@paywithglide/glide-react 0.0.47 → 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/dist/core.js CHANGED
@@ -1,24 +1,24 @@
1
- var ee = Object.defineProperty;
2
- var te = (s, e, t) => e in s ? ee(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
- var w = (s, e, t) => te(s, typeof e != "symbol" ? e + "" : e, t);
4
- function se(s, { strict: e = !0 } = {}) {
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
5
  return !s || typeof s != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(s) : s.startsWith("0x");
6
6
  }
7
- function _(s) {
8
- return se(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
7
+ function Z(s) {
8
+ return ue(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
9
9
  }
10
- const q = "2.21.51";
10
+ const te = "2.21.51";
11
11
  let b = {
12
12
  getDocsUrl: ({ docsBaseUrl: s, docsPath: e = "", docsSlug: t }) => e ? `${s ?? "https://viem.sh"}${e}${t ? `#${t}` : ""}` : void 0,
13
- version: `viem@${q}`
13
+ version: `viem@${te}`
14
14
  };
15
15
  class v extends Error {
16
16
  constructor(e, t = {}) {
17
- var d;
17
+ var c;
18
18
  const i = (() => {
19
- var a;
20
- return t.cause instanceof v ? t.cause.details : (a = t.cause) != null && a.message ? t.cause.message : t.details;
21
- })(), o = t.cause instanceof v && t.cause.docsPath || t.docsPath, n = (d = b.getDocsUrl) == null ? void 0 : d.call(b, { ...t, docsPath: o }), c = [
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
22
  e || "An error occurred.",
23
23
  "",
24
24
  ...t.metaMessages ? [...t.metaMessages, ""] : [],
@@ -27,7 +27,7 @@ class v extends Error {
27
27
  ...b.version ? [`Version: ${b.version}`] : []
28
28
  ].join(`
29
29
  `);
30
- super(c, t.cause ? { cause: t.cause } : void 0), Object.defineProperty(this, "details", {
30
+ super(l, t.cause ? { cause: t.cause } : void 0), Object.defineProperty(this, "details", {
31
31
  enumerable: !0,
32
32
  configurable: !0,
33
33
  writable: !0,
@@ -57,40 +57,40 @@ 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 = q;
60
+ }), this.details = i, this.docsPath = o, this.metaMessages = t.metaMessages, this.name = t.name ?? this.name, this.shortMessage = e, this.version = te;
61
61
  }
62
62
  walk(e) {
63
- return K(this, e);
63
+ return se(this, e);
64
64
  }
65
65
  }
66
- function K(s, e) {
67
- return e != null && e(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? K(s.cause, e) : e ? null : s;
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
68
  }
69
- class N extends v {
69
+ class ie extends v {
70
70
  constructor({ size: e, targetSize: t, type: i }) {
71
71
  super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`, { name: "SizeExceedsPaddingSizeError" });
72
72
  }
73
73
  }
74
- function I(s, { dir: e, size: t = 32 } = {}) {
75
- return typeof s == "string" ? ie(s, { dir: e, size: t }) : oe(s, { dir: e, size: t });
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
76
  }
77
- function ie(s, { dir: e, size: t = 32 } = {}) {
77
+ function he(s, { dir: e, size: t = 32 } = {}) {
78
78
  if (t === null)
79
79
  return s;
80
80
  const i = s.replace("0x", "");
81
81
  if (i.length > t * 2)
82
- throw new N({
82
+ throw new ie({
83
83
  size: Math.ceil(i.length / 2),
84
84
  targetSize: t,
85
85
  type: "hex"
86
86
  });
87
87
  return `0x${i[e === "right" ? "padEnd" : "padStart"](t * 2, "0")}`;
88
88
  }
89
- function oe(s, { dir: e, size: t = 32 } = {}) {
89
+ function me(s, { dir: e, size: t = 32 } = {}) {
90
90
  if (t === null)
91
91
  return s;
92
92
  if (s.length > t)
93
- throw new N({
93
+ throw new ie({
94
94
  size: s.length,
95
95
  targetSize: t,
96
96
  type: "bytes"
@@ -102,85 +102,85 @@ function oe(s, { dir: e, size: t = 32 } = {}) {
102
102
  }
103
103
  return i;
104
104
  }
105
- class ne extends v {
105
+ class ge extends v {
106
106
  constructor({ max: e, min: t, signed: i, size: o, value: n }) {
107
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
108
  }
109
109
  }
110
- class re extends v {
110
+ class fe extends v {
111
111
  constructor({ givenSize: e, maxSize: t }) {
112
112
  super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
113
113
  }
114
114
  }
115
- function V(s, { size: e }) {
116
- if (_(s) > e)
117
- throw new re({
118
- givenSize: _(s),
115
+ function oe(s, { size: e }) {
116
+ if (Z(s) > e)
117
+ throw new fe({
118
+ givenSize: Z(s),
119
119
  maxSize: e
120
120
  });
121
121
  }
122
- const ae = /* @__PURE__ */ Array.from({ length: 256 }, (s, e) => e.toString(16).padStart(2, "0"));
123
- function de(s, e = {}) {
124
- return typeof s == "number" || typeof s == "bigint" ? pe(s, e) : typeof s == "string" ? ue(s, e) : typeof s == "boolean" ? ce(s, e) : J(s, e);
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
125
  }
126
- function ce(s, e = {}) {
126
+ function ve(s, e = {}) {
127
127
  const t = `0x${Number(s)}`;
128
- return typeof e.size == "number" ? (V(t, { size: e.size }), I(t, { size: e.size })) : t;
128
+ return typeof e.size == "number" ? (oe(t, { size: e.size }), x(t, { size: e.size })) : t;
129
129
  }
130
- function J(s, e = {}) {
130
+ function ne(s, e = {}) {
131
131
  let t = "";
132
132
  for (let o = 0; o < s.length; o++)
133
- t += ae[s[o]];
133
+ t += ye[s[o]];
134
134
  const i = `0x${t}`;
135
- return typeof e.size == "number" ? (V(i, { size: e.size }), I(i, { dir: "right", size: e.size })) : i;
135
+ return typeof e.size == "number" ? (oe(i, { size: e.size }), x(i, { dir: "right", size: e.size })) : i;
136
136
  }
137
- function pe(s, e = {}) {
137
+ function be(s, e = {}) {
138
138
  const { signed: t, size: i } = e, o = BigInt(s);
139
139
  let n;
140
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 c = typeof n == "bigint" && t ? -n - 1n : 0;
142
- if (n && o > n || o < c) {
143
- const a = typeof s == "bigint" ? "n" : "";
144
- throw new ne({
145
- max: n ? `${n}${a}` : void 0,
146
- min: `${c}${a}`,
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
147
  signed: t,
148
148
  size: i,
149
- value: `${s}${a}`
149
+ value: `${s}${d}`
150
150
  });
151
151
  }
152
- const d = `0x${(t && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
153
- return i ? I(d, { size: i }) : d;
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
154
  }
155
- const le = /* @__PURE__ */ new TextEncoder();
156
- function ue(s, e = {}) {
157
- const t = le.encode(s);
158
- return J(t, e);
155
+ const Se = /* @__PURE__ */ new TextEncoder();
156
+ function $e(s, e = {}) {
157
+ const t = Se.encode(s);
158
+ return ne(t, e);
159
159
  }
160
- function he(s) {
160
+ function Ie(s) {
161
161
  return s instanceof Error;
162
162
  }
163
- let F = !1;
164
- function me(s) {
165
- if (F)
163
+ let Q = !1;
164
+ function xe(s) {
165
+ if (Q)
166
166
  return;
167
- F = !0;
168
- const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), o = (c) => {
169
- const d = c.detail;
170
- e.has(d.info.uuid) || e.set(d.info.uuid, d);
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
171
  };
172
- window.addEventListener("eip6963:announceProvider", o), window.dispatchEvent(new Event("eip6963:requestProvider")), window.addEventListener("message", async (c) => {
173
- var y;
174
- if (c.origin !== s) return;
175
- const { type: d, data: a } = c.data;
176
- switch (d) {
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
177
  case "glide:getProviders": {
178
178
  const p = Array.from(e.values()).map(
179
- ({ info: u, provider: l }) => ({
180
- info: u,
181
- isConnected: typeof l.isConnected == "boolean" ? l.isConnected : void 0,
182
- chainId: l.chainId,
183
- selectedAddress: l.selectedAddress
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
184
  })
185
185
  ), r = document.getElementById(
186
186
  "glide-deposit-iframe"
@@ -195,7 +195,7 @@ function me(s) {
195
195
  break;
196
196
  }
197
197
  case "glide:providerRequest": {
198
- const { uuid: p, requestId: r, method: u, params: l } = a;
198
+ const { uuid: p, requestId: r, method: h, params: u } = d;
199
199
  if (i.has(r))
200
200
  return;
201
201
  i.set(r, !0);
@@ -205,106 +205,106 @@ function me(s) {
205
205
  return;
206
206
  }
207
207
  try {
208
- const h = await g.provider.request({
209
- method: u,
210
- params: l
208
+ const m = await g.provider.request({
209
+ method: h,
210
+ params: u
211
211
  });
212
- i.delete(r), n(r, { result: h });
213
- } catch (h) {
214
- i.delete(r), he(h) ? n(r, {
215
- error: h.message || String(h),
216
- code: h.code,
217
- data: h.data
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
218
  }) : n(r, {
219
- error: String(h)
219
+ error: String(m)
220
220
  });
221
221
  }
222
222
  break;
223
223
  }
224
224
  case "glide:addEventListener": {
225
- const { uuid: p, requestId: r, eventName: u } = a, l = e.get(p);
226
- if (!l || !l.provider.on) {
225
+ const { uuid: p, requestId: r, eventName: h } = d, u = e.get(p);
226
+ if (!u || !u.provider.on) {
227
227
  n(r, { error: "Provider or method not found" });
228
228
  return;
229
229
  }
230
- const g = (...h) => {
231
- const f = document.getElementById(
230
+ const g = (...m) => {
231
+ const y = document.getElementById(
232
232
  "glide-deposit-iframe"
233
233
  );
234
- f != null && f.contentWindow && f.contentWindow.postMessage(
234
+ y != null && y.contentWindow && y.contentWindow.postMessage(
235
235
  {
236
236
  type: "glide:providerEvent",
237
237
  uuid: p,
238
- eventName: u,
239
- args: h
238
+ eventName: h,
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(u) || t.get(p).set(u, /* @__PURE__ */ new Set()), t.get(p).get(u).add(g), l.provider.on(u, g), n(r, { result: !0 });
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
245
  break;
246
246
  }
247
247
  case "glide:removeEventListener": {
248
- const { uuid: p, requestId: r, eventName: u } = a, l = e.get(p);
249
- if (!l || !l.provider.removeListener) {
248
+ const { uuid: p, requestId: r, eventName: h } = d, u = e.get(p);
249
+ if (!u || !u.provider.removeListener) {
250
250
  n(r, { error: "Provider or method not found" });
251
251
  return;
252
252
  }
253
- const g = (y = t.get(p)) == null ? void 0 : y.get(u);
254
- g && (g.forEach((h) => {
255
- l.provider.removeListener(u, h);
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
256
  }), g.clear()), n(r, { result: !0 });
257
257
  break;
258
258
  }
259
259
  }
260
260
  });
261
- function n(c, d) {
262
- const a = document.getElementById(
261
+ function n(l, c) {
262
+ const d = document.getElementById(
263
263
  "glide-deposit-iframe"
264
264
  );
265
- a != null && a.contentWindow && a.contentWindow.postMessage(
265
+ d != null && d.contentWindow && d.contentWindow.postMessage(
266
266
  {
267
267
  type: "glide:providerResponse",
268
- requestId: c,
269
- ...d
268
+ requestId: l,
269
+ ...c
270
270
  },
271
271
  s
272
272
  );
273
273
  }
274
274
  }
275
- const ge = "@paywithglide/glide-react", fe = "0.0.47", ye = "module", we = ["dist"], ve = "dist/glide.js", be = "dist/index.d.ts", $e = { ".": { types: "./dist/index.d.ts", default: "./dist/glide.js" }, "./core": { types: "./dist/core.d.ts", default: "./dist/core.js" }, "./package.json": "./package.json" }, Se = !1, Ie = { 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" }, xe = { "@paywithglide/glide-js": "0.13.32" }, Pe = { "@antiwork/shortest": "^0.2.1", "@eslint/js": "^9.15.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" }, ke = {
276
- name: ge,
277
- version: fe,
278
- type: ye,
279
- files: we,
280
- module: ve,
281
- types: be,
282
- exports: $e,
283
- sideEffects: Se,
284
- scripts: Ie,
285
- dependencies: xe,
286
- devDependencies: Pe
287
- }, G = ke.version;
288
- function Ee() {
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
289
  var t;
290
290
  if (typeof navigator > "u") return "unknown";
291
291
  const s = navigator.userAgent.toLowerCase(), e = ((t = navigator.platform) == null ? void 0 : t.toLowerCase()) || "";
292
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
293
  }
294
- function Ce() {
294
+ function Re() {
295
295
  if (typeof navigator > "u") return "unknown";
296
296
  const s = navigator.userAgent;
297
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
298
  }
299
- function Ae() {
299
+ function Le() {
300
300
  if (typeof navigator > "u") return !1;
301
301
  const s = navigator.userAgent.toLowerCase();
302
302
  return /android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini|mobile/.test(
303
303
  s
304
304
  );
305
305
  }
306
- const H = 999999;
307
- class Te {
306
+ const ee = 999999;
307
+ class Fe {
308
308
  constructor(e) {
309
309
  w(this, "opts");
310
310
  w(this, "open", () => {
@@ -319,23 +319,23 @@ class Te {
319
319
  }
320
320
  });
321
321
  w(this, "iframeEventHandler", async (e) => {
322
- var i, o, n, c, d, a, y, p, r, u, l, g, h, f, x, $, P, S, k, E, C, A, M, D, T, U, O, j, z, R, L, B, W;
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
323
  const t = e.data;
324
324
  switch (t.type) {
325
325
  case "sendInit": {
326
- const m = this.opts.recipient, X = (i = this.opts.walletProvider) == null ? void 0 : i.address, Z = (o = this.opts.walletProvider) == null ? void 0 : o.availableChainIds, Q = (n = this.opts.walletProvider) == null ? void 0 : n.currentChainId, Y = this.opts.preferGaslessPayment || !!((c = this.opts.walletProvider) != null && c.signTypedDataAsync);
327
- (y = (d = this.iframe) == null ? void 0 : d.contentWindow) == null || y.postMessage(
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
328
  {
329
329
  type: "initialize",
330
330
  // Analytics context - project identification
331
331
  projectId: this.opts.projectId,
332
332
  appSlug: this.opts.app,
333
333
  sessionId: this.opts.sessionId,
334
- recipient: m,
335
- connectedWalletAddress: X,
336
- availableChainIds: Z,
337
- currentChainId: Q,
338
- preferGaslessPayment: Y,
334
+ recipient: a,
335
+ connectedWalletAddress: re,
336
+ availableChainIds: ae,
337
+ currentChainId: de,
338
+ preferGaslessPayment: ce,
339
339
  chainIds: this.opts.chainIds,
340
340
  excludeChainIds: this.opts.excludeChainIds,
341
341
  excludeCurrencyTiers: this.opts.excludeCurrencyTiers,
@@ -362,14 +362,14 @@ class Te {
362
362
  stableDepositAddressKey: this.opts.stableDepositAddressKey,
363
363
  theme: {
364
364
  ...this.opts.theme || {},
365
- colorScheme: ((a = this.opts.theme) == null ? void 0 : a.colorScheme) || getComputedStyle(document.documentElement).colorScheme || "",
365
+ colorScheme: ((p = this.opts.theme) == null ? void 0 : p.colorScheme) || getComputedStyle(document.documentElement).colorScheme || "",
366
366
  safeInsetBottom: this.getSafeInsetBottom()
367
367
  },
368
368
  didProvideLocalStorage: !!this.opts.localStorageProvider,
369
369
  debug: this.opts.debug,
370
370
  popupsBlocked: this.opts.popupsBlocked,
371
371
  gasRefuelAmountPerChain: this.opts.gasRefuelAmountPerChain,
372
- sdkVersion: G,
372
+ sdkVersion: Y,
373
373
  referrerDomain: typeof window < "u" ? window.location.origin : void 0,
374
374
  hasAnalyticsCallback: !!this.opts.onAnalyticsEvent
375
375
  },
@@ -378,7 +378,7 @@ class Te {
378
378
  break;
379
379
  }
380
380
  case "didOpen": {
381
- this.iframe.style.opacity = "1", (r = (p = this.opts).onOpen) == null || r.call(p), this.trackEvent({
381
+ this.iframe.style.opacity = "1", (u = (h = this.opts).onOpen) == null || u.call(h), this.trackEvent({
382
382
  type: "modal_opened",
383
383
  timestamp: Date.now()
384
384
  });
@@ -390,11 +390,11 @@ class Te {
390
390
  case "localStorage.getKeys": {
391
391
  if (!this.opts.localStorageProvider)
392
392
  throw new Error("localStorageProvider is not set");
393
- const m = await this.opts.localStorageProvider.getKeys();
394
- (l = (u = this.iframe) == null ? void 0 : u.contentWindow) == null || l.postMessage(
393
+ const a = await this.opts.localStorageProvider.getKeys();
394
+ (m = (g = this.iframe) == null ? void 0 : g.contentWindow) == null || m.postMessage(
395
395
  {
396
396
  type: "localStorage.didGetKeys",
397
- keys: m
397
+ keys: a
398
398
  },
399
399
  this.baseUrl
400
400
  );
@@ -416,19 +416,19 @@ class Te {
416
416
  case "localStorage.getItem": {
417
417
  if (!this.opts.localStorageProvider)
418
418
  throw new Error("localStorageProvider is not set");
419
- const m = await this.opts.localStorageProvider.getItem(t.key);
420
- (h = (g = this.iframe) == null ? void 0 : g.contentWindow) == null || h.postMessage(
419
+ const a = await this.opts.localStorageProvider.getItem(t.key);
420
+ (P = (y = this.iframe) == null ? void 0 : y.contentWindow) == null || P.postMessage(
421
421
  {
422
422
  type: "localStorage.didGetItem",
423
423
  key: t.key,
424
- value: m
424
+ value: a
425
425
  },
426
426
  this.baseUrl
427
427
  );
428
428
  break;
429
429
  }
430
430
  case "success":
431
- (x = (f = this.opts) == null ? void 0 : f.onSuccess) == null || x.call(f, t.hash, t.session), this.trackEvent({
431
+ (k = (S = this.opts) == null ? void 0 : S.onSuccess) == null || k.call(S, t.hash, t.session), this.trackEvent({
432
432
  type: "modal_closed",
433
433
  timestamp: Date.now(),
434
434
  completedTransaction: !0
@@ -439,10 +439,10 @@ class Te {
439
439
  type: "modal_closed",
440
440
  timestamp: Date.now(),
441
441
  completedTransaction: !1
442
- }), (P = ($ = this.opts) == null ? void 0 : $.onClose) == null || P.call($);
442
+ }), (E = ($ = this.opts) == null ? void 0 : $.onClose) == null || E.call($);
443
443
  break;
444
444
  case "setMode":
445
- (k = (S = this.opts) == null ? void 0 : S.onSetMode) == null || k.call(S, t.mode);
445
+ (C = (I = this.opts) == null ? void 0 : I.onSetMode) == null || C.call(I, t.mode);
446
446
  break;
447
447
  case "switchChain":
448
448
  if (!this.opts.walletProvider)
@@ -450,7 +450,7 @@ class Te {
450
450
  try {
451
451
  await this.opts.walletProvider.switchChainAsync({
452
452
  chainId: t.chainId
453
- }), (C = (E = this.iframe) == null ? void 0 : E.contentWindow) == null || C.postMessage(
453
+ }), (M = (A = this.iframe) == null ? void 0 : A.contentWindow) == null || M.postMessage(
454
454
  {
455
455
  type: "didSwitchChain",
456
456
  success: !0,
@@ -458,12 +458,12 @@ class Te {
458
458
  },
459
459
  this.baseUrl
460
460
  );
461
- } catch (m) {
462
- (M = (A = this.iframe) == null ? void 0 : A.contentWindow) == null || M.postMessage(
461
+ } catch (a) {
462
+ (D = (T = this.iframe) == null ? void 0 : T.contentWindow) == null || D.postMessage(
463
463
  {
464
464
  type: "didSwitchChain",
465
465
  success: !1,
466
- error: m
466
+ error: a
467
467
  },
468
468
  this.baseUrl
469
469
  );
@@ -474,23 +474,23 @@ class Te {
474
474
  if (!this.opts.walletProvider)
475
475
  throw new Error("walletProvider is not set");
476
476
  try {
477
- const m = await this.opts.walletProvider.sendTransactionAsync(
477
+ const a = await this.opts.walletProvider.sendTransactionAsync(
478
478
  t.tx
479
479
  );
480
- (T = (D = this.iframe) == null ? void 0 : D.contentWindow) == null || T.postMessage(
480
+ (W = (U = this.iframe) == null ? void 0 : U.contentWindow) == null || W.postMessage(
481
481
  {
482
482
  type: "didSendTransaction",
483
483
  success: !0,
484
- txHash: m
484
+ txHash: a
485
485
  },
486
486
  this.baseUrl
487
487
  );
488
- } catch (m) {
489
- (O = (U = this.iframe) == null ? void 0 : U.contentWindow) == null || O.postMessage(
488
+ } catch (a) {
489
+ (j = (O = this.iframe) == null ? void 0 : O.contentWindow) == null || j.postMessage(
490
490
  {
491
491
  type: "didSendTransaction",
492
492
  success: !1,
493
- error: m
493
+ error: a
494
494
  },
495
495
  this.baseUrl
496
496
  );
@@ -502,7 +502,7 @@ class Te {
502
502
  if (!this.opts.walletProvider)
503
503
  throw new Error("walletProvider is not set");
504
504
  if (!this.opts.walletProvider.signTypedDataAsync) {
505
- (z = (j = this.iframe) == null ? void 0 : j.contentWindow) == null || z.postMessage(
505
+ (R = (z = this.iframe) == null ? void 0 : z.contentWindow) == null || R.postMessage(
506
506
  {
507
507
  type: "didSignTypedData",
508
508
  success: !1,
@@ -513,23 +513,79 @@ class Te {
513
513
  return;
514
514
  }
515
515
  try {
516
- const m = await this.opts.walletProvider.signTypedDataAsync(
516
+ const a = await this.opts.walletProvider.signTypedDataAsync(
517
517
  t.data
518
518
  );
519
- (L = (R = this.iframe) == null ? void 0 : R.contentWindow) == null || L.postMessage(
519
+ (B = (L = this.iframe) == null ? void 0 : L.contentWindow) == null || B.postMessage(
520
520
  {
521
521
  type: "didSignTypedData",
522
522
  success: !0,
523
- signature: m
523
+ signature: a
524
524
  },
525
525
  this.baseUrl
526
526
  );
527
- } catch (m) {
528
- (W = (B = this.iframe) == null ? void 0 : B.contentWindow) == null || W.postMessage(
527
+ } catch (a) {
528
+ (F = (_ = this.iframe) == null ? void 0 : _.contentWindow) == null || F.postMessage(
529
529
  {
530
530
  type: "didSignTypedData",
531
531
  success: !1,
532
- error: m
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
533
589
  },
534
590
  this.baseUrl
535
591
  );
@@ -548,13 +604,13 @@ class Te {
548
604
  return {
549
605
  projectId: this.opts.projectId,
550
606
  appSlug: this.opts.app,
551
- sdkVersion: G,
607
+ sdkVersion: Y,
552
608
  referrerDomain: typeof window < "u" ? window.location.origin : void 0,
553
609
  walletAddress: (e = this.opts.walletProvider) == null ? void 0 : e.address,
554
610
  device: {
555
- isMobile: Ae(),
556
- platform: Ee(),
557
- browser: Ce()
611
+ isMobile: Le(),
612
+ platform: ze(),
613
+ browser: Re()
558
614
  }
559
615
  };
560
616
  }
@@ -570,15 +626,15 @@ class Te {
570
626
  this.opts.onAnalyticsEvent(t);
571
627
  }
572
628
  get externalUrl() {
573
- var e, t, i, o, n, c, d, a, y;
574
- return `${this.baseUrl}${this.opts.app}?${this.opts.recipient ? `&recipient=${this.opts.recipient}` : ""}${this.opts.preferGaslessPayment ? "&preferGaslessPayment=true" : ""}${this.opts.mode ? `&mode=${this.opts.mode}` : ""}${this.opts.amount ? `&amount=${this.opts.amount}` : ""}${this.opts.chainId ? `&chainId=${this.opts.chainId}` : ""}${this.opts.currencyId ? `&currencyId=${this.opts.currencyId}` : ""}${this.opts.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${de(
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(
575
631
  this.opts.evm.value || 0n
576
- )}` : ""}${this.opts.approval ? `&approval.token=${this.opts.approval.token}&approval.amount=${this.opts.approval.amount}` : ""}${this.opts.sessionMetadata ? `&metadata=${this.opts.sessionMetadata}` : ""}${this.opts.autoCloseOnSuccess ? "&autoCloseOnSuccess=true" : ""}${this.opts.sessionId ? `&sessionId=${this.opts.sessionId}` : ""}${(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(",")}` : ""}${(c = this.opts.allowedPaymentCurrencies) != null && c.length ? `&allowedPaymentCurrencies=${this.opts.allowedPaymentCurrencies.join(",")}` : ""}${(d = this.opts.appMetadata) != null && d.name ? `&appMetadata.name=${encodeURIComponent(this.opts.appMetadata.name)}` : ""}${(a = this.opts.appMetadata) != null && a.logoUrl ? `&appMetadata.logoUrl=${encodeURIComponent(this.opts.appMetadata.logoUrl)}` : ""}${(y = this.opts.appMetadata) != null && y.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))}` : ""}`;
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))}` : ""}`;
577
633
  }
578
634
  initialize() {
579
635
  window.addEventListener("message", this.iframeEventHandler);
580
636
  const e = new URL(this.baseUrl).origin;
581
- me(e);
637
+ xe(e);
582
638
  }
583
639
  destroy() {
584
640
  window.removeEventListener("message", this.iframeEventHandler);
@@ -608,7 +664,7 @@ class Te {
608
664
  this.removeIframe();
609
665
  const t = document.createElement("iframe");
610
666
  t.id = "glide-deposit-iframe";
611
- const i = this.opts.container, o = i ? `z-index: ${H}; 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: ${H}; 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;`;
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;`;
612
668
  t.setAttribute("style", o), t.src = e, t.allow = "payment *; clipboard-write *", i ? i.appendChild(t) : document.body.appendChild(t);
613
669
  }
614
670
  removeIframe() {
@@ -616,7 +672,7 @@ class Te {
616
672
  e && (e.remove(), document.body.classList.remove("glide-deposit-open"));
617
673
  }
618
674
  }
619
- const Ue = Object.freeze({
675
+ const Ge = Object.freeze({
620
676
  getItem: (s) => new Promise((e, t) => {
621
677
  try {
622
678
  const i = localStorage.getItem(s);
@@ -648,7 +704,7 @@ const Ue = Object.freeze({
648
704
  }
649
705
  })
650
706
  });
651
- class Me {
707
+ class Be {
652
708
  constructor(e) {
653
709
  w(this, "callback");
654
710
  w(this, "startTime");
@@ -731,11 +787,11 @@ class Me {
731
787
  });
732
788
  }
733
789
  }
734
- const Oe = new Me();
790
+ const He = new Be();
735
791
  export {
736
- Me as GlideAnalytics,
737
- Te as GlideDeposit,
738
- Ue as browserLocalStorageProvider,
739
- Oe as glideAnalytics,
740
- me as initializeParentBridge
792
+ Be as GlideAnalytics,
793
+ Fe as GlideDeposit,
794
+ Ge as browserLocalStorageProvider,
795
+ He as glideAnalytics,
796
+ xe as initializeParentBridge
741
797
  };
package/dist/glide.js CHANGED
@@ -1,7 +1,7 @@
1
- import { GlideDeposit as w } from "./core.js";
2
- import { GlideAnalytics as r, browserLocalStorageProvider as u, glideAnalytics as o, initializeParentBridge as c } from "./core.js";
3
- import { useMemo as P } from "react";
4
- const C = ({
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 = ({
5
5
  app: G,
6
6
  recipient: U,
7
7
  chainId: z,
@@ -19,26 +19,27 @@ const C = ({
19
19
  payerEmail: _,
20
20
  mode: $,
21
21
  hideSettlementCopy: K,
22
- showAppLogo: W,
23
- showOnrampFirst: x,
24
- debitCardAlias: k,
25
- copyOverrides: L,
26
- stableDepositAddressKey: R,
27
- sessionId: D,
28
- sessionMetadata: E,
22
+ showAppLogo: x,
23
+ showOnrampFirst: k,
24
+ debitCardAlias: L,
25
+ copyOverrides: R,
26
+ stableDepositAddressKey: E,
27
+ sessionId: M,
28
+ sessionMetadata: D,
29
29
  disableWithdrawToSelfSuggestion: T,
30
30
  theme: f,
31
- walletProvider: t,
32
- localStorageProvider: A,
33
- onOpen: F,
34
- onSuccess: M,
35
- onClose: b,
36
- autoCloseOnSuccess: g,
37
- popupsBlocked: v,
38
- baseUrl: I,
39
- debug: m
31
+ 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
40
41
  }) => {
41
- const y = P(() => new w({
42
+ const g = b(() => new y({
42
43
  app: G,
43
44
  recipient: U,
44
45
  chainId: z,
@@ -56,24 +57,25 @@ const C = ({
56
57
  payerEmail: _,
57
58
  mode: $,
58
59
  hideSettlementCopy: K,
59
- showAppLogo: W,
60
- showOnrampFirst: x,
61
- debitCardAlias: k,
62
- copyOverrides: L,
63
- stableDepositAddressKey: R,
64
- sessionId: D,
65
- sessionMetadata: E,
60
+ showAppLogo: x,
61
+ showOnrampFirst: k,
62
+ debitCardAlias: L,
63
+ copyOverrides: R,
64
+ stableDepositAddressKey: E,
65
+ sessionId: M,
66
+ sessionMetadata: D,
66
67
  disableWithdrawToSelfSuggestion: T,
67
68
  theme: f,
68
- walletProvider: t,
69
- localStorageProvider: A,
70
- onOpen: F,
71
- onSuccess: M,
72
- onClose: b,
73
- autoCloseOnSuccess: g,
74
- popupsBlocked: v,
75
- baseUrl: I,
76
- debug: m
69
+ 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
77
79
  }), [
78
80
  G,
79
81
  U,
@@ -92,31 +94,32 @@ const C = ({
92
94
  _,
93
95
  $,
94
96
  K,
95
- W,
96
97
  x,
97
98
  k,
98
99
  L,
99
100
  R,
100
- D,
101
101
  E,
102
+ M,
103
+ D,
102
104
  T,
103
105
  f,
104
- t,
105
106
  A,
106
107
  F,
107
- M,
108
- b,
109
- g,
110
- v,
108
+ w,
109
+ t,
110
+ W,
111
111
  I,
112
- m
112
+ P,
113
+ m,
114
+ O,
115
+ v
113
116
  ]);
114
117
  return {
115
- openGlideDeposit: y.open,
116
- externalUrl: y.externalUrl,
117
- opts: y.opts
118
+ openGlideDeposit: g.open,
119
+ externalUrl: g.externalUrl,
120
+ opts: g.opts
118
121
  };
119
- }, l = ({
122
+ }, p = ({
120
123
  app: G,
121
124
  preferGaslessPayment: U,
122
125
  chainIds: z,
@@ -134,20 +137,21 @@ const C = ({
134
137
  debitCardAlias: _,
135
138
  copyOverrides: $,
136
139
  amount: K,
137
- sessionId: W,
138
- sessionMetadata: x,
139
- theme: k,
140
- walletProvider: L,
141
- localStorageProvider: R,
140
+ sessionId: x,
141
+ sessionMetadata: k,
142
+ theme: L,
143
+ walletProvider: R,
144
+ solanaWalletProvider: E,
145
+ localStorageProvider: M,
142
146
  onOpen: D,
143
- onSuccess: E,
144
- onClose: T,
145
- autoCloseOnSuccess: f,
146
- popupsBlocked: t,
147
- baseUrl: A,
148
- debug: F
147
+ onSuccess: T,
148
+ onClose: f,
149
+ autoCloseOnSuccess: A,
150
+ popupsBlocked: F,
151
+ baseUrl: w,
152
+ debug: t
149
153
  }) => {
150
- const M = P(() => new w({
154
+ const W = b(() => new y({
151
155
  app: G,
152
156
  preferGaslessPayment: U,
153
157
  chainIds: z,
@@ -165,19 +169,20 @@ const C = ({
165
169
  showOnrampFirst: Z,
166
170
  debitCardAlias: _,
167
171
  copyOverrides: $,
168
- sessionId: W,
172
+ sessionId: x,
169
173
  amount: K,
170
- sessionMetadata: x,
171
- theme: k,
172
- walletProvider: L,
173
- localStorageProvider: R,
174
+ sessionMetadata: k,
175
+ theme: L,
176
+ walletProvider: R,
177
+ solanaWalletProvider: E,
178
+ localStorageProvider: M,
174
179
  onOpen: D,
175
- onSuccess: E,
176
- onClose: T,
177
- autoCloseOnSuccess: f,
178
- popupsBlocked: t,
179
- baseUrl: A,
180
- debug: F
180
+ onSuccess: T,
181
+ onClose: f,
182
+ autoCloseOnSuccess: A,
183
+ popupsBlocked: F,
184
+ baseUrl: w,
185
+ debug: t
181
186
  }), [
182
187
  G,
183
188
  U,
@@ -195,26 +200,27 @@ const C = ({
195
200
  Z,
196
201
  _,
197
202
  $,
198
- W,
199
- K,
200
203
  x,
204
+ K,
201
205
  k,
202
206
  L,
203
207
  R,
204
- D,
205
208
  E,
209
+ M,
210
+ D,
206
211
  T,
207
212
  f,
208
- t,
209
213
  A,
210
- F
214
+ F,
215
+ w,
216
+ t
211
217
  ]);
212
218
  return {
213
- openGlidePay: M.open,
214
- externalUrl: M.externalUrl,
215
- opts: M.opts
219
+ openGlidePay: W.open,
220
+ externalUrl: W.externalUrl,
221
+ opts: W.opts
216
222
  };
217
- }, h = ({
223
+ }, l = ({
218
224
  app: G,
219
225
  evm: U,
220
226
  approval: z,
@@ -230,16 +236,17 @@ const C = ({
230
236
  copyOverrides: Y,
231
237
  theme: Z,
232
238
  walletProvider: _,
233
- localStorageProvider: $,
234
- onOpen: K,
235
- onSuccess: W,
236
- onClose: x,
237
- autoCloseOnSuccess: k,
238
- popupsBlocked: L,
239
- baseUrl: R,
239
+ solanaWalletProvider: $,
240
+ localStorageProvider: K,
241
+ onOpen: x,
242
+ onSuccess: k,
243
+ onClose: L,
244
+ autoCloseOnSuccess: R,
245
+ popupsBlocked: E,
246
+ baseUrl: M,
240
247
  debug: D
241
248
  }) => {
242
- const E = P(() => new w({
249
+ const T = b(() => new y({
243
250
  app: G,
244
251
  evm: U,
245
252
  approval: z,
@@ -256,13 +263,14 @@ const C = ({
256
263
  mode: "call",
257
264
  theme: Z,
258
265
  walletProvider: _,
259
- localStorageProvider: $,
260
- onOpen: K,
261
- onSuccess: W,
262
- onClose: x,
263
- autoCloseOnSuccess: k,
264
- popupsBlocked: L,
265
- baseUrl: R,
266
+ solanaWalletProvider: $,
267
+ localStorageProvider: K,
268
+ onOpen: x,
269
+ onSuccess: k,
270
+ onClose: L,
271
+ autoCloseOnSuccess: R,
272
+ popupsBlocked: E,
273
+ baseUrl: M,
266
274
  debug: D
267
275
  }), [
268
276
  G,
@@ -282,19 +290,20 @@ const C = ({
282
290
  _,
283
291
  $,
284
292
  K,
285
- W,
286
293
  x,
287
294
  k,
288
295
  L,
289
296
  R,
297
+ E,
298
+ M,
290
299
  D
291
300
  ]);
292
301
  return {
293
- openGlideCall: E.open,
294
- externalUrl: E.externalUrl,
295
- opts: E.opts
302
+ openGlideCall: T.open,
303
+ externalUrl: T.externalUrl,
304
+ opts: T.opts
296
305
  };
297
- }, p = ({
306
+ }, i = ({
298
307
  app: G,
299
308
  recipient: U,
300
309
  chainId: z,
@@ -311,14 +320,15 @@ const C = ({
311
320
  copyOverrides: Z,
312
321
  theme: _,
313
322
  walletProvider: $,
314
- localStorageProvider: K,
315
- onOpen: W,
316
- onSuccess: x,
317
- onClose: k,
318
- autoCloseOnSuccess: L,
319
- baseUrl: R
323
+ solanaWalletProvider: K,
324
+ localStorageProvider: x,
325
+ onOpen: k,
326
+ onSuccess: L,
327
+ onClose: R,
328
+ autoCloseOnSuccess: E,
329
+ baseUrl: M
320
330
  }) => {
321
- const D = P(() => new w({
331
+ const D = b(() => new y({
322
332
  app: G,
323
333
  recipient: U,
324
334
  chainId: z,
@@ -336,12 +346,13 @@ const C = ({
336
346
  mode: "buy",
337
347
  theme: _,
338
348
  walletProvider: $,
339
- localStorageProvider: K,
340
- onOpen: W,
341
- onSuccess: x,
342
- onClose: k,
343
- autoCloseOnSuccess: L,
344
- baseUrl: R
349
+ solanaWalletProvider: K,
350
+ localStorageProvider: x,
351
+ onOpen: k,
352
+ onSuccess: L,
353
+ onClose: R,
354
+ autoCloseOnSuccess: E,
355
+ baseUrl: M
345
356
  }), [
346
357
  G,
347
358
  U,
@@ -360,11 +371,12 @@ const C = ({
360
371
  _,
361
372
  $,
362
373
  K,
363
- W,
364
374
  x,
365
375
  k,
366
376
  L,
367
- R
377
+ R,
378
+ E,
379
+ M
368
380
  ]);
369
381
  return {
370
382
  openGlideBuy: D.open,
@@ -374,12 +386,12 @@ const C = ({
374
386
  };
375
387
  export {
376
388
  r as GlideAnalytics,
377
- w as GlideDeposit,
378
- u as browserLocalStorageProvider,
389
+ y as GlideDeposit,
390
+ c as browserLocalStorageProvider,
379
391
  o as glideAnalytics,
380
- c as initializeParentBridge,
381
- p as useGlideBuy,
382
- h as useGlideCall,
383
- C as useGlideDeposit,
384
- l as useGlidePay
392
+ d as initializeParentBridge,
393
+ i as useGlideBuy,
394
+ l as useGlideCall,
395
+ h as useGlideDeposit,
396
+ p as useGlidePay
385
397
  };
@@ -77,6 +77,12 @@ export type GlideDepositWalletProvider = {
77
77
  sendTransactionAsync: (tx: EVMTransaction) => Promise<Hex>;
78
78
  signTypedDataAsync?: (args: PermitTypedData<bigint>) => Promise<Hex>;
79
79
  };
80
+ export type GlideSolanaWalletProvider = {
81
+ address: string | undefined;
82
+ currentChainId: "solana:101" | "solana:103";
83
+ signMessageAsync: (message: Uint8Array) => Promise<Uint8Array>;
84
+ sendTransactionAsync: (transaction: Uint8Array) => Promise<Uint8Array>;
85
+ };
80
86
  export type GlideLocalStorageProvider = {
81
87
  getItem: (key: string) => Promise<string | null>;
82
88
  setItem: (key: string, value: string) => Promise<void>;
@@ -125,6 +131,7 @@ export type GlideDepositOptions = {
125
131
  enableRefundEmails?: boolean;
126
132
  payerEmail?: string;
127
133
  walletProvider?: GlideDepositWalletProvider;
134
+ solanaWalletProvider?: GlideSolanaWalletProvider;
128
135
  localStorageProvider?: GlideLocalStorageProvider;
129
136
  onOpen?: () => void;
130
137
  onSuccess?: (fulfillmentTxHash: Hex, session: Session) => void;
@@ -1,4 +1,4 @@
1
- import { FundingSource, GlideDepositWalletProvider, GlideLocalStorageProvider, Hex, ShowAppLogo, DebitCardAlias } from './GlideDeposit.ts';
1
+ import { FundingSource, GlideDepositWalletProvider, GlideSolanaWalletProvider, GlideLocalStorageProvider, Hex, ShowAppLogo, DebitCardAlias } from './GlideDeposit.ts';
2
2
  import { GlideWidgetTheme } from './theme.ts';
3
3
  import { CAIP2, Session } from '@paywithglide/glide-js';
4
4
  interface UseGlideBuyProps {
@@ -18,6 +18,7 @@ interface UseGlideBuyProps {
18
18
  copyOverrides?: Record<string, string>;
19
19
  theme?: GlideWidgetTheme;
20
20
  walletProvider?: GlideDepositWalletProvider;
21
+ solanaWalletProvider?: GlideSolanaWalletProvider;
21
22
  localStorageProvider?: GlideLocalStorageProvider;
22
23
  onOpen?: () => void;
23
24
  onSuccess?: (hash: Hex, session: Session) => void;
@@ -25,7 +26,7 @@ interface UseGlideBuyProps {
25
26
  autoCloseOnSuccess?: boolean;
26
27
  baseUrl?: string;
27
28
  }
28
- export declare const useGlideBuy: ({ app, recipient, chainId, currencyId, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
29
+ export declare const useGlideBuy: ({ app, recipient, chainId, currencyId, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, theme, walletProvider, solanaWalletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, baseUrl, }: UseGlideBuyProps) => {
29
30
  openGlideBuy: () => void;
30
31
  externalUrl: string;
31
32
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -1,4 +1,4 @@
1
- import { FundingSource, GlideDepositWalletProvider, GlideLocalStorageProvider, Hex, ShowAppLogo, DebitCardAlias } from './GlideDeposit.ts';
1
+ import { FundingSource, GlideDepositWalletProvider, GlideSolanaWalletProvider, GlideLocalStorageProvider, Hex, ShowAppLogo, DebitCardAlias } from './GlideDeposit.ts';
2
2
  import { GlideWidgetTheme } from './theme.ts';
3
3
  import { CAIP2, Session } from '@paywithglide/glide-js';
4
4
  interface UseGlideCallProps {
@@ -25,6 +25,7 @@ interface UseGlideCallProps {
25
25
  copyOverrides?: Record<string, string>;
26
26
  theme?: GlideWidgetTheme;
27
27
  walletProvider?: GlideDepositWalletProvider;
28
+ solanaWalletProvider?: GlideSolanaWalletProvider;
28
29
  localStorageProvider?: GlideLocalStorageProvider;
29
30
  onOpen?: () => void;
30
31
  onSuccess?: (hash: Hex, session: Session) => void;
@@ -34,7 +35,7 @@ interface UseGlideCallProps {
34
35
  baseUrl?: string;
35
36
  debug?: boolean;
36
37
  }
37
- export declare const useGlideCall: ({ app, evm, approval, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideCallProps) => {
38
+ export declare const useGlideCall: ({ app, evm, approval, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, sessionMetadata, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, theme, walletProvider, solanaWalletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideCallProps) => {
38
39
  openGlideCall: () => void;
39
40
  externalUrl: string;
40
41
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -1,4 +1,4 @@
1
- import { FundingSource, GlideDepositWalletProvider, GlideLocalStorageProvider, ShowAppLogo, DebitCardAlias } from './GlideDeposit.ts';
1
+ import { FundingSource, GlideDepositWalletProvider, GlideSolanaWalletProvider, GlideLocalStorageProvider, ShowAppLogo, DebitCardAlias } from './GlideDeposit.ts';
2
2
  import { GlideWidgetTheme } from './theme.ts';
3
3
  import { CAIP2, Hex, Session } from '@paywithglide/glide-js';
4
4
  interface UseGlideDepositProps {
@@ -34,6 +34,7 @@ interface UseGlideDepositProps {
34
34
  disableWithdrawToSelfSuggestion?: boolean;
35
35
  theme?: GlideWidgetTheme;
36
36
  walletProvider?: GlideDepositWalletProvider;
37
+ solanaWalletProvider?: GlideSolanaWalletProvider;
37
38
  localStorageProvider?: GlideLocalStorageProvider;
38
39
  onOpen?: () => void;
39
40
  onSuccess?: (hash: Hex, session: Session) => void;
@@ -43,7 +44,7 @@ interface UseGlideDepositProps {
43
44
  baseUrl?: string;
44
45
  debug?: boolean;
45
46
  }
46
- 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, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
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) => {
47
48
  openGlideDeposit: () => void;
48
49
  externalUrl: string;
49
50
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
@@ -1,4 +1,4 @@
1
- import { FundingSource, GlideDepositWalletProvider, GlideLocalStorageProvider, ShowAppLogo, DebitCardAlias } from './GlideDeposit.ts';
1
+ import { FundingSource, GlideDepositWalletProvider, GlideSolanaWalletProvider, GlideLocalStorageProvider, ShowAppLogo, DebitCardAlias } from './GlideDeposit.ts';
2
2
  import { GlideWidgetTheme } from './theme.ts';
3
3
  import { CAIP2, Hex, Session } from '@paywithglide/glide-js';
4
4
  type UseGlidePayProps = {
@@ -27,6 +27,7 @@ type UseGlidePayProps = {
27
27
  sessionMetadata?: string;
28
28
  theme?: GlideWidgetTheme;
29
29
  walletProvider?: GlideDepositWalletProvider;
30
+ solanaWalletProvider?: GlideSolanaWalletProvider;
30
31
  localStorageProvider?: GlideLocalStorageProvider;
31
32
  onOpen?: () => void;
32
33
  onSuccess?: (hash: Hex, session: Session) => void;
@@ -36,7 +37,7 @@ type UseGlidePayProps = {
36
37
  baseUrl?: string;
37
38
  debug?: boolean;
38
39
  };
39
- export declare const useGlidePay: ({ app, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, allowedPaymentCurrencies, appMetadata, enableRefundEmails, payerEmail, hideSettlementCopy, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, amount, sessionId, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlidePayProps) => {
40
+ export declare const useGlidePay: ({ app, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, allowedPaymentCurrencies, appMetadata, enableRefundEmails, payerEmail, hideSettlementCopy, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, amount, sessionId, sessionMetadata, theme, walletProvider, solanaWalletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlidePayProps) => {
40
41
  openGlidePay: () => void;
41
42
  externalUrl: string;
42
43
  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.47",
3
+ "version": "0.0.48",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -34,6 +34,11 @@
34
34
  "devDependencies": {
35
35
  "@antiwork/shortest": "^0.2.1",
36
36
  "@eslint/js": "^9.15.0",
37
+ "@privy-io/react-auth": "^3.10.1",
38
+ "@solana-program/memo": "^0.10.0",
39
+ "@solana-program/system": "^0.10.0",
40
+ "@solana-program/token": "^0.9.0",
41
+ "@solana/kit": "^5.1.0",
37
42
  "@tanstack/react-query": "^5.61.5",
38
43
  "@types/chrome": "^0.0.299",
39
44
  "@types/react": "^18.3.12",