Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -15,6 +15,18 @@ export const CATEGORIES_MAP = {
'hosting-performance-4': 'PERFORMANCE',
};

export const OFFERS_MAP = {
'hosting-free-100M': 'Free hosting',
'hosting-starter': 'STARTER',
'hosting-perso': 'PERSO',
'hosting-startup': 'STARTUP',
'hosting-pro': 'PRO',
'hosting-performance-1': 'PERFORMANCE',
'hosting-agence': 'AGENCY',
'hosting-agence-plus': 'AGENCY PLUS',
'hosting-agence-max': 'AGENCY MAX',
};

export const CLOUDWEB_OFFER = ['cloudweb1', 'cloudweb2', 'cloudweb3'];

export const CLOUDWEB_VERSION_MAP = {
Expand Down Expand Up @@ -47,6 +59,18 @@ export const NEW_OFFERS_PLAN_CODES = {
PERFORMANCE_4: 'hosting-performance-4',
};

export const OFFERS_PLAN_CODES = {
FREE_100M: 'hosting-free-100M',
STARTER: 'hosting-starter',
PERSO: 'hosting-perso',
STARTUP: 'hosting-startup',
PRO: 'hosting-pro',
PERFORMANCE_1: 'hosting-performance-1',
AGENCY: 'hosting-agence',
AGENCY_PLUS: 'hosting-agence-plus',
AGENCY_MAX: 'hosting-agence-max',
};

export const WEB_CLOUD_DB_VALUES = '512MB RAM - 8GB';

export default {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
NEW_OFFERS_END_DATE,
BADGES,
NEW_OFFERS_PLAN_CODES,
OFFERS_PLAN_CODES,
CATEGORIES_MAP,
VERSION_MAP,
CLOUDWEB_OFFER,
Expand All @@ -15,10 +16,174 @@ import {

export default class WebComponentsHostingDomainOffersController {
/* @ngInject */
constructor($translate, $filter) {
constructor($translate, $filter, ovhFeatureFlipping) {
this.$translate = $translate;
this.ovhFeatureFlipping = ovhFeatureFlipping;
const bytes = $filter('bytes');

this.OFFERS = {
FREE_100M: {
TECHNICALS: [
{ prefix: 'sites', values: [1] },
{ prefix: 'disk', values: ['100 Mo SSD'] },
{ prefix: 'emailStorage', values: [1, '5 Go'] },
],
SELECTORS: {
FREE_100M: {
planCode: OFFERS_PLAN_CODES.FREE_100M,
},
},
},
STARTER: {
TECHNICALS: [
{ prefix: 'sites', values: [1] },
{ prefix: 'nddFree', values: [1] },
{ prefix: 'emailStorage', values: [2, '5 Go'] },
{ prefix: 'disk', values: ['1 Go SSD'] },
{ prefix: 'cms', values: [] },
],
SELECTORS: {
STARTER: {
planCode: OFFERS_PLAN_CODES.STARTER,
},
},
},
PERSO: {
TECHNICALS: [
{ prefix: 'sites', values: [5] },
{ prefix: 'nddFree', values: [1] },
{ prefix: 'emailStorage', values: [10, '5 Go'] },
{ prefix: 'disk', values: ['100 Go SSD'] },
{ prefix: 'cms', values: [] },
],
SELECTORS: {
PERSO: {
planCode: OFFERS_PLAN_CODES.PERSO,
},
},
},
STARTUP: {
TECHNICALS: [
{ prefix: 'vcores', values: ['< 1'] },
{ prefix: 'ram', values: ['< 1 Go'] },
{ prefix: 'backupIncluded', values: [] },
{ prefix: 'uptime', values: ['99,9%'] },
{ prefix: 'disk', values: ['100 Go SSD'] },
{ prefix: 'sites', values: [5] },
{ prefix: 'emailStorage', values: [10, '5 Go'] },
{ prefix: 'dbs', values: [5, '1 Go'] },
{ prefix: 'nddFree', values: [1] },
],
SELECTORS: {
STARTUP: {
planCode: OFFERS_PLAN_CODES.STARTUP,
},
},
},
PRO: {
TECHNICALS: [
{ prefix: 'vcores', values: [1] },
{ prefix: 'ram', values: ['2 Go'] },
{ prefix: 'backupIncluded', values: [] },
{ prefix: 'uptime', values: ['99,9%'] },
{ prefix: 'disk', values: ['250 Go SSD'] },
{ prefix: 'sites', values: [100] },
{ prefix: 'emailStorage', values: [100, '5 Go'] },
{ prefix: 'dbs', values: [10, '2 Go'] },
{ prefix: 'nddFree', values: [1] },
{ prefix: 'cdn', values: [] },
],
SELECTORS: {
PRO: {
planCode: OFFERS_PLAN_CODES.PRO,
},
},
},
PERFORMANCE: {
TECHNICALS: [
{ prefix: 'vcores', values: [2] },
{ prefix: 'ram', values: ['4 Go'] },
{ prefix: 'backupIncluded', values: [] },
{ prefix: 'uptime', values: ['99,9%'] },
{ prefix: 'disk', values: ['500 Go'] },
{ prefix: 'sites', values: [150] },
{ prefix: 'emailStorage', values: [1000, '5 Go'] },
{ prefix: 'dbs', values: [20, '2 Go'] },
{ prefix: 'webcloudDb', values: [] },
{ prefix: 'nddFree', values: [1] },
{ prefix: 'cdn', values: [] },
],
SELECTORS: {
PERFORMANCE_1: {
planCode: OFFERS_PLAN_CODES.PERFORMANCE_1,
},
},
},
AGENCE: {
TECHNICALS: [
{ prefix: 'sites', values: [200] },
{ prefix: 'disk', values: ['500 Go SSD'] },
{ prefix: 'ram', values: ['8 Go'] },
{ prefix: 'vcores', values: [6] },
{ prefix: 'backupIncluded', values: [] },
{ prefix: 'uptime', values: ['99,9%'] },
{ prefix: 'userManagement', values: [] },
{ prefix: 'emailStorage', values: [1000, '5 Go'] },
{ prefix: 'dbs', values: [30, '2 Go'] },
{ prefix: 'webcloudDb', values: [] },
{ prefix: 'cdn', values: [] },
{ prefix: 'git', values: [] },
],
SELECTORS: {
AGENCE: {
planCode: OFFERS_PLAN_CODES.AGENCY,
},
},
},
AGENCE_PLUS: {
TECHNICALS: [
{ prefix: 'sites', values: [500] },
{ prefix: 'disk', values: ['700 Go SSD'] },
{ prefix: 'ram', values: ['12 Go'] },
{ prefix: 'vcores', values: [10] },
{ prefix: 'backupIncluded', values: [] },
{ prefix: 'uptime', values: ['99,9%'] },
{ prefix: 'userManagement', values: [] },
{ prefix: 'emailStorage', values: [1000, '5 Go'] },
{ prefix: 'dbs', values: [40, '2 Go'] },
{ prefix: 'webcloudDb', values: [] },
{ prefix: 'cdn', values: [] },
{ prefix: 'git', values: [] },
],
SELECTORS: {
AGENCE_PLUS: {
planCode: OFFERS_PLAN_CODES.AGENCY_PLUS,
},
},
},
AGENCE_MAX: {
TECHNICALS: [
{ prefix: 'sites', values: [3000] },
{ prefix: 'disk', values: ['1 To SSD'] },
{ prefix: 'ram', values: ['16 Go'] },
{ prefix: 'vcores', values: [14] },
{ prefix: 'backupIncluded', values: [] },
{ prefix: 'uptime', values: ['99,9%'] },
{ prefix: 'userManagement', values: [] },
{ prefix: 'emailStorage', values: [1000, '5 Go'] },
{ prefix: 'dbs', values: [50, '2 Go'] },
{ prefix: 'webcloudDb', values: [] },
{ prefix: 'cdn', values: [] },
{ prefix: 'git', values: [] },
],
SELECTORS: {
AGENCE_MAX: {
planCode: OFFERS_PLAN_CODES.AGENCY_MAX,
},
},
},
};

this.NEW_OFFERS = {
PERSO: {
TECHNICALS: [
Expand Down Expand Up @@ -89,7 +254,19 @@ export default class WebComponentsHostingDomainOffersController {
}

$onInit() {
this.groupedOffers = this.buildOffersGroup();
return this.ovhFeatureFlipping
.checkFeatureAvailability(['web-hosting:change-offer'])
.then((featureAvailability) => {
this.useNewOffers = featureAvailability.isFeatureAvailable(
'web-hosting:change-offer',
);
})
.catch(() => {
this.useNewOffers = false;
})
.finally(() => {
this.groupedOffers = this.buildOffersGroup();
});
}

static buildBadgeModel(type, className) {
Expand Down Expand Up @@ -193,7 +370,8 @@ export default class WebComponentsHostingDomainOffersController {
}

getNewOffer(offerCategory) {
return this.NEW_OFFERS[offerCategory.toUpperCase()];
const offers = this.useNewOffers ? this.OFFERS : this.NEW_OFFERS;
return offers[offerCategory.toUpperCase()];
}

getOfferTechnicalsInfo(offerCategory) {
Expand All @@ -202,10 +380,13 @@ export default class WebComponentsHostingDomainOffersController {
let serviceDatas = values[1];
if (prefix === 'services' && !serviceDatas)
serviceDatas = WEB_CLOUD_DB_VALUES;
return this.$translate.instant(
`web_components_hosting_domain_offers_offer_${offerCategory}_technicals_${prefix}`,
{ value1: values[0], value2: serviceDatas },
);
const key = this.useNewOffers
? `web_components_hosting_domain_offers_${prefix}`
: `web_components_hosting_domain_offers_offer_${offerCategory}_technicals_${prefix}`;
return this.$translate.instant(key, {
value1: values[0],
value2: serviceDatas,
});
},
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,19 @@
"web_components_hosting_domain_offers_offer_badge_current": "Offre actuelle",
"web_components_hosting_domain_offers_offer_select_version_placeholder": "Choisir une version",
"web_components_hosting_domain_offers_offer_select_version_performance": "{{coreNumber}} vCores, {{ramSize}} RAM",
"web_components_hosting_domain_offers_offer_price": "{{priceValue}} HT/mois"
"web_components_hosting_domain_offers_offer_price": "{{priceValue}} HT/mois",
"web_components_hosting_domain_offers_sites": "{{value1}} Sites",
"web_components_hosting_domain_offers_disk": "{{value1}}",
"web_components_hosting_domain_offers_emailStorage": "{{value1}} mails {{value2}}",
"web_components_hosting_domain_offers_cms": "CMS 1clic",
"web_components_hosting_domain_offers_nddFree": "{{value1}} ndd free",
"web_components_hosting_domain_offers_vcores": "{{value1}} vCore",
"web_components_hosting_domain_offers_ram": "{{value1}} de RAM",
"web_components_hosting_domain_offers_backupIncluded": "Backup inclus",
"web_components_hosting_domain_offers_uptime": "Uptime {{value1}}",
"web_components_hosting_domain_offers_dbs": "{{value1}} db {{value2}}",
"web_components_hosting_domain_offers_webcloudDb": "WebCloud DB",
"web_components_hosting_domain_offers_cdn": "CDN",
"web_components_hosting_domain_offers_git": "GIT",
"web_components_hosting_domain_offers_userManagement": "Gestion user"
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,30 +165,50 @@ export default /* @ngInject */ ($stateProvider) => {
workflowOptions: /* @ngInject */ (
catalog,
cdnProperties,
serviceInfo,
serviceName,
trackClick,
) => ({
catalog,
catalogItemTypeName: workflowConstants.CATALOG_ITEM_TYPE_NAMES.ADDON,
onPricingSubmit: (pricing) => {
trackClick({
...ORDER_CDN_TRACKING.PRICING.NEXT,
name: ORDER_CDN_TRACKING.PRICING.NEXT.name.replace(
/{{pricing}}/g,
`${pricing.interval}M`,
),
});
},
onValidateSubmit() {
const newPlanCode = this.getPlanCode();

trackClick('web::hosting::cdn::order::confirm');
trackClick(`web_hosting_cdn_order::order::${newPlanCode}`);
},
productName: HOSTING_PRODUCT_NAME,
serviceNameToAddProduct: serviceName,
expressOrder: true,
}),
) => {
const renewPeriod = serviceInfo?.renew?.period;
const filteredCatalog =
renewPeriod != null
? {
...catalog,
addons: (catalog.addons || []).map((addon) => ({
...addon,
pricings: (addon.pricings || []).filter(
(p) =>
!(p.capacities || []).includes(
pricingConstants.PRICING_CAPACITIES.RENEW,
) || p.interval === renewPeriod,
),
})),
}
: catalog;

return {
catalog: filteredCatalog,
catalogItemTypeName: workflowConstants.CATALOG_ITEM_TYPE_NAMES.ADDON,
onPricingSubmit: (pricing) => {
trackClick({
...ORDER_CDN_TRACKING.PRICING.NEXT,
name: ORDER_CDN_TRACKING.PRICING.NEXT.name.replace(
/{{pricing}}/g,
`${pricing.interval}M`,
),
});
},
onValidateSubmit() {
const newPlanCode = this.getPlanCode();

trackClick('web::hosting::cdn::order::confirm');
trackClick(`web_hosting_cdn_order::order::${newPlanCode}`);
},
productName: HOSTING_PRODUCT_NAME,
serviceNameToAddProduct: serviceName,
expressOrder: true,
};
},
trackClick: /* @ngInject */ (atInternet) => (hit) => {
atInternet.trackClick({
...hit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export default class {
user,
userStatisticsLink,
userLogsLink,
isChangeOfferFeatureAvailable,
isWebsiteFeatureAvailable,
isOslToLdpFeatureAvailable,
HOSTING_STATUS,
Expand Down Expand Up @@ -140,6 +141,7 @@ export default class {
this.user = user;
this.userStatisticsLink = userStatisticsLink;
this.userLogsLink = userLogsLink;
this.isChangeOfferFeatureAvailable = isChangeOfferFeatureAvailable;
this.isOslToLdpFeatureAvailable = isOslToLdpFeatureAvailable;
this.DOMAIN_ORDER_URL = DOMAIN_ORDER_URL;
this.HOSTING_ORDER_URL = HOSTING_ORDER_URL;
Expand Down
Loading
Loading