can’t responding to the form

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>

    <h3 style="position:absolute;top:15%">
        <i class="fa-face-smile"></i>
        Upload your FeedBack form for us!!
    </h3>
    <div class="form-box">
        <div class="textup">

            It only takes two minutes!!
        </div>
        <br />
        <form name="myForm" onsubmit="return( feedback());">
            <label for="uname">

                Name
            </label>
            <input type="text" id="uname"
                   name="uname" required>

            <label for="email">
                <i class="fa fa-solid fa-envelope"></i>
                Email Address
            </label>
            <input type="email" id="email"
                   name="email" required>

            <label for="phone">
                <i class="fa-solid fa-phone"></i>
                Phone No
            </label>
            <input type="tel" id="phone"
                   name="phone" required>

            <label>
                <i class="fa-solid fa-face-smile"></i>
                Do you satisfy with our service?
            </label>
            <div class="radio-group">
                <input type="radio" id="yes"
                       name="satisfy" value="yes" checked>
                <label for="yes">Yes</label>

                <input type="radio" id="no"
                       name="satisfy" value="no">
                <label for="no">No</label>
            </div>

            <label for="msg">
                <i class="fa-solid fa-comments"
                   style="margin-right: 3px;"></i>
                Write your Suggestions:
            </label>
            <textarea id="msg" name="msg"
                      rows="4" cols="10" required> 
            </textarea>
            <button type="submit">
                Submit
            </button>
        </form>
    </div>
    <div class="logoposition">
        <img src="images/WhatsApp Image 2024-01-27 at 12.37.00_0f8d14e3.jpg" class="logo" />
    </div>


    <style>

        body {
            margin: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            height: 100vh;
            background-color: #bde5d2;
            font-family: 'Poppins', sans-serif;
            background-repeat: no-repeat;
            background-image: url('images/dodgeball-player-painted-vector.jpg');
            padding: 0;
            background-size: cover;
            background-position: center;
        }

        .textup {
            text-align: center;
            color: rgb(11, 118, 11);
            font-weight: 700;
        }

        i {
            margin-right: 3px;
        }




        .form-box {
            background-color: #fff;
            box-shadow: 0 0 10px rgba(36, 67, 40, 0.8);
            padding: 15px;
            border-radius: 8px;
            width: 500px;
            margin: 0 auto; /* Center the form horizontally */
            margin-top: 10%; /* Adjust the top margin as needed */
            opacity: 0.7;
        }


        form {
            max-width: 400px;
            margin: 0 auto;
        }

        .radio-group {
            display: flex;
            margin-bottom: 16px;
        }

        input[type="radio"] {
            margin-left: 8px;
        }

        label {
            display: block;
            margin-bottom: 8px;
            font-size: 17px;
            color: green;
            font-weight: 600;
        }

        input,
        textarea {
            width: 100%;
            padding: 8px;
            margin-bottom: 12px;
            box-sizing: border-box;
            border-radius: 10px;
        }

        button {
            background-color: #368b44;
            color: #fff;
            padding: 10px;
            border: none;
            border-radius: 25px;
            cursor: pointer;
            width: 100%;
            font-size: 15px;
            transition: .2s linear;
            opacity: 1 !important;
        }

            button:hover {
                background-color: #0a6808;
                border: none;
                transform: translateY(-10px);
                opacity: 1 !important;
            }

        .rounded {
            flex: none;
            width: 60px;
            height: 60px;
            border-radius: 50%;
            object-fit: cover;
        }

        .logo {
            object-fit: cover;
            display: block;
            /* Make sure the image fills the container width */

            max-height: 200px;
            min-height: 200px;
            max-width: 200px;
            border-radius: 50%;
            overflow: hidden;
            flex: none;
            width: auto;
        }

        .logoposition {
            right: 20px;
            position: absolute;
            top: 35px;
        }
    </style>

    <script>
        function feedback() {
            //check for empty input
            if (document.forms[0].uname.value == "") {   
                alert("Please fill in your name.");
                document.forms[0].uname.focus();
                return false;
            }

            if (document.forms[0].email.value == "") {

                alert("Please provide your password within 8 to 16 characters.");
                document.forms[0].email.focus();
                return false;
            }

            if (document.forms[0].yes.checked == false)
            if (document.forms[0].no.checked == false) {
                alert("Please select your gender.");
                return false;
            } else if (document.forms[0].yes.checked == true)
            if (document.forms[0].no.checked == true) {
                return false;
            }

            if (document.forms[0].channel.value == "") { 
                alert("Please select from where you hear about us!");
                document.forms[0].channel.focus(); 
                return false;
            }

            alert("submited");
        }
    </script>
