@startsimpli/billing 0.4.6 → 0.4.8

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startsimpli/billing",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "Universal billing integration for StartSimpli Next.js apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -22,45 +22,45 @@ const mockProduct: BillingProduct = {
22
22
  id: "offer-1",
23
23
  name: "Starter",
24
24
  slug: "starter-monthly",
25
- unit_price: "0.00",
25
+ unitPrice: "0.00",
26
26
  currency: "USD",
27
- pricing_model: "flat",
28
- interval_unit: "month",
29
- interval_count: 1,
30
- interval_display: "per month",
31
- is_recurring: true,
32
- is_free: true,
27
+ pricingModel: "flat",
28
+ intervalUnit: "month",
29
+ intervalCount: 1,
30
+ intervalDisplay: "per month",
31
+ isRecurring: true,
32
+ isFree: true,
33
33
  features: [
34
34
  { key: "seats", name: "Team seats", value: 1, limit: 1, category: "core" },
35
35
  { key: "projects", name: "Projects", value: 3, limit: 3, category: "core" },
36
36
  ],
37
- is_active: true,
38
- is_featured: false,
39
- trial_days: 0,
40
- sort_order: 0,
41
- cta_text: "Start Free",
37
+ isActive: true,
38
+ isFeatured: false,
39
+ trialDays: 0,
40
+ sortOrder: 0,
41
+ ctaText: "Start Free",
42
42
  },
43
43
  {
44
44
  id: "offer-2",
45
45
  name: "Pro",
46
46
  slug: "pro-monthly",
47
- unit_price: "49.00",
47
+ unitPrice: "49.00",
48
48
  currency: "USD",
49
- pricing_model: "flat",
50
- interval_unit: "month",
51
- interval_count: 1,
52
- interval_display: "per month",
53
- is_recurring: true,
54
- is_free: false,
49
+ pricingModel: "flat",
50
+ intervalUnit: "month",
51
+ intervalCount: 1,
52
+ intervalDisplay: "per month",
53
+ isRecurring: true,
54
+ isFree: false,
55
55
  features: [
56
56
  { key: "seats", name: "Team seats", value: 5, limit: 5, category: "core" },
57
57
  { key: "projects", name: "Projects", value: "Unlimited", category: "core" },
58
58
  ],
59
- is_active: true,
60
- is_featured: true,
61
- trial_days: 14,
62
- sort_order: 1,
63
- cta_text: "Start Trial",
59
+ isActive: true,
60
+ isFeatured: true,
61
+ trialDays: 14,
62
+ sortOrder: 1,
63
+ ctaText: "Start Trial",
64
64
  },
65
65
  ],
66
66
  };
@@ -140,7 +140,7 @@ describe("PricingDetailPage integration", () => {
140
140
  id: "offer-1",
141
141
  slug: "starter-monthly",
142
142
  name: "Starter",
143
- is_free: true,
143
+ isFree: true,
144
144
  })
145
145
  );
146
146
  });
@@ -172,8 +172,8 @@ describe("PricingDetailPage integration", () => {
172
172
  id: "offer-2",
173
173
  slug: "pro-monthly",
174
174
  name: "Pro",
175
- is_free: false,
176
- unit_price: "49.00",
175
+ isFree: false,
176
+ unitPrice: "49.00",
177
177
  })
178
178
  );
179
179
  });
@@ -26,73 +26,73 @@ const mockProduct: BillingProduct = {
26
26
  id: "offer-1",
27
27
  name: "Starter",
28
28
  slug: "starter-monthly",
29
- unit_price: "0.00",
29
+ unitPrice: "0.00",
30
30
  currency: "USD",
31
- pricing_model: "flat",
32
- interval_unit: "month",
33
- interval_count: 1,
34
- interval_display: "per month",
35
- is_recurring: true,
36
- is_free: true,
31
+ pricingModel: "flat",
32
+ intervalUnit: "month",
33
+ intervalCount: 1,
34
+ intervalDisplay: "per month",
35
+ isRecurring: true,
36
+ isFree: true,
37
37
  features: [
38
38
  { key: "seats", name: "Team seats", value: 1, limit: 1, category: "core" },
39
39
  { key: "projects", name: "Projects", value: 3, limit: 3, category: "core" },
40
40
  { key: "email_support", name: "Email support", value: true, category: "support" },
41
41
  { key: "priority_support", name: "Priority support", value: false, category: "support" },
42
42
  ],
43
- is_active: true,
44
- is_featured: false,
45
- trial_days: 0,
46
- sort_order: 0,
47
- cta_text: "Start Free",
43
+ isActive: true,
44
+ isFeatured: false,
45
+ trialDays: 0,
46
+ sortOrder: 0,
47
+ ctaText: "Start Free",
48
48
  },
49
49
  {
50
50
  id: "offer-2",
51
51
  name: "Pro",
52
52
  slug: "pro-monthly",
53
- unit_price: "49.00",
53
+ unitPrice: "49.00",
54
54
  currency: "USD",
55
- pricing_model: "flat",
56
- interval_unit: "month",
57
- interval_count: 1,
58
- interval_display: "per month",
59
- is_recurring: true,
60
- is_free: false,
55
+ pricingModel: "flat",
56
+ intervalUnit: "month",
57
+ intervalCount: 1,
58
+ intervalDisplay: "per month",
59
+ isRecurring: true,
60
+ isFree: false,
61
61
  features: [
62
62
  { key: "seats", name: "Team seats", value: 5, limit: 5, category: "core" },
63
63
  { key: "projects", name: "Projects", value: "Unlimited", category: "core" },
64
64
  { key: "email_support", name: "Email support", value: true, category: "support" },
65
65
  { key: "priority_support", name: "Priority support", value: true, category: "support" },
66
66
  ],
67
- is_active: true,
68
- is_featured: true,
69
- trial_days: 14,
70
- sort_order: 1,
71
- cta_text: "Start Trial",
67
+ isActive: true,
68
+ isFeatured: true,
69
+ trialDays: 14,
70
+ sortOrder: 1,
71
+ ctaText: "Start Trial",
72
72
  },
