Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(console, core): remove dev features guard for bring your ui feature #6465

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Controller, useFormContext } from 'react-hook-form';
import { Trans, useTranslation } from 'react-i18next';

import InlineUpsell from '@/components/InlineUpsell';
import { isDevFeaturesEnabled, isCloud } from '@/consts/env';
import { isCloud } from '@/consts/env';
import { SubscriptionDataContext } from '@/contexts/SubscriptionDataProvider';
import Card from '@/ds-components/Card';
import CodeEditor from '@/ds-components/CodeEditor';
Expand Down Expand Up @@ -67,7 +67,7 @@ function CustomUiForm() {
)}
/>
</FormField>
{isDevFeaturesEnabled && isCloud && (
{isCloud && (
<FormField
title="sign_in_exp.custom_ui.bring_your_ui_title"
description={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"name": "Custom UI assets",
"description": "Endpoints for uploading custom UI assets for the sign-in experience. Users can upload a zip file containing custom HTML, CSS, and JavaScript files to replace and fully customize the sign-in experience."
},
{ "name": "Cloud only" },
{ "name": "Dev feature" }
{ "name": "Cloud only" }
],
"paths": {
"/api/sign-in-exp/default/custom-ui-assets": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,8 @@ export default function customUiAssetsRoutes<T extends ManagementApiRouter>(
},
]: RouterInitArgs<T>
) {
// TODO: Remove
if (!EnvSet.values.isDevFeaturesEnabled) {
return;
}

router.post(
'/sign-in-exp/default/custom-ui-assets',
// Manually add this to avoid the case that the dev feature guard is removed but the quota guard is not being updated accordingly.
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
EnvSet.values.isDevFeaturesEnabled
? newKoaQuotaGuard({ key: 'bringYourUiEnabled', quota })
: koaQuotaGuard({ key: 'bringYourUiEnabled', quota }),
Expand Down
6 changes: 1 addition & 5 deletions packages/core/src/routes/swagger/utils/documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ const managementApiIdentifiableEntityNames = Object.freeze([

/** Additional tags that cannot be inferred from the path. */
const additionalTags = Object.freeze(
condArray<string>(
'Organization applications',
EnvSet.values.isDevFeaturesEnabled && 'Custom UI assets',
'Organization users'
)
condArray<string>('Organization applications', 'Custom UI assets', 'Organization users')
);

export const buildManagementApiBaseDocument = (
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/routes/swagger/utils/operation-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ type RouteDictionary = Record<`${OpenAPIV3.HttpMethods} ${string}`, string>;
const devFeatureCustomRoutes: RouteDictionary = Object.freeze({
// Subject tokens
'post /subject-tokens': 'CreateSubjectToken',
// Custom UI assets
'post /sign-in-exp/default/custom-ui-assets': 'UploadCustomUiAssets',
});

export const customRoutes: Readonly<RouteDictionary> = Object.freeze({
Expand Down Expand Up @@ -83,6 +81,8 @@ export const customRoutes: Readonly<RouteDictionary> = Object.freeze({
// Well-known
'get /.well-known/phrases': 'GetSignInExperiencePhrases',
'get /.well-known/sign-in-exp': 'GetSignInExperienceConfig',
// Custom UI assets
'post /sign-in-exp/default/custom-ui-assets': 'UploadCustomUiAssets',
...(EnvSet.values.isDevFeaturesEnabled ? devFeatureCustomRoutes : {}),
} satisfies RouteDictionary); // Key assertion doesn't work without `satisfies`

Expand Down
Loading