Skip to content

Commit

Permalink
refactor: update naming
Browse files Browse the repository at this point in the history
replace all "mainFlow" with "experience"
  • Loading branch information
gao-sun committed May 30, 2024
1 parent d8b92e4 commit 9fcb9a1
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 16 deletions.
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 @@ export default function koaSecurityHeaders<StateT, ContextT, ResponseBodyT>(
};

// @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 @@ export default function koaSecurityHeaders<StateT, ContextT, ResponseBodyT>(
}

// 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

0 comments on commit 9fcb9a1

Please sign in to comment.