@startsimpli/billing 0.4.15 → 0.4.16
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/package.json
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Theme-contract guard for @startsimpli/billing (startsim-1f3n.3).
|
|
3
|
+
*
|
|
4
|
+
* Shared components may only use the semantic tokens from
|
|
5
|
+
* packages/ui/theme/contract.css. The numeric Tailwind ramp
|
|
6
|
+
* (`bg-primary-600`, `focus:ring-primary-500`, …) is not part of it — an app
|
|
7
|
+
* that declares `--color-primary` without a ramp gets NO rule for those
|
|
8
|
+
* classes, which renders a plan card border as invisible white-on-white.
|
|
9
|
+
* Use an opacity modifier on the token instead (`hover:bg-primary/90`).
|
|
10
|
+
*/
|
|
11
|
+
import * as fs from 'fs'
|
|
12
|
+
import * as path from 'path'
|
|
13
|
+
import { describe, it, expect } from 'vitest'
|
|
14
|
+
|
|
15
|
+
const SRC = path.resolve(__dirname, '..')
|
|
16
|
+
const RAMP = /\b[a-z-]*-(primary|accent|secondary)-\d{2,3}\b/
|
|
17
|
+
|
|
18
|
+
function sources(dir: string, acc: string[] = []): string[] {
|
|
19
|
+
for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
20
|
+
const full = path.join(dir, e.name)
|
|
21
|
+
if (e.isDirectory()) {
|
|
22
|
+
if (e.name !== '__tests__' && e.name !== 'node_modules') sources(full, acc)
|
|
23
|
+
} else if (/\.tsx?$/.test(e.name)) acc.push(full)
|
|
24
|
+
}
|
|
25
|
+
return acc
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe('@startsimpli/billing theme contract', () => {
|
|
29
|
+
it('no component styles against a numeric color ramp', () => {
|
|
30
|
+
const offenders: string[] = []
|
|
31
|
+
for (const file of sources(SRC)) {
|
|
32
|
+
fs.readFileSync(file, 'utf8').split('\n').forEach((line, i) => {
|
|
33
|
+
const code = line.replace(/^\s*(\*|\/\/).*$/, '')
|
|
34
|
+
const hit = code.match(RAMP)
|
|
35
|
+
if (hit) offenders.push(`${path.relative(SRC, file)}:${i + 1} ${hit[0]}`)
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
expect(offenders).toEqual([])
|
|
39
|
+
})
|
|
40
|
+
})
|
|
@@ -433,7 +433,7 @@ export function SubscriptionManager({
|
|
|
433
433
|
|
|
434
434
|
// Border: current = solid ring; featured upgrade = blue; else gray.
|
|
435
435
|
const cardBorder =
|
|
436
|
-
isCurrent ? "border-2 border-primary
|
|
436
|
+
isCurrent ? "border-2 border-primary ring-2 ring-primary/20 bg-white shadow-md"
|
|
437
437
|
: offer.isFeatured ? "border border-blue-600 shadow-md bg-white"
|
|
438
438
|
: "border border-gray-200 bg-white shadow-sm";
|
|
439
439
|
|
|
@@ -457,7 +457,7 @@ export function SubscriptionManager({
|
|
|
457
457
|
{isCurrent && (
|
|
458
458
|
<span
|
|
459
459
|
data-testid={`current-plan-badge-${offer.slug}`}
|
|
460
|
-
className="absolute -top-2.5 right-4 inline-block bg-primary
|
|
460
|
+
className="absolute -top-2.5 right-4 inline-block bg-primary text-primary-foreground text-xs font-bold uppercase tracking-wide px-2.5 py-0.5 rounded-full"
|
|
461
461
|
>
|
|
462
462
|
Current Plan
|
|
463
463
|
</span>
|