@doujins/payments-ui 0.0.15 → 0.1.0
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/index.cjs +1008 -2320
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +248 -346
- package/dist/index.d.ts +248 -346
- package/dist/index.js +872 -2166
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -1
- package/package.json +9 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React$1 from 'react';
|
|
2
|
-
import * as _solana_wallet_adapter_base from '@solana/wallet-adapter-base';
|
|
3
2
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
4
3
|
import { QueryClient } from '@tanstack/react-query';
|
|
4
|
+
import * as _solana_wallet_adapter_base from '@solana/wallet-adapter-base';
|
|
5
5
|
import { PublicKey } from '@solana/web3.js';
|
|
6
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
7
6
|
|
|
8
7
|
type AuthTokenProvider = (() => string | null | undefined) | (() => Promise<string | null | undefined>) | null | undefined;
|
|
9
8
|
interface PaymentUserDetails {
|
|
@@ -21,6 +20,8 @@ interface PaymentUserDetails {
|
|
|
21
20
|
interface PaymentEndpoints {
|
|
22
21
|
billingBaseUrl: string;
|
|
23
22
|
accountBaseUrl?: string;
|
|
23
|
+
billingBasePath?: string;
|
|
24
|
+
accountBasePath?: string;
|
|
24
25
|
}
|
|
25
26
|
interface PaymentFeatureFlags {
|
|
26
27
|
enableCardPayments?: boolean;
|
|
@@ -84,8 +85,12 @@ interface BillingDetails {
|
|
|
84
85
|
}
|
|
85
86
|
interface PaymentMethod {
|
|
86
87
|
id: string;
|
|
88
|
+
processor?: string;
|
|
89
|
+
brand?: string;
|
|
87
90
|
card_type?: string;
|
|
88
91
|
last_four?: string;
|
|
92
|
+
exp_month?: number;
|
|
93
|
+
exp_year?: number;
|
|
89
94
|
is_active?: boolean;
|
|
90
95
|
failure_reason?: string | null;
|
|
91
96
|
created_at?: string;
|
|
@@ -107,6 +112,8 @@ interface PaginatedPaymentMethods {
|
|
|
107
112
|
data: PaymentMethod[];
|
|
108
113
|
total?: number;
|
|
109
114
|
next_page?: number | null;
|
|
115
|
+
limit?: number;
|
|
116
|
+
offset?: number;
|
|
110
117
|
}
|
|
111
118
|
interface Payment {
|
|
112
119
|
id: string;
|
|
@@ -144,6 +151,63 @@ interface BillingStatus {
|
|
|
144
151
|
access: BillingAccessGrant[];
|
|
145
152
|
}
|
|
146
153
|
|
|
154
|
+
type PaymentPlatform = 'nmi' | 'ccbill';
|
|
155
|
+
type CheckoutStatus = 'success' | 'pending' | 'redirect_required' | 'blocked';
|
|
156
|
+
interface CheckoutResponse {
|
|
157
|
+
status: CheckoutStatus;
|
|
158
|
+
message?: string;
|
|
159
|
+
subscription_id?: string;
|
|
160
|
+
payment_id?: string;
|
|
161
|
+
transaction_id?: string;
|
|
162
|
+
redirect_url?: string;
|
|
163
|
+
delayed_start?: string;
|
|
164
|
+
}
|
|
165
|
+
interface CheckoutRequestPayload {
|
|
166
|
+
price_id: string;
|
|
167
|
+
processor: string;
|
|
168
|
+
payment_token?: string;
|
|
169
|
+
payment_method_id?: string;
|
|
170
|
+
provider?: string;
|
|
171
|
+
email?: string;
|
|
172
|
+
first_name?: string;
|
|
173
|
+
last_name?: string;
|
|
174
|
+
address1?: string;
|
|
175
|
+
city?: string;
|
|
176
|
+
state?: string;
|
|
177
|
+
zip?: string;
|
|
178
|
+
country?: string;
|
|
179
|
+
}
|
|
180
|
+
interface NmiSubscribePayload {
|
|
181
|
+
priceId: string;
|
|
182
|
+
paymentToken?: string;
|
|
183
|
+
paymentMethodId?: string;
|
|
184
|
+
firstName?: string;
|
|
185
|
+
lastName?: string;
|
|
186
|
+
address1?: string;
|
|
187
|
+
city?: string;
|
|
188
|
+
state?: string;
|
|
189
|
+
zipCode?: string;
|
|
190
|
+
country?: string;
|
|
191
|
+
email?: string;
|
|
192
|
+
provider?: string;
|
|
193
|
+
processor?: string;
|
|
194
|
+
}
|
|
195
|
+
interface CCBillSubscribePayload {
|
|
196
|
+
priceId: string;
|
|
197
|
+
email: string;
|
|
198
|
+
firstName: string;
|
|
199
|
+
lastName: string;
|
|
200
|
+
zipCode: string;
|
|
201
|
+
country: string;
|
|
202
|
+
processor?: string;
|
|
203
|
+
}
|
|
204
|
+
interface SubscriptionCheckoutPayload {
|
|
205
|
+
priceId: string;
|
|
206
|
+
provider?: string;
|
|
207
|
+
processor?: string;
|
|
208
|
+
billing: BillingDetails;
|
|
209
|
+
}
|
|
210
|
+
|
|
147
211
|
interface GeneratePaymentRequest {
|
|
148
212
|
price_id: string;
|
|
149
213
|
token: string;
|
|
@@ -272,61 +336,99 @@ interface PaymentMethodOption {
|
|
|
272
336
|
requiresWallet: boolean;
|
|
273
337
|
}
|
|
274
338
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
339
|
+
/**
|
|
340
|
+
* Minimal Billing API client used by the payments UI.
|
|
341
|
+
*
|
|
342
|
+
* Usage:
|
|
343
|
+
* ```ts
|
|
344
|
+
* const client = createClient({
|
|
345
|
+
* billingBaseUrl: 'https://billing.example.com',
|
|
346
|
+
* getAuthToken: () => authStore.token,
|
|
347
|
+
* })
|
|
348
|
+
*
|
|
349
|
+
* const methods = await client.listPaymentMethods({ limit: 10 })
|
|
350
|
+
* const checkout = await client.checkout({ price_id: 'price_123', processor: 'mobius' })
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
|
|
354
|
+
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
355
|
+
interface ClientConfig {
|
|
356
|
+
billingBaseUrl: string;
|
|
357
|
+
billingBasePath?: string;
|
|
358
|
+
accountBaseUrl?: string;
|
|
359
|
+
accountBasePath?: string;
|
|
360
|
+
getAuthToken?: () => string | null | Promise<string | null>;
|
|
361
|
+
defaultHeaders?: Record<string, string>;
|
|
362
|
+
fetch?: typeof fetch;
|
|
299
363
|
}
|
|
300
|
-
interface
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
364
|
+
interface RequestOptions {
|
|
365
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
366
|
+
body?: unknown;
|
|
367
|
+
headers?: Record<string, string>;
|
|
368
|
+
target?: 'billing' | 'account';
|
|
369
|
+
}
|
|
370
|
+
interface PaginatedResponse<T> {
|
|
371
|
+
data: T[];
|
|
372
|
+
total: number;
|
|
373
|
+
limit: number;
|
|
374
|
+
offset: number;
|
|
375
|
+
hasMore: boolean;
|
|
376
|
+
}
|
|
377
|
+
declare class ClientApiError extends Error {
|
|
378
|
+
status: number;
|
|
379
|
+
body: unknown;
|
|
380
|
+
request: {
|
|
381
|
+
method: HttpMethod;
|
|
382
|
+
url: string;
|
|
383
|
+
};
|
|
384
|
+
constructor(message: string, status: number, body: unknown, request: {
|
|
385
|
+
method: HttpMethod;
|
|
386
|
+
url: string;
|
|
387
|
+
});
|
|
314
388
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
389
|
+
declare const createClient: (config: ClientConfig) => {
|
|
390
|
+
listPaymentMethods(params?: {
|
|
391
|
+
limit?: number;
|
|
392
|
+
offset?: number;
|
|
393
|
+
includeInactive?: boolean;
|
|
394
|
+
}): Promise<PaginatedResponse<PaymentMethod>>;
|
|
395
|
+
createPaymentMethod(payload: CreatePaymentMethodPayload): Promise<PaymentMethod>;
|
|
396
|
+
updatePaymentMethod(id: string, payload: CreatePaymentMethodPayload): Promise<PaymentMethod>;
|
|
397
|
+
deletePaymentMethod(id: string): Promise<void>;
|
|
398
|
+
activatePaymentMethod(id: string): Promise<void>;
|
|
399
|
+
checkout(payload: CheckoutRequestPayload): Promise<CheckoutResponse>;
|
|
400
|
+
cancelSubscription(feedback?: string): Promise<{
|
|
401
|
+
message: string;
|
|
402
|
+
success: boolean;
|
|
403
|
+
}>;
|
|
404
|
+
getPaymentHistory(params?: {
|
|
405
|
+
limit?: number;
|
|
406
|
+
offset?: number;
|
|
407
|
+
type?: string;
|
|
408
|
+
}): Promise<PaginatedResponse<Payment>>;
|
|
409
|
+
getSolanaTokens(): Promise<TokenInfo[]>;
|
|
410
|
+
createSolanaPayIntent(payload: {
|
|
411
|
+
priceId: string;
|
|
412
|
+
token: string;
|
|
413
|
+
userWallet?: string;
|
|
414
|
+
}): Promise<SolanaPayQRCodeIntent>;
|
|
415
|
+
getSolanaPayStatus(reference: string): Promise<SolanaPayStatusResponse>;
|
|
416
|
+
getPaymentStatus(id: string): Promise<PaymentStatusResponse | null>;
|
|
417
|
+
};
|
|
418
|
+
type Client = ReturnType<typeof createClient>;
|
|
419
|
+
|
|
420
|
+
interface PaymentContextValue {
|
|
421
|
+
config: PaymentConfig;
|
|
422
|
+
client: Client;
|
|
423
|
+
queryClient: QueryClient;
|
|
323
424
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
billing: BillingDetails;
|
|
425
|
+
declare const PaymentContext: React$1.Context<PaymentContextValue | undefined>;
|
|
426
|
+
interface PaymentProviderProps {
|
|
427
|
+
config: PaymentConfig;
|
|
428
|
+
children: React$1.ReactNode;
|
|
329
429
|
}
|
|
430
|
+
declare const PaymentProvider: React$1.FC<PaymentProviderProps>;
|
|
431
|
+
declare const usePaymentContext: () => PaymentContextValue;
|
|
330
432
|
|
|
331
433
|
interface SolanaWallet {
|
|
332
434
|
id: string;
|
|
@@ -362,168 +464,6 @@ interface WalletConnectionState {
|
|
|
362
464
|
error: string | null;
|
|
363
465
|
}
|
|
364
466
|
|
|
365
|
-
type RequestOptions = {
|
|
366
|
-
params?: Record<string, string | number>;
|
|
367
|
-
query?: Record<string, string | number | undefined>;
|
|
368
|
-
body?: Record<string, unknown>;
|
|
369
|
-
headers?: Record<string, string>;
|
|
370
|
-
};
|
|
371
|
-
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
372
|
-
interface ApiClient {
|
|
373
|
-
request: <T>(method: HttpMethod, path: string, options?: RequestOptions) => Promise<T>;
|
|
374
|
-
get: <T>(path: string, options?: Omit<RequestOptions, 'body'>) => Promise<T>;
|
|
375
|
-
post: <T>(path: string, options?: RequestOptions) => Promise<T>;
|
|
376
|
-
put: <T>(path: string, options?: RequestOptions) => Promise<T>;
|
|
377
|
-
patch: <T>(path: string, options?: RequestOptions) => Promise<T>;
|
|
378
|
-
delete: <T>(path: string, options?: RequestOptions) => Promise<T>;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
interface CardTokenizeResult {
|
|
382
|
-
token: string;
|
|
383
|
-
billing: BillingDetails;
|
|
384
|
-
}
|
|
385
|
-
declare class CardPaymentService {
|
|
386
|
-
private config;
|
|
387
|
-
private collectLoaded;
|
|
388
|
-
constructor(config: PaymentConfig);
|
|
389
|
-
ensureCollectLoaded(): Promise<void>;
|
|
390
|
-
buildCreatePayload(result: CardTokenizeResult): CreatePaymentMethodPayload;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
interface ListParams {
|
|
394
|
-
page?: number;
|
|
395
|
-
pageSize?: number;
|
|
396
|
-
}
|
|
397
|
-
declare class PaymentMethodService {
|
|
398
|
-
private api;
|
|
399
|
-
constructor(api: ApiClient);
|
|
400
|
-
list(params?: ListParams): Promise<PaginatedPaymentMethods>;
|
|
401
|
-
create(payload: CreatePaymentMethodPayload): Promise<PaymentMethod>;
|
|
402
|
-
remove(id: string): Promise<void>;
|
|
403
|
-
activate(id: string): Promise<void>;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
declare class SolanaPaymentService {
|
|
407
|
-
private api;
|
|
408
|
-
constructor(api: ApiClient);
|
|
409
|
-
generatePayment(priceId: string, token: string, userWallet: string): Promise<GeneratePaymentResponse>;
|
|
410
|
-
submitPayment(signedTransaction: string, priceId: string, intentId: string, memo?: string): Promise<SubmitPaymentResponse>;
|
|
411
|
-
fetchSupportedTokens(): Promise<TokenInfo[]>;
|
|
412
|
-
getSupportedTokens(): Promise<TokenInfo[]>;
|
|
413
|
-
generateQrCode(priceId: string, token: string, userWallet?: string): Promise<SolanaPayQRCodeIntent>;
|
|
414
|
-
generateQRCode(priceId: string, token: string, userWallet?: string): Promise<SolanaPayQRCodeIntent>;
|
|
415
|
-
checkPaymentStatus(reference: string, memo?: string): Promise<SolanaPayStatusResponse>;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
interface TokenCatalogOptions {
|
|
419
|
-
ttlMs?: number;
|
|
420
|
-
}
|
|
421
|
-
declare class TokenCatalog {
|
|
422
|
-
private solanaService;
|
|
423
|
-
private options;
|
|
424
|
-
private cache;
|
|
425
|
-
private lastFetched;
|
|
426
|
-
constructor(solanaService: SolanaPaymentService, options?: TokenCatalogOptions);
|
|
427
|
-
private get ttl();
|
|
428
|
-
getTokens(force?: boolean): Promise<TokenInfo[]>;
|
|
429
|
-
getCached(): TokenInfo[];
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
interface WalletAccount {
|
|
433
|
-
publicKey: string;
|
|
434
|
-
}
|
|
435
|
-
interface WalletAdapterLike {
|
|
436
|
-
publicKey?: {
|
|
437
|
-
toBase58(): string;
|
|
438
|
-
};
|
|
439
|
-
signTransaction?: (tx: unknown) => Promise<unknown>;
|
|
440
|
-
signVersionedTransaction?: (tx: unknown) => Promise<unknown>;
|
|
441
|
-
}
|
|
442
|
-
declare class WalletGateway {
|
|
443
|
-
private adapter;
|
|
444
|
-
setAdapter(adapter: WalletAdapterLike | null): void;
|
|
445
|
-
getPublicKey(): string | null;
|
|
446
|
-
sign(transaction: unknown): Promise<unknown>;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
declare class SubscriptionService {
|
|
450
|
-
private readonly api;
|
|
451
|
-
constructor(api: ApiClient);
|
|
452
|
-
subscribe(platform: PaymentPlatform, payload: NmiSubscribePayload | CCBillSubscribePayload): Promise<SubscriptionResponse>;
|
|
453
|
-
generateFlexFormUrl(payload: GenerateFlexFormURLBodyParams): Promise<FlexFormResponse>;
|
|
454
|
-
getPaymentHistory(params?: {
|
|
455
|
-
limit?: number;
|
|
456
|
-
offset?: number;
|
|
457
|
-
type?: string;
|
|
458
|
-
}): Promise<PaginatedPayments>;
|
|
459
|
-
cancelSubscription(feedback?: string): Promise<{
|
|
460
|
-
message: string;
|
|
461
|
-
success: boolean;
|
|
462
|
-
}>;
|
|
463
|
-
private serializePayload;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
declare class SolanaWalletService {
|
|
467
|
-
private readonly api;
|
|
468
|
-
constructor(api: ApiClient);
|
|
469
|
-
list(): Promise<SolanaWallet[]>;
|
|
470
|
-
requestChallenge(wallet: string): Promise<WalletChallengeResponse>;
|
|
471
|
-
verify(wallet: string, signature: string, nonce?: string): Promise<VerifyWalletResponse>;
|
|
472
|
-
remove(wallet: string): Promise<void>;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
interface PaymentServices {
|
|
476
|
-
cardPayments: CardPaymentService;
|
|
477
|
-
paymentMethods: PaymentMethodService;
|
|
478
|
-
solanaPayments: SolanaPaymentService;
|
|
479
|
-
solanaWallets: SolanaWalletService;
|
|
480
|
-
tokenCatalog: TokenCatalog;
|
|
481
|
-
walletGateway: WalletGateway;
|
|
482
|
-
subscriptions: SubscriptionService;
|
|
483
|
-
billingApi: ApiClient;
|
|
484
|
-
accountApi: ApiClient;
|
|
485
|
-
}
|
|
486
|
-
interface PaymentAppOptions {
|
|
487
|
-
config: PaymentConfig;
|
|
488
|
-
fetcher?: PaymentFetcher;
|
|
489
|
-
}
|
|
490
|
-
declare class PaymentApp {
|
|
491
|
-
private readonly config;
|
|
492
|
-
private readonly fetcher;
|
|
493
|
-
private readonly services;
|
|
494
|
-
constructor(options: PaymentAppOptions);
|
|
495
|
-
getConfig(): PaymentConfig;
|
|
496
|
-
getFetcher(): PaymentFetcher;
|
|
497
|
-
getServices(): PaymentServices;
|
|
498
|
-
private createServices;
|
|
499
|
-
resolveAuthToken: () => Promise<string | null>;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
declare class PaymentsRuntime {
|
|
503
|
-
readonly config: PaymentConfig;
|
|
504
|
-
readonly app: PaymentApp;
|
|
505
|
-
readonly services: PaymentServices;
|
|
506
|
-
readonly queryClient: QueryClient;
|
|
507
|
-
constructor(config: PaymentConfig);
|
|
508
|
-
}
|
|
509
|
-
declare const createPaymentsRuntime: (config: PaymentConfig) => PaymentsRuntime;
|
|
510
|
-
|
|
511
|
-
interface PaymentContextValue {
|
|
512
|
-
config: PaymentConfig;
|
|
513
|
-
fetcher: PaymentFetcher;
|
|
514
|
-
resolveAuthToken: () => Promise<string | null>;
|
|
515
|
-
app: PaymentApp;
|
|
516
|
-
services: PaymentServices;
|
|
517
|
-
queryClient: PaymentsRuntime['queryClient'];
|
|
518
|
-
}
|
|
519
|
-
interface PaymentProviderProps {
|
|
520
|
-
config: PaymentConfig;
|
|
521
|
-
children: React$1.ReactNode;
|
|
522
|
-
runtime?: PaymentsRuntime;
|
|
523
|
-
}
|
|
524
|
-
declare const PaymentProvider: React$1.FC<PaymentProviderProps>;
|
|
525
|
-
declare const usePaymentContext: () => PaymentContextValue;
|
|
526
|
-
|
|
527
467
|
interface SubscriptionCheckoutModalProps {
|
|
528
468
|
open: boolean;
|
|
529
469
|
onOpenChange: (open: boolean) => void;
|
|
@@ -586,6 +526,33 @@ interface PaymentsDialogContextValue {
|
|
|
586
526
|
declare const PaymentsDialogProvider: React$1.FC<React$1.PropsWithChildren>;
|
|
587
527
|
declare const usePaymentDialogs: () => PaymentsDialogContextValue;
|
|
588
528
|
|
|
529
|
+
interface PaymentsUIRootProps {
|
|
530
|
+
children: React$1.ReactNode;
|
|
531
|
+
className?: string;
|
|
532
|
+
/**
|
|
533
|
+
* When true, applies the dark theme variant
|
|
534
|
+
* @default false
|
|
535
|
+
*/
|
|
536
|
+
dark?: boolean;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Root wrapper component that provides scoped CSS variables for payments-ui.
|
|
540
|
+
* Use this to wrap any payments-ui components to ensure styles don't conflict
|
|
541
|
+
* with the consuming application.
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* ```tsx
|
|
545
|
+
* <PaymentsUIRoot>
|
|
546
|
+
* <SubscriptionCheckoutModal ... />
|
|
547
|
+
* </PaymentsUIRoot>
|
|
548
|
+
* ```
|
|
549
|
+
*/
|
|
550
|
+
declare const PaymentsUIRoot: React$1.FC<PaymentsUIRootProps>;
|
|
551
|
+
/**
|
|
552
|
+
prevent conflicts with client app styles
|
|
553
|
+
*/
|
|
554
|
+
declare const PaymentsUIPortalRoot: React$1.FC<PaymentsUIRootProps>;
|
|
555
|
+
|
|
589
556
|
interface CardDetailsFormProps {
|
|
590
557
|
visible: boolean;
|
|
591
558
|
onTokenize: (token: string, billing: BillingDetails) => void;
|
|
@@ -623,28 +590,87 @@ interface PaymentExperienceProps {
|
|
|
623
590
|
enableNewCard?: boolean;
|
|
624
591
|
enableStoredMethods?: boolean;
|
|
625
592
|
enableSolanaPay?: boolean;
|
|
626
|
-
enableAlternativePayments?: boolean;
|
|
627
593
|
onSolanaSuccess?: (result: SubmitPaymentResponse | string) => void;
|
|
628
594
|
onSolanaError?: (error: string) => void;
|
|
629
595
|
initialMode?: 'cards' | 'solana';
|
|
630
596
|
}
|
|
631
597
|
declare const PaymentExperience: React$1.FC<PaymentExperienceProps>;
|
|
632
598
|
|
|
599
|
+
interface BillingHistoryTranslations {
|
|
600
|
+
title?: string;
|
|
601
|
+
description?: string;
|
|
602
|
+
reviewActivity?: string;
|
|
603
|
+
loading?: string;
|
|
604
|
+
error?: string;
|
|
605
|
+
loadingMore?: string;
|
|
606
|
+
reference?: string;
|
|
607
|
+
date?: string;
|
|
608
|
+
amount?: string;
|
|
609
|
+
processor?: string;
|
|
610
|
+
status?: string;
|
|
611
|
+
}
|
|
633
612
|
interface BillingHistoryProps {
|
|
634
613
|
pageSize?: number;
|
|
635
614
|
initialPage?: number;
|
|
636
615
|
enableCancel?: boolean;
|
|
637
616
|
onNotify?: NotificationHandler;
|
|
617
|
+
translations?: BillingHistoryTranslations;
|
|
638
618
|
}
|
|
639
619
|
declare const BillingHistory: React.FC<BillingHistoryProps>;
|
|
640
620
|
|
|
621
|
+
interface CancelMembershipDialogTranslations {
|
|
622
|
+
buttonLabel?: string;
|
|
623
|
+
title?: string;
|
|
624
|
+
description?: string;
|
|
625
|
+
consequence1?: string;
|
|
626
|
+
consequence2?: string;
|
|
627
|
+
consequence3?: string;
|
|
628
|
+
reasonLabel?: string;
|
|
629
|
+
reasonPlaceholder?: string;
|
|
630
|
+
reasonError?: string;
|
|
631
|
+
reasonHint?: string;
|
|
632
|
+
keepMembership?: string;
|
|
633
|
+
confirmCancellation?: string;
|
|
634
|
+
cancelling?: string;
|
|
635
|
+
membershipCancelled?: string;
|
|
636
|
+
cancellationSuccess?: string;
|
|
637
|
+
cancellationFailed?: string;
|
|
638
|
+
}
|
|
641
639
|
interface CancelMembershipDialogProps {
|
|
642
640
|
minReasonLength?: number;
|
|
643
641
|
onCancelled?: () => void;
|
|
644
642
|
onNotify?: NotificationHandler;
|
|
643
|
+
translations?: CancelMembershipDialogTranslations;
|
|
645
644
|
}
|
|
646
645
|
declare const CancelMembershipDialog: React.FC<CancelMembershipDialogProps>;
|
|
647
646
|
|
|
647
|
+
interface PaymentMethodsSectionTranslations {
|
|
648
|
+
title?: string;
|
|
649
|
+
description?: string;
|
|
650
|
+
addCard?: string;
|
|
651
|
+
loadingCards?: string;
|
|
652
|
+
noPaymentMethods?: string;
|
|
653
|
+
addedOn?: string;
|
|
654
|
+
active?: string;
|
|
655
|
+
inactive?: string;
|
|
656
|
+
replaceCard?: string;
|
|
657
|
+
makeDefault?: string;
|
|
658
|
+
defaultMethod?: string;
|
|
659
|
+
remove?: string;
|
|
660
|
+
addNewCard?: string;
|
|
661
|
+
addNewCardDescription?: string;
|
|
662
|
+
saveCard?: string;
|
|
663
|
+
replaceCardTitle?: string;
|
|
664
|
+
replaceCardDescription?: string;
|
|
665
|
+
cardAddedSuccess?: string;
|
|
666
|
+
unableToAddCard?: string;
|
|
667
|
+
cardRemoved?: string;
|
|
668
|
+
unableToRemoveCard?: string;
|
|
669
|
+
cardUpdated?: string;
|
|
670
|
+
unableToReplaceCard?: string;
|
|
671
|
+
defaultPaymentMethodUpdated?: string;
|
|
672
|
+
unableToSetDefault?: string;
|
|
673
|
+
}
|
|
648
674
|
interface PaymentMethodsSectionProps {
|
|
649
675
|
isAuthenticated?: boolean;
|
|
650
676
|
userEmail?: string | null;
|
|
@@ -652,33 +678,10 @@ interface PaymentMethodsSectionProps {
|
|
|
652
678
|
defaultCountry?: string;
|
|
653
679
|
collectPrefix?: string;
|
|
654
680
|
onNotify?: NotificationHandler;
|
|
681
|
+
translations?: PaymentMethodsSectionTranslations;
|
|
655
682
|
}
|
|
656
683
|
declare const PaymentMethodsSection: React.FC<PaymentMethodsSectionProps>;
|
|
657
684
|
|
|
658
|
-
interface SolanaWalletSectionProps {
|
|
659
|
-
onNotify?: NotificationHandler;
|
|
660
|
-
rpcUrl?: string;
|
|
661
|
-
}
|
|
662
|
-
declare const SolanaWalletSection: React.FC<SolanaWalletSectionProps>;
|
|
663
|
-
|
|
664
|
-
declare const WalletManagement: (props: SolanaWalletSectionProps) => react_jsx_runtime.JSX.Element;
|
|
665
|
-
|
|
666
|
-
interface WalletCardProps {
|
|
667
|
-
wallet: SolanaWallet;
|
|
668
|
-
isPrimary?: boolean;
|
|
669
|
-
isConnected?: boolean;
|
|
670
|
-
balance?: number | null;
|
|
671
|
-
onSetPrimary?: (walletId: string) => void;
|
|
672
|
-
onVerify?: (wallet: SolanaWallet) => void;
|
|
673
|
-
onDelete?: (walletId: string) => void;
|
|
674
|
-
isVerifying?: boolean;
|
|
675
|
-
isDeleting?: boolean;
|
|
676
|
-
notify?: NotificationHandler;
|
|
677
|
-
}
|
|
678
|
-
declare const WalletCard: React.FC<WalletCardProps>;
|
|
679
|
-
|
|
680
|
-
declare const EmptyWalletState: React.FC;
|
|
681
|
-
|
|
682
685
|
interface WalletDialogProps {
|
|
683
686
|
open: boolean;
|
|
684
687
|
onOpenChange: (open: boolean) => void;
|
|
@@ -705,8 +708,6 @@ declare const usePaymentMethods: () => {
|
|
|
705
708
|
}, unknown>;
|
|
706
709
|
};
|
|
707
710
|
|
|
708
|
-
declare const usePaymentMethodService: () => PaymentMethodService;
|
|
709
|
-
|
|
710
711
|
declare const useSupportedTokens: () => {
|
|
711
712
|
tokens: TokenInfo[];
|
|
712
713
|
isLoading: boolean;
|
|
@@ -754,19 +755,6 @@ declare const useTokenBalance: (tokens: TokenInfo[]) => {
|
|
|
754
755
|
isConnected: boolean;
|
|
755
756
|
};
|
|
756
757
|
|
|
757
|
-
interface DirectPaymentState {
|
|
758
|
-
loading: boolean;
|
|
759
|
-
error: string | null;
|
|
760
|
-
success: boolean;
|
|
761
|
-
transactionId: string | null;
|
|
762
|
-
}
|
|
763
|
-
interface UseDirectWalletPaymentReturn {
|
|
764
|
-
paymentState: DirectPaymentState;
|
|
765
|
-
payWithWallet: (token: TokenInfo, priceId: string) => Promise<void>;
|
|
766
|
-
resetPayment: () => void;
|
|
767
|
-
}
|
|
768
|
-
declare const useDirectWalletPayment: () => UseDirectWalletPaymentReturn;
|
|
769
|
-
|
|
770
758
|
interface PaymentStatusHookOptions {
|
|
771
759
|
transactionId?: string;
|
|
772
760
|
purchaseId?: string;
|
|
@@ -793,37 +781,16 @@ declare const usePaymentStatus: (options?: PaymentStatusHookOptions) => {
|
|
|
793
781
|
isPending: boolean;
|
|
794
782
|
};
|
|
795
783
|
|
|
796
|
-
declare const useSolanaService: () => SolanaPaymentService;
|
|
797
|
-
|
|
798
784
|
declare const usePaymentNotifications: () => {
|
|
799
785
|
notifyStatus: (status: PaymentStatusPayload["status"], context?: Record<string, unknown>) => void;
|
|
800
786
|
notifySuccess: (payload?: PaymentSuccessPayload) => void;
|
|
801
787
|
notifyError: (error: string | Error) => void;
|
|
802
788
|
};
|
|
803
789
|
|
|
804
|
-
interface UseSolanaDirectPaymentOptions {
|
|
805
|
-
priceId: string;
|
|
806
|
-
tokenAmount: number;
|
|
807
|
-
selectedToken: TokenInfo | null;
|
|
808
|
-
supportedTokens: TokenInfo[];
|
|
809
|
-
onStart: () => void;
|
|
810
|
-
onConfirming: () => void;
|
|
811
|
-
onSuccess: (result: SubmitPaymentResponse, txId: string) => void;
|
|
812
|
-
onError: (error: string) => void;
|
|
813
|
-
}
|
|
814
|
-
interface SolanaDirectPaymentState {
|
|
815
|
-
isBalanceLoading: boolean;
|
|
816
|
-
isProcessing: boolean;
|
|
817
|
-
balanceLabel: string;
|
|
818
|
-
canPay: boolean;
|
|
819
|
-
pay: () => Promise<void>;
|
|
820
|
-
}
|
|
821
|
-
declare const useSolanaDirectPayment: (options: UseSolanaDirectPaymentOptions) => SolanaDirectPaymentState;
|
|
822
|
-
|
|
823
790
|
interface UseSolanaQrPaymentOptions {
|
|
824
791
|
priceId: string;
|
|
825
792
|
selectedToken: TokenInfo | null;
|
|
826
|
-
onSuccess: (
|
|
793
|
+
onSuccess: (paymentId: string | undefined, txId: string | undefined) => void;
|
|
827
794
|
onError: (error: string) => void;
|
|
828
795
|
}
|
|
829
796
|
interface UseSolanaQrPaymentState {
|
|
@@ -859,75 +826,10 @@ interface SubscribeWithCCBillParams {
|
|
|
859
826
|
country: string;
|
|
860
827
|
processor?: string;
|
|
861
828
|
}
|
|
862
|
-
interface GenerateFlexFormParams {
|
|
863
|
-
priceId?: string | null;
|
|
864
|
-
firstName: string;
|
|
865
|
-
lastName: string;
|
|
866
|
-
address1: string;
|
|
867
|
-
city: string;
|
|
868
|
-
state: string;
|
|
869
|
-
zipCode: string;
|
|
870
|
-
country: string;
|
|
871
|
-
}
|
|
872
829
|
declare const useSubscriptionActions: () => {
|
|
873
|
-
subscribeWithCard: ({ priceId, processor, provider, paymentToken, billing, }: SubscribeWithCardParams) => Promise<
|
|
874
|
-
subscribeWithSavedMethod: ({ priceId, processor, provider, paymentMethodId, email, }: SubscribeWithSavedMethodParams) => Promise<
|
|
875
|
-
subscribeWithCCBill: ({ priceId, email, firstName, lastName, zipCode, country, processor, }: SubscribeWithCCBillParams) => Promise<
|
|
876
|
-
generateFlexFormUrl: ({ priceId, firstName, lastName, address1, city, state, zipCode, country, }: GenerateFlexFormParams) => Promise<FlexFormResponse>;
|
|
877
|
-
};
|
|
878
|
-
|
|
879
|
-
interface FlexFormPayload {
|
|
880
|
-
priceId: string;
|
|
881
|
-
firstName: string;
|
|
882
|
-
lastName: string;
|
|
883
|
-
address1: string;
|
|
884
|
-
city: string;
|
|
885
|
-
state: string;
|
|
886
|
-
zipCode: string;
|
|
887
|
-
country: string;
|
|
888
|
-
}
|
|
889
|
-
declare const useAlternativePaymentProvider: () => {
|
|
890
|
-
openFlexForm: (payload: FlexFormPayload) => Promise<void>;
|
|
891
|
-
isLoading: boolean;
|
|
892
|
-
error: string | null;
|
|
893
|
-
};
|
|
894
|
-
|
|
895
|
-
interface UseWalletListOptions {
|
|
896
|
-
autoFetch?: boolean;
|
|
897
|
-
}
|
|
898
|
-
declare const useWalletList: (options?: UseWalletListOptions) => {
|
|
899
|
-
wallets: SolanaWallet[];
|
|
900
|
-
isLoading: boolean;
|
|
901
|
-
error: string | null;
|
|
902
|
-
fetchWallets: () => Promise<SolanaWallet[]>;
|
|
903
|
-
deleteWallet: (walletIdOrAddress: string) => Promise<void>;
|
|
904
|
-
addWallet: (wallet: SolanaWallet) => void;
|
|
905
|
-
updateWallet: (walletId: string, updates: Partial<SolanaWallet>) => void;
|
|
906
|
-
clearError: () => void;
|
|
907
|
-
findWalletByAddress: (address: string) => SolanaWallet | undefined;
|
|
908
|
-
getVerifiedWallets: () => SolanaWallet[];
|
|
909
|
-
hasVerifiedWallets: boolean;
|
|
910
|
-
totalWallets: number;
|
|
830
|
+
subscribeWithCard: ({ priceId, processor, provider, paymentToken, billing, }: SubscribeWithCardParams) => Promise<CheckoutResponse>;
|
|
831
|
+
subscribeWithSavedMethod: ({ priceId, processor, provider, paymentMethodId, email, }: SubscribeWithSavedMethodParams) => Promise<CheckoutResponse>;
|
|
832
|
+
subscribeWithCCBill: ({ priceId, email, firstName, lastName, zipCode, country, processor, }: SubscribeWithCCBillParams) => Promise<CheckoutResponse>;
|
|
911
833
|
};
|
|
912
834
|
|
|
913
|
-
|
|
914
|
-
signAndVerifyWallet: (walletAddress: string, message: string, nonce?: string) => Promise<VerifyWalletResponse>;
|
|
915
|
-
autoVerifyWallet: (walletAddress: string, message: string, nonce?: string) => Promise<VerifyWalletResponse | null>;
|
|
916
|
-
clearError: () => void;
|
|
917
|
-
resetVerification: () => void;
|
|
918
|
-
isVerifying: boolean;
|
|
919
|
-
isVerified: boolean;
|
|
920
|
-
error: string | null;
|
|
921
|
-
};
|
|
922
|
-
|
|
923
|
-
interface WalletConnectionResult extends WalletConnectionState {
|
|
924
|
-
walletName?: string;
|
|
925
|
-
walletIcon?: string;
|
|
926
|
-
connectWallet: () => Promise<void>;
|
|
927
|
-
disconnectWallet: () => Promise<void>;
|
|
928
|
-
connectWalletToBackend: (address: string) => Promise<WalletChallengeResponse>;
|
|
929
|
-
clearError: () => void;
|
|
930
|
-
}
|
|
931
|
-
declare const useWalletConnection: () => WalletConnectionResult;
|
|
932
|
-
|
|
933
|
-
export { type AuthTokenProvider, type BillingAccessGrant, type BillingDetails, BillingHistory, type BillingHistoryProps, type BillingStatus, type CCBillSubscribePayload, CancelMembershipDialog, type CancelMembershipDialogProps, CardDetailsForm, type CardDetailsFormProps, CardPaymentService, type CardTokenizeResult, type CreatePaymentMethodPayload, EmptyWalletState, type FlexFormResponse, type GenerateFlexFormParams, type GenerateFlexFormURLBodyParams, type GeneratePaymentRequest, type GeneratePaymentResponse, type ListParams, type NmiSubscribePayload, type NotificationHandler, type NotificationPayload, type NotificationStatus, type PaginatedPaymentMethods, type PaginatedPayments, type Payment, PaymentApp, type PaymentAppOptions, type PaymentCallbacks, type PaymentConfig, type PaymentContextValue, type PaymentEndpoints, type PaymentError, PaymentExperience, type PaymentExperienceProps, type PaymentFeatureFlags, type PaymentFetcher, type PaymentMethod, type PaymentMethodOption, PaymentMethodService, PaymentMethodsSection, type PaymentMethodsSectionProps, type PaymentPlatform, PaymentProvider, type PaymentProviderProps, type PaymentServices, type PaymentSolanaConfig, type PaymentState, type PaymentStatusPayload, type PaymentStatusResponse, type PaymentStep, type PaymentSuccessPayload, type PaymentUserDetails, PaymentsDialogProvider, PaymentsRuntime, type SolanaFlowConfig, type SolanaPayQRCodeIntent, type SolanaPayStatusResponse, type SolanaPayTransaction, type SolanaPaymentMethod, SolanaPaymentSelector, type SolanaPaymentSelectorProps, SolanaPaymentService, SolanaPaymentView, type SolanaPaymentViewProps, type SolanaWallet, SolanaWalletSection, type SolanaWalletSectionProps, SolanaWalletService, StoredPaymentMethods, type StoredPaymentMethodsProps, type SubmitPaymentRequest, type SubmitPaymentResponse, type SubscribeWithCCBillParams, type SubscribeWithCardParams, type SubscribeWithSavedMethodParams, SubscriptionCheckoutModal, type SubscriptionCheckoutModalProps, type SubscriptionCheckoutPayload, type SubscriptionResponse, SubscriptionService, SubscriptionSuccessDialog, type SupportedTokensResponse, type TokenBalance, TokenCatalog, type TokenCatalogOptions, type TokenInfo, type TransactionStatus, type VerifyWalletResponse, type WalletAccount, type WalletAdapterLike, WalletCard, type WalletChallengeResponse, type WalletConnectionState, WalletDialog, type WalletDialogProps, WalletGateway, type WalletListResponse, WalletManagement, WalletModal, type WalletModalProps, createPaymentsRuntime, useAlternativePaymentProvider, useDirectWalletPayment, usePaymentContext, usePaymentDialogs, usePaymentMethodService, usePaymentMethods, usePaymentNotifications, usePaymentStatus, useSolanaDirectPayment, useSolanaQrPayment, useSolanaService, useSubscriptionActions, useSupportedTokens, useTokenBalance, useWalletConnection, useWalletList, useWalletVerification };
|
|
835
|
+
export { type AuthTokenProvider, type BillingAccessGrant, type BillingDetails, BillingHistory, type BillingHistoryProps, type BillingHistoryTranslations, type BillingStatus, type CCBillSubscribePayload, CancelMembershipDialog, type CancelMembershipDialogProps, type CancelMembershipDialogTranslations, CardDetailsForm, type CardDetailsFormProps, type CheckoutRequestPayload, type CheckoutResponse, type CheckoutStatus, type Client, ClientApiError, type ClientConfig, type CreatePaymentMethodPayload, type GeneratePaymentRequest, type GeneratePaymentResponse, type HttpMethod, type NmiSubscribePayload, type NotificationHandler, type NotificationPayload, type NotificationStatus, type PaginatedPaymentMethods, type PaginatedPayments, type PaginatedResponse, type Payment, type PaymentCallbacks, type PaymentConfig, PaymentContext, type PaymentContextValue, type PaymentEndpoints, type PaymentError, PaymentExperience, type PaymentExperienceProps, type PaymentFeatureFlags, type PaymentFetcher, type PaymentMethod, type PaymentMethodOption, PaymentMethodsSection, type PaymentMethodsSectionProps, type PaymentMethodsSectionTranslations, type PaymentPlatform, PaymentProvider, type PaymentProviderProps, type PaymentSolanaConfig, type PaymentState, type PaymentStatusPayload, type PaymentStatusResponse, type PaymentStep, type PaymentSuccessPayload, type PaymentUserDetails, PaymentsDialogProvider, PaymentsUIPortalRoot, PaymentsUIRoot, type PaymentsUIRootProps, type RequestOptions, type SolanaFlowConfig, type SolanaPayQRCodeIntent, type SolanaPayStatusResponse, type SolanaPayTransaction, type SolanaPaymentMethod, SolanaPaymentSelector, type SolanaPaymentSelectorProps, SolanaPaymentView, type SolanaPaymentViewProps, type SolanaWallet, StoredPaymentMethods, type StoredPaymentMethodsProps, type SubmitPaymentRequest, type SubmitPaymentResponse, type SubscribeWithCCBillParams, type SubscribeWithCardParams, type SubscribeWithSavedMethodParams, SubscriptionCheckoutModal, type SubscriptionCheckoutModalProps, type SubscriptionCheckoutPayload, SubscriptionSuccessDialog, type SupportedTokensResponse, type TokenBalance, type TokenInfo, type TransactionStatus, type VerifyWalletResponse, type WalletChallengeResponse, type WalletConnectionState, WalletDialog, type WalletDialogProps, type WalletListResponse, WalletModal, type WalletModalProps, createClient, usePaymentContext, usePaymentDialogs, usePaymentMethods, usePaymentNotifications, usePaymentStatus, useSolanaQrPayment, useSubscriptionActions, useSupportedTokens, useTokenBalance };
|