@paywithglide/glide-react 0.0.41 → 0.0.43

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.
@@ -133,6 +133,7 @@ export type GlideDepositOptions = {
133
133
  showOnrampFirst?: boolean;
134
134
  debitCardAlias?: DebitCardAlias;
135
135
  copyOverrides?: Record<string, string>;
136
+ stableDepositAddressKey?: string;
136
137
  theme?: GlideWidgetTheme;
137
138
  popupsBlocked?: boolean;
138
139
  baseUrl?: string;
@@ -147,6 +148,7 @@ export declare class GlideDeposit {
147
148
  private destroy;
148
149
  private get baseUrl();
149
150
  private get iframe();
151
+ private getSafeInsetBottom;
150
152
  private iframeEventHandler;
151
153
  private openUrl;
152
154
  private createIframe;
package/dist/glide.js CHANGED
@@ -1,31 +1,31 @@
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 W = (s, t, e) => ee(s, typeof t != "symbol" ? t + "" : t, e);
4
- import { useMemo as B } from "react";
5
- function te(s, { strict: t = !0 } = {}) {
1
+ var ee = Object.defineProperty;
2
+ var te = (s, t, e) => t in s ? ee(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var j = (s, t, e) => te(s, typeof t != "symbol" ? t + "" : t, e);
4
+ import { useMemo as G } from "react";
5
+ function se(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 N(s) {
9
- return te(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
8
+ function q(s) {
9
+ return se(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
10
10
  }
11
- const K = "2.21.51";
12
- let G = {
11
+ const N = "2.21.51";
12
+ let L = {
13
13
  getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
14
- version: `viem@${K}`
14
+ version: `viem@${N}`
15
15
  };
16
- class A extends Error {
16
+ class z extends Error {
17
17
  constructor(t, e = {}) {
18
- var a;
18
+ var d;
19
19
  const i = (() => {
20
- var n;
21
- return e.cause instanceof A ? e.cause.details : (n = e.cause) != null && n.message ? e.cause.message : e.details;
22
- })(), o = e.cause instanceof A && e.cause.docsPath || e.docsPath, r = (a = G.getDocsUrl) == null ? void 0 : a.call(G, { ...e, docsPath: o }), p = [
20
+ var a;
21
+ return e.cause instanceof z ? e.cause.details : (a = e.cause) != null && a.message ? e.cause.message : e.details;
22
+ })(), o = e.cause instanceof z && e.cause.docsPath || e.docsPath, r = (d = L.getDocsUrl) == null ? void 0 : d.call(L, { ...e, docsPath: o }), p = [
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
- ...G.version ? [`Version: ${G.version}`] : []
28
+ ...L.version ? [`Version: ${L.version}`] : []
29
29
  ].join(`
30
30
  `);
31
31
  super(p, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
@@ -58,40 +58,40 @@ class A extends Error {
58
58
  configurable: !0,
59
59
  writable: !0,
60
60
  value: "BaseError"
61
- }), this.details = i, this.docsPath = o, 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 = N;
62
62
  }
63
63
  walk(t) {
64
- return F(this, t);
64
+ return V(this, t);
65
65
  }
66
66
  }
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;
67
+ function V(s, t) {
68
+ return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? V(s.cause, t) : t ? null : s;
69
69
  }
70
- class V extends A {
70
+ class F extends z {
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 H(s, { dir: t, size: e = 32 } = {}) {
76
- return typeof s == "string" ? se(s, { dir: t, size: e }) : ie(s, { dir: t, size: e });
75
+ function O(s, { dir: t, size: e = 32 } = {}) {
76
+ return typeof s == "string" ? ie(s, { dir: t, size: e }) : oe(s, { dir: t, size: e });
77
77
  }
78
- function se(s, { dir: t, size: e = 32 } = {}) {
78
+ function ie(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 V({
83
+ throw new F({
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 ie(s, { dir: t, size: e = 32 } = {}) {
90
+ function oe(s, { dir: t, size: e = 32 } = {}) {
91
91
  if (e === null)
92
92
  return s;
93
93
  if (s.length > e)
94
- throw new V({
94
+ throw new F({
95
95
  size: s.length,
96
96
  targetSize: e,
97
97
  type: "bytes"
@@ -103,65 +103,175 @@ function ie(s, { dir: t, size: e = 32 } = {}) {
103
103
  }
104
104
  return i;
105
105
  }
106
- class oe extends A {
106
+ class re extends z {
107
107
  constructor({ max: t, min: e, signed: i, size: o, value: r }) {
108
108
  super(`Number "${r}" is not in safe ${o ? `${o * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${e} to ${t})` : `(above ${e})`}`, { name: "IntegerOutOfRangeError" });
109
109
  }
110
110
  }
111
- class re extends A {
111
+ class ne extends z {
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 q(s, { size: t }) {
117
- if (N(s) > t)
118
- throw new re({
119
- givenSize: N(s),
116
+ function J(s, { size: t }) {
117
+ if (q(s) > t)
118
+ throw new ne({
119
+ givenSize: q(s),
120
120
  maxSize: t
121
121
  });
122
122
  }
123
- const ne = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
124
- function ae(s, t = {}) {
125
- return typeof s == "number" || typeof s == "bigint" ? de(s, t) : typeof s == "string" ? ce(s, t) : typeof s == "boolean" ? pe(s, t) : J(s, t);
123
+ const ae = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
124
+ function de(s, t = {}) {
125
+ return typeof s == "number" || typeof s == "bigint" ? ce(s, t) : typeof s == "string" ? he(s, t) : typeof s == "boolean" ? pe(s, t) : X(s, t);
126
126
  }
127
127
  function pe(s, t = {}) {
128
128
  const e = `0x${Number(s)}`;
129
- return typeof t.size == "number" ? (q(e, { size: t.size }), H(e, { size: t.size })) : e;
129
+ return typeof t.size == "number" ? (J(e, { size: t.size }), O(e, { size: t.size })) : e;
130
130
  }
131
- function J(s, t = {}) {
131
+ function X(s, t = {}) {
132
132
  let e = "";
133
133
  for (let o = 0; o < s.length; o++)
134
- e += ne[s[o]];
134
+ e += ae[s[o]];
135
135
  const i = `0x${e}`;
136
- return typeof t.size == "number" ? (q(i, { size: t.size }), H(i, { dir: "right", size: t.size })) : i;
136
+ return typeof t.size == "number" ? (J(i, { size: t.size }), O(i, { dir: "right", size: t.size })) : i;
137
137
  }
138
- function de(s, t = {}) {
138
+ function ce(s, t = {}) {
139
139
  const { signed: e, size: i } = t, o = BigInt(s);
140
140
  let r;
141
141
  i ? e ? r = (1n << BigInt(i) * 8n - 1n) - 1n : r = 2n ** (BigInt(i) * 8n) - 1n : typeof s == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
142
142
  const p = typeof r == "bigint" && e ? -r - 1n : 0;
143
143
  if (r && o > r || o < p) {
144
- const n = typeof s == "bigint" ? "n" : "";
145
- throw new oe({
146
- max: r ? `${r}${n}` : void 0,
147
- min: `${p}${n}`,
144
+ const a = typeof s == "bigint" ? "n" : "";
145
+ throw new re({
146
+ max: r ? `${r}${a}` : void 0,
147
+ min: `${p}${a}`,
148
148
  signed: e,
149
149
  size: i,
150
- value: `${s}${n}`
150
+ value: `${s}${a}`
151
151
  });
152
152
  }
153
- const a = `0x${(e && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
154
- return i ? H(a, { size: i }) : a;
153
+ const d = `0x${(e && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
154
+ return i ? O(d, { size: i }) : d;
155
155
  }
156
156
  const le = /* @__PURE__ */ new TextEncoder();
157
- function ce(s, t = {}) {
157
+ function he(s, t = {}) {
158
158
  const e = le.encode(s);
159
- return J(e, t);
159
+ return X(e, t);
160
+ }
161
+ let K = !1;
162
+ function ue(s) {
163
+ if (K)
164
+ return;
165
+ K = !0;
166
+ const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), o = (p) => {
167
+ const d = p.detail;
168
+ t.has(d.info.uuid) || t.set(d.info.uuid, d);
169
+ };
170
+ window.addEventListener("eip6963:announceProvider", o), window.dispatchEvent(new Event("eip6963:requestProvider")), window.addEventListener("message", async (p) => {
171
+ var f;
172
+ if (p.origin !== s) return;
173
+ const { type: d, data: a } = p.data;
174
+ switch (d) {
175
+ case "glide:getProviders": {
176
+ const c = Array.from(t.values()).map(
177
+ ({ info: h, provider: l }) => ({
178
+ info: h,
179
+ isConnected: typeof l.isConnected == "boolean" ? l.isConnected : void 0,
180
+ chainId: l.chainId,
181
+ selectedAddress: l.selectedAddress
182
+ })
183
+ ), n = document.getElementById(
184
+ "glide-deposit-iframe"
185
+ );
186
+ n != null && n.contentWindow && n.contentWindow.postMessage(
187
+ {
188
+ type: "glide:providers",
189
+ providers: c
190
+ },
191
+ s
192
+ );
193
+ break;
194
+ }
195
+ case "glide:providerRequest": {
196
+ const { uuid: c, requestId: n, method: h, params: l } = a;
197
+ if (i.has(n))
198
+ return;
199
+ i.set(n, !0);
200
+ const m = t.get(c);
201
+ if (!m) {
202
+ i.delete(n), r(n, { error: "Provider not found" });
203
+ return;
204
+ }
205
+ try {
206
+ const u = await m.provider.request({
207
+ method: h,
208
+ params: l
209
+ });
210
+ i.delete(n), r(n, { result: u });
211
+ } catch (u) {
212
+ i.delete(n), r(n, {
213
+ error: u.message || String(u),
214
+ code: u.code,
215
+ data: u.data
216
+ });
217
+ }
218
+ break;
219
+ }
220
+ case "glide:addEventListener": {
221
+ const { uuid: c, requestId: n, eventName: h } = a, l = t.get(c);
222
+ if (!l || !l.provider.on) {
223
+ r(n, { error: "Provider or method not found" });
224
+ return;
225
+ }
226
+ const m = (...u) => {
227
+ const g = document.getElementById(
228
+ "glide-deposit-iframe"
229
+ );
230
+ g != null && g.contentWindow && g.contentWindow.postMessage(
231
+ {
232
+ type: "glide:providerEvent",
233
+ uuid: c,
234
+ eventName: h,
235
+ args: u
236
+ },
237
+ s
238
+ );
239
+ };
240
+ e.has(c) || e.set(c, /* @__PURE__ */ new Map()), e.get(c).has(h) || e.get(c).set(h, /* @__PURE__ */ new Set()), e.get(c).get(h).add(m), l.provider.on(h, m), r(n, { result: !0 });
241
+ break;
242
+ }
243
+ case "glide:removeEventListener": {
244
+ const { uuid: c, requestId: n, eventName: h } = a, l = t.get(c);
245
+ if (!l || !l.provider.removeListener) {
246
+ r(n, { error: "Provider or method not found" });
247
+ return;
248
+ }
249
+ const m = (f = e.get(c)) == null ? void 0 : f.get(h);
250
+ m && (m.forEach((u) => {
251
+ l.provider.removeListener(h, u);
252
+ }), m.clear()), r(n, { result: !0 });
253
+ break;
254
+ }
255
+ }
256
+ });
257
+ function r(p, d) {
258
+ const a = document.getElementById(
259
+ "glide-deposit-iframe"
260
+ );
261
+ a != null && a.contentWindow && a.contentWindow.postMessage(
262
+ {
263
+ type: "glide:providerResponse",
264
+ requestId: p,
265
+ ...d
266
+ },
267
+ s
268
+ );
269
+ }
160
270
  }
161
- class O {
271
+ class H {
162
272
  constructor(t) {
163
- W(this, "opts");
164
- W(this, "open", () => {
273
+ j(this, "opts");
274
+ j(this, "open", () => {
165
275
  if (!(!this.opts.container && document.body.classList.contains("glide-deposit-open"))) {
166
276
  if (this.opts.container || document.body.classList.add("glide-deposit-open"), (this.opts.mode === "deposit" || this.opts.mode === "buy") && !this.opts.recipient)
167
277
  throw new Error("recipient is required for deposit/buy mode");
@@ -172,21 +282,21 @@ class O {
172
282
  this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
173
283
  }
174
284
  });
175
- W(this, "iframeEventHandler", async (t) => {
176
- var i, o, r, p, a, n, d, g, f, y, w, b, $, l, v, c, S, h, x, u, I, U, E, k, M, C, P, T, D, j, R, z, L;
285
+ j(this, "iframeEventHandler", async (t) => {
286
+ var i, o, r, p, d, a, f, c, n, h, l, m, u, g, $, y, I, w, x, v, S, E, U, M, C, k, P, D, T, R, B, W, A;
177
287
  const e = t.data;
178
288
  switch (e.type) {
179
289
  case "sendInit": {
180
- const m = 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 || !!((p = this.opts.walletProvider) != null && p.signTypedDataAsync);
181
- (d = (a = this.iframe) == null ? void 0 : a.contentWindow) == null || d.postMessage(
290
+ const b = this.opts.recipient, Q = (i = this.opts.walletProvider) == null ? void 0 : i.address, Y = (o = this.opts.walletProvider) == null ? void 0 : o.availableChainIds, Z = (r = this.opts.walletProvider) == null ? void 0 : r.currentChainId, _ = this.opts.preferGaslessPayment || !!((p = this.opts.walletProvider) != null && p.signTypedDataAsync);
291
+ (f = (d = this.iframe) == null ? void 0 : d.contentWindow) == null || f.postMessage(
182
292
  {
183
293
  type: "initialize",
184
294
  sessionId: this.opts.sessionId,
185
- recipient: m,
186
- connectedWalletAddress: X,
187
- availableChainIds: Q,
188
- currentChainId: Y,
189
- preferGaslessPayment: Z,
295
+ recipient: b,
296
+ connectedWalletAddress: Q,
297
+ availableChainIds: Y,
298
+ currentChainId: Z,
299
+ preferGaslessPayment: _,
190
300
  chainIds: this.opts.chainIds,
191
301
  excludeChainIds: this.opts.excludeChainIds,
192
302
  excludeCurrencyTiers: this.opts.excludeCurrencyTiers,
@@ -210,9 +320,11 @@ class O {
210
320
  showOnrampFirst: this.opts.showOnrampFirst,
211
321
  debitCardAlias: this.opts.debitCardAlias,
212
322
  copyOverrides: this.opts.copyOverrides,
323
+ stableDepositAddressKey: this.opts.stableDepositAddressKey,
213
324
  theme: {
214
325
  ...this.opts.theme || {},
215
- colorScheme: ((n = this.opts.theme) == null ? void 0 : n.colorScheme) || getComputedStyle(document.documentElement).colorScheme || ""
326
+ colorScheme: ((a = this.opts.theme) == null ? void 0 : a.colorScheme) || getComputedStyle(document.documentElement).colorScheme || "",
327
+ safeInsetBottom: this.getSafeInsetBottom()
216
328
  },
217
329
  didProvideLocalStorage: !!this.opts.localStorageProvider,
218
330
  debug: this.opts.debug,
@@ -224,17 +336,17 @@ class O {
224
336
  break;
225
337
  }
226
338
  case "didOpen": {
227
- this.iframe.style.opacity = "1", (f = (g = this.opts).onOpen) == null || f.call(g);
339
+ this.iframe.style.opacity = "1", (n = (c = this.opts).onOpen) == null || n.call(c);
228
340
  break;
229
341
  }
230
342
  case "localStorage.getKeys": {
231
343
  if (!this.opts.localStorageProvider)
232
344
  throw new Error("localStorageProvider is not set");
233
- const m = await this.opts.localStorageProvider.getKeys();
234
- (w = (y = this.iframe) == null ? void 0 : y.contentWindow) == null || w.postMessage(
345
+ const b = await this.opts.localStorageProvider.getKeys();
346
+ (l = (h = this.iframe) == null ? void 0 : h.contentWindow) == null || l.postMessage(
235
347
  {
236
348
  type: "localStorage.didGetKeys",
237
- keys: m
349
+ keys: b
238
350
  },
239
351
  this.baseUrl
240
352
  );
@@ -256,25 +368,25 @@ class O {
256
368
  case "localStorage.getItem": {
257
369
  if (!this.opts.localStorageProvider)
258
370
  throw new Error("localStorageProvider is not set");
259
- const m = await this.opts.localStorageProvider.getItem(e.key);
260
- ($ = (b = this.iframe) == null ? void 0 : b.contentWindow) == null || $.postMessage(
371
+ const b = await this.opts.localStorageProvider.getItem(e.key);
372
+ (u = (m = this.iframe) == null ? void 0 : m.contentWindow) == null || u.postMessage(
261
373
  {
262
374
  type: "localStorage.didGetItem",
263
375
  key: e.key,
264
- value: m
376
+ value: b
265
377
  },
266
378
  this.baseUrl
267
379
  );
268
380
  break;
269
381
  }
270
382
  case "success":
271
- (v = (l = this.opts) == null ? void 0 : l.onSuccess) == null || v.call(l, e.hash, e.session);
383
+ ($ = (g = this.opts) == null ? void 0 : g.onSuccess) == null || $.call(g, e.hash, e.session);
272
384
  break;
273
385
  case "close":
274
- this.removeIframe(), this.destroy(), (S = (c = this.opts) == null ? void 0 : c.onClose) == null || S.call(c);
386
+ this.removeIframe(), this.destroy(), (I = (y = this.opts) == null ? void 0 : y.onClose) == null || I.call(y);
275
387
  break;
276
388
  case "setMode":
277
- (x = (h = this.opts) == null ? void 0 : h.onSetMode) == null || x.call(h, e.mode);
389
+ (x = (w = this.opts) == null ? void 0 : w.onSetMode) == null || x.call(w, e.mode);
278
390
  break;
279
391
  case "switchChain":
280
392
  if (!this.opts.walletProvider)
@@ -282,7 +394,7 @@ class O {
282
394
  try {
283
395
  await this.opts.walletProvider.switchChainAsync({
284
396
  chainId: e.chainId
285
- }), (I = (u = this.iframe) == null ? void 0 : u.contentWindow) == null || I.postMessage(
397
+ }), (S = (v = this.iframe) == null ? void 0 : v.contentWindow) == null || S.postMessage(
286
398
  {
287
399
  type: "didSwitchChain",
288
400
  success: !0,
@@ -290,12 +402,12 @@ class O {
290
402
  },
291
403
  this.baseUrl
292
404
  );
293
- } catch (m) {
294
- (E = (U = this.iframe) == null ? void 0 : U.contentWindow) == null || E.postMessage(
405
+ } catch (b) {
406
+ (U = (E = this.iframe) == null ? void 0 : E.contentWindow) == null || U.postMessage(
295
407
  {
296
408
  type: "didSwitchChain",
297
409
  success: !1,
298
- error: m
410
+ error: b
299
411
  },
300
412
  this.baseUrl
301
413
  );
@@ -306,23 +418,23 @@ class O {
306
418
  if (!this.opts.walletProvider)
307
419
  throw new Error("walletProvider is not set");
308
420
  try {
309
- const m = await this.opts.walletProvider.sendTransactionAsync(
421
+ const b = await this.opts.walletProvider.sendTransactionAsync(
310
422
  e.tx
311
423
  );
312
- (M = (k = this.iframe) == null ? void 0 : k.contentWindow) == null || M.postMessage(
424
+ (C = (M = this.iframe) == null ? void 0 : M.contentWindow) == null || C.postMessage(
313
425
  {
314
426
  type: "didSendTransaction",
315
427
  success: !0,
316
- txHash: m
428
+ txHash: b
317
429
  },
318
430
  this.baseUrl
319
431
  );
320
- } catch (m) {
321
- (P = (C = this.iframe) == null ? void 0 : C.contentWindow) == null || P.postMessage(
432
+ } catch (b) {
433
+ (P = (k = this.iframe) == null ? void 0 : k.contentWindow) == null || P.postMessage(
322
434
  {
323
435
  type: "didSendTransaction",
324
436
  success: !1,
325
- error: m
437
+ error: b
326
438
  },
327
439
  this.baseUrl
328
440
  );
@@ -334,7 +446,7 @@ class O {
334
446
  if (!this.opts.walletProvider)
335
447
  throw new Error("walletProvider is not set");
336
448
  if (!this.opts.walletProvider.signTypedDataAsync) {
337
- (D = (T = this.iframe) == null ? void 0 : T.contentWindow) == null || D.postMessage(
449
+ (T = (D = this.iframe) == null ? void 0 : D.contentWindow) == null || T.postMessage(
338
450
  {
339
451
  type: "didSignTypedData",
340
452
  success: !1,
@@ -345,23 +457,23 @@ class O {
345
457
  return;
346
458
  }
347
459
  try {
348
- const m = await this.opts.walletProvider.signTypedDataAsync(
460
+ const b = await this.opts.walletProvider.signTypedDataAsync(
349
461
  e.data
350
462
  );
351
- (R = (j = this.iframe) == null ? void 0 : j.contentWindow) == null || R.postMessage(
463
+ (B = (R = this.iframe) == null ? void 0 : R.contentWindow) == null || B.postMessage(
352
464
  {
353
465
  type: "didSignTypedData",
354
466
  success: !0,
355
- signature: m
467
+ signature: b
356
468
  },
357
469
  this.baseUrl
358
470
  );
359
- } catch (m) {
360
- (L = (z = this.iframe) == null ? void 0 : z.contentWindow) == null || L.postMessage(
471
+ } catch (b) {
472
+ (A = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || A.postMessage(
361
473
  {
362
474
  type: "didSignTypedData",
363
475
  success: !1,
364
- error: m
476
+ error: b
365
477
  },
366
478
  this.baseUrl
367
479
  );
@@ -373,13 +485,15 @@ class O {
373
485
  this.opts = t;
374
486
  }
375
487
  get externalUrl() {
376
- var t, e, i, o, r, p, a, n, d;
377
- 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(
488
+ var t, e, i, o, r, p, d, a, f;
489
+ 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=${de(
378
490
  this.opts.evm.value || 0n
379
- )}` : ""}${this.opts.approval ? `&approval.token=${this.opts.approval.token}&approval.amount=${this.opts.approval.amount}` : ""}${this.opts.sessionMetadata ? `&metadata=${this.opts.sessionMetadata}` : ""}${this.opts.autoCloseOnSuccess ? "&autoCloseOnSuccess=true" : ""}${this.opts.sessionId ? `&sessionId=${this.opts.sessionId}` : ""}${(t = this.opts.chainIds) != null && t.length ? `&chainIds=${this.opts.chainIds.join(",")}` : ""}${(e = this.opts.excludeChainIds) != null && e.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(i = this.opts.excludeCurrencyTiers) != null && i.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(o = this.opts.excludeFundingSources) != null && o.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${(r = this.opts.fundingSources) != null && r.length ? `&fundingSources=${this.opts.fundingSources.join(",")}` : ""}${(p = this.opts.allowedPaymentCurrencies) != null && p.length ? `&allowedPaymentCurrencies=${this.opts.allowedPaymentCurrencies.join(",")}` : ""}${(a = this.opts.appMetadata) != null && a.name ? `&appMetadata.name=${encodeURIComponent(this.opts.appMetadata.name)}` : ""}${(n = this.opts.appMetadata) != null && n.logoUrl ? `&appMetadata.logoUrl=${encodeURIComponent(this.opts.appMetadata.logoUrl)}` : ""}${(d = this.opts.appMetadata) != null && d.faviconUrl ? `&appMetadata.faviconUrl=${encodeURIComponent(this.opts.appMetadata.faviconUrl)}` : ""}${this.opts.enableRefundEmails ? "&enableRefundEmails=true" : ""}${this.opts.payerEmail ? `&payerEmail=${encodeURIComponent(this.opts.payerEmail)}` : ""}${this.opts.debug ? "&debug=true" : ""}${this.opts.popupsBlocked ? "&popupsBlocked=true" : ""}${this.opts.disableWithdrawToSelfSuggestion ? "&disableWithdrawToSelfSuggestion=true" : ""}${this.opts.hideSettlementCopy ? "&hideSettlementCopy=true" : ""}${this.opts.showAppLogo ? `&showAppLogo=${this.opts.showAppLogo}` : ""}${this.opts.showOnrampFirst ? "&showOnrampFirst=true" : ""}${this.opts.debitCardAlias ? `&debitCardAlias=${this.opts.debitCardAlias}` : ""}${this.opts.copyOverrides ? `&copyOverrides=${encodeURIComponent(JSON.stringify(this.opts.copyOverrides))}` : ""}${this.opts.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
491
+ )}` : ""}${this.opts.approval ? `&approval.token=${this.opts.approval.token}&approval.amount=${this.opts.approval.amount}` : ""}${this.opts.sessionMetadata ? `&metadata=${this.opts.sessionMetadata}` : ""}${this.opts.autoCloseOnSuccess ? "&autoCloseOnSuccess=true" : ""}${this.opts.sessionId ? `&sessionId=${this.opts.sessionId}` : ""}${(t = this.opts.chainIds) != null && t.length ? `&chainIds=${this.opts.chainIds.join(",")}` : ""}${(e = this.opts.excludeChainIds) != null && e.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(i = this.opts.excludeCurrencyTiers) != null && i.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(o = this.opts.excludeFundingSources) != null && o.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${(r = this.opts.fundingSources) != null && r.length ? `&fundingSources=${this.opts.fundingSources.join(",")}` : ""}${(p = this.opts.allowedPaymentCurrencies) != null && p.length ? `&allowedPaymentCurrencies=${this.opts.allowedPaymentCurrencies.join(",")}` : ""}${(d = this.opts.appMetadata) != null && d.name ? `&appMetadata.name=${encodeURIComponent(this.opts.appMetadata.name)}` : ""}${(a = this.opts.appMetadata) != null && a.logoUrl ? `&appMetadata.logoUrl=${encodeURIComponent(this.opts.appMetadata.logoUrl)}` : ""}${(f = this.opts.appMetadata) != null && f.faviconUrl ? `&appMetadata.faviconUrl=${encodeURIComponent(this.opts.appMetadata.faviconUrl)}` : ""}${this.opts.enableRefundEmails ? "&enableRefundEmails=true" : ""}${this.opts.payerEmail ? `&payerEmail=${encodeURIComponent(this.opts.payerEmail)}` : ""}${this.opts.debug ? "&debug=true" : ""}${this.opts.popupsBlocked ? "&popupsBlocked=true" : ""}${this.opts.disableWithdrawToSelfSuggestion ? "&disableWithdrawToSelfSuggestion=true" : ""}${this.opts.hideSettlementCopy ? "&hideSettlementCopy=true" : ""}${this.opts.showAppLogo ? `&showAppLogo=${this.opts.showAppLogo}` : ""}${this.opts.showOnrampFirst ? "&showOnrampFirst=true" : ""}${this.opts.debitCardAlias ? `&debitCardAlias=${this.opts.debitCardAlias}` : ""}${this.opts.copyOverrides ? `&copyOverrides=${encodeURIComponent(JSON.stringify(this.opts.copyOverrides))}` : ""}${this.opts.stableDepositAddressKey ? `&stableDepositAddressKey=${encodeURIComponent(this.opts.stableDepositAddressKey)}` : ""}${this.opts.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
380
492
  }
381
493
  initialize() {
382
494
  window.addEventListener("message", this.iframeEventHandler);
495
+ const t = new URL(this.baseUrl).origin;
496
+ ue(t);
383
497
  }
384
498
  destroy() {
385
499
  window.removeEventListener("message", this.iframeEventHandler);
@@ -390,6 +504,18 @@ class O {
390
504
  get iframe() {
391
505
  return document.getElementById("glide-deposit-iframe");
392
506
  }
507
+ getSafeInsetBottom() {
508
+ if (typeof window > "u" || typeof document > "u")
509
+ return 0;
510
+ try {
511
+ const t = document.createElement("div");
512
+ t.style.cssText = "position: fixed; bottom: 0; left: 0; width: 1px; height: 1px; padding: 0; margin: 0; padding-bottom: env(safe-area-inset-bottom, 0px); visibility: hidden; pointer-events: none; z-index: -1;", document.body.appendChild(t);
513
+ const e = window.getComputedStyle(t).paddingBottom;
514
+ return document.body.removeChild(t), parseFloat(e) || 0;
515
+ } catch {
516
+ return 0;
517
+ }
518
+ }
393
519
  openUrl(t) {
394
520
  this.createIframe(t);
395
521
  }
@@ -411,7 +537,7 @@ class O {
411
537
  t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
412
538
  }
413
539
  }
414
- const me = ({
540
+ const fe = ({
415
541
  app: s,
416
542
  recipient: t,
417
543
  chainId: e,
@@ -419,35 +545,36 @@ const me = ({
419
545
  amount: o,
420
546
  gasRefuelAmountPerChain: r,
421
547
  preferGaslessPayment: p,
422
- chainIds: a,
423
- excludeChainIds: n,
424
- excludeCurrencyTiers: d,
425
- excludeFundingSources: g,
426
- fundingSources: f,
427
- appMetadata: y,
428
- enableRefundEmails: w,
429
- payerEmail: b,
430
- mode: $,
431
- hideSettlementCopy: l,
432
- showAppLogo: v,
433
- showOnrampFirst: c,
434
- debitCardAlias: S,
435
- copyOverrides: h,
436
- sessionId: x,
437
- sessionMetadata: u,
438
- disableWithdrawToSelfSuggestion: I,
548
+ chainIds: d,
549
+ excludeChainIds: a,
550
+ excludeCurrencyTiers: f,
551
+ excludeFundingSources: c,
552
+ fundingSources: n,
553
+ appMetadata: h,
554
+ enableRefundEmails: l,
555
+ payerEmail: m,
556
+ mode: u,
557
+ hideSettlementCopy: g,
558
+ showAppLogo: $,
559
+ showOnrampFirst: y,
560
+ debitCardAlias: I,
561
+ copyOverrides: w,
562
+ stableDepositAddressKey: x,
563
+ sessionId: v,
564
+ sessionMetadata: S,
565
+ disableWithdrawToSelfSuggestion: E,
439
566
  theme: U,
440
- walletProvider: E,
441
- localStorageProvider: k,
442
- onOpen: M,
443
- onSuccess: C,
444
- onClose: P,
567
+ walletProvider: M,
568
+ localStorageProvider: C,
569
+ onOpen: k,
570
+ onSuccess: P,
571
+ onClose: D,
445
572
  autoCloseOnSuccess: T,
446
- popupsBlocked: D,
447
- baseUrl: j,
448
- debug: R
573
+ popupsBlocked: R,
574
+ baseUrl: B,
575
+ debug: W
449
576
  }) => {
450
- const z = B(() => new O({
577
+ const A = G(() => new H({
451
578
  app: s,
452
579
  recipient: t,
453
580
  chainId: e,
@@ -455,33 +582,34 @@ const me = ({
455
582
  amount: o,
456
583
  gasRefuelAmountPerChain: r,
457
584
  preferGaslessPayment: p,
458
- chainIds: a,
459
- excludeChainIds: n,
460
- excludeCurrencyTiers: d,
461
- excludeFundingSources: g,
462
- fundingSources: f,
463
- appMetadata: y,
464
- enableRefundEmails: w,
465
- payerEmail: b,
466
- mode: $,
467
- hideSettlementCopy: l,
468
- showAppLogo: v,
469
- showOnrampFirst: c,
470
- debitCardAlias: S,
471
- copyOverrides: h,
472
- sessionId: x,
473
- sessionMetadata: u,
474
- disableWithdrawToSelfSuggestion: I,
585
+ chainIds: d,
586
+ excludeChainIds: a,
587
+ excludeCurrencyTiers: f,
588
+ excludeFundingSources: c,
589
+ fundingSources: n,
590
+ appMetadata: h,
591
+ enableRefundEmails: l,
592
+ payerEmail: m,
593
+ mode: u,
594
+ hideSettlementCopy: g,
595
+ showAppLogo: $,
596
+ showOnrampFirst: y,
597
+ debitCardAlias: I,
598
+ copyOverrides: w,
599
+ stableDepositAddressKey: x,
600
+ sessionId: v,
601
+ sessionMetadata: S,
602
+ disableWithdrawToSelfSuggestion: E,
475
603
  theme: U,
476
- walletProvider: E,
477
- localStorageProvider: k,
478
- onOpen: M,
479
- onSuccess: C,
480
- onClose: P,
604
+ walletProvider: M,
605
+ localStorageProvider: C,
606
+ onOpen: k,
607
+ onSuccess: P,
608
+ onClose: D,
481
609
  autoCloseOnSuccess: T,
482
- popupsBlocked: D,
483
- baseUrl: j,
484
- debug: R
610
+ popupsBlocked: R,
611
+ baseUrl: B,
612
+ debug: W
485
613
  }), [
486
614
  s,
487
615
  t,
@@ -490,40 +618,41 @@ const me = ({
490
618
  o,
491
619
  r,
492
620
  p,
621
+ d,
493
622
  a,
623
+ f,
624
+ c,
494
625
  n,
495
- d,
626
+ h,
627
+ l,
628
+ m,
629
+ u,
496
630
  g,
497
- f,
631
+ $,
498
632
  y,
633
+ I,
499
634
  w,
500
- b,
501
- $,
502
- l,
635
+ x,
503
636
  v,
504
- c,
505
637
  S,
506
- h,
507
- x,
508
- u,
509
- I,
510
- U,
511
638
  E,
512
- k,
639
+ U,
513
640
  M,
514
641
  C,
642
+ k,
515
643
  P,
516
- T,
517
644
  D,
518
- j,
519
- R
645
+ T,
646
+ R,
647
+ B,
648
+ W
520
649
  ]);
521
650
  return {
522
- openGlideDeposit: z.open,
523
- externalUrl: z.externalUrl,
524
- opts: z.opts
651
+ openGlideDeposit: A.open,
652
+ externalUrl: A.externalUrl,
653
+ opts: A.opts
525
654
  };
526
- }, ge = ({
655
+ }, ye = ({
527
656
  app: s,
528
657
  preferGaslessPayment: t,
529
658
  chainIds: e,
@@ -531,30 +660,30 @@ const me = ({
531
660
  excludeCurrencyTiers: o,
532
661
  excludeFundingSources: r,
533
662
  fundingSources: p,
534
- allowedPaymentCurrencies: a,
535
- appMetadata: n,
536
- enableRefundEmails: d,
537
- payerEmail: g,
538
- hideSettlementCopy: f,
539
- showAppLogo: y,
540
- showOnrampFirst: w,
541
- debitCardAlias: b,
542
- copyOverrides: $,
543
- amount: l,
544
- sessionId: v,
545
- sessionMetadata: c,
546
- theme: S,
547
- walletProvider: h,
663
+ allowedPaymentCurrencies: d,
664
+ appMetadata: a,
665
+ enableRefundEmails: f,
666
+ payerEmail: c,
667
+ hideSettlementCopy: n,
668
+ showAppLogo: h,
669
+ showOnrampFirst: l,
670
+ debitCardAlias: m,
671
+ copyOverrides: u,
672
+ amount: g,
673
+ sessionId: $,
674
+ sessionMetadata: y,
675
+ theme: I,
676
+ walletProvider: w,
548
677
  localStorageProvider: x,
549
- onOpen: u,
550
- onSuccess: I,
551
- onClose: U,
552
- autoCloseOnSuccess: E,
553
- popupsBlocked: k,
554
- baseUrl: M,
555
- debug: C
678
+ onOpen: v,
679
+ onSuccess: S,
680
+ onClose: E,
681
+ autoCloseOnSuccess: U,
682
+ popupsBlocked: M,
683
+ baseUrl: C,
684
+ debug: k
556
685
  }) => {
557
- const P = B(() => new O({
686
+ const P = G(() => new H({
558
687
  app: s,
559
688
  preferGaslessPayment: t,
560
689
  chainIds: e,
@@ -562,29 +691,29 @@ const me = ({
562
691
  excludeCurrencyTiers: o,
563
692
  excludeFundingSources: r,
564
693
  fundingSources: p,
565
- allowedPaymentCurrencies: a,
566
- appMetadata: n,
567
- enableRefundEmails: d,
568
- payerEmail: g,
694
+ allowedPaymentCurrencies: d,
695
+ appMetadata: a,
696
+ enableRefundEmails: f,
697
+ payerEmail: c,
569
698
  mode: "pay",
570
- hideSettlementCopy: f,
571
- showAppLogo: y,
572
- showOnrampFirst: w,
573
- debitCardAlias: b,
574
- copyOverrides: $,
575
- sessionId: v,
576
- amount: l,
577
- sessionMetadata: c,
578
- theme: S,
579
- walletProvider: h,
699
+ hideSettlementCopy: n,
700
+ showAppLogo: h,
701
+ showOnrampFirst: l,
702
+ debitCardAlias: m,
703
+ copyOverrides: u,
704
+ sessionId: $,
705
+ amount: g,
706
+ sessionMetadata: y,
707
+ theme: I,
708
+ walletProvider: w,
580
709
  localStorageProvider: x,
581
- onOpen: u,
582
- onSuccess: I,
583
- onClose: U,
584
- autoCloseOnSuccess: E,
585
- popupsBlocked: k,
586
- baseUrl: M,
587
- debug: C
710
+ onOpen: v,
711
+ onSuccess: S,
712
+ onClose: E,
713
+ autoCloseOnSuccess: U,
714
+ popupsBlocked: M,
715
+ baseUrl: C,
716
+ debug: k
588
717
  }), [
589
718
  s,
590
719
  t,
@@ -593,35 +722,35 @@ const me = ({
593
722
  o,
594
723
  r,
595
724
  p,
725
+ d,
596
726
  a,
727
+ f,
728
+ c,
597
729
  n,
598
- d,
730
+ h,
731
+ l,
732
+ m,
733
+ u,
734
+ $,
599
735
  g,
600
- f,
601
736
  y,
737
+ I,
602
738
  w,
603
- b,
604
- $,
739
+ x,
605
740
  v,
606
- l,
607
- c,
608
741
  S,
609
- h,
610
- x,
611
- u,
612
- I,
613
- U,
614
742
  E,
615
- k,
743
+ U,
616
744
  M,
617
- C
745
+ C,
746
+ k
618
747
  ]);
619
748
  return {
620
749
  openGlidePay: P.open,
621
750
  externalUrl: P.externalUrl,
622
751
  opts: P.opts
623
752
  };
624
- }, fe = ({
753
+ }, we = ({
625
754
  app: s,
626
755
  evm: t,
627
756
  approval: e,
@@ -629,24 +758,24 @@ const me = ({
629
758
  chainIds: o,
630
759
  excludeChainIds: r,
631
760
  excludeCurrencyTiers: p,
632
- excludeFundingSources: a,
633
- sessionMetadata: n,
634
- showAppLogo: d,
635
- showOnrampFirst: g,
636
- debitCardAlias: f,
637
- copyOverrides: y,
638
- theme: w,
639
- walletProvider: b,
640
- localStorageProvider: $,
641
- onOpen: l,
642
- onSuccess: v,
643
- onClose: c,
644
- autoCloseOnSuccess: S,
645
- popupsBlocked: h,
761
+ excludeFundingSources: d,
762
+ sessionMetadata: a,
763
+ showAppLogo: f,
764
+ showOnrampFirst: c,
765
+ debitCardAlias: n,
766
+ copyOverrides: h,
767
+ theme: l,
768
+ walletProvider: m,
769
+ localStorageProvider: u,
770
+ onOpen: g,
771
+ onSuccess: $,
772
+ onClose: y,
773
+ autoCloseOnSuccess: I,
774
+ popupsBlocked: w,
646
775
  baseUrl: x,
647
- debug: u
776
+ debug: v
648
777
  }) => {
649
- const I = B(() => new O({
778
+ const S = G(() => new H({
650
779
  app: s,
651
780
  evm: t,
652
781
  approval: e,
@@ -654,23 +783,23 @@ const me = ({
654
783
  chainIds: o,
655
784
  excludeChainIds: r,
656
785
  excludeCurrencyTiers: p,
657
- excludeFundingSources: a,
658
- sessionMetadata: n,
659
- showAppLogo: d,
660
- showOnrampFirst: g,
661
- debitCardAlias: f,
662
- copyOverrides: y,
786
+ excludeFundingSources: d,
787
+ sessionMetadata: a,
788
+ showAppLogo: f,
789
+ showOnrampFirst: c,
790
+ debitCardAlias: n,
791
+ copyOverrides: h,
663
792
  mode: "call",
664
- theme: w,
665
- walletProvider: b,
666
- localStorageProvider: $,
667
- onOpen: l,
668
- onSuccess: v,
669
- onClose: c,
670
- autoCloseOnSuccess: S,
671
- popupsBlocked: h,
793
+ theme: l,
794
+ walletProvider: m,
795
+ localStorageProvider: u,
796
+ onOpen: g,
797
+ onSuccess: $,
798
+ onClose: y,
799
+ autoCloseOnSuccess: I,
800
+ popupsBlocked: w,
672
801
  baseUrl: x,
673
- debug: u
802
+ debug: v
674
803
  }), [
675
804
  s,
676
805
  t,
@@ -679,29 +808,29 @@ const me = ({
679
808
  o,
680
809
  r,
681
810
  p,
811
+ d,
682
812
  a,
813
+ f,
814
+ c,
683
815
  n,
684
- d,
816
+ h,
817
+ l,
818
+ m,
819
+ u,
685
820
  g,
686
- f,
821
+ $,
687
822
  y,
823
+ I,
688
824
  w,
689
- b,
690
- $,
691
- l,
692
- v,
693
- c,
694
- S,
695
- h,
696
825
  x,
697
- u
826
+ v
698
827
  ]);
699
828
  return {
700
- openGlideCall: I.open,
701
- externalUrl: I.externalUrl,
702
- opts: I.opts
829
+ openGlideCall: S.open,
830
+ externalUrl: S.externalUrl,
831
+ opts: S.opts
703
832
  };
704
- }, ye = ({
833
+ }, ve = ({
705
834
  app: s,
706
835
  recipient: t,
707
836
  chainId: e,
@@ -709,23 +838,23 @@ const me = ({
709
838
  preferGaslessPayment: o,
710
839
  chainIds: r,
711
840
  excludeChainIds: p,
712
- excludeCurrencyTiers: a,
713
- excludeFundingSources: n,
714
- sessionMetadata: d,
715
- showAppLogo: g,
716
- showOnrampFirst: f,
717
- debitCardAlias: y,
718
- copyOverrides: w,
719
- theme: b,
720
- walletProvider: $,
721
- localStorageProvider: l,
722
- onOpen: v,
723
- onSuccess: c,
724
- onClose: S,
725
- autoCloseOnSuccess: h,
841
+ excludeCurrencyTiers: d,
842
+ excludeFundingSources: a,
843
+ sessionMetadata: f,
844
+ showAppLogo: c,
845
+ showOnrampFirst: n,
846
+ debitCardAlias: h,
847
+ copyOverrides: l,
848
+ theme: m,
849
+ walletProvider: u,
850
+ localStorageProvider: g,
851
+ onOpen: $,
852
+ onSuccess: y,
853
+ onClose: I,
854
+ autoCloseOnSuccess: w,
726
855
  baseUrl: x
727
856
  }) => {
728
- const u = B(() => new O({
857
+ const v = G(() => new H({
729
858
  app: s,
730
859
  recipient: t,
731
860
  chainId: e,
@@ -733,21 +862,21 @@ const me = ({
733
862
  preferGaslessPayment: o,
734
863
  chainIds: r,
735
864
  excludeChainIds: p,
736
- excludeCurrencyTiers: a,
737
- excludeFundingSources: n,
738
- sessionMetadata: d,
739
- showAppLogo: g,
740
- showOnrampFirst: f,
741
- debitCardAlias: y,
742
- copyOverrides: w,
865
+ excludeCurrencyTiers: d,
866
+ excludeFundingSources: a,
867
+ sessionMetadata: f,
868
+ showAppLogo: c,
869
+ showOnrampFirst: n,
870
+ debitCardAlias: h,
871
+ copyOverrides: l,
743
872
  mode: "buy",
744
- theme: b,
745
- walletProvider: $,
746
- localStorageProvider: l,
747
- onOpen: v,
748
- onSuccess: c,
749
- onClose: S,
750
- autoCloseOnSuccess: h,
873
+ theme: m,
874
+ walletProvider: u,
875
+ localStorageProvider: g,
876
+ onOpen: $,
877
+ onSuccess: y,
878
+ onClose: I,
879
+ autoCloseOnSuccess: w,
751
880
  baseUrl: x
752
881
  }), [
753
882
  s,
@@ -757,28 +886,28 @@ const me = ({
757
886
  o,
758
887
  r,
759
888
  p,
889
+ d,
760
890
  a,
891
+ f,
892
+ c,
761
893
  n,
762
- d,
894
+ h,
895
+ l,
896
+ m,
897
+ u,
763
898
  g,
764
- f,
899
+ $,
765
900
  y,
901
+ I,
766
902
  w,
767
- b,
768
- $,
769
- l,
770
- v,
771
- c,
772
- S,
773
- h,
774
903
  x
775
904
  ]);
776
905
  return {
777
- openGlideBuy: u.open,
778
- externalUrl: u.externalUrl,
779
- opts: u.opts
906
+ openGlideBuy: v.open,
907
+ externalUrl: v.externalUrl,
908
+ opts: v.opts
780
909
  };
781
- }, we = Object.freeze({
910
+ }, be = Object.freeze({
782
911
  getItem: (s) => new Promise((t, e) => {
783
912
  try {
784
913
  const i = localStorage.getItem(s);
@@ -811,10 +940,11 @@ const me = ({
811
940
  })
812
941
  });
813
942
  export {
814
- O as GlideDeposit,
815
- we as browserLocalStorageProvider,
816
- ye as useGlideBuy,
817
- fe as useGlideCall,
818
- me as useGlideDeposit,
819
- ge as useGlidePay
943
+ H as GlideDeposit,
944
+ be as browserLocalStorageProvider,
945
+ ue as initializeParentBridge,
946
+ ve as useGlideBuy,
947
+ we as useGlideCall,
948
+ fe as useGlideDeposit,
949
+ ye as useGlidePay
820
950
  };
package/dist/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from './useGlideCall.ts';
5
5
  export * from './useGlideBuy.ts';
6
6
  export * from './theme.ts';
7
7
  export * from './browserLocalStorageProvider.ts';
8
+ export * from './walletProviderBridge.ts';
package/dist/theme.d.ts CHANGED
@@ -30,4 +30,5 @@ export type GlideWidgetTheme = {
30
30
  colorAlertWarningAccent?: string;
31
31
  colorAlertBorder?: string;
32
32
  appLogoHeight?: string;
33
+ safeInsetBottom?: number;
33
34
  };
@@ -28,6 +28,7 @@ interface UseGlideDepositProps {
28
28
  showOnrampFirst?: boolean;
29
29
  debitCardAlias?: DebitCardAlias;
30
30
  copyOverrides?: Record<string, string>;
31
+ stableDepositAddressKey?: string;
31
32
  sessionId?: string;
32
33
  sessionMetadata?: string;
33
34
  disableWithdrawToSelfSuggestion?: boolean;
@@ -42,7 +43,7 @@ interface UseGlideDepositProps {
42
43
  baseUrl?: string;
43
44
  debug?: boolean;
44
45
  }
45
- export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, appMetadata, enableRefundEmails, payerEmail, mode, hideSettlementCopy, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, sessionId, sessionMetadata, disableWithdrawToSelfSuggestion, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
46
+ export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, appMetadata, enableRefundEmails, payerEmail, mode, hideSettlementCopy, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, stableDepositAddressKey, sessionId, sessionMetadata, disableWithdrawToSelfSuggestion, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
46
47
  openGlideDeposit: () => void;
47
48
  externalUrl: string;
48
49
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Wallet Provider Bridge for Parent Window (glide-react)
3
+ *
4
+ * This module detects wallet providers (including Rainbow) in the parent window
5
+ * and creates a message bridge to make them available in the iframe.
6
+ *
7
+ * Since Rainbow and some other wallets don't inject into iframes for security,
8
+ * this bridge proxies all EIP-1193 provider calls between parent and iframe.
9
+ */
10
+ export interface EIP1193Provider {
11
+ request(args: {
12
+ method: string;
13
+ params?: unknown[] | Record<string, unknown>;
14
+ }): Promise<unknown>;
15
+ on?(event: string, listener: (...args: unknown[]) => void): void;
16
+ removeListener?(event: string, listener: (...args: unknown[]) => void): void;
17
+ }
18
+ export interface EIP6963ProviderInfo {
19
+ uuid: string;
20
+ name: string;
21
+ icon: string;
22
+ rdns: string;
23
+ }
24
+ export interface EIP6963ProviderDetail {
25
+ info: EIP6963ProviderInfo;
26
+ provider: EIP1193Provider;
27
+ }
28
+ /**
29
+ * Initialize wallet provider bridge in parent window
30
+ * Detects all EIP-6963 providers and sets up message handlers
31
+ */
32
+ export declare function initializeParentBridge(iframeOrigin: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paywithglide/glide-react",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"