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