Refactor billing imports, reorganize package scripts and improve action structure

Deleted unnecessary schema files and reorganized their imports into more logical order. Modified the package script structure to align more accurately with standard conventions. Also refactored the team-billing.service file to improve action structure, making it easier to understand and edit. Furthermore, upgraded various dependencies, reflecting their new versions in the lockfile.
This commit is contained in:
giancarlo
2024-04-07 12:47:29 +08:00
parent 0a9c1f35c6
commit 0002ac6255
22 changed files with 244 additions and 82 deletions

View File

@@ -1,24 +0,0 @@
'use client';
import { createContext, useState } from 'react';
export const Captcha = createContext<{
token: string;
setToken: (token: string) => void;
}>({
token: '',
setToken: (_: string) => {
// do nothing
return '';
},
});
export function CaptchaProvider(props: { children: React.ReactNode }) {
const [token, setToken] = useState<string>('');
return (
<Captcha.Provider value={{ token, setToken }}>
{props.children}
</Captcha.Provider>
);
}

View File

@@ -1,17 +0,0 @@
'use client';
import { useContext } from 'react';
import { Turnstile } from '@marsidev/react-turnstile';
import { Captcha } from './captcha-provider';
export function CaptchaTokenSetter(props: { siteKey: string | undefined }) {
const { setToken } = useContext(Captcha);
if (!props.siteKey) {
return null;
}
return <Turnstile siteKey={props.siteKey} onSuccess={setToken} />;
}

View File

@@ -1,3 +0,0 @@
export * from './captchaTokenSetter';
export * from './use-captcha-token';
export * from './captcha-provider';

View File

@@ -1,13 +0,0 @@
import { useContext } from 'react';
import { Captcha } from './captcha-provider';
export function useCaptchaToken() {
const context = useContext(Captcha);
if (!context) {
throw new Error(`useCaptchaToken must be used within a CaptchaProvider`);
}
return context.token;
}

View File

@@ -8,7 +8,7 @@ import { If } from '@kit/ui/if';
import { Separator } from '@kit/ui/separator';
import { Trans } from '@kit/ui/trans';
import { useCaptchaToken } from './captcha';
import { useCaptchaToken } from '../captcha/client';
import { MagicLinkAuthContainer } from './magic-link-auth-container';
import { OauthProviders } from './oauth-providers';
import { EmailPasswordSignUpContainer } from './password-sign-up-container';