From 380750adbf41f16e381a033046aea11753bd06b5 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 7 May 2024 19:08:11 +0200 Subject: [PATCH] wip #6889 @2 --- .../fluidbook.cart.bastide-resah-guest.js | 51 ++++++++++--------- js/libs/fluidbook/fluidbook.stats.js | 3 -- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/js/libs/fluidbook/cart/fluidbook.cart.bastide-resah-guest.js b/js/libs/fluidbook/cart/fluidbook.cart.bastide-resah-guest.js index 233c0b92..4e270076 100644 --- a/js/libs/fluidbook/cart/fluidbook.cart.bastide-resah-guest.js +++ b/js/libs/fluidbook/cart/fluidbook.cart.bastide-resah-guest.js @@ -33,19 +33,19 @@ FluidbookCartBastideResahGuest.prototype = { $this.login(formData) }); - $(document).on("submit", "#Bastide_forgotpass_form", function(e) { + $(document).on("submit", "#Bastide_forgotpass_form", function (e) { e.preventDefault() let formData = $(this).serialize() $this.forgotpass(formData) }) - $(document).on("submit", "#Bastide_resetpass_form", function(e) { + $(document).on("submit", "#Bastide_resetpass_form", function (e) { e.preventDefault() let formData = $(this).serialize() $this.resetpass(formData) }) - $(document).on("submit", "#Bastide_register_form,#Bastide_forgotpass_form,#Bastide_resetpass_form", function() { + $(document).on("submit", "#Bastide_register_form,#Bastide_forgotpass_form,#Bastide_resetpass_form", function () { let el = $(this).find('button[type="submit"]') $this.disabledSubmitButton(el) }) @@ -77,10 +77,10 @@ FluidbookCartBastideResahGuest.prototype = { updateDataContent: function () { let dataContent = $("#Bastide_auth_form").find('[data-content]').data('content') - $("#Bastide_cart").attr('data-content',dataContent) + $("#Bastide_cart").attr('data-content', dataContent) }, - updateTitle: function(title = "Connexion") { + updateTitle: function (title = "Connexion") { $("#mview-dialog-title").text(title) }, @@ -232,7 +232,7 @@ FluidbookCartBastideResahGuest.prototype = { return form; }, - register: function(d) { + register: function (d) { var $this = this var token = document.cookie.match(new RegExp('(^| )XSRF-TOKEN=([^;]+)')); token = token[0].split('=')[1] @@ -247,31 +247,32 @@ FluidbookCartBastideResahGuest.prototype = { url: '/fluidbook/signin', type: 'POST', data: d, - success: function(data) { - $this.updateTitle('Merci !') - $this.updateCart('register_ok') - $this.updateDataContent() + success: function (data) { + $this.updateTitle('Merci !'); + $this.updateCart('register_ok'); + $this.updateDataContent(); + this.matomoPush(['trackEvent', 'register', 'send', d.email]); }, - error: function(xhr, status, error) { + error: function (xhr, status, error) { let errorsMessage = JSON.parse(xhr.responseText); $this.displayErrors(errorsMessage) }, - complete: function() { + complete: function () { $this.disabledSubmitButton($("button[type=submit]")) } }); }, - login: function(d) { + login: function (d) { var $this = this $.ajax({ url: '/fluidbook/login', type: 'POST', data: d, - success: function(data) { + success: function (data) { window.location.reload() }, - error: function(xhr, status, error) { + error: function (xhr, status, error) { let errorsMessage = JSON.parse(xhr.responseText); $(".errors-container").remove() $(".error").removeClass("error") @@ -280,34 +281,34 @@ FluidbookCartBastideResahGuest.prototype = { }); }, - forgotpass: function(d) { + forgotpass: function (d) { let $this = this $.ajax({ url: '/fluidbook/forgotpassword', type: 'POST', data: d, - success: function(data) { + success: function (data) { $this.updateCart('forgot_pass_notif') $this.updateDataContent() }, - error: function(xhr, status, error) { + error: function (xhr, status, error) { let errorsMessage = JSON.parse(xhr.responseText); $this.displayErrors(errorsMessage) }, - complete: function() { + complete: function () { $this.disabledSubmitButton($("button[type=submit]")) } }) }, - displayErrors: function(errors) { + displayErrors: function (errors) { $(".errors-container").remove() $(".error").removeClass("error") - for(let k in errors['errors']) { - $("[name="+k+"]").parent().append('
') + for (let k in errors['errors']) { + $("[name=" + k + "]").parent().append('
') $(".errors-container").parent().addClass("error") - for(let i in errors['errors'][k]) { - $("[name="+k+"]").parent().find('.errors-container').append(`
${errors['errors'][k][i]}
`) + for (let i in errors['errors'][k]) { + $("[name=" + k + "]").parent().find('.errors-container').append(`
${errors['errors'][k][i]}
`) } } }, @@ -316,7 +317,7 @@ FluidbookCartBastideResahGuest.prototype = { return window.location.hash === '#/cart/validate' ? 990 : 1190; // Validate modal is narrower than main cart }, - disabledSubmitButton: function(el) { + disabledSubmitButton: function (el) { $(el).toggleClass("disabled") } diff --git a/js/libs/fluidbook/fluidbook.stats.js b/js/libs/fluidbook/fluidbook.stats.js index 63479344..422805b9 100644 --- a/js/libs/fluidbook/fluidbook.stats.js +++ b/js/libs/fluidbook/fluidbook.stats.js @@ -371,7 +371,6 @@ FluidbookStats.prototype = { custom_vars.env_work = 'pre-prod'; } - $.each(hashes, function (k, hash) { if ($this.fluidbook.settings.tagcommander_plan[hash]) { setTimeout(function () { @@ -393,8 +392,6 @@ FluidbookStats.prototype = { } }); - - }); }, -- 2.39.5