@paywithglide/glide-react 0.0.42 → 0.0.44

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,180 @@ 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
+ function ue(s) {
162
+ return s instanceof Error;
163
+ }
164
+ let K = !1;
165
+ function me(s) {
166
+ if (K)
167
+ return;
168
+ K = !0;
169
+ const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), o = (p) => {
170
+ const d = p.detail;
171
+ t.has(d.info.uuid) || t.set(d.info.uuid, d);
172
+ };
173
+ window.addEventListener("eip6963:announceProvider", o), window.dispatchEvent(new Event("eip6963:requestProvider")), window.addEventListener("message", async (p) => {
174
+ var f;
175
+ if (p.origin !== s) return;
176
+ const { type: d, data: a } = p.data;
177
+ switch (d) {
178
+ case "glide:getProviders": {
179
+ const c = Array.from(t.values()).map(
180
+ ({ info: h, provider: l }) => ({
181
+ info: h,
182
+ isConnected: typeof l.isConnected == "boolean" ? l.isConnected : void 0,
183
+ chainId: l.chainId,
184
+ selectedAddress: l.selectedAddress
185
+ })
186
+ ), n = document.getElementById(
187
+ "glide-deposit-iframe"
188
+ );
189
+ n != null && n.contentWindow && n.contentWindow.postMessage(
190
+ {
191
+ type: "glide:providers",
192
+ providers: c
193
+ },
194
+ s
195
+ );
196
+ break;
197
+ }
198
+ case "glide:providerRequest": {
199
+ const { uuid: c, requestId: n, method: h, params: l } = a;
200
+ if (i.has(n))
201
+ return;
202
+ i.set(n, !0);
203
+ const m = t.get(c);
204
+ if (!m) {
205
+ i.delete(n), r(n, { error: "Provider not found" });
206
+ return;
207
+ }
208
+ try {
209
+ const u = await m.provider.request({
210
+ method: h,
211
+ params: l
212
+ });
213
+ i.delete(n), r(n, { result: u });
214
+ } catch (u) {
215
+ i.delete(n), ue(u) ? r(n, {
216
+ error: u.message || String(u),
217
+ code: u.code,
218
+ data: u.data
219
+ }) : r(n, {
220
+ error: String(u)
221
+ });
222
+ }
223
+ break;
224
+ }
225
+ case "glide:addEventListener": {
226
+ const { uuid: c, requestId: n, eventName: h } = a, l = t.get(c);
227
+ if (!l || !l.provider.on) {
228
+ r(n, { error: "Provider or method not found" });
229
+ return;
230
+ }
231
+ const m = (...u) => {
232
+ const g = document.getElementById(
233
+ "glide-deposit-iframe"
234
+ );
235
+ g != null && g.contentWindow && g.contentWindow.postMessage(
236
+ {
237
+ type: "glide:providerEvent",
238
+ uuid: c,
239
+ eventName: h,
240
+ args: u
241
+ },
242
+ s
243
+ );
244
+ };
245
+ 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 });
246
+ break;
247
+ }
248
+ case "glide:removeEventListener": {
249
+ const { uuid: c, requestId: n, eventName: h } = a, l = t.get(c);
250
+ if (!l || !l.provider.removeListener) {
251
+ r(n, { error: "Provider or method not found" });
252
+ return;
253
+ }
254
+ const m = (f = e.get(c)) == null ? void 0 : f.get(h);
255
+ m && (m.forEach((u) => {
256
+ l.provider.removeListener(h, u);
257
+ }), m.clear()), r(n, { result: !0 });
258
+ break;
259
+ }
260
+ }
261
+ });
262
+ function r(p, d) {
263
+ const a = document.getElementById(
264
+ "glide-deposit-iframe"
265
+ );
266
+ a != null && a.contentWindow && a.contentWindow.postMessage(
267
+ {
268
+ type: "glide:providerResponse",
269
+ requestId: p,
270
+ ...d
271
+ },
272
+ s
273
+ );
274
+ }
160
275
  }
