From 3cd893451aebe8ef26667acfcf59fde33ec79743 Mon Sep 17 00:00:00 2001 From: Jacques Larique Date: Thu, 27 Jul 2023 10:06:09 +0200 Subject: [PATCH] feat(sign-up): consent request management ref: MANAGER-11426 Signed-off-by: Jacques Larique --- packages/manager/apps/sign-up/src/routing.js | 27 +++++++++---------- .../manager/modules/sign-up/src/service.js | 12 ++++----- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/packages/manager/apps/sign-up/src/routing.js b/packages/manager/apps/sign-up/src/routing.js index 11a8db7c28f5..55f9200d445a 100644 --- a/packages/manager/apps/sign-up/src/routing.js +++ b/packages/manager/apps/sign-up/src/routing.js @@ -76,20 +76,19 @@ export const state = { me, signUp, ) => (smsConsent) => - signUp.saveNic(me.model).then(() => { - if (smsConsent) { - signUp.giveSmsConsent(); - } - // for tracking purposes - if ($window.sessionStorage) { - $window.sessionStorage.setItem('ovhSessionSuccess', true); - } - // manage redirection - const redirectUrl = getRedirectLocation(me.nichandle); - if (redirectUrl) { - $window.location.assign(redirectUrl); - } - }), + signUp.saveNic(me.model).then(() => + signUp.sendSmsConsent(smsConsent).then(() => { + // for tracking purposes + if ($window.sessionStorage) { + $window.sessionStorage.setItem('ovhSessionSuccess', true); + } + // manage redirection + const redirectUrl = getRedirectLocation(me.nichandle); + if (redirectUrl) { + $window.location.assign(redirectUrl); + } + }), + ), steps: () => [ { diff --git a/packages/manager/modules/sign-up/src/service.js b/packages/manager/modules/sign-up/src/service.js index 48457c02edd9..60400947c89e 100644 --- a/packages/manager/modules/sign-up/src/service.js +++ b/packages/manager/modules/sign-up/src/service.js @@ -40,14 +40,14 @@ export default class SignUpService { return this.$http.put('/me', nicInfos); } - giveSmsConsent() { + sendSmsConsent(consent = false) { return this.$http.put('/me/marketing', { - denyAll: false, + denyAll: consent !== true, sms: { - events: true, - newProductRecommendation: true, - newsletter: true, - offerAndDiscount: true, + events: consent, + newProductRecommendation: consent, + newsletter: consent, + offerAndDiscount: consent, }, }); }