@tpmjs/pricing-page-copy 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2025 TPMJS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,67 @@
1
+ import * as ai from 'ai';
2
+
3
+ /**
4
+ * Pricing Page Copy Tool for TPMJS
5
+ * Generates pricing page copy with tier names, feature lists, and CTAs
6
+ *
7
+ * This is a proper AI SDK v6 tool that can be used with streamText()
8
+ * Uses jsonSchema() to avoid Zod 4 JSON Schema conversion issues with OpenAI
9
+ */
10
+ interface PricingTier {
11
+ name: string;
12
+ headline: string;
13
+ price: string;
14
+ billingPeriod: string;
15
+ features: Array<{
16
+ text: string;
17
+ benefit: string;
18
+ included: boolean;
19
+ }>;
20
+ cta: string;
21
+ recommended?: boolean;
22
+ badge?: string;
23
+ valueProposition: string;
24
+ }
25
+ interface PricingPageCopy {
26
+ pageHeadline: string;
27
+ pageSubheadline: string;
28
+ tiers: PricingTier[];
29
+ faq: Array<{
30
+ question: string;
31
+ answer: string;
32
+ }>;
33
+ trustSignals: string[];
34
+ guarantee?: string;
35
+ }
36
+ /**
37
+ * Input type for Pricing Page Copy Tool
38
+ */
39
+ type PricingPageCopyInput = {
40
+ tiers: Array<{
41
+ name?: string;
42
+ price: number | string;
43
+ billingPeriod?: string;
44
+ features: string[];
45
+ recommended?: boolean;
46
+ }>;
47
+ targetAudience: string;
48
+ };
49
+ /**
50
+ * Pricing Page Copy Tool
51
+ * Generates pricing page copy with tier names, feature lists, and CTAs
52
+ *
53
+ * This is a proper AI SDK v6 tool that can be used with streamText()
54
+ */
55
+ declare const pricingPageCopyTool: ai.Tool<PricingPageCopyInput, {
56
+ pageHeadline: string;
57
+ pageSubheadline: string;
58
+ tiers: PricingTier[];
59
+ faq: {
60
+ question: string;
61
+ answer: string;
62
+ }[];
63
+ trustSignals: string[];
64
+ guarantee: string;
65
+ }>;
66
+
67
+ export { type PricingPageCopy, type PricingTier, pricingPageCopyTool as default, pricingPageCopyTool };
package/dist/index.js ADDED
@@ -0,0 +1,287 @@
1
+ import { tool, jsonSchema } from 'ai';
2
+
3
+ // src/index.ts
4
+ function generateTierName(index, totalTiers, providedName) {
5
+ if (providedName) return providedName;
6
+ const tierNames = [
7
+ ["Free", "Pro", "Enterprise"],
8
+ ["Basic", "Professional", "Business", "Enterprise"],
9
+ ["Starter", "Growth", "Scale", "Enterprise"],
10
+ ["Essential", "Advanced", "Premium", "Ultimate"]
11
+ ];
12
+ const nameSet = tierNames.find((set) => set.length === totalTiers) || tierNames[1];
13
+ return nameSet?.[index] || `Tier ${index + 1}`;
14
+ }
15
+ function generateHeadline(tierName, index, totalTiers) {
16
+ const headlines = {
17
+ free: "Get started for free",
18
+ starter: "Perfect for individuals",
19
+ basic: "Essential features for getting started",
20
+ pro: "For growing teams",
21
+ professional: "Advanced features for professionals",
22
+ growth: "Scale your business",
23
+ business: "Built for businesses",
24
+ scale: "Enterprise-grade features",
25
+ premium: "Premium features and support",
26
+ enterprise: "Custom solutions for large teams",
27
+ ultimate: "Everything you need and more"
28
+ };
29
+ const nameLower = tierName.toLowerCase();
30
+ for (const [key, headline] of Object.entries(headlines)) {
31
+ if (nameLower.includes(key)) {
32
+ return headline;
33
+ }
34
+ }
35
+ if (index === 0) return "Perfect for getting started";
36
+ if (index === totalTiers - 1) return "Maximum power and flexibility";
37
+ return "Best for growing teams";
38
+ }
39
+ function featureToBenefit(feature) {
40
+ const featureLower = feature.toLowerCase();
41
+ if (featureLower.includes("unlimited")) {
42
+ return "Never worry about limits";
43
+ }
44
+ if (featureLower.includes("24/7") || featureLower.includes("support")) {
45
+ return "Get help whenever you need it";
46
+ }
47
+ if (featureLower.includes("analytics") || featureLower.includes("reporting")) {
48
+ return "Make data-driven decisions";
49
+ }
50
+ if (featureLower.includes("integration")) {
51
+ return "Work seamlessly with your tools";
52
+ }
53
+ if (featureLower.includes("storage")) {
54
+ return "Store all your important data";
55
+ }
56
+ if (featureLower.includes("user") || featureLower.includes("seat")) {
57
+ return "Collaborate with your team";
58
+ }
59
+ if (featureLower.includes("custom")) {
60
+ return "Tailored to your needs";
61
+ }
62
+ if (featureLower.includes("priority")) {
63
+ return "Get faster service";
64
+ }
65
+ if (featureLower.includes("backup")) {
66
+ return "Keep your data safe";
67
+ }
68
+ if (featureLower.includes("security")) {
69
+ return "Protect your information";
70
+ }
71
+ return "Enhance your workflow";
72
+ }
73
+ function generateCTA(tierName, price, index) {
74
+ const isFree = price === 0 || price === "0" || String(price).toLowerCase().includes("free");
75
+ if (isFree) {
76
+ return "Start for free";
77
+ }
78
+ const nameLower = tierName.toLowerCase();
79
+ if (nameLower.includes("enterprise") || nameLower.includes("custom")) {
80
+ return "Contact sales";
81
+ }
82
+ if (index === 0) {
83
+ return "Get started";
84
+ }
85
+ return "Start free trial";
86
+ }
87
+ function generateBadge(tierName, recommended) {
88
+ if (recommended) {
89
+ return "Most Popular";
90
+ }
91
+ const nameLower = tierName.toLowerCase();
92
+ if (nameLower.includes("pro") || nameLower.includes("professional")) {
93
+ return "Best Value";
94
+ }
95
+ return void 0;
96
+ }
97
+ function generateValueProposition(tierName, features, targetAudience) {
98
+ const nameLower = tierName.toLowerCase();
99
+ if (nameLower.includes("free") || nameLower.includes("starter")) {
100
+ return `Perfect for ${targetAudience} just getting started`;
101
+ }
102
+ if (nameLower.includes("enterprise")) {
103
+ return `Comprehensive solution for large-scale ${targetAudience}`;
104
+ }
105
+ const featureCount = features.length;
106
+ return `Everything ${targetAudience} need${targetAudience.endsWith("s") ? "" : "s"} with ${featureCount}+ features`;
107
+ }
108
+ function formatPrice(price, billingPeriod) {
109
+ const priceNum = typeof price === "string" ? Number.parseFloat(price) : price;
110
+ if (isNaN(priceNum)) {
111
+ return String(price);
112
+ }
113
+ if (priceNum === 0) {
114
+ return "Free";
115
+ }
116
+ const formatted = `$${priceNum.toFixed(0)}`;
117
+ return billingPeriod ? `${formatted}/${billingPeriod}` : formatted;
118
+ }
119
+ function determineBillingPeriod(providedPeriod) {
120
+ if (providedPeriod) return providedPeriod;
121
+ return "month";
122
+ }
123
+ function processFeaturesWithBenefits(features, _tierIndex, _allTierFeatures) {
124
+ return features.map((feature) => ({
125
+ text: feature,
126
+ benefit: featureToBenefit(feature),
127
+ included: true
128
+ }));
129
+ }
130
+ function generatePageHeadline(targetAudience) {
131
+ return `Simple, transparent pricing for ${targetAudience}`;
132
+ }
133
+ function generatePageSubheadline(tierCount) {
134
+ if (tierCount === 1) {
135
+ return "One simple plan with everything you need";
136
+ }
137
+ if (tierCount === 2) {
138
+ return "Choose the plan that fits your needs";
139
+ }
140
+ return "Choose the plan that's right for you. All plans include a 14-day free trial.";
141
+ }
142
+ function generateFAQ(tiers, _targetAudience) {
143
+ const faq = [];
144
+ faq.push({
145
+ question: "Can I change plans later?",
146
+ answer: "Yes! You can upgrade or downgrade your plan at any time. Changes take effect immediately."
147
+ });
148
+ const hasTrial = tiers.some((tier) => tier.cta.toLowerCase().includes("trial"));
149
+ if (hasTrial) {
150
+ faq.push({
151
+ question: "What happens after the free trial?",
152
+ answer: "After your 14-day free trial, you'll be charged for your selected plan. Cancel anytime during the trial at no cost."
153
+ });
154
+ }
155
+ const hasEnterprise = tiers.some((tier) => tier.name.toLowerCase().includes("enterprise"));
156
+ if (hasEnterprise) {
157
+ faq.push({
158
+ question: "What's included in the Enterprise plan?",
159
+ answer: "Enterprise plans include custom features, dedicated support, advanced security, and volume pricing. Contact our sales team for details."
160
+ });
161
+ }
162
+ faq.push({
163
+ question: "Do you offer discounts?",
164
+ answer: "Yes! We offer discounts for annual billing, nonprofits, and educational institutions. Contact us for details."
165
+ });
166
+ faq.push({
167
+ question: "Is my data secure?",
168
+ answer: "Absolutely. We use industry-standard encryption and security practices to protect your data. All plans include secure data storage."
169
+ });
170
+ return faq;
171
+ }
172
+ function generateTrustSignals(tiers) {
173
+ const signals = [
174
+ "14-day free trial, no credit card required",
175
+ "Cancel anytime",
176
+ "Secure payment processing"
177
+ ];
178
+ const hasEnterprise = tiers.some((tier) => tier.name.toLowerCase().includes("enterprise"));
179
+ if (hasEnterprise) {
180
+ signals.push("Dedicated account manager for Enterprise");
181
+ }
182
+ signals.push("99.9% uptime SLA");
183
+ signals.push("24/7 customer support");
184
+ return signals;
185
+ }
186
+ function generateGuarantee() {
187
+ return "30-day money-back guarantee. If you're not satisfied, we'll refund your purchase, no questions asked.";
188
+ }
189
+ var pricingPageCopyTool = tool({
190
+ description: "Generates comprehensive pricing page copy with tier names, headlines, benefit-oriented feature lists, CTAs, FAQs, and trust signals. Frames features as benefits and clearly differentiates tiers.",
191
+ inputSchema: jsonSchema({
192
+ type: "object",
193
+ properties: {
194
+ tiers: {
195
+ type: "array",
196
+ items: {
197
+ type: "object",
198
+ properties: {
199
+ name: {
200
+ type: "string",
201
+ description: "Tier name (optional, will be generated if not provided)"
202
+ },
203
+ price: {
204
+ oneOf: [{ type: "number" }, { type: "string" }],
205
+ description: 'Price amount (number or "custom", "free", etc.)'
206
+ },
207
+ billingPeriod: {
208
+ type: "string",
209
+ description: "Billing period (month, year, etc.)"
210
+ },
211
+ features: {
212
+ type: "array",
213
+ items: { type: "string" },
214
+ description: "List of features included in this tier"
215
+ },
216
+ recommended: {
217
+ type: "boolean",
218
+ description: "Whether this tier is recommended/most popular"
219
+ }
220
+ },
221
+ required: ["price", "features"]
222
+ },
223
+ minItems: 1,
224
+ description: "Pricing tiers with features and prices"
225
+ },
226
+ targetAudience: {
227
+ type: "string",
228
+ description: 'Primary target audience (e.g., "small businesses", "developers", "teams")'
229
+ }
230
+ },
231
+ required: ["tiers", "targetAudience"],
232
+ additionalProperties: false
233
+ }),
234
+ async execute({ tiers, targetAudience }) {
235
+ if (!tiers || tiers.length === 0) {
236
+ throw new Error("At least one pricing tier is required");
237
+ }
238
+ if (!targetAudience || targetAudience.trim().length === 0) {
239
+ throw new Error("Target audience is required");
240
+ }
241
+ for (const tier of tiers) {
242
+ if (!tier.features || tier.features.length === 0) {
243
+ throw new Error("Each tier must have at least one feature");
244
+ }
245
+ }
246
+ tiers.map((t) => t.features);
247
+ const processedTiers = tiers.map(
248
+ (tier, index) => {
249
+ const name = generateTierName(index, tiers.length, tier.name);
250
+ const headline = generateHeadline(name, index, tiers.length);
251
+ const billingPeriod = determineBillingPeriod(tier.billingPeriod);
252
+ const price = formatPrice(tier.price, billingPeriod);
253
+ const features = processFeaturesWithBenefits(tier.features);
254
+ const cta = generateCTA(name, tier.price, index);
255
+ const badge = generateBadge(name, tier.recommended);
256
+ const valueProposition = generateValueProposition(name, tier.features, targetAudience);
257
+ return {
258
+ name,
259
+ headline,
260
+ price,
261
+ billingPeriod,
262
+ features,
263
+ cta,
264
+ recommended: tier.recommended,
265
+ badge,
266
+ valueProposition
267
+ };
268
+ }
269
+ );
270
+ const pageHeadline = generatePageHeadline(targetAudience);
271
+ const pageSubheadline = generatePageSubheadline(tiers.length);
272
+ const faq = generateFAQ(processedTiers);
273
+ const trustSignals = generateTrustSignals(processedTiers);
274
+ const guarantee = generateGuarantee();
275
+ return {
276
+ pageHeadline,
277
+ pageSubheadline,
278
+ tiers: processedTiers,
279
+ faq,
280
+ trustSignals,
281
+ guarantee
282
+ };
283
+ }
284
+ });
285
+ var index_default = pricingPageCopyTool;
286
+
287
+ export { index_default as default, pricingPageCopyTool };
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "@tpmjs/pricing-page-copy",
3
+ "version": "0.1.0",
4
+ "description": "Generate pricing page copy with tier names, feature lists, and CTAs",
5
+ "type": "module",
6
+ "keywords": [
7
+ "tpmjs",
8
+ "pricing",
9
+ "marketing",
10
+ "copywriting",
11
+ "ai"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "devDependencies": {
23
+ "tsup": "^8.3.5",
24
+ "typescript": "^5.9.3",
25
+ "@tpmjs/tsconfig": "0.0.0"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/ajaxdavis/tpmjs.git",
33
+ "directory": "packages/tools/official/pricing-page-copy"
34
+ },
35
+ "homepage": "https://tpmjs.com",
36
+ "license": "MIT",
37
+ "tpmjs": {
38
+ "category": "marketing",
39
+ "frameworks": [
40
+ "vercel-ai"
41
+ ],
42
+ "tools": [
43
+ {
44
+ "exportName": "pricingPageCopyTool",
45
+ "description": "Generates comprehensive pricing page copy with tier names, headlines, benefit-oriented feature lists, CTAs, FAQs, and trust signals. Frames features as benefits and clearly differentiates tiers.",
46
+ "parameters": [
47
+ {
48
+ "name": "tiers",
49
+ "type": "object[]",
50
+ "description": "Pricing tiers with features and prices. Each tier should have: name (optional), price (number or string), billingPeriod (optional), features (string[]), recommended (optional boolean)",
51
+ "required": true
52
+ },
53
+ {
54
+ "name": "targetAudience",
55
+ "type": "string",
56
+ "description": "Primary target audience (e.g., 'small businesses', 'developers', 'teams')",
57
+ "required": true
58
+ }
59
+ ],
60
+ "returns": {
61
+ "type": "PricingPageCopy",
62
+ "description": "Complete pricing page copy with page headline/subheadline, processed tiers (with names, headlines, benefit-oriented features, CTAs, badges), FAQs, trust signals, and guarantee"
63
+ },
64
+ "aiAgent": {
65
+ "useCase": "Use this tool when users need to create pricing page copy for their products or services. Automatically generates benefit-oriented copy, tier differentiation, and conversion-focused CTAs.",
66
+ "limitations": "Generates copy structure and suggestions, not actual product pricing strategy. Copy should be reviewed and customized based on brand voice and specific product details.",
67
+ "examples": [
68
+ "Generate pricing page copy for our SaaS product with 3 tiers",
69
+ "Create pricing copy for small business audience with Free, Pro, and Enterprise plans",
70
+ "Build a pricing page for our API product targeting developers"
71
+ ]
72
+ }
73
+ }
74
+ ]
75
+ },
76
+ "dependencies": {
77
+ "ai": "6.0.0-beta.124"
78
+ },
79
+ "scripts": {
80
+ "build": "tsup",
81
+ "dev": "tsup --watch",
82
+ "type-check": "tsc --noEmit",
83
+ "clean": "rm -rf dist .turbo"
84
+ }
85
+ }