</body>
</html>

i cant popup the blockers, i am not sure whether the scripts is respondin. when I didn’t key in the name it shows the blocking from the itself but not the popup blocker. I do check whether there is any class name issue or any general problem but still cant find out what the problem is. I expect that when i not insert any value, the popup blocker should popup

How to Handle the SSO Login in cypress automation and CI intergration

I am trying to build cypress framework for our project but we need to bypass Microsoft Azure SSO enabled Login and also should be able to integrate with CI pipeline. So Please suggest me any workaround for the same.I tried to pass client credentials as by value directly and tried to get token and login in. but It will work only in local machine. we should not hardcode the credentials and also we cant handle this login in CI pipeline. so please suggest me for the same.

Selecting a level in the game is an inverted image at the top

I scroll up 27 levels and there is an inverted image. I need to turn it the other way around. Whatever I did, either the background disappears or is rotated incorrectly.

var rc = function() {
  this.root = (new D).add(new ka);
  this.levelSelectLayer = d.addFillSprite(this.root, 0, 0, 0, d.width, 1920, 1, !1);
  this.levelSelectLayer._compMap.Sprite_0.y.set__(-960);
  this.levelSelectLayer.add(new Pb(!0));
  var a;
  a = d.addImageSprite(this.levelSelectLayer, 0, 960, "game_scene_bg", 1, 1, !1)._compMap.Sprite_0;
  a.setRotation(180);
  a.setScaleXY(-1, 1);
  d.addImageSprite(this.levelSelectLayer, 0, 960, "game_scene_bg", 1, 1, !1);
  d.addFillSprite(this.root, 640, 0, 0, 220, 2 * 960, 1, !1);
  d.addFillSprite(this.root, -220, 0, 0, 220, 2 * 960, 1, !1);

  this.initLevelSelectButton(136, 1820, "1");
  this.initLevelSelectButton(290, 1771, "2");
  this.initLevelSelectButton(427, 1705, "3");
  this.initLevelSelectButton(518, 1579, "4");
  this.initLevelSelectButton(410, 1479, "5");
  this.initLevelSelectButton(272, 1427, "6");
  this.initLevelSelectButton(190, 1301, "7");
  this.initLevelSelectButton(286, 1191, "8");
  this.initLevelSelectButton(436, 1167, "9");
  this.initLevelSelectButton(545, 1071, "10");
  this.initLevelSelectButton(441, 982, "11");
  this.initLevelSelectButton(299, 994, "12");
  this.initLevelSelectButton(175, 970, "13");
  this.initLevelSelectButton(151, 836, "14");
  this.initLevelSelectButton(275, 771, "15");
  this.initLevelSelectButton(410, 772, "16");
  this.initLevelSelectButton(523, 727, "17");
  this.initLevelSelectButton(560, 607, "18");
  this.initLevelSelectButton(495, 502, "19");
  this.initLevelSelectButton(366, 521, "20");
  this.initLevelSelectButton(248, 600, "21");
  this.initLevelSelectButton(124, 565, "22");
  this.initLevelSelectButton(162, 445, "23");
  this.initLevelSelectButton(286, 367, "24");
  this.initLevelSelectButton(410, 315, "25");
  this.initLevelSelectButton(466, 195, "26");
  this.initLevelSelectButton(360, 109, "27");

  d.addButton(this.root, 80, 80, "home_btn", function() {
    d.goToScene((new wa).root)
  });

  MonkeyCreative.playClicked();
};

