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:
Carl-Gerhard Lindesvärd
2025-02-26 11:24:00 +01:00
committed by GitHub
parent 86bf9dd064
commit 168ebc3430
105 changed files with 3395 additions and 463 deletions

View File

@@ -26,11 +26,25 @@ export const shortNumber =
}).format(value);
};
export const formatCurrency =
(locale: string) =>
(amount: number, currency = 'USD') => {
return new Intl.NumberFormat(locale, {
style: 'currency',
currency: currency,
minimumFractionDigits: 0,
maximumFractionDigits: 0,
}).format(amount);
};
export function useNumber() {
const locale = 'en-gb';
const locale = 'en-US';
const format = formatNumber(locale);
const short = shortNumber(locale);
const currency = formatCurrency(locale);
return {
currency,
format,
short,
shortWithUnit: (value: number | null | undefined, unit?: string | null) => {

View File

@@ -4,7 +4,7 @@ import debounce from 'lodash.debounce';
import { use, useEffect, useMemo, useState } from 'react';
import useWebSocket from 'react-use-websocket';
import { getSuperJson } from '@openpanel/common';
import { getSuperJson } from '@openpanel/json';
type UseWSOptions = {
debounce?: {