73
73
  {
74
74
  id: "offer-3",
75
75
  name: "Enterprise",
76
76
  slug: "enterprise-monthly",
77
- unit_price: "199.00",
77
+ unitPrice: "199.00",
78
78
  currency: "USD",
79
- pricing_model: "per_seat",
80
- interval_unit: "month",
81
- interval_count: 1,
82
- interval_display: "per month",
83
- is_recurring: true,
84
- is_free: false,
79
+ pricingModel: "per_seat",
80
+ intervalUnit: "month",
81
+ intervalCount: 1,
82
+ intervalDisplay: "per month",
83
+ isRecurring: true,
84
+ isFree: false,
85
85
  features: [
86
86
  { key: "seats", name: "Team seats", value: "Unlimited", category: "core" },
87
87
  { key: "projects", name: "Projects", value: "Unlimited", category: "core" },
88
88
  { key: "email_support", name: "Email support", value: true, category: "support" },
89
89
  { key: "priority_support", name: "Priority support", value: true, category: "support" },
90
90
  ],
91
- is_active: true,
92
- is_featured: false,
93
- trial_days: 0,
94
- sort_order: 2,
95
- cta_text: "Contact Sales",
91
+ isActive: true,
92
+ isFeatured: false,
93
+ trialDays: 0,
94
+ sortOrder: 2,
95
+ ctaText: "Contact Sales",
96
96
  },
97
97
  ],
98
98
  };
@@ -104,7 +104,7 @@ interface DetailCardProps {
104
104
  }
105
105
 
