feat(subscriptions): added polar as payment provider for subscriptions
* feature(dashboard): add polar / subscription * wip(payments): manage subscription * wip(payments): add free product, faq and some other improvements * fix(root): change node to bundler in tsconfig * wip(payments): display current subscription * feat(dashboard): schedule project for deletion * wip(payments): support custom products/subscriptions * wip(payments): fix polar scripts * wip(payments): add json package to dockerfiles
This commit is contained in:
committed by
GitHub
parent
86bf9dd064
commit
168ebc3430
21
packages/json/index.ts
Normal file
21
packages/json/index.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import superjson from 'superjson';
|
||||
|
||||
export function getSafeJson<T>(str: string): T | null {
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
} catch (e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function getSuperJson<T>(str: string): T | null {
|
||||
const json = getSafeJson<T>(str);
|
||||
if (typeof json === 'object' && json !== null && 'json' in json) {
|
||||
return superjson.parse<T>(str);
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
export function setSuperJson(str: any): string {
|
||||
return superjson.stringify(str);
|
||||
}
|
||||
17
packages/json/package.json
Normal file
17
packages/json/package.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@openpanel/json",
|
||||
"version": "0.0.1",
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"superjson": "^1.13.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@openpanel/tsconfig": "workspace:*",
|
||||
"@openpanel/validation": "workspace:*",
|
||||
"@types/node": "20.14.8",
|
||||
"typescript": "^5.2.2"
|
||||
}
|
||||
}
|
||||
13
packages/json/tsconfig.json
Normal file
13
packages/json/tsconfig.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "@openpanel/tsconfig/base.json",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
"@/server/*": ["./src/server/*"]
|
||||
},
|
||||
"tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
|
||||
},
|
||||
"include": ["."],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user