@omnikit-js/ui 0.5.0 → 0.5.2

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 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 a beautiful UI.
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,58 +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
- ### Simple Setup - No Tailwind Required!
23
+ ## Usage
23
24
 
24
- Just import the component's CSS file in your app:
25
+ ### Option 1: Standard CSS (For Apps Without Tailwind)
25
26
 
26
- **Option 1: In your `app/globals.css` or main CSS file:**
27
- ```css
28
- @import '@omnikit-js/ui/styles.css';
29
- ```
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'
30
35
 
31
- **Option 2: In your layout file:**
32
- ```tsx
33
- import '@omnikit-js/ui/styles.css';
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
+ )
44
+ }
34
45
  ```
35
46
 
36
- **That's it!** The component includes all necessary styles and works without requiring Tailwind CSS configuration.
47
+ ### Option 2: Prefixed CSS (Recommended for Apps With Existing Tailwind)
37
48
 
38
- ## Prerequisites
49
+ To avoid conflicts with your app's existing Tailwind styles, use the prefixed version:
39
50
 
40
- 1. A Stripe account with API keys
41
- 2. A billing API backend (compatible with the expected endpoints)
42
- 3. Next.js 13+ with App Router
51
+ ```javascript
52
+ // Import the prefixed CSS instead
53
+ import '@omnikit-js/ui/dist/styles.prefixed.css'
43
54
 
44
- ## Usage
55
+ // Use the component
56
+ import { Billing } from '@omnikit-js/ui'
57
+
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
+ ```
45
68
 
46
- ### Basic Usage
69
+ **Note:** The prefixed version uses `tw-` prefix for all Tailwind classes internally, preventing conflicts with your app's styles.
47
70
 
48
- ```jsx
49
- import { Billing } from '@omnikit-js/ui';
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'
50
77
 
51
78
  export default function BillingPage() {
52
79
  return (
53
- <div className="max-w-7xl mx-auto p-6">
54
- <Billing userId="user-123" />
55
- </div>
56
- );
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
+ )
57
89
  }
58
90
  ```
59
91
 
60
- ### Advanced Usage with Custom Configuration
92
+ ### Next.js Pages Router Example
61
93
 
62
- ```jsx
63
- import { Billing } from '@omnikit-js/ui';
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'
64
105
 
65
106
  export default function BillingPage() {
66
107
  return (
67
- <Billing
68
- userId="user-123"
69
- apiUrl="https://api.yourdomain.com"
70
- apiKey={process.env.API_KEY}
71
- projectId="project-456"
72
- />
73
- );
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
+ )
74
117
  }
75
118
  ```
76
119
 
@@ -96,6 +139,58 @@ export default function ClientBillingPage({ customerData, pricingData, paymentMe
96
139
  }
97
140
  ```
98
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
+
99
194
  ## Component Props
100
195
 
101
196
  ### Billing (Server Component)
@@ -117,7 +212,7 @@ export default function ClientBillingPage({ customerData, pricingData, paymentMe
117
212
  | apiUrl | string | The API base URL |
118
213
  | apiKey | string | The API key for authentication |
119
214
 
120
- ### Environment Variables
215
+ ## Environment Variables
121
216
 
122
217
  Create a `.env.local` file in your Next.js project:
123
218
 
@@ -146,43 +241,44 @@ The component expects the following API endpoints:
146
241
  - `POST /billing/payment-methods/:id/default` - Set default payment method
147
242
  - `DELETE /billing/payment-methods/:id` - Delete payment method
148
243
 
149
- ## Features
244
+ ## Troubleshooting
150
245
 
151
- ### Subscription Management
152
- - View current subscription details
153
- - Upgrade/downgrade plans
154
- - Cancel subscriptions
155
- - View billing history
156
-
157
- ### Payment Methods
158
- - Add new payment methods with Stripe
159
- - Set default payment method
160
- - Remove payment methods
161
- - Secure card information handling
162
-
163
- ### Usage Tracking
164
- - Real-time usage metrics
165
- - Progress bars for plan limits
166
- - Usage history and analytics
167
-
168
- ### Responsive Design
169
- - Mobile-friendly interface
170
- - Clean, modern UI
171
- - Accessible components
172
-
173
- ## Styling
174
-
175
- The component uses Tailwind CSS classes and is designed to work with your existing Tailwind configuration. Make sure your project includes the component's styles by adding this to your `tailwind.config.js`:
176
-
177
- ```js
178
- module.exports = {
179
- content: [
180
- // ... your other content paths
181
- "./node_modules/@omnikit-js/ui/**/*.{js,ts,jsx,tsx}",
182
- ],
183
- // ... rest of your config
184
- }
185
- ```
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.
186
282
 
187
283
  ## TypeScript
188
284