|
1 | | -import { Environment } from '@ovh-ux/manager-config'; |
2 | | -import { MAX_NAME_LENGTH, URLS } from './constants'; |
| 1 | +import { MAX_NAME_LENGTH, USER_MENU_URLS } from './constants'; |
3 | 2 |
|
4 | 3 | export default class { |
5 | 4 | /* @ngInject */ |
6 | | - constructor($q, $translate, atInternet, ovhManagerNavbarMenuHeaderBuilder, ssoAuthentication) { |
| 5 | + constructor( |
| 6 | + $q, |
| 7 | + $translate, |
| 8 | + atInternet, |
| 9 | + coreconfig, |
| 10 | + ovhManagerNavbarMenuHeaderBuilder, |
| 11 | + ssoAuthentication, |
| 12 | + ) { |
7 | 13 | this.$q = $q; |
8 | 14 | this.$translate = $translate; |
9 | 15 | this.atInternet = atInternet; |
10 | 16 | this.NavbarBuilder = ovhManagerNavbarMenuHeaderBuilder; |
11 | 17 | this.ssoAuthentication = ssoAuthentication; |
12 | 18 |
|
13 | | - this.REGION = Environment.getRegion(); |
| 19 | + this.REGION = coreconfig.getRegion(); |
| 20 | + this.URLS = USER_MENU_URLS[this.REGION]; |
14 | 21 | } |
15 | 22 |
|
16 | 23 | $onInit() { |
@@ -49,100 +56,100 @@ export default class { |
49 | 56 | return [{ |
50 | 57 | name: 'user.account', |
51 | 58 | title: this.$translate.instant('navbar_user_account'), |
52 | | - url: URLS.userInfos, |
| 59 | + url: this.URLS.userInfos, |
53 | 60 | click: () => this.trackUserMenuSection('my_account', 'account'), |
54 | 61 | subLinks: [{ |
55 | 62 | title: this.$translate.instant('navbar_user_account_infos'), |
56 | | - url: URLS.userInfos, |
| 63 | + url: this.URLS.userInfos, |
57 | 64 | }, { |
58 | 65 | title: this.$translate.instant('navbar_user_account_security'), |
59 | | - url: URLS.userSecurity, |
| 66 | + url: this.URLS.userSecurity, |
60 | 67 | }, (this.REGION === 'EU' || this.REGION === 'CA') && { |
61 | 68 | title: this.$translate.instant('navbar_user_account_emails'), |
62 | | - url: URLS.userEmails, |
| 69 | + url: this.URLS.userEmails, |
63 | 70 | }, (this.REGION === 'EU') && { |
64 | 71 | title: this.$translate.instant('navbar_user_account_subscriptions'), |
65 | | - url: URLS.userSubscriptions, |
| 72 | + url: this.URLS.userSubscriptions, |
66 | 73 | }, { |
67 | 74 | title: this.$translate.instant('navbar_user_account_ssh'), |
68 | | - url: URLS.userSSH, |
| 75 | + url: this.URLS.userSSH, |
69 | 76 | }, { |
70 | 77 | title: this.$translate.instant('navbar_user_account_advanced'), |
71 | | - url: URLS.userAdvanced, |
| 78 | + url: this.URLS.userAdvanced, |
72 | 79 | }], |
73 | 80 | }, |
74 | 81 |
|
75 | 82 | // Billing |
76 | 83 | !this.user.isEnterprise && { |
77 | 84 | name: 'user.billing', |
78 | 85 | title: this.$translate.instant('navbar_user_billing'), |
79 | | - url: URLS.billing, |
| 86 | + url: this.URLS.billing, |
80 | 87 | click: () => this.trackUserMenuSection('my_facturation', 'billing'), |
81 | 88 | subLinks: [{ |
82 | 89 | title: this.$translate.instant('navbar_user_billing_history'), |
83 | | - url: URLS.billing, |
| 90 | + url: this.URLS.billing, |
84 | 91 | }, { |
85 | 92 | title: this.$translate.instant('navbar_user_billing_payments'), |
86 | | - url: URLS.billingPayments, |
| 93 | + url: this.URLS.billingPayments, |
87 | 94 | }], |
88 | 95 | }, |
89 | 96 |
|
90 | 97 | // Services |
91 | 98 | (this.REGION === 'EU' || this.REGION === 'CA') && (!this.user.isEnterprise ? { |
92 | 99 | name: 'user.services', |
93 | 100 | title: this.$translate.instant('navbar_user_renew'), |
94 | | - url: URLS.services, |
| 101 | + url: this.URLS.services, |
95 | 102 | click: () => this.trackUserMenuSection('my_services', 'services'), |
96 | 103 | subLinks: [{ |
97 | 104 | title: this.$translate.instant('navbar_user_renew_management'), |
98 | | - url: URLS.services, |
| 105 | + url: this.URLS.services, |
99 | 106 | }, { |
100 | 107 | title: this.$translate.instant('navbar_user_renew_agreements'), |
101 | | - url: URLS.servicesAgreements, |
| 108 | + url: this.URLS.servicesAgreements, |
102 | 109 | }], |
103 | 110 | } : { |
104 | 111 | title: this.$translate.instant('navbar_user_renew_agreements'), |
105 | | - url: URLS.servicesAgreements, |
| 112 | + url: this.URLS.servicesAgreements, |
106 | 113 | }), |
107 | 114 |
|
108 | 115 | // Payment |
109 | 116 | !this.user.isEnterprise && { |
110 | 117 | name: 'user.payment', |
111 | 118 | title: this.$translate.instant('navbar_user_means'), |
112 | | - url: URLS.paymentMeans, |
| 119 | + url: this.URLS.paymentMeans, |
113 | 120 | click: () => this.trackUserMenuSection('my_payment_types', 'payment_types'), |
114 | 121 | subLinks: [{ |
115 | 122 | title: this.$translate.instant('navbar_user_means_mean'), |
116 | | - url: URLS.paymentMeans, |
| 123 | + url: this.URLS.paymentMeans, |
117 | 124 | }, (this.REGION === 'EU' || this.REGION === 'CA') && { |
118 | 125 | title: this.$translate.instant('navbar_user_means_ovhaccount'), |
119 | | - url: URLS.ovhAccount, |
| 126 | + url: this.URLS.ovhAccount, |
120 | 127 | }, (this.REGION === 'EU' || this.REGION === 'CA') && { |
121 | 128 | title: this.$translate.instant('navbar_user_means_vouchers'), |
122 | | - url: URLS.billingVouchers, |
| 129 | + url: this.URLS.billingVouchers, |
123 | 130 | }, { |
124 | 131 | title: this.$translate.instant('navbar_user_means_refunds'), |
125 | | - url: URLS.billingRefunds, |
| 132 | + url: this.URLS.billingRefunds, |
126 | 133 | }, (this.REGION === 'EU') && { |
127 | 134 | title: this.$translate.instant('navbar_user_means_fidelity'), |
128 | | - url: URLS.billingFidelity, |
| 135 | + url: this.URLS.billingFidelity, |
129 | 136 | }, { |
130 | 137 | title: this.$translate.instant('navbar_user_means_credits'), |
131 | | - url: URLS.billingCredits, |
| 138 | + url: this.URLS.billingCredits, |
132 | 139 | }], |
133 | 140 | }, |
134 | 141 |
|
135 | 142 | // Orders |
136 | 143 | (!this.user.isEnterprise && this.REGION === 'EU' && this.user.ovhSubsidiary === 'FR') && { |
137 | 144 | title: this.$translate.instant('navbar_user_orders_all'), |
138 | | - url: URLS.orders, |
| 145 | + url: this.URLS.orders, |
139 | 146 | click: () => this.trackUserMenuSection('my_orders', 'orders'), |
140 | 147 | }, |
141 | 148 |
|
142 | 149 | // Contacts |
143 | 150 | (this.REGION === 'EU') && { |
144 | 151 | title: this.$translate.instant('navbar_user_contacts'), |
145 | | - url: URLS.contacts, |
| 152 | + url: this.URLS.contacts, |
146 | 153 | click: () => this.trackUserMenuSection('my_contacts', 'contacts'), |
147 | 154 | }, |
148 | 155 |
|
|
0 commit comments