106
106
  function DetailCard({ offer, onSelect }: DetailCardProps) {
107
- const isFeatured = offer.is_featured;
107
+ const isFeatured = offer.isFeatured;
108
108
 
109
109
  return (
110
110
  <div
@@ -126,23 +126,23 @@ function DetailCard({ offer, onSelect }: DetailCardProps) {
126
126
  <h2 className="text-xl font-bold text-gray-900 mb-4">{offer.name}</h2>
127
127
 
128
128
  <div className="mb-2">
129
- {offer.is_free ? (
129
+ {offer.isFree ? (
130
130
  <span aria-label="Free">
131
131
  <span aria-hidden="true" className="text-4xl font-extrabold text-gray-900">Free</span>
132
132
  </span>
133
133
  ) : (
134
- <span aria-label={`${Math.floor(parseFloat(offer.unit_price) || 0)} dollars ${offer.interval_display}`}>
134
+ <span aria-label={`${Math.floor(parseFloat(offer.unitPrice) || 0)} dollars ${offer.intervalDisplay}`}>
135
135
  <span aria-hidden="true" className="text-4xl font-extrabold text-gray-900">
136
- ${Math.floor(parseFloat(offer.unit_price) || 0)}
136
+ ${Math.floor(parseFloat(offer.unitPrice) || 0)}
137
137
  </span>
138
- <span aria-hidden="true" className="text-base text-gray-500 ml-1"> {offer.interval_display}</span>
138
+ <span aria-hidden="true" className="text-base text-gray-500 ml-1"> {offer.intervalDisplay}</span>
139
139
  </span>
140
140
  )}
141
141
  </div>
142
142
 
143
- {offer.trial_days > 0 && (
143
+ {offer.trialDays > 0 && (
144
144
  <span className="inline-block bg-blue-50 text-blue-700 text-sm font-semibold px-3 py-1 rounded-lg mb-5 w-fit">
145
- {offer.trial_days}-day free trial
145
+ {offer.trialDays}-day free trial
146
146
  </span>
147
147
  )}
148
148
 
@@ -174,7 +174,7 @@ function DetailCard({ offer, onSelect }: DetailCardProps) {
174
174
  }
175
175
  `}
176
176
  >
177
- {offer.cta_text}
177
+ {offer.ctaText}
178
178
  </button>
179
179
  </div>
180
180
  );
@@ -25,67 +25,67 @@ const mockProduct: BillingProduct = {
25
25
  id: "offer-1",
26
26
  name: "Starter",
27
27
  slug: "starter-monthly",
28
- unit_price: "0.00",
28
+ unitPrice: "0.00",
29
29
  currency: "USD",
30
- pricing_model: "flat",
31
- interval_unit: "month",
32
- interval_count: 1,
33
- interval_display: "per month",
34
- is_recurring: true,
35
- is_free: true,
30
+ pricingModel: "flat",
31
+ intervalUnit: "month",
32
+ intervalCount: 1,
33
+ intervalDisplay: "per month",
34
+ isRecurring: true,
35
+ isFree: true,
36
36
  features: [
37
37
  { key: "seats", name: "Team seats", value: 1, limit: 1 },
38
38
  { key: "projects", name: "Projects", value: 3, limit: 3 },
39
39
  ],
40
- is_active: true,
41
- is_featured: false,
42
- trial_days: 0,
43
- sort_order: 0,
44
- cta_text: "Start Free",
40
+ isActive: true,
41
+ isFeatured: false,
42
+ trialDays: 0,
43
+ sortOrder: 0,
44
+ ctaText: "Start Free",
45
45
  },
46
46
  {
47
47
  id: "offer-2",
48
48
  name: "Pro",
49
49
  slug: "pro-monthly",
50
- unit_price: "49.00",
50
+ unitPrice: "49.00",
51
51
  currency: "USD",
52
- pricing_model: "flat",
53
- interval_unit: "month",
54
- interval_count: 1,
55
- interval_display: "per month",
56
- is_recurring: true,
57
- is_free: false,
52
+ pricingModel: "flat",
53
+ intervalUnit: "month",
54
+ intervalCount: 1,
55
+ intervalDisplay: "per month",
56
+ isRecurring: true,
57
+ isFree: false,
58
58
  features: [
59
59
  { key: "seats", name: "Team seats", value: 5, limit: 5 },
60
60
  { key: "projects", name: "Projects", value: "Unlimited" },
61
61
  ],
62
- is_active: true,
63
- is_featured: true,
64
- trial_days: 14,
65
- sort_order: 1,
66
- cta_text: "Start Trial",
62
+ isActive: true,
63
+ isFeatured: true,
64
+ trialDays: 14,
65
+ sortOrder: 1,
66
+ ctaText: "Start Trial",
67
67
  },
68
68
  {
69
69
  id: "offer-3",
70
70
  name: "Enterprise",
71
71
  slug: "enterprise-monthly",
72
- unit_price: "199.00",
72
+ unitPrice: "199.00",
73
73
  currency: "USD",
74
- pricing_model: "per_seat",
75
- interval_unit: "month",
76
- interval_count: 1,
77
- interval_display: "per month",
78
- is_recurring: true,
79
- is_free: false,
74
+ pricingModel: "per_seat",
75
+ intervalUnit: "month",
76
+ intervalCount: 1,
77
+ intervalDisplay: "per month",
78
+ isRecurring: true,
79
+ isFree: false,
80
80
  features: [
81
81
  { key: "seats", name: "Team seats", value: "Unlimited" },
82
82
  { key: "projects", name: "Projects", value: "Unlimited" },
83
83
  ],
84
- is_active: true,
85
- is_featured: false,
86
- trial_days: 0,
87
- sort_order: 2,
88
- cta_text: "Contact Sales",
84
+ isActive: true,
85
+ isFeatured: false,
86
+ trialDays: 0,
87
+ sortOrder: 2,
88
+ ctaText: "Contact Sales",
89
89
  },
90
90
  ],
91
91
  };
@@ -77,7 +77,7 @@ interface PricingCardProps {
77
77
  }
78
78
 
79
79
  function PricingCard({ offer, onSelect }: PricingCardProps) {
80
- const isFeatured = offer.is_featured;
80
+ const isFeatured = offer.isFeatured;
81
81
 
82
82
  return (
83
83
  <div
@@ -100,24 +100,24 @@ function PricingCard({ offer, onSelect }: PricingCardProps) {
100
100
  <h2 className="text-xl font-bold text-gray-900 mb-4">{offer.name}</h2>
101
101
 
102
102
  <div className="mb-2">
103
- {offer.is_free ? (
103
+ {offer.isFree ? (
104
104
  <span className="text-4xl font-extrabold text-gray-900">Free</span>
105
105
  ) : (
106
106
  <span>
107
107
  <span className="text-4xl font-extrabold text-gray-900">
108
- ${Math.floor(parseFloat(offer.unit_price) || 0)}
108
+ ${Math.floor(parseFloat(offer.unitPrice) || 0)}
109
109
  </span>
110
- <span className="text-base text-gray-500 ml-1"> {offer.interval_display}</span>
110
+ <span className="text-base text-gray-500 ml-1"> {offer.intervalDisplay}</span>
111
111
  </span>
112
112
  )}
113
113
  </div>
114
114
 
115
- {offer.trial_days > 0 && (
115
+ {offer.trialDays > 0 && (
116
116
  <span
117
117
  data-testid="trial-badge"
118
118
  className="inline-block bg-blue-50 text-blue-700 text-sm font-semibold px-3 py-1 rounded-lg mb-5 w-fit"
119
119
  >
120
- {offer.trial_days}-day free trial
120
+ {offer.trialDays}-day free trial
121
121
  </span>
122
122
  )}
123
123
 
@@ -146,7 +146,7 @@ function PricingCard({ offer, onSelect }: PricingCardProps) {
146
146
  }
147
147
  `}
148
148
  >
149
- {offer.cta_text}
149
+ {offer.ctaText}
150
150
  </button>
151
151
  </div>
152
152
  );
@@ -25,14 +25,14 @@ const mockProduct: BillingProduct = {
25
25
  id: "offer-1",
26
26
  name: "Starter",
27
27
  slug: "starter-monthly",
28
- unit_price: "0.00",
28
+ unitPrice: "0.00",
29
29
  currency: "USD",
30
- pricing_model: "flat",
31
- interval_unit: "month",
32
- interval_count: 1,
33
- interval_display: "per month",
34
- is_recurring: true,
35
- is_free: true,
30
+ pricingModel: "flat",
31
+ intervalUnit: "month",
32
+ intervalCount: 1,
33
+ intervalDisplay: "per month",
34
+ isRecurring: true,
35
+ isFree: true,
36
36
  features: [
37
37
  { key: "seats", name: "Team seats", value: 1, limit: 1 },
38
38
  { key: "projects", name: "Projects", value: 3, limit: 3 },
@@ -40,24 +40,24 @@ const mockProduct: BillingProduct = {
40
40
  { key: "support", name: "Support", value: "Email" },
41
41
  { key: "api", name: "API Access", value: "Limited" },
42
42
  ],
43
- is_active: true,
44
- is_featured: false,
45
- trial_days: 0,
46
- sort_order: 0,
47
- cta_text: "Start Free",
43
+ isActive: true,
44
+ isFeatured: false,
45
+ trialDays: 0,
46
+ sortOrder: 0,
47
+ ctaText: "Start Free",
48
48
  },
49
49
  {
50
50
  id: "offer-2",
51
51
  name: "Pro",
52
52
  slug: "pro-monthly",
53
- unit_price: "49.00",
53
+ unitPrice: "49.00",
54
54
  currency: "USD",
55
- pricing_model: "flat",
56
- interval_unit: "month",
57
- interval_count: 1,
58
- interval_display: "per month",
59
- is_recurring: true,
60
- is_free: false,
55
+ pricingModel: "flat",
56
+ intervalUnit: "month",
57
+ intervalCount: 1,
58
+ intervalDisplay: "per month",
59
+ isRecurring: true,
60
+ isFree: false,
61
61
  features: [
62
62
  { key: "seats", name: "Team seats", value: 5, limit: 5 },
63
63
  { key: "projects", name: "Projects", value: "Unlimited" },
@@ -65,24 +65,24 @@ const mockProduct: BillingProduct = {
65
65
  { key: "support", name: "Support", value: "Priority" },
66
66
  { key: "api", name: "API Access", value: "Full" },
67
67
  ],
68
- is_active: true,
69
- is_featured: true,
70
- trial_days: 14,
71
- sort_order: 1,
72
- cta_text: "Start Trial",
68
+ isActive: true,
69
+ isFeatured: true,
70
+ trialDays: 14,
71
+ sortOrder: 1,
72
+ ctaText: "Start Trial",
73
73
  },
74
74
  {
75
75
  id: "offer-3",
76
76
  name: "Enterprise",
77
77
  slug: "enterprise-monthly",
78
- unit_price: "199.00",
78
+ unitPrice: "199.00",
79
79
  currency: "USD",
80
- pricing_model: "per_seat",
81
- interval_unit: "month",
82
- interval_count: 1,
83
- interval_display: "per month",
84
- is_recurring: true,
85
- is_free: false,
80
+ pricingModel: "per_seat",
81
+ intervalUnit: "month",
82
+ intervalCount: 1,
83
+ intervalDisplay: "per month",
84
+ isRecurring: true,
85
+ isFree: false,
86
86
  features: [
87
87
  { key: "seats", name: "Team seats", value: "Unlimited" },
88
88
  { key: "projects", name: "Projects", value: "Unlimited" },
@@ -91,11 +91,11 @@ const mockProduct: BillingProduct = {
91
91
  { key: "api", name: "API Access", value: "Full" },
92
92
  { key: "sla", name: "SLA", value: "99.9%" },
93
93
  ],
94
- is_active: true,
95
- is_featured: false,
96
- trial_days: 0,
97
- sort_order: 2,
98
- cta_text: "Contact Sales",
94
+ isActive: true,
95
+ isFeatured: false,
96
+ trialDays: 0,
97
+ sortOrder: 2,
98
+ ctaText: "Contact Sales",
99
99
  },
100
100
  ],
101
101
  };
@@ -77,7 +77,7 @@ interface SectionCardProps {
77
77
  }
78
78
 
79
79
  function SectionCard({ offer, onSelect, maxFeatures }: SectionCardProps) {
80
- const isFeatured = offer.is_featured;
80
+ const isFeatured = offer.isFeatured;
81
81
  const visibleFeatures = offer.features.slice(0, maxFeatures);
82
82
 
83
83
  return (
@@ -95,24 +95,24 @@ function SectionCard({ offer, onSelect, maxFeatures }: SectionCardProps) {
95
95
  <h3 className="text-lg font-bold text-gray-900 mb-2">{offer.name}</h3>
96
96
 
97
97
  <div className="mb-2">
98
- {offer.is_free ? (
98
+ {offer.isFree ? (
99
99
  <span className="text-2xl font-extrabold text-gray-900">Free</span>
100
100
  ) : (
101
101
  <span>
102
102
  <span className="text-2xl font-extrabold text-gray-900">
103
- ${Math.floor(parseFloat(offer.unit_price) || 0)}
103
+ ${Math.floor(parseFloat(offer.unitPrice) || 0)}
104
104
  </span>
105
- <span className="text-sm text-gray-500 ml-1"> {offer.interval_display}</span>
105
+ <span className="text-sm text-gray-500 ml-1"> {offer.intervalDisplay}</span>
106
106
  </span>
107
107
  )}
108
108
  </div>
109
109
 
110
- {offer.trial_days > 0 && (
110
+ {offer.trialDays > 0 && (
111
111
  <span
112
112
  data-testid="trial-badge"
113
113
  className="inline-block bg-blue-50 text-blue-700 text-xs font-semibold px-2 py-0.5 rounded-md mb-3 w-fit"
114
114
  >
115
- {offer.trial_days}-day free trial
115
+ {offer.trialDays}-day free trial
116
116
  </span>
117
117
  )}
118
118
 
@@ -147,7 +147,7 @@ function SectionCard({ offer, onSelect, maxFeatures }: SectionCardProps) {
147
147
  }
148
148
  `}
149
149
  >
150
- {offer.cta_text}
150
+ {offer.ctaText}
151
151
  </button>
152
152
  </div>
153
153
  );
@@ -31,67 +31,67 @@ const mockProduct: BillingProduct = {
31
31
  id: "offer-1",
32
32
  name: "Starter",
33
33
  slug: "starter-monthly",
34
- unit_price: "0.00",
34
+ unitPrice: "0.00",
35
35
  currency: "USD",
36
- pricing_model: "flat",
37
- interval_unit: "month",
38
- interval_count: 1,
39
- interval_display: "per month",
40
- is_recurring: true,
41
- is_free: true,
36
+ pricingModel: "flat",
37
+ intervalUnit: "month",
38
+ intervalCount: 1,
39
+ intervalDisplay: "per month",
40
+ isRecurring: true,
41
+ isFree: true,
42
42
  features: [
43
43
  { key: "seats", name: "Team seats", value: 1, limit: 1 },
44
44
  { key: "projects", name: "Projects", value: 3, limit: 3 },
45
45
  ],
46
- is_active: true,
47
- is_featured: false,
48
- trial_days: 0,
49
- sort_order: 0,
50
- cta_text: "Start Free",
46
+ isActive: true,
47
+ isFeatured: false,
48
+ trialDays: 0,
49
+ sortOrder: 0,
50
+ ctaText: "Start Free",
51
51
  },
52
52
  {
53
53
  id: "offer-2",
54
54
  name: "Pro",
55
55
  slug: "pro-monthly",
56
- unit_price: "49.00",
56
+ unitPrice: "49.00",
57
57
  currency: "USD",
58
- pricing_model: "flat",
59
- interval_unit: "month",
60
- interval_count: 1,
61
- interval_display: "per month",
62
- is_recurring: true,
63
- is_free: false,
58
+ pricingModel: "flat",
59
+ intervalUnit: "month",
60
+ intervalCount: 1,
61
+ intervalDisplay: "per month",
62
+ isRecurring: true,
63
+ isFree: false,
64
64
  features: [
65
65
  { key: "seats", name: "Team seats", value: 5, limit: 5 },
66
66
  { key: "projects", name: "Projects", value: "Unlimited" },
67
67
  ],
68
- is_active: true,
69
- is_featured: true,
70
- trial_days: 14,
71
- sort_order: 1,
72
- cta_text: "Start Trial",
68
+ isActive: true,
69
+ isFeatured: true,
70
+ trialDays: 14,
71
+ sortOrder: 1,
72
+ ctaText: "Start Trial",
73
73
  },
74
74
  {
75
75
  id: "offer-3",
76
76
  name: "Enterprise",
77
77
  slug: "enterprise-monthly",
78
- unit_price: "199.00",
78
+ unitPrice: "199.00",
79
79
  currency: "USD",
80
- pricing_model: "per_seat",
81
- interval_unit: "month",
82
- interval_count: 1,
83
- interval_display: "per month",
84
- is_recurring: true,
85
- is_free: false,
80
+ pricingModel: "per_seat",
81
+ intervalUnit: "month",
82
+ intervalCount: 1,
83
+ intervalDisplay: "per month",
84
+ isRecurring: true,
85
+ isFree: false,
86
86
  features: [
87
87
  { key: "seats", name: "Team seats", value: "Unlimited" },
88
88
  { key: "projects", name: "Projects", value: "Unlimited" },
89
89
  ],
90
- is_active: true,
91
- is_featured: false,
92
- trial_days: 0,
93
- sort_order: 2,
94
- cta_text: "Contact Sales",
90
+ isActive: true,
91
+ isFeatured: false,
92
+ trialDays: 0,
93
+ sortOrder: 2,
94
+ ctaText: "Contact Sales",
95
95
  },
96
96
  ],
97
97
  };
@@ -100,40 +100,40 @@ const mockSubscriptionActive: SubscriptionInfo = {
100
100
  id: "sub-123",
101
101
  offer: mockProduct.offers[1], // Pro plan
102
102
  status: "active",
103
- current_period_start: "2026-01-01T00:00:00Z",
104
- current_period_end: "2026-02-01T00:00:00Z",
105
- cancel_at_period_end: false,
106
- trial_end: null,
103
+ currentPeriodStart: "2026-01-01T00:00:00Z",
104
+ currentPeriodEnd: "2026-02-01T00:00:00Z",
105
+ cancelAtPeriodEnd: false,
106
+ trialEnd: null,
107
107
  };
108
108
 
109
109
  const mockSubscriptionTrialing: SubscriptionInfo = {
110
110
  id: "sub-456",
111
111
  offer: mockProduct.offers[1], // Pro plan
112
112
  status: "trialing",
113
- current_period_start: "2026-01-01T00:00:00Z",
114
- current_period_end: "2026-02-01T00:00:00Z",
115
- cancel_at_period_end: false,
116
- trial_end: "2026-01-15T00:00:00Z",
113
+ currentPeriodStart: "2026-01-01T00:00:00Z",
114
+ currentPeriodEnd: "2026-02-01T00:00:00Z",
115
+ cancelAtPeriodEnd: false,
116
+ trialEnd: "2026-01-15T00:00:00Z",
117
117
  };
118
118
 
119
119
  const mockSubscriptionPastDue: SubscriptionInfo = {
120
120
  id: "sub-789",
121
121
  offer: mockProduct.offers[1], // Pro plan
122
122
  status: "past_due",
123
- current_period_start: "2026-01-01T00:00:00Z",
124
- current_period_end: "2026-02-01T00:00:00Z",
125
- cancel_at_period_end: false,
126
- trial_end: null,
123
+ currentPeriodStart: "2026-01-01T00:00:00Z",
124
+ currentPeriodEnd: "2026-02-01T00:00:00Z",
125
+ cancelAtPeriodEnd: false,
126
+ trialEnd: null,
127
127
  };
128
128
 
129
129
  const mockSubscriptionCancelled: SubscriptionInfo = {
130
130
  id: "sub-999",
131
131
  offer: mockProduct.offers[1], // Pro plan
132
132
  status: "cancelled",
133
- current_period_start: "2026-01-01T00:00:00Z",
134
- current_period_end: "2026-02-01T00:00:00Z",
135
- cancel_at_period_end: true,
136
- trial_end: null,
133
+ currentPeriodStart: "2026-01-01T00:00:00Z",
134
+ currentPeriodEnd: "2026-02-01T00:00:00Z",
135
+ cancelAtPeriodEnd: true,
136
+ trialEnd: null,
137
137
  };
138
138
 
139
139
  function createWrapper(fetcher: typeof fetch) {
@@ -495,15 +495,15 @@ describe("SubscriptionManager", () => {
495
495
  expect(statusBadge.className).toMatch(/warning|error|danger|alert/i);
496
496
  });
497
497
 
498
- it("does not crash when current_period_end is null (free plan)", async () => {
498
+ it("does not crash when currentPeriodEnd is null (free plan)", async () => {
499
499
  const freeSubscription: SubscriptionInfo = {
500
500
  id: "sub-free",
501
- offer: { ...mockProduct.offers[0], is_free: true },
501
+ offer: { ...mockProduct.offers[0], isFree: true },
502
502
  status: "active",
503
- current_period_start: null,
504
- current_period_end: null,
505
- cancel_at_period_end: false,
506
- trial_end: null,
503
+ currentPeriodStart: null,
504
+ currentPeriodEnd: null,
505
+ cancelAtPeriodEnd: false,
506
+ trialEnd: null,
507
507
  };
508
508
  const fetcher = mockFetchRouter({
509
509
  "/billing/subscription/current/": freeSubscription,
@@ -167,30 +167,30 @@ export function SubscriptionManager({
167
167
  <div data-testid="current-plan" className="rounded-2xl border border-gray-200 bg-white shadow-sm p-8">
168
168
  <div className="flex items-center justify-between mb-4">
169
169
  <h2 className="text-xl font-bold text-gray-900">{subscription.offer.name}</h2>
170
- <StatusBadge status={subscription.status} trialEnd={subscription.trial_end} />
170
+ <StatusBadge status={subscription.status} trialEnd={subscription.trialEnd} />
171
171
  </div>
172
172
 
173
173
  <div className="mb-4">
174
- {subscription.offer.is_free ? (
174
+ {subscription.offer.isFree ? (
175
175
  <span aria-label="Free">
176
176
  <span aria-hidden="true" className="text-3xl font-extrabold text-gray-900">Free</span>
177
177
  </span>
178
178
  ) : (
179
- <span aria-label={`${Math.floor(parseFloat(subscription.offer.unit_price) || 0)} dollars ${subscription.offer.interval_display}`}>
179
+ <span aria-label={`${Math.floor(parseFloat(subscription.offer.unitPrice) || 0)} dollars ${subscription.offer.intervalDisplay}`}>
180
180
  <span aria-hidden="true" className="text-3xl font-extrabold text-gray-900">
181
- ${Math.floor(parseFloat(subscription.offer.unit_price) || 0)}
181
+ ${Math.floor(parseFloat(subscription.offer.unitPrice) || 0)}
182
182
  </span>
183
183
  <span aria-hidden="true" className="text-base text-gray-500 ml-1">
184
- {subscription.offer.interval_display}
184
+ {subscription.offer.intervalDisplay}
185
185
  </span>
186
186
  </span>
187
187
  )}
188
188
  </div>
189
189
 
190
- {subscription.current_period_start && subscription.current_period_end && (
190
+ {subscription.currentPeriodStart && subscription.currentPeriodEnd && (
191
191
  <p className="text-sm text-gray-500">
192
- Billing period: {formatDate(subscription.current_period_start)} to{" "}
193
- {formatDate(subscription.current_period_end)}
192
+ Billing period: {formatDate(subscription.currentPeriodStart)} to{" "}
193
+ {formatDate(subscription.currentPeriodEnd)}
194
194
  </p>
195
195
  )}
196
196
  </div>
@@ -211,24 +211,24 @@ export function SubscriptionManager({
211
211
  <div
212
212
  key={offer.id}
213
213
  className={`rounded-xl border p-6 ${
214
- offer.is_featured
214
+ offer.isFeatured
215
215
  ? "border-blue-600 shadow-md"
216
216
  : "border-gray-200 bg-white shadow-sm"
217
217
  }`}
218
218
  >
219
219
  <h4 className="text-lg font-bold text-gray-900 mb-2">{offer.name}</h4>
220
220
  <div className="mb-3">
221
- {offer.is_free ? (
221
+ {offer.isFree ? (
222
222
  <span aria-label="Free">
223
223
  <span aria-hidden="true" className="text-2xl font-extrabold text-gray-900">Free</span>
224
224
  </span>
225
225
  ) : (
226
- <span aria-label={`${Math.floor(parseFloat(offer.unit_price) || 0)} dollars ${offer.interval_display}`}>
226
+ <span aria-label={`${Math.floor(parseFloat(offer.unitPrice) || 0)} dollars ${offer.intervalDisplay}`}>
227
227
  <span aria-hidden="true" className="text-2xl font-extrabold text-gray-900">
228
- ${Math.floor(parseFloat(offer.unit_price) || 0)}
228
+ ${Math.floor(parseFloat(offer.unitPrice) || 0)}
229
229
  </span>
230
230
  <span aria-hidden="true" className="text-sm text-gray-500 ml-1">
231
- {offer.interval_display}
231
+ {offer.intervalDisplay}
232
232
  </span>
233
233
  </span>
234
234
  )}
@@ -237,12 +237,12 @@ export function SubscriptionManager({
237
237
  data-testid={`upgrade-cta-${offer.slug}`}
238
238
  onClick={() => onPlanChange?.(offer)}
239
239
  className={`w-full py-2.5 px-4 text-sm font-bold rounded-xl cursor-pointer transition-colors ${
240
- offer.is_featured
240
+ offer.isFeatured
241
241
  ? "bg-blue-600 text-white hover:bg-blue-700"
242
242
  : "bg-gray-100 text-gray-800 hover:bg-gray-200"
243
243
  }`}
244
244
  >
245
- {offer.cta_text}
245
+ {offer.ctaText}
246
246
  </button>
247
247
  </div>
248
248
  ))}
@@ -30,20 +30,20 @@ const mockProduct: BillingProduct = {
30
30
  id: "offer-1",
31
31
  name: "Pro",
32
32
  slug: "pro-monthly",
33
- unit_price: "49.00",
33
+ unitPrice: "49.00",
34
34
  currency: "USD",
35
- pricing_model: "flat",
36
- interval_unit: "month",
37
- interval_count: 1,
38
- interval_display: "per month",
39
- is_recurring: true,
40
- is_free: false,
35
+ pricingModel: "flat",
36
+ intervalUnit: "month",
37
+ intervalCount: 1,
38
+ intervalDisplay: "per month",
39
+ isRecurring: true,
40
+ isFree: false,
41
41
  features: [{ key: "seats", name: "Team seats", value: 5, limit: 5 }],
42
- is_active: true,
43
- is_featured: true,
44
- trial_days: 14,
45
- sort_order: 0,
46
- cta_text: "Upgrade to Pro",
42
+ isActive: true,
43
+ isFeatured: true,
44
+ trialDays: 14,
45
+ sortOrder: 0,
46
+ ctaText: "Upgrade to Pro",
47
47
  },
48
48
  ],
49
49
  };
@@ -122,7 +122,7 @@ export function UpgradeModal({
122
122
  {product && (
123
123
  <div data-testid="upgrade-offers" className="flex flex-wrap justify-center gap-5">
124
124
  {product.offers.map((offer) => {
125
- const isFeatured = offer.is_featured;
125
+ const isFeatured = offer.isFeatured;
126
126
  return (
127
127
  <div
128
128
  key={offer.id}
@@ -138,23 +138,23 @@ export function UpgradeModal({
138
138
  <h3 className="text-lg font-bold text-gray-900 mb-2">{offer.name}</h3>
139
139
 
140
140
  <div className="mb-2">
141
- {offer.is_free ? (
141
+ {offer.isFree ? (
142
142
  <span aria-label="Free">
143
143
  <span aria-hidden="true" className="text-2xl font-extrabold text-gray-900">Free</span>
144
144
  </span>
145
145
  ) : (
146
- <span aria-label={`${Math.floor(parseFloat(offer.unit_price) || 0)} dollars ${offer.interval_display}`}>
146
+ <span aria-label={`${Math.floor(parseFloat(offer.unitPrice) || 0)} dollars ${offer.intervalDisplay}`}>
147
147
  <span aria-hidden="true" className="text-2xl font-extrabold text-gray-900">
148
- ${Math.floor(parseFloat(offer.unit_price) || 0)}
148
+ ${Math.floor(parseFloat(offer.unitPrice) || 0)}
149
149
  </span>
150
- <span aria-hidden="true" className="text-sm text-gray-500"> {offer.interval_display}</span>
150
+ <span aria-hidden="true" className="text-sm text-gray-500"> {offer.intervalDisplay}</span>
151
151
  </span>
152
152
  )}
153
153
  </div>
154
154
 
155
- {offer.trial_days > 0 && (
155
+ {offer.trialDays > 0 && (
156
156
  <span className="inline-block bg-blue-50 text-blue-700 text-xs font-semibold px-2.5 py-0.5 rounded-md mb-3 w-fit">
157
- {offer.trial_days}-day free trial
157
+ {offer.trialDays}-day free trial
158
158
  </span>
159
159
  )}
160
160
 
@@ -182,7 +182,7 @@ export function UpgradeModal({
182
182
  }
183
183
  `}
184
184
  >
185
- {offer.cta_text}
185
+ {offer.ctaText}
186
186
  </button>
187
187
  </div>
188
188
  );
@@ -23,7 +23,7 @@ describe("useCheckout", () => {
23
23
  ok: true,
24
24
  json: () =>
25
25
  Promise.resolve({
26
- session_id: "cs_test_123",
26
+ sessionId: "cs_test_123",
27
27
  url: "https://checkout.stripe.com/test",
28
28
  }),
29
29
  });
@@ -41,7 +41,7 @@ describe("useCheckout", () => {
41
41
  });
42
42
 
43
43
  expect(checkoutResult).toEqual({
44
- session_id: "cs_test_123",
44
+ sessionId: "cs_test_123",
45
45
  url: "https://checkout.stripe.com/test",
46
46
  });
47
47
  expect(result.current.loading).toBe(false);
@@ -63,7 +63,7 @@ describe("useCheckout", () => {
63
63
  const mockFetch = vi.fn().mockResolvedValue({
64
64
  ok: true,
65
65
  json: () =>
66
- Promise.resolve({ session_id: "cs_1", url: "https://test.com" }),
66
+ Promise.resolve({ sessionId: "cs_1", url: "https://test.com" }),
67
67
  });
68
68
  const wrapper = createWrapper(mockFetch as unknown as typeof fetch);
69
69
 
@@ -120,7 +120,7 @@ describe("useCheckout", () => {
120
120
  ok: true,
121
121
  json: () =>
122
122
  Promise.resolve({
123
- session_id: "cs_redirect_1",
123
+ sessionId: "cs_redirect_1",
124
124
  url: "https://checkout.stripe.com/pay/cs_redirect_1",
125
125
  }),
126
126
  });
@@ -148,7 +148,7 @@ describe("useCheckout", () => {
148
148
  ok: true,
149
149
  json: () =>
150
150
  Promise.resolve({
151
- subscription_id: "sub_free_123",
151
+ subscriptionId: "sub_free_123",
152
152
  status: "active",
153
153
  }),
154
154
  });
@@ -162,7 +162,7 @@ describe("useCheckout", () => {
162
162
  });
163
163
 
164
164
  expect(freeResult).toEqual({
165
- subscription_id: "sub_free_123",
165
+ subscriptionId: "sub_free_123",
166
166
  status: "active",
167
167
  });
168
168
  expect(result.current.loading).toBe(false);
@@ -15,39 +15,39 @@ const mockProduct: BillingProduct = {
15
15
  id: "offer-1",
16
16
  name: "Starter",
17
17
  slug: "starter-monthly",
18
- unit_price: "0.00",
18
+ unitPrice: "0.00",
19
19
  currency: "USD",
20
- pricing_model: "flat",
21
- interval_unit: "month",
22
- interval_count: 1,
23
- interval_display: "per month",
24
- is_recurring: true,
25
- is_free: true,
20
+ pricingModel: "flat",
21
+ intervalUnit: "month",
22
+ intervalCount: 1,
23
+ intervalDisplay: "per month",
24
+ isRecurring: true,
25
+ isFree: true,
26
26
  features: [],
27
- is_active: true,
28
- is_featured: false,
29
- trial_days: 0,
30
- sort_order: 0,
31
- cta_text: "Start Free",
27
+ isActive: true,
28
+ isFeatured: false,
29
+ trialDays: 0,
30
+ sortOrder: 0,
31
+ ctaText: "Start Free",
32
32
  },
33
33
  {
34
34
  id: "offer-2",
35
35
  name: "Pro",
36
36
  slug: "pro-monthly",
37
- unit_price: "49.00",
37
+ unitPrice: "49.00",
38
38
  currency: "USD",
39
- pricing_model: "flat",
40
- interval_unit: "month",
41
- interval_count: 1,
42
- interval_display: "per month",
43
- is_recurring: true,
44
- is_free: false,
39
+ pricingModel: "flat",
40
+ intervalUnit: "month",
41
+ intervalCount: 1,
42
+ intervalDisplay: "per month",
43
+ isRecurring: true,
44
+ isFree: false,
45
45
  features: [{ key: "seats", name: "Team seats", value: 5, limit: 5 }],
46
- is_active: true,
47
- is_featured: true,
48
- trial_days: 14,
49
- sort_order: 1,
50
- cta_text: "Start Trial",
46
+ isActive: true,
47
+ isFeatured: true,
48
+ trialDays: 14,
49
+ sortOrder: 1,
50
+ ctaText: "Start Trial",
51
51
  },
52
52
  ],
53
53
  };
@@ -9,30 +9,30 @@ const mockOffer: ProductOffer = {
9
9
  id: "offer-2",
10
10
  name: "Pro",
11
11
  slug: "pro-monthly",
12
- unit_price: "49.00",
12
+ unitPrice: "49.00",
13
13
  currency: "USD",
14
- pricing_model: "flat",
15
- interval_unit: "month",
16
- interval_count: 1,
17
- interval_display: "per month",
18
- is_recurring: true,
19
- is_free: false,
14
+ pricingModel: "flat",
15
+ intervalUnit: "month",
16
+ intervalCount: 1,
17
+ intervalDisplay: "per month",
18
+ isRecurring: true,
19
+ isFree: false,
20
20
  features: [{ key: "seats", name: "Team seats", value: 5, limit: 5 }],
21
- is_active: true,
22
- is_featured: true,
23
- trial_days: 14,
24
- sort_order: 1,
25
- cta_text: "Start Trial",
21
+ isActive: true,
22
+ isFeatured: true,
23
+ trialDays: 14,
24
+ sortOrder: 1,
25
+ ctaText: "Start Trial",
26
26
  };
27
27
 
28
28
  const mockSubscription: SubscriptionInfo = {
29
29
  id: "sub-123",
30
30
  offer: mockOffer,
31
31
  status: "active",
32
- current_period_start: "2026-01-01T00:00:00Z",
33
- current_period_end: "2026-02-01T00:00:00Z",
34
- cancel_at_period_end: false,
35
- trial_end: null,
32
+ currentPeriodStart: "2026-01-01T00:00:00Z",
33
+ currentPeriodEnd: "2026-02-01T00:00:00Z",
34
+ cancelAtPeriodEnd: false,
35
+ trialEnd: null,
36
36
  };
37
37
 
38
38
  function createWrapper(fetcher: typeof fetch) {
@@ -9,20 +9,20 @@ export interface ProductOffer {
9
9
  id: string;
10
10
  name: string;
11
11
  slug: string;
12
- unit_price: string; // Decimal as string from DRF
12
+ unitPrice: string; // Decimal as string from DRF
13
13
  currency: string;
14
- pricing_model: "flat" | "per_seat" | "tiered" | "volume" | "usage";
15
- interval_unit: "day" | "week" | "month" | "year" | null;
16
- interval_count: number | null;
17
- interval_display: string;
18
- is_recurring: boolean;
19
- is_free: boolean;
14
+ pricingModel: "flat" | "per_seat" | "tiered" | "volume" | "usage";
15
+ intervalUnit: "day" | "week" | "month" | "year" | null;
16
+ intervalCount: number | null;
17
+ intervalDisplay: string;
18
+ isRecurring: boolean;
19
+ isFree: boolean;
20
20
  features: OfferFeature[];
21
- is_active: boolean;
22
- is_featured: boolean;
23
- trial_days: number;
24
- sort_order: number;
25
- cta_text: string;
21
+ isActive: boolean;
22
+ isFeatured: boolean;
23
+ trialDays: number;
24
+ sortOrder: number;
25
+ ctaText: string;
26
26
  }
27
27
 
28
28
  export interface OfferFeature {
@@ -43,12 +43,12 @@ export interface BillingProduct {
43
43
  }
44
44
 
45
45
  export interface CheckoutResult {
46
- session_id: string;
46
+ sessionId: string;
47
47
  url: string;
48
48
  }
49
49
 
50
50
  export interface FreeSubscriptionResult {
51
- subscription_id: string;
51
+ subscriptionId: string;
52
52
  status: string;
53
53
  }
54
54
 
@@ -60,10 +60,10 @@ export interface SubscriptionInfo {
60
60
  id: string;
61
61
  offer: ProductOffer;
62
62
  status: "active" | "trialing" | "past_due" | "cancelled" | "incomplete" | "incomplete_expired" | "unpaid";
63
- current_period_start: string | null;
64
- current_period_end: string | null;
65
- cancel_at_period_end: boolean;
66
- trial_end: string | null;
63
+ currentPeriodStart: string | null;
64
+ currentPeriodEnd: string | null;
65
+ cancelAtPeriodEnd: boolean;
66
+ trialEnd: string | null;
67
67
  }
68
68
 
69
69
  export interface PaymentMethod {
@@ -72,19 +72,19 @@ export interface PaymentMethod {
72
72
  }
73
73
 
74
74
  export interface CachedSubscriptionState {
75
- subscription_id: string | null;
76
- provider_subscription_id: string | null;
75
+ subscriptionId: string | null;
76
+ providerSubscriptionId: string | null;
77
77
  status: string;
78
- customer_id: string | null;
79
- price_id: string | null;
80
- offer_id: string | null;
81
- product_slug: string | null;
82
- offer_slug: string | null;
83
- current_period_start: number | null;
84
- current_period_end: number | null;
85
- cancel_at_period_end: boolean;
86
- trial_end: number | null;
87
- payment_method: PaymentMethod | null;
78
+ customerId: string | null;
79
+ priceId: string | null;
80
+ offerId: string | null;
81
+ productSlug: string | null;
82
+ offerSlug: string | null;
83
+ currentPeriodStart: number | null;
84
+ currentPeriodEnd: number | null;
85
+ cancelAtPeriodEnd: boolean;
86
+ trialEnd: number | null;
87
+ paymentMethod: PaymentMethod | null;
88
88
  }
89
89
 
90
90
  export interface BillingConfig {
@@ -49,7 +49,7 @@ describe("BillingApiClient", () => {
49
49
  mockFetch.mockResolvedValue({
50
50
  ok: true,
51
51
  json: () =>
52
- Promise.resolve({ session_id: "cs_1", url: "https://pay.com" }),
52
+ Promise.resolve({ sessionId: "cs_1", url: "https://pay.com" }),
53
53
  });
54
54
 
55
55
  const client = createClient();
@@ -59,7 +59,7 @@ describe("BillingApiClient", () => {
59
59
  cancelUrl: "https://nope.com",
60
60
  });
61
61
 
62
- expect(result.session_id).toBe("cs_1");
62
+ expect(result.sessionId).toBe("cs_1");
63
63
  expect(mockFetch).toHaveBeenCalledWith(
64
64
  "/api/billing/offer-checkout/",
65
65
  expect.objectContaining({
@@ -75,7 +75,7 @@ describe("BillingApiClient", () => {
75
75
  mockFetch.mockResolvedValue({
76
76
  ok: true,
77
77
  json: () =>
78
- Promise.resolve({ session_id: "cs_1", url: "https://pay.com" }),
78
+ Promise.resolve({ sessionId: "cs_1", url: "https://pay.com" }),
79
79
  });
80
80
 
81
81
  const client = createClient();