Skip to content

Commit

Permalink
Merge pull request #3266 from ovh/feat/account-migration-uikit
Browse files Browse the repository at this point in the history
feat: fi migration
  • Loading branch information
antleblanc authored Sep 21, 2020
2 parents bd2051a + cc87f66 commit 89e8a3e
Show file tree
Hide file tree
Showing 71 changed files with 1,540 additions and 177 deletions.
2 changes: 2 additions & 0 deletions packages/manager/apps/cloud/client/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { detach as detachPreloader } from '@ovh-ux/manager-preloader';
import ovhManagerCore from '@ovh-ux/manager-core';
import ngAtInternet from '@ovh-ux/ng-at-internet';
import ngAtInternetUiRouterPlugin from '@ovh-ux/ng-at-internet-ui-router-plugin';
import ovhManagerAccountMigration from '@ovh-ux/manager-account-migration';
import ngOvhApiWrappers from '@ovh-ux/ng-ovh-api-wrappers';
import ngOvhBrowserAlert from '@ovh-ux/ng-ovh-browser-alert';
import ngOvhCheckboxTable from '@ovh-ux/ng-ovh-checkbox-table';
Expand Down Expand Up @@ -80,6 +81,7 @@ angular
ngOvhUserPref,
ngOvhUiRouterLayout,
ngOvhUiRouterLineProgress,
ovhManagerAccountMigration,
'ovh-api-services',
'ovh-common-style',
ngQAllSettled,
Expand Down
2 changes: 1 addition & 1 deletion packages/manager/apps/cloud/client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<!-- /Skip content target -->

<ovh-browser-alert></ovh-browser-alert>

