@paywithglide/glide-react 0.0.42 → 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.
@@ -148,6 +148,7 @@ export declare class GlideDeposit {
148
148
  private destroy;
149
149
  private get baseUrl();
150
150
  private get iframe();
151
+ private getSafeInsetBottom;
151
152
  private iframeEventHandler;
152
153
  private openUrl;
153
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 B = (s, t, e) => ee(s, typeof t != "symbol" ? t + "" : t, e);
4
- import { useMemo as O } 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 K(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
11
  const N = "2.21.51";
12
- let W = {
12
+ let L = {
13
13
  getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
14
14
  version: `viem@${N}`
15
15
  };
16
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 z ? e.cause.details : (n = e.cause) != null && n.message ? e.cause.message : e.details;
22
- })(), o = e.cause instanceof z && e.cause.docsPath || e.docsPath, r = (a = W.getDocsUrl) == null ? void 0 : a.call(W, { ...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
- ...W.version ? [`Version: ${W.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", {
@@ -61,37 +61,37 @@ class z extends Error {
61
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 z {
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 L(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 z {
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 z {
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 (K(s) > t)
118
- throw new re({
119
- givenSize: K(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 }), L(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 }), L(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 ? L(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
271
  class H {
162
272
  constructor(t) {
163
- B(this, "opts");
164
- B(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 H {
172
282
  this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
173
283
  }
174
284
  });
175
- B(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, C, M, P, D, T, R, j, G, A;
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,
@@ -213,7 +323,8 @@ class H {
213
323
  stableDepositAddressKey: this.opts.stableDepositAddressKey,
214
324
  theme: {
215
325
  ...this.opts.theme || {},
216
- 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()
217
328
  },
218
329
  didProvideLocalStorage: !!this.opts.localStorageProvider,
219
330
  debug: this.opts.debug,
@@ -225,17 +336,17 @@ class H {
225
336
  break;
226
337
  }
227
338
  case "didOpen": {
228
- 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);
229
340
  break;
230
341
  }
231
342
  case "localStorage.getKeys": {
232
343
  if (!this.opts.localStorageProvider)
233
344
  throw new Error("localStorageProvider is not set");
234
- const m = await this.opts.localStorageProvider.getKeys();
235
- (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(
236
347
  {
237
348
  type: "localStorage.didGetKeys",
238
- keys: m
349
+ keys: b
239
350
  },
240
351
  this.baseUrl
241
352
  );
@@ -257,25 +368,25 @@ class H {
257
368
  case "localStorage.getItem": {
258
369
  if (!this.opts.localStorageProvider)
259
370
  throw new Error("localStorageProvider is not set");
260
- const m = await this.opts.localStorageProvider.getItem(e.key);
261
- ($ = (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(
262
373
  {
263
374
  type: "localStorage.didGetItem",
264
375
  key: e.key,
265
- value: m
376
+ value: b
266
377
  },
267
378
  this.baseUrl
268
379
  );
269
380
  break;
270
381
  }
271
382
  case "success":
272
- (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);
273
384
  break;
274
385
  case "close":
275
- 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);
276
387
  break;
277
388
  case "setMode":
278
- (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);
279
390
  break;
280
391
  case "switchChain":
281
392
  if (!this.opts.walletProvider)
@@ -283,7 +394,7 @@ class H {
283
394
  try {
284
395
  await this.opts.walletProvider.switchChainAsync({
285
396
  chainId: e.chainId
286
- }), (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(
287
398
  {
288
399
  type: "didSwitchChain",
289
400
  success: !0,
@@ -291,12 +402,12 @@ class H {
291
402
  },
292
403
  this.baseUrl
293
404
  );
294
- } catch (m) {
295
- (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(
296
407
  {
297
408
  type: "didSwitchChain",
298
409
  success: !1,
299
- error: m
410
+ error: b
300
411
  },
301
412
  this.baseUrl
302
413
  );
@@ -307,23 +418,23 @@ class H {
307
418
  if (!this.opts.walletProvider)
308
419
  throw new Error("walletProvider is not set");
309
420
  try {
310
- const m = await this.opts.walletProvider.sendTransactionAsync(
421
+ const b = await this.opts.walletProvider.sendTransactionAsync(
311
422
  e.tx
312
423
  );
313
- (C = (k = this.iframe) == null ? void 0 : k.contentWindow) == null || C.postMessage(
424
+ (C = (M = this.iframe) == null ? void 0 : M.contentWindow) == null || C.postMessage(
314
425
  {
315
426
  type: "didSendTransaction",
316
427
  success: !0,
317
- txHash: m
428
+ txHash: b
318
429
  },
319
430
  this.baseUrl
320
431
  );
321
- } catch (m) {
322
- (P = (M = this.iframe) == null ? void 0 : M.contentWindow) == null || P.postMessage(
432
+ } catch (b) {
433
+ (P = (k = this.iframe) == null ? void 0 : k.contentWindow) == null || P.postMessage(
323
434
  {
324
435
  type: "didSendTransaction",
325
436
  success: !1,
326
- error: m
437
+ error: b
327
438
  },
328
439
  this.baseUrl
329
440
  );
@@ -346,23 +457,23 @@ class H {
346
457
  return;
347
458
  }
348
459
  try {
349
- const m = await this.opts.walletProvider.signTypedDataAsync(
460
+ const b = await this.opts.walletProvider.signTypedDataAsync(
350
461
  e.data
351
462
  );
352
- (j = (R = this.iframe) == null ? void 0 : R.contentWindow) == null || j.postMessage(
463
+ (B = (R = this.iframe) == null ? void 0 : R.contentWindow) == null || B.postMessage(
353
464
  {
354
465
  type: "didSignTypedData",
355
466
  success: !0,
356
- signature: m
467
+ signature: b
357
468
  },
358
469
  this.baseUrl
359
470
  );
360
- } catch (m) {
361
- (A = (G = this.iframe) == null ? void 0 : G.contentWindow) == null || A.postMessage(
471
+ } catch (b) {
472
+ (A = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || A.postMessage(
362
473
  {
363
474
  type: "didSignTypedData",
364
475
  success: !1,
365
- error: m
476
+ error: b
366
477
  },
367
478
  this.baseUrl
368
479
  );
@@ -374,13 +485,15 @@ class H {
374
485
  this.opts = t;
375
486
  }
376
487
  get externalUrl() {
377
- var t, e, i, o, r, p, a, n, d;
378
- 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(
379
490
  this.opts.evm.value || 0n
380
- )}` : ""}${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.stableDepositAddressKey ? `&stableDepositAddressKey=${encodeURIComponent(this.opts.stableDepositAddressKey)}` : ""}${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))}` : ""}`;
381
492
  }
