1$(document).ready(function () { 2 if ($(".userProfile").length) { 3 var getP=$('.pr_point').text(); 4 getP=getP.replace(/[^0-9\.]/g,''); 5 $(".userProfile .progress").css('width',getP+'%'); 6 $(window).on('scroll', function () { 7 let scroll = $(window).scrollTop(); 8 let oTop = $('.progress-bar').offset().top - window.innerHeight; 9 if (scroll > oTop) { 10 $(".progress-bar").addClass("progressbar-active"); 11 } 12 else { 13 $(".progress-bar").removeClass("progressbar-active"); 14 } 15 }); 16 } 17 18}); 19window.userprofiledetail; 20// $(document).ready(async function () { 21 window.addEventListener("load", async function () { 22 23 //$('.userProfile_part').hide(); 24 // let userId = (sessionStorage.getItem("userId") || "CP04962366").trim(); 25// let mobileNumber = (sessionStorage.getItem("mobileNumber") || "9324667788").trim(); 26 27function getCookie(name) { 28 let cookieArr = document.cookie.split(";"); 29 for (let i = 0; i < cookieArr.length; i++) {
30 let cookie = cookieArr[i].trim(); 31 if (cookie.startsWith(name + "=")) { 32 return cookie.substring(name.length + 1); 33 } 34 } 35 return null; 36} 37 38 39 let mobileNumber = getCookie("mobileNumber"); 40 let userId = sessionStorage.getItem("userId"); 41 // var userId = sessionStorage.getItem("userId"); 42 // var mobileNumber = sessionStorage.getItem("mobileNumber"); 43 44 let status="guest" 45 let loginmethod=""; 46 if (userId) { 47 status="loggedIn"; 48 loginmethod="OTP Method"; 49 } 50 if (!userId) { 51 // console.log("Missing userId or mobileNumber. Removing the div."); 52 document.querySelector(".userProfile")?.remove(); 53 }else{ 54 55 var userapidata = { 56 "category": "USER", 57 "operation": "GET", 58 "userDetails": { 59 "userId":userId,//"CP04962366", // Use sessionStorage value 60 "firstName": "", 61 "middleName": "", 62 "lastName": "", 63 "emailId": "", 64 "mobileNo":mobileNumber,//"9324667788" // Use sessionStorage value 65 "dob": "", 66 "address": "", 67 "gender": "", 68 "nomineeName": "", 69 "kycStatus": "" 70 } 71 }; 72 73 let data = { 74 "userencdata": CryptoService.encrypt(userapidata) 75 }; 76 let profileCompletion = "0";
77 let category = ""; 78 $.ajax({ 79 url: "/bin/api/v2/profilemanagerapi", // The URL to send the request to 80 type: "POST", // Request method 81 contentType: "application/json", 82 data: JSON.stringify(data), // Convert the data to a JSON string 83 success: function (response) { 84 // console.log("Success:", response); // Handle success response 85 let encryptedData = { 86 payload: response.str 87 }; 88 // localStorage.removeItem("userDetails"); 89 response = JSON.parse(CryptoService.decrypt(encryptedData)); 90 window.userprofiledetail=response; 91 // sessionStorage.setItem("userDetails", JSON.stringify(response)); 92 if (response && response.userDetails) { 93 94 95 96 let userDetails = response.userDetails; 97 let nameOfUser = userDetails.firstName + userDetails.middleName + userDetails.lastName 98 document.cookie = "profileName=" + nameOfUser + "; path=/"; 99 document.cookie = "profileFullName=" + ((userDetails.firstName) ? userDetails.firstName + " " : "") + ((userDetails.middleName) ? userDetails.middleName + " " : "") + ((userDetails.lastName) ? userDetails.lastName : ""); 100 // Update Profile Image 101 if (userDetails.profilePicUrl) { 102 $(".userImg img").attr("src", userDetails.profilePicUrl); 103 }else{ 104 $(".userImg img").attr("src","/content/dam/revampbagic/other-images/icons/customer-icon.webp") 105 } 106 107 // Update User Information 108 $(".usernameHeading").text(userDetails.firstName + " " + userDetails.lastName); 109 110 $(".userNum2 .userRating").text(userDetails.userSegment || "0"); 111 category = userDetails.userSegment || "" 112 113 // Update Profile Completion Progress 114 profileCompletion = response.profileWeightage || "0"; 115 $(".userProfiledet.pr_point").text(profileCompletion + "%"); 116 // $(".progress-bar").css("width", parseInt(profileCompletion) + "%").attr("aria-valuenow", parseInt(profileCompletion)).attr("style", `width: ${parseInt(profileCompletion)}%;`); 117 $(".progress").css("width", parseInt(profileCompletion) + "%") 118 119 120 $('.userProfile_part').show(); 121 122 123 124 125 }else{ 126 $('.userProfile_part').hide(); 127 } 128 // var data = { 129 // "status": status, 130 // "id": userId || "", 131 // "loginMethod":loginmethod, 132 // "profileCompletion":profileCompletion ? profileCompletion : "0", 133 // "category":category ? category : "" 134 135 // }; 136 137 // dataLayerEvents.pageLoad(data); 138 }, 139 error: function (xhr, status, error) { 140 console.error("Error:", error); // Handle error response 141 $('.userProfile_part').hide(); 142 var data = { 143 "status": status, 144 "id": userId || "", 145 "loginMethod":loginmethod, 146 "profileCompletion":profileCompletion ? profileCompletion : "0", 147 "category":category ? category : "" 148 149 }; 150 151 dataLayerEvents.pageLoad(data); 152 } 153 }); 154 } 155 156 157}); 158// }; 159 160 161$(document).ready(function () { 162 163 164 $(document).on('click', '.benefitsCta', function () { 165 166 var usernameHeading = $('.usernameHeading').text().trim(); // Get the username heading 167 var $link = $(this).find('a'); // Find the <a> tag inside .benefitsCta 168 var linkName = $link.text().trim(); // Get the button text 169 var linkHref = $link.attr('href'); // Get the href attribute 170 171 var data = { 172 "linkName": linkName, 173 "linkPosition": "User Profile", 174 "linkHref": linkHref, 175 "linkType": "button", 176 "eventPosition": "Customer Dashboard", 177 178 179 "status": "logged In", 180 "id": userId, 181 "loginMethod": "OTP Method", 182 "profileCompletion": $(this).parents().find('.profileCompletion').find('.pr_point').text(), 183 "category": "super prive", 184 185 }; 186 187 dataLayerEvents.linkClicked(data); 188 }); 189 190})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.