@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.
- package/dist/GlideDeposit.d.ts +1 -0
- package/dist/glide.js +436 -305
- package/dist/index.d.ts +1 -0
- package/dist/theme.d.ts +1 -0
- package/dist/walletProviderBridge.d.ts +35 -0
- package/package.json +3 -3
package/dist/GlideDeposit.d.ts
CHANGED
package/dist/glide.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useMemo as
|
|
5
|
-
function
|
|
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
|
|
9
|
-
return
|
|
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
|
|
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
|
|
18
|
+
var d;
|
|
19
19
|
const i = (() => {
|
|
20
|
-
var
|
|
21
|
-
return e.cause instanceof z ? e.cause.details : (
|
|
22
|
-
})(), o = e.cause instanceof z && e.cause.docsPath || e.docsPath, r = (
|
|
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
|
-
...
|
|
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
|
|
64
|
+
return V(this, t);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ?
|
|
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
|
|
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
|
|
76
|
-
return typeof s == "string" ?
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
117
|
-
if (
|
|
118
|
-
throw new
|
|
119
|
-
givenSize:
|
|
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
|
|
124
|
-
function
|
|
125
|
-
return typeof s == "number" || typeof s == "bigint" ?
|
|
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" ? (
|
|
129
|
+
return typeof t.size == "number" ? (J(e, { size: t.size }), O(e, { size: t.size })) : e;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function X(s, t = {}) {
|
|
132
132
|
let e = "";
|
|
133
133
|
for (let o = 0; o < s.length; o++)
|
|
134
|
-
e +=
|
|
134
|
+
e += ae[s[o]];
|
|
135
135
|
const i = `0x${e}`;
|
|
136
|
-
return typeof t.size == "number" ? (
|
|
136
|
+
return typeof t.size == "number" ? (J(i, { size: t.size }), O(i, { dir: "right", size: t.size })) : i;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
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
|
|
145
|
-
throw new
|
|
146
|
-
max: r ? `${r}${
|
|
147
|
-
min: `${p}${
|
|
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}${
|
|
150
|
+
value: `${s}${a}`
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
const
|
|
154
|
-
return i ?
|
|
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
|
|
157
|
+
function he(s, t = {}) {
|
|
158
158
|
const e = le.encode(s);
|
|
159
|
-
return
|
|
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
|
-
|
|
164
|
-
|
|
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
|
-
|
|
176
|
-
var i, o, r, p, 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
|
|
181
|
-
(
|
|
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:
|
|
186
|
-
connectedWalletAddress:
|
|
187
|
-
availableChainIds:
|
|
188
|
-
currentChainId:
|
|
189
|
-
preferGaslessPayment:
|
|
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: ((
|
|
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", (
|
|
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
|
|
235
|
-
(
|
|
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:
|
|
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
|
|
261
|
-
(
|
|
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:
|
|
381
|
+
value: b
|
|
266
382
|
},
|
|
267
383
|
this.baseUrl
|
|
268
384
|
);
|
|
269
385
|
break;
|
|
270
386
|
}
|
|
271
387
|
case "success":
|
|
272
|
-
(
|
|
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(), (
|
|
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
|
-
(
|
|
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
|
-
}), (
|
|
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 (
|
|
295
|
-
(
|
|
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:
|
|
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
|
|
426
|
+
const b = await this.opts.walletProvider.sendTransactionAsync(
|
|
311
427
|
e.tx
|
|
312
428
|
);
|
|
313
|
-
(C = (
|
|
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:
|
|
433
|
+
txHash: b
|
|
318
434
|
},
|
|
319
435
|
this.baseUrl
|
|
320
436
|
);
|
|
321
|
-
} catch (
|
|
322
|
-
(P = (
|
|
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:
|
|
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
|
|
465
|
+
const b = await this.opts.walletProvider.signTypedDataAsync(
|
|
350
466
|
e.data
|
|
351
467
|
);
|
|
352
|
-
(
|
|
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:
|
|
472
|
+
signature: b
|
|
357
473
|
},
|
|
358
474
|
this.baseUrl
|
|
359
475
|
);
|
|
360
|
-
} catch (
|
|
361
|
-
(A = (
|
|
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:
|
|
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,
|
|
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 ? `¤cyId=${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=${
|
|
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 ? `¤cyId=${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(",")}` : ""}${(
|
|
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 ? `©Overrides=${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
|
|
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:
|
|
424
|
-
excludeChainIds:
|
|
425
|
-
excludeCurrencyTiers:
|
|
426
|
-
excludeFundingSources:
|
|
427
|
-
fundingSources:
|
|
428
|
-
appMetadata:
|
|
429
|
-
enableRefundEmails:
|
|
430
|
-
payerEmail:
|
|
431
|
-
mode:
|
|
432
|
-
hideSettlementCopy:
|
|
433
|
-
showAppLogo:
|
|
434
|
-
showOnrampFirst:
|
|
435
|
-
debitCardAlias:
|
|
436
|
-
copyOverrides:
|
|
437
|
-
stableDepositAddressKey:
|
|
438
|
-
sessionId:
|
|
439
|
-
sessionMetadata:
|
|
440
|
-
disableWithdrawToSelfSuggestion:
|
|
441
|
-
theme:
|
|
442
|
-
walletProvider:
|
|
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:
|
|
574
|
+
onOpen: k,
|
|
445
575
|
onSuccess: P,
|
|
446
576
|
onClose: D,
|
|
447
577
|
autoCloseOnSuccess: T,
|
|
448
578
|
popupsBlocked: R,
|
|
449
|
-
baseUrl:
|
|
450
|
-
debug:
|
|
579
|
+
baseUrl: B,
|
|
580
|
+
debug: W
|
|
451
581
|
}) => {
|
|
452
|
-
const A =
|
|
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:
|
|
461
|
-
excludeChainIds:
|
|
462
|
-
excludeCurrencyTiers:
|
|
463
|
-
excludeFundingSources:
|
|
464
|
-
fundingSources:
|
|
465
|
-
appMetadata:
|
|
466
|
-
enableRefundEmails:
|
|
467
|
-
payerEmail:
|
|
468
|
-
mode:
|
|
469
|
-
hideSettlementCopy:
|
|
470
|
-
showAppLogo:
|
|
471
|
-
showOnrampFirst:
|
|
472
|
-
debitCardAlias:
|
|
473
|
-
copyOverrides:
|
|
474
|
-
stableDepositAddressKey:
|
|
475
|
-
sessionId:
|
|
476
|
-
sessionMetadata:
|
|
477
|
-
disableWithdrawToSelfSuggestion:
|
|
478
|
-
theme:
|
|
479
|
-
walletProvider:
|
|
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:
|
|
611
|
+
onOpen: k,
|
|
482
612
|
onSuccess: P,
|
|
483
613
|
onClose: D,
|
|
484
614
|
autoCloseOnSuccess: T,
|
|
485
615
|
popupsBlocked: R,
|
|
486
|
-
baseUrl:
|
|
487
|
-
debug:
|
|
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
|
-
|
|
631
|
+
h,
|
|
632
|
+
l,
|
|
633
|
+
m,
|
|
634
|
+
u,
|
|
499
635
|
g,
|
|
500
|
-
|
|
636
|
+
$,
|
|
501
637
|
y,
|
|
638
|
+
I,
|
|
502
639
|
w,
|
|
503
|
-
b,
|
|
504
|
-
$,
|
|
505
|
-
l,
|
|
506
|
-
v,
|
|
507
|
-
c,
|
|
508
640
|
S,
|
|
509
|
-
|
|
641
|
+
v,
|
|
510
642
|
x,
|
|
511
|
-
u,
|
|
512
|
-
I,
|
|
513
|
-
U,
|
|
514
643
|
E,
|
|
515
|
-
|
|
516
|
-
C,
|
|
644
|
+
U,
|
|
517
645
|
M,
|
|
646
|
+
C,
|
|
647
|
+
k,
|
|
518
648
|
P,
|
|
519
649
|
D,
|
|
520
650
|
T,
|
|
521
651
|
R,
|
|
522
|
-
|
|
523
|
-
|
|
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
|
-
},
|
|
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:
|
|
539
|
-
appMetadata:
|
|
540
|
-
enableRefundEmails:
|
|
541
|
-
payerEmail:
|
|
542
|
-
hideSettlementCopy:
|
|
543
|
-
showAppLogo:
|
|
544
|
-
showOnrampFirst:
|
|
545
|
-
debitCardAlias:
|
|
546
|
-
copyOverrides:
|
|
547
|
-
amount:
|
|
548
|
-
sessionId:
|
|
549
|
-
sessionMetadata:
|
|
550
|
-
theme:
|
|
551
|
-
walletProvider:
|
|
552
|
-
localStorageProvider:
|
|
553
|
-
onOpen:
|
|
554
|
-
onSuccess:
|
|
555
|
-
onClose:
|
|
556
|
-
autoCloseOnSuccess:
|
|
557
|
-
popupsBlocked:
|
|
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:
|
|
689
|
+
debug: k
|
|
560
690
|
}) => {
|
|
561
|
-
const P =
|
|
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:
|
|
570
|
-
appMetadata:
|
|
571
|
-
enableRefundEmails:
|
|
572
|
-
payerEmail:
|
|
699
|
+
allowedPaymentCurrencies: d,
|
|
700
|
+
appMetadata: a,
|
|
701
|
+
enableRefundEmails: f,
|
|
702
|
+
payerEmail: c,
|
|
573
703
|
mode: "pay",
|
|
574
|
-
hideSettlementCopy:
|
|
575
|
-
showAppLogo:
|
|
576
|
-
showOnrampFirst:
|
|
577
|
-
debitCardAlias:
|
|
578
|
-
copyOverrides:
|
|
579
|
-
sessionId:
|
|
580
|
-
amount:
|
|
581
|
-
sessionMetadata:
|
|
582
|
-
theme:
|
|
583
|
-
walletProvider:
|
|
584
|
-
localStorageProvider:
|
|
585
|
-
onOpen:
|
|
586
|
-
onSuccess:
|
|
587
|
-
onClose:
|
|
588
|
-
autoCloseOnSuccess:
|
|
589
|
-
popupsBlocked:
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
745
|
+
v,
|
|
614
746
|
x,
|
|
615
|
-
u,
|
|
616
|
-
I,
|
|
617
|
-
U,
|
|
618
747
|
E,
|
|
619
|
-
|
|
748
|
+
U,
|
|
749
|
+
M,
|
|
620
750
|
C,
|
|
621
|
-
|
|
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
|
-
},
|
|
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:
|
|
637
|
-
sessionMetadata:
|
|
638
|
-
showAppLogo:
|
|
639
|
-
showOnrampFirst:
|
|
640
|
-
debitCardAlias:
|
|
641
|
-
copyOverrides:
|
|
642
|
-
theme:
|
|
643
|
-
walletProvider:
|
|
644
|
-
localStorageProvider:
|
|
645
|
-
onOpen:
|
|
646
|
-
onSuccess:
|
|
647
|
-
onClose:
|
|
648
|
-
autoCloseOnSuccess:
|
|
649
|
-
popupsBlocked:
|
|
650
|
-
baseUrl:
|
|
651
|
-
debug:
|
|
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
|
|
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:
|
|
662
|
-
sessionMetadata:
|
|
663
|
-
showAppLogo:
|
|
664
|
-
showOnrampFirst:
|
|
665
|
-
debitCardAlias:
|
|
666
|
-
copyOverrides:
|
|
791
|
+
excludeFundingSources: d,
|
|
792
|
+
sessionMetadata: a,
|
|
793
|
+
showAppLogo: f,
|
|
794
|
+
showOnrampFirst: c,
|
|
795
|
+
debitCardAlias: n,
|
|
796
|
+
copyOverrides: h,
|
|
667
797
|
mode: "call",
|
|
668
|
-
theme:
|
|
669
|
-
walletProvider:
|
|
670
|
-
localStorageProvider:
|
|
671
|
-
onOpen:
|
|
672
|
-
onSuccess:
|
|
673
|
-
onClose:
|
|
674
|
-
autoCloseOnSuccess:
|
|
675
|
-
popupsBlocked:
|
|
676
|
-
baseUrl:
|
|
677
|
-
debug:
|
|
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
|
-
|
|
821
|
+
h,
|
|
822
|
+
l,
|
|
823
|
+
m,
|
|
824
|
+
u,
|
|
689
825
|
g,
|
|
690
|
-
|
|
826
|
+
$,
|
|
691
827
|
y,
|
|
828
|
+
I,
|
|
692
829
|
w,
|
|
693
|
-
b,
|
|
694
|
-
$,
|
|
695
|
-
l,
|
|
696
|
-
v,
|
|
697
|
-
c,
|
|
698
830
|
S,
|
|
699
|
-
|
|
700
|
-
x,
|
|
701
|
-
u
|
|
831
|
+
v
|
|
702
832
|
]);
|
|
703
833
|
return {
|
|
704
|
-
openGlideCall:
|
|
705
|
-
externalUrl:
|
|
706
|
-
opts:
|
|
834
|
+
openGlideCall: x.open,
|
|
835
|
+
externalUrl: x.externalUrl,
|
|
836
|
+
opts: x.opts
|
|
707
837
|
};
|
|
708
|
-
},
|
|
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:
|
|
717
|
-
excludeFundingSources:
|
|
718
|
-
sessionMetadata:
|
|
719
|
-
showAppLogo:
|
|
720
|
-
showOnrampFirst:
|
|
721
|
-
debitCardAlias:
|
|
722
|
-
copyOverrides:
|
|
723
|
-
theme:
|
|
724
|
-
walletProvider:
|
|
725
|
-
localStorageProvider:
|
|
726
|
-
onOpen:
|
|
727
|
-
onSuccess:
|
|
728
|
-
onClose:
|
|
729
|
-
autoCloseOnSuccess:
|
|
730
|
-
baseUrl:
|
|
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
|
|
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:
|
|
741
|
-
excludeFundingSources:
|
|
742
|
-
sessionMetadata:
|
|
743
|
-
showAppLogo:
|
|
744
|
-
showOnrampFirst:
|
|
745
|
-
debitCardAlias:
|
|
746
|
-
copyOverrides:
|
|
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:
|
|
749
|
-
walletProvider:
|
|
750
|
-
localStorageProvider:
|
|
751
|
-
onOpen:
|
|
752
|
-
onSuccess:
|
|
753
|
-
onClose:
|
|
754
|
-
autoCloseOnSuccess:
|
|
755
|
-
baseUrl:
|
|
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
|
-
|
|
899
|
+
h,
|
|
900
|
+
l,
|
|
901
|
+
m,
|
|
902
|
+
u,
|
|
767
903
|
g,
|
|
768
|
-
|
|
904
|
+
$,
|
|
769
905
|
y,
|
|
906
|
+
I,
|
|
770
907
|
w,
|
|
771
|
-
|
|
772
|
-
$,
|
|
773
|
-
l,
|
|
774
|
-
v,
|
|
775
|
-
c,
|
|
776
|
-
S,
|
|
777
|
-
h,
|
|
778
|
-
x
|
|
908
|
+
S
|
|
779
909
|
]);
|
|
780
910
|
return {
|
|
781
|
-
openGlideBuy:
|
|
782
|
-
externalUrl:
|
|
783
|
-
opts:
|
|
911
|
+
openGlideBuy: v.open,
|
|
912
|
+
externalUrl: v.externalUrl,
|
|
913
|
+
opts: v.opts
|
|
784
914
|
};
|
|
785
|
-
},
|
|
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
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
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
package/dist/theme.d.ts
CHANGED
|
@@ -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.
|
|
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": "
|
|
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": "
|
|
25
|
+
"prepublishOnly": "bun run build"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@paywithglide/glide-js": "0.13.10"
|