feat(api): Add payments with Polar.sh (#264)

## Description
<!-- Briefly describe the purpose and scope of your changes -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced a new subscription API endpoint for managing subscriptions
and products.
- Enhanced subscription management with new entities and
functionalities.
- Added functionality to retrieve current timestamps in both local and
UTC formats.
- Added Polar.sh integration with customer portal and checkout session
creation APIs.

- **Refactor**
- Redesigned team details to now present members and subscription
information instead of a plan type.
  - Enhanced member management by incorporating role assignments.
- Streamlined user data handling and removed legacy subscription event
logic.
  - Simplified error handling in actor functions for better clarity.
  - Updated plan types and UI labels to reflect new subscription tiers.
  - Improved database indexing for Steam user data.

- **Chores**
- Updated the database schema with new tables and fields to support
subscription, team, and member enhancements.
  - Extended identifier prefixes to broaden system integration.
- Added new secrets related to pricing plans in infrastructure
configuration.
  - Configured API and auth routing with new domain and routing rules.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
Wanjohi
2025-04-18 14:24:19 +03:00
committed by GitHub
parent 76d27e4708
commit 47e61599bb
40 changed files with 3304 additions and 425 deletions

View File

@@ -8,8 +8,8 @@ import { useNavigate } from "@solidjs/router";
import { useOpenAuth } from "@openauthjs/solid";
import { utility } from "@nestri/www/ui/utility";
import { useAccount } from "../providers/account";
import { Container, Screen as FullScreen } from "@nestri/www/ui/layout";
import { FormField, Input, Select } from "@nestri/www/ui/form";
import { Container, Screen as FullScreen } from "@nestri/www/ui/layout";
import { createForm, getValue, setError, valiForm } from "@modular-forms/solid";
const nameRegex = /^[a-z0-9\-]+$/
@@ -32,8 +32,9 @@ const Hr = styled("hr", {
})
const Plan = {
Pro: 'BYOG',
Basic: 'Hosted',
Free: 'free',
Pro: 'pro',
Family: 'family',
} as const;
const schema = v.object({
@@ -110,6 +111,13 @@ const UrlTitle = styled("span", {
}
})
/**
* Renders a form for creating a new team with validated fields for team name, slug, and plan type.
*
* Submits the form data to the API to create the team, displays validation errors, and navigates to the new team's page upon success.
*
* @remark If the chosen team slug is already taken, an error message is shown for the slug field.
*/
export function CreateTeamComponent() {
const [form, { Form, Field }] = createForm({
validate: valiForm(schema),
@@ -215,12 +223,14 @@ export function CreateTeamComponent() {
required
value={field.value}
badges={[
{ label: "BYOG", color: "purple" },
{ label: "Hosted", color: "blue" },
{ label: "Free", color: "gray" },
{ label: "Pro", color: "blue" },
{ label: "Family", color: "purple" },
]}
options={[
{ label: "I'll be playing on my machine", value: 'BYOG' },
{ label: "I'll be playing on the cloud", value: 'Hosted' },
{ label: "I'll be playing by myself", value: 'free' },
{ label: "I'll be playing with 3 friends", value: 'pro' },
{ label: "I'll be playing with 5 family members", value: 'family' },
]}
/>
</FormField>