@startsimpli/billing 0.4.7 → 0.4.9

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.7",
3
+ "version": "0.4.9",
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
  );