how to make fast backgroundImages in expo react native

how i can make a fast backgroundImage in react native? i am using expo, i have already make a background image, but have a fadeout and a fadein, this bother me, i want something fast, like just apear the image without this lag, how can i do this?
code:

import React, { useState, useEffect } from 'react';
import { View, ImageBackground, StyleSheet, Modal, TouchableOpacity, Text } from 'react-native';
import { useNavigation } from '@react-navigation/native'
import { Image } from 'expo-image'

const images = [
    require("../../assets/imgs/carrousel/1.jpg"),
    require("../../assets/imgs/carrousel/2.jpg"),
    require("../../assets/imgs/carrousel/3.png"),
    require("../../assets/imgs/carrousel/4.png"),
    ...
];

const Conectar = () => {
    const [index, setIndex] = useState(0);
    const navigation = useNavigation()


    useEffect(() => {
        const interval = setInterval(() => {
            setIndex((prevIndex) => (prevIndex + 1) % images.length);
        }, 3000);

        return () => clearInterval(interval);
    }, []);

    return (
        <View style={styles.container}>
            <ImageBackground source={images[index]} style={styles.backgroundImage}>
            ...
            </ImageBackground>
        </View>
    );
};


export default Conectar;

Simulate keypress with chrome extension

I am creating a Chrome extension to automate some tasks but I need a Chrome extension to do so.

I am currently setting the innerHTML of the textarea but this isn’t triggering the word count, it’s only if I type it triggers the word count

I have tried an array of solutions eg dispatching a keyboard event and using the Chrome extension API.

None of this is working for me.

How to compare if two variables reference the same object in javascript

I am new to JavaScript and getting my hands on the spread operator.
I understand that it will deep copy the top-level elements of an array or object but shallow copy the nested arrays or objects.
I wanted to see it action and hence the code below but was unable to get the required output as per my understanding.

const originalObject = {
  name: 'Alice',
  address: {
    street: '123 Main St',
    city: 'Anytown',
  },
};

const copiedObject = { ...originalObject };

console.log(copiedObject.name === originalObject.name); // Expected Output: false but Outputs: true

originalObject.address.city = 'Newtown';

console.log(copiedObject.address.city); // Output: "Newtown" (modification affects both objects)
console.log(originalObject.address.city);

console.log(copiedObject.address === originalObject.address); // Output: true (Can we understand this means both has a reference to the same object?)

Shouldn’t it give an output as false?
console.log(copiedObject.name === originalObject.name);

Could someone explain in simpler terms how can I visualise it in code and also compare if two properties share the same reference in javascript?

Similar questions on stackoverflow thay I went through but couldn’t find an answer:

  1. How to check if two vars have the same reference?
  2. How to compare two variables in javascript
  3. Compare if two variables reference the same object in javascript

React Native not showing certain images, what can I do?

I’m making a weather app that fetches weather info. It puts them into ForecastItem components and they show the hour, temperature and the image. Some of them randomly don’t show the picture.

Here is the Home screen that maps the forecast into ForecastItem components:

<View style={{ flexDirection: 'row' }}>
  {forecastData.forecast.forecastday[0].hour.map(
    (item, index) => (
      <ForecastItem
        key={index}
        item={item}
        isDay={currentWeatherData.current.is_day}
      />
    )
  )}
</View>

The ForecastItem component is as follows:

import React from 'react';
import { Image, StyleSheet, Text, View } from 'react-native';
import { weatherImages, weatherImagesNight } from '../constants/constants';

