@paywithglide/glide-react 0.0.47 → 0.0.49
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/core.js +291 -379
- package/dist/glide.js +152 -136
- package/dist/pkg/GlideDeposit.d.ts +8 -8
- package/dist/pkg/analytics.d.ts +0 -19
- package/dist/pkg/useGlideBuy.d.ts +3 -2
- package/dist/pkg/useGlideCall.d.ts +3 -2
- package/dist/pkg/useGlideDeposit.d.ts +5 -2
- package/dist/pkg/useGlidePay.d.ts +3 -2
- package/package.json +6 -1
package/dist/core.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
return !s || typeof s != "string" ? !1 :
|
|
1
|
+
var ce = Object.defineProperty;
|
|
2
|
+
var le = (s, t, e) => t in s ? ce(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var I = (s, t, e) => le(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
function pe(s, { strict: t = !0 } = {}) {
|
|
5
|
+
return !s || typeof s != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(s) : s.startsWith("0x");
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
return
|
|
7
|
+
function Z(s) {
|
|
8
|
+
return pe(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
let
|
|
12
|
-
getDocsUrl: ({ docsBaseUrl: s, docsPath:
|
|
13
|
-
version: `viem@${
|
|
10
|
+
const ee = "2.21.51";
|
|
11
|
+
let w = {
|
|
12
|
+
getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
|
|
13
|
+
version: `viem@${ee}`
|
|
14
14
|
};
|
|
15
15
|
class v extends Error {
|
|
16
|
-
constructor(
|
|
17
|
-
var
|
|
16
|
+
constructor(t, e = {}) {
|
|
17
|
+
var l;
|
|
18
18
|
const i = (() => {
|
|
19
|
-
var
|
|
20
|
-
return
|
|
21
|
-
})(), o =
|
|
22
|
-
|
|
19
|
+
var d;
|
|
20
|
+
return e.cause instanceof v ? e.cause.details : (d = e.cause) != null && d.message ? e.cause.message : e.details;
|
|
21
|
+
})(), o = e.cause instanceof v && e.cause.docsPath || e.docsPath, n = (l = w.getDocsUrl) == null ? void 0 : l.call(w, { ...e, docsPath: o }), p = [
|
|
22
|
+
t || "An error occurred.",
|
|
23
23
|
"",
|
|
24
|
-
...
|
|
24
|
+
...e.metaMessages ? [...e.metaMessages, ""] : [],
|
|
25
25
|
...n ? [`Docs: ${n}`] : [],
|
|
26
26
|
...i ? [`Details: ${i}`] : [],
|
|
27
|
-
...
|
|
27
|
+
...w.version ? [`Version: ${w.version}`] : []
|
|
28
28
|
].join(`
|
|
29
29
|
`);
|
|
30
|
-
super(
|
|
30
|
+
super(p, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
|
|
31
31
|
enumerable: !0,
|
|
32
32
|
configurable: !0,
|
|
33
33
|
writable: !0,
|
|
@@ -57,130 +57,130 @@ class v extends Error {
|
|
|
57
57
|
configurable: !0,
|
|
58
58
|
writable: !0,
|
|
59
59
|
value: "BaseError"
|
|
60
|
-
}), this.details = i, this.docsPath = o, this.metaMessages =
|
|
60
|
+
}), this.details = i, this.docsPath = o, this.metaMessages = e.metaMessages, this.name = e.name ?? this.name, this.shortMessage = t, this.version = ee;
|
|
61
61
|
}
|
|
62
|
-
walk(
|
|
63
|
-
return
|
|
62
|
+
walk(t) {
|
|
63
|
+
return te(this, t);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return
|
|
66
|
+
function te(s, t) {
|
|
67
|
+
return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? te(s.cause, t) : t ? null : s;
|
|
68
68
|
}
|
|
69
|
-
class
|
|
70
|
-
constructor({ size:
|
|
71
|
-
super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (${
|
|
69
|
+
class se extends v {
|
|
70
|
+
constructor({ size: t, targetSize: e, type: i }) {
|
|
71
|
+
super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
function
|
|
75
|
-
return typeof s == "string" ?
|
|
74
|
+
function P(s, { dir: t, size: e = 32 } = {}) {
|
|
75
|
+
return typeof s == "string" ? he(s, { dir: t, size: e }) : ue(s, { dir: t, size: e });
|
|
76
76
|
}
|
|
77
|
-
function
|
|
78
|
-
if (
|
|
77
|
+
function he(s, { dir: t, size: e = 32 } = {}) {
|
|
78
|
+
if (e === null)
|
|
79
79
|
return s;
|
|
80
80
|
const i = s.replace("0x", "");
|
|
81
|
-
if (i.length >
|
|
82
|
-
throw new
|
|
81
|
+
if (i.length > e * 2)
|
|
82
|
+
throw new se({
|
|
83
83
|
size: Math.ceil(i.length / 2),
|
|
84
|
-
targetSize:
|
|
84
|
+
targetSize: e,
|
|
85
85
|
type: "hex"
|
|
86
86
|
});
|
|
87
|
-
return `0x${i[
|
|
87
|
+
return `0x${i[t === "right" ? "padEnd" : "padStart"](e * 2, "0")}`;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
if (
|
|
89
|
+
function ue(s, { dir: t, size: e = 32 } = {}) {
|
|
90
|
+
if (e === null)
|
|
91
91
|
return s;
|
|
92
|
-
if (s.length >
|
|
93
|
-
throw new
|
|
92
|
+
if (s.length > e)
|
|
93
|
+
throw new se({
|
|
94
94
|
size: s.length,
|
|
95
|
-
targetSize:
|
|
95
|
+
targetSize: e,
|
|
96
96
|
type: "bytes"
|
|
97
97
|
});
|
|
98
|
-
const i = new Uint8Array(
|
|
99
|
-
for (let o = 0; o <
|
|
100
|
-
const n =
|
|
101
|
-
i[n ? o :
|
|
98
|
+
const i = new Uint8Array(e);
|
|
99
|
+
for (let o = 0; o < e; o++) {
|
|
100
|
+
const n = t === "right";
|
|
101
|
+
i[n ? o : e - o - 1] = s[n ? o : s.length - o - 1];
|
|
102
102
|
}
|
|
103
103
|
return i;
|
|
104
104
|
}
|
|
105
|
-
class
|
|
106
|
-
constructor({ max:
|
|
107
|
-
super(`Number "${n}" is not in safe ${o ? `${o * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${
|
|
105
|
+
class me extends v {
|
|
106
|
+
constructor({ max: t, min: e, signed: i, size: o, value: n }) {
|
|
107
|
+
super(`Number "${n}" is not in safe ${o ? `${o * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${e} to ${t})` : `(above ${e})`}`, { name: "IntegerOutOfRangeError" });
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
class
|
|
111
|
-
constructor({ givenSize:
|
|
112
|
-
super(`Size cannot exceed ${
|
|
110
|
+
class ge extends v {
|
|
111
|
+
constructor({ givenSize: t, maxSize: e }) {
|
|
112
|
+
super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
if (
|
|
117
|
-
throw new
|
|
118
|
-
givenSize:
|
|
119
|
-
maxSize:
|
|
115
|
+
function ie(s, { size: t }) {
|
|
116
|
+
if (Z(s) > t)
|
|
117
|
+
throw new ge({
|
|
118
|
+
givenSize: Z(s),
|
|
119
|
+
maxSize: t
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
const
|
|
123
|
-
function
|
|
124
|
-
return typeof s == "number" || typeof s == "bigint" ?
|
|
122
|
+
const fe = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
|
|
123
|
+
function ye(s, t = {}) {
|
|
124
|
+
return typeof s == "number" || typeof s == "bigint" ? we(s, t) : typeof s == "string" ? $e(s, t) : typeof s == "boolean" ? ve(s, t) : oe(s, t);
|
|
125
125
|
}
|
|
126
|
-
function
|
|
127
|
-
const
|
|
128
|
-
return typeof
|
|
126
|
+
function ve(s, t = {}) {
|
|
127
|
+
const e = `0x${Number(s)}`;
|
|
128
|
+
return typeof t.size == "number" ? (ie(e, { size: t.size }), P(e, { size: t.size })) : e;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
131
|
-
let
|
|
130
|
+
function oe(s, t = {}) {
|
|
131
|
+
let e = "";
|
|
132
132
|
for (let o = 0; o < s.length; o++)
|
|
133
|
-
|
|
134
|
-
const i = `0x${
|
|
135
|
-
return typeof
|
|
133
|
+
e += fe[s[o]];
|
|
134
|
+
const i = `0x${e}`;
|
|
135
|
+
return typeof t.size == "number" ? (ie(i, { size: t.size }), P(i, { dir: "right", size: t.size })) : i;
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
const { signed:
|
|
137
|
+
function we(s, t = {}) {
|
|
138
|
+
const { signed: e, size: i } = t, o = BigInt(s);
|
|
139
139
|
let n;
|
|
140
|
-
i ?
|
|
141
|
-
const
|
|
142
|
-
if (n && o > n || o <
|
|
143
|
-
const
|
|
144
|
-
throw new
|
|
145
|
-
max: n ? `${n}${
|
|
146
|
-
min: `${
|
|
147
|
-
signed:
|
|
140
|
+
i ? e ? n = (1n << BigInt(i) * 8n - 1n) - 1n : n = 2n ** (BigInt(i) * 8n) - 1n : typeof s == "number" && (n = BigInt(Number.MAX_SAFE_INTEGER));
|
|
141
|
+
const p = typeof n == "bigint" && e ? -n - 1n : 0;
|
|
142
|
+
if (n && o > n || o < p) {
|
|
143
|
+
const d = typeof s == "bigint" ? "n" : "";
|
|
144
|
+
throw new me({
|
|
145
|
+
max: n ? `${n}${d}` : void 0,
|
|
146
|
+
min: `${p}${d}`,
|
|
147
|
+
signed: e,
|
|
148
148
|
size: i,
|
|
149
|
-
value: `${s}${
|
|
149
|
+
value: `${s}${d}`
|
|
150
150
|
});
|
|
151
151
|
}
|
|
152
|
-
const
|
|
153
|
-
return i ?
|
|
152
|
+
const l = `0x${(e && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
|
|
153
|
+
return i ? P(l, { size: i }) : l;
|
|
154
154
|
}
|
|
155
|
-
const
|
|
156
|
-
function
|
|
157
|
-
const
|
|
158
|
-
return
|
|
155
|
+
const be = /* @__PURE__ */ new TextEncoder();
|
|
156
|
+
function $e(s, t = {}) {
|
|
157
|
+
const e = be.encode(s);
|
|
158
|
+
return oe(e, t);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function Se(s) {
|
|
161
161
|
return s instanceof Error;
|
|
162
162
|
}
|
|
163
|
-
let
|
|
164
|
-
function
|
|
165
|
-
if (
|
|
163
|
+
let Q = !1;
|
|
164
|
+
function Ie(s) {
|
|
165
|
+
if (Q)
|
|
166
166
|
return;
|
|
167
|
-
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
-
|
|
167
|
+
Q = !0;
|
|
168
|
+
const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), o = (p) => {
|
|
169
|
+
const l = p.detail;
|
|
170
|
+
t.has(l.info.uuid) || t.set(l.info.uuid, l);
|
|
171
171
|
};
|
|
172
|
-
window.addEventListener("eip6963:announceProvider", o), window.dispatchEvent(new Event("eip6963:requestProvider")), window.addEventListener("message", async (
|
|
173
|
-
var
|
|
174
|
-
if (
|
|
175
|
-
const { type:
|
|
176
|
-
switch (
|
|
172
|
+
window.addEventListener("eip6963:announceProvider", o), window.dispatchEvent(new Event("eip6963:requestProvider")), window.addEventListener("message", async (p) => {
|
|
173
|
+
var f;
|
|
174
|
+
if (p.origin !== s) return;
|
|
175
|
+
const { type: l, data: d } = p.data;
|
|
176
|
+
switch (l) {
|
|
177
177
|
case "glide:getProviders": {
|
|
178
|
-
const
|
|
179
|
-
({ info: u, provider:
|
|
178
|
+
const c = Array.from(t.values()).map(
|
|
179
|
+
({ info: u, provider: h }) => ({
|
|
180
180
|
info: u,
|
|
181
|
-
isConnected: typeof
|
|
182
|
-
chainId:
|
|
183
|
-
selectedAddress:
|
|
181
|
+
isConnected: typeof h.isConnected == "boolean" ? h.isConnected : void 0,
|
|
182
|
+
chainId: h.chainId,
|
|
183
|
+
selectedAddress: h.selectedAddress
|
|
184
184
|
})
|
|
185
185
|
), r = document.getElementById(
|
|
186
186
|
"glide-deposit-iframe"
|
|
@@ -188,126 +188,107 @@ function me(s) {
|
|
|
188
188
|
r != null && r.contentWindow && r.contentWindow.postMessage(
|
|
189
189
|
{
|
|
190
190
|
type: "glide:providers",
|
|
191
|
-
providers:
|
|
191
|
+
providers: c
|
|
192
192
|
},
|
|
193
193
|
s
|
|
194
194
|
);
|
|
195
195
|
break;
|
|
196
196
|
}
|
|
197
197
|
case "glide:providerRequest": {
|
|
198
|
-
const { uuid:
|
|
198
|
+
const { uuid: c, requestId: r, method: u, params: h } = d;
|
|
199
199
|
if (i.has(r))
|
|
200
200
|
return;
|
|
201
201
|
i.set(r, !0);
|
|
202
|
-
const g =
|
|
202
|
+
const g = t.get(c);
|
|
203
203
|
if (!g) {
|
|
204
204
|
i.delete(r), n(r, { error: "Provider not found" });
|
|
205
205
|
return;
|
|
206
206
|
}
|
|
207
207
|
try {
|
|
208
|
-
const
|
|
208
|
+
const m = await g.provider.request({
|
|
209
209
|
method: u,
|
|
210
|
-
params:
|
|
210
|
+
params: h
|
|
211
211
|
});
|
|
212
|
-
i.delete(r), n(r, { result:
|
|
213
|
-
} catch (
|
|
214
|
-
i.delete(r),
|
|
215
|
-
error:
|
|
216
|
-
code:
|
|
217
|
-
data:
|
|
212
|
+
i.delete(r), n(r, { result: m });
|
|
213
|
+
} catch (m) {
|
|
214
|
+
i.delete(r), Se(m) ? n(r, {
|
|
215
|
+
error: m.message || String(m),
|
|
216
|
+
code: m.code,
|
|
217
|
+
data: m.data
|
|
218
218
|
}) : n(r, {
|
|
219
|
-
error: String(
|
|
219
|
+
error: String(m)
|
|
220
220
|
});
|
|
221
221
|
}
|
|
222
222
|
break;
|
|
223
223
|
}
|
|
224
224
|
case "glide:addEventListener": {
|
|
225
|
-
const { uuid:
|
|
226
|
-
if (!
|
|
225
|
+
const { uuid: c, requestId: r, eventName: u } = d, h = t.get(c);
|
|
226
|
+
if (!h || !h.provider.on) {
|
|
227
227
|
n(r, { error: "Provider or method not found" });
|
|
228
228
|
return;
|
|
229
229
|
}
|
|
230
|
-
const g = (...
|
|
231
|
-
const
|
|
230
|
+
const g = (...m) => {
|
|
231
|
+
const y = document.getElementById(
|
|
232
232
|
"glide-deposit-iframe"
|
|
233
233
|
);
|
|
234
|
-
|
|
234
|
+
y != null && y.contentWindow && y.contentWindow.postMessage(
|
|
235
235
|
{
|
|
236
236
|
type: "glide:providerEvent",
|
|
237
|
-
uuid:
|
|
237
|
+
uuid: c,
|
|
238
238
|
eventName: u,
|
|
239
|
-
args:
|
|
239
|
+
args: m
|
|
240
240
|
},
|
|
241
241
|
s
|
|
242
242
|
);
|
|
243
243
|
};
|
|
244
|
-
|
|
244
|
+
e.has(c) || e.set(c, /* @__PURE__ */ new Map()), e.get(c).has(u) || e.get(c).set(u, /* @__PURE__ */ new Set()), e.get(c).get(u).add(g), h.provider.on(u, g), n(r, { result: !0 });
|
|
245
245
|
break;
|
|
246
246
|
}
|
|
247
247
|
case "glide:removeEventListener": {
|
|
248
|
-
const { uuid:
|
|
249
|
-
if (!
|
|
248
|
+
const { uuid: c, requestId: r, eventName: u } = d, h = t.get(c);
|
|
249
|
+
if (!h || !h.provider.removeListener) {
|
|
250
250
|
n(r, { error: "Provider or method not found" });
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
253
|
-
const g = (
|
|
254
|
-
g && (g.forEach((
|
|
255
|
-
|
|
253
|
+
const g = (f = e.get(c)) == null ? void 0 : f.get(u);
|
|
254
|
+
g && (g.forEach((m) => {
|
|
255
|
+
h.provider.removeListener(u, m);
|
|
256
256
|
}), g.clear()), n(r, { result: !0 });
|
|
257
257
|
break;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
|
-
function n(
|
|
262
|
-
const
|
|
261
|
+
function n(p, l) {
|
|
262
|
+
const d = document.getElementById(
|
|
263
263
|
"glide-deposit-iframe"
|
|
264
264
|
);
|
|
265
|
-
|
|
265
|
+
d != null && d.contentWindow && d.contentWindow.postMessage(
|
|
266
266
|
{
|
|
267
267
|
type: "glide:providerResponse",
|
|
268
|
-
requestId:
|
|
269
|
-
...
|
|
268
|
+
requestId: p,
|
|
269
|
+
...l
|
|
270
270
|
},
|
|
271
271
|
s
|
|
272
272
|
);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
const
|
|
276
|
-
name:
|
|
277
|
-
version:
|
|
278
|
-
type:
|
|
279
|
-
files:
|
|
280
|
-
module:
|
|
281
|
-
types:
|
|
282
|
-
exports:
|
|
283
|
-
sideEffects:
|
|
284
|
-
scripts:
|
|
285
|
-
dependencies:
|
|
286
|
-
devDependencies:
|
|
287
|
-
},
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
return /iphone|ipad|ipod/.test(s) || e === "macintel" && navigator.maxTouchPoints > 1 ? "ios" : /android/.test(s) ? "android" : /win/.test(e) || /windows/.test(s) ? "windows" : /mac/.test(e) && !/iphone|ipad|ipod/.test(s) ? "macos" : /linux/.test(e) || /linux/.test(s) ? "linux" : "unknown";
|
|
293
|
-
}
|
|
294
|
-
function Ce() {
|
|
295
|
-
if (typeof navigator > "u") return "unknown";
|
|
296
|
-
const s = navigator.userAgent;
|
|
297
|
-
return s.includes("Firefox") ? "firefox" : s.includes("Edg") ? "edge" : s.includes("Chrome") ? "chrome" : s.includes("Safari") ? "safari" : s.includes("Opera") || s.includes("OPR") ? "opera" : "unknown";
|
|
298
|
-
}
|
|
299
|
-
function Ae() {
|
|
300
|
-
if (typeof navigator > "u") return !1;
|
|
301
|
-
const s = navigator.userAgent.toLowerCase();
|
|
302
|
-
return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/.test(
|
|
303
|
-
s
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
const H = 999999;
|
|
307
|
-
class Te {
|
|
308
|
-
constructor(e) {
|
|
309
|
-
w(this, "opts");
|
|
310
|
-
w(this, "open", () => {
|
|
275
|
+
const Pe = "@paywithglide/glide-react", xe = "0.0.49", Ee = "module", Ce = ["dist"], ke = "dist/glide.js", Me = "dist/index.d.ts", Ae = { ".": { types: "./dist/index.d.ts", default: "./dist/glide.js" }, "./core": { types: "./dist/core.d.ts", default: "./dist/core.js" }, "./package.json": "./package.json" }, Ue = !1, Te = { dev: "vite", build: "bun run lint && vite build", "build-web": "tsc --p ./tsconfig.build.json && vite build --mode web", "build-chromeext": "tsc --p ./tsconfig.build.json && vite build --mode chromeext:popup && vite build --mode chromeext:content && vite build --mode chromeext:background", lint: "prettier --check . && eslint . --max-warnings 0 && tsc --p ./tsconfig.build.json", preview: "vite preview", prepublishOnly: "bun run build" }, We = { "@paywithglide/glide-js": "0.13.32" }, je = { "@antiwork/shortest": "^0.2.1", "@eslint/js": "^9.15.0", "@privy-io/react-auth": "^3.10.1", "@solana-program/memo": "^0.10.0", "@solana-program/system": "^0.10.0", "@solana-program/token": "^0.9.0", "@solana/kit": "^5.1.0", "@tanstack/react-query": "^5.61.5", "@types/chrome": "^0.0.299", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@vitejs/plugin-react": "^4.3.4", eslint: "^9.15.0", "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-refresh": "^0.4.14", globals: "^15.12.0", prettier: "^3.6.2", react: "^18.3.1", "react-dom": "^18.3.1", typescript: "~5.6.2", "typescript-eslint": "^8.15.0", viem: "^2.21.51", vite: "^6.0.1", "vite-plugin-dts": "^4.3.0", "vite-plugin-static-copy": "^2.2.0", wagmi: "^2.13.0" }, ze = {
|
|
276
|
+
name: Pe,
|
|
277
|
+
version: xe,
|
|
278
|
+
type: Ee,
|
|
279
|
+
files: Ce,
|
|
280
|
+
module: ke,
|
|
281
|
+
types: Me,
|
|
282
|
+
exports: Ae,
|
|
283
|
+
sideEffects: Ue,
|
|
284
|
+
scripts: Te,
|
|
285
|
+
dependencies: We,
|
|
286
|
+
devDependencies: je
|
|
287
|
+
}, De = ze.version, Y = 999999;
|
|
288
|
+
class Re {
|
|
289
|
+
constructor(t) {
|
|
290
|
+
I(this, "opts");
|
|
291
|
+
I(this, "open", () => {
|
|
311
292
|
if (!(!this.opts.container && document.body.classList.contains("glide-deposit-open"))) {
|
|
312
293
|
if (this.opts.container || document.body.classList.add("glide-deposit-open"), (this.opts.mode === "deposit" || this.opts.mode === "buy") && !this.opts.recipient)
|
|
313
294
|
throw new Error("recipient is required for deposit/buy mode");
|
|
@@ -318,30 +299,31 @@ class Te {
|
|
|
318
299
|
this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
|
|
319
300
|
}
|
|
320
301
|
});
|
|
321
|
-
|
|
322
|
-
var i, o, n,
|
|
323
|
-
const
|
|
324
|
-
switch (
|
|
302
|
+
I(this, "iframeEventHandler", async (t) => {
|
|
303
|
+
var i, o, n, p, l, d, f, c, r, u, h, g, m, y, x, b, E, $, C, S, k, M, A, U, T, W, j, z, D, O, R, L, B, F, G, H, q, K, N, _, V, J, X;
|
|
304
|
+
const e = t.data;
|
|
305
|
+
switch (e.type) {
|
|
325
306
|
case "sendInit": {
|
|
326
|
-
const
|
|
327
|
-
(
|
|
307
|
+
const a = this.opts.recipient, ne = ((i = this.opts.walletProvider) == null ? void 0 : i.address) || ((o = this.opts.solanaWalletProvider) == null ? void 0 : o.address), re = (n = this.opts.walletProvider) == null ? void 0 : n.availableChainIds, ae = ((p = this.opts.walletProvider) == null ? void 0 : p.currentChainId) || ((l = this.opts.solanaWalletProvider) == null ? void 0 : l.currentChainId), de = this.opts.preferGaslessPayment || !!((d = this.opts.walletProvider) != null && d.signTypedDataAsync);
|
|
308
|
+
(r = (f = this.iframe) == null ? void 0 : f.contentWindow) == null || r.postMessage(
|
|
328
309
|
{
|
|
329
310
|
type: "initialize",
|
|
330
311
|
// Analytics context - project identification
|
|
331
312
|
projectId: this.opts.projectId,
|
|
332
313
|
appSlug: this.opts.app,
|
|
333
314
|
sessionId: this.opts.sessionId,
|
|
334
|
-
recipient:
|
|
335
|
-
connectedWalletAddress:
|
|
336
|
-
availableChainIds:
|
|
337
|
-
currentChainId:
|
|
338
|
-
preferGaslessPayment:
|
|
315
|
+
recipient: a,
|
|
316
|
+
connectedWalletAddress: ne,
|
|
317
|
+
availableChainIds: re,
|
|
318
|
+
currentChainId: ae,
|
|
319
|
+
preferGaslessPayment: de,
|
|
339
320
|
chainIds: this.opts.chainIds,
|
|
340
321
|
excludeChainIds: this.opts.excludeChainIds,
|
|
341
322
|
excludeCurrencyTiers: this.opts.excludeCurrencyTiers,
|
|
342
323
|
excludeFundingSources: this.opts.excludeFundingSources,
|
|
343
324
|
fundingSources: this.opts.fundingSources,
|
|
344
325
|
allowedPaymentCurrencies: this.opts.allowedPaymentCurrencies,
|
|
326
|
+
excludePaymentCurrencies: this.opts.excludePaymentCurrencies,
|
|
345
327
|
appMetadata: this.opts.appMetadata,
|
|
346
328
|
enableRefundEmails: this.opts.enableRefundEmails,
|
|
347
329
|
payerEmail: this.opts.payerEmail,
|
|
@@ -362,14 +344,14 @@ class Te {
|
|
|
362
344
|
stableDepositAddressKey: this.opts.stableDepositAddressKey,
|
|
363
345
|
theme: {
|
|
364
346
|
...this.opts.theme || {},
|
|
365
|
-
colorScheme: ((
|
|
347
|
+
colorScheme: ((c = this.opts.theme) == null ? void 0 : c.colorScheme) || getComputedStyle(document.documentElement).colorScheme || "",
|
|
366
348
|
safeInsetBottom: this.getSafeInsetBottom()
|
|
367
349
|
},
|
|
368
350
|
didProvideLocalStorage: !!this.opts.localStorageProvider,
|
|
369
351
|
debug: this.opts.debug,
|
|
370
352
|
popupsBlocked: this.opts.popupsBlocked,
|
|
371
353
|
gasRefuelAmountPerChain: this.opts.gasRefuelAmountPerChain,
|
|
372
|
-
sdkVersion:
|
|
354
|
+
sdkVersion: De,
|
|
373
355
|
referrerDomain: typeof window < "u" ? window.location.origin : void 0,
|
|
374
356
|
hasAnalyticsCallback: !!this.opts.onAnalyticsEvent
|
|
375
357
|
},
|
|
@@ -378,23 +360,20 @@ class Te {
|
|
|
378
360
|
break;
|
|
379
361
|
}
|
|
380
362
|
case "didOpen": {
|
|
381
|
-
this.iframe.style.opacity = "1", (
|
|
382
|
-
type: "modal_opened",
|
|
383
|
-
timestamp: Date.now()
|
|
384
|
-
});
|
|
363
|
+
this.iframe.style.opacity = "1", (h = (u = this.opts).onOpen) == null || h.call(u);
|
|
385
364
|
break;
|
|
386
365
|
}
|
|
387
366
|
case "analyticsEvent":
|
|
388
|
-
this.opts.onAnalyticsEvent &&
|
|
367
|
+
this.opts.onAnalyticsEvent && e.event && this.opts.onAnalyticsEvent(e.event);
|
|
389
368
|
break;
|
|
390
369
|
case "localStorage.getKeys": {
|
|
391
370
|
if (!this.opts.localStorageProvider)
|
|
392
371
|
throw new Error("localStorageProvider is not set");
|
|
393
|
-
const
|
|
394
|
-
(
|
|
372
|
+
const a = await this.opts.localStorageProvider.getKeys();
|
|
373
|
+
(m = (g = this.iframe) == null ? void 0 : g.contentWindow) == null || m.postMessage(
|
|
395
374
|
{
|
|
396
375
|
type: "localStorage.didGetKeys",
|
|
397
|
-
keys:
|
|
376
|
+
keys: a
|
|
398
377
|
},
|
|
399
378
|
this.baseUrl
|
|
400
379
|
);
|
|
@@ -404,66 +383,58 @@ class Te {
|
|
|
404
383
|
if (!this.opts.localStorageProvider)
|
|
405
384
|
throw new Error("localStorageProvider is not set");
|
|
406
385
|
await this.opts.localStorageProvider.setItem(
|
|
407
|
-
|
|
408
|
-
|
|
386
|
+
e.key,
|
|
387
|
+
e.value
|
|
409
388
|
);
|
|
410
389
|
break;
|
|
411
390
|
case "localStorage.removeItem":
|
|
412
391
|
if (!this.opts.localStorageProvider)
|
|
413
392
|
throw new Error("localStorageProvider is not set");
|
|
414
|
-
await this.opts.localStorageProvider.removeItem(
|
|
393
|
+
await this.opts.localStorageProvider.removeItem(e.key);
|
|
415
394
|
break;
|
|
416
395
|
case "localStorage.getItem": {
|
|
417
396
|
if (!this.opts.localStorageProvider)
|
|
418
397
|
throw new Error("localStorageProvider is not set");
|
|
419
|
-
const
|
|
420
|
-
(
|
|
398
|
+
const a = await this.opts.localStorageProvider.getItem(e.key);
|
|
399
|
+
(x = (y = this.iframe) == null ? void 0 : y.contentWindow) == null || x.postMessage(
|
|
421
400
|
{
|
|
422
401
|
type: "localStorage.didGetItem",
|
|
423
|
-
key:
|
|
424
|
-
value:
|
|
402
|
+
key: e.key,
|
|
403
|
+
value: a
|
|
425
404
|
},
|
|
426
405
|
this.baseUrl
|
|
427
406
|
);
|
|
428
407
|
break;
|
|
429
408
|
}
|
|
430
409
|
case "success":
|
|
431
|
-
(
|
|
432
|
-
type: "modal_closed",
|
|
433
|
-
timestamp: Date.now(),
|
|
434
|
-
completedTransaction: !0
|
|
435
|
-
});
|
|
410
|
+
(E = (b = this.opts) == null ? void 0 : b.onSuccess) == null || E.call(b, e.hash, e.session);
|
|
436
411
|
break;
|
|
437
412
|
case "close":
|
|
438
|
-
this.removeIframe(), this.destroy(), this.
|
|
439
|
-
type: "modal_closed",
|
|
440
|
-
timestamp: Date.now(),
|
|
441
|
-
completedTransaction: !1
|
|
442
|
-
}), (P = ($ = this.opts) == null ? void 0 : $.onClose) == null || P.call($);
|
|
413
|
+
this.removeIframe(), this.destroy(), (C = ($ = this.opts) == null ? void 0 : $.onClose) == null || C.call($);
|
|
443
414
|
break;
|
|
444
415
|
case "setMode":
|
|
445
|
-
(k = (S = this.opts) == null ? void 0 : S.onSetMode) == null || k.call(S,
|
|
416
|
+
(k = (S = this.opts) == null ? void 0 : S.onSetMode) == null || k.call(S, e.mode);
|
|
446
417
|
break;
|
|
447
418
|
case "switchChain":
|
|
448
419
|
if (!this.opts.walletProvider)
|
|
449
420
|
throw new Error("walletProvider is not set");
|
|
450
421
|
try {
|
|
451
422
|
await this.opts.walletProvider.switchChainAsync({
|
|
452
|
-
chainId:
|
|
453
|
-
}), (
|
|
423
|
+
chainId: e.chainId
|
|
424
|
+
}), (A = (M = this.iframe) == null ? void 0 : M.contentWindow) == null || A.postMessage(
|
|
454
425
|
{
|
|
455
426
|
type: "didSwitchChain",
|
|
456
427
|
success: !0,
|
|
457
|
-
chainId:
|
|
428
|
+
chainId: e.chainId
|
|
458
429
|
},
|
|
459
430
|
this.baseUrl
|
|
460
431
|
);
|
|
461
|
-
} catch (
|
|
462
|
-
(
|
|
432
|
+
} catch (a) {
|
|
433
|
+
(T = (U = this.iframe) == null ? void 0 : U.contentWindow) == null || T.postMessage(
|
|
463
434
|
{
|
|
464
435
|
type: "didSwitchChain",
|
|
465
436
|
success: !1,
|
|
466
|
-
error:
|
|
437
|
+
error: a
|
|
467
438
|
},
|
|
468
439
|
this.baseUrl
|
|
469
440
|
);
|
|
@@ -474,23 +445,23 @@ class Te {
|
|
|
474
445
|
if (!this.opts.walletProvider)
|
|
475
446
|
throw new Error("walletProvider is not set");
|
|
476
447
|
try {
|
|
477
|
-
const
|
|
478
|
-
|
|
448
|
+
const a = await this.opts.walletProvider.sendTransactionAsync(
|
|
449
|
+
e.tx
|
|
479
450
|
);
|
|
480
|
-
(
|
|
451
|
+
(j = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || j.postMessage(
|
|
481
452
|
{
|
|
482
453
|
type: "didSendTransaction",
|
|
483
454
|
success: !0,
|
|
484
|
-
txHash:
|
|
455
|
+
txHash: a
|
|
485
456
|
},
|
|
486
457
|
this.baseUrl
|
|
487
458
|
);
|
|
488
|
-
} catch (
|
|
489
|
-
(
|
|
459
|
+
} catch (a) {
|
|
460
|
+
(D = (z = this.iframe) == null ? void 0 : z.contentWindow) == null || D.postMessage(
|
|
490
461
|
{
|
|
491
462
|
type: "didSendTransaction",
|
|
492
463
|
success: !1,
|
|
493
|
-
error:
|
|
464
|
+
error: a
|
|
494
465
|
},
|
|
495
466
|
this.baseUrl
|
|
496
467
|
);
|
|
@@ -502,7 +473,7 @@ class Te {
|
|
|
502
473
|
if (!this.opts.walletProvider)
|
|
503
474
|
throw new Error("walletProvider is not set");
|
|
504
475
|
if (!this.opts.walletProvider.signTypedDataAsync) {
|
|
505
|
-
(
|
|
476
|
+
(R = (O = this.iframe) == null ? void 0 : O.contentWindow) == null || R.postMessage(
|
|
506
477
|
{
|
|
507
478
|
type: "didSignTypedData",
|
|
508
479
|
success: !1,
|
|
@@ -513,23 +484,79 @@ class Te {
|
|
|
513
484
|
return;
|
|
514
485
|
}
|
|
515
486
|
try {
|
|
516
|
-
const
|
|
517
|
-
|
|
487
|
+
const a = await this.opts.walletProvider.signTypedDataAsync(
|
|
488
|
+
e.data
|
|
518
489
|
);
|
|
519
|
-
(
|
|
490
|
+
(B = (L = this.iframe) == null ? void 0 : L.contentWindow) == null || B.postMessage(
|
|
520
491
|
{
|
|
521
492
|
type: "didSignTypedData",
|
|
522
493
|
success: !0,
|
|
523
|
-
signature:
|
|
494
|
+
signature: a
|
|
524
495
|
},
|
|
525
496
|
this.baseUrl
|
|
526
497
|
);
|
|
527
|
-
} catch (
|
|
528
|
-
(
|
|
498
|
+
} catch (a) {
|
|
499
|
+
(G = (F = this.iframe) == null ? void 0 : F.contentWindow) == null || G.postMessage(
|
|
529
500
|
{
|
|
530
501
|
type: "didSignTypedData",
|
|
531
502
|
success: !1,
|
|
532
|
-
error:
|
|
503
|
+
error: a
|
|
504
|
+
},
|
|
505
|
+
this.baseUrl
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
break;
|
|
510
|
+
case "solana_signMessage":
|
|
511
|
+
{
|
|
512
|
+
if (!this.opts.solanaWalletProvider)
|
|
513
|
+
throw new Error("solanaWalletProvider is not set");
|
|
514
|
+
try {
|
|
515
|
+
const a = await this.opts.solanaWalletProvider.signMessageAsync(
|
|
516
|
+
e.message
|
|
517
|
+
);
|
|
518
|
+
(q = (H = this.iframe) == null ? void 0 : H.contentWindow) == null || q.postMessage(
|
|
519
|
+
{
|
|
520
|
+
type: "solana_didSignMessage",
|
|
521
|
+
success: !0,
|
|
522
|
+
signature: a
|
|
523
|
+
},
|
|
524
|
+
this.baseUrl
|
|
525
|
+
);
|
|
526
|
+
} catch (a) {
|
|
527
|
+
(N = (K = this.iframe) == null ? void 0 : K.contentWindow) == null || N.postMessage(
|
|
528
|
+
{
|
|
529
|
+
type: "solana_didSignMessage",
|
|
530
|
+
success: !1,
|
|
531
|
+
error: a
|
|
532
|
+
},
|
|
533
|
+
this.baseUrl
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
break;
|
|
538
|
+
case "solana_sendTransaction":
|
|
539
|
+
{
|
|
540
|
+
if (!this.opts.solanaWalletProvider)
|
|
541
|
+
throw new Error("solanaWalletProvider is not set");
|
|
542
|
+
try {
|
|
543
|
+
const a = await this.opts.solanaWalletProvider.sendTransactionAsync(
|
|
544
|
+
e.transaction
|
|
545
|
+
);
|
|
546
|
+
(V = (_ = this.iframe) == null ? void 0 : _.contentWindow) == null || V.postMessage(
|
|
547
|
+
{
|
|
548
|
+
type: "solana_didSendTransaction",
|
|
549
|
+
success: !0,
|
|
550
|
+
signature: a
|
|
551
|
+
},
|
|
552
|
+
this.baseUrl
|
|
553
|
+
);
|
|
554
|
+
} catch (a) {
|
|
555
|
+
(X = (J = this.iframe) == null ? void 0 : J.contentWindow) == null || X.postMessage(
|
|
556
|
+
{
|
|
557
|
+
type: "solana_didSendTransaction",
|
|
558
|
+
success: !1,
|
|
559
|
+
error: a
|
|
533
560
|
},
|
|
534
561
|
this.baseUrl
|
|
535
562
|
);
|
|
@@ -538,47 +565,18 @@ class Te {
|
|
|
538
565
|
break;
|
|
539
566
|
}
|
|
540
567
|
});
|
|
541
|
-
this.opts =
|
|
542
|
-
}
|
|
543
|
-
/**
|
|
544
|
-
* Get analytics context for events tracked directly in SDK
|
|
545
|
-
*/
|
|
546
|
-
getAnalyticsContext() {
|
|
547
|
-
var e;
|
|
548
|
-
return {
|
|
549
|
-
projectId: this.opts.projectId,
|
|
550
|
-
appSlug: this.opts.app,
|
|
551
|
-
sdkVersion: G,
|
|
552
|
-
referrerDomain: typeof window < "u" ? window.location.origin : void 0,
|
|
553
|
-
walletAddress: (e = this.opts.walletProvider) == null ? void 0 : e.address,
|
|
554
|
-
device: {
|
|
555
|
-
isMobile: Ae(),
|
|
556
|
-
platform: Ee(),
|
|
557
|
-
browser: Ce()
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* Track an analytics event with context
|
|
563
|
-
*/
|
|
564
|
-
trackEvent(e) {
|
|
565
|
-
if (!this.opts.onAnalyticsEvent) return;
|
|
566
|
-
const t = {
|
|
567
|
-
...e,
|
|
568
|
-
...this.getAnalyticsContext()
|
|
569
|
-
};
|
|
570
|
-
this.opts.onAnalyticsEvent(t);
|
|
568
|
+
this.opts = t;
|
|
571
569
|
}
|
|
572
570
|
get externalUrl() {
|
|
573
|
-
var
|
|
574
|
-
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=${
|
|
571
|
+
var t, e, i, o, n, p, l, d, f, c;
|
|
572
|
+
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=${ye(
|
|
575
573
|
this.opts.evm.value || 0n
|
|
576
|
-
)}` : ""}${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}` : ""}${(
|
|
574
|
+
)}` : ""}${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(",")}` : ""}${(n = this.opts.fundingSources) != null && n.length ? `&fundingSources=${this.opts.fundingSources.join(",")}` : ""}${(p = this.opts.allowedPaymentCurrencies) != null && p.length ? `&allowedPaymentCurrencies=${this.opts.allowedPaymentCurrencies.join(",")}` : ""}${(l = this.opts.excludePaymentCurrencies) != null && l.length ? `&excludePaymentCurrencies=${this.opts.excludePaymentCurrencies.join(",")}` : ""}${(d = this.opts.appMetadata) != null && d.name ? `&appMetadata.name=${encodeURIComponent(this.opts.appMetadata.name)}` : ""}${(f = this.opts.appMetadata) != null && f.logoUrl ? `&appMetadata.logoUrl=${encodeURIComponent(this.opts.appMetadata.logoUrl)}` : ""}${(c = this.opts.appMetadata) != null && c.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))}` : ""}`;
|
|
577
575
|
}
|
|
578
576
|
initialize() {
|
|
579
577
|
window.addEventListener("message", this.iframeEventHandler);
|
|
580
|
-
const
|
|
581
|
-
|
|
578
|
+
const t = new URL(this.baseUrl).origin;
|
|
579
|
+
Ie(t);
|
|
582
580
|
}
|
|
583
581
|
destroy() {
|
|
584
582
|
window.removeEventListener("message", this.iframeEventHandler);
|
|
@@ -593,149 +591,63 @@ class Te {
|
|
|
593
591
|
if (typeof window > "u" || typeof document > "u")
|
|
594
592
|
return 0;
|
|
595
593
|
try {
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
const
|
|
599
|
-
return document.body.removeChild(
|
|
594
|
+
const t = document.createElement("div");
|
|
595
|
+
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);
|
|
596
|
+
const e = window.getComputedStyle(t).paddingBottom;
|
|
597
|
+
return document.body.removeChild(t), parseFloat(e) || 0;
|
|
600
598
|
} catch {
|
|
601
599
|
return 0;
|
|
602
600
|
}
|
|
603
601
|
}
|
|
604
|
-
openUrl(
|
|
605
|
-
this.createIframe(
|
|
602
|
+
openUrl(t) {
|
|
603
|
+
this.createIframe(t);
|
|
606
604
|
}
|
|
607
|
-
createIframe(
|
|
605
|
+
createIframe(t) {
|
|
608
606
|
this.removeIframe();
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
const i = this.opts.container, o = i ? `z-index: ${
|
|
612
|
-
|
|
607
|
+
const e = document.createElement("iframe");
|
|
608
|
+
e.id = "glide-deposit-iframe";
|
|
609
|
+
const i = this.opts.container, o = i ? `z-index: ${Y}; display: block; background-color: transparent; border: 0px none transparent; overflow-x: hidden; overflow-y: auto; visibility: visible; margin: 0px; padding: 0px; -webkit-tap-highlight-color: transparent; position: relative; width: 100%; height: 100%; opacity: 0;` : `z-index: ${Y}; display: block; background-color: transparent; border: 0px none transparent; overflow-x: hidden; overflow-y: auto; visibility: visible; margin: 0px; padding: 0px; -webkit-tap-highlight-color: transparent; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; opacity: 0;`;
|
|
610
|
+
e.setAttribute("style", o), e.src = t, e.allow = "payment *; clipboard-write *", i ? i.appendChild(e) : document.body.appendChild(e);
|
|
613
611
|
}
|
|
614
612
|
removeIframe() {
|
|
615
|
-
const
|
|
616
|
-
|
|
613
|
+
const t = document.getElementById("glide-deposit-iframe");
|
|
614
|
+
t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
|
|
617
615
|
}
|
|
618
616
|
}
|
|
619
|
-
const
|
|
620
|
-
getItem: (s) => new Promise((
|
|
617
|
+
const Le = Object.freeze({
|
|
618
|
+
getItem: (s) => new Promise((t, e) => {
|
|
621
619
|
try {
|
|
622
620
|
const i = localStorage.getItem(s);
|
|
623
|
-
e(i);
|
|
624
|
-
} catch (i) {
|
|
625
621
|
t(i);
|
|
622
|
+
} catch (i) {
|
|
623
|
+
e(i);
|
|
626
624
|
}
|
|
627
625
|
}),
|
|
628
|
-
setItem: (s,
|
|
626
|
+
setItem: (s, t) => new Promise((e, i) => {
|
|
629
627
|
try {
|
|
630
|
-
localStorage.setItem(s,
|
|
628
|
+
localStorage.setItem(s, t), e();
|
|
631
629
|
} catch (o) {
|
|
632
630
|
i(o);
|
|
633
631
|
}
|
|
634
632
|
}),
|
|
635
|
-
removeItem: (s) => new Promise((
|
|
633
|
+
removeItem: (s) => new Promise((t, e) => {
|
|
636
634
|
try {
|
|
637
|
-
localStorage.removeItem(s),
|
|
635
|
+
localStorage.removeItem(s), t();
|
|
638
636
|
} catch (i) {
|
|
639
|
-
|
|
637
|
+
e(i);
|
|
640
638
|
}
|
|
641
639
|
}),
|
|
642
|
-
getKeys: () => new Promise((s,
|
|
640
|
+
getKeys: () => new Promise((s, t) => {
|
|
643
641
|
try {
|
|
644
|
-
const
|
|
645
|
-
s(
|
|
646
|
-
} catch (
|
|
647
|
-
e
|
|
642
|
+
const e = Object.keys(localStorage);
|
|
643
|
+
s(e);
|
|
644
|
+
} catch (e) {
|
|
645
|
+
t(e);
|
|
648
646
|
}
|
|
649
647
|
})
|
|
650
648
|
});
|
|
651
|
-
class Me {
|
|
652
|
-
constructor(e) {
|
|
653
|
-
w(this, "callback");
|
|
654
|
-
w(this, "startTime");
|
|
655
|
-
w(this, "currentStep");
|
|
656
|
-
this.callback = e;
|
|
657
|
-
}
|
|
658
|
-
setCallback(e) {
|
|
659
|
-
this.callback = e;
|
|
660
|
-
}
|
|
661
|
-
track(e) {
|
|
662
|
-
if (this.callback)
|
|
663
|
-
try {
|
|
664
|
-
this.callback(e);
|
|
665
|
-
} catch (t) {
|
|
666
|
-
console.error("Error in analytics callback:", t);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
// Convenience methods for common events
|
|
670
|
-
modalOpened() {
|
|
671
|
-
this.startTime = Date.now(), this.track({
|
|
672
|
-
type: "modal_opened",
|
|
673
|
-
timestamp: Date.now()
|
|
674
|
-
});
|
|
675
|
-
}
|
|
676
|
-
modalClosed(e) {
|
|
677
|
-
this.track({
|
|
678
|
-
type: "modal_closed",
|
|
679
|
-
timestamp: Date.now(),
|
|
680
|
-
completedTransaction: e
|
|
681
|
-
}), this.startTime = void 0, this.currentStep = void 0;
|
|
682
|
-
}
|
|
683
|
-
stepViewed(e) {
|
|
684
|
-
this.currentStep = e, this.track({
|
|
685
|
-
type: "step_viewed",
|
|
686
|
-
step: e,
|
|
687
|
-
timestamp: Date.now()
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
stepExited(e, t) {
|
|
691
|
-
this.track({
|
|
692
|
-
type: "step_exited",
|
|
693
|
-
step: e,
|
|
694
|
-
timestamp: Date.now(),
|
|
695
|
-
direction: t
|
|
696
|
-
});
|
|
697
|
-
}
|
|
698
|
-
paymentMethodSelected(e) {
|
|
699
|
-
this.track({
|
|
700
|
-
type: "payment_method_selected",
|
|
701
|
-
paymentMethod: e,
|
|
702
|
-
timestamp: Date.now()
|
|
703
|
-
});
|
|
704
|
-
}
|
|
705
|
-
transactionCompleted(e, t, i, o) {
|
|
706
|
-
const n = this.startTime ? Date.now() - this.startTime : 0;
|
|
707
|
-
this.track({
|
|
708
|
-
type: "transaction_completed",
|
|
709
|
-
sessionId: e,
|
|
710
|
-
txHash: t,
|
|
711
|
-
paymentMethod: i,
|
|
712
|
-
success: !0,
|
|
713
|
-
amountUSD: o,
|
|
714
|
-
timestamp: Date.now()
|
|
715
|
-
}), this.track({
|
|
716
|
-
type: "conversion_completed",
|
|
717
|
-
sessionId: e,
|
|
718
|
-
paymentMethod: i,
|
|
719
|
-
amountUSD: o,
|
|
720
|
-
duration: n,
|
|
721
|
-
timestamp: Date.now()
|
|
722
|
-
});
|
|
723
|
-
}
|
|
724
|
-
errorOccurred(e, t, i) {
|
|
725
|
-
this.track({
|
|
726
|
-
type: "error_occurred",
|
|
727
|
-
errorType: e,
|
|
728
|
-
errorMessage: t,
|
|
729
|
-
step: i || this.currentStep,
|
|
730
|
-
timestamp: Date.now()
|
|
731
|
-
});
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
const Oe = new Me();
|
|
735
649
|
export {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
Oe as glideAnalytics,
|
|
740
|
-
me as initializeParentBridge
|
|
650
|
+
Re as GlideDeposit,
|
|
651
|
+
Le as browserLocalStorageProvider,
|
|
652
|
+
Ie as initializeParentBridge
|
|
741
653
|
};
|