@paywithglide/glide-react 0.0.26 → 0.0.28

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.
@@ -99,7 +99,7 @@ export type GlideDepositOptions = {
99
99
  token: Hex;
100
100
  amount: bigint;
101
101
  };
102
- gasRefuelAmount?: string;
102
+ gasRefuelUSD?: string;
103
103
  sessionMetadata?: string;
104
104
  preferGaslessPayment?: boolean;
105
105
  excludeChainIds?: CAIP2[];
package/dist/glide.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var Z = Object.defineProperty;
2
2
  var _ = (s, t, e) => t in s ? Z(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var I = (s, t, e) => _(s, typeof t != "symbol" ? t + "" : t, e);
4
- import { useMemo as P } from "react";
3
+ var S = (s, t, e) => _(s, typeof t != "symbol" ? t + "" : t, e);
4
+ import { useMemo as I } from "react";
5
5
  function ee(s, { strict: t = !0 } = {}) {
6
6
  return !s || typeof s != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(s) : s.startsWith("0x");
7
7
  }
@@ -158,10 +158,10 @@ function de(s, t = {}) {
158
158
  const e = le.encode(s);
159
159
  return q(e, t);
160
160
  }
161
- class S {
161
+ class P {
162
162
  constructor(t) {
163
- I(this, "opts");
164
- I(this, "open", () => {
163
+ S(this, "opts");
164
+ S(this, "open", () => {
165
165
  if (!(!this.opts.container && document.body.classList.contains("glide-deposit-open"))) {
166
166
  if (this.opts.container || document.body.classList.add("glide-deposit-open"), (this.opts.mode === "deposit" || this.opts.mode === "buy") && !this.opts.recipient)
167
167
  throw new Error("recipient is required for deposit/buy mode");
@@ -172,8 +172,8 @@ class S {
172
172
  this.openUrl(`${this.baseUrl}${this.opts.app}?init=true&embed=true`), this.initialize();
173
173
  }
174
174
  });
175
- I(this, "iframeEventHandler", async (t) => {
176
- var i, r, o, c, a, n, p, h, u, m, f, g, l, b, y, w, v, k, U, z, A, M, T, D, G, j, B, C, W, H, L, O;
175
+ S(this, "iframeEventHandler", async (t) => {
176
+ var i, r, o, c, a, n, p, h, u, m, f, g, l, b, y, w, v, k, U, z, D, M, T, A, G, j, B, C, W, H, L, O;
177
177
  const e = t.data;
178
178
  switch (e.type) {
179
179
  case "sendInit": {
@@ -200,7 +200,7 @@ class S {
200
200
  didProvideLocalStorage: !!this.opts.localStorageProvider,
201
201
  debug: this.opts.debug,
202
202
  popupsBlocked: this.opts.popupsBlocked,
203
- gasRefuelAmount: this.opts.gasRefuelAmount
203
+ gasRefuelUSD: this.opts.gasRefuelUSD
204
204
  },
205
205
  new URL(this.baseUrl).origin
206
206
  ), this.iframe.style.opacity = "1", (h = (p = this.opts).onOpen) == null || h.call(p);
@@ -270,7 +270,7 @@ class S {
270
270
  this.baseUrl
271
271
  );
272
272
  } catch (d) {
273
- (M = (A = this.iframe) == null ? void 0 : A.contentWindow) == null || M.postMessage(
273
+ (M = (D = this.iframe) == null ? void 0 : D.contentWindow) == null || M.postMessage(
274
274
  {
275
275
  type: "didSwitchChain",
276
276
  success: !1,
@@ -288,7 +288,7 @@ class S {
288
288
  const d = await this.opts.walletProvider.sendTransactionAsync(
289
289
  e.tx
290
290
  );
291
- (D = (T = this.iframe) == null ? void 0 : T.contentWindow) == null || D.postMessage(
291
+ (A = (T = this.iframe) == null ? void 0 : T.contentWindow) == null || A.postMessage(
292
292
  {
293
293
  type: "didSendTransaction",
294
294
  success: !0,
@@ -355,7 +355,7 @@ class S {
355
355
  var t, e, i;
356
356
  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.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${ne(
357
357
  this.opts.evm.value || 0n
358
- )}` : ""}${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.excludeChainIds) != null && t.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(e = this.opts.excludeCurrencyTiers) != null && e.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(i = this.opts.excludeFundingSources) != null && i.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${this.opts.debug ? "debug=true" : ""}${this.opts.popupsBlocked ? "popupsBlocked=true" : ""}${this.opts.gasRefuelAmount ? `&gasRefuelAmount=${this.opts.gasRefuelAmount}` : ""}`;
358
+ )}` : ""}${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.excludeChainIds) != null && t.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(e = this.opts.excludeCurrencyTiers) != null && e.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(i = this.opts.excludeFundingSources) != null && i.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${this.opts.debug ? "debug=true" : ""}${this.opts.popupsBlocked ? "popupsBlocked=true" : ""}${this.opts.gasRefuelUSD ? `&gasRefuelUSD=${this.opts.gasRefuelUSD}` : ""}`;
359
359
  }
360
360
  initialize() {
361
361
  window.addEventListener("message", this.iframeEventHandler);
@@ -393,7 +393,7 @@ class S {
393
393
  const ue = ({
394
394
  app: s,
395
395
  recipient: t,
396
- gasRefuelAmount: e,
396
+ gasRefuelUSD: e,
397
397
  preferGaslessPayment: i,
398
398
  excludeChainIds: r,
399
399
  excludeCurrencyTiers: o,
@@ -411,10 +411,10 @@ const ue = ({
411
411
  baseUrl: y,
412
412
  debug: w
413
413
  }) => {
414
- const v = P(() => new S({
414
+ const v = I(() => new P({
415
415
  app: s,
416
416
  recipient: t,
417
- gasRefuelAmount: e,
417
+ gasRefuelUSD: e,
418
418
  preferGaslessPayment: i,
419
419
  excludeChainIds: r,
420
420
  excludeCurrencyTiers: o,
@@ -477,7 +477,7 @@ const ue = ({
477
477
  baseUrl: b,
478
478
  debug: y
479
479
  }) => {
480
- const w = P(() => new S({
480
+ const w = I(() => new P({
481
481
  app: s,
482
482
  preferGaslessPayment: t,
483
483
  excludeChainIds: e,
@@ -542,7 +542,7 @@ const ue = ({
542
542
  baseUrl: b,
543
543
  debug: y
544
544
  }) => {
545
- const w = P(() => new S({
545
+ const w = I(() => new P({
546
546
  app: s,
547
547
  evm: t,
548
548
  approval: e,
@@ -604,7 +604,7 @@ const ue = ({
604
604
  autoCloseOnSuccess: f,
605
605
  baseUrl: g
606
606
  }) => {
607
- const l = P(() => new S({
607
+ const l = I(() => new P({
608
608
  app: s,
609
609
  recipient: t,
610
610
  preferGaslessPayment: e,
@@ -676,7 +676,7 @@ const ue = ({
676
676
  })
677
677
  });
678
678
  export {
679
- S as GlideDeposit,
679
+ P as GlideDeposit,
680
680
  ye as browserLocalStorageProvider,
681
681
  ge as useGlideBuy,
682
682
  fe as useGlideCall,
@@ -4,7 +4,7 @@ import { CAIP2 } from '@paywithglide/glide-js';
4
4
  interface UseGlideDepositProps {
5
5
  app: string;
6
6
  recipient?: string;
7
- gasRefuelAmount?: string;
7
+ gasRefuelUSD?: string;
8
8
  preferGaslessPayment?: boolean;
9
9
  excludeChainIds?: CAIP2[];
10
10
  excludeCurrencyTiers?: ("tier1" | "tier2" | "tier3")[];
@@ -22,7 +22,7 @@ interface UseGlideDepositProps {
22
22
  baseUrl?: string;
23
23
  debug?: boolean;
24
24
  }
25
- export declare const useGlideDeposit: ({ app, recipient, gasRefuelAmount, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
25
+ export declare const useGlideDeposit: ({ app, recipient, gasRefuelUSD, preferGaslessPayment, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, mode, sessionMetadata, theme, walletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlideDepositProps) => {
26
26
  openGlideDeposit: () => void;
27
27
  externalUrl: string;
28
28
  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.26",
3
+ "version": "0.0.28",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"