Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…lfinance into feature/bugfixes-dev
  • Loading branch information
npy11 authored and npy11 committed Oct 15, 2024
2 parents 0c40301 + 119dc0e commit fd0693c
Show file tree
Hide file tree
Showing 20 changed files with 166 additions and 198 deletions.
9 changes: 1 addition & 8 deletions blocks/applyloanform/applyloanform.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { validationJSFunc } from './validation.js';
import AirDatepicker from '../datepickerlib/datepickerlib.js';
import Popper from '../datepickerlib/popper.js';
import { buttonCLick } from './loanformapi.js';
import { fetchAPI } from '../../scripts/scripts.js';
import { CFApiCall, fetchAPI } from '../../scripts/scripts.js';

export default async function decorate(block) {
const cfURL = block.textContent.trim();
Expand All @@ -32,13 +32,6 @@ export default async function decorate(block) {
}
}

export async function CFApiCall(cfurl) {
const response = await fetchAPI('GET', cfurl);
const responseJson = await response.json();
return responseJson;
}


function applyLoanFormJson(data) {
var mainObj = {};

Expand Down
14 changes: 4 additions & 10 deletions blocks/aprcalculator/aprcalculator.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { fetchAPI } from '../../scripts/scripts.js';
import { calculatorFlatStrLogic, CFApiCall, fetchAPI } from '../../scripts/scripts.js';
import { homeLoanCalcFunc } from '../emiandeligiblitycalc/homeloancalculators.js';
import { homeloanCalHTML } from '../homeloancalculatorv2/templatehtmlv2.js';

export default async function decorate(block) {
const cfURL = block.textContent.trim();

const cfRepsonse = await CFApiCall(cfURL);
const repsonseData = cfRepsonse.data[0].data;
const jsonResponseData = JSON.parse(repsonseData);
const cfRepsonse = cfURL && await CFApiCall(cfURL);
const repsonseData = cfRepsonse.data;
const jsonResponseData = calculatorFlatStrLogic(repsonseData);

block.innerHTML = homeloanCalHTML(jsonResponseData);

Expand All @@ -34,12 +34,6 @@ export default async function decorate(block) {
}
}

export async function CFApiCall(cfurl) {
const response = await fetchAPI('GET', cfurl);
const responseJson = await response.json();
return responseJson;
}

function onloadAPRCalc() {
const isAprCalculator = document.querySelector('.homeloancalculator .apr');
if (isAprCalculator) {
Expand Down
9 changes: 2 additions & 7 deletions blocks/authorisedagencies/authorisedagencies.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { fetchAPI, targetObject } from '../../scripts/scripts.js';
import { CFApiCall, fetchAPI, targetObject } from '../../scripts/scripts.js';
import { ctaClickInteraction } from '../../dl.js';

export default async function decorate(block) {
const cfURL = block.textContent.trim();
const cfRepsonse = await fetchApiCall(cfURL);
const cfRepsonse = await CFApiCall(cfURL);
const repsonseData = cfRepsonse.data;
const result = Object.groupBy(repsonseData, ({ Location }) => {
const lowercaseLocation = Location.toLowerCase();
Expand Down Expand Up @@ -158,8 +158,3 @@ export default async function decorate(block) {
// })
};
}
export async function fetchApiCall(cfurl) {
const response = await fetchAPI('GET', cfurl);
const responseJson = await response.json();
return responseJson;
}
7 changes: 1 addition & 6 deletions blocks/branchcarousel/branchcarousel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetchAPI } from '../../scripts/scripts.js';
import { CFApiCall, fetchAPI } from '../../scripts/scripts.js';
import { setLocationObj } from '../moredetailsaddress/moredetailsaddress.js';

export default async function decorate(block) {
Expand All @@ -25,8 +25,3 @@ export default async function decorate(block) {
block.classList.add('dp-none');
}

export async function CFApiCall(linkURL) {
const response = await fetchAPI('GET', linkURL);
const responseJson = await response.json();
return responseJson;
}
8 changes: 1 addition & 7 deletions blocks/branchkeyfeatures/branchkeyfeatures.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetchAPI } from '../../scripts/scripts.js';
import { CFApiCall, fetchAPI } from '../../scripts/scripts.js';
import { featureDropDownClick } from '../keyfeatures/keyfeatures.js';
import { setLocationObj } from '../moredetailsaddress/moredetailsaddress.js';

Expand Down Expand Up @@ -52,9 +52,3 @@ export default async function decorate(block) {

block.classList.add('dp-none');
}

export async function CFApiCall(linkURL) {
const response = await fetchAPI('GET', linkURL);
const responseJson = await response.json();
return responseJson;
}
5 changes: 5 additions & 0 deletions blocks/branchlocator/branchlocator-biz.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ async function getStateCity(lat, lng) {
setLocationObj.geoInfo.city = city.long_name;
setLocationObj.geoInfo.state = region.long_name;
setLocationObj.geoInfo.country = country.long_name;

/* setLocationObj.getExcelData[region.long_name].filter((each) => {
return each['Location'].includes(city.long_name);
}); */

resolve();
} else {
reject('No results found');
Expand Down
8 changes: 1 addition & 7 deletions blocks/branchlocator/branchlocator.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { branchURLStr, fetchAPI } from '../../scripts/scripts.js';
import { branchURLStr, CFApiCall, fetchAPI } from '../../scripts/scripts.js';
import { dropDownStateCity, locateMeClick, onloadBranchLocator } from './branchlocator-biz.js';
import { setLocationObj } from './branchlocator-init.js';

Expand Down Expand Up @@ -93,12 +93,6 @@ export function innerBranchFunc(branchhList) {
return innerBranch;
}

export async function CFApiCall(cfurl) {
const response = await fetchAPI('GET', cfurl);
const responseJson = await response.json();
return responseJson;
}

export default async function decorate(block) {
const props = Array.from(block.children, (row) => row.firstElementChild);

Expand Down
2 changes: 1 addition & 1 deletion blocks/breadcrumb/breadcrumb.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default async function decorate(block) {
'aria-label': 'Breadcrumb',
});

if (multiText && multiUrl) {
if (multiText.innerText?.trim() && multiUrl.innerText?.trim()) {
const breadcrumbsText = [];
const multiUrls = multiUrl.innerText.trim().replace(/~/g, '/').split(',');
multiText.innerText.trim().split(',').forEach((text, index) => {
Expand Down
14 changes: 4 additions & 10 deletions blocks/calculatorsection/calculatorsection.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { fetchAPI } from '../../scripts/scripts.js';
import { calculatorFlatStrLogic, CFApiCall, fetchAPI } from '../../scripts/scripts.js';
import { homeLoanCalcFunc } from '../emiandeligiblitycalc/homeloancalculators.js';
import { renderCalculatorData } from './renderdatafunc.js';
import { homeloanCalHTML } from '../homeloancalculatorv2/templatehtmlv2.js';

export default async function decorate(block) {
const cfURL = block.textContent.trim();

const cfRepsonse = await CFApiCall(cfURL);
const repsonseData = cfRepsonse.data[0].data;
const jsonResponseData = JSON.parse(repsonseData);
const cfRepsonse = cfURL && await CFApiCall(cfURL);
const repsonseData = cfRepsonse.data;
const jsonResponseData = calculatorFlatStrLogic(repsonseData);

block.innerHTML = homeloanCalHTML(jsonResponseData);

Expand Down Expand Up @@ -39,12 +39,6 @@ export default async function decorate(block) {
}
}

export async function CFApiCall(cfurl) {
const response = await fetchAPI('GET', cfurl);
const responseJson = await response.json();
return responseJson;
}

export function readMoreFucn(block) {
document.querySelector('.discalimer-details').classList.remove('dp-none');
if (block.querySelector('.discalimer-calc')) {
Expand Down
4 changes: 2 additions & 2 deletions blocks/code/code.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { decorateIcons } from "../../scripts/aem.js";
import { decoratePlaceholder } from "../../scripts/scripts.js";
import { decodeHtmlSymbols, decoratePlaceholder } from "../../scripts/scripts.js";
import { mobileHeaderAnalytics } from "./code-analytics.js";
import { decorateTable } from "./table.js";
export default async function decorate(block) {
Expand All @@ -9,7 +9,7 @@ export default async function decorate(block) {
decorateTable(block)
return block
}
const titleData = block.children[0]?.querySelector('p')?.innerHTML.trim().replaceAll('&lt;', '<').replaceAll('&gt;', '>') || '';
const titleData = decodeHtmlSymbols(block.children[0]?.querySelector('p')?.innerHTML.trim() || '');
block.innerHTML = '';
if (titleData) {
const titleElement = document.createElement('div');
Expand Down
16 changes: 5 additions & 11 deletions blocks/gstcalculator/gstcalculator.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import { currenyCommaSeperation, fetchAPI } from '../../scripts/scripts.js';
import { calculatorFlatStrLogic, CFApiCall, currenyCommaSeperation, fetchAPI } from '../../scripts/scripts.js';
import { homeLoanCalcFunc } from '../emiandeligiblitycalc/homeloancalculators.js';
import { homeloanCalHTML } from '../homeloancalculatorv2/templatehtmlv2.js';

export default async function decorate(block) {
const cfURL = block.textContent.trim();

const cfRepsonse = await CFApiCall(cfURL);
const repsonseData = cfRepsonse.data[0].data;
const jsonResponseData = JSON.parse(repsonseData);
const cfRepsonse = cfURL && await CFApiCall(cfURL);
const repsonseData = cfRepsonse.data;
const jsonResponseData = calculatorFlatStrLogic(repsonseData);

block.innerHTML = homeloanCalHTML(jsonResponseData);

let elgCalDiv; let
elgOverlay;
let elgCalDiv; let elgOverlay;

try {
elgCalDiv = document.querySelector('.home-page-calculator-call-xf');
Expand All @@ -34,11 +33,6 @@ export default async function decorate(block) {
}
}

export async function CFApiCall(cfurl) {
const response = await fetchAPI('GET', cfurl);
const responseJson = await response.json();
return responseJson;
}

function onloadGSTCalc() {
const isGstCalculator = document.querySelector('.homeloancalculator .gst');
Expand Down
15 changes: 4 additions & 11 deletions blocks/homeloancalculatorv2/homeloancalculatorv2.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ import { firstTabActive } from "./commonfile.js"; */
import { homeloanCalHTML } from './templatehtmlv2.js';
import { homeLoanCalcFunc } from './homeloancalculators.js';
import { calculatorTypeTabClick, mainTabClick, renderEmiEligibility } from './combineemieligibility.js';
import { fetchAPI } from '../../scripts/scripts.js';
import { calculatorFlatStrLogic, CFApiCall, fetchAPI } from '../../scripts/scripts.js';

let calculatorType; let emiCalDiv; let
emiOverlay;
let calculatorType; let emiCalDiv; let emiOverlay;

export default async function decorate(block) {
const cfURL = block.textContent.trim();

const cfRepsonse = cfURL && await CFApiCall(cfURL);
const repsonseData = cfRepsonse && cfRepsonse.data[0].data;
const jsonResponseData = repsonseData && JSON.parse(repsonseData);
const repsonseData = cfRepsonse.data;
const jsonResponseData = calculatorFlatStrLogic(repsonseData);

if (!jsonResponseData) return;

Expand Down Expand Up @@ -63,12 +62,6 @@ export default async function decorate(block) {
}
}

export async function CFApiCall(cfurl) {
// const cfModification = cfurl?.replace("/content/dam/", "/api/assets/");
const response = await fetchAPI('GET', cfurl);
const responseJson = await response.json();
return responseJson;
}

/* export function homeLoancalculatorCallXf() {
document.querySelectorAll("[data-teaserv2-xf='home-page-calculator-call-xf']") &&
Expand Down
12 changes: 6 additions & 6 deletions blocks/homeloancalculatorv2/templatehtmlv2.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function homeloanCalHTML(callJson) {
buttonLink2 = callJson.button2link.replace('DWEB', 'MWEB');
}

const salaried = callJson.salaried?.salariedcheck
const salaried = callJson.salaried?.salariedcheck == 'true'
? `
<li id="salaryTab" class="firsttab onetab">
<div class="customecheck">
Expand All @@ -32,7 +32,7 @@ export function homeloanCalHTML(callJson) {
</li>`
: '';

const business = callJson.business?.businesscheck
const business = callJson.business?.businesscheck == 'true'
? `
<li id="${callJson.business.businesstabid}" class="firsttab secondtab twotab">
<div class="customecheck">
Expand All @@ -59,7 +59,7 @@ export function homeloanCalHTML(callJson) {
: '';

let emiinputdiv = '';
callJson.chechboxemiobj.chechboxemi
callJson.chechboxemiobj.chechboxemi == 'true'
&& callJson.chechboxemiobj.loanamout.forEach((each, index) => {
emiinputdiv += `<div class="loanamount">
<div class="data">
Expand Down Expand Up @@ -89,7 +89,7 @@ export function homeloanCalHTML(callJson) {
});

let eligibilityinputdiv = '';
callJson.chechboxelibilityobj.chechboxemi
callJson.chechboxelibilityobj.chechboxemi == 'true'
&& callJson.chechboxelibilityobj.loanamout.forEach((each, index) => {
eligibilityinputdiv += `<div class="loanamount">
<div class="data">
Expand Down Expand Up @@ -135,7 +135,7 @@ export function homeloanCalHTML(callJson) {
</div>`
: '';

const emidiv = callJson.chechboxemiobj.chechboxemi
const emidiv = callJson.chechboxemiobj.chechboxemi == 'true'
? `
<div class="emicalculator commoncalculator">
<div class="parent-emi" id="emic">
Expand Down Expand Up @@ -167,7 +167,7 @@ export function homeloanCalHTML(callJson) {
</div>`
: '';

const eligibilitydiv = callJson.chechboxelibilityobj.chechboxemi
const eligibilitydiv = callJson.chechboxelibilityobj.chechboxemi == 'true'
? `
<div class="eligibilitycalculator calculator commoncalculator">
<div class="parent-emi parent-eligibility" id="emic">
Expand Down
Loading

0 comments on commit fd0693c

Please sign in to comment.