export default function ForecastItem({ item, isDay }) {
  return (
    <View style={[styles.forecastItem, {backgroundColor: isDay ? 'white' : 'black'}]}>
      <Text style={styles.text}>{item.time.substring(11, 13)}</Text>
      <Image
        source={
          item.is_day
            ? weatherImages[item.condition.text]
            : weatherImagesNight[item.condition.text]
        }
        style={styles.imgForecast}
      />
      <Text style={styles.text}>{item.temp_c}°C</Text>
    </View>
  );
}

constants.js is storing images’ locations:

const sunny = require('../assets/images/sunny.png');
const clear_night = require('../assets/images/clear_night.png');
const partlycloudy = require('../assets/images/partlycloudy.png');
const partlycloudy_night = require('../assets/images/partlycloudy_night.png');
const cloudy = require('../assets/images/cloudy.png');
...etc...

export const weatherImages = {
  'Sunny': sunny,
  'Clear': sunny,
  'Partly cloudy': partlycloudy,
  ...etc...
}

export const weatherImagesNight = {
  'Sunny': clear_night,
  'Clear': clear_night,
  'Partly cloudy': partlycloudy_night,
  ...etc...
}

The problem is some of them are showing the forecast image just fine and some of them are empty.

This is how it looks like:
image

I tried hardcoding path to the image in ForecastItem’s Image source attribute, for example

<Image source={require('../assets/images/fog.png')} />

Now, all of the forecast items were showing an icon of fog. The interesting part is, when i Ctrl+Z’d to the previous state, the same forecast items that were missing the icon now had that fog icon even though that is not the correct weather. That would mean the image is not even updating and that’s the reason why it’s not showing. I have no idea what else to do to fix it.

Here is a demonstration on Youtube on how it works, I added so that weather in text is shown on each forecast item: Youtube

You can see the weather on Miami is shown wrong the second time I open it in the forecast items that were empty the first time I viewed it.

FastAPI Post Request Not Working, Response variable throwing exception

I have this problem where after initializing the response variable, it is immediately throwing an exception, this is the error it gives me:
app.js:36 Error:
processImages @ app.js:36
await in processImages (async)
onclick @ Demo/:13

I’ve already checked the webapi by debugging and its working fine. It gives an ok.

app.js file:

async function processImages() {
    const fileInput = document.getElementById('fileInput');
    const outputImagesDiv = document.getElementById('outputImages');

    const files = fileInput.files;
    if (files.length === 0) {
        alert('Please select at least one image.');
        return;
    }

    const formData = new FormData();
    for (const file of files) {
        formData.append('files', file);
    }

    try {
        const response = await fetch('http://127.0.0.1:3003/process_images', {
            method: 'POST',
            body: formData,
        });//throws exception directly after this

        if (response.status !== 200) {
            alert('Error processing images.');
            return;
        }

        const result = response.data;
        outputImagesDiv.innerHTML = '';

        for (let i = 0; i < result.imagesWithLandmarks.length; i++) {
            const imgElement = document.createElement('img');
            imgElement.src = `data:image/png;base64,${result.imagesWithLandmarks[i]}`;
            outputImagesDiv.appendChild(imgElement);
        }
    } catch (error) {
        console.error('Error:', error);
        alert('An error occurred while processing images.');
    }
}

main.py(web api)

from fastapi import FastAPI, File, UploadFile
from typing import List
from fastapi.middleware.cors import CORSMiddleware
from DlibActuator import DlibActuator

app = FastAPI()
dlib = DlibActuator()

origins = ["*"]

