Skip to content

Commit 42b3805

Browse files
Omar ALKABOUSS MOUSSANAachrafHafedh
authored andcommitted
fix(billing): expose endstrategyenum for us region
ref: #MANAGER-20013 Signed-off-by: Omar ALKABOUSS MOUSSANA <omar.alkabouss-moussana.ext@corp.ovh.com>
1 parent caad1ac commit 42b3805

File tree

1 file changed

+72
-87
lines changed

1 file changed

+72
-87
lines changed

packages/manager/modules/billing/src/autoRenew/autorenew.routing.js

Lines changed: 72 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import assign from 'lodash/assign';
2-
31
import {
42
TRACKING_AUTORENEW_PAGE_NAME,
53
TRACKING_PAGE_CATEGORY,
64
} from './autorenew.constants';
75

8-
export default /* @ngInject */ ($stateProvider, coreConfigProvider) => {
6+
export default /* @ngInject */ ($stateProvider) => {
97
$stateProvider.state('billing.autorenewRedirection', {
108
url:
119
'/autoRenew?selectedType&pageSize&pageNumber&filters&searchText&nicBilling&sort',
@@ -47,95 +45,82 @@ export default /* @ngInject */ ($stateProvider, coreConfigProvider) => {
4745
squash: true,
4846
},
4947
},
50-
resolve: assign(
51-
{
52-
currentActiveLink: /* @ngInject */ ($state) => () =>
53-
$state.href($state.current.name, {}, { inherit: false }),
54-
sshLink: /* @ngInject */ ($state) =>
55-
$state.href('billing.autorenew.ssh', {}, { inherit: false }),
56-
queryParameters: /* @ngInject */ ($transition$, BillingAutoRenew) => {
57-
if ($transition$.to()?.name === 'billing.autorenew.services') {
58-
BillingAutoRenew.setQueryParams($transition$.params());
59-
}
60-
return BillingAutoRenew.getQueryParams();
61-
},
62-
featureAvailability: /* @ngInject */ (ovhFeatureFlipping) =>
63-
ovhFeatureFlipping.checkFeatureAvailability([
64-
'vrack:delete',
65-
'billing:management',
66-
'billing:autorenew2016Deployment',
67-
'billing:agreements',
68-
]),
69-
isAgreementsAvailable: /* @ngInject */ (featureAvailability) =>
70-
featureAvailability?.isFeatureAvailable('billing:agreements') ||
71-
false,
72-
isAutorenewManagementAvailable: /* @ngInject */ (featureAvailability) =>
73-
featureAvailability?.isFeatureAvailable('billing:management') ||
74-
false,
75-
hideBreadcrumb: /* @ngInject */ () => true,
76-
trackingPrefix: () => 'dedicated::account::billing::autorenew',
77-
goToAutorenew: /* @ngInject */ (
78-
$state,
79-
$timeout,
80-
Alerter,
81-
queryParameters,
82-
) => (message = false, type = 'success') => {
83-
const reload = message && type === 'success';
48+
resolve: {
49+
currentActiveLink: /* @ngInject */ ($state) => () =>
50+
$state.href($state.current.name, {}, { inherit: false }),
51+
sshLink: /* @ngInject */ ($state) =>
52+
$state.href('billing.autorenew.ssh', {}, { inherit: false }),
53+
queryParameters: /* @ngInject */ ($transition$, BillingAutoRenew) => {
54+
if ($transition$.to()?.name === 'billing.autorenew.services') {
55+
BillingAutoRenew.setQueryParams($transition$.params());
56+
}
57+
return BillingAutoRenew.getQueryParams();
58+
},
59+
featureAvailability: /* @ngInject */ (ovhFeatureFlipping) =>
60+
ovhFeatureFlipping.checkFeatureAvailability([
61+
'vrack:delete',
62+
'billing:management',
63+
'billing:autorenew2016Deployment',
64+
'billing:agreements',
65+
]),
66+
isAgreementsAvailable: /* @ngInject */ (featureAvailability) =>
67+
featureAvailability?.isFeatureAvailable('billing:agreements') || false,
68+
isAutorenewManagementAvailable: /* @ngInject */ (featureAvailability) =>
69+
featureAvailability?.isFeatureAvailable('billing:management') || false,
70+
hideBreadcrumb: /* @ngInject */ () => true,
71+
trackingPrefix: () => 'dedicated::account::billing::autorenew',
72+
goToAutorenew: /* @ngInject */ (
73+
$state,
74+
$timeout,
75+
Alerter,
76+
queryParameters,
77+
) => (message = false, type = 'success') => {
78+
const reload = message && type === 'success';
8479

85-
const promise = $state.go(
86-
'billing.autorenew',
87-
queryParameters || {},
88-
{
89-
reload,
90-
},
91-
);
80+
const promise = $state.go('billing.autorenew', queryParameters || {}, {
81+
reload,
82+
});
9283

93-
if (message) {
94-
promise.then(() =>
95-
$timeout(() => Alerter.set(`alert-${type}`, message)),
96-
);
97-
}
84+
if (message) {
85+
promise.then(() =>
86+
$timeout(() => Alerter.set(`alert-${type}`, message)),
87+
);
88+
}
9889

99-
return promise;
100-
},
101-
homeLink: /* @ngInject */ ($state, isAutorenewManagementAvailable) => {
102-
if (isAutorenewManagementAvailable) {
103-
return $state.href(
104-
'billing.autorenew.services',
105-
{},
106-
{ inherit: false },
107-
);
108-
}
109-
return null;
110-
},
111-
breadcrumb: /* @ngInject */ ($translate) =>
112-
$translate.instant('billing_title'),
113-
defaultPaymentMean: /* @ngInject */ (ovhPaymentMethod) =>
114-
ovhPaymentMethod.getDefaultPaymentMethod(),
115-
agreementsLink: /* @ngInject */ ($state, isAgreementsAvailable) => {
116-
if (isAgreementsAvailable) {
117-
return $state.href(
118-
'billing.autorenew.agreements',
119-
{},
120-
{ inherit: false },
121-
);
122-
}
123-
return null;
124-
},
90+
return promise;
91+
},
92+
homeLink: /* @ngInject */ ($state, isAutorenewManagementAvailable) => {
93+
if (isAutorenewManagementAvailable) {
94+
return $state.href(
95+
'billing.autorenew.services',
96+
{},
97+
{ inherit: false },
98+
);
99+
}
100+
return null;
125101
},
126-
!coreConfigProvider.isRegion('US')
127-
? {
128-
endStrategyEnum: /* @ngInject */ ($http) =>
129-
$http
130-
.get('/services.json')
131-
.then(
132-
({ data }) =>
133-
data.models['services.billing.engagement.EndStrategyEnum']
134-
?.enum,
135-
),
102+
breadcrumb: /* @ngInject */ ($translate) =>
103+
$translate.instant('billing_title'),
104+
defaultPaymentMean: /* @ngInject */ (ovhPaymentMethod) =>
105+
ovhPaymentMethod.getDefaultPaymentMethod(),
106+
agreementsLink: /* @ngInject */ ($state, isAgreementsAvailable) => {
107+
if (isAgreementsAvailable) {
108+
return $state.href(
109+
'billing.autorenew.agreements',
110+
{},
111+
{ inherit: false },
112+
);
136113
}
137-
: {},
138-
),
114+
return null;
115+
},
116+
endStrategyEnum: /* @ngInject */ ($http) =>
117+
$http
118+
.get('/services.json')
119+
.then(
120+
({ data }) =>
121+
data.models['services.billing.engagement.EndStrategyEnum']?.enum,
122+
),
123+
},
139124
atInternet: {
140125
ignore: true,
141126
},

0 commit comments

Comments
 (0)