@doujins/payments-ui 0.0.10 → 0.0.12
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 +1805 -245
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +244 -9
- package/dist/index.d.ts +244 -9
- package/dist/index.js +1789 -248
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +10 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React$1 from 'react';
|
|
2
2
|
import { StoreApi } from 'zustand';
|
|
3
3
|
import { PublicKey } from '@solana/web3.js';
|
|
4
4
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
6
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
7
|
|
|
7
8
|
type AuthTokenProvider = (() => string | null | undefined) | (() => Promise<string | null | undefined>) | null | undefined;
|
|
@@ -54,6 +55,13 @@ interface PaymentConfig {
|
|
|
54
55
|
collectJsKey?: string;
|
|
55
56
|
solanaRpcUrl?: string;
|
|
56
57
|
}
|
|
58
|
+
type NotificationStatus = 'default' | 'success' | 'info' | 'destructive';
|
|
59
|
+
interface NotificationPayload {
|
|
60
|
+
title: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
status?: NotificationStatus;
|
|
63
|
+
}
|
|
64
|
+
type NotificationHandler = (payload: NotificationPayload) => void;
|
|
57
65
|
|
|
58
66
|
interface BillingDetails {
|
|
59
67
|
firstName: string;
|
|
@@ -93,6 +101,41 @@ interface PaginatedPaymentMethods {
|
|
|
93
101
|
total?: number;
|
|
94
102
|
next_page?: number | null;
|
|
95
103
|
}
|
|
104
|
+
interface Payment {
|
|
105
|
+
id: string;
|
|
106
|
+
subscription_id?: string | null;
|
|
107
|
+
processor: string;
|
|
108
|
+
transaction_id: string;
|
|
109
|
+
amount: number;
|
|
110
|
+
currency: string;
|
|
111
|
+
purchased_at: string;
|
|
112
|
+
status?: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
}
|
|
115
|
+
interface PaginatedPayments {
|
|
116
|
+
data: Payment[];
|
|
117
|
+
total_items: number;
|
|
118
|
+
limit?: number;
|
|
119
|
+
offset?: number;
|
|
120
|
+
page?: number;
|
|
121
|
+
page_size?: number;
|
|
122
|
+
total_pages?: number;
|
|
123
|
+
}
|
|
124
|
+
interface BillingAccessGrant {
|
|
125
|
+
kind: string;
|
|
126
|
+
entitlement: string;
|
|
127
|
+
subscription_id?: string | null;
|
|
128
|
+
processor?: string | null;
|
|
129
|
+
processor_subscription_id?: string | null;
|
|
130
|
+
source_type?: string | null;
|
|
131
|
+
source_id?: string | null;
|
|
132
|
+
start_at?: string | null;
|
|
133
|
+
end_at?: string | null;
|
|
134
|
+
}
|
|
135
|
+
interface BillingStatus {
|
|
136
|
+
is_premium: boolean;
|
|
137
|
+
access: BillingAccessGrant[];
|
|
138
|
+
}
|
|
96
139
|
|
|
97
140
|
interface GeneratePaymentRequest {
|
|
98
141
|
price_id: string;
|
|
@@ -278,6 +321,40 @@ interface SubscriptionCheckoutPayload {
|
|
|
278
321
|
billing: BillingDetails;
|
|
279
322
|
}
|
|
280
323
|
|
|
324
|
+
interface SolanaWallet {
|
|
325
|
+
id: string;
|
|
326
|
+
address: string;
|
|
327
|
+
is_verified: boolean;
|
|
328
|
+
verified_at?: string;
|
|
329
|
+
created_at: string;
|
|
330
|
+
updated_at?: string;
|
|
331
|
+
user_id?: string;
|
|
332
|
+
}
|
|
333
|
+
interface WalletListResponse {
|
|
334
|
+
wallets: SolanaWallet[];
|
|
335
|
+
count: number;
|
|
336
|
+
}
|
|
337
|
+
interface WalletChallengeResponse {
|
|
338
|
+
wallet: string;
|
|
339
|
+
message: string;
|
|
340
|
+
expires_at: number;
|
|
341
|
+
nonce: string;
|
|
342
|
+
}
|
|
343
|
+
interface VerifyWalletResponse {
|
|
344
|
+
verified: boolean;
|
|
345
|
+
wallet: string;
|
|
346
|
+
verified_at?: string;
|
|
347
|
+
linked_wallet?: SolanaWallet;
|
|
348
|
+
}
|
|
349
|
+
interface WalletConnectionState {
|
|
350
|
+
isConnected: boolean;
|
|
351
|
+
isConnecting: boolean;
|
|
352
|
+
publicKey: string | null;
|
|
353
|
+
wallets: SolanaWallet[];
|
|
354
|
+
isLoading: boolean;
|
|
355
|
+
error: string | null;
|
|
356
|
+
}
|
|
357
|
+
|
|
281
358
|
type RequestOptions = {
|
|
282
359
|
params?: Record<string, string | number>;
|
|
283
360
|
query?: Record<string, string | number | undefined>;
|
|
@@ -367,13 +444,32 @@ declare class SubscriptionService {
|
|
|
367
444
|
constructor(api: ApiClient);
|
|
368
445
|
subscribe(platform: PaymentPlatform, payload: NmiSubscribePayload | CCBillSubscribePayload): Promise<SubscriptionResponse>;
|
|
369
446
|
generateFlexFormUrl(payload: GenerateFlexFormURLBodyParams): Promise<FlexFormResponse>;
|
|
447
|
+
getPaymentHistory(params?: {
|
|
448
|
+
limit?: number;
|
|
449
|
+
offset?: number;
|
|
450
|
+
type?: string;
|
|
451
|
+
}): Promise<PaginatedPayments>;
|
|
452
|
+
cancelSubscription(feedback?: string): Promise<{
|
|
453
|
+
message: string;
|
|
454
|
+
success: boolean;
|
|
455
|
+
}>;
|
|
370
456
|
private serializePayload;
|
|
371
457
|
}
|
|
372
458
|
|
|
459
|
+
declare class SolanaWalletService {
|
|
460
|
+
private readonly api;
|
|
461
|
+
constructor(api: ApiClient);
|
|
462
|
+
list(): Promise<SolanaWallet[]>;
|
|
463
|
+
requestChallenge(wallet: string): Promise<WalletChallengeResponse>;
|
|
464
|
+
verify(wallet: string, signature: string, nonce?: string): Promise<VerifyWalletResponse>;
|
|
465
|
+
remove(wallet: string): Promise<void>;
|
|
466
|
+
}
|
|
467
|
+
|
|
373
468
|
interface PaymentServices {
|
|
374
469
|
cardPayments: CardPaymentService;
|
|
375
470
|
paymentMethods: PaymentMethodService;
|
|
376
471
|
solanaPayments: SolanaPaymentService;
|
|
472
|
+
solanaWallets: SolanaWalletService;
|
|
377
473
|
tokenCatalog: TokenCatalog;
|
|
378
474
|
walletGateway: WalletGateway;
|
|
379
475
|
subscriptions: SubscriptionService;
|
|
@@ -447,9 +543,9 @@ interface PaymentContextValue {
|
|
|
447
543
|
}
|
|
448
544
|
interface PaymentProviderProps {
|
|
449
545
|
config: PaymentConfig;
|
|
450
|
-
children: React.ReactNode;
|
|
546
|
+
children: React$1.ReactNode;
|
|
451
547
|
}
|
|
452
|
-
declare const PaymentProvider: React.FC<PaymentProviderProps>;
|
|
548
|
+
declare const PaymentProvider: React$1.FC<PaymentProviderProps>;
|
|
453
549
|
declare const usePaymentContext: () => PaymentContextValue;
|
|
454
550
|
|
|
455
551
|
interface CardDetailsFormProps {
|
|
@@ -464,7 +560,7 @@ interface CardDetailsFormProps {
|
|
|
464
560
|
onBillingChange?: (billing: BillingDetails) => void;
|
|
465
561
|
submitDisabled?: boolean;
|
|
466
562
|
}
|
|
467
|
-
declare const CardDetailsForm: React.FC<CardDetailsFormProps>;
|
|
563
|
+
declare const CardDetailsForm: React$1.FC<CardDetailsFormProps>;
|
|
468
564
|
|
|
469
565
|
interface StoredPaymentMethodsProps {
|
|
470
566
|
selectedMethodId?: string | null;
|
|
@@ -473,7 +569,7 @@ interface StoredPaymentMethodsProps {
|
|
|
473
569
|
heading?: string;
|
|
474
570
|
description?: string;
|
|
475
571
|
}
|
|
476
|
-
declare const StoredPaymentMethods: React.FC<StoredPaymentMethodsProps>;
|
|
572
|
+
declare const StoredPaymentMethods: React$1.FC<StoredPaymentMethodsProps>;
|
|
477
573
|
|
|
478
574
|
interface PaymentExperienceProps {
|
|
479
575
|
priceId: string;
|
|
@@ -489,11 +585,11 @@ interface PaymentExperienceProps {
|
|
|
489
585
|
enableNewCard?: boolean;
|
|
490
586
|
enableStoredMethods?: boolean;
|
|
491
587
|
enableSolanaPay?: boolean;
|
|
492
|
-
checkoutSummary?: React.ReactNode;
|
|
588
|
+
checkoutSummary?: React$1.ReactNode;
|
|
493
589
|
onSolanaSuccess?: (result: SubmitPaymentResponse | string) => void;
|
|
494
590
|
onSolanaError?: (error: string) => void;
|
|
495
591
|
}
|
|
496
|
-
declare const PaymentExperience: React.FC<PaymentExperienceProps>;
|
|
592
|
+
declare const PaymentExperience: React$1.FC<PaymentExperienceProps>;
|
|
497
593
|
|
|
498
594
|
interface SolanaPaymentSelectorProps {
|
|
499
595
|
isOpen: boolean;
|
|
@@ -503,7 +599,92 @@ interface SolanaPaymentSelectorProps {
|
|
|
503
599
|
onError?: (error: string) => void;
|
|
504
600
|
onSuccess: (result: SubmitPaymentResponse | string) => void;
|
|
505
601
|
}
|
|
506
|
-
declare const SolanaPaymentSelector: React.FC<SolanaPaymentSelectorProps>;
|
|
602
|
+
declare const SolanaPaymentSelector: React$1.FC<SolanaPaymentSelectorProps>;
|
|
603
|
+
|
|
604
|
+
interface BillingHistoryProps {
|
|
605
|
+
pageSize?: number;
|
|
606
|
+
initialPage?: number;
|
|
607
|
+
enableCancel?: boolean;
|
|
608
|
+
onNotify?: NotificationHandler;
|
|
609
|
+
}
|
|
610
|
+
declare const BillingHistory: React.FC<BillingHistoryProps>;
|
|
611
|
+
|
|
612
|
+
interface CancelMembershipDialogProps {
|
|
613
|
+
minReasonLength?: number;
|
|
614
|
+
onCancelled?: () => void;
|
|
615
|
+
onNotify?: NotificationHandler;
|
|
616
|
+
}
|
|
617
|
+
declare const CancelMembershipDialog: React.FC<CancelMembershipDialogProps>;
|
|
618
|
+
|
|
619
|
+
interface PaymentMethodsSectionProps {
|
|
620
|
+
isAuthenticated?: boolean;
|
|
621
|
+
userEmail?: string | null;
|
|
622
|
+
provider?: string;
|
|
623
|
+
defaultCountry?: string;
|
|
624
|
+
collectPrefix?: string;
|
|
625
|
+
onNotify?: NotificationHandler;
|
|
626
|
+
}
|
|
627
|
+
declare const PaymentMethodsSection: React.FC<PaymentMethodsSectionProps>;
|
|
628
|
+
|
|
629
|
+
interface SolanaWalletSectionProps {
|
|
630
|
+
onNotify?: NotificationHandler;
|
|
631
|
+
rpcUrl?: string;
|
|
632
|
+
}
|
|
633
|
+
declare const SolanaWalletSection: React.FC<SolanaWalletSectionProps>;
|
|
634
|
+
|
|
635
|
+
declare const WalletManagement: (props: SolanaWalletSectionProps) => react_jsx_runtime.JSX.Element;
|
|
636
|
+
|
|
637
|
+
interface WalletCardProps {
|
|
638
|
+
wallet: SolanaWallet;
|
|
639
|
+
isPrimary?: boolean;
|
|
640
|
+
isConnected?: boolean;
|
|
641
|
+
balance?: number | null;
|
|
642
|
+
onSetPrimary?: (walletId: string) => void;
|
|
643
|
+
onVerify?: (wallet: SolanaWallet) => void;
|
|
644
|
+
onDelete?: (walletId: string) => void;
|
|
645
|
+
isVerifying?: boolean;
|
|
646
|
+
isDeleting?: boolean;
|
|
647
|
+
notify?: NotificationHandler;
|
|
648
|
+
}
|
|
649
|
+
declare const WalletCard: React.FC<WalletCardProps>;
|
|
650
|
+
|
|
651
|
+
declare const EmptyWalletState: React.FC;
|
|
652
|
+
|
|
653
|
+
interface WalletModalProps {
|
|
654
|
+
open: boolean;
|
|
655
|
+
onOpenChange: (open: boolean) => void;
|
|
656
|
+
}
|
|
657
|
+
declare const WalletModal: React.FC<WalletModalProps>;
|
|
658
|
+
|
|
659
|
+
interface WalletDialogProps {
|
|
660
|
+
open: boolean;
|
|
661
|
+
onOpenChange: (open: boolean) => void;
|
|
662
|
+
}
|
|
663
|
+
declare const WalletDialog: React.FC<WalletDialogProps>;
|
|
664
|
+
|
|
665
|
+
interface SubscriptionCheckoutModalProps {
|
|
666
|
+
open: boolean;
|
|
667
|
+
onOpenChange: (open: boolean) => void;
|
|
668
|
+
priceId?: string | null;
|
|
669
|
+
usdAmount?: number;
|
|
670
|
+
planName?: string;
|
|
671
|
+
amountLabel?: string;
|
|
672
|
+
billingPeriodLabel?: string;
|
|
673
|
+
userEmail?: string | null;
|
|
674
|
+
provider?: string;
|
|
675
|
+
onSuccess?: () => void;
|
|
676
|
+
enableSolanaPay?: boolean;
|
|
677
|
+
}
|
|
678
|
+
declare const SubscriptionCheckoutModal: React$1.FC<SubscriptionCheckoutModalProps>;
|
|
679
|
+
|
|
680
|
+
interface SubscriptionSuccessDialogProps {
|
|
681
|
+
open: boolean;
|
|
682
|
+
planName?: string;
|
|
683
|
+
amountLabel?: string;
|
|
684
|
+
billingPeriodLabel?: string;
|
|
685
|
+
onClose: () => void;
|
|
686
|
+
}
|
|
687
|
+
declare const SubscriptionSuccessDialog: React$1.FC<SubscriptionSuccessDialogProps>;
|
|
507
688
|
|
|
508
689
|
declare const usePaymentMethods: () => {
|
|
509
690
|
listQuery: _tanstack_react_query.UseQueryResult<PaginatedPaymentMethods, Error>;
|
|
@@ -683,4 +864,58 @@ declare const useSubscriptionActions: () => {
|
|
|
683
864
|
generateFlexFormUrl: ({ priceId, firstName, lastName, address1, city, state, zipCode, country, }: GenerateFlexFormParams) => Promise<FlexFormResponse>;
|
|
684
865
|
};
|
|
685
866
|
|
|
686
|
-
|
|
867
|
+
interface FlexFormPayload {
|
|
868
|
+
priceId: string;
|
|
869
|
+
firstName: string;
|
|
870
|
+
lastName: string;
|
|
871
|
+
address1: string;
|
|
872
|
+
city: string;
|
|
873
|
+
state: string;
|
|
874
|
+
zipCode: string;
|
|
875
|
+
country: string;
|
|
876
|
+
}
|
|
877
|
+
declare const useAlternativePaymentProvider: () => {
|
|
878
|
+
openFlexForm: (payload: FlexFormPayload) => Promise<void>;
|
|
879
|
+
isLoading: boolean;
|
|
880
|
+
error: string | null;
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
interface UseWalletListOptions {
|
|
884
|
+
autoFetch?: boolean;
|
|
885
|
+
}
|
|
886
|
+
declare const useWalletList: (options?: UseWalletListOptions) => {
|
|
887
|
+
wallets: SolanaWallet[];
|
|
888
|
+
isLoading: boolean;
|
|
889
|
+
error: string | null;
|
|
890
|
+
fetchWallets: () => Promise<SolanaWallet[]>;
|
|
891
|
+
deleteWallet: (walletIdOrAddress: string) => Promise<void>;
|
|
892
|
+
addWallet: (wallet: SolanaWallet) => void;
|
|
893
|
+
updateWallet: (walletId: string, updates: Partial<SolanaWallet>) => void;
|
|
894
|
+
clearError: () => void;
|
|
895
|
+
findWalletByAddress: (address: string) => SolanaWallet | undefined;
|
|
896
|
+
getVerifiedWallets: () => SolanaWallet[];
|
|
897
|
+
hasVerifiedWallets: boolean;
|
|
898
|
+
totalWallets: number;
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
declare const useWalletVerification: () => {
|
|
902
|
+
signAndVerifyWallet: (walletAddress: string, message: string, nonce?: string) => Promise<VerifyWalletResponse>;
|
|
903
|
+
autoVerifyWallet: (walletAddress: string, message: string, nonce?: string) => Promise<VerifyWalletResponse | null>;
|
|
904
|
+
clearError: () => void;
|
|
905
|
+
resetVerification: () => void;
|
|
906
|
+
isVerifying: boolean;
|
|
907
|
+
isVerified: boolean;
|
|
908
|
+
error: string | null;
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
interface WalletConnectionResult extends WalletConnectionState {
|
|
912
|
+
walletName?: string;
|
|
913
|
+
walletIcon?: string;
|
|
914
|
+
connectWallet: () => Promise<void>;
|
|
915
|
+
disconnectWallet: () => Promise<void>;
|
|
916
|
+
connectWalletToBackend: (address: string) => Promise<WalletChallengeResponse>;
|
|
917
|
+
clearError: () => void;
|
|
918
|
+
}
|
|
919
|
+
declare const useWalletConnection: () => WalletConnectionResult;
|
|
920
|
+
|
|
921
|
+
export { type AsyncStatus, 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 PaymentState, type PaymentStatusPayload, type PaymentStatusResponse, type PaymentStep, type PaymentStoreOptions, type PaymentStoreState, type PaymentSuccessPayload, type PaymentUserDetails, type SolanaFlowConfig, type SolanaFlowState, type SolanaPayQRCodeIntent, type SolanaPayStatusResponse, type SolanaPayTransaction, type SolanaPaymentMethod, SolanaPaymentSelector, SolanaPaymentService, type SolanaWallet, SolanaWalletSection, type SolanaWalletSectionProps, SolanaWalletService, StoredPaymentMethods, type StoredPaymentMethodsProps, type SubmitPaymentRequest, type SubmitPaymentResponse, type SubscribeWithCCBillParams, type SubscribeWithCardParams, type SubscribeWithSavedMethodParams, SubscriptionCheckoutModal, 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, createPaymentStore, useAlternativePaymentProvider, useDirectWalletPayment, usePaymentContext, usePaymentMethodService, usePaymentMethods, usePaymentStatus, usePaymentStore, useSolanaDirectPayment, useSolanaQrPayment, useSolanaService, useSubscriptionActions, useSupportedTokens, useTokenBalance, useWalletConnection, useWalletList, useWalletVerification };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React$1 from 'react';
|
|
2
2
|
import { StoreApi } from 'zustand';
|
|
3
3
|
import { PublicKey } from '@solana/web3.js';
|
|
4
4
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
5
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
6
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
6
7
|
|
|
7
8
|
type AuthTokenProvider = (() => string | null | undefined) | (() => Promise<string | null | undefined>) | null | undefined;
|
|
@@ -54,6 +55,13 @@ interface PaymentConfig {
|
|
|
54
55
|
collectJsKey?: string;
|
|
55
56
|
solanaRpcUrl?: string;
|
|
56
57
|
}
|
|
58
|
+
type NotificationStatus = 'default' | 'success' | 'info' | 'destructive';
|
|
59
|
+
interface NotificationPayload {
|
|
60
|
+
title: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
status?: NotificationStatus;
|
|
63
|
+
}
|
|
64
|
+
type NotificationHandler = (payload: NotificationPayload) => void;
|
|
57
65
|
|
|
58
66
|
interface BillingDetails {
|
|
59
67
|
firstName: string;
|
|
@@ -93,6 +101,41 @@ interface PaginatedPaymentMethods {
|
|
|
93
101
|
total?: number;
|
|
94
102
|
next_page?: number | null;
|
|
95
103
|
}
|
|
104
|
+
interface Payment {
|
|
105
|
+
id: string;
|
|
106
|
+
subscription_id?: string | null;
|
|
107
|
+
processor: string;
|
|
108
|
+
transaction_id: string;
|
|
109
|
+
amount: number;
|
|
110
|
+
currency: string;
|
|
111
|
+
purchased_at: string;
|
|
112
|
+
status?: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
}
|
|
115
|
+
interface PaginatedPayments {
|
|
116
|
+
data: Payment[];
|
|
117
|
+
total_items: number;
|
|
118
|
+
limit?: number;
|
|
119
|
+
offset?: number;
|
|
120
|
+
page?: number;
|
|
121
|
+
page_size?: number;
|
|
122
|
+
total_pages?: number;
|
|
123
|
+
}
|
|
124
|
+
interface BillingAccessGrant {
|
|
125
|
+
kind: string;
|
|
126
|
+
entitlement: string;
|
|
127
|
+
subscription_id?: string | null;
|
|
128
|
+
processor?: string | null;
|
|
129
|
+
processor_subscription_id?: string | null;
|
|
130
|
+
source_type?: string | null;
|
|
131
|
+
source_id?: string | null;
|
|
132
|
+
start_at?: string | null;
|
|
133
|
+
end_at?: string | null;
|
|
134
|
+
}
|
|
135
|
+
interface BillingStatus {
|
|
136
|
+
is_premium: boolean;
|
|
137
|
+
access: BillingAccessGrant[];
|
|
138
|
+
}
|
|
96
139
|
|
|
97
140
|
interface GeneratePaymentRequest {
|
|
98
141
|
price_id: string;
|
|
@@ -278,6 +321,40 @@ interface SubscriptionCheckoutPayload {
|
|
|
278
321
|
billing: BillingDetails;
|
|
279
322
|
}
|
|
280
323
|
|
|
324
|
+
interface SolanaWallet {
|
|
325
|
+
id: string;
|
|
326
|
+
address: string;
|
|
327
|
+
is_verified: boolean;
|
|
328
|
+
verified_at?: string;
|
|
329
|
+
created_at: string;
|
|
330
|
+
updated_at?: string;
|
|
331
|
+
user_id?: string;
|
|
332
|
+
}
|
|
333
|
+
interface WalletListResponse {
|
|
334
|
+
wallets: SolanaWallet[];
|
|
335
|
+
count: number;
|
|
336
|
+
}
|
|
337
|
+
interface WalletChallengeResponse {
|
|
338
|
+
wallet: string;
|
|
339
|
+
message: string;
|
|
340
|
+
expires_at: number;
|
|
341
|
+
nonce: string;
|
|
342
|
+
}
|
|
343
|
+
interface VerifyWalletResponse {
|
|
344
|
+
verified: boolean;
|
|
345
|
+
wallet: string;
|
|
346
|
+
verified_at?: string;
|
|
347
|
+
linked_wallet?: SolanaWallet;
|
|
348
|
+
}
|
|
349
|
+
interface WalletConnectionState {
|
|
350
|
+
isConnected: boolean;
|
|
351
|
+
isConnecting: boolean;
|
|
352
|
+
publicKey: string | null;
|
|
353
|
+
wallets: SolanaWallet[];
|
|
354
|
+
isLoading: boolean;
|
|
355
|
+
error: string | null;
|
|
356
|
+
}
|
|
357
|
+
|
|
281
358
|
type RequestOptions = {
|
|
282
359
|
params?: Record<string, string | number>;
|
|
283
360
|
query?: Record<string, string | number | undefined>;
|
|
@@ -367,13 +444,32 @@ declare class SubscriptionService {
|
|
|
367
444
|
constructor(api: ApiClient);
|
|
368
445
|
subscribe(platform: PaymentPlatform, payload: NmiSubscribePayload | CCBillSubscribePayload): Promise<SubscriptionResponse>;
|
|
369
446
|
generateFlexFormUrl(payload: GenerateFlexFormURLBodyParams): Promise<FlexFormResponse>;
|
|
447
|
+
getPaymentHistory(params?: {
|
|
448
|
+
limit?: number;
|
|
449
|
+
offset?: number;
|
|
450
|
+
type?: string;
|
|
451
|
+
}): Promise<PaginatedPayments>;
|
|
452
|
+
cancelSubscription(feedback?: string): Promise<{
|
|
453
|
+
message: string;
|
|
454
|
+
success: boolean;
|
|
455
|
+
}>;
|
|
370
456
|
private serializePayload;
|
|
371
457
|
}
|
|
372
458
|
|
|
459
|
+
declare class SolanaWalletService {
|
|
460
|
+
private readonly api;
|
|
461
|
+
constructor(api: ApiClient);
|
|
462
|
+
list(): Promise<SolanaWallet[]>;
|
|
463
|
+
requestChallenge(wallet: string): Promise<WalletChallengeResponse>;
|
|
464
|
+
verify(wallet: string, signature: string, nonce?: string): Promise<VerifyWalletResponse>;
|
|
465
|
+
remove(wallet: string): Promise<void>;
|
|
466
|
+
}
|
|
467
|
+
|
|
373
468
|
interface PaymentServices {
|
|
374
469
|
cardPayments: CardPaymentService;
|
|
375
470
|
paymentMethods: PaymentMethodService;
|
|
376
471
|
solanaPayments: SolanaPaymentService;
|
|
472
|
+
solanaWallets: SolanaWalletService;
|
|
377
473
|
tokenCatalog: TokenCatalog;
|
|
378
474
|
walletGateway: WalletGateway;
|
|
379
475
|
subscriptions: SubscriptionService;
|
|
@@ -447,9 +543,9 @@ interface PaymentContextValue {
|
|
|
447
543
|
}
|
|
448
544
|
interface PaymentProviderProps {
|
|
449
545
|
config: PaymentConfig;
|
|
450
|
-
children: React.ReactNode;
|
|
546
|
+
children: React$1.ReactNode;
|
|
451
547
|
}
|
|
452
|
-
declare const PaymentProvider: React.FC<PaymentProviderProps>;
|
|
548
|
+
declare const PaymentProvider: React$1.FC<PaymentProviderProps>;
|
|
453
549
|
declare const usePaymentContext: () => PaymentContextValue;
|
|
454
550
|
|
|
455
551
|
interface CardDetailsFormProps {
|
|
@@ -464,7 +560,7 @@ interface CardDetailsFormProps {
|
|
|
464
560
|
onBillingChange?: (billing: BillingDetails) => void;
|
|
465
561
|
submitDisabled?: boolean;
|
|
466
562
|
}
|
|
467
|
-
declare const CardDetailsForm: React.FC<CardDetailsFormProps>;
|
|
563
|
+
declare const CardDetailsForm: React$1.FC<CardDetailsFormProps>;
|
|
468
564
|
|
|
469
565
|
interface StoredPaymentMethodsProps {
|
|
470
566
|
selectedMethodId?: string | null;
|
|
@@ -473,7 +569,7 @@ interface StoredPaymentMethodsProps {
|
|
|
473
569
|
heading?: string;
|
|
474
570
|
description?: string;
|
|
475
571
|
}
|
|
476
|
-
declare const StoredPaymentMethods: React.FC<StoredPaymentMethodsProps>;
|
|
572
|
+
declare const StoredPaymentMethods: React$1.FC<StoredPaymentMethodsProps>;
|
|
477
573
|
|
|
478
574
|
interface PaymentExperienceProps {
|
|
479
575
|
priceId: string;
|
|
@@ -489,11 +585,11 @@ interface PaymentExperienceProps {
|
|
|
489
585
|
enableNewCard?: boolean;
|
|
490
586
|
enableStoredMethods?: boolean;
|
|
491
587
|
enableSolanaPay?: boolean;
|
|
492
|
-
checkoutSummary?: React.ReactNode;
|
|
588
|
+
checkoutSummary?: React$1.ReactNode;
|
|
493
589
|
onSolanaSuccess?: (result: SubmitPaymentResponse | string) => void;
|
|
494
590
|
onSolanaError?: (error: string) => void;
|
|
495
591
|
}
|
|
496
|
-
declare const PaymentExperience: React.FC<PaymentExperienceProps>;
|
|
592
|
+
declare const PaymentExperience: React$1.FC<PaymentExperienceProps>;
|
|
497
593
|
|
|
498
594
|
interface SolanaPaymentSelectorProps {
|
|
499
595
|
isOpen: boolean;
|
|
@@ -503,7 +599,92 @@ interface SolanaPaymentSelectorProps {
|
|
|
503
599
|
onError?: (error: string) => void;
|
|
504
600
|
onSuccess: (result: SubmitPaymentResponse | string) => void;
|
|
505
601
|
}
|
|
506
|
-
declare const SolanaPaymentSelector: React.FC<SolanaPaymentSelectorProps>;
|
|
602
|
+
declare const SolanaPaymentSelector: React$1.FC<SolanaPaymentSelectorProps>;
|
|
603
|
+
|
|
604
|
+
interface BillingHistoryProps {
|
|
605
|
+
pageSize?: number;
|
|
606
|
+
initialPage?: number;
|
|
607
|
+
enableCancel?: boolean;
|
|
608
|
+
onNotify?: NotificationHandler;
|
|
609
|
+
}
|
|
610
|
+
declare const BillingHistory: React.FC<BillingHistoryProps>;
|
|
611
|
+
|
|
612
|
+
interface CancelMembershipDialogProps {
|
|
613
|
+
minReasonLength?: number;
|
|
614
|
+
onCancelled?: () => void;
|
|
615
|
+
onNotify?: NotificationHandler;
|
|
616
|
+
}
|
|
617
|
+
declare const CancelMembershipDialog: React.FC<CancelMembershipDialogProps>;
|
|
618
|
+
|
|
619
|
+
interface PaymentMethodsSectionProps {
|
|
620
|
+
isAuthenticated?: boolean;
|
|
621
|
+
userEmail?: string | null;
|
|
622
|
+
provider?: string;
|
|
623
|
+
defaultCountry?: string;
|
|
624
|
+
collectPrefix?: string;
|
|
625
|
+
onNotify?: NotificationHandler;
|
|
626
|
+
}
|
|
627
|
+
declare const PaymentMethodsSection: React.FC<PaymentMethodsSectionProps>;
|
|
628
|
+
|
|
629
|
+
interface SolanaWalletSectionProps {
|
|
630
|
+
onNotify?: NotificationHandler;
|
|
631
|
+
rpcUrl?: string;
|
|
632
|
+
}
|
|
633
|
+
declare const SolanaWalletSection: React.FC<SolanaWalletSectionProps>;
|
|
634
|
+
|
|
635
|
+
declare const WalletManagement: (props: SolanaWalletSectionProps) => react_jsx_runtime.JSX.Element;
|
|
636
|
+
|
|
637
|
+
interface WalletCardProps {
|
|
638
|
+
wallet: SolanaWallet;
|
|
639
|
+
isPrimary?: boolean;
|
|
640
|
+
isConnected?: boolean;
|
|
641
|
+
balance?: number | null;
|
|
642
|
+
onSetPrimary?: (walletId: string) => void;
|
|
643
|
+
onVerify?: (wallet: SolanaWallet) => void;
|
|
644
|
+
onDelete?: (walletId: string) => void;
|
|
645
|
+
isVerifying?: boolean;
|
|
646
|
+
isDeleting?: boolean;
|
|
647
|
+
notify?: NotificationHandler;
|
|
648
|
+
}
|
|
649
|
+
declare const WalletCard: React.FC<WalletCardProps>;
|
|
650
|
+
|
|
651
|
+
declare const EmptyWalletState: React.FC;
|
|
652
|
+
|
|
653
|
+
interface WalletModalProps {
|
|
654
|
+
open: boolean;
|
|
655
|
+
onOpenChange: (open: boolean) => void;
|
|
656
|
+
}
|
|
657
|
+
declare const WalletModal: React.FC<WalletModalProps>;
|
|
658
|
+
|
|
659
|
+
interface WalletDialogProps {
|
|
660
|
+
open: boolean;
|
|
661
|
+
onOpenChange: (open: boolean) => void;
|
|
662
|
+
}
|
|
663
|
+
declare const WalletDialog: React.FC<WalletDialogProps>;
|
|
664
|
+
|
|
665
|
+
interface SubscriptionCheckoutModalProps {
|
|
666
|
+
open: boolean;
|
|
667
|
+
onOpenChange: (open: boolean) => void;
|
|
668
|
+
priceId?: string | null;
|
|
669
|
+
usdAmount?: number;
|
|
670
|
+
planName?: string;
|
|
671
|
+
amountLabel?: string;
|
|
672
|
+
billingPeriodLabel?: string;
|
|
673
|
+
userEmail?: string | null;
|
|
674
|
+
provider?: string;
|
|
675
|
+
onSuccess?: () => void;
|
|
676
|
+
enableSolanaPay?: boolean;
|
|
677
|
+
}
|
|
678
|
+
declare const SubscriptionCheckoutModal: React$1.FC<SubscriptionCheckoutModalProps>;
|
|
679
|
+
|
|
680
|
+
interface SubscriptionSuccessDialogProps {
|
|
681
|
+
open: boolean;
|
|
682
|
+
planName?: string;
|
|
683
|
+
amountLabel?: string;
|
|
684
|
+
billingPeriodLabel?: string;
|
|
685
|
+
onClose: () => void;
|
|
686
|
+
}
|
|
687
|
+
declare const SubscriptionSuccessDialog: React$1.FC<SubscriptionSuccessDialogProps>;
|
|
507
688
|
|
|
508
689
|
declare const usePaymentMethods: () => {
|
|
509
690
|
listQuery: _tanstack_react_query.UseQueryResult<PaginatedPaymentMethods, Error>;
|
|
@@ -683,4 +864,58 @@ declare const useSubscriptionActions: () => {
|
|
|
683
864
|
generateFlexFormUrl: ({ priceId, firstName, lastName, address1, city, state, zipCode, country, }: GenerateFlexFormParams) => Promise<FlexFormResponse>;
|
|
684
865
|
};
|
|
685
866
|
|
|
686
|
-
|
|
867
|
+
interface FlexFormPayload {
|
|
868
|
+
priceId: string;
|
|
869
|
+
firstName: string;
|
|
870
|
+
lastName: string;
|
|
871
|
+
address1: string;
|
|
872
|
+
city: string;
|
|
873
|
+
state: string;
|
|
874
|
+
zipCode: string;
|
|
875
|
+
country: string;
|
|
876
|
+
}
|
|
877
|
+
declare const useAlternativePaymentProvider: () => {
|
|
878
|
+
openFlexForm: (payload: FlexFormPayload) => Promise<void>;
|
|
879
|
+
isLoading: boolean;
|
|
880
|
+
error: string | null;
|
|
881
|
+
};
|
|
882
|
+
|
|
883
|
+
interface UseWalletListOptions {
|
|
884
|
+
autoFetch?: boolean;
|
|
885
|
+
}
|
|
886
|
+
declare const useWalletList: (options?: UseWalletListOptions) => {
|
|
887
|
+
wallets: SolanaWallet[];
|
|
888
|
+
isLoading: boolean;
|
|
889
|
+
error: string | null;
|
|
890
|
+
fetchWallets: () => Promise<SolanaWallet[]>;
|
|
891
|
+
deleteWallet: (walletIdOrAddress: string) => Promise<void>;
|
|
892
|
+
addWallet: (wallet: SolanaWallet) => void;
|
|
893
|
+
updateWallet: (walletId: string, updates: Partial<SolanaWallet>) => void;
|
|
894
|
+
clearError: () => void;
|
|
895
|
+
findWalletByAddress: (address: string) => SolanaWallet | undefined;
|
|
896
|
+
getVerifiedWallets: () => SolanaWallet[];
|
|
897
|
+
hasVerifiedWallets: boolean;
|
|
898
|
+
totalWallets: number;
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
declare const useWalletVerification: () => {
|
|
902
|
+
signAndVerifyWallet: (walletAddress: string, message: string, nonce?: string) => Promise<VerifyWalletResponse>;
|
|
903
|
+
autoVerifyWallet: (walletAddress: string, message: string, nonce?: string) => Promise<VerifyWalletResponse | null>;
|
|
904
|
+
clearError: () => void;
|
|
905
|
+
resetVerification: () => void;
|
|
906
|
+
isVerifying: boolean;
|
|
907
|
+
isVerified: boolean;
|
|
908
|
+
error: string | null;
|
|
909
|
+
};
|
|
910
|
+
|
|
911
|
+
interface WalletConnectionResult extends WalletConnectionState {
|
|
912
|
+
walletName?: string;
|
|
913
|
+
walletIcon?: string;
|
|
914
|
+
connectWallet: () => Promise<void>;
|
|
915
|
+
disconnectWallet: () => Promise<void>;
|
|
916
|
+
connectWalletToBackend: (address: string) => Promise<WalletChallengeResponse>;
|
|
917
|
+
clearError: () => void;
|
|
918
|
+
}
|
|
919
|
+
declare const useWalletConnection: () => WalletConnectionResult;
|
|
920
|
+
|
|
921
|
+
export { type AsyncStatus, 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 PaymentState, type PaymentStatusPayload, type PaymentStatusResponse, type PaymentStep, type PaymentStoreOptions, type PaymentStoreState, type PaymentSuccessPayload, type PaymentUserDetails, type SolanaFlowConfig, type SolanaFlowState, type SolanaPayQRCodeIntent, type SolanaPayStatusResponse, type SolanaPayTransaction, type SolanaPaymentMethod, SolanaPaymentSelector, SolanaPaymentService, type SolanaWallet, SolanaWalletSection, type SolanaWalletSectionProps, SolanaWalletService, StoredPaymentMethods, type StoredPaymentMethodsProps, type SubmitPaymentRequest, type SubmitPaymentResponse, type SubscribeWithCCBillParams, type SubscribeWithCardParams, type SubscribeWithSavedMethodParams, SubscriptionCheckoutModal, 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, createPaymentStore, useAlternativePaymentProvider, useDirectWalletPayment, usePaymentContext, usePaymentMethodService, usePaymentMethods, usePaymentStatus, usePaymentStore, useSolanaDirectPayment, useSolanaQrPayment, useSolanaService, useSubscriptionActions, useSupportedTokens, useTokenBalance, useWalletConnection, useWalletList, useWalletVerification };
|