@varity-labs/ui-kit 2.0.0-beta.8 → 2.0.0-beta.9
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/components/Dashboard/DashboardHeader.js +4 -4
- package/dist/components/Dashboard/DashboardHeader.js.map +1 -1
- package/dist/components/Dashboard/DashboardLayout.d.ts +3 -3
- package/dist/components/Dashboard/DashboardLayout.d.ts.map +1 -1
- package/dist/components/Dashboard/DashboardLayout.js +1 -1
- package/dist/components/InAppWallet/EmailLoginButton.d.ts +27 -0
- package/dist/components/InAppWallet/EmailLoginButton.d.ts.map +1 -0
- package/dist/components/InAppWallet/EmailLoginButton.js +84 -0
- package/dist/components/InAppWallet/EmailLoginButton.js.map +1 -0
- package/dist/components/InAppWallet/InAppWalletProvider.d.ts +54 -0
- package/dist/components/InAppWallet/InAppWalletProvider.d.ts.map +1 -0
- package/dist/components/InAppWallet/InAppWalletProvider.js +225 -0
- package/dist/components/InAppWallet/InAppWalletProvider.js.map +1 -0
- package/dist/components/InAppWallet/OnboardingFlow.d.ts +25 -0
- package/dist/components/InAppWallet/OnboardingFlow.d.ts.map +1 -0
- package/dist/components/InAppWallet/OnboardingFlow.js +159 -0
- package/dist/components/InAppWallet/OnboardingFlow.js.map +1 -0
- package/dist/components/InAppWallet/SocialLoginButtons.d.ts +28 -0
- package/dist/components/InAppWallet/SocialLoginButtons.d.ts.map +1 -0
- package/dist/components/InAppWallet/SocialLoginButtons.js +128 -0
- package/dist/components/InAppWallet/SocialLoginButtons.js.map +1 -0
- package/dist/components/InAppWallet/index.d.ts +15 -0
- package/dist/components/InAppWallet/index.d.ts.map +1 -0
- package/dist/components/InAppWallet/index.js +14 -0
- package/dist/components/InAppWallet/index.js.map +1 -0
- package/dist/components/PaymentWidget/PaymentWidget.d.ts +19 -7
- package/dist/components/PaymentWidget/PaymentWidget.d.ts.map +1 -1
- package/dist/components/PaymentWidget/PaymentWidget.js +176 -10
- package/dist/components/PaymentWidget/PaymentWidget.js.map +1 -1
- package/dist/components/PaymentWidget/useSeamlessPayment.d.ts +34 -8
- package/dist/components/PaymentWidget/useSeamlessPayment.d.ts.map +1 -1
- package/dist/components/PaymentWidget/useSeamlessPayment.js +158 -12
- package/dist/components/PaymentWidget/useSeamlessPayment.js.map +1 -1
- package/dist/components/PaymentWidget/useVarityPayment.d.ts +6 -5
- package/dist/components/PaymentWidget/useVarityPayment.d.ts.map +1 -1
- package/dist/components/PaymentWidget/useVarityPayment.js +147 -11
- package/dist/components/PaymentWidget/useVarityPayment.js.map +1 -1
- package/dist/components/Payments/CheckoutModal.d.ts +19 -0
- package/dist/components/Payments/CheckoutModal.d.ts.map +1 -0
- package/dist/components/Payments/CheckoutModal.js +194 -0
- package/dist/components/Payments/CheckoutModal.js.map +1 -0
- package/dist/components/Payments/SubscriptionWidget.d.ts +17 -0
- package/dist/components/Payments/SubscriptionWidget.d.ts.map +1 -0
- package/dist/components/Payments/SubscriptionWidget.js +89 -0
- package/dist/components/Payments/SubscriptionWidget.js.map +1 -0
- package/dist/components/Payments/constants.d.ts +59 -0
- package/dist/components/Payments/constants.d.ts.map +1 -0
- package/dist/components/Payments/constants.js +145 -0
- package/dist/components/Payments/constants.js.map +1 -0
- package/dist/components/Payments/index.d.ts +10 -0
- package/dist/components/Payments/index.d.ts.map +1 -0
- package/dist/components/Payments/index.js +12 -0
- package/dist/components/Payments/index.js.map +1 -0
- package/dist/components/Payments/types.d.ts +119 -0
- package/dist/components/Payments/types.d.ts.map +1 -0
- package/dist/components/Payments/types.js +27 -0
- package/dist/components/Payments/types.js.map +1 -0
- package/dist/components/Payments/usePayments.d.ts +33 -0
- package/dist/components/Payments/usePayments.d.ts.map +1 -0
- package/dist/components/Payments/usePayments.js +249 -0
- package/dist/components/Payments/usePayments.js.map +1 -0
- package/dist/components/SIWE/AuthStatus.d.ts +15 -0
- package/dist/components/SIWE/AuthStatus.d.ts.map +1 -0
- package/dist/components/SIWE/AuthStatus.js +47 -0
- package/dist/components/SIWE/AuthStatus.js.map +1 -0
- package/dist/components/SIWE/ProtectedRoute.d.ts +17 -0
- package/dist/components/SIWE/ProtectedRoute.d.ts.map +1 -0
- package/dist/components/SIWE/ProtectedRoute.js +52 -0
- package/dist/components/SIWE/ProtectedRoute.js.map +1 -0
- package/dist/components/SIWE/SIWEButton.d.ts +22 -0
- package/dist/components/SIWE/SIWEButton.d.ts.map +1 -0
- package/dist/components/SIWE/SIWEButton.js +106 -0
- package/dist/components/SIWE/SIWEButton.js.map +1 -0
- package/dist/components/SIWE/SIWEModal.d.ts +19 -0
- package/dist/components/SIWE/SIWEModal.d.ts.map +1 -0
- package/dist/components/SIWE/SIWEModal.js +75 -0
- package/dist/components/SIWE/SIWEModal.js.map +1 -0
- package/dist/components/SIWE/SIWEProvider.d.ts +38 -0
- package/dist/components/SIWE/SIWEProvider.d.ts.map +1 -0
- package/dist/components/SIWE/SIWEProvider.js +227 -0
- package/dist/components/SIWE/SIWEProvider.js.map +1 -0
- package/dist/components/SIWE/index.d.ts +15 -0
- package/dist/components/SIWE/index.d.ts.map +1 -0
- package/dist/components/SIWE/index.js +10 -0
- package/dist/components/SIWE/index.js.map +1 -0
- package/dist/hooks/web3/index.d.ts +5 -0
- package/dist/hooks/web3/index.d.ts.map +1 -0
- package/dist/hooks/web3/index.js +6 -0
- package/dist/hooks/web3/index.js.map +1 -0
- package/dist/hooks/web3/useAddressValidation.d.ts +37 -0
- package/dist/hooks/web3/useAddressValidation.d.ts.map +1 -0
- package/dist/hooks/web3/useAddressValidation.js +59 -0
- package/dist/hooks/web3/useAddressValidation.js.map +1 -0
- package/dist/hooks/web3/useBlockExplorer.d.ts +37 -0
- package/dist/hooks/web3/useBlockExplorer.d.ts.map +1 -0
- package/dist/hooks/web3/useBlockExplorer.js +59 -0
- package/dist/hooks/web3/useBlockExplorer.js.map +1 -0
- package/dist/hooks/web3/useUSDCFormat.d.ts +34 -0
- package/dist/hooks/web3/useUSDCFormat.d.ts.map +1 -0
- package/dist/hooks/web3/useUSDCFormat.js +43 -0
- package/dist/hooks/web3/useUSDCFormat.js.map +1 -0
- package/dist/hooks/web3/useVarityWallet.d.ts +48 -0
- package/dist/hooks/web3/useVarityWallet.d.ts.map +1 -0
- package/dist/hooks/web3/useVarityWallet.js +70 -0
- package/dist/hooks/web3/useVarityWallet.js.map +1 -0
- package/dist/providers/ChainContext.d.ts +65 -0
- package/dist/providers/ChainContext.d.ts.map +1 -0
- package/dist/providers/ChainContext.js +92 -0
- package/dist/providers/ChainContext.js.map +1 -0
- package/dist/providers/PrivyStack.d.ts +17 -50
- package/dist/providers/PrivyStack.d.ts.map +1 -1
- package/dist/providers/PrivyStack.js +15 -43
- package/dist/providers/PrivyStack.js.map +1 -1
- package/dist/providers/VarityDashboardProvider.d.ts +2 -2
- package/dist/providers/VarityDashboardProvider.d.ts.map +1 -1
- package/dist/providers/VarityDashboardProvider.js +26 -3
- package/dist/providers/VarityDashboardProvider.js.map +1 -1
- package/dist/providers/VarityProvider.d.ts +32 -0
- package/dist/providers/VarityProvider.d.ts.map +1 -0
- package/dist/providers/VarityProvider.js +56 -0
- package/dist/providers/VarityProvider.js.map +1 -0
- package/dist/providers/WalletContext.d.ts +68 -0
- package/dist/providers/WalletContext.d.ts.map +1 -0
- package/dist/providers/WalletContext.js +98 -0
- package/dist/providers/WalletContext.js.map +1 -0
- package/dist/providers/WalletSyncProvider.d.ts +15 -18
- package/dist/providers/WalletSyncProvider.d.ts.map +1 -1
- package/dist/providers/WalletSyncProvider.js +12 -15
- package/dist/providers/WalletSyncProvider.js.map +1 -1
- package/dist/providers/index.d.ts +48 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +53 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/wallets/SimpleSmartWallet.d.ts +68 -0
- package/dist/wallets/SimpleSmartWallet.d.ts.map +1 -0
- package/dist/wallets/SimpleSmartWallet.js +74 -0
- package/dist/wallets/SimpleSmartWallet.js.map +1 -0
- package/dist/wallets/SmartWalletProvider.d.ts +217 -0
- package/dist/wallets/SmartWalletProvider.d.ts.map +1 -0
- package/dist/wallets/SmartWalletProvider.js +366 -0
- package/dist/wallets/SmartWalletProvider.js.map +1 -0
- package/dist/wallets/config.d.ts +222 -0
- package/dist/wallets/config.d.ts.map +1 -0
- package/dist/wallets/config.js +206 -0
- package/dist/wallets/config.js.map +1 -0
- package/dist/wallets/index.d.ts +9 -0
- package/dist/wallets/index.d.ts.map +1 -0
- package/dist/wallets/index.js +9 -0
- package/dist/wallets/index.js.map +1 -0
- package/dist/web3/AddressDisplay/AddressDisplay.d.ts +33 -0
- package/dist/web3/AddressDisplay/AddressDisplay.d.ts.map +1 -0
- package/dist/web3/AddressDisplay/AddressDisplay.js +42 -0
- package/dist/web3/AddressDisplay/AddressDisplay.js.map +1 -0
- package/dist/web3/AddressInput/AddressInput.d.ts +36 -0
- package/dist/web3/AddressInput/AddressInput.d.ts.map +1 -0
- package/dist/web3/AddressInput/AddressInput.js +54 -0
- package/dist/web3/AddressInput/AddressInput.js.map +1 -0
- package/dist/web3/AmountInput/AmountInput.d.ts +41 -0
- package/dist/web3/AmountInput/AmountInput.d.ts.map +1 -0
- package/dist/web3/AmountInput/AmountInput.js +74 -0
- package/dist/web3/AmountInput/AmountInput.js.map +1 -0
- package/dist/web3/BalanceDisplay/BalanceDisplay.d.ts +30 -0
- package/dist/web3/BalanceDisplay/BalanceDisplay.d.ts.map +1 -0
- package/dist/web3/BalanceDisplay/BalanceDisplay.js +35 -0
- package/dist/web3/BalanceDisplay/BalanceDisplay.js.map +1 -0
- package/dist/web3/BlockExplorerLink/BlockExplorerLink.d.ts +41 -0
- package/dist/web3/BlockExplorerLink/BlockExplorerLink.d.ts.map +1 -0
- package/dist/web3/BlockExplorerLink/BlockExplorerLink.js +46 -0
- package/dist/web3/BlockExplorerLink/BlockExplorerLink.js.map +1 -0
- package/dist/web3/ConnectWallet/ConnectWallet.d.ts +35 -0
- package/dist/web3/ConnectWallet/ConnectWallet.d.ts.map +1 -0
- package/dist/web3/ConnectWallet/ConnectWallet.js +58 -0
- package/dist/web3/ConnectWallet/ConnectWallet.js.map +1 -0
- package/dist/web3/DisconnectButton/DisconnectButton.d.ts +30 -0
- package/dist/web3/DisconnectButton/DisconnectButton.d.ts.map +1 -0
- package/dist/web3/DisconnectButton/DisconnectButton.js +48 -0
- package/dist/web3/DisconnectButton/DisconnectButton.js.map +1 -0
- package/dist/web3/WalletBalance/WalletBalance.d.ts +27 -0
- package/dist/web3/WalletBalance/WalletBalance.d.ts.map +1 -0
- package/dist/web3/WalletBalance/WalletBalance.js +49 -0
- package/dist/web3/WalletBalance/WalletBalance.js.map +1 -0
- package/dist/web3/WalletDropdown/WalletDropdown.d.ts +29 -0
- package/dist/web3/WalletDropdown/WalletDropdown.d.ts.map +1 -0
- package/dist/web3/WalletDropdown/WalletDropdown.js +93 -0
- package/dist/web3/WalletDropdown/WalletDropdown.js.map +1 -0
- package/dist/web3/WalletInfo/WalletInfo.d.ts +31 -0
- package/dist/web3/WalletInfo/WalletInfo.d.ts.map +1 -0
- package/dist/web3/WalletInfo/WalletInfo.js +41 -0
- package/dist/web3/WalletInfo/WalletInfo.js.map +1 -0
- package/dist/web3/index.d.ts +11 -0
- package/dist/web3/index.d.ts.map +1 -0
- package/dist/web3/index.js +14 -0
- package/dist/web3/index.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment Constants
|
|
3
|
+
* Subscription plans, pricing, and USDC configuration
|
|
4
|
+
*/
|
|
5
|
+
import { SubscriptionTier } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Varity L3 Chain Configuration
|
|
8
|
+
*/
|
|
9
|
+
export const VARITY_L3_CHAIN_ID = 33529;
|
|
10
|
+
export const USDC_CONTRACT_ADDRESS = '0x6Fd8ee6B4C2193e9E2e0E2EC5D295689B607c0cE'; // Bridged USDC on Varity L3 (chain 33529)
|
|
11
|
+
export const USDC_DECIMALS = 6;
|
|
12
|
+
/**
|
|
13
|
+
* Subscription Plans
|
|
14
|
+
* Prices in USDC (with 6 decimals)
|
|
15
|
+
*/
|
|
16
|
+
export const SUBSCRIPTION_PLANS = [
|
|
17
|
+
{
|
|
18
|
+
id: 'basic',
|
|
19
|
+
tier: SubscriptionTier.BASIC,
|
|
20
|
+
name: 'Basic',
|
|
21
|
+
description: 'Perfect for small businesses getting started',
|
|
22
|
+
price: 99_000000, // $99 USDC (6 decimals)
|
|
23
|
+
priceDisplay: '$99/month',
|
|
24
|
+
features: [
|
|
25
|
+
'1 AI Dashboard',
|
|
26
|
+
'Up to 5 users',
|
|
27
|
+
'10 GB storage',
|
|
28
|
+
'Community support',
|
|
29
|
+
'Basic analytics',
|
|
30
|
+
'Email notifications',
|
|
31
|
+
],
|
|
32
|
+
maxUsers: 5,
|
|
33
|
+
maxDashboards: 1,
|
|
34
|
+
maxStorage: 10,
|
|
35
|
+
supportLevel: 'community',
|
|
36
|
+
isPopular: false,
|
|
37
|
+
isRecommended: false,
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'professional',
|
|
41
|
+
tier: SubscriptionTier.PROFESSIONAL,
|
|
42
|
+
name: 'Professional',
|
|
43
|
+
description: 'Advanced features for growing businesses',
|
|
44
|
+
price: 499_000000, // $499 USDC (6 decimals)
|
|
45
|
+
priceDisplay: '$499/month',
|
|
46
|
+
features: [
|
|
47
|
+
'Up to 5 AI Dashboards',
|
|
48
|
+
'Up to 25 users',
|
|
49
|
+
'100 GB storage',
|
|
50
|
+
'Priority email support',
|
|
51
|
+
'Advanced analytics',
|
|
52
|
+
'Custom integrations',
|
|
53
|
+
'API access',
|
|
54
|
+
'White-label branding',
|
|
55
|
+
],
|
|
56
|
+
maxUsers: 25,
|
|
57
|
+
maxDashboards: 5,
|
|
58
|
+
maxStorage: 100,
|
|
59
|
+
supportLevel: 'priority',
|
|
60
|
+
isPopular: true,
|
|
61
|
+
isRecommended: true,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 'enterprise',
|
|
65
|
+
tier: SubscriptionTier.ENTERPRISE,
|
|
66
|
+
name: 'Enterprise',
|
|
67
|
+
description: 'Full-featured solution for large organizations',
|
|
68
|
+
price: 2999_000000, // $2,999 USDC (6 decimals)
|
|
69
|
+
priceDisplay: '$2,999/month',
|
|
70
|
+
features: [
|
|
71
|
+
'Unlimited AI Dashboards',
|
|
72
|
+
'Unlimited users',
|
|
73
|
+
'Unlimited storage',
|
|
74
|
+
'Dedicated support manager',
|
|
75
|
+
'Enterprise analytics',
|
|
76
|
+
'Custom development',
|
|
77
|
+
'SLA guarantee (99.99%)',
|
|
78
|
+
'Full white-label',
|
|
79
|
+
'On-premise deployment',
|
|
80
|
+
'Custom contracts',
|
|
81
|
+
],
|
|
82
|
+
maxUsers: undefined,
|
|
83
|
+
maxDashboards: undefined,
|
|
84
|
+
maxStorage: undefined,
|
|
85
|
+
supportLevel: 'dedicated',
|
|
86
|
+
isPopular: false,
|
|
87
|
+
isRecommended: false,
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
/**
|
|
91
|
+
* Get subscription plan by ID
|
|
92
|
+
*/
|
|
93
|
+
export function getSubscriptionPlan(planId) {
|
|
94
|
+
return SUBSCRIPTION_PLANS.find(plan => plan.id === planId);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get subscription plan by tier
|
|
98
|
+
*/
|
|
99
|
+
export function getSubscriptionPlanByTier(tier) {
|
|
100
|
+
return SUBSCRIPTION_PLANS.find(plan => plan.tier === tier);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Format USDC amount for display
|
|
104
|
+
* Converts from 6 decimal representation to human-readable
|
|
105
|
+
*/
|
|
106
|
+
export function formatUSDC(amount) {
|
|
107
|
+
return `$${(amount / 1_000000).toLocaleString('en-US', {
|
|
108
|
+
minimumFractionDigits: 2,
|
|
109
|
+
maximumFractionDigits: 2,
|
|
110
|
+
})}`;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Convert human amount to USDC contract amount
|
|
114
|
+
* e.g., 99 -> 99_000000 (6 decimals)
|
|
115
|
+
*/
|
|
116
|
+
export function toUSDCAmount(humanAmount) {
|
|
117
|
+
return Math.floor(humanAmount * 1_000000);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Convert USDC contract amount to human amount
|
|
121
|
+
* e.g., 99_000000 -> 99
|
|
122
|
+
*/
|
|
123
|
+
export function fromUSDCAmount(contractAmount) {
|
|
124
|
+
return contractAmount / 1_000000;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Payment API Endpoints
|
|
128
|
+
*/
|
|
129
|
+
export const PAYMENT_ENDPOINTS = {
|
|
130
|
+
CREATE_CHECKOUT: '/api/v1/payments/checkout',
|
|
131
|
+
GET_SUBSCRIPTION: '/api/v1/payments/subscription',
|
|
132
|
+
CANCEL_SUBSCRIPTION: '/api/v1/payments/subscription/cancel',
|
|
133
|
+
RESUME_SUBSCRIPTION: '/api/v1/payments/subscription/resume',
|
|
134
|
+
UPGRADE_SUBSCRIPTION: '/api/v1/payments/subscription/upgrade',
|
|
135
|
+
DOWNGRADE_SUBSCRIPTION: '/api/v1/payments/subscription/downgrade',
|
|
136
|
+
GET_INVOICES: '/api/v1/payments/invoices',
|
|
137
|
+
GET_USAGE: '/api/v1/payments/usage',
|
|
138
|
+
WEBHOOK: '/api/v1/webhooks/payments',
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Trial Period Configuration
|
|
142
|
+
*/
|
|
143
|
+
export const TRIAL_PERIOD_DAYS = 14;
|
|
144
|
+
export const TRIAL_ENABLED = true;
|
|
145
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/components/Payments/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAoB,gBAAgB,EAAE,MAAM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AM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,eAAe,EAAE,2BAA2B;IAC5C,gBAAgB,EAAE,+BAA+B;IACjD,mBAAmB,EAAE,sCAAsC;IAC3D,mBAAmB,EAAE,sCAAsC;IAC3D,oBAAoB,EAAE,uCAAuC;IAC7D,sBAAsB,EAAE,yCAAyC;IACjE,YAAY,EAAE,2BAA2B;IACzC,SAAS,EAAE,wBAAwB;IACnC,OAAO,EAAE,2BAA2B;CACrC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payments Components
|
|
3
|
+
* Subscription and payment management for Varity L3
|
|
4
|
+
*/
|
|
5
|
+
export { SubscriptionWidget } from './SubscriptionWidget';
|
|
6
|
+
export { CheckoutModal } from './CheckoutModal';
|
|
7
|
+
export { usePayments } from './usePayments';
|
|
8
|
+
export * from './types';
|
|
9
|
+
export * from './constants';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Payments/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,cAAc,SAAS,CAAC;AAGxB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payments Components
|
|
3
|
+
* Subscription and payment management for Varity L3
|
|
4
|
+
*/
|
|
5
|
+
export { SubscriptionWidget } from './SubscriptionWidget';
|
|
6
|
+
export { CheckoutModal } from './CheckoutModal';
|
|
7
|
+
export { usePayments } from './usePayments';
|
|
8
|
+
// Export types
|
|
9
|
+
export * from './types';
|
|
10
|
+
// Export constants
|
|
11
|
+
export * from './constants';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Payments/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,eAAe;AACf,cAAc,SAAS,CAAC;AAExB,mBAAmB;AACnB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment Types
|
|
3
|
+
* Type definitions for Varity payment and subscription system
|
|
4
|
+
*/
|
|
5
|
+
export declare enum SubscriptionTier {
|
|
6
|
+
BASIC = "basic",
|
|
7
|
+
PROFESSIONAL = "professional",
|
|
8
|
+
ENTERPRISE = "enterprise"
|
|
9
|
+
}
|
|
10
|
+
export declare enum SubscriptionStatus {
|
|
11
|
+
ACTIVE = "active",
|
|
12
|
+
INACTIVE = "inactive",
|
|
13
|
+
PAST_DUE = "past_due",
|
|
14
|
+
CANCELED = "canceled",
|
|
15
|
+
TRIALING = "trialing"
|
|
16
|
+
}
|
|
17
|
+
export declare enum PaymentStatus {
|
|
18
|
+
PENDING = "pending",
|
|
19
|
+
PROCESSING = "processing",
|
|
20
|
+
COMPLETED = "completed",
|
|
21
|
+
FAILED = "failed",
|
|
22
|
+
REFUNDED = "refunded"
|
|
23
|
+
}
|
|
24
|
+
export interface SubscriptionPlan {
|
|
25
|
+
id: string;
|
|
26
|
+
tier: SubscriptionTier;
|
|
27
|
+
name: string;
|
|
28
|
+
description: string;
|
|
29
|
+
price: number;
|
|
30
|
+
priceDisplay: string;
|
|
31
|
+
features: string[];
|
|
32
|
+
maxUsers?: number;
|
|
33
|
+
maxDashboards?: number;
|
|
34
|
+
maxStorage?: number;
|
|
35
|
+
supportLevel: 'community' | 'email' | 'priority' | 'dedicated';
|
|
36
|
+
isPopular?: boolean;
|
|
37
|
+
isRecommended?: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface UserSubscription {
|
|
40
|
+
id: string;
|
|
41
|
+
userId: string;
|
|
42
|
+
walletAddress: string;
|
|
43
|
+
planId: string;
|
|
44
|
+
tier: SubscriptionTier;
|
|
45
|
+
status: SubscriptionStatus;
|
|
46
|
+
currentPeriodStart: Date;
|
|
47
|
+
currentPeriodEnd: Date;
|
|
48
|
+
cancelAtPeriodEnd: boolean;
|
|
49
|
+
trialEnd?: Date;
|
|
50
|
+
createdAt: Date;
|
|
51
|
+
updatedAt: Date;
|
|
52
|
+
}
|
|
53
|
+
export interface Payment {
|
|
54
|
+
id: string;
|
|
55
|
+
userId: string;
|
|
56
|
+
walletAddress: string;
|
|
57
|
+
subscriptionId?: string;
|
|
58
|
+
amount: number;
|
|
59
|
+
currency: 'USDC';
|
|
60
|
+
status: PaymentStatus;
|
|
61
|
+
transactionHash?: string;
|
|
62
|
+
invoiceId?: string;
|
|
63
|
+
description: string;
|
|
64
|
+
createdAt: Date;
|
|
65
|
+
completedAt?: Date;
|
|
66
|
+
failedAt?: Date;
|
|
67
|
+
failureReason?: string;
|
|
68
|
+
}
|
|
69
|
+
export interface Invoice {
|
|
70
|
+
id: string;
|
|
71
|
+
userId: string;
|
|
72
|
+
subscriptionId: string;
|
|
73
|
+
amount: number;
|
|
74
|
+
currency: 'USDC';
|
|
75
|
+
status: 'draft' | 'open' | 'paid' | 'void';
|
|
76
|
+
invoiceNumber: string;
|
|
77
|
+
invoiceDate: Date;
|
|
78
|
+
dueDate: Date;
|
|
79
|
+
paidDate?: Date;
|
|
80
|
+
items: InvoiceItem[];
|
|
81
|
+
downloadUrl?: string;
|
|
82
|
+
}
|
|
83
|
+
export interface InvoiceItem {
|
|
84
|
+
description: string;
|
|
85
|
+
quantity: number;
|
|
86
|
+
unitPrice: number;
|
|
87
|
+
amount: number;
|
|
88
|
+
}
|
|
89
|
+
export interface UsageMetrics {
|
|
90
|
+
userId: string;
|
|
91
|
+
period: 'current' | 'previous';
|
|
92
|
+
dashboardViews: number;
|
|
93
|
+
apiCalls: number;
|
|
94
|
+
storageUsed: number;
|
|
95
|
+
activeUsers: number;
|
|
96
|
+
billingCycle: 'monthly' | 'annual';
|
|
97
|
+
}
|
|
98
|
+
export interface PaymentMethod {
|
|
99
|
+
id: string;
|
|
100
|
+
type: 'wallet' | 'usdc_allowance';
|
|
101
|
+
walletAddress: string;
|
|
102
|
+
chainId: number;
|
|
103
|
+
isDefault: boolean;
|
|
104
|
+
createdAt: Date;
|
|
105
|
+
}
|
|
106
|
+
export interface CheckoutSession {
|
|
107
|
+
id: string;
|
|
108
|
+
planId: string;
|
|
109
|
+
userId: string;
|
|
110
|
+
walletAddress: string;
|
|
111
|
+
amount: number;
|
|
112
|
+
currency: 'USDC';
|
|
113
|
+
status: 'pending' | 'completed' | 'failed';
|
|
114
|
+
createdAt: Date;
|
|
115
|
+
expiresAt: Date;
|
|
116
|
+
successUrl?: string;
|
|
117
|
+
cancelUrl?: string;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Payments/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAY,gBAAgB;IAC1B,KAAK,UAAU;IACf,YAAY,iBAAiB;IAC7B,UAAU,eAAe;CAC1B;AAED,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,QAAQ,aAAa;CACtB;AAED,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,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CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment Types
|
|
3
|
+
* Type definitions for Varity payment and subscription system
|
|
4
|
+
*/
|
|
5
|
+
export var SubscriptionTier;
|
|
6
|
+
(function (SubscriptionTier) {
|
|
7
|
+
SubscriptionTier["BASIC"] = "basic";
|
|
8
|
+
SubscriptionTier["PROFESSIONAL"] = "professional";
|
|
9
|
+
SubscriptionTier["ENTERPRISE"] = "enterprise";
|
|
10
|
+
})(SubscriptionTier || (SubscriptionTier = {}));
|
|
11
|
+
export var SubscriptionStatus;
|
|
12
|
+
(function (SubscriptionStatus) {
|
|
13
|
+
SubscriptionStatus["ACTIVE"] = "active";
|
|
14
|
+
SubscriptionStatus["INACTIVE"] = "inactive";
|
|
15
|
+
SubscriptionStatus["PAST_DUE"] = "past_due";
|
|
16
|
+
SubscriptionStatus["CANCELED"] = "canceled";
|
|
17
|
+
SubscriptionStatus["TRIALING"] = "trialing";
|
|
18
|
+
})(SubscriptionStatus || (SubscriptionStatus = {}));
|
|
19
|
+
export var PaymentStatus;
|
|
20
|
+
(function (PaymentStatus) {
|
|
21
|
+
PaymentStatus["PENDING"] = "pending";
|
|
22
|
+
PaymentStatus["PROCESSING"] = "processing";
|
|
23
|
+
PaymentStatus["COMPLETED"] = "completed";
|
|
24
|
+
PaymentStatus["FAILED"] = "failed";
|
|
25
|
+
PaymentStatus["REFUNDED"] = "refunded";
|
|
26
|
+
})(PaymentStatus || (PaymentStatus = {}));
|
|
27
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/components/Payments/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAN,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,mCAAe,CAAA;IACf,iDAA6B,CAAA;IAC7B,6CAAyB,CAAA;AAC3B,CAAC,EAJW,gBAAgB,KAAhB,gBAAgB,QAI3B;AAED,MAAM,CAAN,IAAY,kBAMX;AAND,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,2CAAqB,CAAA;IACrB,2CAAqB,CAAA;IACrB,2CAAqB,CAAA;IACrB,2CAAqB,CAAA;AACvB,CAAC,EANW,kBAAkB,KAAlB,kBAAkB,QAM7B;AAED,MAAM,CAAN,IAAY,aAMX;AAND,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,0CAAyB,CAAA;IACzB,wCAAuB,CAAA;IACvB,kCAAiB,CAAA;IACjB,sCAAqB,CAAA;AACvB,CAAC,EANW,aAAa,KAAb,aAAa,QAMxB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { UserSubscription, Payment, Invoice, UsageMetrics, SubscriptionTier } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Payments Hook
|
|
4
|
+
* Provides subscription and payment management functionality
|
|
5
|
+
*/
|
|
6
|
+
interface UsePaymentsProps {
|
|
7
|
+
apiUrl: string;
|
|
8
|
+
}
|
|
9
|
+
interface UsePaymentsReturn {
|
|
10
|
+
subscription: UserSubscription | null;
|
|
11
|
+
isLoadingSubscription: boolean;
|
|
12
|
+
subscriptionError: string | null;
|
|
13
|
+
payments: Payment[];
|
|
14
|
+
isLoadingPayments: boolean;
|
|
15
|
+
paymentsError: string | null;
|
|
16
|
+
invoices: Invoice[];
|
|
17
|
+
isLoadingInvoices: boolean;
|
|
18
|
+
invoicesError: string | null;
|
|
19
|
+
usage: UsageMetrics | null;
|
|
20
|
+
isLoadingUsage: boolean;
|
|
21
|
+
usageError: string | null;
|
|
22
|
+
fetchSubscription: () => Promise<void>;
|
|
23
|
+
fetchPayments: () => Promise<void>;
|
|
24
|
+
fetchInvoices: () => Promise<void>;
|
|
25
|
+
fetchUsage: () => Promise<void>;
|
|
26
|
+
cancelSubscription: () => Promise<void>;
|
|
27
|
+
resumeSubscription: () => Promise<void>;
|
|
28
|
+
upgradeSubscription: (newTier: SubscriptionTier) => Promise<void>;
|
|
29
|
+
downgradeSubscription: (newTier: SubscriptionTier) => Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export declare const usePayments: ({ apiUrl }: UsePaymentsProps) => UsePaymentsReturn;
|
|
32
|
+
export default usePayments;
|
|
33
|
+
//# sourceMappingURL=usePayments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePayments.d.ts","sourceRoot":"","sources":["../../../src/components/Payments/usePayments.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,YAAY,EAEZ,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAGjB;;;GAGG;AAEH,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,iBAAiB;IAEzB,YAAY,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACtC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAGjC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAG7B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAG7B,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,iBAAiB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,aAAa,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,kBAAkB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,kBAAkB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,mBAAmB,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAClE,qBAAqB,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrE;AAED,eAAO,MAAM,WAAW,GAAI,YAAY,gBAAgB,KAAG,iBAiQ1D,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { useState, useEffect, useCallback } from 'react';
|
|
2
|
+
import axios from 'axios';
|
|
3
|
+
import { useSIWE } from '../SIWE/SIWEProvider';
|
|
4
|
+
import { PAYMENT_ENDPOINTS } from './constants';
|
|
5
|
+
export const usePayments = ({ apiUrl }) => {
|
|
6
|
+
const { isAuthenticated, accessToken, user } = useSIWE();
|
|
7
|
+
// State
|
|
8
|
+
const [subscription, setSubscription] = useState(null);
|
|
9
|
+
const [isLoadingSubscription, setIsLoadingSubscription] = useState(false);
|
|
10
|
+
const [subscriptionError, setSubscriptionError] = useState(null);
|
|
11
|
+
const [payments, setPayments] = useState([]);
|
|
12
|
+
const [isLoadingPayments, setIsLoadingPayments] = useState(false);
|
|
13
|
+
const [paymentsError, setPaymentsError] = useState(null);
|
|
14
|
+
const [invoices, setInvoices] = useState([]);
|
|
15
|
+
const [isLoadingInvoices, setIsLoadingInvoices] = useState(false);
|
|
16
|
+
const [invoicesError, setInvoicesError] = useState(null);
|
|
17
|
+
const [usage, setUsage] = useState(null);
|
|
18
|
+
const [isLoadingUsage, setIsLoadingUsage] = useState(false);
|
|
19
|
+
const [usageError, setUsageError] = useState(null);
|
|
20
|
+
// API client
|
|
21
|
+
const apiClient = axios.create({
|
|
22
|
+
baseURL: apiUrl,
|
|
23
|
+
headers: accessToken ? { Authorization: `Bearer ${accessToken}` } : {},
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Fetch current subscription
|
|
27
|
+
*/
|
|
28
|
+
const fetchSubscription = useCallback(async () => {
|
|
29
|
+
if (!isAuthenticated || !user)
|
|
30
|
+
return;
|
|
31
|
+
try {
|
|
32
|
+
setIsLoadingSubscription(true);
|
|
33
|
+
setSubscriptionError(null);
|
|
34
|
+
const response = await apiClient.get(PAYMENT_ENDPOINTS.GET_SUBSCRIPTION);
|
|
35
|
+
setSubscription(response.data.data);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
const axiosError = error;
|
|
39
|
+
const errorMessage = axiosError.response?.data?.message || 'Failed to fetch subscription';
|
|
40
|
+
setSubscriptionError(errorMessage);
|
|
41
|
+
console.error('Fetch subscription error:', error);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
setIsLoadingSubscription(false);
|
|
45
|
+
}
|
|
46
|
+
}, [isAuthenticated, user, apiClient]);
|
|
47
|
+
/**
|
|
48
|
+
* Fetch payment history
|
|
49
|
+
*/
|
|
50
|
+
const fetchPayments = useCallback(async () => {
|
|
51
|
+
if (!isAuthenticated || !user)
|
|
52
|
+
return;
|
|
53
|
+
try {
|
|
54
|
+
setIsLoadingPayments(true);
|
|
55
|
+
setPaymentsError(null);
|
|
56
|
+
const response = await apiClient.get('/api/v1/payments/history');
|
|
57
|
+
setPayments(response.data.data);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
const axiosError = error;
|
|
61
|
+
const errorMessage = axiosError.response?.data?.message || 'Failed to fetch payments';
|
|
62
|
+
setPaymentsError(errorMessage);
|
|
63
|
+
console.error('Fetch payments error:', error);
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
setIsLoadingPayments(false);
|
|
67
|
+
}
|
|
68
|
+
}, [isAuthenticated, user, apiClient]);
|
|
69
|
+
/**
|
|
70
|
+
* Fetch invoices
|
|
71
|
+
*/
|
|
72
|
+
const fetchInvoices = useCallback(async () => {
|
|
73
|
+
if (!isAuthenticated || !user)
|
|
74
|
+
return;
|
|
75
|
+
try {
|
|
76
|
+
setIsLoadingInvoices(true);
|
|
77
|
+
setInvoicesError(null);
|
|
78
|
+
const response = await apiClient.get(PAYMENT_ENDPOINTS.GET_INVOICES);
|
|
79
|
+
setInvoices(response.data.data);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
const axiosError = error;
|
|
83
|
+
const errorMessage = axiosError.response?.data?.message || 'Failed to fetch invoices';
|
|
84
|
+
setInvoicesError(errorMessage);
|
|
85
|
+
console.error('Fetch invoices error:', error);
|
|
86
|
+
}
|
|
87
|
+
finally {
|
|
88
|
+
setIsLoadingInvoices(false);
|
|
89
|
+
}
|
|
90
|
+
}, [isAuthenticated, user, apiClient]);
|
|
91
|
+
/**
|
|
92
|
+
* Fetch usage metrics
|
|
93
|
+
*/
|
|
94
|
+
const fetchUsage = useCallback(async () => {
|
|
95
|
+
if (!isAuthenticated || !user)
|
|
96
|
+
return;
|
|
97
|
+
try {
|
|
98
|
+
setIsLoadingUsage(true);
|
|
99
|
+
setUsageError(null);
|
|
100
|
+
const response = await apiClient.get(PAYMENT_ENDPOINTS.GET_USAGE);
|
|
101
|
+
setUsage(response.data.data);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
const axiosError = error;
|
|
105
|
+
const errorMessage = axiosError.response?.data?.message || 'Failed to fetch usage';
|
|
106
|
+
setUsageError(errorMessage);
|
|
107
|
+
console.error('Fetch usage error:', error);
|
|
108
|
+
}
|
|
109
|
+
finally {
|
|
110
|
+
setIsLoadingUsage(false);
|
|
111
|
+
}
|
|
112
|
+
}, [isAuthenticated, user, apiClient]);
|
|
113
|
+
/**
|
|
114
|
+
* Cancel subscription
|
|
115
|
+
*/
|
|
116
|
+
const cancelSubscription = useCallback(async () => {
|
|
117
|
+
if (!isAuthenticated || !subscription)
|
|
118
|
+
return;
|
|
119
|
+
try {
|
|
120
|
+
setIsLoadingSubscription(true);
|
|
121
|
+
setSubscriptionError(null);
|
|
122
|
+
await apiClient.post(PAYMENT_ENDPOINTS.CANCEL_SUBSCRIPTION);
|
|
123
|
+
// Refresh subscription data
|
|
124
|
+
await fetchSubscription();
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
const axiosError = error;
|
|
128
|
+
const errorMessage = axiosError.response?.data?.message || 'Failed to cancel subscription';
|
|
129
|
+
setSubscriptionError(errorMessage);
|
|
130
|
+
console.error('Cancel subscription error:', error);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
setIsLoadingSubscription(false);
|
|
135
|
+
}
|
|
136
|
+
}, [isAuthenticated, subscription, apiClient, fetchSubscription]);
|
|
137
|
+
/**
|
|
138
|
+
* Resume subscription
|
|
139
|
+
*/
|
|
140
|
+
const resumeSubscription = useCallback(async () => {
|
|
141
|
+
if (!isAuthenticated || !subscription)
|
|
142
|
+
return;
|
|
143
|
+
try {
|
|
144
|
+
setIsLoadingSubscription(true);
|
|
145
|
+
setSubscriptionError(null);
|
|
146
|
+
await apiClient.post(PAYMENT_ENDPOINTS.RESUME_SUBSCRIPTION);
|
|
147
|
+
// Refresh subscription data
|
|
148
|
+
await fetchSubscription();
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
const axiosError = error;
|
|
152
|
+
const errorMessage = axiosError.response?.data?.message || 'Failed to resume subscription';
|
|
153
|
+
setSubscriptionError(errorMessage);
|
|
154
|
+
console.error('Resume subscription error:', error);
|
|
155
|
+
throw error;
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
setIsLoadingSubscription(false);
|
|
159
|
+
}
|
|
160
|
+
}, [isAuthenticated, subscription, apiClient, fetchSubscription]);
|
|
161
|
+
/**
|
|
162
|
+
* Upgrade subscription
|
|
163
|
+
*/
|
|
164
|
+
const upgradeSubscription = useCallback(async (newTier) => {
|
|
165
|
+
if (!isAuthenticated || !subscription)
|
|
166
|
+
return;
|
|
167
|
+
try {
|
|
168
|
+
setIsLoadingSubscription(true);
|
|
169
|
+
setSubscriptionError(null);
|
|
170
|
+
await apiClient.post(PAYMENT_ENDPOINTS.UPGRADE_SUBSCRIPTION, {
|
|
171
|
+
newTier,
|
|
172
|
+
});
|
|
173
|
+
// Refresh subscription data
|
|
174
|
+
await fetchSubscription();
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
const axiosError = error;
|
|
178
|
+
const errorMessage = axiosError.response?.data?.message || 'Failed to upgrade subscription';
|
|
179
|
+
setSubscriptionError(errorMessage);
|
|
180
|
+
console.error('Upgrade subscription error:', error);
|
|
181
|
+
throw error;
|
|
182
|
+
}
|
|
183
|
+
finally {
|
|
184
|
+
setIsLoadingSubscription(false);
|
|
185
|
+
}
|
|
186
|
+
}, [isAuthenticated, subscription, apiClient, fetchSubscription]);
|
|
187
|
+
/**
|
|
188
|
+
* Downgrade subscription
|
|
189
|
+
*/
|
|
190
|
+
const downgradeSubscription = useCallback(async (newTier) => {
|
|
191
|
+
if (!isAuthenticated || !subscription)
|
|
192
|
+
return;
|
|
193
|
+
try {
|
|
194
|
+
setIsLoadingSubscription(true);
|
|
195
|
+
setSubscriptionError(null);
|
|
196
|
+
await apiClient.post(PAYMENT_ENDPOINTS.DOWNGRADE_SUBSCRIPTION, {
|
|
197
|
+
newTier,
|
|
198
|
+
});
|
|
199
|
+
// Refresh subscription data
|
|
200
|
+
await fetchSubscription();
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
const axiosError = error;
|
|
204
|
+
const errorMessage = axiosError.response?.data?.message || 'Failed to downgrade subscription';
|
|
205
|
+
setSubscriptionError(errorMessage);
|
|
206
|
+
console.error('Downgrade subscription error:', error);
|
|
207
|
+
throw error;
|
|
208
|
+
}
|
|
209
|
+
finally {
|
|
210
|
+
setIsLoadingSubscription(false);
|
|
211
|
+
}
|
|
212
|
+
}, [isAuthenticated, subscription, apiClient, fetchSubscription]);
|
|
213
|
+
// Auto-fetch subscription on mount
|
|
214
|
+
useEffect(() => {
|
|
215
|
+
if (isAuthenticated && user) {
|
|
216
|
+
fetchSubscription();
|
|
217
|
+
fetchUsage();
|
|
218
|
+
}
|
|
219
|
+
}, [isAuthenticated, user, fetchSubscription, fetchUsage]);
|
|
220
|
+
return {
|
|
221
|
+
// Subscription state
|
|
222
|
+
subscription,
|
|
223
|
+
isLoadingSubscription,
|
|
224
|
+
subscriptionError,
|
|
225
|
+
// Payment history
|
|
226
|
+
payments,
|
|
227
|
+
isLoadingPayments,
|
|
228
|
+
paymentsError,
|
|
229
|
+
// Invoices
|
|
230
|
+
invoices,
|
|
231
|
+
isLoadingInvoices,
|
|
232
|
+
invoicesError,
|
|
233
|
+
// Usage metrics
|
|
234
|
+
usage,
|
|
235
|
+
isLoadingUsage,
|
|
236
|
+
usageError,
|
|
237
|
+
// Actions
|
|
238
|
+
fetchSubscription,
|
|
239
|
+
fetchPayments,
|
|
240
|
+
fetchInvoices,
|
|
241
|
+
fetchUsage,
|
|
242
|
+
cancelSubscription,
|
|
243
|
+
resumeSubscription,
|
|
244
|
+
upgradeSubscription,
|
|
245
|
+
downgradeSubscription,
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
export default usePayments;
|
|
249
|
+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kBAAkB;QAClB,kBAAkB;QAClB,mBAAmB;QACnB,qBAAqB;KACtB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Auth Status Component
|
|
4
|
+
* Displays current authentication status and user information
|
|
5
|
+
*/
|
|
6
|
+
interface AuthStatusProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
theme?: 'light' | 'dark';
|
|
9
|
+
showAddress?: boolean;
|
|
10
|
+
showChainId?: boolean;
|
|
11
|
+
compact?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const AuthStatus: React.FC<AuthStatusProps>;
|
|
14
|
+
export default AuthStatus;
|
|
15
|
+
//# sourceMappingURL=AuthStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthStatus.d.ts","sourceRoot":"","sources":["../../../src/components/SIWE/AuthStatus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B;;;GAGG;AAEH,UAAU,eAAe;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAoFhD,CAAC;AAUF,eAAe,UAAU,CAAC"}
|