382
493
  initialize() {
383
494
  window.addEventListener("message", this.iframeEventHandler);
495
+ const t = new URL(this.baseUrl).origin;
496
+ ue(t);
384
497
  }
385
498
  destroy() {
386
499
  window.removeEventListener("message", this.iframeEventHandler);
@@ -391,6 +504,18 @@ class H {
391
504
  get iframe() {
392
505
  return document.getElementById("glide-deposit-iframe");
393
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
+ }
394
519
  openUrl(t) {
395
520
  this.createIframe(t);
396
521
  }
@@ -412,7 +537,7 @@ class H {
412
537
  t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
413
538
  }
414
539
  }
415
- const me = ({
540
+ const fe = ({
416
541
  app: s,
417
542
  recipient: t,
418
543
  chainId: e,
@@ -420,36 +545,36 @@ const me = ({
420
545
  amount: o,
421
546
  gasRefuelAmountPerChain: r,
422
547
  preferGaslessPayment: p,
423
- chainIds: a,
424
- excludeChainIds: n,
425
- excludeCurrencyTiers: d,
426
- excludeFundingSources: g,
427
- fundingSources: f,
428
- appMetadata: y,
429
- enableRefundEmails: w,
430
- payerEmail: b,
431
- mode: $,
432
- hideSettlementCopy: l,
433
- showAppLogo: v,
434
- showOnrampFirst: c,
435
- debitCardAlias: S,
436
- copyOverrides: h,
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,
437
562
  stableDepositAddressKey: x,
438
- sessionId: u,
439
- sessionMetadata: I,
440
- disableWithdrawToSelfSuggestion: U,
441
- theme: E,
442
- walletProvider: k,
563
+ sessionId: v,
564
+ sessionMetadata: S,
565
+ disableWithdrawToSelfSuggestion: E,
566
+ theme: U,
567
+ walletProvider: M,
443
568
  localStorageProvider: C,
444
- onOpen: M,
569
+ onOpen: k,
445
570
  onSuccess: P,
446
571
  onClose: D,
447
572
  autoCloseOnSuccess: T,
448
573
  popupsBlocked: R,
449
- baseUrl: j,
450
- debug: G
574
+ baseUrl: B,
575
+ debug: W
451
576
  }) => {
452
- const A = O(() => new H({
577
+ const A = G(() => new H({
453
578
  app: s,
454
579
  recipient: t,
455
580
  chainId: e,
@@ -457,34 +582,34 @@ const me = ({
457
582
  amount: o,
458
583
  gasRefuelAmountPerChain: r,
459
584
  preferGaslessPayment: p,
460
- chainIds: a,
461
- excludeChainIds: n,
462
- excludeCurrencyTiers: d,
463
- excludeFundingSources: g,
464
- fundingSources: f,
465
- appMetadata: y,
466
- enableRefundEmails: w,
467
- payerEmail: b,
468
- mode: $,
469
- hideSettlementCopy: l,
470
- showAppLogo: v,
471
- showOnrampFirst: c,
472
- debitCardAlias: S,
473
- copyOverrides: h,
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,
474
599
  stableDepositAddressKey: x,
475
- sessionId: u,
476
- sessionMetadata: I,
477
- disableWithdrawToSelfSuggestion: U,
478
- theme: E,
479
- walletProvider: k,
600
+ sessionId: v,
601
+ sessionMetadata: S,
602
+ disableWithdrawToSelfSuggestion: E,
603
+ theme: U,
604
+ walletProvider: M,
480
605
  localStorageProvider: C,
481
- onOpen: M,
606
+ onOpen: k,
482
607
  onSuccess: P,
483
608
  onClose: D,
484
609
  autoCloseOnSuccess: T,
485
610
  popupsBlocked: R,
486
- baseUrl: j,
487
- debug: G
611
+ baseUrl: B,
612
+ debug: W
488
613
  }), [
489
614
  s,
490
615
  t,
@@ -493,41 +618,41 @@ const me = ({
493
618
  o,
494
619
  r,
495
620
  p,
621
+ d,
496
622
  a,
623
+ f,
624
+ c,
497
625
  n,
498
- d,
626
+ h,
627
+ l,
628
+ m,
629
+ u,
499
630
  g,
500
- f,
631
+ $,
501
632
  y,
633
+ I,
502
634
  w,
503
- b,
504
- $,
505
- l,
635
+ x,
506
636
  v,
507
- c,
508
637
  S,
509
- h,
510
- x,
511
- u,
512
- I,
513
- U,
514
638
  E,
515
- k,
516
- C,
639
+ U,
517
640
  M,
641
+ C,
642
+ k,
518
643
  P,
519
644
  D,
520
645
  T,
521
646
  R,
522
- j,
523
- G
647
+ B,
648
+ W
524
649
  ]);
525
650
  return {
526
651
  openGlideDeposit: A.open,
527
652
  externalUrl: A.externalUrl,
528
653
  opts: A.opts
529
654
  };
530
- }, ge = ({
655
+ }, ye = ({
531
656
  app: s,
532
657
  preferGaslessPayment: t,
533
658
  chainIds: e,
@@ -535,30 +660,30 @@ const me = ({
535
660
  excludeCurrencyTiers: o,
536
661
  excludeFundingSources: r,
537
662
  fundingSources: p,
538
- allowedPaymentCurrencies: a,
539
- appMetadata: n,
540
- enableRefundEmails: d,
541
- payerEmail: g,
542
- hideSettlementCopy: f,
543
- showAppLogo: y,
544
- showOnrampFirst: w,
545
- debitCardAlias: b,
546
- copyOverrides: $,
547
- amount: l,
548
- sessionId: v,
549
- sessionMetadata: c,
550
- theme: S,
551
- 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,
552
677
  localStorageProvider: x,
553
- onOpen: u,
554
- onSuccess: I,
555
- onClose: U,
556
- autoCloseOnSuccess: E,
557
- popupsBlocked: k,
678
+ onOpen: v,
679
+ onSuccess: S,
680
+ onClose: E,
681
+ autoCloseOnSuccess: U,
682
+ popupsBlocked: M,
558
683
  baseUrl: C,
559
- debug: M
684
+ debug: k
560
685
  }) => {
561
- const P = O(() => new H({
686
+ const P = G(() => new H({
562
687
  app: s,
563
688
  preferGaslessPayment: t,
564
689
  chainIds: e,
@@ -566,29 +691,29 @@ const me = ({
566
691
  excludeCurrencyTiers: o,
567
692
  excludeFundingSources: r,
568
693
  fundingSources: p,
569
- allowedPaymentCurrencies: a,
570
- appMetadata: n,
571
- enableRefundEmails: d,
572
- payerEmail: g,
694
+ allowedPaymentCurrencies: d,
695
+ appMetadata: a,
696
+ enableRefundEmails: f,
697
+ payerEmail: c,
573
698
  mode: "pay",
574
- hideSettlementCopy: f,
575
- showAppLogo: y,
576
- showOnrampFirst: w,
577
- debitCardAlias: b,
578
- copyOverrides: $,
579
- sessionId: v,
580
- amount: l,
581
- sessionMetadata: c,
582
- theme: S,
583
- 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,
584
709
  localStorageProvider: x,
585
- onOpen: u,
586
- onSuccess: I,
587
- onClose: U,
588
- autoCloseOnSuccess: E,
589
- popupsBlocked: k,
710
+ onOpen: v,
711
+ onSuccess: S,
712
+ onClose: E,
713
+ autoCloseOnSuccess: U,
714
+ popupsBlocked: M,
590
715
  baseUrl: C,
591
- debug: M
716
+ debug: k
592
717
  }), [
593
718
  s,
594
719
  t,
@@ -597,35 +722,35 @@ const me = ({
597
722
  o,
598
723
  r,
599
724
  p,
725
+ d,
600
726
  a,
727
+ f,
728
+ c,
601
729
  n,
602
- d,
730
+ h,
731
+ l,
732
+ m,
733
+ u,
734
+ $,
603
735
  g,
604
- f,
605
736
  y,
737
+ I,
606
738
  w,
607
- b,
608
- $,
739
+ x,
609
740
  v,
610
- l,
611
- c,
612
741
  S,
613
- h,
614
- x,
615
- u,
616
- I,
617
- U,
618
742
  E,
619
- k,
743
+ U,
744
+ M,
620
745
  C,
621
- M
746
+ k
622
747
  ]);
623
748
  return {
624
749
  openGlidePay: P.open,
625
750
  externalUrl: P.externalUrl,
626
751
  opts: P.opts
627
752
  };
628
- }, fe = ({
753
+ }, we = ({
629
754
  app: s,
630
755
  evm: t,
631
756
  approval: e,
@@ -633,24 +758,24 @@ const me = ({
633
758
  chainIds: o,
634
759
  excludeChainIds: r,
635
760
  excludeCurrencyTiers: p,
636
- excludeFundingSources: a,
637
- sessionMetadata: n,
638
- showAppLogo: d,
639
- showOnrampFirst: g,
640
- debitCardAlias: f,
641
- copyOverrides: y,
642
- theme: w,
643
- walletProvider: b,
644
- localStorageProvider: $,
645
- onOpen: l,
646
- onSuccess: v,
647
- onClose: c,
648
- autoCloseOnSuccess: S,
649
- 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,
650
775
  baseUrl: x,
651
- debug: u
776
+ debug: v
652
777
  }) => {
653
- const I = O(() => new H({
778
+ const S = G(() => new H({
654
779
  app: s,
655
780
  evm: t,
656
781
  approval: e,
@@ -658,23 +783,23 @@ const me = ({
658
783
  chainIds: o,
659
784
  excludeChainIds: r,
660
785
  excludeCurrencyTiers: p,
661
- excludeFundingSources: a,
662
- sessionMetadata: n,
663
- showAppLogo: d,
664
- showOnrampFirst: g,
665
- debitCardAlias: f,
666
- copyOverrides: y,
786
+ excludeFundingSources: d,
787
+ sessionMetadata: a,
788
+ showAppLogo: f,
789
+ showOnrampFirst: c,
790
+ debitCardAlias: n,
791
+ copyOverrides: h,
667
792
  mode: "call",
668
- theme: w,
669
- walletProvider: b,
670
- localStorageProvider: $,
671
- onOpen: l,
672
- onSuccess: v,
673
- onClose: c,
674
- autoCloseOnSuccess: S,
675
- 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,
676
801
  baseUrl: x,
677
- debug: u
802
+ debug: v
678
803
  }), [
679
804
  s,
680
805
  t,
@@ -683,29 +808,29 @@ const me = ({
683
808
  o,
684
809
  r,
685
810
  p,
811
+ d,
686
812
  a,
813
+ f,
814
+ c,
687
815
  n,
688
- d,
816
+ h,
817
+ l,
818
+ m,
819
+ u,
689
820
  g,
690
- f,
821
+ $,
691
822
  y,
823
+ I,
692
824
  w,
693
- b,
694
- $,
695
- l,
696
- v,
697
- c,
698
- S,
699
- h,
700
825
  x,
701
- u
826
+ v
702
827
  ]);
703
828
  return {
704
- openGlideCall: I.open,
705
- externalUrl: I.externalUrl,
706
- opts: I.opts
829
+ openGlideCall: S.open,
830
+ externalUrl: S.externalUrl,
831
+ opts: S.opts
707
832
  };
708
- }, ye = ({
833
+ }, ve = ({
709
834
  app: s,
710
835
  recipient: t,
711
836
  chainId: e,
@@ -713,23 +838,23 @@ const me = ({
713
838
  preferGaslessPayment: o,
714
839
  chainIds: r,
715
840
  excludeChainIds: p,
716
- excludeCurrencyTiers: a,
717
- excludeFundingSources: n,
718
- sessionMetadata: d,
719
- showAppLogo: g,
720
- showOnrampFirst: f,
721
- debitCardAlias: y,
722
- copyOverrides: w,
723
- theme: b,
724
- walletProvider: $,
725
- localStorageProvider: l,
726
- onOpen: v,
727
- onSuccess: c,
728
- onClose: S,
729
- 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,
730
855
  baseUrl: x
731
856
  }) => {
732
- const u = O(() => new H({
857
+ const v = G(() => new H({
733
858
  app: s,
734
859
  recipient: t,
735
860
  chainId: e,
@@ -737,21 +862,21 @@ const me = ({
737
862
  preferGaslessPayment: o,
738
863
  chainIds: r,
739
864
  excludeChainIds: p,
740
- excludeCurrencyTiers: a,
741
- excludeFundingSources: n,
742
- sessionMetadata: d,
743
- showAppLogo: g,
744
- showOnrampFirst: f,
745
- debitCardAlias: y,
746
- copyOverrides: w,
865
+ excludeCurrencyTiers: d,
866
+ excludeFundingSources: a,
867
+ sessionMetadata: f,
868
+ showAppLogo: c,
869
+ showOnrampFirst: n,
870
+ debitCardAlias: h,
871
+ copyOverrides: l,
747
872
  mode: "buy",
748
- theme: b,
749
- walletProvider: $,
750
- localStorageProvider: l,
751
- onOpen: v,
752
- onSuccess: c,
753
- onClose: S,
754
- autoCloseOnSuccess: h,
873
+ theme: m,
874
+ walletProvider: u,
875
+ localStorageProvider: g,
876
+ onOpen: $,
877
+ onSuccess: y,
878
+ onClose: I,
879
+ autoCloseOnSuccess: w,
755
880
  baseUrl: x
756
881
  }), [
757
882
  s,
@@ -761,28 +886,28 @@ const me = ({
761
886
  o,
762
887
  r,
763
888
  p,
889
+ d,
764
890
  a,
891
+ f,
892
+ c,
765
893
  n,
766
- d,
894
+ h,
895
+ l,
896
+ m,
897
+ u,
767
898
  g,
768
- f,
899
+ $,
769
900
  y,
901
+ I,
770
902
  w,
771
- b,
772
- $,
773
- l,
774
- v,
775
- c,
776
- S,
777
- h,
778
903
  x
779
904
  ]);
780
905
  return {
781
- openGlideBuy: u.open,
782
- externalUrl: u.externalUrl,
783
- opts: u.opts
906
+ openGlideBuy: v.open,
907
+ externalUrl: v.externalUrl,
908
+ opts: v.opts
784
909
  };
785
- }, we = Object.freeze({
910
+ }, be = Object.freeze({
786
911
  getItem: (s) => new Promise((t, e) => {
787
912
  try {
788
913
  const i = localStorage.getItem(s);
@@ -816,9 +941,10 @@ const me = ({
816
941
  });
817
942
  export {
818
943
  H as GlideDeposit,
819
- we as browserLocalStorageProvider,
820
- ye as useGlideBuy,
821
- fe as useGlideCall,
822
- me as useGlideDeposit,
823
- ge as useGlidePay
944
+ be as browserLocalStorageProvider,
945
+ ue as initializeParentBridge,
946
+ ve as useGlideBuy,
947
+ we as useGlideCall,
948
+ fe as useGlideDeposit,
949
+ ye as useGlidePay
824
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
  };
@@ -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.42",
3
+ "version": "0.0.43",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"