]> _ Git - fluidbook-html5.git/commitdiff
wip #6889 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 7 May 2024 17:08:11 +0000 (19:08 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 7 May 2024 17:08:11 +0000 (19:08 +0200)
js/libs/fluidbook/cart/fluidbook.cart.bastide-resah-guest.js
js/libs/fluidbook/fluidbook.stats.js

index 233c0b926d554aa109c6a8cae59c5a1a41e26e35..4e270076cff269e5c3ab20db910ed17a2c81b613 100644 (file)
@@ -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('<div class="errors-container"></div>')
+        for (let k in errors['errors']) {
+            $("[name=" + k + "]").parent().append('<div class="errors-container"></div>')
             $(".errors-container").parent().addClass("error")
-            for(let i in errors['errors'][k]) {
-                $("[name="+k+"]").parent().find('.errors-container').append(`<div>${errors['errors'][k][i]}</div>`)
+            for (let i in errors['errors'][k]) {
+                $("[name=" + k + "]").parent().find('.errors-container').append(`<div>${errors['errors'][k][i]}</div>`)
             }
         }
     },
@@ -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")
     }
 
index 6347934459d4a5f2c64af93e2813145055cf3401..422805b95f22136b788ec9277b188db9b2112e32 100644 (file)
@@ -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 = {
 
                 }
             });
-
-
         });
     },