161
276
  class H {
162
277
  constructor(t) {
163
- B(this, "opts");
164
- B(this, "open", () => {
278
+ j(this, "opts");
279
+ j(this, "open", () => {
165
280
  if (!(!this.opts.container && document.body.classList.contains("glide-deposit-open"))) {
166
281
  if (this.opts.container || document.body.classList.add("glide-deposit-open"), (this.opts.mode === "deposit" || this.opts.mode === "buy") && !this.opts.recipient)
167
282
  throw new Error("recipient is required for deposit/buy mode");
@@ -172,21 +287,21 @@ class H {
172
287
  this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
173
288
  }
174
289
  });
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;
290
+ j(this, "iframeEventHandler", async (t) => {
291
+ var i, o, r, p, d, a, f, c, n, h, l, m, u, g, $, y, I, w, S, v, x, E, U, M, C, k, P, D, T, R, B, W, A;
177
292
  const e = t.data;
178
293
  switch (e.type) {
179
294
  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(
295
+ 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);
296
+ (f = (d = this.iframe) == null ? void 0 : d.contentWindow) == null || f.postMessage(
182
297
  {
183
298
  type: "initialize",
184
299
  sessionId: this.opts.sessionId,
185
- recipient: m,
186
- connectedWalletAddress: X,
187
- availableChainIds: Q,
188
- currentChainId: Y,
189
- preferGaslessPayment: Z,
300
+ recipient: b,
301
+ connectedWalletAddress: Q,
302
+ availableChainIds: Y,
303
+ currentChainId: Z,
304
+ preferGaslessPayment: _,
190
305
  chainIds: this.opts.chainIds,
191
306
  excludeChainIds: this.opts.excludeChainIds,
192
307
  excludeCurrencyTiers: this.opts.excludeCurrencyTiers,
@@ -213,7 +328,8 @@ class H {
213
328
  stableDepositAddressKey: this.opts.stableDepositAddressKey,
214
329
  theme: {
215
330
  ...this.opts.theme || {},
216
- colorScheme: ((n = this.opts.theme) == null ? void 0 : n.colorScheme) || getComputedStyle(document.documentElement).colorScheme || ""
331
+ colorScheme: ((a = this.opts.theme) == null ? void 0 : a.colorScheme) || getComputedStyle(document.documentElement).colorScheme || "",
332
+ safeInsetBottom: this.getSafeInsetBottom()
217
333
  },
218
334
  didProvideLocalStorage: !!this.opts.localStorageProvider,
219
335
  debug: this.opts.debug,
@@ -225,17 +341,17 @@ class H {
225
341
  break;
226
342
  }
227
343
  case "didOpen": {
228
- this.iframe.style.opacity = "1", (f = (g = this.opts).onOpen) == null || f.call(g);
344
+ this.iframe.style.opacity = "1", (n = (c = this.opts).onOpen) == null || n.call(c);
229
345
  break;
230
346
  }
231
347
  case "localStorage.getKeys": {
232
348
  if (!this.opts.localStorageProvider)
233
349
  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(
350
+ const b = await this.opts.localStorageProvider.getKeys();
351
+ (l = (h = this.iframe) == null ? void 0 : h.contentWindow) == null || l.postMessage(
236
352
  {
237
353
  type: "localStorage.didGetKeys",
238
- keys: m
354
+ keys: b
239
355
  },
240
356
  this.baseUrl
241
357
  );
@@ -257,25 +373,25 @@ class H {
257
373
  case "localStorage.getItem": {
258
374
  if (!this.opts.localStorageProvider)
259
375
  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(
376
+ const b = await this.opts.localStorageProvider.getItem(e.key);
377
+ (u = (m = this.iframe) == null ? void 0 : m.contentWindow) == null || u.postMessage(
262
378
  {
263
379
  type: "localStorage.didGetItem",
264
380
  key: e.key,
265
- value: m
381
+ value: b
266
382
  },
267
383
  this.baseUrl
268
384
  );
269
385
  break;
270
386
  }
271
387
  case "success":
272
- (v = (l = this.opts) == null ? void 0 : l.onSuccess) == null || v.call(l, e.hash, e.session);
388
+ ($ = (g = this.opts) == null ? void 0 : g.onSuccess) == null || $.call(g, e.hash, e.session);
273
389
  break;
274
390
  case "close":
275
- this.removeIframe(), this.destroy(), (S = (c = this.opts) == null ? void 0 : c.onClose) == null || S.call(c);
391
+ this.removeIframe(), this.destroy(), (I = (y = this.opts) == null ? void 0 : y.onClose) == null || I.call(y);
276
392
  break;
277
393
  case "setMode":
278
- (x = (h = this.opts) == null ? void 0 : h.onSetMode) == null || x.call(h, e.mode);
394
+ (S = (w = this.opts) == null ? void 0 : w.onSetMode) == null || S.call(w, e.mode);
279
395
  break;
280
396
  case "switchChain":
281
397
  if (!this.opts.walletProvider)
@@ -283,7 +399,7 @@ class H {
283
399
  try {
284
400
  await this.opts.walletProvider.switchChainAsync({
285
401
  chainId: e.chainId
286
- }), (I = (u = this.iframe) == null ? void 0 : u.contentWindow) == null || I.postMessage(
402
+ }), (x = (v = this.iframe) == null ? void 0 : v.contentWindow) == null || x.postMessage(
287
403
  {
288
404
  type: "didSwitchChain",
289
405
  success: !0,
@@ -291,12 +407,12 @@ class H {
291
407
  },
292
408
  this.baseUrl
293
409
  );
294
- } catch (m) {
295
- (E = (U = this.iframe) == null ? void 0 : U.contentWindow) == null || E.postMessage(
410
+ } catch (b) {
411
+ (U = (E = this.iframe) == null ? void 0 : E.contentWindow) == null || U.postMessage(
296
412
  {
297
413
  type: "didSwitchChain",
298
414
  success: !1,
299
- error: m
415
+ error: b
300
416
  },
301
417
  this.baseUrl
302
418
  );
@@ -307,23 +423,23 @@ class H {
307
423
  if (!this.opts.walletProvider)
308
424
  throw new Error("walletProvider is not set");
309
425
  try {
310
- const m = await this.opts.walletProvider.sendTransactionAsync(
426
+ const b = await this.opts.walletProvider.sendTransactionAsync(
311
427
  e.tx
312
428
  );
313
- (C = (k = this.iframe) == null ? void 0 : k.contentWindow) == null || C.postMessage(
429
+ (C = (M = this.iframe) == null ? void 0 : M.contentWindow) == null || C.postMessage(
314
430
  {
315
431
  type: "didSendTransaction",
316
432
  success: !0,
317
- txHash: m
433
+ txHash: b
318
434
  },
319
435
  this.baseUrl
320
436
  );
321
- } catch (m) {
322
- (P = (M = this.iframe) == null ? void 0 : M.contentWindow) == null || P.postMessage(
437
+ } catch (b) {
438
+ (P = (k = this.iframe) == null ? void 0 : k.contentWindow) == null || P.postMessage(
323
439
  {
324
440
  type: "didSendTransaction",
325
441
  success: !1,
326
- error: m
442
+ error: b
327
443
  },
328
444
  this.baseUrl
329
445
  );
@@ -346,23 +462,23 @@ class H {
346
462
  return;
347
463
  }
348
464
  try {
349
- const m = await this.opts.walletProvider.signTypedDataAsync(
465
+ const b = await this.opts.walletProvider.signTypedDataAsync(
350
466
  e.data
351
467
  );
352
- (j = (R = this.iframe) == null ? void 0 : R.contentWindow) == null || j.postMessage(
468
+ (B = (R = this.iframe) == null ? void 0 : R.contentWindow) == null || B.postMessage(
353
469
  {
354
470
  type: "didSignTypedData",
355
471
  success: !0,
356
- signature: m
472
+ signature: b
357
473
  },
358
474
  this.baseUrl
359
475
  );
360
- } catch (m) {
361
- (A = (G = this.iframe) == null ? void 0 : G.contentWindow) == null || A.postMessage(
476
+ } catch (b) {
477
+ (A = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || A.postMessage(
362
478
  {
363
479
  type: "didSignTypedData",
364
480
  success: !1,
365
- error: m
481
+ error: b
366
482
  },
367
483
  this.baseUrl
368
484
  );
@@ -374,13 +490,15 @@ class H {
374
490
  this.opts = t;
375
491
  }
376
492
  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(
493
+ var t, e, i, o, r, p, d, a, f;
494
+ 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
495
  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))}` : ""}`;
496
+ )}` : ""}${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
497
  }
382
498
  initialize() {
383
499
  window.addEventListener("message", this.iframeEventHandler);
500
+ const t = new URL(this.baseUrl).origin;
501
+ me(t);
384
502
  }
385
503
  destroy() {
386
504
  window.removeEventListener("message", this.iframeEventHandler);
@@ -391,6 +509,18 @@ class H {
391
509
  get iframe() {
392
510
  return document.getElementById("glide-deposit-iframe");
393
511
  }
512
+ getSafeInsetBottom() {
513
+ if (typeof window > "u" || typeof document > "u")
514
+ return 0;
515
+ try {
516
+ const t = document.createElement("div");
517
+ 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);
518
+ const e = window.getComputedStyle(t).paddingBottom;
519
+ return document.body.removeChild(t), parseFloat(e) || 0;
520
+ } catch {
521
+ return 0;
522
+ }
523
+ }
394
524
  openUrl(t) {
395
525
  this.createIframe(t);
396
526
  }
@@ -412,7 +542,7 @@ class H {
412
542
  t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
413
543
  }
414
544
  }
415
- const me = ({
545
+ const ye = ({
416
546
  app: s,
417
547
  recipient: t,
418
548
  chainId: e,
@@ -420,36 +550,36 @@ const me = ({
420
550
  amount: o,
421
551
  gasRefuelAmountPerChain: r,
422
552
  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,
437
- stableDepositAddressKey: x,
438
- sessionId: u,
439
- sessionMetadata: I,
440
- disableWithdrawToSelfSuggestion: U,
441
- theme: E,
442
- walletProvider: k,
553
+ chainIds: d,
554
+ excludeChainIds: a,
555
+ excludeCurrencyTiers: f,
556
+ excludeFundingSources: c,
557
+ fundingSources: n,
558
+ appMetadata: h,
559
+ enableRefundEmails: l,
560
+ payerEmail: m,
561
+ mode: u,
562
+ hideSettlementCopy: g,
563
+ showAppLogo: $,
564
+ showOnrampFirst: y,
565
+ debitCardAlias: I,
566
+ copyOverrides: w,
567
+ stableDepositAddressKey: S,
568
+ sessionId: v,
569
+ sessionMetadata: x,
570
+ disableWithdrawToSelfSuggestion: E,
571
+ theme: U,
572
+ walletProvider: M,
443
573
  localStorageProvider: C,
444
- onOpen: M,
574
+ onOpen: k,
445
575
  onSuccess: P,
446
576
  onClose: D,
447
577
  autoCloseOnSuccess: T,
448
578
  popupsBlocked: R,
449
- baseUrl: j,
450
- debug: G
579
+ baseUrl: B,
580
+ debug: W
451
581
  }) => {
452
- const A = O(() => new H({
582
+ const A = G(() => new H({
453
583
  app: s,
454
584
  recipient: t,
455
585
  chainId: e,
@@ -457,34 +587,34 @@ const me = ({
457
587
  amount: o,
458
588
  gasRefuelAmountPerChain: r,
459
589
  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,
474
- stableDepositAddressKey: x,
475
- sessionId: u,
476
- sessionMetadata: I,
477
- disableWithdrawToSelfSuggestion: U,
478
- theme: E,
479
- walletProvider: k,
590
+ chainIds: d,
591
+ excludeChainIds: a,
592
+ excludeCurrencyTiers: f,
593
+ excludeFundingSources: c,
594
+ fundingSources: n,
595
+ appMetadata: h,
596
+ enableRefundEmails: l,
597
+ payerEmail: m,
598
+ mode: u,
599
+ hideSettlementCopy: g,
600
+ showAppLogo: $,
601
+ showOnrampFirst: y,
602
+ debitCardAlias: I,
603
+ copyOverrides: w,
604
+ stableDepositAddressKey: S,
605
+ sessionId: v,
606
+ sessionMetadata: x,
607
+ disableWithdrawToSelfSuggestion: E,
608
+ theme: U,
609
+ walletProvider: M,
480
610
  localStorageProvider: C,
481
- onOpen: M,
611
+ onOpen: k,
482
612
  onSuccess: P,
483
613
  onClose: D,
484
614
  autoCloseOnSuccess: T,
485
615
  popupsBlocked: R,
486
- baseUrl: j,
487
- debug: G
616
+ baseUrl: B,
617
+ debug: W
488
618
  }), [
489
619
  s,
490
620
  t,
@@ -493,41 +623,41 @@ const me = ({
493
623
  o,
494
624
  r,
495
625
  p,
626
+ d,
496
627
  a,
628
+ f,
629
+ c,
497
630
  n,
498
- d,
631
+ h,
632
+ l,
633
+ m,
634
+ u,
499
635
  g,
500
- f,
636
+ $,
501
637
  y,
638
+ I,
502
639
  w,
503
- b,
504
- $,
505
- l,
506
- v,
507
- c,
508
640
  S,
509
- h,
641
+ v,
510
642
  x,
511
- u,
512
- I,
513
- U,
514
643
  E,
515
- k,
516
- C,
644
+ U,
517
645
  M,
646
+ C,
647
+ k,
518
648
  P,
519
649
  D,
520
650
  T,
521
651
  R,
522
- j,
523
- G
652
+ B,
653
+ W
524
654
  ]);
525
655
  return {
526
656
  openGlideDeposit: A.open,
527
657
  externalUrl: A.externalUrl,
528
658
  opts: A.opts
529
659
  };
530
- }, ge = ({
660
+ }, we = ({
531
661
  app: s,
532
662
  preferGaslessPayment: t,
533
663
  chainIds: e,
@@ -535,30 +665,30 @@ const me = ({
535
665
  excludeCurrencyTiers: o,
536
666
  excludeFundingSources: r,
537
667
  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,
552
- localStorageProvider: x,
553
- onOpen: u,
554
- onSuccess: I,
555
- onClose: U,
556
- autoCloseOnSuccess: E,
557
- popupsBlocked: k,
668
+ allowedPaymentCurrencies: d,
669
+ appMetadata: a,
670
+ enableRefundEmails: f,
671
+ payerEmail: c,
672
+ hideSettlementCopy: n,
673
+ showAppLogo: h,
674
+ showOnrampFirst: l,
675
+ debitCardAlias: m,
676
+ copyOverrides: u,
677
+ amount: g,
678
+ sessionId: $,
679
+ sessionMetadata: y,
680
+ theme: I,
681
+ walletProvider: w,
682
+ localStorageProvider: S,
683
+ onOpen: v,
684
+ onSuccess: x,
685
+ onClose: E,
686
+ autoCloseOnSuccess: U,
687
+ popupsBlocked: M,
558
688
  baseUrl: C,
559
- debug: M
689
+ debug: k
560
690
  }) => {
561
- const P = O(() => new H({
691
+ const P = G(() => new H({
562
692
  app: s,
563
693
  preferGaslessPayment: t,
564
694
  chainIds: e,
@@ -566,29 +696,29 @@ const me = ({
566
696
  excludeCurrencyTiers: o,
567
697
  excludeFundingSources: r,
568
698
  fundingSources: p,
569
- allowedPaymentCurrencies: a,
570
- appMetadata: n,
571
- enableRefundEmails: d,
572
- payerEmail: g,
699
+ allowedPaymentCurrencies: d,
700
+ appMetadata: a,
701
+ enableRefundEmails: f,
702
+ payerEmail: c,
573
703
  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,
584
- localStorageProvider: x,
585
- onOpen: u,
586
- onSuccess: I,
587
- onClose: U,
588
- autoCloseOnSuccess: E,
589
- popupsBlocked: k,
704
+ hideSettlementCopy: n,
705
+ showAppLogo: h,
706
+ showOnrampFirst: l,
707
+ debitCardAlias: m,
708
+ copyOverrides: u,
709
+ sessionId: $,
710
+ amount: g,
711
+ sessionMetadata: y,
712
+ theme: I,
713
+ walletProvider: w,
714
+ localStorageProvider: S,
715
+ onOpen: v,
716
+ onSuccess: x,
717
+ onClose: E,
718
+ autoCloseOnSuccess: U,
719
+ popupsBlocked: M,
590
720
  baseUrl: C,
591
- debug: M
721
+ debug: k
592
722
  }), [
593
723
  s,
594
724
  t,
@@ -597,35 +727,35 @@ const me = ({
597
727
  o,
598
728
  r,
599
729
  p,
730
+ d,
600
731
  a,
732
+ f,
733
+ c,
601
734
  n,
602
- d,
735
+ h,
736
+ l,
737
+ m,
738
+ u,
739
+ $,
603
740
  g,
604
- f,
605
741
  y,
742
+ I,
606
743
  w,
607
- b,
608
- $,
609
- v,
610
- l,
611
- c,
612
744
  S,
613
- h,
745
+ v,
614
746
  x,
615
- u,
616
- I,
617
- U,
618
747
  E,
619
- k,
748
+ U,
749
+ M,
620
750
  C,
621
- M
751
+ k
622
752
  ]);
623
753
  return {
624
754
  openGlidePay: P.open,
625
755
  externalUrl: P.externalUrl,
626
756
  opts: P.opts
627
757
  };
628
- }, fe = ({
758
+ }, ve = ({
629
759
  app: s,
630
760
  evm: t,
631
761
  approval: e,
@@ -633,24 +763,24 @@ const me = ({
633
763
  chainIds: o,
634
764
  excludeChainIds: r,
635
765
  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,
650
- baseUrl: x,
651
- debug: u
766
+ excludeFundingSources: d,
767
+ sessionMetadata: a,
768
+ showAppLogo: f,
769
+ showOnrampFirst: c,
770
+ debitCardAlias: n,
771
+ copyOverrides: h,
772
+ theme: l,
773
+ walletProvider: m,
774
+ localStorageProvider: u,
775
+ onOpen: g,
776
+ onSuccess: $,
777
+ onClose: y,
778
+ autoCloseOnSuccess: I,
779
+ popupsBlocked: w,
780
+ baseUrl: S,
781
+ debug: v
652
782
  }) => {
653
- const I = O(() => new H({
783
+ const x = G(() => new H({
654
784
  app: s,
655
785
  evm: t,
656
786
  approval: e,
@@ -658,23 +788,23 @@ const me = ({
658
788
  chainIds: o,
659
789
  excludeChainIds: r,
660
790
  excludeCurrencyTiers: p,
661
- excludeFundingSources: a,
662
- sessionMetadata: n,
663
- showAppLogo: d,
664
- showOnrampFirst: g,
665
- debitCardAlias: f,
666
- copyOverrides: y,
791
+ excludeFundingSources: d,
792
+ sessionMetadata: a,
793
+ showAppLogo: f,
794
+ showOnrampFirst: c,
795
+ debitCardAlias: n,
796
+ copyOverrides: h,
667
797
  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,
676
- baseUrl: x,
677
- debug: u
798
+ theme: l,
799
+ walletProvider: m,
800
+ localStorageProvider: u,
801
+ onOpen: g,
802
+ onSuccess: $,
803
+ onClose: y,
804
+ autoCloseOnSuccess: I,
805
+ popupsBlocked: w,
806
+ baseUrl: S,
807
+ debug: v
678
808
  }), [
679
809
  s,
680
810
  t,
@@ -683,29 +813,29 @@ const me = ({
683
813
  o,
684
814
  r,
685
815
  p,
816
+ d,
686
817
  a,
818
+ f,
819
+ c,
687
820
  n,
688
- d,
821
+ h,
822
+ l,
823
+ m,
824
+ u,
689
825
  g,
690
- f,
826
+ $,
691
827
  y,
828
+ I,
692
829
  w,
693
- b,
694
- $,
695
- l,
696
- v,
697
- c,
698
830
  S,
699
- h,
700
- x,
701
- u
831
+ v
702
832
  ]);
703
833
  return {
704
- openGlideCall: I.open,
705
- externalUrl: I.externalUrl,
706
- opts: I.opts
834
+ openGlideCall: x.open,
835
+ externalUrl: x.externalUrl,
836
+ opts: x.opts
707
837
  };
708
- }, ye = ({
838
+ }, be = ({
709
839
  app: s,
710
840
  recipient: t,
711
841
  chainId: e,
@@ -713,23 +843,23 @@ const me = ({
713
843
  preferGaslessPayment: o,
714
844
  chainIds: r,
715
845
  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,
730
- baseUrl: x
846
+ excludeCurrencyTiers: d,
847
+ excludeFundingSources: a,
848
+ sessionMetadata: f,
849
+ showAppLogo: c,
850
+ showOnrampFirst: n,
851
+ debitCardAlias: h,
852
+ copyOverrides: l,
853
+ theme: m,
854
+ walletProvider: u,
855
+ localStorageProvider: g,
856
+ onOpen: $,
857
+ onSuccess: y,
858
+ onClose: I,
859
+ autoCloseOnSuccess: w,
860
+ baseUrl: S
731
861
  }) => {
732
- const u = O(() => new H({
862
+ const v = G(() => new H({
733
863
  app: s,
734
864
  recipient: t,
735
865
  chainId: e,
@@ -737,22 +867,22 @@ const me = ({
737
867
  preferGaslessPayment: o,
738
868
  chainIds: r,
739
869
  excludeChainIds: p,
740
- excludeCurrencyTiers: a,
741
- excludeFundingSources: n,
742
- sessionMetadata: d,
743
- showAppLogo: g,
744
- showOnrampFirst: f,
745
- debitCardAlias: y,
746
- copyOverrides: w,
870
+ excludeCurrencyTiers: d,
871
+ excludeFundingSources: a,
872
+ sessionMetadata: f,
873
+ showAppLogo: c,
874
+ showOnrampFirst: n,
875
+ debitCardAlias: h,
876
+ copyOverrides: l,
747
877
  mode: "buy",
748
- theme: b,
749
- walletProvider: $,
750
- localStorageProvider: l,
751
- onOpen: v,
752
- onSuccess: c,
753
- onClose: S,
754
- autoCloseOnSuccess: h,
755
- baseUrl: x
878
+ theme: m,
879
+ walletProvider: u,
880
+ localStorageProvider: g,
881
+ onOpen: $,
882
+ onSuccess: y,
883
+ onClose: I,
884
+ autoCloseOnSuccess: w,
885
+ baseUrl: S
756
886
  }), [
757
887
  s,
758
888
  t,
@@ -761,28 +891,28 @@ const me = ({
761
891
  o,
762
892
  r,
763
893
  p,
894
+ d,
764
895
  a,
896
+ f,
897
+ c,
765
898
  n,
766
- d,
899
+ h,
900
+ l,
901
+ m,
902
+ u,
767
903
  g,
768
- f,
904
+ $,
769
905
  y,
906
+ I,
770
907
  w,
771
- b,
772
- $,
773
- l,
774
- v,
775
- c,
776
- S,
777
- h,
778
- x
908
+ S
779
909
  ]);
780
910
  return {
781
- openGlideBuy: u.open,
782
- externalUrl: u.externalUrl,
783
- opts: u.opts
911
+ openGlideBuy: v.open,
912
+ externalUrl: v.externalUrl,
913
+ opts: v.opts
784
914
  };
785
- }, we = Object.freeze({
915
+ }, $e = Object.freeze({
786
916
  getItem: (s) => new Promise((t, e) => {
787
917
  try {
788
918
  const i = localStorage.getItem(s);
@@ -816,9 +946,10 @@ const me = ({
816
946
  });
817
947
  export {
818
948
  H as GlideDeposit,
819
- we as browserLocalStorageProvider,
820
- ye as useGlideBuy,
821
- fe as useGlideCall,
822
- me as useGlideDeposit,
823
- ge as useGlidePay
949
+ $e as browserLocalStorageProvider,
950
+ me as initializeParentBridge,
951
+ be as useGlideBuy,
952
+ ve as useGlideCall,
953
+ ye as useGlideDeposit,
954
+ we as useGlidePay
824
955
  };
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,35 @@
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
+ isConnected?: boolean;
18
+ chainId?: string;
19
+ selectedAddress?: string;
20
+ }
21
+ export interface EIP6963ProviderInfo {
22
+ uuid: string;
23
+ name: string;
24
+ icon: string;
25
+ rdns: string;
26
+ }
27
+ export interface EIP6963ProviderDetail {
28
+ info: EIP6963ProviderInfo;
29
+ provider: EIP1193Provider;
30
+ }
31
+ /**
32
+ * Initialize wallet provider bridge in parent window
33
+ * Detects all EIP-6963 providers and sets up message handlers
34
+ */
35
+ 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.44",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -17,12 +17,12 @@
17
17
  "sideEffects": false,
18
18
  "scripts": {
19
19
  "dev": "vite",
20
- "build": "tsc --p ./tsconfig.build.json && vite build",
20
+ "build": "bun run lint && vite build",
21
21
  "build-web": "tsc --p ./tsconfig.build.json && vite build --mode web",
22
22
  "build-chromeext": "tsc --p ./tsconfig.build.json && vite build --mode chromeext:popup && vite build --mode chromeext:content && vite build --mode chromeext:background",
23
23
  "lint": "prettier --check . && eslint . --max-warnings 0 && tsc --p ./tsconfig.build.json",
24
24
  "preview": "vite preview",
25
- "prepublishOnly": "npm run build"
25
+ "prepublishOnly": "bun run build"
26
26
  },
27
27
  "dependencies": {
28
28
  "@paywithglide/glide-js": "0.13.10"