@paywithglide/glide-react 0.0.50 → 0.0.52

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.50", 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" }, 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.52", 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.50", 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 P } 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 t } from "react";
4
+ const l = ({
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,
35
+ localStorageProvider: g,
36
+ onOpen: I,
37
37
  onSuccess: O,
38
- onClose: P,
39
- autoCloseOnSuccess: m,
40
- popupsBlocked: v,
38
+ onClose: W,
39
+ autoCloseOnSuccess: y,
40
+ popupsBlocked: m,
41
41
  baseUrl: S,
42
42
  debug: C
43
43
  }) => {
44
- const t = I(() => new g({
44
+ const v = t(() => new P({
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,
75
+ localStorageProvider: g,
76
+ onOpen: I,
77
77
  onSuccess: O,
78
- onClose: P,
79
- autoCloseOnSuccess: m,
80
- popupsBlocked: v,
78
+ onClose: W,
79
+ autoCloseOnSuccess: y,
80
+ popupsBlocked: m,
81
81
  baseUrl: S,
82
82
  debug: C
83
83
  }), [
@@ -111,19 +111,19 @@ const u = ({
111
111
  w,
112
112
  A,
113
113
  b,
114
+ g,
115
+ I,
116
+ O,
114
117
  W,
115
118
  y,
116
- O,
117
- P,
118
119
  m,
119
- v,
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: v.open,
125
+ externalUrl: v.externalUrl,
126
+ opts: v.opts
127
127
  };
128
128
  }, i = ({
129
129
  app: G,
@@ -134,30 +134,33 @@ const u = ({
134
134
  excludeFundingSources: B,
135
135
  fundingSources: H,
136
136
  allowedPaymentCurrencies: J,
137
- appMetadata: N,
138
- enableRefundEmails: Q,
139
- payerEmail: V,
140
- hideSettlementCopy: X,
141
- showAppLogo: Y,
142
- showOnrampFirst: Z,
143
- debitCardAlias: _,
144
- copyOverrides: $,
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
137
+ chainId: N,
138
+ currencyId: Q,
139
+ appMetadata: V,
140
+ enableRefundEmails: X,
141
+ payerEmail: Y,
142
+ hideSettlementCopy: Z,
143
+ showAppLogo: _,
144
+ showOnrampFirst: $,
145
+ debitCardAlias: K,
146
+ copyOverrides: k,
147
+ amount: x,
148
+ amountUSD: L,
149
+ sessionId: R,
150
+ sessionMetadata: E,
151
+ theme: M,
152
+ walletProvider: D,
153
+ solanaWalletProvider: T,
154
+ localStorageProvider: f,
155
+ onOpen: F,
156
+ onSuccess: w,
157
+ onClose: A,
158
+ autoCloseOnSuccess: b,
159
+ popupsBlocked: g,
160
+ baseUrl: I,
161
+ debug: O
159
162
  }) => {
160
- const W = I(() => new g({
163
+ const W = t(() => new P({
161
164
  app: G,
162
165
  preferGaslessPayment: U,
163
166
  chainIds: z,
@@ -166,29 +169,32 @@ const u = ({
166
169
  excludeFundingSources: B,
167
170
  fundingSources: H,
168
171
  allowedPaymentCurrencies: J,
169
- appMetadata: N,
170
- enableRefundEmails: Q,
171
- payerEmail: V,
172
+ chainId: N,
173
+ currencyId: Q,
174
+ appMetadata: V,
175
+ enableRefundEmails: X,
176
+ payerEmail: Y,
172
177
  mode: "pay",
173
- hideSettlementCopy: X,
174
- showAppLogo: Y,
175
- showOnrampFirst: Z,
176
- debitCardAlias: _,
177
- copyOverrides: $,
178
- sessionId: k,
179
- 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
178
+ hideSettlementCopy: Z,
179
+ showAppLogo: _,
180
+ showOnrampFirst: $,
181
+ debitCardAlias: K,
182
+ copyOverrides: k,
183
+ sessionId: R,
184
+ amount: x,
185
+ amountUSD: L,
186
+ sessionMetadata: E,
187
+ theme: M,
188
+ walletProvider: D,
189
+ solanaWalletProvider: T,
190
+ localStorageProvider: f,
191
+ onOpen: F,
192
+ onSuccess: w,
193
+ onClose: A,
194
+ autoCloseOnSuccess: b,
195
+ popupsBlocked: g,
196
+ baseUrl: I,
197
+ debug: O
192
198
  }), [
193
199
  G,
194
200
  U,
@@ -206,11 +212,11 @@ const u = ({
206
212
  Z,
207
213
  _,
208
214
  $,
209
- k,
210
215
  K,
216
+ k,
217
+ R,
211
218
  x,
212
219
  L,
213
- R,
214
220
  E,
215
221
  M,
216
222
  D,
@@ -219,14 +225,17 @@ const u = ({
219
225
  F,
220
226
  w,
221
227
  A,
222
- b
228
+ b,
229
+ g,
230
+ I,
231
+ O
223
232
  ]);
224
233
  return {
225
234
  openGlidePay: W.open,
226
235
  externalUrl: W.externalUrl,
227
236
  opts: W.opts
228
237
  };
229
- }, l = ({
238
+ }, u = ({
230
239
  app: G,
231
240
  evm: U,
232
241
  approval: z,
@@ -252,7 +261,7 @@ const u = ({
252
261
  baseUrl: M,
253
262
  debug: D
254
263
  }) => {
255
- const T = I(() => new g({
264
+ const T = t(() => new P({
256
265
  app: G,
257
266
  evm: U,
258
267
  approval: z,
@@ -334,7 +343,7 @@ const u = ({
334
343
  autoCloseOnSuccess: E,
335
344
  baseUrl: M
336
345
  }) => {
337
- const D = I(() => new g({
346
+ const D = t(() => new P({
338
347
  app: G,
339
348
  recipient: U,
340
349
  chainId: z,
@@ -391,11 +400,11 @@ const u = ({
391
400
  };
392
401
  };
393
402
  export {
394
- g as GlideDeposit,
403
+ P as GlideDeposit,
395
404
  c as browserLocalStorageProvider,
396
405
  d as initializeParentBridge,
397
406
  n as useGlideBuy,
398
- l as useGlideCall,
399
- u as useGlideDeposit,
407
+ u as useGlideCall,
408
+ l as useGlideDeposit,
400
409
  i as useGlidePay
401
410
  };
@@ -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[];
@@ -11,6 +17,20 @@ type UseGlidePayProps = {
11
17
  excludeFundingSources?: FundingSource[];
12
18
  fundingSources?: FundingSource[];
13
19
  allowedPaymentCurrencies?: string[];
20
+ /**
21
+ * Override the destination chain. Required when the target currency lives on
22
+ * a different chain than the app's default (e.g. an Ethereum-only token when
23
+ * the app is configured for Base). Must be a CAIP-2 chain ID (e.g.
24
+ * "eip155:1" for Ethereum mainnet). Applied before the currency lookup, so
25
+ * pairing this with `currencyId` always resolves correctly.
26
+ */
27
+ chainId?: CAIP2;
28
+ /**
29
+ * Lock the payment to a specific currency. Pass the currency ID (e.g. the
30
+ * RAILS token ID) to force the widget to only accept that currency. If the
31
+ * token lives on a different chain than the app default, also pass `chainId`.
32
+ */
33
+ currencyId?: string;
14
34
  appMetadata?: {
15
35
  name?: string;
16
36
  logoUrl?: string;
@@ -37,7 +57,7 @@ type UseGlidePayProps = {
37
57
  baseUrl?: string;
38
58
  debug?: boolean;
39
59
  };
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) => {
60
+ export declare const useGlidePay: ({ app, preferGaslessPayment, chainIds, excludeChainIds, excludeCurrencyTiers, excludeFundingSources, fundingSources, allowedPaymentCurrencies, chainId, currencyId, 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
61
  openGlidePay: () => void;
42
62
  externalUrl: string;
43
63
  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.50",
3
+ "version": "0.0.52",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"