@paywithglide/glide-react 0.0.44 → 0.0.45

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/glide.js CHANGED
@@ -1,6 +1,6 @@
1
1
  var ee = Object.defineProperty;
2
2
  var te = (s, t, e) => t in s ? ee(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var j = (s, t, e) => te(s, typeof t != "symbol" ? t + "" : t, e);
3
+ var L = (s, t, e) => te(s, typeof t != "symbol" ? t + "" : t, e);
4
4
  import { useMemo as G } from "react";
5
5
  function se(s, { strict: t = !0 } = {}) {
6
6
  return !s || typeof s != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(s) : s.startsWith("0x");
@@ -9,26 +9,26 @@ function q(s) {
9
9
  return se(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
10
10
  }
11
11
  const N = "2.21.51";
12
- let L = {
12
+ let W = {
13
13
  getDocsUrl: ({ docsBaseUrl: s, docsPath: t = "", docsSlug: e }) => t ? `${s ?? "https://viem.sh"}${t}${e ? `#${e}` : ""}` : void 0,
14
14
  version: `viem@${N}`
15
15
  };
16
- class z extends Error {
16
+ class D extends Error {
17
17
  constructor(t, e = {}) {
18
18
  var d;
19
19
  const i = (() => {
20
20
  var a;
21
- return e.cause instanceof z ? e.cause.details : (a = e.cause) != null && a.message ? e.cause.message : e.details;
22
- })(), o = e.cause instanceof z && e.cause.docsPath || e.docsPath, r = (d = L.getDocsUrl) == null ? void 0 : d.call(L, { ...e, docsPath: o }), p = [
21
+ return e.cause instanceof D ? e.cause.details : (a = e.cause) != null && a.message ? e.cause.message : e.details;
22
+ })(), o = e.cause instanceof D && e.cause.docsPath || e.docsPath, n = (d = W.getDocsUrl) == null ? void 0 : d.call(W, { ...e, docsPath: o }), c = [
23
23
  t || "An error occurred.",
24
24
  "",
25
25
  ...e.metaMessages ? [...e.metaMessages, ""] : [],
26
- ...r ? [`Docs: ${r}`] : [],
26
+ ...n ? [`Docs: ${n}`] : [],
27
27
  ...i ? [`Details: ${i}`] : [],
28
- ...L.version ? [`Version: ${L.version}`] : []
28
+ ...W.version ? [`Version: ${W.version}`] : []
29
29
  ].join(`
30
30
  `);
31
- super(p, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
31
+ super(c, e.cause ? { cause: e.cause } : void 0), Object.defineProperty(this, "details", {
32
32
  enumerable: !0,
33
33
  configurable: !0,
34
34
  writable: !0,
@@ -67,12 +67,12 @@ class z extends Error {
67
67
  function V(s, t) {
68
68
  return t != null && t(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? V(s.cause, t) : t ? null : s;
69
69
  }
70
- class F extends z {
70
+ class F extends D {
71
71
  constructor({ size: t, targetSize: e, type: i }) {
72
72
  super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`, { name: "SizeExceedsPaddingSizeError" });
73
73
  }
74
74
  }
75
- function O(s, { dir: t, size: e = 32 } = {}) {
75
+ function H(s, { dir: t, size: e = 32 } = {}) {
76
76
  return typeof s == "string" ? ie(s, { dir: t, size: e }) : oe(s, { dir: t, size: e });
77
77
  }
78
78
  function ie(s, { dir: t, size: e = 32 } = {}) {
@@ -98,60 +98,60 @@ function oe(s, { dir: t, size: e = 32 } = {}) {
98
98
  });
99
99
  const i = new Uint8Array(e);
100
100
  for (let o = 0; o < e; o++) {
101
- const r = t === "right";
102
- i[r ? o : e - o - 1] = s[r ? o : s.length - o - 1];
101
+ const n = t === "right";
102
+ i[n ? o : e - o - 1] = s[n ? o : s.length - o - 1];
103
103
  }
104
104
  return i;
105
105
  }
106
- class re extends z {
107
- constructor({ max: t, min: e, signed: i, size: o, value: r }) {
108
- super(`Number "${r}" is not in safe ${o ? `${o * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${e} to ${t})` : `(above ${e})`}`, { name: "IntegerOutOfRangeError" });
106
+ class ne extends D {
107
+ constructor({ max: t, min: e, signed: i, size: o, value: n }) {
108
+ super(`Number "${n}" is not in safe ${o ? `${o * 8}-bit ${i ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${e} to ${t})` : `(above ${e})`}`, { name: "IntegerOutOfRangeError" });
109
109
  }
110
110
  }
111
- class ne extends z {
111
+ class re extends D {
112
112
  constructor({ givenSize: t, maxSize: e }) {
113
113
  super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
114
114
  }
115
115
  }
116
116
  function J(s, { size: t }) {
117
117
  if (q(s) > t)
118
- throw new ne({
118
+ throw new re({
119
119
  givenSize: q(s),
120
120
  maxSize: t
121
121
  });
122
122
  }
123
123
  const ae = /* @__PURE__ */ Array.from({ length: 256 }, (s, t) => t.toString(16).padStart(2, "0"));
124
124
  function de(s, t = {}) {
125
- return typeof s == "number" || typeof s == "bigint" ? ce(s, t) : typeof s == "string" ? he(s, t) : typeof s == "boolean" ? pe(s, t) : X(s, t);
125
+ return typeof s == "number" || typeof s == "bigint" ? pe(s, t) : typeof s == "string" ? he(s, t) : typeof s == "boolean" ? ce(s, t) : X(s, t);
126
126
  }
127
- function pe(s, t = {}) {
127
+ function ce(s, t = {}) {
128
128
  const e = `0x${Number(s)}`;
129
- return typeof t.size == "number" ? (J(e, { size: t.size }), O(e, { size: t.size })) : e;
129
+ return typeof t.size == "number" ? (J(e, { size: t.size }), H(e, { size: t.size })) : e;
130
130
  }
131
131
  function X(s, t = {}) {
132
132
  let e = "";
133
133
  for (let o = 0; o < s.length; o++)
134
134
  e += ae[s[o]];
135
135
  const i = `0x${e}`;
136
- return typeof t.size == "number" ? (J(i, { size: t.size }), O(i, { dir: "right", size: t.size })) : i;
136
+ return typeof t.size == "number" ? (J(i, { size: t.size }), H(i, { dir: "right", size: t.size })) : i;
137
137
  }
138
- function ce(s, t = {}) {
138
+ function pe(s, t = {}) {
139
139
  const { signed: e, size: i } = t, o = BigInt(s);
140
- let r;
141
- i ? e ? r = (1n << BigInt(i) * 8n - 1n) - 1n : r = 2n ** (BigInt(i) * 8n) - 1n : typeof s == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
142
- const p = typeof r == "bigint" && e ? -r - 1n : 0;
143
- if (r && o > r || o < p) {
140
+ let n;
141
+ i ? e ? n = (1n << BigInt(i) * 8n - 1n) - 1n : n = 2n ** (BigInt(i) * 8n) - 1n : typeof s == "number" && (n = BigInt(Number.MAX_SAFE_INTEGER));
142
+ const c = typeof n == "bigint" && e ? -n - 1n : 0;
143
+ if (n && o > n || o < c) {
144
144
  const a = typeof s == "bigint" ? "n" : "";
145
- throw new re({
146
- max: r ? `${r}${a}` : void 0,
147
- min: `${p}${a}`,
145
+ throw new ne({
146
+ max: n ? `${n}${a}` : void 0,
147
+ min: `${c}${a}`,
148
148
  signed: e,
149
149
  size: i,
150
150
  value: `${s}${a}`
151
151
  });
152
152
  }
153
153
  const d = `0x${(e && o < 0 ? (1n << BigInt(i * 8)) + BigInt(o) : o).toString(16)}`;
154
- return i ? O(d, { size: i }) : d;
154
+ return i ? H(d, { size: i }) : d;
155
155
  }
156
156
  const le = /* @__PURE__ */ new TextEncoder();
157
157
  function he(s, t = {}) {
@@ -166,43 +166,43 @@ function me(s) {
166
166
  if (K)
167
167
  return;
168
168
  K = !0;
169
- const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), o = (p) => {
170
- const d = p.detail;
169
+ const t = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), o = (c) => {
170
+ const d = c.detail;
171
171
  t.has(d.info.uuid) || t.set(d.info.uuid, d);
172
172
  };
173
- window.addEventListener("eip6963:announceProvider", o), window.dispatchEvent(new Event("eip6963:requestProvider")), window.addEventListener("message", async (p) => {
173
+ window.addEventListener("eip6963:announceProvider", o), window.dispatchEvent(new Event("eip6963:requestProvider")), window.addEventListener("message", async (c) => {
174
174
  var f;
175
- if (p.origin !== s) return;
176
- const { type: d, data: a } = p.data;
175
+ if (c.origin !== s) return;
176
+ const { type: d, data: a } = c.data;
177
177
  switch (d) {
178
178
  case "glide:getProviders": {
179
- const c = Array.from(t.values()).map(
179
+ const p = Array.from(t.values()).map(
180
180
  ({ info: h, provider: l }) => ({
181
181
  info: h,
182
182
  isConnected: typeof l.isConnected == "boolean" ? l.isConnected : void 0,
183
183
  chainId: l.chainId,
184
184
  selectedAddress: l.selectedAddress
185
185
  })
186
- ), n = document.getElementById(
186
+ ), r = document.getElementById(
187
187
  "glide-deposit-iframe"
188
188
  );
189
- n != null && n.contentWindow && n.contentWindow.postMessage(
189
+ r != null && r.contentWindow && r.contentWindow.postMessage(
190
190
  {
191
191
  type: "glide:providers",
192
- providers: c
192
+ providers: p
193
193
  },
194
194
  s
195
195
  );
196
196
  break;
197
197
  }
198
198
  case "glide:providerRequest": {
199
- const { uuid: c, requestId: n, method: h, params: l } = a;
200
- if (i.has(n))
199
+ const { uuid: p, requestId: r, method: h, params: l } = a;
200
+ if (i.has(r))
201
201
  return;
202
- i.set(n, !0);
203
- const m = t.get(c);
202
+ i.set(r, !0);
203
+ const m = t.get(p);
204
204
  if (!m) {
205
- i.delete(n), r(n, { error: "Provider not found" });
205
+ i.delete(r), n(r, { error: "Provider not found" });
206
206
  return;
207
207
  }
208
208
  try {
@@ -210,22 +210,22 @@ function me(s) {
210
210
  method: h,
211
211
  params: l
212
212
  });
213
- i.delete(n), r(n, { result: u });
213
+ i.delete(r), n(r, { result: u });
214
214
  } catch (u) {
215
- i.delete(n), ue(u) ? r(n, {
215
+ i.delete(r), ue(u) ? n(r, {
216
216
  error: u.message || String(u),
217
217
  code: u.code,
218
218
  data: u.data
219
- }) : r(n, {
219
+ }) : n(r, {
220
220
  error: String(u)
221
221
  });
222
222
  }
223
223
  break;
224
224
  }
225
225
  case "glide:addEventListener": {
226
- const { uuid: c, requestId: n, eventName: h } = a, l = t.get(c);
226
+ const { uuid: p, requestId: r, eventName: h } = a, l = t.get(p);
227
227
  if (!l || !l.provider.on) {
228
- r(n, { error: "Provider or method not found" });
228
+ n(r, { error: "Provider or method not found" });
229
229
  return;
230
230
  }
231
231
  const m = (...u) => {
@@ -235,48 +235,61 @@ function me(s) {
235
235
  g != null && g.contentWindow && g.contentWindow.postMessage(
236
236
  {
237
237
  type: "glide:providerEvent",
238
- uuid: c,
238
+ uuid: p,
239
239
  eventName: h,
240
240
  args: u
241
241
  },
242
242
  s
243
243
  );
244
244
  };
245
- e.has(c) || e.set(c, /* @__PURE__ */ new Map()), e.get(c).has(h) || e.get(c).set(h, /* @__PURE__ */ new Set()), e.get(c).get(h).add(m), l.provider.on(h, m), r(n, { result: !0 });
245
+ e.has(p) || e.set(p, /* @__PURE__ */ new Map()), e.get(p).has(h) || e.get(p).set(h, /* @__PURE__ */ new Set()), e.get(p).get(h).add(m), l.provider.on(h, m), n(r, { result: !0 });
246
246
  break;
247
247
  }
248
248
  case "glide:removeEventListener": {
249
- const { uuid: c, requestId: n, eventName: h } = a, l = t.get(c);
249
+ const { uuid: p, requestId: r, eventName: h } = a, l = t.get(p);
250
250
  if (!l || !l.provider.removeListener) {
251
- r(n, { error: "Provider or method not found" });
251
+ n(r, { error: "Provider or method not found" });
252
252
  return;
253
253
  }
254
- const m = (f = e.get(c)) == null ? void 0 : f.get(h);
254
+ const m = (f = e.get(p)) == null ? void 0 : f.get(h);
255
255
  m && (m.forEach((u) => {
256
256
  l.provider.removeListener(h, u);
257
- }), m.clear()), r(n, { result: !0 });
257
+ }), m.clear()), n(r, { result: !0 });
258
258
  break;
259
259
  }
260
260
  }
261
261
  });
262
- function r(p, d) {
262
+ function n(c, d) {
263
263
  const a = document.getElementById(
264
264
  "glide-deposit-iframe"
265
265
  );
266
266
  a != null && a.contentWindow && a.contentWindow.postMessage(
267
267
  {
268
268
  type: "glide:providerResponse",
269
- requestId: p,
269
+ requestId: c,
270
270
  ...d
271
271
  },
272
272
  s
273
273
  );
274
274
  }
275
275
  }
276
- class H {
276
+ const ge = "@paywithglide/glide-react", fe = "0.0.45", ye = "module", we = ["dist"], ve = "dist/glide.js", be = "dist/index.d.ts", $e = { ".": { types: "./dist/index.d.ts", default: "./dist/glide.js" }, "./package.json": "./package.json" }, xe = !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" }, Se = { "@paywithglide/glide-js": "0.13.10" }, 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" }, Ee = {
277
+ name: ge,
278
+ version: fe,
279
+ type: ye,
280
+ files: we,
281
+ module: ve,
282
+ types: be,
283
+ exports: $e,
284
+ sideEffects: xe,
285
+ scripts: Ie,
286
+ dependencies: Se,
287
+ devDependencies: Pe
288
+ }, ke = Ee.version;
289
+ class O {
277
290
  constructor(t) {
278
- j(this, "opts");
279
- j(this, "open", () => {
291
+ L(this, "opts");
292
+ L(this, "open", () => {
280
293
  if (!(!this.opts.container && document.body.classList.contains("glide-deposit-open"))) {
281
294
  if (this.opts.container || document.body.classList.add("glide-deposit-open"), (this.opts.mode === "deposit" || this.opts.mode === "buy") && !this.opts.recipient)
282
295
  throw new Error("recipient is required for deposit/buy mode");
@@ -287,12 +300,12 @@ class H {
287
300
  this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
288
301
  }
289
302
  });
290
- j(this, "iframeEventHandler", async (t) => {
291
- var i, o, r, p, d, a, f, c, n, h, l, m, u, g, $, y, I, w, S, v, x, E, U, M, C, k, P, D, T, R, B, W, A;
303
+ L(this, "iframeEventHandler", async (t) => {
304
+ var i, o, n, c, d, a, f, p, r, h, l, m, u, g, $, y, x, w, I, v, S, E, k, U, M, C, P, z, j, T, R, B, A;
292
305
  const e = t.data;
293
306
  switch (e.type) {
294
307
  case "sendInit": {
295
- const b = this.opts.recipient, Q = (i = this.opts.walletProvider) == null ? void 0 : i.address, Y = (o = this.opts.walletProvider) == null ? void 0 : o.availableChainIds, Z = (r = this.opts.walletProvider) == null ? void 0 : r.currentChainId, _ = this.opts.preferGaslessPayment || !!((p = this.opts.walletProvider) != null && p.signTypedDataAsync);
308
+ const b = this.opts.recipient, Q = (i = this.opts.walletProvider) == null ? void 0 : i.address, Y = (o = this.opts.walletProvider) == null ? void 0 : o.availableChainIds, Z = (n = this.opts.walletProvider) == null ? void 0 : n.currentChainId, _ = this.opts.preferGaslessPayment || !!((c = this.opts.walletProvider) != null && c.signTypedDataAsync);
296
309
  (f = (d = this.iframe) == null ? void 0 : d.contentWindow) == null || f.postMessage(
297
310
  {
298
311
  type: "initialize",
@@ -334,14 +347,16 @@ class H {
334
347
  didProvideLocalStorage: !!this.opts.localStorageProvider,
335
348
  debug: this.opts.debug,
336
349
  popupsBlocked: this.opts.popupsBlocked,
337
- gasRefuelAmountPerChain: this.opts.gasRefuelAmountPerChain
350
+ gasRefuelAmountPerChain: this.opts.gasRefuelAmountPerChain,
351
+ sdkVersion: ke,
352
+ referrerDomain: typeof window < "u" ? window.location.origin : void 0
338
353
  },
339
354
  new URL(this.baseUrl).origin
340
355
  );
341
356
  break;
342
357
  }
343
358
  case "didOpen": {
344
- this.iframe.style.opacity = "1", (n = (c = this.opts).onOpen) == null || n.call(c);
359
+ this.iframe.style.opacity = "1", (r = (p = this.opts).onOpen) == null || r.call(p);
345
360
  break;
346
361
  }
347
362
  case "localStorage.getKeys": {
@@ -388,10 +403,10 @@ class H {
388
403
  ($ = (g = this.opts) == null ? void 0 : g.onSuccess) == null || $.call(g, e.hash, e.session);
389
404
  break;
390
405
  case "close":
391
- this.removeIframe(), this.destroy(), (I = (y = this.opts) == null ? void 0 : y.onClose) == null || I.call(y);
406
+ this.removeIframe(), this.destroy(), (x = (y = this.opts) == null ? void 0 : y.onClose) == null || x.call(y);
392
407
  break;
393
408
  case "setMode":
394
- (S = (w = this.opts) == null ? void 0 : w.onSetMode) == null || S.call(w, e.mode);
409
+ (I = (w = this.opts) == null ? void 0 : w.onSetMode) == null || I.call(w, e.mode);
395
410
  break;
396
411
  case "switchChain":
397
412
  if (!this.opts.walletProvider)
@@ -399,7 +414,7 @@ class H {
399
414
  try {
400
415
  await this.opts.walletProvider.switchChainAsync({
401
416
  chainId: e.chainId
402
- }), (x = (v = this.iframe) == null ? void 0 : v.contentWindow) == null || x.postMessage(
417
+ }), (S = (v = this.iframe) == null ? void 0 : v.contentWindow) == null || S.postMessage(
403
418
  {
404
419
  type: "didSwitchChain",
405
420
  success: !0,
@@ -408,7 +423,7 @@ class H {
408
423
  this.baseUrl
409
424
  );
410
425
  } catch (b) {
411
- (U = (E = this.iframe) == null ? void 0 : E.contentWindow) == null || U.postMessage(
426
+ (k = (E = this.iframe) == null ? void 0 : E.contentWindow) == null || k.postMessage(
412
427
  {
413
428
  type: "didSwitchChain",
414
429
  success: !1,
@@ -426,7 +441,7 @@ class H {
426
441
  const b = await this.opts.walletProvider.sendTransactionAsync(
427
442
  e.tx
428
443
  );
429
- (C = (M = this.iframe) == null ? void 0 : M.contentWindow) == null || C.postMessage(
444
+ (M = (U = this.iframe) == null ? void 0 : U.contentWindow) == null || M.postMessage(
430
445
  {
431
446
  type: "didSendTransaction",
432
447
  success: !0,
@@ -435,7 +450,7 @@ class H {
435
450
  this.baseUrl
436
451
  );
437
452
  } catch (b) {
438
- (P = (k = this.iframe) == null ? void 0 : k.contentWindow) == null || P.postMessage(
453
+ (P = (C = this.iframe) == null ? void 0 : C.contentWindow) == null || P.postMessage(
439
454
  {
440
455
  type: "didSendTransaction",
441
456
  success: !1,
@@ -451,7 +466,7 @@ class H {
451
466
  if (!this.opts.walletProvider)
452
467
  throw new Error("walletProvider is not set");
453
468
  if (!this.opts.walletProvider.signTypedDataAsync) {
454
- (T = (D = this.iframe) == null ? void 0 : D.contentWindow) == null || T.postMessage(
469
+ (j = (z = this.iframe) == null ? void 0 : z.contentWindow) == null || j.postMessage(
455
470
  {
456
471
  type: "didSignTypedData",
457
472
  success: !1,
@@ -465,7 +480,7 @@ class H {
465
480
  const b = await this.opts.walletProvider.signTypedDataAsync(
466
481
  e.data
467
482
  );
468
- (B = (R = this.iframe) == null ? void 0 : R.contentWindow) == null || B.postMessage(
483
+ (R = (T = this.iframe) == null ? void 0 : T.contentWindow) == null || R.postMessage(
469
484
  {
470
485
  type: "didSignTypedData",
471
486
  success: !0,
@@ -474,7 +489,7 @@ class H {
474
489
  this.baseUrl
475
490
  );
476
491
  } catch (b) {
477
- (A = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || A.postMessage(
492
+ (A = (B = this.iframe) == null ? void 0 : B.contentWindow) == null || A.postMessage(
478
493
  {
479
494
  type: "didSignTypedData",
480
495
  success: !1,
@@ -490,10 +505,10 @@ class H {
490
505
  this.opts = t;
491
506
  }
492
507
  get externalUrl() {
493
- var t, e, i, o, r, p, d, a, f;
508
+ var t, e, i, o, n, c, d, a, f;
494
509
  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(
495
510
  this.opts.evm.value || 0n
496
- )}` : ""}${this.opts.approval ? `&approval.token=${this.opts.approval.token}&approval.amount=${this.opts.approval.amount}` : ""}${this.opts.sessionMetadata ? `&metadata=${this.opts.sessionMetadata}` : ""}${this.opts.autoCloseOnSuccess ? "&autoCloseOnSuccess=true" : ""}${this.opts.sessionId ? `&sessionId=${this.opts.sessionId}` : ""}${(t = this.opts.chainIds) != null && t.length ? `&chainIds=${this.opts.chainIds.join(",")}` : ""}${(e = this.opts.excludeChainIds) != null && e.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(i = this.opts.excludeCurrencyTiers) != null && i.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(o = this.opts.excludeFundingSources) != null && o.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${(r = this.opts.fundingSources) != null && r.length ? `&fundingSources=${this.opts.fundingSources.join(",")}` : ""}${(p = this.opts.allowedPaymentCurrencies) != null && p.length ? `&allowedPaymentCurrencies=${this.opts.allowedPaymentCurrencies.join(",")}` : ""}${(d = this.opts.appMetadata) != null && d.name ? `&appMetadata.name=${encodeURIComponent(this.opts.appMetadata.name)}` : ""}${(a = this.opts.appMetadata) != null && a.logoUrl ? `&appMetadata.logoUrl=${encodeURIComponent(this.opts.appMetadata.logoUrl)}` : ""}${(f = this.opts.appMetadata) != null && f.faviconUrl ? `&appMetadata.faviconUrl=${encodeURIComponent(this.opts.appMetadata.faviconUrl)}` : ""}${this.opts.enableRefundEmails ? "&enableRefundEmails=true" : ""}${this.opts.payerEmail ? `&payerEmail=${encodeURIComponent(this.opts.payerEmail)}` : ""}${this.opts.debug ? "&debug=true" : ""}${this.opts.popupsBlocked ? "&popupsBlocked=true" : ""}${this.opts.disableWithdrawToSelfSuggestion ? "&disableWithdrawToSelfSuggestion=true" : ""}${this.opts.hideSettlementCopy ? "&hideSettlementCopy=true" : ""}${this.opts.showAppLogo ? `&showAppLogo=${this.opts.showAppLogo}` : ""}${this.opts.showOnrampFirst ? "&showOnrampFirst=true" : ""}${this.opts.debitCardAlias ? `&debitCardAlias=${this.opts.debitCardAlias}` : ""}${this.opts.copyOverrides ? `&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))}` : ""}`;
511
+ )}` : ""}${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(",")}` : ""}${(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)}` : ""}${(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))}` : ""}`;
497
512
  }
498
513
  initialize() {
499
514
  window.addEventListener("message", this.iframeEventHandler);
@@ -542,19 +557,19 @@ class H {
542
557
  t && (t.remove(), document.body.classList.remove("glide-deposit-open"));
543
558
  }
544
559
  }
545
- const ye = ({
560
+ const Ce = ({
546
561
  app: s,
547
562
  recipient: t,
548
563
  chainId: e,
549
564
  currencyId: i,
550
565
  amount: o,
551
- gasRefuelAmountPerChain: r,
552
- preferGaslessPayment: p,
566
+ gasRefuelAmountPerChain: n,
567
+ preferGaslessPayment: c,
553
568
  chainIds: d,
554
569
  excludeChainIds: a,
555
570
  excludeCurrencyTiers: f,
556
- excludeFundingSources: c,
557
- fundingSources: n,
571
+ excludeFundingSources: p,
572
+ fundingSources: r,
558
573
  appMetadata: h,
559
574
  enableRefundEmails: l,
560
575
  payerEmail: m,
@@ -562,36 +577,36 @@ const ye = ({
562
577
  hideSettlementCopy: g,
563
578
  showAppLogo: $,
564
579
  showOnrampFirst: y,
565
- debitCardAlias: I,
580
+ debitCardAlias: x,
566
581
  copyOverrides: w,
567
- stableDepositAddressKey: S,
582
+ stableDepositAddressKey: I,
568
583
  sessionId: v,
569
- sessionMetadata: x,
584
+ sessionMetadata: S,
570
585
  disableWithdrawToSelfSuggestion: E,
571
- theme: U,
572
- walletProvider: M,
573
- localStorageProvider: C,
574
- onOpen: k,
586
+ theme: k,
587
+ walletProvider: U,
588
+ localStorageProvider: M,
589
+ onOpen: C,
575
590
  onSuccess: P,
576
- onClose: D,
577
- autoCloseOnSuccess: T,
578
- popupsBlocked: R,
579
- baseUrl: B,
580
- debug: W
591
+ onClose: z,
592
+ autoCloseOnSuccess: j,
593
+ popupsBlocked: T,
594
+ baseUrl: R,
595
+ debug: B
581
596
  }) => {
582
- const A = G(() => new H({
597
+ const A = G(() => new O({
583
598
  app: s,
584
599
  recipient: t,
585
600
  chainId: e,
586
601
  currencyId: i,
587
602
  amount: o,
588
- gasRefuelAmountPerChain: r,
589
- preferGaslessPayment: p,
603
+ gasRefuelAmountPerChain: n,
604
+ preferGaslessPayment: c,
590
605
  chainIds: d,
591
606
  excludeChainIds: a,
592
607
  excludeCurrencyTiers: f,
593
- excludeFundingSources: c,
594
- fundingSources: n,
608
+ excludeFundingSources: p,
609
+ fundingSources: r,
595
610
  appMetadata: h,
596
611
  enableRefundEmails: l,
597
612
  payerEmail: m,
@@ -599,35 +614,35 @@ const ye = ({
599
614
  hideSettlementCopy: g,
600
615
  showAppLogo: $,
601
616
  showOnrampFirst: y,
602
- debitCardAlias: I,
617
+ debitCardAlias: x,
603
618
  copyOverrides: w,
604
- stableDepositAddressKey: S,
619
+ stableDepositAddressKey: I,
605
620
  sessionId: v,
606
- sessionMetadata: x,
621
+ sessionMetadata: S,
607
622
  disableWithdrawToSelfSuggestion: E,
608
- theme: U,
609
- walletProvider: M,
610
- localStorageProvider: C,
611
- onOpen: k,
623
+ theme: k,
624
+ walletProvider: U,
625
+ localStorageProvider: M,
626
+ onOpen: C,
612
627
  onSuccess: P,
613
- onClose: D,
614
- autoCloseOnSuccess: T,
615
- popupsBlocked: R,
616
- baseUrl: B,
617
- debug: W
628
+ onClose: z,
629
+ autoCloseOnSuccess: j,
630
+ popupsBlocked: T,
631
+ baseUrl: R,
632
+ debug: B
618
633
  }), [
619
634
  s,
620
635
  t,
621
636
  e,
622
637
  i,
623
638
  o,
624
- r,
625
- p,
639
+ n,
640
+ c,
626
641
  d,
627
642
  a,
628
643
  f,
629
- c,
630
- n,
644
+ p,
645
+ r,
631
646
  h,
632
647
  l,
633
648
  m,
@@ -635,41 +650,41 @@ const ye = ({
635
650
  g,
636
651
  $,
637
652
  y,
638
- I,
653
+ x,
639
654
  w,
640
- S,
655
+ I,
641
656
  v,
642
- x,
657
+ S,
643
658
  E,
659
+ k,
644
660
  U,
645
661
  M,
646
662
  C,
647
- k,
648
663
  P,
649
- D,
664
+ z,
665
+ j,
650
666
  T,
651
667
  R,
652
- B,
653
- W
668
+ B
654
669
  ]);
655
670
  return {
656
671
  openGlideDeposit: A.open,
657
672
  externalUrl: A.externalUrl,
658
673
  opts: A.opts
659
674
  };
660
- }, we = ({
675
+ }, Ae = ({
661
676
  app: s,
662
677
  preferGaslessPayment: t,
663
678
  chainIds: e,
664
679
  excludeChainIds: i,
665
680
  excludeCurrencyTiers: o,
666
- excludeFundingSources: r,
667
- fundingSources: p,
681
+ excludeFundingSources: n,
682
+ fundingSources: c,
668
683
  allowedPaymentCurrencies: d,
669
684
  appMetadata: a,
670
685
  enableRefundEmails: f,
671
- payerEmail: c,
672
- hideSettlementCopy: n,
686
+ payerEmail: p,
687
+ hideSettlementCopy: r,
673
688
  showAppLogo: h,
674
689
  showOnrampFirst: l,
675
690
  debitCardAlias: m,
@@ -677,31 +692,31 @@ const ye = ({
677
692
  amount: g,
678
693
  sessionId: $,
679
694
  sessionMetadata: y,
680
- theme: I,
695
+ theme: x,
681
696
  walletProvider: w,
682
- localStorageProvider: S,
697
+ localStorageProvider: I,
683
698
  onOpen: v,
684
- onSuccess: x,
699
+ onSuccess: S,
685
700
  onClose: E,
686
- autoCloseOnSuccess: U,
687
- popupsBlocked: M,
688
- baseUrl: C,
689
- debug: k
701
+ autoCloseOnSuccess: k,
702
+ popupsBlocked: U,
703
+ baseUrl: M,
704
+ debug: C
690
705
  }) => {
691
- const P = G(() => new H({
706
+ const P = G(() => new O({
692
707
  app: s,
693
708
  preferGaslessPayment: t,
694
709
  chainIds: e,
695
710
  excludeChainIds: i,
696
711
  excludeCurrencyTiers: o,
697
- excludeFundingSources: r,
698
- fundingSources: p,
712
+ excludeFundingSources: n,
713
+ fundingSources: c,
699
714
  allowedPaymentCurrencies: d,
700
715
  appMetadata: a,
701
716
  enableRefundEmails: f,
702
- payerEmail: c,
717
+ payerEmail: p,
703
718
  mode: "pay",
704
- hideSettlementCopy: n,
719
+ hideSettlementCopy: r,
705
720
  showAppLogo: h,
706
721
  showOnrampFirst: l,
707
722
  debitCardAlias: m,
@@ -709,29 +724,29 @@ const ye = ({
709
724
  sessionId: $,
710
725
  amount: g,
711
726
  sessionMetadata: y,
712
- theme: I,
727
+ theme: x,
713
728
  walletProvider: w,
714
- localStorageProvider: S,
729
+ localStorageProvider: I,
715
730
  onOpen: v,
716
- onSuccess: x,
731
+ onSuccess: S,
717
732
  onClose: E,
718
- autoCloseOnSuccess: U,
719
- popupsBlocked: M,
720
- baseUrl: C,
721
- debug: k
733
+ autoCloseOnSuccess: k,
734
+ popupsBlocked: U,
735
+ baseUrl: M,
736
+ debug: C
722
737
  }), [
723
738
  s,
724
739
  t,
725
740
  e,
726
741
  i,
727
742
  o,
728
- r,
729
- p,
743
+ n,
744
+ c,
730
745
  d,
731
746
  a,
732
747
  f,
733
- c,
734
- n,
748
+ p,
749
+ r,
735
750
  h,
736
751
  l,
737
752
  m,
@@ -739,35 +754,35 @@ const ye = ({
739
754
  $,
740
755
  g,
741
756
  y,
742
- I,
757
+ x,
743
758
  w,
744
- S,
759
+ I,
745
760
  v,
746
- x,
761
+ S,
747
762
  E,
763
+ k,
748
764
  U,
749
765
  M,
750
- C,
751
- k
766
+ C
752
767
  ]);
753
768
  return {
754
769
  openGlidePay: P.open,
755
770
  externalUrl: P.externalUrl,
756
771
  opts: P.opts
757
772
  };
758
- }, ve = ({
773
+ }, De = ({
759
774
  app: s,
760
775
  evm: t,
761
776
  approval: e,
762
777
  preferGaslessPayment: i,
763
778
  chainIds: o,
764
- excludeChainIds: r,
765
- excludeCurrencyTiers: p,
779
+ excludeChainIds: n,
780
+ excludeCurrencyTiers: c,
766
781
  excludeFundingSources: d,
767
782
  sessionMetadata: a,
768
783
  showAppLogo: f,
769
- showOnrampFirst: c,
770
- debitCardAlias: n,
784
+ showOnrampFirst: p,
785
+ debitCardAlias: r,
771
786
  copyOverrides: h,
772
787
  theme: l,
773
788
  walletProvider: m,
@@ -775,24 +790,24 @@ const ye = ({
775
790
  onOpen: g,
776
791
  onSuccess: $,
777
792
  onClose: y,
778
- autoCloseOnSuccess: I,
793
+ autoCloseOnSuccess: x,
779
794
  popupsBlocked: w,
780
- baseUrl: S,
795
+ baseUrl: I,
781
796
  debug: v
782
797
  }) => {
783
- const x = G(() => new H({
798
+ const S = G(() => new O({
784
799
  app: s,
785
800
  evm: t,
786
801
  approval: e,
787
802
  preferGaslessPayment: i,
788
803
  chainIds: o,
789
- excludeChainIds: r,
790
- excludeCurrencyTiers: p,
804
+ excludeChainIds: n,
805
+ excludeCurrencyTiers: c,
791
806
  excludeFundingSources: d,
792
807
  sessionMetadata: a,
793
808
  showAppLogo: f,
794
- showOnrampFirst: c,
795
- debitCardAlias: n,
809
+ showOnrampFirst: p,
810
+ debitCardAlias: r,
796
811
  copyOverrides: h,
797
812
  mode: "call",
798
813
  theme: l,
@@ -801,9 +816,9 @@ const ye = ({
801
816
  onOpen: g,
802
817
  onSuccess: $,
803
818
  onClose: y,
804
- autoCloseOnSuccess: I,
819
+ autoCloseOnSuccess: x,
805
820
  popupsBlocked: w,
806
- baseUrl: S,
821
+ baseUrl: I,
807
822
  debug: v
808
823
  }), [
809
824
  s,
@@ -811,13 +826,13 @@ const ye = ({
811
826
  e,
812
827
  i,
813
828
  o,
814
- r,
815
- p,
829
+ n,
830
+ c,
816
831
  d,
817
832
  a,
818
833
  f,
819
- c,
820
- n,
834
+ p,
835
+ r,
821
836
  h,
822
837
  l,
823
838
  m,
@@ -825,29 +840,29 @@ const ye = ({
825
840
  g,
826
841
  $,
827
842
  y,
828
- I,
843
+ x,
829
844
  w,
830
- S,
845
+ I,
831
846
  v
832
847
  ]);
833
848
  return {
834
- openGlideCall: x.open,
835
- externalUrl: x.externalUrl,
836
- opts: x.opts
849
+ openGlideCall: S.open,
850
+ externalUrl: S.externalUrl,
851
+ opts: S.opts
837
852
  };
838
- }, be = ({
853
+ }, ze = ({
839
854
  app: s,
840
855
  recipient: t,
841
856
  chainId: e,
842
857
  currencyId: i,
843
858
  preferGaslessPayment: o,
844
- chainIds: r,
845
- excludeChainIds: p,
859
+ chainIds: n,
860
+ excludeChainIds: c,
846
861
  excludeCurrencyTiers: d,
847
862
  excludeFundingSources: a,
848
863
  sessionMetadata: f,
849
- showAppLogo: c,
850
- showOnrampFirst: n,
864
+ showAppLogo: p,
865
+ showOnrampFirst: r,
851
866
  debitCardAlias: h,
852
867
  copyOverrides: l,
853
868
  theme: m,
@@ -855,23 +870,23 @@ const ye = ({
855
870
  localStorageProvider: g,
856
871
  onOpen: $,
857
872
  onSuccess: y,
858
- onClose: I,
873
+ onClose: x,
859
874
  autoCloseOnSuccess: w,
860
- baseUrl: S
875
+ baseUrl: I
861
876
  }) => {
862
- const v = G(() => new H({
877
+ const v = G(() => new O({
863
878
  app: s,
864
879
  recipient: t,
865
880
  chainId: e,
866
881
  currencyId: i,
867
882
  preferGaslessPayment: o,
868
- chainIds: r,
869
- excludeChainIds: p,
883
+ chainIds: n,
884
+ excludeChainIds: c,
870
885
  excludeCurrencyTiers: d,
871
886
  excludeFundingSources: a,
872
887
  sessionMetadata: f,
873
- showAppLogo: c,
874
- showOnrampFirst: n,
888
+ showAppLogo: p,
889
+ showOnrampFirst: r,
875
890
  debitCardAlias: h,
876
891
  copyOverrides: l,
877
892
  mode: "buy",
@@ -880,22 +895,22 @@ const ye = ({
880
895
  localStorageProvider: g,
881
896
  onOpen: $,
882
897
  onSuccess: y,
883
- onClose: I,
898
+ onClose: x,
884
899
  autoCloseOnSuccess: w,
885
- baseUrl: S
900
+ baseUrl: I
886
901
  }), [
887
902
  s,
888
903
  t,
889
904
  e,
890
905
  i,
891
906
  o,
892
- r,
893
- p,
907
+ n,
908
+ c,
894
909
  d,
895
910
  a,
896
911
  f,
897
- c,
898
- n,
912
+ p,
913
+ r,
899
914
  h,
900
915
  l,
901
916
  m,
@@ -903,16 +918,16 @@ const ye = ({
903
918
  g,
904
919
  $,
905
920
  y,
906
- I,
921
+ x,
907
922
  w,
908
- S
923
+ I
909
924
  ]);
910
925
  return {
911
926
  openGlideBuy: v.open,
912
927
  externalUrl: v.externalUrl,
913
928
  opts: v.opts
914
929
  };
915
- }, $e = Object.freeze({
930
+ }, je = Object.freeze({
916
931
  getItem: (s) => new Promise((t, e) => {
917
932
  try {
918
933
  const i = localStorage.getItem(s);
@@ -945,11 +960,11 @@ const ye = ({
945
960
  })
946
961
  });
947
962
  export {
948
- H as GlideDeposit,
949
- $e as browserLocalStorageProvider,
963
+ O as GlideDeposit,
964
+ je as browserLocalStorageProvider,
950
965
  me as initializeParentBridge,
951
- be as useGlideBuy,
952
- ve as useGlideCall,
953
- ye as useGlideDeposit,
954
- we as useGlidePay
966
+ ze as useGlideBuy,
967
+ De as useGlideCall,
968
+ Ce as useGlideDeposit,
969
+ Ae as useGlidePay
955
970
  };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,2 @@
1
- export * from './GlideDeposit.ts';
2
- export * from './useGlideDeposit.ts';
3
- export * from './useGlidePay.ts';
4
- export * from './useGlideCall.ts';
5
- export * from './useGlideBuy.ts';
6
- export * from './theme.ts';
7
- export * from './browserLocalStorageProvider.ts';
8
- export * from './walletProviderBridge.ts';
1
+ export * from './pkg/index'
2
+ export {}
@@ -0,0 +1,8 @@
1
+ export * from './GlideDeposit.ts';
2
+ export * from './useGlideDeposit.ts';
3
+ export * from './useGlidePay.ts';
4
+ export * from './useGlideCall.ts';
5
+ export * from './useGlideBuy.ts';
6
+ export * from './theme.ts';
7
+ export * from './browserLocalStorageProvider.ts';
8
+ export * from './walletProviderBridge.ts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paywithglide/glide-react",
3
- "version": "0.0.44",
3
+ "version": "0.0.45",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
File without changes
File without changes
File without changes