Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
634750802 committed Sep 9, 2024
1 parent 3ad0033 commit de46767
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion frontend/app/src/api/site-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export interface PublicWebsiteSettings {
'custom_js_button_img_src': string;
'custom_js_logo_src': string;
'ga_id': string | null;
'enable_post_verifications': boolean;
'enable_post_verifications_for_widgets': boolean;
}

const settingsItemSchema = z.object({
Expand Down Expand Up @@ -69,7 +71,7 @@ const settingsItemSchema = z.object({
z.object({
data_type: z.literal('bool'),
value: z.boolean().nullable(),
default: z.boolean(),
default: z.coerce.boolean(),
}),
z.object({
data_type: z.literal('list'),
Expand Down
8 changes: 7 additions & 1 deletion frontend/app/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,16 @@ export default async function RootLayout ({
getBootstrapStatus(),
]);

const _experimentalFeatures = experimentalFeatures();

if (!settings.enable_post_verifications) {
delete _experimentalFeatures.message_verify_service;
}

return (
<html lang="en" suppressHydrationWarning>
<body className={inter.className}>
<RootProviders me={me} settings={settings} bootstrapStatus={bootstrapStatus} experimentalFeatures={experimentalFeatures()}>
<RootProviders me={me} settings={settings} bootstrapStatus={bootstrapStatus} experimentalFeatures={_experimentalFeatures}>
{children}
<SystemWizardDialog />
</RootProviders>
Expand Down
4 changes: 4 additions & 0 deletions frontend/packages/widget-react/src/load-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@ export async function loadConfig () {
fetch(requestUrl(`/experimental-features`)).then(res => res.json() as Promise<Partial<ExperimentalFeatures>>),
]);

if (!settings.enable_post_verifications || !settings.enable_post_verifications_for_widgets) {
delete experimentalFeatures.message_verify_service;
}

return { settings, bootstrapStatus, experimentalFeatures };
}

0 comments on commit de46767

Please sign in to comment.