@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 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,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
- ### Setup
23
-
24
- 1. Add our component to your `tailwind.config.js`:
25
- ```js
26
- module.exports = {
27
- content: [
28
- './pages/**/*.{js,ts,jsx,tsx,mdx}',
29
- './components/**/*.{js,ts,jsx,tsx,mdx}',
30
- './app/**/*.{js,ts,jsx,tsx,mdx}',
31
- // Add this line
32
- './node_modules/@omnikit-js/ui/**/*.{js,ts,jsx,tsx}',
33
- ],
34
- // ... rest of your config
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. Import the component-specific styles:
39
- ```tsx
40
- import '@omnikit-js/ui/styles.css';
41
- ```
47
+ ### Option 2: Prefixed CSS (Recommended for Apps With Existing Tailwind)
42
48
 
43
- **That's it!** The component will use your existing Tailwind configuration plus essential component-specific styles.
49
+ To avoid conflicts with your app's existing Tailwind styles, use the prefixed version:
44
50
 
45
- ## Prerequisites
51
+ ```javascript
52
+ // Import the prefixed CSS instead
53
+ import '@omnikit-js/ui/dist/styles.prefixed.css'
46
54
 
47
- 1. A Stripe account with API keys
48
- 2. A billing API backend (compatible with the expected endpoints)
49
- 3. Next.js 13+ with App Router
55
+ // Use the component
56
+ import { Billing } from '@omnikit-js/ui'
50
57
 
51
- ## Usage
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
- ### Basic Usage
69
+ **Note:** The prefixed version uses `tw-` prefix for all Tailwind classes internally, preventing conflicts with your app's styles.
54
70
 
55
- ```jsx
56
- 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'
57
77
 
58
78
  export default function BillingPage() {
59
79
  return (
60
- <div className="max-w-7xl mx-auto p-6">
61
- <Billing userId="user-123" />
62
- </div>
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
- ### Advanced Usage with Custom Configuration
92
+ ### Next.js Pages Router Example
68
93
 
69
- ```jsx
70
- 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'
71
105
 
72
106
  export default function BillingPage() {
73
107
  return (
74
- <Billing
75
- userId="user-123"
76
- apiUrl="https://api.yourdomain.com"
77
- apiKey={process.env.API_KEY}
78
- projectId="project-456"
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
- ### Environment Variables
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
- ## Features
244
+ ## Troubleshooting
157
245
 
158
- ### Subscription Management
159
- - View current subscription details
160
- - Upgrade/downgrade plans
161
- - Cancel subscriptions
162
- - View billing history
163
-
164
- ### Payment Methods
165
- - Add new payment methods with Stripe
166
- - Set default payment method
167
- - Remove payment methods
168
- - Secure card information handling
169
-
170
- ### Usage Tracking
171
- - Real-time usage metrics
172
- - Progress bars for plan limits
173
- - Usage history and analytics
174
-
175
- ### Responsive Design
176
- - Mobile-friendly interface
177
- - Clean, modern UI
178
- - Accessible components
179
-
180
- ## Styling
181
-
182
- 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`:
183
-
184
- ```js
185
- module.exports = {
186
- content: [
187
- // ... your other content paths
188
- "./node_modules/@omnikit-js/ui/**/*.{js,ts,jsx,tsx}",
189
- ],
190
- // ... rest of your config
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