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

New release - GCJ prod account #14414

Merged
merged 2 commits into from
Dec 4, 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 @@ -14,7 +14,8 @@ import constants from '../../account-sidebar/UsefulLinks/constants';

const kycIndiaFeature = 'identity-documents';
const kycFraudFeature = 'procedures:fraud';
const kycFeatures = [kycIndiaFeature, kycFraudFeature]
const newAccount = 'new-account';
const accountFeatures = [kycIndiaFeature, kycFraudFeature, newAccount];

export default function AccountSidebar() {
const [menu, setMenu] = useState<SidebarMenuItem>(undefined);
Expand All @@ -38,6 +39,7 @@ export default function AccountSidebar() {
}

const isEUOrCA = ['EU', 'CA'].includes(region);
const isNewAccountAvailable = !!availability['new-account'];

menu.push({
id: 'back-to-home',
Expand All @@ -48,7 +50,7 @@ export default function AccountSidebar() {
menu.push({
id: 'my-account',
label: t('sidebar_account'),
href: navigation.getURL('dedicated', '/useraccount/dashboard'),
href: navigation.getURL(isNewAccountAvailable ? 'new-account' : 'dedicated', '/useraccount/dashboard'),
routeMatcher: new RegExp('^/useraccount'),
});

Expand All @@ -58,7 +60,7 @@ export default function AccountSidebar() {
menu.push({
id: 'my-identity-documents',
label: t('sidebar_account_identity_documents'),
href: navigation.getURL('dedicated', '/identity-documents'),
href: navigation.getURL(isNewAccountAvailable ? 'new-account' : 'dedicated', '/identity-documents'),
routeMatcher: new RegExp('^/identity-documents'),
});
}
Expand All @@ -70,7 +72,7 @@ export default function AccountSidebar() {
menu.push({
id: 'kyc-documents',
label: t('sidebar_account_kyc_documents'),
href: navigation.getURL('dedicated', '/documents'),
href: navigation.getURL(isNewAccountAvailable ? 'new-account' : 'dedicated', '/documents'),
routeMatcher: new RegExp('^/documents'),
});
}
Expand Down Expand Up @@ -119,7 +121,7 @@ export default function AccountSidebar() {
menu.push({
id: 'my-contacts',
label: t('sidebar_account_contacts'),
href: navigation.getURL('dedicated', '/contacts'),
href: navigation.getURL(isNewAccountAvailable ? 'new-account' : 'dedicated', '/contacts'),
routeMatcher: new RegExp('^/contacts'),
});
}
Expand Down Expand Up @@ -152,7 +154,7 @@ export default function AccountSidebar() {
return menu;
};

const {data: availability} = useFeatureAvailability(features.concat(kycFeatures));
const {data: availability} = useFeatureAvailability(features.concat(accountFeatures));

const buildMenu = async () =>
Promise.resolve({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const UserAccountMenu = ({
const [isKycDocumentsVisible, setIsDocumentsVisible] = useState<boolean>(
false,
);

const [isNewAccountAvailable, setIsNewAccountAvailable] = useState<boolean>(false);
const user = shell
.getPlugin('environment')
.getEnvironment()
Expand Down Expand Up @@ -70,12 +70,12 @@ const UserAccountMenu = ({
const getUrl = (key: string, hash: string) =>
shell.getPlugin('navigation').getURL(key, hash);
const ssoLink = getUrl('iam', '#/dashboard/users');
const supportLink = getUrl('dedicated', '#/useraccount/support/level');
let [supportLink, setSupportLink] = useState(getUrl('dedicated', '#/useraccount/support/level'));

const getAllLinks = useMemo(
() => async () => {
let isIdentityDocumentsAvailable = false;
const featureAvailability = await fetchFeatureAvailabilityData(['identity-documents', 'procedures:fraud']);
const featureAvailability = await fetchFeatureAvailabilityData(['new-account', 'identity-documents', 'procedures:fraud']);
if (featureAvailability['identity-documents']) {
const { status } = await reketInstance.get(`/me/procedure/identity`);
isIdentityDocumentsAvailable = ['required', 'open'].includes(status);
Expand All @@ -85,11 +85,23 @@ const UserAccountMenu = ({
setIsDocumentsVisible(['required', 'open'].includes(status));
}

setIsNewAccountAvailable(!!featureAvailability['new-account'])

if (isNewAccountAvailable) {
setSupportLink(getUrl('new-account', '#/useraccount/support/level'));
}

setAllLinks([
...links,
...links.map((link: UserLink) => {
if (['user-account-menu-profile', 'myCommunications', 'myContacts'].includes(link.key)) {
link.app = isNewAccountAvailable ? 'new-account' : 'dedicated';
}
return link;
}),
...(isIdentityDocumentsAvailable
? [
{
app: isNewAccountAvailable ? 'new-account' : 'dedicated',
key: 'myIdentityDocuments',
hash: '#/identity-documents',
i18nKey: 'user_account_menu_my_identity_documents',
Expand All @@ -99,6 +111,7 @@ const UserAccountMenu = ({
...(region === 'US'
? [
{
app: isNewAccountAvailable ? 'new-account' : 'dedicated',
key: 'myAssistanceTickets',
hash: '#/ticket',
i18nKey: 'user_account_menu_my_assistance_tickets',
Expand Down Expand Up @@ -186,7 +199,7 @@ const UserAccountMenu = ({
</div>
<div className="border-bottom pb-2 pt-2">
{allLinks.map((link: UserLink) => {
const { key, hash, i18nKey } = link;
const { app, key, hash, i18nKey } = link;
return (
<a
key={key}
Expand All @@ -195,7 +208,7 @@ const UserAccountMenu = ({
className="d-block"
aria-label={t(i18nKey)}
title={t(i18nKey)}
href={getUrl('dedicated', hash)}
href={getUrl(app, hash)}
target="_top"
>
{t(i18nKey)}
Expand All @@ -208,6 +221,7 @@ const UserAccountMenu = ({
id={'account_kyc_documents'}
onClick={() => onLinkClick(
{
app: isNewAccountAvailable ? 'new-account': 'dedicated',
key: 'account_kyc_documents',
hash: '#/documents',
i18nKey: 'sidebar_account_kyc_documents'
Expand All @@ -216,7 +230,7 @@ const UserAccountMenu = ({
className="d-block"
aria-label={sidebarTranslation.t('sidebar_account_kyc_documents')}
title={sidebarTranslation.t('sidebar_account_kyc_documents')}
href={getUrl('dedicated', '#/documents')}
href={getUrl(isNewAccountAvailable ? 'new-account': 'dedicated', '#/documents')}
target="_top"
>
{sidebarTranslation.t('sidebar_account_kyc_documents')}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export type UserLink = {
app: string;
key: string;
hash: string;
i18nKey: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,50 @@ export const tracking = {

export const links: UserLink[] = [
{
app: 'dedicated',
key: 'user-account-menu-profile',
hash: '#/useraccount/dashboard',
i18nKey: 'user_account_menu_profile',
trackingHit: tracking.goToProfile,
},
{
app: 'dedicated',
key: 'myInvoices',
hash: '#/billing/history',
i18nKey: 'user_account_menu_my_invoices',
trackingHit: tracking.billingBills,
},
{
app: 'dedicated',
key: 'myServices',
hash: '#/billing/autorenew',
i18nKey: 'user_account_menu_my_services',
trackingHit: tracking.myServices
},
{
app: 'dedicated',
key: 'myCommunications',
hash: '#/useraccount/emails',
i18nKey: 'user_account_menu_my_communication',
trackingHit: tracking.accountContacts,
},
{
app: 'dedicated',
key: 'myPaymentMethods',
hash: '#/billing/payment/method',
i18nKey: 'user_account_menu_my_payment_methods',
trackingHit: tracking.paymentMethod,

},
{
app: 'dedicated',
key: 'myCommands',
hash: '#/billing/orders',
i18nKey: 'user_account_menu_my_commands',
trackingHit: tracking.orders,
},
{
app: 'dedicated',
key: 'myContacts',
hash: '#/contacts/services',
i18nKey: 'user_account_menu_my_contacts',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default {
isDisabled: '<',
supportLink: '<',
hubLink: '<',
isSupportWithExternalLinks: '<',
},
controller,
template,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,14 @@ export const PRIVACY_LINKS = {
WE: 'https://www.ovhcloud.com/en-ie/terms-and-conditions/privacy-policy/',
};

export const SUPPORT_URL = 'https://help.ovhcloud.com/csm?id=csm_get_help';

export default {
DOCUMENT_TYPE,
DOCUMENT_LIST,
MAXIMUM_SIZE,
LEGAL_FORMS,
MAXIMUM_DOCUMENTS,
PRIVACY_LINKS,
SUPPORT_URL,
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TRACKING } from './constants';
import { TRACKING, SUPPORT_URL } from './constants';

export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('account.kyc-documents.documents', {
Expand All @@ -7,8 +7,15 @@ export default /* @ngInject */ ($stateProvider) => {
resolve: {
breadcrumb: /* @ngInject */ ($translate) =>
$translate.instant('kyc_documents_breadcrumb'),
supportLink: /* @ngInject */ (coreURLBuilder) =>
coreURLBuilder.buildURL('dedicated', '#/support/tickets'),
isSupportWithExternalLinks: /* @ngInject */ (coreConfig) =>
coreConfig.isRegion(['EU', 'CA']),
supportLink: /* @ngInject */ (
isSupportWithExternalLinks,
coreURLBuilder,
) =>
isSupportWithExternalLinks
? SUPPORT_URL
: coreURLBuilder.buildURL('dedicated', '#/support/tickets'),
},
atInternet: {
rename: TRACKING.DOCUMENTS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<a
data-ng-href="{{:: $ctrl.supportLink}}"
data-translate="document_dashboard_open_banner_link"
target="{{$ctrl.isSupportWithExternalLinks ? '_blank' : '_top'}}"
></a>
</oui-message>

Expand Down
Loading