app.add_middleware(
    CORSMiddleware,
    allow_origins=origins,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

@app.post("/process_images")
async def process_images(files: List[UploadFile] = File(...)):
    image_paths = []
    for file in files:
        with open(f"./uploads/{file.filename}", "wb") as buffer:
            buffer.write(file.file.read())
        image_paths.append(f"./uploads/{file.filename}")

    result = dlib.process_images(image_paths)

    return result.dict()

@app.get("/check_api")
def check_api():
    return {"status": "API is working correctly"}

Im guessing the problem is with how I am receiving the response? Again it throws an exception upon initializing the response variable and the web api is working fine

How to first rotate an image and then translate it in an image slider

I am trying to build an image slider in which when pressing the previous or next button my image slider first rotate 180deg then translate the width of the image to show next/previous image. I can’t get it to work and I think that I may need as a solution an async/await function whicj I am really not very good at right now. Maybe someone can show the way to solve this

<div class="wrapper">
    <div class="slider-container">
        <div class="image-container">
            <img src="https://picsum.photos/id/237/300/200" alt="">
        </div>
        <div class="image-container">
            <img src="https://picsum.photos/seed/picsum/300/200" alt="">
        </div>
        <div class="image-container">
            <img src="https://picsum.photos/300/200?grayscale" alt="">
        </div>
        <div class="image-container">
            <img src="https://picsum.photos/300/200/?blur" alt="">
        </div>
        <div class="image-container">
            <img src="https://picsum.photos/id/870/300/200?grayscale&blur=2" alt="">
        </div>
        <div class="image-container">
            <img src="https://picsum.photos/id/1/300/200" alt="">
        </div>
    </div>
    <div class="btn-container">
        <button class="btn prev">Previous</button>
        <button class="btn next">Next</button>
    </div>
</div>
const container = document.querySelectorAll('.image-container')
const prevBtn = document.querySelector('.prev')
let counter=0

prevBtn.addEventListener('click', moveSlide)

function moveSlide(){
    counter++
    container.forEach((image,index)=>{
        let width = image.getBoundingClientRect().width
        image.style.transform = `rotateY(180deg)`
        setTimeout(()=>{
            image.style.transform = `translate(-${counter*width}px`
        },450)

    })
}
*{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

body{
    display: flex;
    height: 100vh;
    overflow: hidden;
    align-items: center;
    align-content: center;
    justify-content: center;
}
.wrapper{
    display: flex;
    flex-direction: column;
}

.slider-container{
    height: 50vh;
    width: 300px;
    display: flex;
    margin: auto;
    flex-direction: row;
    overflow: hidden;
}

.image-container{
    display: block;
    width: 300px;  
    transition: transform 450ms ease;  
}

.btn-container{
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: row;
    gap: 5px;
}

.btn-container .btn{
    width: 15vw;
    padding: 5px;
}

I tried to write an asynchronus function but could not get it right..

Send JSON Encoded PHP Variable to JavaScript onblur Event

I am trying to dynamically generate a set of input fields on my PHP page when a user pulls focus from a single preexisting input text field. Essentially, I’d like to use onblur to send both the value of this initial field and an array I’ve retrieved from MySQL to a JS function, which will then use that information to determine which input fields are needed and generate them.

I am able to JSON encode the array without any difficulty:

$mysqli_equations = collect_all_formulas();
$equations = array();
while($row = $mysqli_equations->fetch_assoc()) {
    $equations[] = $row;
}

$js_array = json_encode($equations);

If I echo the $js_array string at this point, it looks good to me…

[{“BlackboxEquationId”:”1″,”FindingVariable”:”a”,”Equation”:”a = ( 2.0
/ t ) * ( ( ( xf – xo ) / t ) – vo
)”},{“BlackboxEquationId”:”2″,”FindingVariable”:”a”,”Equation”:”a = (
vf ^2.0 – vo ^2.0 ) / ( 2.0 * ( xf – xo )
)”},{“BlackboxEquationId”:”3″,”FindingVariable”:”a”,”Equation”:”a = (
vf – vo ) / t”}, … ]

But if I try to send it with onblur (note, this is a line within a php echo):

> <input type="text" id="known_variable" name="known_variable"
> onblur="build_known_vars(this.value, ' . $js_array . ')"
> onfocus="remove_vars()" />

I get an unexpected end of input. I believe this is because the first time we hit double quotes, we take this to be the end of the string, but then the input stream just keeps spitting out the rest of the string:

<input type="text" id="known_variable" name="known_variable" onblur="build_known_vars(this.value, [{" BlackboxEquationId":" 1"," FindingVariable":" a", etc etc

I’ve tried and failed at manipulating the data to make it happy, but even replacing all double quotes results in a different unexpected input message, I assume due to the rest of the nonsense characters in the string I’m sending.

Is my best bet here to use JSON.parse prior to sending? If so, where / how would I do this, since I’m attempting to send the string to a JS function directly from the input field? Or am I way off, and there’s another way I should be passing this along altogether?

Very inexperienced, and perhaps I’m approaching this the wrong way altogether, so more than open to advice if that’s the case. There seem to be similar questions already out there, but I’m not finding any that specifically address this situation.

Is it possible to use an undefined html attribute for js/css purposed?

Is it possible to use a non existent HTML attribute in an element so that it can be used for HTMl and JS?
Ex.:
element:

<p id="a" special="3">!</p>

script:

document.getElementById("a").special // 3

What I did:

Element:

<p id="1" special="log">Element</p>
<p id="output></p>

Script:

document.getElementById("output").innerHTML = document.getElementById("1").special

Expected output:
Expected: element | log
Actual output:
Output: element | undefined

Add object properties to html element

Can I add a custom property to an HTMLElement on the dom, and be sure that the browser won’t remove it behind my back until the element is garbage collected? I’m currently doing the following:

const el = document.createElement("div");
el.__my_custom_property = my_obj;
document.body.appendChild(el);

I want to ensure that my_obj lives for at least as long as el, and that it will also be garbage collected some time after el is.


If relevant, in my actual use case I’m using rust wasm, and want to attach an object to the node that will update it’s properties (such as inner text, children, attributes, etc.) via a weak reference (to ensure the node can still be dropped without circular references).

I don’t want to manage the lifetime of that object by myself, because it only needs to live for as long as the element does.

Why can’t I open my PayPal partner referral link in the browser?

I have a script to generate PayPal partner referral URLs for my apps on boarding process. I can successfully generate the link but when I paste the link in my browser nothing loads. I create the link with a valid token so I am not sure where I am going wrong.

This is all done using a sandbox account. code is below.

Generates the url:

const createReferal = async () => {
  const paypalApiUrl =
    'https://api-m.sandbox.paypal.com/v2/customer/partner-referrals';

  const requestBody = {
    operations: [{ operation: 'API_INTEGRATION' }],
    legal_consents: [{ type: 'SHARE_DATA_CONSENT', granted: true }],
    products: ['EXPRESS_CHECKOUT'],
  };

  axios
    .post(paypalApiUrl, requestBody, {
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer {VALID TOKEN GOES HERE}`,
      },
    })
    .then((response) => {
      console.log(response.data);
    })
    .catch((error) => {
      console.log({ error: error.message });
    });
};

This is the data I get returned:

{"name":"AUTHENTICATION_FAILURE","message":"Authentication failed due to invalid authentication credentials or a missing Authorization header.","links":[{"href":"https://developer.paypal.com/docs/api/overview/#error","rel":"information_link"}]}

How would I add an authorization header if I am just trying to redirect the user from the client application. (Using MERN stack)

Node.js -> TypeError: brevo.ApiClient is not a constructor

I am trying to create an auto-emailer that, on sending details like name and email, sends an email to the given email address saying “subscribed.”. It was a task for me but have been stuck here to around 7 hours straight and have tried various aspects.

app.post('/submit', (req, res) => {
    const { name, email, subject , sender , to} = req.body;

    
    let defaultClient = new brevo.ApiClient();
    let apiKey = defaultClient.authentications['api-key'];
    apiKey.apiKey = 'API_KEY';
let apiInstance = new Brevo. TransactionalEmailsApi();
let sendSmtpEmail = new Brevo. SendSmtpEmail();
    sendSmtpEmail.to = [{ email: email, name: name }];
    sendSmtpEmail.templateId = 59;
    sendSmtpEmail.params = { name: name }; 
    sentSmtpEmail.subject = {subject:subject};
    sendSmtpEmail.sender = {sender:sender};
    sendSmtpEmail.to = {to:to};

    
    apiInstance.sendTransacEmail(sendSmtpEmail)
        .then(function (data) {
            console.log('Email sent successfully.');
            res.send('Email sent successfully.');
        })
        .catch(function (error) {
            console.error('Error sending email:', error);
            res.status(500).send('Error sending email.');
        });
});

I used the Brevo API for creating an auto-emailer and got this code from its documentation.

const brevo = require('@getbrevo/brevo');
var defaultClient = brevo.ApiClient.instance;

let apiKey = defaultClient.authentications['api-key'];
apiKey.apiKey = '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';

let apiInstance = new Brevo. TransactionalEmailsApi();
let sendSmtpEmail = new Brevo. SendSmtpEmail();

sendSmtpEmail.subject = "My {{params.subject}}";
sendSmtpEmail.htmlContent = "<html><body><h1>Common: This is my first transactional email {{params.parameter}}</h1></body></html>";
sendSmtpEmail.sender = { "name": "John", "email": "[email protected]" };
sendSmtpEmail.to = [
  { "email": "[email protected]", "name": "sample-name" }
];
sendSmtpEmail.replyTo = { "email": "[email protected]", "name": "sample-name" };
sendSmtpEmail.headers = { "Some-Custom-Name": "unique-id-1234" };
sendSmtpEmail.params = { "parameter": "My param value", "subject": "common subject" };


apiInstance.sendTransacEmail(sendSmtpEmail).then(function (data) {
console.log('API called successfully. Returned data: ' + JSON.stringify(data));
}, function (error) {
  console.error(error);
});

After writing this code in the above format, i am getting errors like

TypeError: brevo.ApiClient is not a constructor
    at E:Projectsemail-app1server.js:25:25
    at Layer.handle [as handle_request] (E:Projectsemail-app1node_modulesexpresslibrouterlayer.js:95:5)
    at next (E:Projectsemail-app1node_modulesexpresslibrouterroute.js:144:13)
    at Route.dispatch (E:Projectsemail-app1node_modulesexpresslibrouterroute.js:114:3)
    at Layer.handle [as handle_request] (E:Projectsemail-app1node_modulesexpresslibrouterlayer.js:95:5)
    at E:Projectsemail-app1node_modulesexpresslibrouterindex.js:284:15
    at Function.process_params (E:Projectsemail-app1node_modulesexpresslibrouterindex.js:346:12)
    at next (E:Projectsemail-app1node_modulesexpresslibrouterindex.js:280:10)
    at E:Projectsemail-app1node_modulesbody-parserlibread.js:137:5
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)

and after changing the line

let defaultClient = new Brevo. ApiClient() to

let defualtClient = brevo.ApiClient.instance
i am getting this error

TypeError: Cannot read properties of undefined (reading 'instance')
    at E:Projectsemail-app1server.js:25:41
    at Layer.handle [as handle_request] (E:Projectsemail-app1node_modulesexpresslibrouterlayer.js:95:5)
    at next (E:Projectsemail-app1node_modulesexpresslibrouterroute.js:144:13)
    at Route.dispatch (E:Projectsemail-app1node_modulesexpresslibrouterroute.js:114:3)
    at Layer.handle [as handle_request] (E:Projectsemail-app1node_modulesexpresslibrouterlayer.js:95:5)
    at E:Projectsemail-app1node_modulesexpresslibrouterindex.js:284:15
    at Function.process_params (E:Projectsemail-app1node_modulesexpresslibrouterindex.js:346:12)
    at next (E:Projectsemail-app1node_modulesexpresslibrouterindex.js:280:10)
    at E:Projectsemail-app1node_modulesbody-parserlibread.js:137:5
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)