@paywithglide/glide-react 0.0.49 → 0.0.51

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
@@ -272,7 +272,7 @@ function Ie(s) {
272
272
  );
273
273
  }
274
274
  }
275
- const Pe = "@paywithglide/glide-react", xe = "0.0.49", Ee = "module", Ce = ["dist"], ke = "dist/glide.js", Me = "dist/index.d.ts", Ae = { ".": { types: "./dist/index.d.ts", default: "./dist/glide.js" }, "./core": { types: "./dist/core.d.ts", default: "./dist/core.js" }, "./package.json": "./package.json" }, Ue = !1, Te = { dev: "vite", build: "bun run lint && vite build", "build-web": "tsc --p ./tsconfig.build.json && vite build --mode web", "build-chromeext": "tsc --p ./tsconfig.build.json && vite build --mode chromeext:popup && vite build --mode chromeext:content && vite build --mode chromeext:background", lint: "prettier --check . && eslint . --max-warnings 0 && tsc --p ./tsconfig.build.json", preview: "vite preview", prepublishOnly: "bun run build" }, We = { "@paywithglide/glide-js": "0.13.32" }, je = { "@antiwork/shortest": "^0.2.1", "@eslint/js": "^9.15.0", "@privy-io/react-auth": "^3.10.1", "@solana-program/memo": "^0.10.0", "@solana-program/system": "^0.10.0", "@solana-program/token": "^0.9.0", "@solana/kit": "^5.1.0", "@tanstack/react-query": "^5.61.5", "@types/chrome": "^0.0.299", "@types/react": "^18.3.12", "@types/react-dom": "^18.3.1", "@vitejs/plugin-react": "^4.3.4", eslint: "^9.15.0", "eslint-plugin-react-hooks": "^5.0.0", "eslint-plugin-react-refresh": "^0.4.14", globals: "^15.12.0", prettier: "^3.6.2", react: "^18.3.1", "react-dom": "^18.3.1", typescript: "~5.6.2", "typescript-eslint": "^8.15.0", viem: "^2.21.51", vite: "^6.0.1", "vite-plugin-dts": "^4.3.0", "vite-plugin-static-copy": "^2.2.0", wagmi: "^2.13.0" }, ze = {
275
+ const Pe = "@paywithglide/glide-react", xe = "0.0.51", Ee = "module", Ce = ["dist"], ke = "dist/glide.js", Me = "dist/glide.d.ts", Ae = { ".": { types: "./dist/glide.d.ts", default: "./dist/glide.js" }, "./core": { types: "./dist/core.d.ts", default: "./dist/core.js" }, "./package.json": "./package.json" }, Ue = !1, Te = { dev: "vite", build: "bun run lint && vite build", "build-web": "tsc --p ./tsconfig.build.json && vite build --mode web", "build-chromeext": "tsc --p ./tsconfig.build.json && vite build --mode chromeext:popup && vite build --mode chromeext:content && vite build --mode chromeext:background", lint: "prettier --check . && eslint . --max-warnings 0 && tsc --p ./tsconfig.build.json", preview: "vite preview", prepublishOnly: "bun run build" }, We = { "@paywithglide/glide-js": "0.13.32" }, De = { "@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
276
  name: Pe,
277
277
  version: xe,
278
278
  type: Ee,
@@ -283,8 +283,8 @@ const Pe = "@paywithglide/glide-react", xe = "0.0.49", Ee = "module", Ce = ["dis
283
283
  sideEffects: Ue,
284
284
  scripts: Te,
285
285
  dependencies: We,
286
- devDependencies: je
287
- }, De = ze.version, Y = 999999;
286
+ devDependencies: De
287
+ }, ze = je.version, Y = 999999;
288
288
  class Re {
289
289
  constructor(t) {
290
290
  I(this, "opts");
@@ -300,7 +300,7 @@ class Re {
300
300
  }
301
301
  });
302
302
  I(this, "iframeEventHandler", async (t) => {
303
- var i, o, n, p, l, d, f, c, r, u, h, g, m, y, x, b, E, $, C, S, k, M, A, U, T, W, j, z, D, O, R, L, B, F, G, H, q, K, N, _, V, J, X;
303
+ var i, o, n, p, l, d, f, c, r, u, h, g, m, y, x, b, E, $, C, S, k, M, A, U, T, W, D, j, z, O, R, L, B, F, G, H, q, K, N, _, V, J, X;
304
304
  const e = t.data;
305
305
  switch (e.type) {
306
306
  case "sendInit": {
@@ -329,6 +329,7 @@ class Re {
329
329
  payerEmail: this.opts.payerEmail,
330
330
  mode: this.opts.mode,
331
331
  amount: this.opts.amount,
332
+ amountUSD: this.opts.amountUSD,
332
333
  chainId: this.opts.chainId,
333
334
  currencyId: this.opts.currencyId,
334
335
  evmTx: this.opts.evm,
@@ -351,7 +352,7 @@ class Re {
351
352
  debug: this.opts.debug,
352
353
  popupsBlocked: this.opts.popupsBlocked,
353
354
  gasRefuelAmountPerChain: this.opts.gasRefuelAmountPerChain,
354
- sdkVersion: De,
355
+ sdkVersion: ze,
355
356
  referrerDomain: typeof window < "u" ? window.location.origin : void 0,
356
357
  hasAnalyticsCallback: !!this.opts.onAnalyticsEvent
357
358
  },
@@ -448,7 +449,7 @@ class Re {
448
449
  const a = await this.opts.walletProvider.sendTransactionAsync(
449
450
  e.tx
450
451
  );
451
- (j = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || j.postMessage(
452
+ (D = (W = this.iframe) == null ? void 0 : W.contentWindow) == null || D.postMessage(
452
453
  {
453
454
  type: "didSendTransaction",
454
455
  success: !0,
@@ -457,7 +458,7 @@ class Re {
457
458
  this.baseUrl
458
459
  );
459
460
  } catch (a) {
460
- (D = (z = this.iframe) == null ? void 0 : z.contentWindow) == null || D.postMessage(
461
+ (z = (j = this.iframe) == null ? void 0 : j.contentWindow) == null || z.postMessage(
461
462
  {
462
463
  type: "didSendTransaction",
463
464
  success: !1,
@@ -569,7 +570,7 @@ class Re {
569
570
  }
570
571
  get externalUrl() {
571
572
  var t, e, i, o, n, p, l, d, f, c;
572
- return `${this.baseUrl}${this.opts.app}?${this.opts.recipient ? `&recipient=${this.opts.recipient}` : ""}${this.opts.preferGaslessPayment ? "&preferGaslessPayment=true" : ""}${this.opts.mode ? `&mode=${this.opts.mode}` : ""}${this.opts.amount ? `&amount=${this.opts.amount}` : ""}${this.opts.chainId ? `&chainId=${this.opts.chainId}` : ""}${this.opts.currencyId ? `&currencyId=${this.opts.currencyId}` : ""}${this.opts.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${ye(
573
+ 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.amountUSD ? `&amountUSD=${this.opts.amountUSD}` : ""}${this.opts.chainId ? `&chainId=${this.opts.chainId}` : ""}${this.opts.currencyId ? `&currencyId=${this.opts.currencyId}` : ""}${this.opts.evm ? `&evm.chainId=${this.opts.evm.chainId}&evm.to=${this.opts.evm.to}&evm.data=${this.opts.evm.data || "0x0"}&evm.value=${ye(
573
574
  this.opts.evm.value || 0n
574
575
  )}` : ""}${this.opts.approval ? `&approval.token=${this.opts.approval.token}&approval.amount=${this.opts.approval.amount}` : ""}${this.opts.sessionMetadata ? `&metadata=${this.opts.sessionMetadata}` : ""}${this.opts.autoCloseOnSuccess ? "&autoCloseOnSuccess=true" : ""}${this.opts.sessionId ? `&sessionId=${this.opts.sessionId}` : ""}${(t = this.opts.chainIds) != null && t.length ? `&chainIds=${this.opts.chainIds.join(",")}` : ""}${(e = this.opts.excludeChainIds) != null && e.length ? `&excludeChainIds=${this.opts.excludeChainIds.join(",")}` : ""}${(i = this.opts.excludeCurrencyTiers) != null && i.length ? `&excludeCurrencyTiers=${this.opts.excludeCurrencyTiers.join(",")}` : ""}${(o = this.opts.excludeFundingSources) != null && o.length ? `&excludeFundingSources=${this.opts.excludeFundingSources.join(",")}` : ""}${(n = this.opts.fundingSources) != null && n.length ? `&fundingSources=${this.opts.fundingSources.join(",")}` : ""}${(p = this.opts.allowedPaymentCurrencies) != null && p.length ? `&allowedPaymentCurrencies=${this.opts.allowedPaymentCurrencies.join(",")}` : ""}${(l = this.opts.excludePaymentCurrencies) != null && l.length ? `&excludePaymentCurrencies=${this.opts.excludePaymentCurrencies.join(",")}` : ""}${(d = this.opts.appMetadata) != null && d.name ? `&appMetadata.name=${encodeURIComponent(this.opts.appMetadata.name)}` : ""}${(f = this.opts.appMetadata) != null && f.logoUrl ? `&appMetadata.logoUrl=${encodeURIComponent(this.opts.appMetadata.logoUrl)}` : ""}${(c = this.opts.appMetadata) != null && c.faviconUrl ? `&appMetadata.faviconUrl=${encodeURIComponent(this.opts.appMetadata.faviconUrl)}` : ""}${this.opts.enableRefundEmails ? "&enableRefundEmails=true" : ""}${this.opts.payerEmail ? `&payerEmail=${encodeURIComponent(this.opts.payerEmail)}` : ""}${this.opts.debug ? "&debug=true" : ""}${this.opts.popupsBlocked ? "&popupsBlocked=true" : ""}${this.opts.disableWithdrawToSelfSuggestion ? "&disableWithdrawToSelfSuggestion=true" : ""}${this.opts.hideSettlementCopy ? "&hideSettlementCopy=true" : ""}${this.opts.showAppLogo ? `&showAppLogo=${this.opts.showAppLogo}` : ""}${this.opts.showOnrampFirst ? "&showOnrampFirst=true" : ""}${this.opts.debitCardAlias ? `&debitCardAlias=${this.opts.debitCardAlias}` : ""}${this.opts.copyOverrides ? `&copyOverrides=${encodeURIComponent(JSON.stringify(this.opts.copyOverrides))}` : ""}${this.opts.stableDepositAddressKey ? `&stableDepositAddressKey=${encodeURIComponent(this.opts.stableDepositAddressKey)}` : ""}${this.opts.gasRefuelAmountPerChain ? `&gasRefuelAmountPerChain=${encodeURIComponent(JSON.stringify(this.opts.gasRefuelAmountPerChain))}` : ""}`;
575
576
  }
package/dist/glide.js CHANGED
@@ -1,7 +1,7 @@
1
- import { GlideDeposit as g } from "./core.js";
1
+ import { GlideDeposit as I } from "./core.js";
2
2
  import { browserLocalStorageProvider as c, initializeParentBridge as d } from "./core.js";
3
- import { useMemo as I } from "react";
4
- const u = ({
3
+ import { useMemo as y } from "react";
4
+ const i = ({
5
5
  app: G,
6
6
  recipient: U,
7
7
  chainId: z,
@@ -32,16 +32,16 @@ const u = ({
32
32
  theme: w,
33
33
  walletProvider: A,
34
34
  solanaWalletProvider: b,
35
- localStorageProvider: W,
36
- onOpen: y,
37
- onSuccess: O,
38
- onClose: P,
39
- autoCloseOnSuccess: m,
40
- popupsBlocked: v,
35
+ localStorageProvider: g,
36
+ onOpen: W,
37
+ onSuccess: P,
38
+ onClose: t,
39
+ autoCloseOnSuccess: v,
40
+ popupsBlocked: m,
41
41
  baseUrl: S,
42
42
  debug: C
43
43
  }) => {
44
- const t = I(() => new g({
44
+ const O = y(() => new I({
45
45
  app: G,
46
46
  recipient: U,
47
47
  chainId: z,
@@ -72,12 +72,12 @@ const u = ({
72
72
  theme: w,
73
73
  walletProvider: A,
74
74
  solanaWalletProvider: b,
75
- localStorageProvider: W,
76
- onOpen: y,
77
- onSuccess: O,
78
- onClose: P,
79
- autoCloseOnSuccess: m,
80
- popupsBlocked: v,
75
+ localStorageProvider: g,
76
+ onOpen: W,
77
+ onSuccess: P,
78
+ onClose: t,
79
+ autoCloseOnSuccess: v,
80
+ popupsBlocked: m,
81
81
  baseUrl: S,
82
82
  debug: C
83
83
  }), [
@@ -111,21 +111,21 @@ const u = ({
111
111
  w,
112
112
  A,
113
113
  b,
114
+ g,
114
115
  W,
115
- y,
116
- O,
117
116
  P,
118
- m,
117
+ t,
119
118
  v,
119
+ m,
120
120
  S,
121
121
  C
122
122
  ]);
123
123
  return {
124
- openGlideDeposit: t.open,
125
- externalUrl: t.externalUrl,
126
- opts: t.opts
124
+ openGlideDeposit: O.open,
125
+ externalUrl: O.externalUrl,
126
+ opts: O.opts
127
127
  };
128
- }, i = ({
128
+ }, l = ({
129
129
  app: G,
130
130
  preferGaslessPayment: U,
131
131
  chainIds: z,
@@ -143,21 +143,22 @@ const u = ({
143
143
  debitCardAlias: _,
144
144
  copyOverrides: $,
145
145
  amount: K,
146
- sessionId: k,
147
- sessionMetadata: x,
148
- theme: L,
149
- walletProvider: R,
150
- solanaWalletProvider: E,
151
- localStorageProvider: M,
152
- onOpen: D,
153
- onSuccess: T,
154
- onClose: f,
155
- autoCloseOnSuccess: F,
156
- popupsBlocked: w,
157
- baseUrl: A,
158
- debug: b
146
+ amountUSD: k,
147
+ sessionId: x,
148
+ sessionMetadata: L,
149
+ theme: R,
150
+ walletProvider: E,
151
+ solanaWalletProvider: M,
152
+ localStorageProvider: D,
153
+ onOpen: T,
154
+ onSuccess: f,
155
+ onClose: F,
156
+ autoCloseOnSuccess: w,
157
+ popupsBlocked: A,
158
+ baseUrl: b,
159
+ debug: g
159
160
  }) => {
160
- const W = I(() => new g({
161
+ const W = y(() => new I({
161
162
  app: G,
162
163
  preferGaslessPayment: U,
163
164
  chainIds: z,
@@ -175,20 +176,21 @@ const u = ({
175
176
  showOnrampFirst: Z,
176
177
  debitCardAlias: _,
177
178
  copyOverrides: $,
178
- sessionId: k,
179
+ sessionId: x,
179
180
  amount: K,
180
- sessionMetadata: x,
181
- theme: L,
182
- walletProvider: R,
183
- solanaWalletProvider: E,
184
- localStorageProvider: M,
185
- onOpen: D,
186
- onSuccess: T,
187
- onClose: f,
188
- autoCloseOnSuccess: F,
189
- popupsBlocked: w,
190
- baseUrl: A,
191
- debug: b
181
+ amountUSD: k,
182
+ sessionMetadata: L,
183
+ theme: R,
184
+ walletProvider: E,
185
+ solanaWalletProvider: M,
186
+ localStorageProvider: D,
187
+ onOpen: T,
188
+ onSuccess: f,
189
+ onClose: F,
190
+ autoCloseOnSuccess: w,
191
+ popupsBlocked: A,
192
+ baseUrl: b,
193
+ debug: g
192
194
  }), [
193
195
  G,
194
196
  U,
@@ -206,9 +208,9 @@ const u = ({
206
208
  Z,
207
209
  _,
208
210
  $,
209
- k,
210
- K,
211
211
  x,
212
+ K,
213
+ k,
212
214
  L,
213
215
  R,
214
216
  E,
@@ -219,14 +221,15 @@ const u = ({
219
221
  F,
220
222
  w,
221
223
  A,
222
- b
224
+ b,
225
+ g
223
226
  ]);
224
227
  return {
225
228
  openGlidePay: W.open,
226
229
  externalUrl: W.externalUrl,
227
230
  opts: W.opts
228
231
  };
229
- }, l = ({
232
+ }, u = ({
230
233
  app: G,
231
234
  evm: U,
232
235
  approval: z,
@@ -252,7 +255,7 @@ const u = ({
252
255
  baseUrl: M,
253
256
  debug: D
254
257
  }) => {
255
- const T = I(() => new g({
258
+ const T = y(() => new I({
256
259
  app: G,
257
260
  evm: U,
258
261
  approval: z,
@@ -334,7 +337,7 @@ const u = ({
334
337
  autoCloseOnSuccess: E,
335
338
  baseUrl: M
336
339
  }) => {
337
- const D = I(() => new g({
340
+ const D = y(() => new I({
338
341
  app: G,
339
342
  recipient: U,
340
343
  chainId: z,
@@ -391,11 +394,11 @@ const u = ({
391
394
  };
392
395
  };
393
396
  export {
394
- g as GlideDeposit,
397
+ I as GlideDeposit,
395
398
  c as browserLocalStorageProvider,
396
399
  d as initializeParentBridge,
397
400
  n as useGlideBuy,
398
- l as useGlideCall,
399
- u as useGlideDeposit,
400
- i as useGlidePay
401
+ u as useGlideCall,
402
+ i as useGlideDeposit,
403
+ l as useGlidePay
401
404
  };
@@ -101,6 +101,13 @@ export type GlideDepositOptions = {
101
101
  recipient?: string;
102
102
  mode?: "deposit" | "withdraw" | "pay" | "call" | "buy";
103
103
  amount?: string;
104
+ /**
105
+ * Payment amount in USD. Use this instead of `amount` when you want to
106
+ * accept a fixed USD value paid in a specific token (e.g. $20 paid in RAILS).
107
+ * The token equivalent is computed server-side and cannot be manipulated by the user.
108
+ * Only valid for `mode: "pay"`.
109
+ */
110
+ amountUSD?: string;
104
111
  sessionId?: string;
105
112
  chainId?: CAIP2;
106
113
  currencyId?: string;
@@ -4,6 +4,12 @@ import { CAIP2, Hex, Session } from '@paywithglide/glide-js';
4
4
  type UseGlidePayProps = {
5
5
  app: string;
6
6
  amount?: string;
7
+ /**
8
+ * Payment amount in USD. Use this instead of `amount` to accept a fixed USD
9
+ * value paid in a specific token (e.g. $20 paid in RAILS). The token
10
+ * equivalent is computed server-side and cannot be manipulated by the user.
11
+ */
12
+ amountUSD?: string;
7
13
  preferGaslessPayment?: boolean;
8
14
  chainIds?: CAIP2[];
9
15
  excludeChainIds?: CAIP2[];
@@ -37,7 +43,7 @@ type UseGlidePayProps = {
37
43
  baseUrl?: string;
38
44
  debug?: boolean;
39
45
  };
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) => {
46
+ export declare const useGlidePay: ({ app, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, allowedPaymentCurrencies, appMetadata, enableRefundEmails, payerEmail, hideSettlementCopy, showAppLogo, showOnrampFirst, debitCardAlias, copyOverrides, amount, amountUSD, sessionId, sessionMetadata, theme, walletProvider, solanaWalletProvider, localStorageProvider, onOpen, onSuccess, onClose, autoCloseOnSuccess, popupsBlocked, baseUrl, debug, }: UseGlidePayProps) => {
41
47
  openGlidePay: () => void;
42
48
  externalUrl: string;
43
49
  opts: import('./GlideDeposit.ts').GlideDepositOptions;
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@paywithglide/glide-react",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
7
7
  ],
8
8
  "module": "dist/glide.js",
9
- "types": "dist/index.d.ts",
9
+ "types": "dist/glide.d.ts",
10
10
  "exports": {
11
11
  ".": {
12
- "types": "./dist/index.d.ts",
12
+ "types": "./dist/glide.d.ts",
13
13
  "default": "./dist/glide.js"
14
14
  },
15
15
  "./core": {