mirror of
https://github.com/documenso/documenso.git
synced 2026-07-26 18:04:55 +10:00
138d663c25
Merge origin/main into feat/external-2fa-codes. Resolve formatting conflicts caused by biome rollout; preserve both feature streams: PR's external 2FA token + signing-session 2FA proof additions plus main's RateLimit/RecipientExpired/signingReminders/date-auto-insert. In complete-document-with-token.ts, drop the duplicate early field-fetching block introduced when main moved that logic later with date auto-insert support; keep the EXTERNAL_TWO_FACTOR_AUTH check using derivedRecipientActionAuth.
40 lines
994 B
TypeScript
40 lines
994 B
TypeScript
import { createContext, useContext } from 'react';
|
|
|
|
type BrandingContextValue = {
|
|
brandingEnabled: boolean;
|
|
brandingUrl: string;
|
|
brandingLogo: string;
|
|
brandingCompanyDetails: string;
|
|
brandingHidePoweredBy: boolean;
|
|
};
|
|
|
|
const BrandingContext = createContext<BrandingContextValue | undefined>(undefined);
|
|
|
|
const defaultBrandingContextValue: BrandingContextValue = {
|
|
brandingEnabled: false,
|
|
brandingUrl: '',
|
|
brandingLogo: '',
|
|
brandingCompanyDetails: '',
|
|
brandingHidePoweredBy: false,
|
|
};
|
|
|
|
export const BrandingProvider = (props: { branding?: BrandingContextValue; children: React.ReactNode }) => {
|
|
return (
|
|
<BrandingContext.Provider value={props.branding ?? defaultBrandingContextValue}>
|
|
{props.children}
|
|
</BrandingContext.Provider>
|
|
);
|
|
};
|
|
|
|
export const useBranding = () => {
|
|
const ctx = useContext(BrandingContext);
|
|
|
|
if (!ctx) {
|
|
throw new Error('Branding context not found');
|
|
}
|
|
|
|
return ctx;
|
|
};
|
|
|
|
export type BrandingSettings = BrandingContextValue;
|