<account-migration-notification></account-migration-notification>
<ovh-chatbot
data-ng-if="$ctrl.user.ovhSubsidiary"
data-language="{{$ctrl.currentLanguage}}"
Expand Down
1 change: 1 addition & 0 deletions packages/manager/apps/cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"start:watch": "lerna exec --stream --parallel --scope='@ovh-ux/manager-cloud' --include-dependencies -- npm run dev:watch --if-present"
},
"dependencies": {
"@ovh-ux/manager-account-migration": "^0.0.0 || ^1.0.0",
"@ovh-ux/manager-account-sidebar": "^2.0.0 || ^3.0.0",
"@ovh-ux/manager-at-internet-configuration": "^0.0.0 || ^1.0.0",
"@ovh-ux/manager-banner": "^1.1.3",
Expand Down
2 changes: 2 additions & 0 deletions packages/manager/apps/dedicated/client/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import ovhManagerVrack from '@ovh-ux/manager-vrack';
import ovhManagerIplb from '@ovh-ux/manager-iplb';
import { detach as detachPreloader } from '@ovh-ux/manager-preloader';
import ovhNotificationsSidebar from '@ovh-ux/manager-notifications-sidebar';
import ovhManagerAccountMigration from '@ovh-ux/manager-account-migration';
import account from './account';
import config from './config/config';
import contactsService from './account/contacts/service/contacts-service.module';
Expand Down Expand Up @@ -127,6 +128,7 @@ angular
'ovh-angular-responsive-tabs',
'ovh-api-services',
ovhManagerAtInternetConfiguration,
ovhManagerAccountMigration,
ovhManagerIplb,
ovhManagerPccResourceUpgrade,
ovhManagerServerSidebar,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import template from './autorenew-blocked.html';

export default {
bindings: {
goToAutorenew: '<',
gotoContracts: '<',
},
template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<oui-modal
data-heading="{{:: 'autorenew_service_autorenew_blocked_title' | translate }}"
data-primary-action="$ctrl.gotoContracts()"
data-primary-label="{{:: 'autorenew_service_autorenew_blocked_confirm' | translate }}"
data-on-dismiss="$ctrl.goToAutorenew()"
data-type="warning"
>
<p data-translate="autorenew_service_autorenew_blocked_description"></p>
</oui-modal>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import angular from 'angular';
import 'angular-translate';
import atInternet from '@ovh-ux/ng-at-internet';
import '@ovh-ux/ng-translate-async-loader';
import '@ovh-ux/ui-kit';

import component from './autorenew-blocked.component';
import routing from './autorenew-blocked.routing';

const moduleName = 'ovhManagerBillingAutorenewBlocked';

angular
.module(moduleName, [
'ui.router',
'oui',
'ngTranslateAsyncLoader',
'pascalprecht.translate',
atInternet,
])
.config(routing)
.component('billingAutorenewBlocked', component);

export default moduleName;
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state(
'app.account.billing.autorenew.configure-renew-impossible',
{
url: '/configure-renew-impossible',
views: {
modal: {
component: 'billingAutorenewBlocked',
},
},
layout: 'modal',
translations: { value: ['.'], format: 'json' },
resolve: {
gotoContracts: /* @ngInject */ ($state, atInternet) => () => {
atInternet.trackClick({
name:
'dedicated::account::billing::autorenew::configure-renew-impossible::go-to-agreements',
type: 'action',
});
return $state.go('app.account.billing.autorenew.agreements');
},
},
},
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"autorenew_service_autorenew_blocked_title": "Konfigurace obnovení není dostupná",
"autorenew_service_autorenew_blocked_description": "U našich starých smluv již není automatické obnovení možné. Přečtěte si a přijměte nové smlouvy, abyste mohli automaticky obnovovat své produkty.",
"autorenew_service_autorenew_blocked_confirm": "Přečtěte si a přijměte nové VOP"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"autorenew_service_autorenew_blocked_title": "Renewal configuration unavailable",
"autorenew_service_autorenew_blocked_description": "Automatic renewal is no longer available for older contracts. Please read and accept the new contracts in order to renew your products automatically.",
"autorenew_service_autorenew_blocked_confirm": "Read and accept the new General Terms &amp; Conditions"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"autorenew_service_autorenew_blocked_title": "Uusimisen määrittely ei ole saatavilla",
"autorenew_service_autorenew_blocked_description": "Vanhojen sopimustemme automaattinen uusiminen ei ole enää mahdollista. Lue ja hyväksy uudet sopimukset, jotta voit uusia tuotteesi automaattisesti.",
"autorenew_service_autorenew_blocked_confirm": "Lue ja hyväksy uudet yleiset myyntiehdot"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"autorenew_service_autorenew_blocked_title": "Configuration du renouvellement indisponible",
"autorenew_service_autorenew_blocked_description": "Le renouvellement automatique n'est plus possible sur nos anciens contrats. Veuillez lire et accepter les nouveaux contrats pour pouvoir renouveler vos produits automatiquement.",
"autorenew_service_autorenew_blocked_confirm": "Lire et accepter les nouvelles CGV"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"autorenew_service_autorenew_blocked_title": "Atnaujinimo konfigūracija negalima",
"autorenew_service_autorenew_blocked_description": "Pagal senas sutartis automatinis atnaujinimas nebeįmanomas. Perskaitykite ir sutikite su naujomis sutartimis, kad galėtumėte automatiškai atnaujinti savo gaminius.",
"autorenew_service_autorenew_blocked_confirm": "Perskaitykite ir priimkite naujas pardavimo sąlygas"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('app.account.billing.autorenew.update', {
url: '/update?serviceId&serviceType',
component: 'billingAutorenewUpdate',
redirectTo: (transition) =>
transition
.injector()
.getAsync('accountMigrationService')
.then((accountMigrationService) =>
accountMigrationService.getMigrationDates(),
)
.then((migrationDates) => {
if (migrationDates) {
return moment().isBefore(moment(migrationDates.START, 'MM/DD/YYYY'))
? null
: 'app.account.billing.autorenew.configure-renew-impossible';
}
return null;
}),
translations: { value: ['.'], format: 'json' },
resolve: {
addPaymentMean: /* @ngInject */ ($state) => () =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ export default /* @ngInject */ (
) => {
if (coreConfigProvider.isRegion(['EU', 'CA'])) {
$stateProvider.state('app.account.billing.autorenew.agreements.agreement', {
url: '/details/:id',
url: '/details/{id:int}',
template,
controller: 'UserAccount.controllers.agreements.details',
controllerAs: 'ctrl',
resolve: {
agreementId: /* @ngInject */ ($transition$) => $transition$.params().id,
},
});

// ensure compatibility with links sended by emails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import get from 'lodash/get';
angular
.module('UserAccount')
.controller('UserAccount.controllers.agreements.details', [
'$stateParams',
'$q',
'UserAccount.services.agreements',
'UserAccountServicesAgreements',
'Alerter',
'agreementId',
'$translate',
'User',
'GDPR_AGREEMENTS_INFOS',
'AGREEMENT_GENERIC_MORE_INFORMATIONS_URL',
function UserAccountAgreementsDtailsController(
$stateParams,
$q,
Service,
Alerter,
agreementId,
$translate,
User,
GDPR_AGREEMENTS_INFOS,
Expand All @@ -31,8 +31,8 @@ angular
this.alreadyAccepted = false;

$q.all([
Service.getAgreement($stateParams.id),
Service.getContract($stateParams.id),
Service.getAgreement(agreementId),
Service.getContract(agreementId),
User.getUser(),
])
.then(([agreement, contract, user]) => {
Expand Down Expand Up @@ -66,7 +66,10 @@ angular
};

this.accept = () => {
Service.accept($stateParams.id)
Service.accept({
...this.agreement,
...this.contract,
})
.then(() => {
this.accepted = true;
Alerter.success(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import controller from './popup-agreement.controller';
import template from './popup-agreement.html';

export default {
bindings: {
agreements: '<',
goBack: '<',
},
controller,
template,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import get from 'lodash/get';

export default class {
/* @ngInject */
constructor(
$translate,
accountMigrationService,
atInternet,
UserAccountServicesAgreements,
) {
this.$translate = $translate;
this.accountMigrationService = accountMigrationService;
this.atInternet = atInternet;
this.UserAccountServicesAgreements = UserAccountServicesAgreements;
}

$onInit() {
this.currentAgreementIndex = 0;
this.currentAgreement = this.agreements[this.currentAgreementIndex];
this.AgreementUnderProcess = false;
}

acceptAndNext() {
if (this.currentAgreementIndex === this.agreements.length - 1) {
this.atInternet.trackClick({
name:
'dedicated::account::billing::autorenew::agreements::popup-agreement::accept-all',
type: 'action',
});
}
this.AgreementUnderProcess = true;
this.UserAccountServicesAgreements.accept(this.currentAgreement)
.then(() => {
if (this.currentAgreementIndex !== this.agreements.length - 1) {
this.currentAgreementIndex += 1;
this.currentAgreement = this.agreements[this.currentAgreementIndex];
this.AgreementUnderProcess = false;
} else {
this.accountMigrationService.refreshMigrationDetails().then(() => {
this.goBack(false, 'success', true);
});
}
})
.catch((error) =>
this.goBack(
this.$translate.instant('user_agreements_accept_all_error', {
message: get(error, 'data.message'),
}),
'danger',
true,
),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<oui-modal
data-primary-action=":: $ctrl.acceptAndNext()"
data-primary-label="{{ (
($ctrl.currentAgreementIndex === ($ctrl.agreements.length - 1))
? 'user_agreements_accept'
: 'user_agreements_accept_all_accept_and_next'
) | translate }}"
data-primary-disabled="!$ctrl.currentAgreement.accepted"
data-secondary-action=":: $ctrl.goBack(false, 'success', true)"
data-secondary-label="{{:: 'wizard_cancel' | translate }}"
data-loading="$ctrl.AgreementUnderProcess"
data-on-dismiss=":: $ctrl.goBack(false, 'success', true)"
>
<strong
data-ng-bind="'user_agreements_accept_all_count' | translate: {
current: $ctrl.currentAgreementIndex + 1,
total: $ctrl.agreements.length
}"
></strong>
<h3 data-ng-bind=":: $ctrl.currentAgreement.name"></h3>
<oui-textarea
data-name="agreement"
data-model="$ctrl.currentAgreement.text"
data-rows="10"
data-readonly
></oui-textarea>
<div class="oui-checkbox mt-3">
<input
class="oui-checkbox__input"
id="agreement-checkbox"
name="agreement-checkbox"
type="checkbox"
data-ng-model="$ctrl.currentAgreement.accepted"
/>
<label class="oui-checkbox__label-container" for="agreement-checkbox">
<span class="oui-checkbox__label">
<span class="oui-checkbox__icon"></span>
<span
class="oui-checkbox__text"
data-translate="user_agreements_accept_all_read_and_accepted"
data-translate-values="{
contractTitle: $ctrl.currentAgreement.name
}"
></span>
</span>
<span
class="oui-checkbox__description"
data-ng-bind-html="'user_agreements_accept_all_annexes' | translate: { url: $ctrl.currentAgreement.pdfUrl }"
></span>
</label>
</div>
</oui-modal>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import angular from 'angular';
import 'angular-translate';
import atInternet from '@ovh-ux/ng-at-internet';
import '@ovh-ux/ng-translate-async-loader';
import '@ovh-ux/ui-kit';

import component from './popup-agreement.component';
import routing from './popup-agreement.routes';

const moduleName = 'ovhManagerBillingAutorenewActivation';

angular
.module(moduleName, [
'ngTranslateAsyncLoader',
'oui',
'pascalprecht.translate',
'ui.router',
atInternet,
])
.config(routing)
.component('billingAutorenewActivation', component);

export default moduleName;
Loading

0 comments on commit 89e8a3e

Please sign in to comment.