@omnikit-js/ui 0.4.6 → 0.5.1
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/README.md +168 -79
- package/dist/styles.css +2486 -0
- package/dist/styles.prefixed.css +248 -0
- package/package.json +9 -6
- package/src/components/BillingClient.tsx +12 -12
- package/src/components/SubscriptionConfirmModal.tsx +7 -7
- package/src/components/ui/alert.tsx +1 -1
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/card-brand-icon.tsx +1 -1
- package/src/components/ui/card.tsx +1 -1
- package/src/components/ui/dialog.tsx +2 -2
- package/src/components/ui/dropdown-menu.tsx +6 -6
- package/src/components/ui/navigation-menu.tsx +4 -4
- package/src/components/ui/select.tsx +2 -2
- package/src/components/ui/tabs.tsx +2 -2
- package/src/components/ui/tooltip.tsx +1 -1
- package/src/styles/globals.css +1 -91
- package/src/styles/main.css +95 -0
- package/src/styles/prefixed-main.css +95 -0
- package/src/styles/prefixed.css +1 -0
package/README.md
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
# @omnikit-js/ui
|
|
2
2
|
|
|
3
|
-
A comprehensive SaaS billing component for Next.js applications with Stripe integration. Built with React Server Components support and
|
|
3
|
+
A comprehensive SaaS billing component for Next.js applications with Stripe integration. Built with React Server Components support and Tailwind CSS v4.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- 🚀 **Server Components Support** - Optimized for Next.js App Router
|
|
8
8
|
- 💳 **Stripe Integration** - Complete payment processing and subscription management
|
|
9
|
-
- 🎨 **Beautiful UI** - Built with Tailwind CSS and Radix UI
|
|
9
|
+
- 🎨 **Beautiful UI** - Built with Tailwind CSS v4 and Radix UI
|
|
10
10
|
- 📊 **Usage Tracking** - Monitor and display resource usage
|
|
11
11
|
- 🔄 **Subscription Management** - Handle upgrades, downgrades, and cancellations
|
|
12
12
|
- 💰 **Payment Methods** - Add, remove, and manage multiple payment methods
|
|
13
13
|
- 📜 **Billing History** - View and download past invoices
|
|
14
14
|
- 🔐 **Secure** - Server-side API key handling
|
|
15
|
+
- 🎯 **No Style Conflicts** - Prefixed CSS option to avoid conflicts with your app
|
|
15
16
|
|
|
16
17
|
## Installation
|
|
17
18
|
|
|
@@ -19,65 +20,100 @@ A comprehensive SaaS billing component for Next.js applications with Stripe inte
|
|
|
19
20
|
npm install @omnikit-js/ui
|
|
20
21
|
```
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
1
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Option 1: Standard CSS (For Apps Without Tailwind)
|
|
26
|
+
|
|
27
|
+
If your app doesn't use Tailwind CSS or you want to use the component's default styles:
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
// Import the CSS in your app's entry point (e.g., _app.tsx or layout.tsx)
|
|
31
|
+
import '@omnikit-js/ui/dist/styles.css'
|
|
32
|
+
|
|
33
|
+
// Use the component
|
|
34
|
+
import { Billing } from '@omnikit-js/ui'
|
|
35
|
+
|
|
36
|
+
export default function BillingPage() {
|
|
37
|
+
return (
|
|
38
|
+
<Billing
|
|
39
|
+
userId="user_123"
|
|
40
|
+
apiUrl="https://your-api.com"
|
|
41
|
+
apiKey="your-api-key"
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
35
44
|
}
|
|
36
45
|
```
|
|
37
46
|
|
|
38
|
-
2
|
|
39
|
-
```tsx
|
|
40
|
-
import '@omnikit-js/ui/styles.css';
|
|
41
|
-
```
|
|
47
|
+
### Option 2: Prefixed CSS (Recommended for Apps With Existing Tailwind)
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
To avoid conflicts with your app's existing Tailwind styles, use the prefixed version:
|
|
44
50
|
|
|
45
|
-
|
|
51
|
+
```javascript
|
|
52
|
+
// Import the prefixed CSS instead
|
|
53
|
+
import '@omnikit-js/ui/dist/styles.prefixed.css'
|
|
46
54
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
3. Next.js 13+ with App Router
|
|
55
|
+
// Use the component
|
|
56
|
+
import { Billing } from '@omnikit-js/ui'
|
|
50
57
|
|
|
51
|
-
|
|
58
|
+
export default function BillingPage() {
|
|
59
|
+
return (
|
|
60
|
+
<Billing
|
|
61
|
+
userId="user_123"
|
|
62
|
+
apiUrl="https://your-api.com"
|
|
63
|
+
apiKey="your-api-key"
|
|
64
|
+
/>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
```
|
|
52
68
|
|
|
53
|
-
|
|
69
|
+
**Note:** The prefixed version uses `tw-` prefix for all Tailwind classes internally, preventing conflicts with your app's styles.
|
|
54
70
|
|
|
55
|
-
|
|
56
|
-
|
|
71
|
+
### Next.js App Router Example
|
|
72
|
+
|
|
73
|
+
```javascript
|
|
74
|
+
// app/billing/page.tsx
|
|
75
|
+
import '@omnikit-js/ui/dist/styles.prefixed.css'
|
|
76
|
+
import { Billing } from '@omnikit-js/ui'
|
|
57
77
|
|
|
58
78
|
export default function BillingPage() {
|
|
59
79
|
return (
|
|
60
|
-
<
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
80
|
+
<main className="container mx-auto p-4">
|
|
81
|
+
<h1 className="text-2xl font-bold mb-6">Billing & Subscription</h1>
|
|
82
|
+
<Billing
|
|
83
|
+
userId="user_123"
|
|
84
|
+
apiUrl={process.env.NEXT_PUBLIC_API_URL}
|
|
85
|
+
apiKey={process.env.API_KEY}
|
|
86
|
+
/>
|
|
87
|
+
</main>
|
|
88
|
+
)
|
|
64
89
|
}
|
|
65
90
|
```
|
|
66
91
|
|
|
67
|
-
###
|
|
92
|
+
### Next.js Pages Router Example
|
|
68
93
|
|
|
69
|
-
```
|
|
70
|
-
|
|
94
|
+
```javascript
|
|
95
|
+
// pages/_app.tsx
|
|
96
|
+
import '@omnikit-js/ui/dist/styles.prefixed.css'
|
|
97
|
+
import type { AppProps } from 'next/app'
|
|
98
|
+
|
|
99
|
+
export default function App({ Component, pageProps }: AppProps) {
|
|
100
|
+
return <Component {...pageProps} />
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// pages/billing.tsx
|
|
104
|
+
import { Billing } from '@omnikit-js/ui'
|
|
71
105
|
|
|
72
106
|
export default function BillingPage() {
|
|
73
107
|
return (
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
108
|
+
<div className="container mx-auto p-4">
|
|
109
|
+
<h1 className="text-2xl font-bold mb-6">Billing & Subscription</h1>
|
|
110
|
+
<Billing
|
|
111
|
+
userId="user_123"
|
|
112
|
+
apiUrl={process.env.NEXT_PUBLIC_API_URL}
|
|
113
|
+
apiKey={process.env.API_KEY}
|
|
114
|
+
/>
|
|
115
|
+
</div>
|
|
116
|
+
)
|
|
81
117
|
}
|
|
82
118
|
```
|
|
83
119
|
|
|
@@ -103,6 +139,58 @@ export default function ClientBillingPage({ customerData, pricingData, paymentMe
|
|
|
103
139
|
}
|
|
104
140
|
```
|
|
105
141
|
|
|
142
|
+
## Resolving Style Conflicts
|
|
143
|
+
|
|
144
|
+
If you experience style conflicts, especially with progress bars or grid layouts:
|
|
145
|
+
|
|
146
|
+
### Progress Bar Color Conflicts
|
|
147
|
+
|
|
148
|
+
Override the progress bar styles in your global CSS:
|
|
149
|
+
|
|
150
|
+
```css
|
|
151
|
+
/* Force specific progress bar colors */
|
|
152
|
+
.omnikit-progress-fill {
|
|
153
|
+
background-color: #3b82f6 !important;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* Or for dark mode */
|
|
157
|
+
@media (prefers-color-scheme: dark) {
|
|
158
|
+
.omnikit-progress-fill {
|
|
159
|
+
background-color: #60a5fa !important;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Grid Layout Conflicts
|
|
165
|
+
|
|
166
|
+
Wrap the component in a scoped container to isolate styles:
|
|
167
|
+
|
|
168
|
+
```css
|
|
169
|
+
/* Create an isolation container */
|
|
170
|
+
.billing-wrapper {
|
|
171
|
+
/* Reset conflicting styles */
|
|
172
|
+
all: initial;
|
|
173
|
+
font-family: inherit;
|
|
174
|
+
color: inherit;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.billing-wrapper * {
|
|
178
|
+
box-sizing: border-box;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* Fix specific grid issues */
|
|
182
|
+
.billing-wrapper .omnikit-pricing-grid {
|
|
183
|
+
display: grid !important;
|
|
184
|
+
gap: 1rem !important;
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
```javascript
|
|
189
|
+
<div className="billing-wrapper">
|
|
190
|
+
<Billing userId="user_123" />
|
|
191
|
+
</div>
|
|
192
|
+
```
|
|
193
|
+
|
|
106
194
|
## Component Props
|
|
107
195
|
|
|
108
196
|
### Billing (Server Component)
|
|
@@ -124,7 +212,7 @@ export default function ClientBillingPage({ customerData, pricingData, paymentMe
|
|
|
124
212
|
| apiUrl | string | The API base URL |
|
|
125
213
|
| apiKey | string | The API key for authentication |
|
|
126
214
|
|
|
127
|
-
|
|
215
|
+
## Environment Variables
|
|
128
216
|
|
|
129
217
|
Create a `.env.local` file in your Next.js project:
|
|
130
218
|
|
|
@@ -153,43 +241,44 @@ The component expects the following API endpoints:
|
|
|
153
241
|
- `POST /billing/payment-methods/:id/default` - Set default payment method
|
|
154
242
|
- `DELETE /billing/payment-methods/:id` - Delete payment method
|
|
155
243
|
|
|
156
|
-
##
|
|
244
|
+
## Troubleshooting
|
|
157
245
|
|
|
158
|
-
###
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
246
|
+
### Common Issues and Solutions
|
|
247
|
+
|
|
248
|
+
1. **Progress bar showing wrong color**
|
|
249
|
+
- Use the prefixed CSS version
|
|
250
|
+
- Override `.omnikit-progress-fill` with `!important`
|
|
251
|
+
|
|
252
|
+
2. **Grid layout breaking on pricing page**
|
|
253
|
+
- Check for global grid styles in your app
|
|
254
|
+
- Use the isolation container approach shown above
|
|
255
|
+
- Ensure no conflicting CSS Grid properties
|
|
256
|
+
|
|
257
|
+
3. **Modal z-index conflicts**
|
|
258
|
+
- Component modals use `z-50` (z-index: 50)
|
|
259
|
+
- Adjust your app's z-index scale if needed
|
|
260
|
+
|
|
261
|
+
4. **Font inconsistencies**
|
|
262
|
+
- The component inherits font-family
|
|
263
|
+
- Set font on a parent element
|
|
264
|
+
|
|
265
|
+
5. **Styles not loading**
|
|
266
|
+
- Ensure you're importing the CSS file
|
|
267
|
+
- Check the correct path: `@omnikit-js/ui/dist/styles.css` or `@omnikit-js/ui/dist/styles.prefixed.css`
|
|
268
|
+
|
|
269
|
+
## Version History
|
|
270
|
+
|
|
271
|
+
- **0.5.1** - Tailwind CSS v4 support with prefix option
|
|
272
|
+
- **0.3.5** - Previous version with Tailwind CSS v3
|
|
273
|
+
|
|
274
|
+
## Browser Support
|
|
275
|
+
|
|
276
|
+
Requires modern browsers:
|
|
277
|
+
- Safari 16.4+
|
|
278
|
+
- Chrome 111+
|
|
279
|
+
- Firefox 128+
|
|
280
|
+
|
|
281
|
+
For older browser support, use version 0.3.5.
|
|
193
282
|
|
|
194
283
|
## TypeScript
|
|
195
284
|
|