@paywithglide/glide-react 0.0.48 → 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 CHANGED
@@ -1,33 +1,33 @@
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");
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
7
  function Z(s) {
8
- return ue(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
8
+ return pe(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
9
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}`
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(e, t = {}) {
17
- var c;
16
+ constructor(t, e = {}) {
17
+ var l;
18
18
  const i = (() => {
19
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.",
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
- ...t.metaMessages ? [...t.metaMessages, ""] : [],
24
+ ...e.metaMessages ? [...e.metaMessages, ""] : [],
25
25
  ...n ? [`Docs: ${n}`] : [],
26
26
  ...i ? [`Details: ${i}`] : [],
27
- ...b.version ? [`Version: ${b.version}`] : []
27
+ ...w.version ? [`Version: ${w.version}`] : []
28
28
  ].join(`
29
29
  `);
30
- super(l, t.cause ? { cause: t.cause } : void 0), Object.defineProperty(this, "details", {
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 = t.metaMessages, this.name = t.name ?? this.name, this.shortMessage = e, this.version = te;
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(e) {
63
- return se(this, e);
62
+ walk(t) {
63
+ return te(this, t);
64
64
  }
65
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;
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 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" });
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 x(s, { dir: e, size: t = 32 } = {}) {
75
- return typeof s == "string" ? he(s, { dir: e, size: t }) : me(s, { dir: e, size: t });
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 he(s, { dir: e, size: t = 32 } = {}) {
78
- if (t === null)
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 > t * 2)
82
- throw new ie({
81
+ if (i.length > e * 2)
82
+ throw new se({
83
83
  size: Math.ceil(i.length / 2),
84
- targetSize: t,
84
+ targetSize: e,
85
85
  type: "hex"
86
86
  });
87
- return `0x${i[e === "right" ? "padEnd" : "padStart"](t * 2, "0")}`;
87
+ return `0x${i[t === "right" ? "padEnd" : "padStart"](e * 2, "0")}`;
88
88
  }
89
- function me(s, { dir: e, size: t = 32 } = {}) {
90
- if (t === null)
89
+ function ue(s, { dir: t, size: e = 32 } = {}) {
90
+ if (e === null)
91
91
  return s;
92
- if (s.length > t)
93
- throw new ie({
92
+ if (s.length > e)
93
+ throw new se({
94
94
  size: s.length,
95
- targetSize: t,
95
+ targetSize: e,
96
96
  type: "bytes"
97
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];
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 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" });
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 fe extends v {
111
- constructor({ givenSize: e, maxSize: t }) {
112
- super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
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 oe(s, { size: e }) {
116
- if (Z(s) > e)
117
- throw new fe({
115
+ function ie(s, { size: t }) {
116
+ if (Z(s) > t)
117
+ throw new ge({
118
118
  givenSize: Z(s),
119
- maxSize: e
119
+ maxSize: t
120
120
  });
121
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);
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 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;
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 ne(s, e = {}) {
131
- let t = "";
130
+ function oe(s, t = {}) {
131
+ let e = "";
132
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;
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 be(s, e = {}) {
138
- const { signed: t, size: i } = e, o = BigInt(s);
137
+ function we(s, t = {}) {
138
+ const { signed: e, size: i } = t, o = BigInt(s);
139
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) {
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
143
  const d = typeof s == "bigint" ? "n" : "";
144
- throw new ge({
144
+ throw new me({
145
145
  max: n ? `${n}${d}` : void 0,
146
- min: `${l}${d}`,
147
- signed: t,
146
+ min: `${p}${d}`,
147
+ signed: e,
148
148
  size: i,
149
149
  value: `${s}${d}`
150
150
  });
151
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;
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 Se = /* @__PURE__ */ new TextEncoder();
156
- function $e(s, e = {}) {
157
- const t = Se.encode(s);
158
- return ne(t, e);
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 Ie(s) {
160
+ function Se(s) {
161
161
  return s instanceof Error;
162
162
  }
163
163
  let Q = !1;
164
- function xe(s) {
164
+ function Ie(s) {
165
165
  if (Q)
166
166
  return;
167
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);
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 (l) => {
172
+ window.addEventListener("eip6963:announceProvider", o), window.dispatchEvent(new Event("eip6963:requestProvider")), window.addEventListener("message", async (p) => {
173
173
  var f;
174
- if (l.origin !== s) return;
175
- const { type: c, data: d } = l.data;
176
- switch (c) {
174
+ if (p.origin !== s) return;
175
+ const { type: l, data: d } = p.data;
176
+ switch (l) {
177
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
178
+ const c = Array.from(t.values()).map(
179
+ ({ info: u, provider: h }) => ({
180
+ info: u,
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,30 +188,30 @@ function xe(s) {
188
188
  r != null && r.contentWindow && r.contentWindow.postMessage(
189
189
  {
190
190
  type: "glide:providers",
191
- providers: p
191
+ providers: c
192
192
  },
193
193
  s
194
194
  );
195
195
  break;
196
196
  }
197
197
  case "glide:providerRequest": {
198
- const { uuid: p, requestId: r, method: h, params: u } = d;
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 = e.get(p);
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
208
  const m = await g.provider.request({
209
- method: h,
210
- params: u
209
+ method: u,
210
+ params: h
211
211
  });
212
212
  i.delete(r), n(r, { result: m });
213
213
  } catch (m) {
214
- i.delete(r), Ie(m) ? n(r, {
214
+ i.delete(r), Se(m) ? n(r, {
215
215
  error: m.message || String(m),
216
216
  code: m.code,
217
217
  data: m.data
@@ -222,8 +222,8 @@ function xe(s) {
222
222
  break;
223
223
  }
224
224
  case "glide:addEventListener": {
225
- const { uuid: p, requestId: r, eventName: h } = d, u = e.get(p);
226
- if (!u || !u.provider.on) {
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
  }
@@ -234,80 +234,61 @@ function xe(s) {
234
234
  y != null && y.contentWindow && y.contentWindow.postMessage(
235
235
  {
236
236
  type: "glide:providerEvent",
237
- uuid: p,
238
- eventName: h,
237
+ uuid: c,
238
+ eventName: u,
239
239
  args: m
240
240
  },
241
241
  s
242
242
  );
243
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 });
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: p, requestId: r, eventName: h } = d, u = e.get(p);
249
- if (!u || !u.provider.removeListener) {
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 = (f = t.get(p)) == null ? void 0 : f.get(h);
253
+ const g = (f = e.get(c)) == null ? void 0 : f.get(u);
254
254
  g && (g.forEach((m) => {
255
- u.provider.removeListener(h, 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(l, c) {
261
+ function n(p, l) {
262
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: l,
269
- ...c
268
+ requestId: p,
269
+ ...l
270
270
  },
271
271
  s
272
272
  );
273
273
  }
274
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 = {
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
276
  name: Pe,
277
- version: ke,
277
+ version: xe,
278
278
  type: Ee,
279
279
  files: Ce,
280
- module: Ae,
280
+ module: ke,
281
281
  types: Me,
282
- exports: Te,
283
- sideEffects: De,
284
- scripts: Ue,
282
+ exports: Ae,
283
+ sideEffects: Ue,
284
+ scripts: Te,
285
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", () => {
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,12 +299,12 @@ class Fe {
318
299
  this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
319
300
  }
320
301
  });
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) {
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 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);
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);
327
308
  (r = (f = this.iframe) == null ? void 0 : f.contentWindow) == null || r.postMessage(
328
309
  {
329
310
  type: "initialize",
@@ -332,16 +313,17 @@ class Fe {
332
313
  appSlug: this.opts.app,
333
314
  sessionId: this.opts.sessionId,
334
315
  recipient: a,
335
- connectedWalletAddress: re,
336
- availableChainIds: ae,
337
- currentChainId: de,
338
- preferGaslessPayment: ce,
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 Fe {
362
344
  stableDepositAddressKey: this.opts.stableDepositAddressKey,
363
345
  theme: {
364
346
  ...this.opts.theme || {},
365
- colorScheme: ((p = this.opts.theme) == null ? void 0 : p.colorScheme) || getComputedStyle(document.documentElement).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: Y,
354
+ sdkVersion: De,
373
355
  referrerDomain: typeof window < "u" ? window.location.origin : void 0,
374
356
  hasAnalyticsCallback: !!this.opts.onAnalyticsEvent
375
357
  },
@@ -378,14 +360,11 @@ class Fe {
378
360
  break;
379
361
  }
380
362
  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
- });
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 && t.event && this.opts.onAnalyticsEvent(t.event);
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)
@@ -404,23 +383,23 @@ class Fe {
404
383
  if (!this.opts.localStorageProvider)
405
384
  throw new Error("localStorageProvider is not set");
406
385
  await this.opts.localStorageProvider.setItem(
407
- t.key,
408
- t.value
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(t.key);
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 a = await this.opts.localStorageProvider.getItem(t.key);
420
- (P = (y = this.iframe) == null ? void 0 : y.contentWindow) == null || P.postMessage(
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: t.key,
402
+ key: e.key,
424
403
  value: a
425
404
  },
426
405
  this.baseUrl
@@ -428,38 +407,30 @@ class Fe {
428
407
  break;
429
408
  }
430
409
  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
- });
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.trackEvent({
439
- type: "modal_closed",
440
- timestamp: Date.now(),
441
- completedTransaction: !1
442
- }), (E = ($ = this.opts) == null ? void 0 : $.onClose) == null || E.call($);
413
+ this.removeIframe(), this.destroy(), (C = ($ = this.opts) == null ? void 0 : $.onClose) == null || C.call($);
443
414
  break;
444
415
  case "setMode":
445
- (C = (I = this.opts) == null ? void 0 : I.onSetMode) == null || C.call(I, t.mode);
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: t.chainId
453
- }), (M = (A = this.iframe) == null ? void 0 : A.contentWindow) == null || M.postMessage(
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: t.chainId
428
+ chainId: e.chainId
458
429
  },
459
430
  this.baseUrl
460
431
  );
461
432
  } catch (a) {
462
- (D = (T = this.iframe) == null ? void 0 : T.contentWindow) == null || D.postMessage(
433
+ (T = (U = this.iframe) == null ? void 0 : U.contentWindow) == null || T.postMessage(
463
434
  {
464
435
  type: "didSwitchChain",
465
436
  success: !1,
@@ -475,9 +446,9 @@ class Fe {
475
446
  throw new Error("walletProvider is not set");
476
447
  try {
477
448
  const a = await this.opts.walletProvider.sendTransactionAsync(
478
- t.tx
449
+ e.tx
479
450
  );
480
- (W = (U = this.iframe) == null ? void 0 : U.contentWindow) == null || W.postMessage(
451
+ (j = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || j.postMessage(
481
452
  {
482
453
  type: "didSendTransaction",
483
454
  success: !0,
@@ -486,7 +457,7 @@ class Fe {
486
457
  this.baseUrl
487
458
  );
488
459
  } catch (a) {
489
- (j = (O = this.iframe) == null ? void 0 : O.contentWindow) == null || j.postMessage(
460
+ (D = (z = this.iframe) == null ? void 0 : z.contentWindow) == null || D.postMessage(
490
461
  {
491
462
  type: "didSendTransaction",
492
463
  success: !1,
@@ -502,7 +473,7 @@ class Fe {
502
473
  if (!this.opts.walletProvider)
503
474
  throw new Error("walletProvider is not set");
504
475
  if (!this.opts.walletProvider.signTypedDataAsync) {
505
- (R = (z = this.iframe) == null ? void 0 : z.contentWindow) == null || R.postMessage(
476
+ (R = (O = this.iframe) == null ? void 0 : O.contentWindow) == null || R.postMessage(
506
477
  {
507
478
  type: "didSignTypedData",
508
479
  success: !1,
@@ -514,7 +485,7 @@ class Fe {
514
485
  }
515
486
  try {
516
487
  const a = await this.opts.walletProvider.signTypedDataAsync(
517
- t.data
488
+ e.data
518
489
  );
519
490
  (B = (L = this.iframe) == null ? void 0 : L.contentWindow) == null || B.postMessage(
520
491
  {
@@ -525,7 +496,7 @@ class Fe {
525
496
  this.baseUrl
526
497
  );
527
498
  } catch (a) {
528
- (F = (_ = this.iframe) == null ? void 0 : _.contentWindow) == null || F.postMessage(
499
+ (G = (F = this.iframe) == null ? void 0 : F.contentWindow) == null || G.postMessage(
529
500
  {
530
501
  type: "didSignTypedData",
531
502
  success: !1,
@@ -542,9 +513,9 @@ class Fe {
542
513
  throw new Error("solanaWalletProvider is not set");
543
514
  try {
544
515
  const a = await this.opts.solanaWalletProvider.signMessageAsync(
545
- t.message
516
+ e.message
546
517
  );
547
- (H = (G = this.iframe) == null ? void 0 : G.contentWindow) == null || H.postMessage(
518
+ (q = (H = this.iframe) == null ? void 0 : H.contentWindow) == null || q.postMessage(
548
519
  {
549
520
  type: "solana_didSignMessage",
550
521
  success: !0,
@@ -553,7 +524,7 @@ class Fe {
553
524
  this.baseUrl
554
525
  );
555
526
  } catch (a) {
556
- (K = (q = this.iframe) == null ? void 0 : q.contentWindow) == null || K.postMessage(
527
+ (N = (K = this.iframe) == null ? void 0 : K.contentWindow) == null || N.postMessage(
557
528
  {
558
529
  type: "solana_didSignMessage",
559
530
  success: !1,
@@ -570,9 +541,9 @@ class Fe {
570
541
  throw new Error("solanaWalletProvider is not set");
571
542
  try {
572
543
  const a = await this.opts.solanaWalletProvider.sendTransactionAsync(
573
- t.transaction
544
+ e.transaction
574
545
  );
575
- (V = (N = this.iframe) == null ? void 0 : N.contentWindow) == null || V.postMessage(
546
+ (V = (_ = this.iframe) == null ? void 0 : _.contentWindow) == null || V.postMessage(
576
547
  {
577
548
  type: "solana_didSendTransaction",
578
549
  success: !0,
@@ -594,47 +565,18 @@ class Fe {
594
565
  break;
595
566
  }
596
567
  });
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);
568
+ this.opts = t;
627
569
  }
628
570
  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 ? `&currencyId=${this.opts.currencyId}` : ""}${this.opts.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${we(
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 ? `&currencyId=${this.opts.currencyId}` : ""}${this.opts.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${ye(
631
573
  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 ? `&copyOverrides=${encodeURIComponent(JSON.stringify(this.opts.copyOverrides))}` : ""}${this.opts.stableDepositAddressKey ? `&stableDepositAddressKey=${encodeURIComponent(this.opts.stableDepositAddressKey)}` : ""}${this.opts.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
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 ? `&copyOverrides=${encodeURIComponent(JSON.stringify(this.opts.copyOverrides))}` : ""}${this.opts.stableDepositAddressKey ? `&stableDepositAddressKey=${encodeURIComponent(this.opts.stableDepositAddressKey)}` : ""}${this.opts.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
633
575
  }
634
576
  initialize() {
635
577
  window.addEventListener("message", this.iframeEventHandler);
636
- const e = new URL(this.baseUrl).origin;
637
- xe(e);
578
+ const t = new URL(this.baseUrl).origin;
579
+ Ie(t);
638
580
  }
639
581
  destroy() {
640
582
  window.removeEventListener("message", this.iframeEventHandler);
@@ -649,149 +591,63 @@ class Fe {
649
591
  if (typeof window > "u" || typeof document > "u")
650
592
  return 0;
651
593
  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;
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;
656
598
  } catch {
657
599
  return 0;
658
600
  }
659
601
  }
660
- openUrl(e) {
661
- this.createIframe(e);
602
+ openUrl(t) {
603
+ this.createIframe(t);
662
604
  }
663
- createIframe(e) {
605
+ createIframe(t) {
664
606
  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);
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);
669
611
  }
670
612
  removeIframe() {
671
- const e = document.getElementById("glide-deposit-iframe");
672
- e && (e.remove(), document.body.classList.remove("glide-deposit-open"));
613
+ const t = document.getElementById("glide-deposit-iframe");
614
+ t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
673
615
  }
674
616
  }
675
- const Ge = Object.freeze({
676
- getItem: (s) => new Promise((e, t) => {
617
+ const Le = Object.freeze({
618
+ getItem: (s) => new Promise((t, e) => {
677
619
  try {
678
620
  const i = localStorage.getItem(s);
679
- e(i);
680
- } catch (i) {
681
621
  t(i);
622
+ } catch (i) {
623
+ e(i);
682
624
  }
683
625
  }),
684
- setItem: (s, e) => new Promise((t, i) => {
626
+ setItem: (s, t) => new Promise((e, i) => {
685
627
  try {
686
- localStorage.setItem(s, e), t();
628
+ localStorage.setItem(s, t), e();
687
629
  } catch (o) {
688
630
  i(o);
689
631
  }
690
632
  }),
691
- removeItem: (s) => new Promise((e, t) => {
633
+ removeItem: (s) => new Promise((t, e) => {
692
634
  try {
693
- localStorage.removeItem(s), e();
635
+ localStorage.removeItem(s), t();
694
636
  } catch (i) {
695
- t(i);
637
+ e(i);
696
638
  }
697
639
  }),
698
- getKeys: () => new Promise((s, e) => {
640
+ getKeys: () => new Promise((s, t) => {
699
641
  try {
700
- const t = Object.keys(localStorage);
701
- s(t);
702
- } catch (t) {
703
- e(t);
642
+ const e = Object.keys(localStorage);
643
+ s(e);
644
+ } catch (e) {
645
+ t(e);
704
646
  }
705
647
  })
706
648
  });
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
649
  export {
792
- Be as GlideAnalytics,
793
- Fe as GlideDeposit,
794
- Ge as browserLocalStorageProvider,
795
- He as glideAnalytics,
796
- xe as initializeParentBridge
650
+ Re as GlideDeposit,
651
+ Le as browserLocalStorageProvider,
652
+ Ie as initializeParentBridge
797
653
  };
package/dist/glide.js CHANGED
@@ -1,7 +1,7 @@
1
- import { GlideDeposit as y } from "./core.js";
2
- import { GlideAnalytics as r, browserLocalStorageProvider as c, glideAnalytics as o, initializeParentBridge as d } from "./core.js";
3
- import { useMemo as b } from "react";
4
- const h = ({
1
+ import { GlideDeposit as g } from "./core.js";
2
+ import { browserLocalStorageProvider as c, initializeParentBridge as d } from "./core.js";
3
+ import { useMemo as I } from "react";
4
+ const u = ({
5
5
  app: G,
6
6
  recipient: U,
7
7
  chainId: z,
@@ -14,32 +14,34 @@ const h = ({
14
14
  excludeCurrencyTiers: Q,
15
15
  excludeFundingSources: V,
16
16
  fundingSources: X,
17
- appMetadata: Y,
18
- enableRefundEmails: Z,
19
- payerEmail: _,
20
- mode: $,
21
- hideSettlementCopy: K,
22
- showAppLogo: x,
23
- showOnrampFirst: k,
24
- debitCardAlias: L,
25
- copyOverrides: R,
26
- stableDepositAddressKey: E,
27
- sessionId: M,
28
- sessionMetadata: D,
29
- disableWithdrawToSelfSuggestion: T,
30
- theme: f,
17
+ allowedPaymentCurrencies: Y,
18
+ excludePaymentCurrencies: Z,
19
+ appMetadata: _,
20
+ enableRefundEmails: $,
21
+ payerEmail: K,
22
+ mode: k,
23
+ hideSettlementCopy: x,
24
+ showAppLogo: L,
25
+ showOnrampFirst: R,
26
+ debitCardAlias: E,
27
+ copyOverrides: M,
28
+ stableDepositAddressKey: D,
29
+ sessionId: T,
30
+ sessionMetadata: f,
31
+ disableWithdrawToSelfSuggestion: F,
32
+ theme: w,
31
33
  walletProvider: A,
32
- solanaWalletProvider: F,
33
- localStorageProvider: w,
34
- onOpen: t,
35
- onSuccess: W,
36
- onClose: I,
37
- autoCloseOnSuccess: P,
38
- popupsBlocked: m,
39
- baseUrl: O,
40
- debug: v
34
+ solanaWalletProvider: b,
35
+ localStorageProvider: W,
36
+ onOpen: y,
37
+ onSuccess: O,
38
+ onClose: P,
39
+ autoCloseOnSuccess: m,
40
+ popupsBlocked: v,
41
+ baseUrl: S,
42
+ debug: C
41
43
  }) => {
42
- const g = b(() => new y({
44
+ const t = I(() => new g({
43
45
  app: G,
44
46
  recipient: U,
45
47
  chainId: z,
@@ -52,30 +54,32 @@ const h = ({
52
54
  excludeCurrencyTiers: Q,
53
55
  excludeFundingSources: V,
54
56
  fundingSources: X,
55
- appMetadata: Y,
56
- enableRefundEmails: Z,
57
- payerEmail: _,
58
- mode: $,
59
- hideSettlementCopy: K,
60
- showAppLogo: x,
61
- showOnrampFirst: k,
62
- debitCardAlias: L,
63
- copyOverrides: R,
64
- stableDepositAddressKey: E,
65
- sessionId: M,
66
- sessionMetadata: D,
67
- disableWithdrawToSelfSuggestion: T,
68
- theme: f,
57
+ allowedPaymentCurrencies: Y,
58
+ excludePaymentCurrencies: Z,
59
+ appMetadata: _,
60
+ enableRefundEmails: $,
61
+ payerEmail: K,
62
+ mode: k,
63
+ hideSettlementCopy: x,
64
+ showAppLogo: L,
65
+ showOnrampFirst: R,
66
+ debitCardAlias: E,
67
+ copyOverrides: M,
68
+ stableDepositAddressKey: D,
69
+ sessionId: T,
70
+ sessionMetadata: f,
71
+ disableWithdrawToSelfSuggestion: F,
72
+ theme: w,
69
73
  walletProvider: A,
70
- solanaWalletProvider: F,
71
- localStorageProvider: w,
72
- onOpen: t,
73
- onSuccess: W,
74
- onClose: I,
75
- autoCloseOnSuccess: P,
76
- popupsBlocked: m,
77
- baseUrl: O,
78
- debug: v
74
+ solanaWalletProvider: b,
75
+ localStorageProvider: W,
76
+ onOpen: y,
77
+ onSuccess: O,
78
+ onClose: P,
79
+ autoCloseOnSuccess: m,
80
+ popupsBlocked: v,
81
+ baseUrl: S,
82
+ debug: C
79
83
  }), [
80
84
  G,
81
85
  U,
@@ -94,8 +98,8 @@ const h = ({
94
98
  _,
95
99
  $,
96
100
  K,
97
- x,
98
101
  k,
102
+ x,
99
103
  L,
100
104
  R,
101
105
  E,
@@ -103,23 +107,25 @@ const h = ({
103
107
  D,
104
108
  T,
105
109
  f,
106
- A,
107
110
  F,
108
111
  w,
109
- t,
112
+ A,
113
+ b,
110
114
  W,
111
- I,
115
+ y,
116
+ O,
112
117
  P,
113
118
  m,
114
- O,
115
- v
119
+ v,
120
+ S,
121
+ C
116
122
  ]);
117
123
  return {
118
- openGlideDeposit: g.open,
119
- externalUrl: g.externalUrl,
120
- opts: g.opts
124
+ openGlideDeposit: t.open,
125
+ externalUrl: t.externalUrl,
126
+ opts: t.opts
121
127
  };
122
- }, p = ({
128
+ }, i = ({
123
129
  app: G,
124
130
  preferGaslessPayment: U,
125
131
  chainIds: z,
@@ -137,8 +143,8 @@ const h = ({
137
143
  debitCardAlias: _,
138
144
  copyOverrides: $,
139
145
  amount: K,
140
- sessionId: x,
141
- sessionMetadata: k,
146
+ sessionId: k,
147
+ sessionMetadata: x,
142
148
  theme: L,
143
149
  walletProvider: R,
144
150
  solanaWalletProvider: E,
@@ -146,12 +152,12 @@ const h = ({
146
152
  onOpen: D,
147
153
  onSuccess: T,
148
154
  onClose: f,
149
- autoCloseOnSuccess: A,
150
- popupsBlocked: F,
151
- baseUrl: w,
152
- debug: t
155
+ autoCloseOnSuccess: F,
156
+ popupsBlocked: w,
157
+ baseUrl: A,
158
+ debug: b
153
159
  }) => {
154
- const W = b(() => new y({
160
+ const W = I(() => new g({
155
161
  app: G,
156
162
  preferGaslessPayment: U,
157
163
  chainIds: z,
@@ -169,9 +175,9 @@ const h = ({
169
175
  showOnrampFirst: Z,
170
176
  debitCardAlias: _,
171
177
  copyOverrides: $,
172
- sessionId: x,
178
+ sessionId: k,
173
179
  amount: K,
174
- sessionMetadata: k,
180
+ sessionMetadata: x,
175
181
  theme: L,
176
182
  walletProvider: R,
177
183
  solanaWalletProvider: E,
@@ -179,10 +185,10 @@ const h = ({
179
185
  onOpen: D,
180
186
  onSuccess: T,
181
187
  onClose: f,
182
- autoCloseOnSuccess: A,
183
- popupsBlocked: F,
184
- baseUrl: w,
185
- debug: t
188
+ autoCloseOnSuccess: F,
189
+ popupsBlocked: w,
190
+ baseUrl: A,
191
+ debug: b
186
192
  }), [
187
193
  G,
188
194
  U,
@@ -200,9 +206,9 @@ const h = ({
200
206
  Z,
201
207
  _,
202
208
  $,
203
- x,
204
- K,
205
209
  k,
210
+ K,
211
+ x,
206
212
  L,
207
213
  R,
208
214
  E,
@@ -210,10 +216,10 @@ const h = ({
210
216
  D,
211
217
  T,
212
218
  f,
213
- A,
214
219
  F,
215
220
  w,
216
- t
221
+ A,
222
+ b
217
223
  ]);
218
224
  return {
219
225
  openGlidePay: W.open,
@@ -238,15 +244,15 @@ const h = ({
238
244
  walletProvider: _,
239
245
  solanaWalletProvider: $,
240
246
  localStorageProvider: K,
241
- onOpen: x,
242
- onSuccess: k,
247
+ onOpen: k,
248
+ onSuccess: x,
243
249
  onClose: L,
244
250
  autoCloseOnSuccess: R,
245
251
  popupsBlocked: E,
246
252
  baseUrl: M,
247
253
  debug: D
248
254
  }) => {
249
- const T = b(() => new y({
255
+ const T = I(() => new g({
250
256
  app: G,
251
257
  evm: U,
252
258
  approval: z,
@@ -265,8 +271,8 @@ const h = ({
265
271
  walletProvider: _,
266
272
  solanaWalletProvider: $,
267
273
  localStorageProvider: K,
268
- onOpen: x,
269
- onSuccess: k,
274
+ onOpen: k,
275
+ onSuccess: x,
270
276
  onClose: L,
271
277
  autoCloseOnSuccess: R,
272
278
  popupsBlocked: E,
@@ -290,8 +296,8 @@ const h = ({
290
296
  _,
291
297
  $,
292
298
  K,
293
- x,
294
299
  k,
300
+ x,
295
301
  L,
296
302
  R,
297
303
  E,
@@ -303,7 +309,7 @@ const h = ({
303
309
  externalUrl: T.externalUrl,
304
310
  opts: T.opts
305
311
  };
306
- }, i = ({
312
+ }, n = ({
307
313
  app: G,
308
314
  recipient: U,
309
315
  chainId: z,
@@ -321,14 +327,14 @@ const h = ({
321
327
  theme: _,
322
328
  walletProvider: $,
323
329
  solanaWalletProvider: K,
324
- localStorageProvider: x,
325
- onOpen: k,
330
+ localStorageProvider: k,
331
+ onOpen: x,
326
332
  onSuccess: L,
327
333
  onClose: R,
328
334
  autoCloseOnSuccess: E,
329
335
  baseUrl: M
330
336
  }) => {
331
- const D = b(() => new y({
337
+ const D = I(() => new g({
332
338
  app: G,
333
339
  recipient: U,
334
340
  chainId: z,
@@ -347,8 +353,8 @@ const h = ({
347
353
  theme: _,
348
354
  walletProvider: $,
349
355
  solanaWalletProvider: K,
350
- localStorageProvider: x,
351
- onOpen: k,
356
+ localStorageProvider: k,
357
+ onOpen: x,
352
358
  onSuccess: L,
353
359
  onClose: R,
354
360
  autoCloseOnSuccess: E,
@@ -371,8 +377,8 @@ const h = ({
371
377
  _,
372
378
  $,
373
379
  K,
374
- x,
375
380
  k,
381
+ x,
376
382
  L,
377
383
  R,
378
384
  E,
@@ -385,13 +391,11 @@ const h = ({
385
391
  };
386
392
  };
387
393
  export {
388
- r as GlideAnalytics,
389
- y as GlideDeposit,
394
+ g as GlideDeposit,
390
395
  c as browserLocalStorageProvider,
391
- o as glideAnalytics,
392
396
  d as initializeParentBridge,
393
- i as useGlideBuy,
397
+ n as useGlideBuy,
394
398
  l as useGlideCall,
395
- h as useGlideDeposit,
396
- p as useGlidePay
399
+ u as useGlideDeposit,
400
+ i as useGlidePay
397
401
  };
@@ -123,6 +123,7 @@ export type GlideDepositOptions = {
123
123
  excludeFundingSources?: FundingSource[];
124
124
  fundingSources?: FundingSource[];
125
125
  allowedPaymentCurrencies?: string[];
126
+ excludePaymentCurrencies?: string[];
126
127
  appMetadata?: {
127
128
  name?: string;
128
129
  logoUrl?: string;
@@ -160,14 +161,6 @@ export type GlideDepositOptions = {
160
161
  export declare class GlideDeposit {
161
162
  opts: GlideDepositOptions;
162
163
  constructor(opts: GlideDepositOptions);
163
- /**
164
- * Get analytics context for events tracked directly in SDK
165
- */
166
- private getAnalyticsContext;
167
- /**
168
- * Track an analytics event with context
169
- */
170
- private trackEvent;
171
164
  open: () => void;
172
165
  get externalUrl(): string;
173
166
  private initialize;
@@ -199,22 +199,3 @@ export type GlideAnalyticsEvent = GlideAnalyticsEventType & GlideAnalyticsContex
199
199
  * Callback function type for analytics events
200
200
  */
201
201
  export type GlideAnalyticsCallback = (event: GlideAnalyticsEvent) => void;
202
- /**
203
- * Helper class for emitting analytics events
204
- */
205
- export declare class GlideAnalytics {
206
- private callback?;
207
- private startTime?;
208
- private currentStep?;
209
- constructor(callback?: GlideAnalyticsCallback);
210
- setCallback(callback: GlideAnalyticsCallback | undefined): void;
211
- track(event: GlideAnalyticsEvent): void;
212
- modalOpened(): void;
213
- modalClosed(completedTransaction: boolean): void;
214
- stepViewed(step: string): void;
215
- stepExited(step: string, direction: "forward" | "back"): void;
216
- paymentMethodSelected(paymentMethod: "wallet" | "transfer" | "coinbase" | "coinbase_app" | "fiat" | "interac" | "debit_card_alias"): void;
217
- transactionCompleted(sessionId: string, txHash: string, paymentMethod: string, amountUSD?: number): void;
218
- errorOccurred(errorType: string, errorMessage: string, step?: string): void;
219
- }
220
- export declare const glideAnalytics: GlideAnalytics;
@@ -14,6 +14,8 @@ interface UseGlideDepositProps {
14
14
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
15
15
  excludeFundingSources?: FundingSource[];
16
16
  fundingSources?: FundingSource[];
17
+ allowedPaymentCurrencies?: string[];
18
+ excludePaymentCurrencies?: string[];
17
19
  appMetadata?: {
18
20
  name?: string;
19
21
  logoUrl?: string;
@@ -44,7 +46,7 @@ interface UseGlideDepositProps {
44
46
  baseUrl?: string;
45
47
  debug?: boolean;
46
48
  }
47
- export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, appMetadata, enableRefundEmails, payerEmail, mode, hideSettlementCopy, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, stableDepositAddressKey, sessionId, sessionMetadata, disableWithdrawToSelfSuggestion, theme, walletProvider, solanaWalletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
49
+ export declare const useGlideDeposit: ({ app, recipient, chainId, currencyId, amount, gasRefuelAmountPerChain, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, allowedPaymentCurrencies, excludePaymentCurrencies, appMetadata, enableRefundEmails, payerEmail, mode, hideSettlementCopy, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, stableDepositAddressKey, sessionId, sessionMetadata, disableWithdrawToSelfSuggestion, theme, walletProvider, solanaWalletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
48
50
  openGlideDeposit: () => void;
49
51
  externalUrl: string;
50
52
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paywithglide/glide-react",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"