cms-plugin-bigcommerce-c556b84476d7.herokuapp.com Open in urlscan Pro
23.22.130.173  Public Scan

URL: https://cms-plugin-bigcommerce-c556b84476d7.herokuapp.com/javascripts/main.js?version=U2FsdGVkX1/mHYwWy3+3y3Ytzn0rVpXCm3IXa70BDl4=
Submission: On August 02 via api from TR — Scanned from CA

Form analysis 0 forms found in the DOM

Text Content

document.addEventListener('DOMContentLoaded', function () {
    /*********************getting version from script*******************************/
    const scriptElements = document.querySelectorAll('script');
    let version;
    let app_url;

    // Loop through each script element
    scriptElements.forEach(function (scriptElement) {
        // Check if the script element's source URL contains the 'version' parameter
        const scriptPathMatch = scriptElement.src.match(/([\s\S]+)\/javascripts\/main\.js\?version=([^&]+)/);

        if (scriptPathMatch && scriptPathMatch[1] && scriptPathMatch[2]) {
            try {
                app_url = scriptPathMatch[1];
                // Decode the base64-encoded version using atob
                version = scriptPathMatch[2];
            } catch (error) {
                console.error('Error decoding version:', error);
            }
        }
    });

    if (version) {
        // Create a data object to send in the request body
        const requestData = {
            s_ssh: version
        };
        // Create a new XMLHttpRequest object
        const xhr = new XMLHttpRequest();
        xhr.open('POST', `${app_url}/upload-settings`, true);//add requested link from injected file with same endpoint
        xhr.setRequestHeader('Content-Type', 'application/json');
        xhr.onload = function () {
            if (xhr.status === 200) {
                const response = JSON.parse(xhr.responseText);
                const btnColor = response.settings && response.settings.btnColor ? response.settings.btnColor : '#146ff8';
                const btnSize = response.settings && response.settings.btnSize ? response.settings.btnSize : '45px';
                const footerColor = response.settings && response.settings.footerColor ? response.settings.footerColor : '';
                const horizontalPosition = response.settings && response.settings.horizontalPosition ? response.settings.horizontalPosition : 'left';
                const hideMob = response.settings && response.settings.mobileVisibility ? response.settings.mobileVisibility : false;
                const hideTrigger = response.settings && response.settings.hideStatus ? response.settings.hideStatus : false;
                const language = response.settings && response.settings.language ? response.settings.language : 'en';
                const triggerRadius = response.settings && response.settings.buttonShape ? response.settings.buttonShape : '20';
                const leadColor = response.settings && response.settings.leadColor ? response.settings.leadColor : '#146FF8';
                const position = response.settings && response.settings.interfacePosition ? response.settings.interfacePosition : 'left';
                const triggerIcon = response.settings && response.settings.svgValue ? response.settings.svgValue : 'public';
                const statementLink = response.settings && response.settings.statementLink ? response.settings.statementLink : '';
                const verticalPosition = response.settings && response.settings.verticalPosition ? response.settings.verticalPosition : 'bottom';
                const triggerOffsetX = response.settings && response.settings.tHorizonOff ? response.settings.tHorizonOff : '10';
                const triggerOffsetY = response.settings && response.settings.tVerticalOff ? response.settings.tVerticalOff : '10';
                const mobileTriggerSize = response.settings && response.settings.mobSize ? response.settings.mobSize : '';
                const mobtriggerPositionOffX = response.settings && response.settings.mobHorizonOff ? response.settings.mobHorizonOff : '';
                const mobtriggerOffsetY = response.settings && response.settings.mobVerticalOff ? response.settings.mobVerticalOff : '';
                const mobtriggerPositionX = response.settings && response.settings.mobHorizon ? response.settings.mobHorizon : '';
                const mobtriggerPositionY = response.settings && response.settings.mobVertical ? response.settings.mobVertical : '';
                const mobtriggerRadius = response.settings && response.settings.mobShape ? response.settings.mobShape : '';

                //Check the widget settings are enable or not
                if (response.settings.checkStatus === true) {
                    (function () {
                        const s = document.createElement('script');
                        const h = document.querySelector('head') || document.body;
                        s.src = 'https://acsbapp.com/apps/app/dist/js/app.js';//add acessibie source link here
                        s.async = true;
                        s.onload = function () {
                            const data = {
                                statementLink: `${statementLink}`,
                                footerHtml: `${footerColor}`,
                                hideMobile: hideMob,
                                hideTrigger: hideTrigger,
                                disableBgProcess: false,
                                language: `${language}`,
                                position: `${position}`,
                                leadColor: `${leadColor}`,
                                triggerColor: `${btnColor}`,
                                triggerRadius: `${triggerRadius}`,
                                triggerPositionX: `${horizontalPosition}`,
                                triggerPositionY: `${verticalPosition}`,
                                triggerIcon: `${triggerIcon}`,
                                triggerSize: `${btnSize}`,
                                triggerOffsetX: triggerOffsetX,
                                triggerOffsetY: triggerOffsetY,
                                mobile: {
                                    triggerSize: `${mobileTriggerSize}`,
                                    triggerPositionX: `${mobtriggerPositionX}`,
                                    triggerPositionY: `${mobtriggerPositionY}`,
                                    triggerOffsetX: mobtriggerPositionOffX,
                                    triggerOffsetY: mobtriggerOffsetY,
                                    triggerRadius: `${mobtriggerRadius}`,
                                },
                            };
                            console.log("=======acsb settings=======");
                            console.log(data);
                            console.log("=======acsb settings=======");
                            acsbJS.init(data);
                        };
                        h.appendChild(s);
                    })();
                } else {
                    console.log('Status false plesse enable widget.');
                }
            } else {
                console.error('Request failed with status:', xhr.status);
            }
        };

        // Send the data as JSON in the request body
        xhr.send(JSON.stringify(requestData));
    } else {
        console.error('Value for "s_ssh" not found in localStorage');
    }

});