@nozle-js/react 0.3.0
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 +1009 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +150 -0
- package/dist/index.d.ts +150 -0
- package/dist/index.js +997 -0
- package/dist/index.js.map +1 -0
- package/dist/styles/preset.cjs +77 -0
- package/dist/styles/preset.cjs.map +1 -0
- package/dist/styles/preset.d.cts +18 -0
- package/dist/styles/preset.d.ts +18 -0
- package/dist/styles/preset.js +75 -0
- package/dist/styles/preset.js.map +1 -0
- package/package.json +38 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,1009 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var stripeJs = require('@stripe/stripe-js');
|
|
5
|
+
var centrifuge = require('centrifuge');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
// src/provider.tsx
|
|
9
|
+
|
|
10
|
+
// src/store.ts
|
|
11
|
+
var BillingStore = class {
|
|
12
|
+
baseUrl;
|
|
13
|
+
apiKey;
|
|
14
|
+
customerId;
|
|
15
|
+
state = {
|
|
16
|
+
entitlements: null,
|
|
17
|
+
credits: null,
|
|
18
|
+
usage: {},
|
|
19
|
+
connectionState: "connecting",
|
|
20
|
+
error: null
|
|
21
|
+
};
|
|
22
|
+
listeners = /* @__PURE__ */ new Set();
|
|
23
|
+
constructor(baseUrl, apiKey, customerId) {
|
|
24
|
+
this.baseUrl = baseUrl;
|
|
25
|
+
this.apiKey = apiKey;
|
|
26
|
+
this.customerId = customerId;
|
|
27
|
+
}
|
|
28
|
+
getSnapshot = () => this.state;
|
|
29
|
+
getServerSnapshot = () => this.state;
|
|
30
|
+
subscribe = (listener) => {
|
|
31
|
+
this.listeners.add(listener);
|
|
32
|
+
return () => {
|
|
33
|
+
this.listeners.delete(listener);
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
emit() {
|
|
37
|
+
for (const listener of this.listeners) {
|
|
38
|
+
listener();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
setConnectionState(state) {
|
|
42
|
+
this.state = { ...this.state, connectionState: state };
|
|
43
|
+
this.emit();
|
|
44
|
+
}
|
|
45
|
+
setError(error) {
|
|
46
|
+
this.state = { ...this.state, error };
|
|
47
|
+
this.emit();
|
|
48
|
+
}
|
|
49
|
+
updateUsage(metric, used, limit, remaining) {
|
|
50
|
+
this.state = {
|
|
51
|
+
...this.state,
|
|
52
|
+
usage: {
|
|
53
|
+
...this.state.usage,
|
|
54
|
+
[metric]: { used, limit, remaining }
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
this.emit();
|
|
58
|
+
}
|
|
59
|
+
async fetchUsage(feature) {
|
|
60
|
+
try {
|
|
61
|
+
const res = await fetch(
|
|
62
|
+
`${this.baseUrl}/v1/can?customer_id=${this.customerId}&feature=${feature}`,
|
|
63
|
+
{ headers: { Authorization: `Bearer ${this.apiKey}` } }
|
|
64
|
+
);
|
|
65
|
+
if (!res.ok) return;
|
|
66
|
+
const data = await res.json();
|
|
67
|
+
this.updateUsage(feature, data.used, data.limit, data.remaining);
|
|
68
|
+
this.state = {
|
|
69
|
+
...this.state,
|
|
70
|
+
entitlements: {
|
|
71
|
+
plan_slug: "pro",
|
|
72
|
+
subscription_status: "active",
|
|
73
|
+
features: { [feature]: { enabled: data.allowed } },
|
|
74
|
+
limits: { [feature]: { limit: data.limit, used: data.used, source: "entitlement" } }
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
this.emit();
|
|
78
|
+
} catch (err) {
|
|
79
|
+
this.state = {
|
|
80
|
+
...this.state,
|
|
81
|
+
error: err instanceof Error ? err : new Error(String(err))
|
|
82
|
+
};
|
|
83
|
+
this.emit();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async fetchCheckoutSecret(planCode, successUrl) {
|
|
87
|
+
const res = await fetch(`${this.baseUrl}/v1/checkout`, {
|
|
88
|
+
method: "POST",
|
|
89
|
+
headers: {
|
|
90
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
91
|
+
"Content-Type": "application/json"
|
|
92
|
+
},
|
|
93
|
+
body: JSON.stringify({
|
|
94
|
+
plan_code: planCode,
|
|
95
|
+
customer_id: this.customerId,
|
|
96
|
+
success_url: successUrl || `${window.location.origin}/checkout/complete?session_id={CHECKOUT_SESSION_ID}`
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
if (!res.ok) throw new Error("Failed to create checkout session");
|
|
100
|
+
const data = await res.json();
|
|
101
|
+
return data.client_secret;
|
|
102
|
+
}
|
|
103
|
+
async fetchPlans() {
|
|
104
|
+
const res = await fetch(`${this.baseUrl}/v1/plans`, {
|
|
105
|
+
headers: { Authorization: `Bearer ${this.apiKey}` }
|
|
106
|
+
});
|
|
107
|
+
if (!res.ok) return [];
|
|
108
|
+
const data = await res.json();
|
|
109
|
+
return data.plans || [];
|
|
110
|
+
}
|
|
111
|
+
handleEvent(event) {
|
|
112
|
+
if (event.type === "usage.updated") {
|
|
113
|
+
const metric = event.metric;
|
|
114
|
+
const used = event.used;
|
|
115
|
+
const limit = event.limit;
|
|
116
|
+
const remaining = event.remaining;
|
|
117
|
+
this.updateUsage(metric, used, limit, remaining);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
function connectCentrifugo(store, customerId, wsUrl) {
|
|
122
|
+
const centrifuge$1 = new centrifuge.Centrifuge(wsUrl, {});
|
|
123
|
+
const sub = centrifuge$1.newSubscription(
|
|
124
|
+
`customer:${customerId}`
|
|
125
|
+
);
|
|
126
|
+
sub.on("publication", (ctx) => {
|
|
127
|
+
store.handleEvent(
|
|
128
|
+
ctx.data
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
sub.on("subscribed", () => {
|
|
132
|
+
store.setConnectionState("connected");
|
|
133
|
+
});
|
|
134
|
+
centrifuge$1.on("connected", () => {
|
|
135
|
+
store.setConnectionState("connected");
|
|
136
|
+
});
|
|
137
|
+
centrifuge$1.on("disconnected", () => {
|
|
138
|
+
store.setConnectionState("disconnected");
|
|
139
|
+
});
|
|
140
|
+
sub.subscribe();
|
|
141
|
+
centrifuge$1.connect();
|
|
142
|
+
store.setConnectionState("connecting");
|
|
143
|
+
return {
|
|
144
|
+
disconnect: () => {
|
|
145
|
+
sub.unsubscribe();
|
|
146
|
+
centrifuge$1.disconnect();
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
var BillingContext = react.createContext(null);
|
|
151
|
+
function BillingProvider({
|
|
152
|
+
apiKey,
|
|
153
|
+
customerId,
|
|
154
|
+
baseUrl = "http://localhost:8080",
|
|
155
|
+
wsUrl = "ws://localhost:8001/connection/websocket",
|
|
156
|
+
stripeKey,
|
|
157
|
+
features = [],
|
|
158
|
+
children
|
|
159
|
+
}) {
|
|
160
|
+
const storeRef = react.useRef(null);
|
|
161
|
+
if (!storeRef.current) {
|
|
162
|
+
storeRef.current = new BillingStore(baseUrl, apiKey, customerId);
|
|
163
|
+
}
|
|
164
|
+
const stripePromise = react.useMemo(
|
|
165
|
+
() => stripeKey ? stripeJs.loadStripe(stripeKey) : null,
|
|
166
|
+
[stripeKey]
|
|
167
|
+
);
|
|
168
|
+
react.useEffect(() => {
|
|
169
|
+
const store = storeRef.current;
|
|
170
|
+
for (const feature of features) {
|
|
171
|
+
store.fetchUsage(feature);
|
|
172
|
+
}
|
|
173
|
+
const connection = connectCentrifugo(
|
|
174
|
+
store,
|
|
175
|
+
customerId,
|
|
176
|
+
wsUrl
|
|
177
|
+
);
|
|
178
|
+
return () => {
|
|
179
|
+
connection.disconnect();
|
|
180
|
+
};
|
|
181
|
+
}, [apiKey, customerId, baseUrl, wsUrl, features]);
|
|
182
|
+
return /* @__PURE__ */ jsxRuntime.jsx(BillingContext.Provider, { value: { store: storeRef.current, stripePromise }, children });
|
|
183
|
+
}
|
|
184
|
+
function useBillingContext() {
|
|
185
|
+
const ctx = react.useContext(BillingContext);
|
|
186
|
+
if (!ctx) {
|
|
187
|
+
throw new Error("useBillingContext must be used within a BillingProvider");
|
|
188
|
+
}
|
|
189
|
+
return ctx;
|
|
190
|
+
}
|
|
191
|
+
function useCan(feature) {
|
|
192
|
+
const { store } = useBillingContext();
|
|
193
|
+
const state = react.useSyncExternalStore(
|
|
194
|
+
store.subscribe,
|
|
195
|
+
store.getSnapshot,
|
|
196
|
+
store.getServerSnapshot
|
|
197
|
+
);
|
|
198
|
+
if (state.error) {
|
|
199
|
+
return { allowed: false, isLoading: false, error: state.error };
|
|
200
|
+
}
|
|
201
|
+
if (state.entitlements === null) {
|
|
202
|
+
return { allowed: false, isLoading: true, error: null };
|
|
203
|
+
}
|
|
204
|
+
const featureState = state.entitlements.features[feature];
|
|
205
|
+
return {
|
|
206
|
+
allowed: featureState?.enabled ?? false,
|
|
207
|
+
isLoading: false,
|
|
208
|
+
error: null
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function useUsage(metric) {
|
|
212
|
+
const { store } = useBillingContext();
|
|
213
|
+
const state = react.useSyncExternalStore(
|
|
214
|
+
store.subscribe,
|
|
215
|
+
store.getSnapshot,
|
|
216
|
+
store.getServerSnapshot
|
|
217
|
+
);
|
|
218
|
+
if (state.error) {
|
|
219
|
+
return { data: null, isLoading: false, error: state.error };
|
|
220
|
+
}
|
|
221
|
+
if (state.entitlements === null) {
|
|
222
|
+
return { data: null, isLoading: true, error: null };
|
|
223
|
+
}
|
|
224
|
+
const usage = state.usage[metric] ?? null;
|
|
225
|
+
return { data: usage, isLoading: false, error: null };
|
|
226
|
+
}
|
|
227
|
+
function usePlan() {
|
|
228
|
+
const { store } = useBillingContext();
|
|
229
|
+
const state = react.useSyncExternalStore(
|
|
230
|
+
store.subscribe,
|
|
231
|
+
store.getSnapshot,
|
|
232
|
+
store.getServerSnapshot
|
|
233
|
+
);
|
|
234
|
+
if (state.error) {
|
|
235
|
+
return { data: null, isLoading: false, error: state.error };
|
|
236
|
+
}
|
|
237
|
+
if (state.entitlements === null) {
|
|
238
|
+
return { data: null, isLoading: true, error: null };
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
data: {
|
|
242
|
+
plan_slug: state.entitlements.plan_slug,
|
|
243
|
+
subscription_status: state.entitlements.subscription_status
|
|
244
|
+
},
|
|
245
|
+
isLoading: false,
|
|
246
|
+
error: null
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
function useCheckout() {
|
|
250
|
+
const { store, stripePromise } = useBillingContext();
|
|
251
|
+
const [isLoading, setIsLoading] = react.useState(false);
|
|
252
|
+
const [error, setError] = react.useState(null);
|
|
253
|
+
const fetchClientSecret = react.useCallback(
|
|
254
|
+
async (planCode, successUrl) => {
|
|
255
|
+
setIsLoading(true);
|
|
256
|
+
setError(null);
|
|
257
|
+
try {
|
|
258
|
+
return await store.fetchCheckoutSecret(planCode, successUrl);
|
|
259
|
+
} catch (err) {
|
|
260
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
261
|
+
setError(e);
|
|
262
|
+
throw e;
|
|
263
|
+
} finally {
|
|
264
|
+
setIsLoading(false);
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
[store]
|
|
268
|
+
);
|
|
269
|
+
return { fetchClientSecret, stripePromise, isLoading, error };
|
|
270
|
+
}
|
|
271
|
+
function useSubscribe() {
|
|
272
|
+
const { store } = useBillingContext();
|
|
273
|
+
const [isLoading, setIsLoading] = react.useState(false);
|
|
274
|
+
const [error, setError] = react.useState(null);
|
|
275
|
+
const subscribe = react.useCallback(
|
|
276
|
+
async (planCode) => {
|
|
277
|
+
setIsLoading(true);
|
|
278
|
+
setError(null);
|
|
279
|
+
try {
|
|
280
|
+
const res = await fetch(`${store.baseUrl}/v1/subscribe`, {
|
|
281
|
+
method: "POST",
|
|
282
|
+
headers: {
|
|
283
|
+
Authorization: `Bearer ${store.apiKey}`,
|
|
284
|
+
"Content-Type": "application/json"
|
|
285
|
+
},
|
|
286
|
+
body: JSON.stringify({
|
|
287
|
+
plan_code: planCode,
|
|
288
|
+
customer_id: store.customerId
|
|
289
|
+
})
|
|
290
|
+
});
|
|
291
|
+
if (!res.ok) throw new Error("Failed to create subscription");
|
|
292
|
+
return await res.json();
|
|
293
|
+
} catch (err) {
|
|
294
|
+
const e = err instanceof Error ? err : new Error(String(err));
|
|
295
|
+
setError(e);
|
|
296
|
+
throw e;
|
|
297
|
+
} finally {
|
|
298
|
+
setIsLoading(false);
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
[store]
|
|
302
|
+
);
|
|
303
|
+
return { subscribe, isLoading, error };
|
|
304
|
+
}
|
|
305
|
+
function usePlans() {
|
|
306
|
+
const { store } = useBillingContext();
|
|
307
|
+
const [plans, setPlans] = react.useState([]);
|
|
308
|
+
const [isLoading, setIsLoading] = react.useState(true);
|
|
309
|
+
react.useEffect(() => {
|
|
310
|
+
store.fetchPlans().then(setPlans).finally(() => setIsLoading(false));
|
|
311
|
+
}, [store]);
|
|
312
|
+
return { plans, isLoading };
|
|
313
|
+
}
|
|
314
|
+
var fontFamily = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
|
|
315
|
+
var levelColors = {
|
|
316
|
+
normal: {
|
|
317
|
+
fg: "#6366f1",
|
|
318
|
+
bg: "rgba(99, 102, 241, 0.08)",
|
|
319
|
+
trackBg: "#e5e7eb"
|
|
320
|
+
},
|
|
321
|
+
warning: {
|
|
322
|
+
fg: "#f59e0b",
|
|
323
|
+
bg: "rgba(245, 158, 11, 0.08)",
|
|
324
|
+
trackBg: "#e5e7eb"
|
|
325
|
+
},
|
|
326
|
+
critical: {
|
|
327
|
+
fg: "#ef4444",
|
|
328
|
+
bg: "rgba(239, 68, 68, 0.08)",
|
|
329
|
+
trackBg: "#e5e7eb"
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
var skeletonStyleInjected = false;
|
|
333
|
+
function ensureKeyframes() {
|
|
334
|
+
if (skeletonStyleInjected || typeof document === "undefined") return;
|
|
335
|
+
const sheet = document.createElement("style");
|
|
336
|
+
sheet.textContent = `@keyframes nozle-pulse{0%,100%{opacity:1}50%{opacity:.4}}`;
|
|
337
|
+
document.head.appendChild(sheet);
|
|
338
|
+
skeletonStyleInjected = true;
|
|
339
|
+
}
|
|
340
|
+
function UsageMeter({
|
|
341
|
+
metric,
|
|
342
|
+
variant = "bar",
|
|
343
|
+
className,
|
|
344
|
+
style,
|
|
345
|
+
...props
|
|
346
|
+
}) {
|
|
347
|
+
const { data, isLoading, error } = useUsage(metric);
|
|
348
|
+
if (isLoading) {
|
|
349
|
+
ensureKeyframes();
|
|
350
|
+
if (variant === "minimal") {
|
|
351
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
352
|
+
"span",
|
|
353
|
+
{
|
|
354
|
+
"data-nozle": "usage-meter",
|
|
355
|
+
"data-variant": "minimal",
|
|
356
|
+
className,
|
|
357
|
+
style: {
|
|
358
|
+
display: "inline-block",
|
|
359
|
+
width: 80,
|
|
360
|
+
height: 16,
|
|
361
|
+
borderRadius: 4,
|
|
362
|
+
background: "#e5e7eb",
|
|
363
|
+
animation: "nozle-pulse 1.5s ease-in-out infinite",
|
|
364
|
+
...style
|
|
365
|
+
},
|
|
366
|
+
...props
|
|
367
|
+
}
|
|
368
|
+
);
|
|
369
|
+
}
|
|
370
|
+
if (variant === "ring") {
|
|
371
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
372
|
+
"div",
|
|
373
|
+
{
|
|
374
|
+
"data-nozle": "usage-meter",
|
|
375
|
+
"data-variant": "ring",
|
|
376
|
+
className,
|
|
377
|
+
style: {
|
|
378
|
+
width: 96,
|
|
379
|
+
height: 96,
|
|
380
|
+
borderRadius: "50%",
|
|
381
|
+
background: "#e5e7eb",
|
|
382
|
+
animation: "nozle-pulse 1.5s ease-in-out infinite",
|
|
383
|
+
...style
|
|
384
|
+
},
|
|
385
|
+
...props
|
|
386
|
+
}
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
390
|
+
"div",
|
|
391
|
+
{
|
|
392
|
+
"data-nozle": "usage-meter",
|
|
393
|
+
"data-variant": "bar",
|
|
394
|
+
className,
|
|
395
|
+
style: {
|
|
396
|
+
maxWidth: 360,
|
|
397
|
+
fontFamily,
|
|
398
|
+
...style
|
|
399
|
+
},
|
|
400
|
+
...props,
|
|
401
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
402
|
+
"div",
|
|
403
|
+
{
|
|
404
|
+
style: {
|
|
405
|
+
height: 8,
|
|
406
|
+
borderRadius: 4,
|
|
407
|
+
background: "#e5e7eb",
|
|
408
|
+
animation: "nozle-pulse 1.5s ease-in-out infinite"
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
)
|
|
412
|
+
}
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
if (error || !data) return null;
|
|
416
|
+
const percent = data.limit > 0 ? Math.round(data.used / data.limit * 100) : 0;
|
|
417
|
+
const level = percent >= 90 ? "critical" : percent >= 75 ? "warning" : "normal";
|
|
418
|
+
const colors = levelColors[level];
|
|
419
|
+
if (variant === "minimal") {
|
|
420
|
+
const minimalStyle = {
|
|
421
|
+
fontFamily,
|
|
422
|
+
fontSize: 13,
|
|
423
|
+
fontWeight: 500,
|
|
424
|
+
color: colors.fg,
|
|
425
|
+
background: colors.bg,
|
|
426
|
+
padding: "3px 8px",
|
|
427
|
+
borderRadius: 6,
|
|
428
|
+
whiteSpace: "nowrap",
|
|
429
|
+
...style
|
|
430
|
+
};
|
|
431
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
432
|
+
"span",
|
|
433
|
+
{
|
|
434
|
+
"data-nozle": "usage-meter",
|
|
435
|
+
"data-variant": "minimal",
|
|
436
|
+
"data-level": level,
|
|
437
|
+
className,
|
|
438
|
+
style: minimalStyle,
|
|
439
|
+
...props,
|
|
440
|
+
children: [
|
|
441
|
+
data.used.toLocaleString(),
|
|
442
|
+
"/",
|
|
443
|
+
data.limit.toLocaleString()
|
|
444
|
+
]
|
|
445
|
+
}
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
if (variant === "ring") {
|
|
449
|
+
const size = 96;
|
|
450
|
+
const strokeWidth = 7;
|
|
451
|
+
const radius = (size - strokeWidth) / 2;
|
|
452
|
+
const circumference = 2 * Math.PI * radius;
|
|
453
|
+
const offset = circumference - percent / 100 * circumference;
|
|
454
|
+
const containerStyle = {
|
|
455
|
+
position: "relative",
|
|
456
|
+
display: "inline-flex",
|
|
457
|
+
alignItems: "center",
|
|
458
|
+
justifyContent: "center",
|
|
459
|
+
width: size,
|
|
460
|
+
height: size,
|
|
461
|
+
fontFamily,
|
|
462
|
+
...style
|
|
463
|
+
};
|
|
464
|
+
const labelStyle2 = {
|
|
465
|
+
position: "absolute",
|
|
466
|
+
inset: 0,
|
|
467
|
+
display: "flex",
|
|
468
|
+
flexDirection: "column",
|
|
469
|
+
alignItems: "center",
|
|
470
|
+
justifyContent: "center",
|
|
471
|
+
fontWeight: 700,
|
|
472
|
+
fontSize: 20,
|
|
473
|
+
lineHeight: 1,
|
|
474
|
+
color: colors.fg
|
|
475
|
+
};
|
|
476
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
477
|
+
"div",
|
|
478
|
+
{
|
|
479
|
+
"data-nozle": "usage-meter",
|
|
480
|
+
"data-variant": "ring",
|
|
481
|
+
"data-level": level,
|
|
482
|
+
className,
|
|
483
|
+
style: containerStyle,
|
|
484
|
+
...props,
|
|
485
|
+
children: [
|
|
486
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
487
|
+
"svg",
|
|
488
|
+
{
|
|
489
|
+
viewBox: `0 0 ${size} ${size}`,
|
|
490
|
+
width: size,
|
|
491
|
+
height: size,
|
|
492
|
+
style: { display: "block", transform: "rotate(-90deg)" },
|
|
493
|
+
children: [
|
|
494
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
495
|
+
"circle",
|
|
496
|
+
{
|
|
497
|
+
cx: size / 2,
|
|
498
|
+
cy: size / 2,
|
|
499
|
+
r: radius,
|
|
500
|
+
fill: "none",
|
|
501
|
+
stroke: colors.trackBg,
|
|
502
|
+
strokeWidth
|
|
503
|
+
}
|
|
504
|
+
),
|
|
505
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
506
|
+
"circle",
|
|
507
|
+
{
|
|
508
|
+
cx: size / 2,
|
|
509
|
+
cy: size / 2,
|
|
510
|
+
r: radius,
|
|
511
|
+
fill: "none",
|
|
512
|
+
stroke: colors.fg,
|
|
513
|
+
strokeWidth,
|
|
514
|
+
strokeDasharray: circumference,
|
|
515
|
+
strokeDashoffset: offset,
|
|
516
|
+
strokeLinecap: "round",
|
|
517
|
+
style: { transition: "stroke-dashoffset 0.4s ease" }
|
|
518
|
+
}
|
|
519
|
+
)
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { "data-nozle": "usage-meter-label", style: labelStyle2, children: [
|
|
524
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
525
|
+
percent,
|
|
526
|
+
"%"
|
|
527
|
+
] }),
|
|
528
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
529
|
+
"span",
|
|
530
|
+
{
|
|
531
|
+
style: {
|
|
532
|
+
fontSize: 10,
|
|
533
|
+
fontWeight: 400,
|
|
534
|
+
color: "#6b7280",
|
|
535
|
+
marginTop: 2
|
|
536
|
+
},
|
|
537
|
+
children: "used"
|
|
538
|
+
}
|
|
539
|
+
)
|
|
540
|
+
] })
|
|
541
|
+
]
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
const cardStyle = {
|
|
546
|
+
fontFamily,
|
|
547
|
+
maxWidth: 360,
|
|
548
|
+
background: "#ffffff",
|
|
549
|
+
border: "1px solid #e5e7eb",
|
|
550
|
+
borderRadius: 12,
|
|
551
|
+
padding: "16px 20px",
|
|
552
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02)",
|
|
553
|
+
...style
|
|
554
|
+
};
|
|
555
|
+
const headerStyle = {
|
|
556
|
+
display: "flex",
|
|
557
|
+
justifyContent: "space-between",
|
|
558
|
+
alignItems: "baseline",
|
|
559
|
+
marginBottom: 10
|
|
560
|
+
};
|
|
561
|
+
const labelStyle = {
|
|
562
|
+
fontSize: 13,
|
|
563
|
+
fontWeight: 500,
|
|
564
|
+
color: "#374151"
|
|
565
|
+
};
|
|
566
|
+
const valueStyle = {
|
|
567
|
+
fontSize: 13,
|
|
568
|
+
fontWeight: 600,
|
|
569
|
+
color: colors.fg
|
|
570
|
+
};
|
|
571
|
+
const trackStyle = {
|
|
572
|
+
height: 8,
|
|
573
|
+
borderRadius: 4,
|
|
574
|
+
background: colors.trackBg,
|
|
575
|
+
overflow: "hidden"
|
|
576
|
+
};
|
|
577
|
+
const fillStyle = {
|
|
578
|
+
height: "100%",
|
|
579
|
+
borderRadius: 4,
|
|
580
|
+
background: colors.fg,
|
|
581
|
+
width: `${Math.min(percent, 100)}%`,
|
|
582
|
+
transition: "width 0.4s ease"
|
|
583
|
+
};
|
|
584
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
585
|
+
"div",
|
|
586
|
+
{
|
|
587
|
+
"data-nozle": "usage-meter",
|
|
588
|
+
"data-variant": "bar",
|
|
589
|
+
"data-level": level,
|
|
590
|
+
className,
|
|
591
|
+
style: cardStyle,
|
|
592
|
+
...props,
|
|
593
|
+
children: [
|
|
594
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: headerStyle, children: [
|
|
595
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { "data-nozle": "usage-meter-label", style: labelStyle, children: [
|
|
596
|
+
data.used.toLocaleString(),
|
|
597
|
+
" / ",
|
|
598
|
+
data.limit.toLocaleString()
|
|
599
|
+
] }),
|
|
600
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { style: valueStyle, children: [
|
|
601
|
+
percent,
|
|
602
|
+
"%"
|
|
603
|
+
] })
|
|
604
|
+
] }),
|
|
605
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { "data-nozle": "usage-meter-track", style: trackStyle, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-nozle": "usage-meter-fill", style: fillStyle }) })
|
|
606
|
+
]
|
|
607
|
+
}
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
var fontFamily2 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
|
|
611
|
+
var statusColorMap = {
|
|
612
|
+
active: { dot: "#22c55e", bg: "rgba(34, 197, 94, 0.08)", text: "#15803d" },
|
|
613
|
+
trialing: { dot: "#6366f1", bg: "rgba(99, 102, 241, 0.08)", text: "#4f46e5" },
|
|
614
|
+
past_due: { dot: "#f59e0b", bg: "rgba(245, 158, 11, 0.08)", text: "#b45309" },
|
|
615
|
+
canceled: { dot: "#6b7280", bg: "rgba(107, 114, 128, 0.08)", text: "#4b5563" },
|
|
616
|
+
unpaid: { dot: "#ef4444", bg: "rgba(239, 68, 68, 0.08)", text: "#dc2626" },
|
|
617
|
+
incomplete: { dot: "#f59e0b", bg: "rgba(245, 158, 11, 0.08)", text: "#b45309" }
|
|
618
|
+
};
|
|
619
|
+
var defaultStatusColors = { dot: "#6366f1", bg: "rgba(99, 102, 241, 0.08)", text: "#4f46e5" };
|
|
620
|
+
function getStatusColors(status) {
|
|
621
|
+
return statusColorMap[status] ?? defaultStatusColors;
|
|
622
|
+
}
|
|
623
|
+
var skeletonStyleInjected2 = false;
|
|
624
|
+
function ensureKeyframes2() {
|
|
625
|
+
if (skeletonStyleInjected2 || typeof document === "undefined") return;
|
|
626
|
+
const sheet = document.createElement("style");
|
|
627
|
+
sheet.textContent = `@keyframes nozle-pulse{0%,100%{opacity:1}50%{opacity:.4}}`;
|
|
628
|
+
document.head.appendChild(sheet);
|
|
629
|
+
skeletonStyleInjected2 = true;
|
|
630
|
+
}
|
|
631
|
+
function PlanBadge({
|
|
632
|
+
variant = "pill",
|
|
633
|
+
className,
|
|
634
|
+
style,
|
|
635
|
+
...props
|
|
636
|
+
}) {
|
|
637
|
+
const { data, isLoading, error } = usePlan();
|
|
638
|
+
if (isLoading) {
|
|
639
|
+
ensureKeyframes2();
|
|
640
|
+
if (variant === "icon") {
|
|
641
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
642
|
+
"span",
|
|
643
|
+
{
|
|
644
|
+
"data-nozle": "plan-badge",
|
|
645
|
+
"data-variant": "icon",
|
|
646
|
+
className,
|
|
647
|
+
style: {
|
|
648
|
+
display: "inline-block",
|
|
649
|
+
width: 32,
|
|
650
|
+
height: 32,
|
|
651
|
+
borderRadius: "50%",
|
|
652
|
+
background: "#e5e7eb",
|
|
653
|
+
animation: "nozle-pulse 1.5s ease-in-out infinite",
|
|
654
|
+
...style
|
|
655
|
+
},
|
|
656
|
+
...props
|
|
657
|
+
}
|
|
658
|
+
);
|
|
659
|
+
}
|
|
660
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
661
|
+
"span",
|
|
662
|
+
{
|
|
663
|
+
"data-nozle": "plan-badge",
|
|
664
|
+
"data-variant": variant,
|
|
665
|
+
className,
|
|
666
|
+
style: {
|
|
667
|
+
display: "inline-block",
|
|
668
|
+
width: 72,
|
|
669
|
+
height: 22,
|
|
670
|
+
borderRadius: variant === "pill" ? 999 : 4,
|
|
671
|
+
background: "#e5e7eb",
|
|
672
|
+
animation: "nozle-pulse 1.5s ease-in-out infinite",
|
|
673
|
+
...style
|
|
674
|
+
},
|
|
675
|
+
...props
|
|
676
|
+
}
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
if (error || !data) return null;
|
|
680
|
+
const statusLabel = data.subscription_status.replace(/_/g, " ");
|
|
681
|
+
const colors = getStatusColors(data.subscription_status);
|
|
682
|
+
const planName = data.plan_slug;
|
|
683
|
+
if (variant === "text") {
|
|
684
|
+
const textStyle = {
|
|
685
|
+
fontFamily: fontFamily2,
|
|
686
|
+
display: "inline-flex",
|
|
687
|
+
alignItems: "center",
|
|
688
|
+
gap: 6,
|
|
689
|
+
fontSize: 14,
|
|
690
|
+
fontWeight: 500,
|
|
691
|
+
color: "#111827",
|
|
692
|
+
...style
|
|
693
|
+
};
|
|
694
|
+
const dotStyle2 = {
|
|
695
|
+
width: 8,
|
|
696
|
+
height: 8,
|
|
697
|
+
borderRadius: "50%",
|
|
698
|
+
background: colors.dot,
|
|
699
|
+
flexShrink: 0
|
|
700
|
+
};
|
|
701
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
702
|
+
"span",
|
|
703
|
+
{
|
|
704
|
+
"data-nozle": "plan-badge",
|
|
705
|
+
"data-variant": "text",
|
|
706
|
+
"data-status": data.subscription_status,
|
|
707
|
+
className,
|
|
708
|
+
style: textStyle,
|
|
709
|
+
...props,
|
|
710
|
+
children: [
|
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: dotStyle2, "aria-hidden": "true" }),
|
|
712
|
+
planName
|
|
713
|
+
]
|
|
714
|
+
}
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
if (variant === "icon") {
|
|
718
|
+
const iconStyle = {
|
|
719
|
+
fontFamily: fontFamily2,
|
|
720
|
+
display: "inline-flex",
|
|
721
|
+
alignItems: "center",
|
|
722
|
+
justifyContent: "center",
|
|
723
|
+
width: 32,
|
|
724
|
+
height: 32,
|
|
725
|
+
borderRadius: "50%",
|
|
726
|
+
background: colors.bg,
|
|
727
|
+
color: colors.text,
|
|
728
|
+
fontSize: 14,
|
|
729
|
+
fontWeight: 700,
|
|
730
|
+
lineHeight: 1,
|
|
731
|
+
flexShrink: 0,
|
|
732
|
+
...style
|
|
733
|
+
};
|
|
734
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
735
|
+
"span",
|
|
736
|
+
{
|
|
737
|
+
"data-nozle": "plan-badge",
|
|
738
|
+
"data-variant": "icon",
|
|
739
|
+
"data-status": data.subscription_status,
|
|
740
|
+
className,
|
|
741
|
+
style: iconStyle,
|
|
742
|
+
title: `${planName} (${statusLabel})`,
|
|
743
|
+
...props,
|
|
744
|
+
children: planName.charAt(0).toUpperCase()
|
|
745
|
+
}
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
const pillStyle = {
|
|
749
|
+
fontFamily: fontFamily2,
|
|
750
|
+
display: "inline-flex",
|
|
751
|
+
alignItems: "center",
|
|
752
|
+
gap: 6,
|
|
753
|
+
fontSize: 12,
|
|
754
|
+
fontWeight: 600,
|
|
755
|
+
lineHeight: 1.4,
|
|
756
|
+
color: colors.text,
|
|
757
|
+
background: colors.bg,
|
|
758
|
+
padding: "4px 12px",
|
|
759
|
+
borderRadius: 999,
|
|
760
|
+
whiteSpace: "nowrap",
|
|
761
|
+
...style
|
|
762
|
+
};
|
|
763
|
+
const dotStyle = {
|
|
764
|
+
width: 6,
|
|
765
|
+
height: 6,
|
|
766
|
+
borderRadius: "50%",
|
|
767
|
+
background: colors.dot,
|
|
768
|
+
flexShrink: 0
|
|
769
|
+
};
|
|
770
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
771
|
+
"span",
|
|
772
|
+
{
|
|
773
|
+
"data-nozle": "plan-badge",
|
|
774
|
+
"data-variant": "pill",
|
|
775
|
+
"data-status": data.subscription_status,
|
|
776
|
+
className,
|
|
777
|
+
style: pillStyle,
|
|
778
|
+
...props,
|
|
779
|
+
children: [
|
|
780
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: dotStyle, "aria-hidden": "true" }),
|
|
781
|
+
planName
|
|
782
|
+
]
|
|
783
|
+
}
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
var fontFamily3 = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';
|
|
787
|
+
var primaryColor = "#6366f1";
|
|
788
|
+
var primaryHover = "#4f46e5";
|
|
789
|
+
function UpgradePrompt({
|
|
790
|
+
feature,
|
|
791
|
+
variant = "card",
|
|
792
|
+
upgradeUrl = "/upgrade",
|
|
793
|
+
message = "Upgrade your plan to unlock this feature",
|
|
794
|
+
className,
|
|
795
|
+
style,
|
|
796
|
+
...props
|
|
797
|
+
}) {
|
|
798
|
+
const { allowed, isLoading } = useCan(feature ?? "");
|
|
799
|
+
if (isLoading || allowed || !feature) return null;
|
|
800
|
+
if (variant === "inline") {
|
|
801
|
+
const inlineStyle = {
|
|
802
|
+
fontFamily: fontFamily3,
|
|
803
|
+
fontSize: 13,
|
|
804
|
+
color: "#6b7280",
|
|
805
|
+
...style
|
|
806
|
+
};
|
|
807
|
+
const linkStyle = {
|
|
808
|
+
color: primaryColor,
|
|
809
|
+
fontWeight: 600,
|
|
810
|
+
textDecoration: "none",
|
|
811
|
+
marginLeft: 4
|
|
812
|
+
};
|
|
813
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
814
|
+
"span",
|
|
815
|
+
{
|
|
816
|
+
"data-nozle": "upgrade-prompt",
|
|
817
|
+
"data-variant": "inline",
|
|
818
|
+
className,
|
|
819
|
+
style: inlineStyle,
|
|
820
|
+
...props,
|
|
821
|
+
children: [
|
|
822
|
+
message,
|
|
823
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
824
|
+
"a",
|
|
825
|
+
{
|
|
826
|
+
href: upgradeUrl,
|
|
827
|
+
"data-nozle": "upgrade-prompt-link",
|
|
828
|
+
style: linkStyle,
|
|
829
|
+
onMouseEnter: (e) => {
|
|
830
|
+
e.currentTarget.style.textDecoration = "underline";
|
|
831
|
+
},
|
|
832
|
+
onMouseLeave: (e) => {
|
|
833
|
+
e.currentTarget.style.textDecoration = "none";
|
|
834
|
+
},
|
|
835
|
+
children: "Upgrade"
|
|
836
|
+
}
|
|
837
|
+
)
|
|
838
|
+
]
|
|
839
|
+
}
|
|
840
|
+
);
|
|
841
|
+
}
|
|
842
|
+
if (variant === "banner") {
|
|
843
|
+
const bannerStyle = {
|
|
844
|
+
fontFamily: fontFamily3,
|
|
845
|
+
display: "flex",
|
|
846
|
+
alignItems: "center",
|
|
847
|
+
justifyContent: "space-between",
|
|
848
|
+
gap: 16,
|
|
849
|
+
background: "rgba(99, 102, 241, 0.06)",
|
|
850
|
+
border: "1px solid rgba(99, 102, 241, 0.15)",
|
|
851
|
+
borderRadius: 10,
|
|
852
|
+
padding: "12px 20px",
|
|
853
|
+
...style
|
|
854
|
+
};
|
|
855
|
+
const msgStyle2 = {
|
|
856
|
+
fontSize: 14,
|
|
857
|
+
fontWeight: 500,
|
|
858
|
+
color: "#374151",
|
|
859
|
+
flex: 1
|
|
860
|
+
};
|
|
861
|
+
const btnStyle2 = {
|
|
862
|
+
display: "inline-flex",
|
|
863
|
+
alignItems: "center",
|
|
864
|
+
justifyContent: "center",
|
|
865
|
+
fontSize: 13,
|
|
866
|
+
fontWeight: 600,
|
|
867
|
+
color: "#ffffff",
|
|
868
|
+
background: primaryColor,
|
|
869
|
+
border: "none",
|
|
870
|
+
borderRadius: 8,
|
|
871
|
+
padding: "8px 18px",
|
|
872
|
+
textDecoration: "none",
|
|
873
|
+
cursor: "pointer",
|
|
874
|
+
whiteSpace: "nowrap",
|
|
875
|
+
transition: "background 0.15s ease"
|
|
876
|
+
};
|
|
877
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
878
|
+
"div",
|
|
879
|
+
{
|
|
880
|
+
"data-nozle": "upgrade-prompt",
|
|
881
|
+
"data-variant": "banner",
|
|
882
|
+
className,
|
|
883
|
+
style: bannerStyle,
|
|
884
|
+
...props,
|
|
885
|
+
children: [
|
|
886
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { "data-nozle": "upgrade-prompt-message", style: msgStyle2, children: message }),
|
|
887
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
888
|
+
"a",
|
|
889
|
+
{
|
|
890
|
+
href: upgradeUrl,
|
|
891
|
+
"data-nozle": "upgrade-prompt-action",
|
|
892
|
+
style: btnStyle2,
|
|
893
|
+
onMouseEnter: (e) => {
|
|
894
|
+
e.currentTarget.style.background = primaryHover;
|
|
895
|
+
},
|
|
896
|
+
onMouseLeave: (e) => {
|
|
897
|
+
e.currentTarget.style.background = primaryColor;
|
|
898
|
+
},
|
|
899
|
+
children: "Upgrade"
|
|
900
|
+
}
|
|
901
|
+
)
|
|
902
|
+
]
|
|
903
|
+
}
|
|
904
|
+
);
|
|
905
|
+
}
|
|
906
|
+
const cardStyle = {
|
|
907
|
+
fontFamily: fontFamily3,
|
|
908
|
+
maxWidth: 400,
|
|
909
|
+
background: "#ffffff",
|
|
910
|
+
border: "1px solid #e5e7eb",
|
|
911
|
+
borderRadius: 16,
|
|
912
|
+
padding: 24,
|
|
913
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02)",
|
|
914
|
+
textAlign: "center",
|
|
915
|
+
...style
|
|
916
|
+
};
|
|
917
|
+
const iconWrapStyle = {
|
|
918
|
+
display: "inline-flex",
|
|
919
|
+
alignItems: "center",
|
|
920
|
+
justifyContent: "center",
|
|
921
|
+
width: 48,
|
|
922
|
+
height: 48,
|
|
923
|
+
borderRadius: 12,
|
|
924
|
+
background: "rgba(99, 102, 241, 0.08)",
|
|
925
|
+
marginBottom: 16
|
|
926
|
+
};
|
|
927
|
+
const msgStyle = {
|
|
928
|
+
fontSize: 15,
|
|
929
|
+
fontWeight: 500,
|
|
930
|
+
color: "#374151",
|
|
931
|
+
lineHeight: 1.5,
|
|
932
|
+
margin: 0,
|
|
933
|
+
marginBottom: 20
|
|
934
|
+
};
|
|
935
|
+
const btnStyle = {
|
|
936
|
+
display: "inline-flex",
|
|
937
|
+
alignItems: "center",
|
|
938
|
+
justifyContent: "center",
|
|
939
|
+
fontSize: 14,
|
|
940
|
+
fontWeight: 600,
|
|
941
|
+
color: "#ffffff",
|
|
942
|
+
background: primaryColor,
|
|
943
|
+
border: "none",
|
|
944
|
+
borderRadius: 10,
|
|
945
|
+
padding: "10px 24px",
|
|
946
|
+
textDecoration: "none",
|
|
947
|
+
cursor: "pointer",
|
|
948
|
+
transition: "background 0.15s ease",
|
|
949
|
+
width: "100%"
|
|
950
|
+
};
|
|
951
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
952
|
+
"div",
|
|
953
|
+
{
|
|
954
|
+
"data-nozle": "upgrade-prompt",
|
|
955
|
+
"data-variant": "card",
|
|
956
|
+
className,
|
|
957
|
+
style: cardStyle,
|
|
958
|
+
...props,
|
|
959
|
+
children: [
|
|
960
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-nozle": "upgrade-prompt-content", children: [
|
|
961
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: iconWrapStyle, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
962
|
+
"svg",
|
|
963
|
+
{
|
|
964
|
+
width: "24",
|
|
965
|
+
height: "24",
|
|
966
|
+
viewBox: "0 0 24 24",
|
|
967
|
+
fill: "none",
|
|
968
|
+
stroke: primaryColor,
|
|
969
|
+
strokeWidth: "2",
|
|
970
|
+
strokeLinecap: "round",
|
|
971
|
+
strokeLinejoin: "round",
|
|
972
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M13 2L3 14h9l-1 8 10-12h-9l1-8z" })
|
|
973
|
+
}
|
|
974
|
+
) }),
|
|
975
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { "data-nozle": "upgrade-prompt-message", style: msgStyle, children: message })
|
|
976
|
+
] }),
|
|
977
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
978
|
+
"a",
|
|
979
|
+
{
|
|
980
|
+
href: upgradeUrl,
|
|
981
|
+
"data-nozle": "upgrade-prompt-action",
|
|
982
|
+
style: btnStyle,
|
|
983
|
+
onMouseEnter: (e) => {
|
|
984
|
+
e.currentTarget.style.background = primaryHover;
|
|
985
|
+
},
|
|
986
|
+
onMouseLeave: (e) => {
|
|
987
|
+
e.currentTarget.style.background = primaryColor;
|
|
988
|
+
},
|
|
989
|
+
children: "Upgrade Now"
|
|
990
|
+
}
|
|
991
|
+
)
|
|
992
|
+
]
|
|
993
|
+
}
|
|
994
|
+
);
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
exports.BillingProvider = BillingProvider;
|
|
998
|
+
exports.PlanBadge = PlanBadge;
|
|
999
|
+
exports.UpgradePrompt = UpgradePrompt;
|
|
1000
|
+
exports.UsageMeter = UsageMeter;
|
|
1001
|
+
exports.useBillingContext = useBillingContext;
|
|
1002
|
+
exports.useCan = useCan;
|
|
1003
|
+
exports.useCheckout = useCheckout;
|
|
1004
|
+
exports.usePlan = usePlan;
|
|
1005
|
+
exports.usePlans = usePlans;
|
|
1006
|
+
exports.useSubscribe = useSubscribe;
|
|
1007
|
+
exports.useUsage = useUsage;
|
|
1008
|
+
//# sourceMappingURL=index.cjs.map
|
|
1009
|
+
//# sourceMappingURL=index.cjs.map
|