siteMapPerso

refactor

11/13/2023 8:14:05 PM

Changes

mySiteMap.js 45(+28 -17)

Details

mySiteMap.js 45(+28 -17)

diff --git a/mySiteMap.js b/mySiteMap.js
index 239a752..75b5101 100644
--- a/mySiteMap.js
+++ b/mySiteMap.js
@@ -40,7 +40,19 @@ let homeListeners = [
     { class: `.columnists .items article.item`, labelName: 'Clumnists from Home' },
 ]
 
-let payWallListeners = [`.item .button`, `.item .list_items`, `.otros-planes__item a`, `.footer-footer a`]
+let payWallListeners = [
+    { class: `.page.suscripciones a.logo`, labelName: 'Botón - Header Logo El Cronista from Pay Wall' },
+    { class: `.panel:first-child .suscripcion .items:first-child .item .button`, labelName: 'Botón - Quiero suscribirme:  Promo elecciones' },
+    { class: `.panel:nth-child(2) .suscripcion .items .item:first-child .button`, labelName: 'Botón - Quiero suscribirme: Plan Digital' },
+    { class: `.panel:nth-child(2) .suscripcion .items .item:nth-child(2) .button`, labelName: 'Botón - Quiero suscribirme: Plan Digital anual' },
+    { class: `.panel:nth-child(2) .suscripcion .items .item:nth-child(3) .button`, labelName: 'Botón - Quiero suscribirme: Print Full' },
+    { class: `.panel .suscripcion .items .item .list_items`, labelName: 'Botón - Mostrar detalles de  planes' },
+    { class: "#page-header-session-box .sign-in-button", labelName: 'Botón Ingresar From Pay wall' },
+    { class: `.otros-planes__item a`, labelName: '' },
+    { class: `.page.suscripciones .whatsapp-wrapper`, labelName: 'Botón Whatsapp from Pay Wall' },
+    { class: `.footer-footer a:first-child`, labelName: 'Botón Terminos y condiciones from Pay Wall' },
+    { class: `.footer-footer a:nth-child(2)`, labelName: 'Botón Precios vigentes from Pay Wall' },
+]
 
 let homeInteractions = {
     name: "Home"
@@ -98,18 +110,26 @@ function PageType(name, myUrl, interaction, myEvents) {
         if (url.includes('?') || url.includes('/')) {
             url = url.slice(0, window.location.href.lastIndexOf('?'));
         }
-        console.log(`${enviroment}${myUrl}`)
+        console.log(url)
         isMatch = (url === `${enviroment}${myUrl}` ? true : false);
         console.log(isMatch)
-        if (name == "PayWall") {
-            let limit = new URL(window.location.href).searchParams.get("limit")
-            console.log(limit)
-        }
-
-
         return isMatch;
     };
     this.listeners = GenerateListeners(name, myEvents);
+    if (name == "PayWall") {
+        this.onActionEvent = (actionEvent) => {
+            if (email) {
+                let limit = new URL(window.location.href).searchParams.get("limit")
+                console.log("limit: " + limit)
+                let continueUrl = new URL(window.location.href).searchParams.get("continue")
+                actionEvent.user = actionEvent.user || {};
+                actionEvent.user.attributes = actionEvent.user.attributes || {};
+                actionEvent.user.attributes.typeOfEntry = limit ? "limite de 9 notas" : "choque metered";
+                actionEvent.user.attributes.continueUrl = continueUrl;
+            }
+            return actionEvent;
+        }
+    }
 }
 
 function ReadHomeBlocks(event) {
@@ -123,9 +143,6 @@ function ReadHomeBlocks(event) {
 function sendDataFromHomeBlocks(nameEvent, target, container) {
 
     for (let i = 0; i < container.length; i++) {
-        console.log(nameEvent)
-        console.log(target)
-        console.log(container)
         if (target === container[i]) {
             console.log("cumple")
             SalesforceInteractions.sendEvent({
@@ -171,8 +188,6 @@ function ReadGlobalEvents(event, listeners) {
 
 }
 
-
-
 function GenerateContentZones(zones) {
 
     let ContentZones = [];
@@ -195,17 +210,13 @@ function GenerateListeners(pageType, elements) {
         for (let i = 0; i < elements.length; i++) {
 
             if (pageType == "Home" && (elements[i].class == elements[0].class || elements[i].class == elements[1].class)) {
-                console.log(elements[i].class)
                 let myEventsBlock = SalesforceInteractions.listener("click", elements[i].class, (e) => {
-                    e.preventDefault()
-                    console.log(e)
                     ReadHomeBlocks(e.currentTarget)
                 })
                 listeners.push(myEventsBlock)
             } else {
                 let myEvents = SalesforceInteractions.listener("click", `${elements[i].class}`, (e) => {
                     e.preventDefault()
-                    console.log(elements[i].class)
                     ReadGlobalEvents(e, elements[i])
                     e.stopPropagation();
                 })