Skip to content

Commit

Permalink
feat: fetch products from organization
Browse files Browse the repository at this point in the history
  • Loading branch information
xn1cklas committed Sep 7, 2024
1 parent b412ce6 commit 7be2042
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Create your polar access token here: https://polar.sh/settings#oauth

NEXT_PUBLIC_POLAR_ACCESS_TOKEN=your_polar_access_token_here
NEXT_PUBLIC_POLAR_ACCESS_TOKEN=your_polar_access_token_here
NEXT_PUBLIC_POLAR_ORGANIZATION_ID=your_polar_organization_id_here
40 changes: 38 additions & 2 deletions src/components/Products.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,49 @@ export const mockPricingData: PricingData[] = [
"Binary Downloads",
],
},
// ... (keep other mock data, update currency if needed)
{
id: "pro",
title: "Pro Plan",
forType: "For Teams",
monthlyPrice: "29",
annualPrice: "290",
currency: "USD",
description:
"Upgrade to Pro for advanced features and priority support. Ideal for growing teams and businesses.",
features: [
"Everything in Basic",
"Team Collaboration Tools",
"Advanced Analytics",
"Priority Support",
"Custom Integrations",
],
},
{
id: "enterprise",
title: "Enterprise",
forType: "For Large Organizations",
monthlyPrice: "Custom",
annualPrice: "Custom",
currency: "USD",
description:
"Tailored solutions for large-scale deployments with dedicated support and custom features.",
features: [
"Everything in Pro",
"Dedicated Account Manager",
"On-premise Deployment Option",
"Custom SLA",
"Advanced Security Features",
],
},
];

export async function Products(): Promise<PricingData[]> {
try {
const result = await polar.products.list({ organizationId: "nsquare" });
const result = await polar.products.list({
organizationId: process.env.NEXT_PUBLIC_POLAR_ORGANIZATION_ID,
});
const products = result.result.items;
console.log(products);

return products.length > 0
? mapProductsToPricingData(products)
Expand Down

0 comments on commit 7be2042

Please sign in to comment.