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

refactor: update naming #5951

Merged
merged 1 commit into from
May 31, 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 @@ -20,7 +20,14 @@ type Props = PropsWithChildren<{
readonly onGoBack?: () => void;
}>;

function MainFlowLikeModal({ title, subtitle, subtitleProps, children, onClose, onGoBack }: Props) {
function ExperienceLikeModal({
title,
subtitle,
subtitleProps,
children,
onClose,
onGoBack,
}: Props) {
const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' });
const navigate = useNavigate();

Expand Down Expand Up @@ -58,4 +65,4 @@ function MainFlowLikeModal({ title, subtitle, subtitleProps, children, onClose,
);
}

export default MainFlowLikeModal;
export default ExperienceLikeModal;
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useStaticApi } from '@/hooks/use-api';
import { useConfirmModal } from '@/hooks/use-confirm-modal';
import useTenantPathname from '@/hooks/use-tenant-pathname';

import MainFlowLikeModal from '../../components/MainFlowLikeModal';
import ExperienceLikeModal from '../../components/ExperienceLikeModal';
import { handleError } from '../../utils';

type FormFields = {
Expand Down Expand Up @@ -88,7 +88,7 @@ function ChangePasswordModal() {
};

return (
<MainFlowLikeModal title="profile.password.set_password" onClose={onClose} onGoBack={onClose}>
<ExperienceLikeModal title="profile.password.set_password" onClose={onClose} onGoBack={onClose}>
<TextInput
placeholder={t('profile.password.password')}
{...register('newPassword', {
Expand Down Expand Up @@ -143,7 +143,7 @@ function ChangePasswordModal() {
isLoading={isSubmitting}
onClick={onSubmit}
/>
</MainFlowLikeModal>
</ExperienceLikeModal>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useStaticApi } from '@/hooks/use-api';
import useTenantPathname from '@/hooks/use-tenant-pathname';
import { trySubmitSafe } from '@/utils/form';

import MainFlowLikeModal from '../../components/MainFlowLikeModal';
import ExperienceLikeModal from '../../components/ExperienceLikeModal';
import { parseLocationState } from '../../utils';

type EmailForm = {
Expand Down Expand Up @@ -50,7 +50,7 @@ function LinkEmailModal() {
const { email: currentEmail } = parseLocationState(state);

return (
<MainFlowLikeModal
<ExperienceLikeModal
title="profile.link_account.link_email"
subtitle="profile.link_account.link_email_subtitle"
onClose={onClose}
Expand Down Expand Up @@ -80,7 +80,7 @@ function LinkEmailModal() {
isLoading={isSubmitting}
onClick={onSubmit}
/>
</MainFlowLikeModal>
</ExperienceLikeModal>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useConfirmModal } from '@/hooks/use-confirm-modal';
import useCurrentUser from '@/hooks/use-current-user';
import useTenantPathname from '@/hooks/use-tenant-pathname';

import MainFlowLikeModal from '../../components/MainFlowLikeModal';
import ExperienceLikeModal from '../../components/ExperienceLikeModal';
import { handleError, parseLocationState } from '../../utils';

import * as styles from './index.module.scss';
Expand Down Expand Up @@ -110,7 +110,7 @@ function VerificationCodeModal() {
}, [code, onSubmit]);

return (
<MainFlowLikeModal
<ExperienceLikeModal
title="profile.code.enter_verification_code"
subtitle="profile.code.enter_verification_code_subtitle"
subtitleProps={conditional(email && { target: email })}
Expand Down Expand Up @@ -153,7 +153,7 @@ function VerificationCodeModal() {
{t('profile.password.verify_via_password')}
</TextLink>
)}
</MainFlowLikeModal>
</ExperienceLikeModal>
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import TextLink from '@/ds-components/TextLink';
import { useStaticApi } from '@/hooks/use-api';
import useTenantPathname from '@/hooks/use-tenant-pathname';

import MainFlowLikeModal from '../../components/MainFlowLikeModal';
import ExperienceLikeModal from '../../components/ExperienceLikeModal';
import { handleError, parseLocationState } from '../../utils';

import * as styles from './index.module.scss';
Expand Down Expand Up @@ -69,7 +69,7 @@ function VerifyPasswordModal() {
};

return (
<MainFlowLikeModal
<ExperienceLikeModal
title="profile.password.enter_password"
subtitle="profile.password.enter_password_subtitle"
onClose={onClose}
Expand Down Expand Up @@ -116,7 +116,7 @@ function VerifyPasswordModal() {
{t('profile.code.verify_via_code')}
</TextLink>
)}
</MainFlowLikeModal>
</ExperienceLikeModal>
);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/middleware/koa-security-headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
};

// @ts-expect-error: helmet typings has lots of {A?: T, B?: never} | {A?: never, B?: T} options definitions. Optional settings type can not inferred correctly.
const mainFlowUiSecurityHeaderSettings: HelmetOptions = {
const experienceSecurityHeaderSettings: HelmetOptions = {
...basicSecurityHeaderSettings,
// WARNING: high risk Need to allow self hosted terms of use page loaded in an iframe
frameguard: false,
Expand Down Expand Up @@ -145,7 +145,7 @@
}

// Main flow UI
await helmetPromise(mainFlowUiSecurityHeaderSettings, req, res);
await helmetPromise(experienceSecurityHeaderSettings, req, res);

Check warning on line 148 in packages/core/src/middleware/koa-security-headers.ts

View check run for this annotation

Codecov / codecov/patch

packages/core/src/middleware/koa-security-headers.ts#L148

Added line #L148 was not covered by tests

return next();
};
Expand Down
Loading