Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar edqCountry_1 =..

Decoded Output download

<?  
Object.defineProperty(exports, \"__esModule\", { value: true });
var edqCountry_1 = __webpack_require__(/*! ./edqCountry */ \"../src/utils/edqCountry.ts\");
var edq_utils_1 = __webpack_require__(/*! ./edq-utils */ \"../src/utils/edq-utils.ts\");
var sfra_1 = __webpack_require__(/*! ../sfra */ \"../src/sfra.ts\");
/**
 * Global Intuitive
 * Sets the configuration to use Global Intuitive
 *
 *@param vDefaultCountry - Contains the default country value provided by the store configuration
 *@param edqAuthorizationToken - Contains the Global Intuitive authorization token for the Email Validate API
 *@param edqDataSetCode - Contains the code for the dataset to be used
 *@param edqCountryElement - Contains the selector of the country input
 *@param edqAddressLine1Element - Contains the selector of the address line 1 input
 *@param edqAddressLine2Element - Contains the selector of the address line 2 input
 *@param edqCityLineElement - Contains the selector of the city line input
 *@param edqStateLineElement - Contains the selector of the state line input
 *@param edqPostalLineElement - Contains the selector of the postal code input
 */
function edqSetGlobalIntuitiveConfiguration(_a) {
    var vDefaultCountry = _a.vDefaultCountry, edqAuthorizationToken = _a.edqAuthorizationToken, edqDataSetUsage = _a.edqDataSetUsage, edqDataSetCode = _a.edqDataSetCode, edqCountryElement = _a.edqCountryElement, edqAddressLine1Element = _a.edqAddressLine1Element, edqAddressLine2Element = _a.edqAddressLine2Element, edqCityLineElement = _a.edqCityLineElement, edqStateLineElement = _a.edqStateLineElement, edqPostalLineElement = _a.edqPostalLineElement;
    var globalIntuitiveIsoCountry = vDefaultCountry;
    if (window.sfccConfig.edqCountryElement != null) {
        globalIntuitiveIsoCountry = window.sfccConfig.edqCountryElement.value;
    }
    window.EdqConfig.GLOBAL_INTUITIVE_AUTH_TOKEN = edqAuthorizationToken;
    window.EdqConfig.GLOBAL_INTUITIVE_ISO3_COUNTRY = edqCountry_1.countryAlpha3({ \"incomingCountryIso2\": globalIntuitiveIsoCountry, \"vDefaultCountry\": vDefaultCountry });
    /**
     * Configuration option to include Data Sets for Global Intuitive.
     * For more information refer to feature #118583.
     */
    if (edqDataSetUsage) {
        window.EdqConfig.GLOBAL_INTUITIVE_DATASET = edqDataSetCode;
    }
    window.EdqConfig.GLOBAL_INTUITIVE_ELEMENT = window.sfccConfig.edqAddressLine1Element;
    window.EdqConfig.GLOBAL_INTUITIVE_USE_CURRENT_LOCATION = window.sfccConfig.edqGlobalIntuitiveUseCurrentLocation;
    window.EdqConfig.GLOBAL_INTUITIVE_MAPPING = [
        {
            field: window.sfccConfig.edqAddressLine1Element,
            elements: [\"address.addressLine1\"]
        },
        {
            field: window.sfccConfig.edqAddressLine2Element,
            elements: [\"address.addressLine2\"]
        },
        {
            field: window.sfccConfig.edqCityLineElement,
            elements: [\"address.locality\"]
        },
        {
            field: window.sfccConfig.edqStateLineElement,
            elements: [\"address.province\"]
        },
        {
            field: window.sfccConfig.edqPostalLineElement,
            elements: [\"address.postalCode\"]
        },
    ];
}
exports.edqSetGlobalIntuitiveConfiguration = edqSetGlobalIntuitiveConfiguration;
/**
 * Will check if the country has a value when Global Intuitive has being used and set the Country value if this null.
 *
 *@param edqCountryElement - Contains the selector of the country input
 *@param edqAddressLine1Element - Contains the selector of the address line 1 input
 */
function setCountryField(event, _a) {
    var edqCountryElement = _a.edqCountryElement, edqAddressLine1Element = _a.edqAddressLine1Element;
    setTimeout(function () {
        if (edqCountryElement !== null && edqCountryElement.value === \"\" && edqAddressLine1Element.hasAttribute(\"edq-metadata\")) {
            edqCountryElement.value = edqCountry_1.countryAlpha2({ \"incomingCountryIso3\": window.EdqConfig.GLOBAL_INTUITIVE_ISO3_COUNTRY })[\"key\"];
        }
    }, 5000);
}
exports.setCountryField = setCountryField;
/**
 * Browser autofill triggers Global Intuitive Suggestion box and proceed to the billing stage the suggestion address box doesn't dissapear.
 * For more information see Bug #142988
 *
 * @param edqGlobalIntuitiveSuggestionsSelector - Contains the selector \".edq-global-intuitive-address-suggestions\"
 */
function removeGlobalIntuitiveSuggestionBox(_a) {
    var edqGlobalIntuitiveSuggestionsSelector = _a.edqGlobalIntuitiveSuggestionsSelector;
    if ((edqGlobalIntuitiveSuggestionsSelector)
        && (edqGlobalIntuitiveSuggestionsSelector.style.display == \"block\")) {
        var edqGlobalIntuitiveSuggestionBox = edqGlobalIntuitiveSuggestionsSelector;
        edqGlobalIntuitiveSuggestionBox.style.display = \"none\";
    }
}
exports.removeGlobalIntuitiveSuggestionBox = removeGlobalIntuitiveSuggestionBox;
/**
 * In SFRA the checkout web page contains both billing and shipping in a single page controlled by JavaScript to hide/show elements.
 * The setCheckoutFormEvents is intended to set all input address fields variables depending on the stage we are(billing/shipping);
 * the selectors choose by this function just appear once the stage is completed; once we click on the selector the other will
 * be going to the stage that we're selecting and the will continue the regular workflow.
 *
 * @param edqCountryElement - Contains the selector of the country input
 * @param reloadGIjs - Contains the value to reload Global Intuitive
 * @param edqGlobalIntuitiveUnicornJsPath - Contains the Global Intuitive url
 * @param edqGlobalIntuitiveIntegrityKey - Contains the Global Intuitive integrity key
 */
function setCheckoutFormEvents(_a) {
    var reloadGIjs = _a.reloadGIjs, edqGlobalIntuitiveUnicornJsPath = _a.edqGlobalIntuitiveUnicornJsPath, edqGlobalIntuitiveIntegrityKey = _a.edqGlobalIntuitiveIntegrityKey, vDefaultCountry = _a.vDefaultCountry, edqAuthorizationToken = _a.edqAuthorizationToken, edqDataSetUsage = _a.edqDataSetUsage, edqDataSetCode = _a.edqDataSetCode, edqCountryElement = _a.edqCountryElement, edqAddressLine1Element = _a.edqAddressLine1Element, edqAddressLine2Element = _a.edqAddressLine2Element, edqCityLineElement = _a.edqCityLineElement, edqStateLineElement = _a.edqStateLineElement, edqPostalLineElement = _a.edqPostalLineElement;
    if (edqCountryElement != null) {
        if (edqCountryElement.value === \"\") {
            edqCountryElement.value = \"US\";
        }
    }
    /**
     * Autofill after selecting a suggested address is broken.
     * By doing this we can refresh the configuration for Global Intuitive in Checkout stage; we can toogle between
     * shipping and billing address elements; since the webpage doesn't reload, all elements are controlled by js and css;
     * the listeners are set to refresh the configuration for Global Intuitive.
     * For more information see Bug #125898.
     */
    var setEventsForRegistration = function () {
        setEventsForListeners({ \"checkoutStage\": \"\",
            \"vDefaultCountry\": vDefaultCountry,
            \"edqAuthorizationToken\": edqAuthorizationToken,
            \"edqDataSetUsage\": edqDataSetUsage,
            \"edqDataSetCode\": edqDataSetCode,
            \"edqCountryElement\": edqCountryElement,
            \"edqAddressLine1Element\": edqAddressLine1Element,
            \"edqAddressLine2Element\": edqAddressLine2Element,
            \"edqCityLineElement\": edqCityLineElement,
            \"edqStateLineElement\": edqStateLineElement,
            \"edqPostalLineElement\": edqPostalLineElement });
    };
    var setEventsForBilling = function () {
        setEventsForListeners({ \"checkoutStage\": \"billing\",
            \"vDefaultCountry\": vDefaultCountry,
            \"edqAuthorizationToken\": edqAuthorizationToken,
            \"edqDataSetUsage\": edqDataSetUsage,
            \"edqDataSetCode\": edqDataSetCode,
            \"edqCountryElement\": edqCountryElement,
            \"edqAddressLine1Element\": edqAddressLine1Element,
            \"edqAddressLine2Element\": edqAddressLine2Element,
            \"edqCityLineElement\": edqCityLineElement,
            \"edqStateLineElement\": edqStateLineElement,
            \"edqPostalLineElement\": edqPostalLineElement });
        if (reloadGIjs) {
            /** Autofill not working on billing address at all
             * By doing this in the checkout stage for SFRA we can remove the global-intuitive-unicorn.js in order to force to reload all the content with
             * the new parameters that we're including, since the webpage doesn't do a refresh items we're not changing values
             * For more information see Bug #126164 */
            $(\"script[src=\\"\" + window.sfccConfig.edqGlobalIntuitiveUnicornJsPath + \"\\"]\").remove();
            $(\"<script>\").attr({
                src: window.sfccConfig.edqGlobalIntuitiveUnicornJsPath,
                integrity: edqGlobalIntuitiveIntegrityKey,
                crossorigin: \"anonymous\"
            }).appendTo(\"body\");
            reloadGIjs = false;
        }
    };
    var setEventsForShipping = function (e) {
        setEventsForListeners({ \"checkoutStage\": \"shipping\",
            \"vDefaultCountry\": vDefaultCountry,
            \"edqAuthorizationToken\": edqAuthorizationToken,
            \"edqDataSetUsage\": edqDataSetUsage,
            \"edqDataSetCode\": edqDataSetCode,
            \"edqCountryElement\": edqCountryElement,
            \"edqAddressLine1Element\": edqAddressLine1Element,
            \"edqAddressLine2Element\": edqAddressLine2Element,
            \"edqCityLineElement\": edqCityLineElement,
            \"edqStateLineElement\": edqStateLineElement,
            \"edqPostalLineElement\": edqPostalLineElement });
    };
    edq_utils_1.addEventOnElement({ \"selector\": \"#country\", \"event\": \"change\", \"fn\": setEventsForRegistration });
    edq_utils_1.addEventOnElement({ \"selector\": \"[name=dwfrm_shipping_shippingAddress_addressFields_country]\", \"event\": \"change\", \"fn\": setEventsForShipping });
    edq_utils_1.addEventOnElement({ \"selector\": \"[name=dwfrm_billing_addressFields_country]\", \"event\": \"change\", \"fn\": setEventsForBilling });
    edq_utils_1.addEventOnElement({ \"selector\": \"#editShipping\", \"event\": \"click\", \"fn\": setEventsForShipping });
    edq_utils_1.addEventOnElement({ \"selector\": \"[name=edqShippingAddAddress]\", \"event\": \"click\", \"fn\": setEventsForShipping });
    edq_utils_1.addEventOnElement({ \"selector\": \"[name=edqShippingEditAddress]\", \"event\": \"click\", \"fn\": setEventsForShipping });
    edq_utils_1.addEventOnElement({ \"selector\": \".address-selector-block\", \"event\": \"click\", \"fn\": setEventsForBilling });
    edq_utils_1.addEventOnElement({ \"selector\": \"#dwfrm_billing\", \"event\": \"click\", \"fn\": setEventsForBilling });
    edq_utils_1.addEventOnElement({ \"selector\": \"[value=submit-shipping]\", \"event\": \"click\", \"fn\": removeGlobalIntuitiveSuggestionBox });
}
exports.setCheckoutFormEvents = setCheckoutFormEvents;
/**
 * Set the events for the checkout stage; if shipping stage is selected this function will set the events
 * for shipping and when the stage changes to billing the function will set the events for the billing stage.
 *
 * @param checkoutStage - Contains the stage(shipping/billing) for the checkout page in SFRA
 */
function setEventsForListeners(_a) {
    var checkoutStage = _a.checkoutStage, vDefaultCountry = _a.vDefaultCountry, edqAuthorizationToken = _a.edqAuthorizationToken, edqDataSetUsage = _a.edqDataSetUsage, edqDataSetCode = _a.edqDataSetCode, edqCountryElement = _a.edqCountryElement, edqAddressLine1Element = _a.edqAddressLine1Element, edqAddressLine2Element = _a.edqAddressLine2Element, edqCityLineElement = _a.edqCityLineElement, edqStateLineElement = _a.edqStateLineElement, edqPostalLineElement = _a.edqPostalLineElement;
    sfra_1.setEdqInputSelectors({ \"stageContentLocation\": checkoutStage });
    edqSetGlobalIntuitiveConfiguration({ vDefaultCountry: vDefaultCountry, edqAuthorizationToken: edqAuthorizationToken, edqDataSetUsage: edqDataSetUsage, edqDataSetCode: edqDataSetCode, edqCountryElement: edqCountryElement, edqAddressLine1Element: edqAddressLine1Element, edqAddressLine2Element: edqAddressLine2Element, edqCityLineElement: edqCityLineElement, edqStateLineElement: edqStateLineElement, edqPostalLineElement: edqPostalLineElement }); /* fn() */
    edq_utils_1.addEventOnElement({ \"selector\": \"[name=\" + edqAddressLine1Element.name + \"]\", \"event\": \"keypress\", \"fn\": function (e) { setCountryField(e, { \"edqCountryElement\": edqCountryElement, \"edqAddressLine1Element\": edqAddressLine1Element }); } });
    edq_utils_1.addEventOnElement({ \"selector\": \"[name=\" + edqAddressLine1Element.name + \"]\", \"event\": \"mouseleave\", \"fn\": function (e) { setCountryField(e, { \"edqCountryElement\": edqCountryElement, \"edqAddressLine1Element\": edqAddressLine1Element }); } });
    edq_utils_1.addEventOnElement({ \"selector\": \"[name=\" + edqAddressLine1Element.name + \"]\", \"event\": \"mouseenter\", \"fn\": function (e) { setCountryField(e, { \"edqCountryElement\": edqCountryElement, \"edqAddressLine1Element\": edqAddressLine1Element }); } });
}
exports.setEventsForListeners = setEventsForListeners;
/**
 * Global Intuitive creating multiple elements of suggestion box
 * By doing this we remove all edq-verification-suggestion-box that are created; except the one we're using.
 * For more information see Bug #108100
 *
 * @param edqSuggestionBox - Contains the selector \"#edq-verification-suggestion-box\"
 */
function removeMultipleEDQSuggestion(_a) {
    var edqSuggestionBox = _a.edqSuggestionBox;
    for (var i = 0; i < edqSuggestionBox.length; i++) {
        edqSuggestionBox[i].parentNode.removeChild(edqSuggestionBox[i]);
    }
}
exports.removeMultipleEDQSuggestion = removeMultipleEDQSuggestion;


//# sourceURL=webpack://EdqDemandware.sfra/../src/utils/edqGlobalIntuitive.ts? ?>

Did this file decode correctly?

Original Code

\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nvar edqCountry_1 = __webpack_require__(/*! ./edqCountry */ \"../src/utils/edqCountry.ts\");\r\nvar edq_utils_1 = __webpack_require__(/*! ./edq-utils */ \"../src/utils/edq-utils.ts\");\r\nvar sfra_1 = __webpack_require__(/*! ../sfra */ \"../src/sfra.ts\");\r\n/**\r\n * Global Intuitive\r\n * Sets the configuration to use Global Intuitive\r\n *\r\n *@param vDefaultCountry - Contains the default country value provided by the store configuration\r\n *@param edqAuthorizationToken - Contains the Global Intuitive authorization token for the Email Validate API\r\n *@param edqDataSetCode - Contains the code for the dataset to be used\r\n *@param edqCountryElement - Contains the selector of the country input\r\n *@param edqAddressLine1Element - Contains the selector of the address line 1 input\r\n *@param edqAddressLine2Element - Contains the selector of the address line 2 input\r\n *@param edqCityLineElement - Contains the selector of the city line input\r\n *@param edqStateLineElement - Contains the selector of the state line input\r\n *@param edqPostalLineElement - Contains the selector of the postal code input\r\n */\r\nfunction edqSetGlobalIntuitiveConfiguration(_a) {\r\n    var vDefaultCountry = _a.vDefaultCountry, edqAuthorizationToken = _a.edqAuthorizationToken, edqDataSetUsage = _a.edqDataSetUsage, edqDataSetCode = _a.edqDataSetCode, edqCountryElement = _a.edqCountryElement, edqAddressLine1Element = _a.edqAddressLine1Element, edqAddressLine2Element = _a.edqAddressLine2Element, edqCityLineElement = _a.edqCityLineElement, edqStateLineElement = _a.edqStateLineElement, edqPostalLineElement = _a.edqPostalLineElement;\r\n    var globalIntuitiveIsoCountry = vDefaultCountry;\r\n    if (window.sfccConfig.edqCountryElement != null) {\r\n        globalIntuitiveIsoCountry = window.sfccConfig.edqCountryElement.value;\r\n    }\r\n    window.EdqConfig.GLOBAL_INTUITIVE_AUTH_TOKEN = edqAuthorizationToken;\r\n    window.EdqConfig.GLOBAL_INTUITIVE_ISO3_COUNTRY = edqCountry_1.countryAlpha3({ \"incomingCountryIso2\": globalIntuitiveIsoCountry, \"vDefaultCountry\": vDefaultCountry });\r\n    /**\r\n     * Configuration option to include Data Sets for Global Intuitive.\r\n     * For more information refer to feature #118583.\r\n     */\r\n    if (edqDataSetUsage) {\r\n        window.EdqConfig.GLOBAL_INTUITIVE_DATASET = edqDataSetCode;\r\n    }\r\n    window.EdqConfig.GLOBAL_INTUITIVE_ELEMENT = window.sfccConfig.edqAddressLine1Element;\r\n    window.EdqConfig.GLOBAL_INTUITIVE_USE_CURRENT_LOCATION = window.sfccConfig.edqGlobalIntuitiveUseCurrentLocation;\r\n    window.EdqConfig.GLOBAL_INTUITIVE_MAPPING = [\r\n        {\r\n            field: window.sfccConfig.edqAddressLine1Element,\r\n            elements: [\"address.addressLine1\"]\r\n        },\r\n        {\r\n            field: window.sfccConfig.edqAddressLine2Element,\r\n            elements: [\"address.addressLine2\"]\r\n        },\r\n        {\r\n            field: window.sfccConfig.edqCityLineElement,\r\n            elements: [\"address.locality\"]\r\n        },\r\n        {\r\n            field: window.sfccConfig.edqStateLineElement,\r\n            elements: [\"address.province\"]\r\n        },\r\n        {\r\n            field: window.sfccConfig.edqPostalLineElement,\r\n            elements: [\"address.postalCode\"]\r\n        },\r\n    ];\r\n}\r\nexports.edqSetGlobalIntuitiveConfiguration = edqSetGlobalIntuitiveConfiguration;\r\n/**\r\n * Will check if the country has a value when Global Intuitive has being used and set the Country value if this null.\r\n *\r\n *@param edqCountryElement - Contains the selector of the country input\r\n *@param edqAddressLine1Element - Contains the selector of the address line 1 input\r\n */\r\nfunction setCountryField(event, _a) {\r\n    var edqCountryElement = _a.edqCountryElement, edqAddressLine1Element = _a.edqAddressLine1Element;\r\n    setTimeout(function () {\r\n        if (edqCountryElement !== null && edqCountryElement.value === \"\" && edqAddressLine1Element.hasAttribute(\"edq-metadata\")) {\r\n            edqCountryElement.value = edqCountry_1.countryAlpha2({ \"incomingCountryIso3\": window.EdqConfig.GLOBAL_INTUITIVE_ISO3_COUNTRY })[\"key\"];\r\n        }\r\n    }, 5000);\r\n}\r\nexports.setCountryField = setCountryField;\r\n/**\r\n * Browser autofill triggers Global Intuitive Suggestion box and proceed to the billing stage the suggestion address box doesn't dissapear.\r\n * For more information see Bug #142988\r\n *\r\n * @param edqGlobalIntuitiveSuggestionsSelector - Contains the selector \".edq-global-intuitive-address-suggestions\"\r\n */\r\nfunction removeGlobalIntuitiveSuggestionBox(_a) {\r\n    var edqGlobalIntuitiveSuggestionsSelector = _a.edqGlobalIntuitiveSuggestionsSelector;\r\n    if ((edqGlobalIntuitiveSuggestionsSelector)\r\n        && (edqGlobalIntuitiveSuggestionsSelector.style.display == \"block\")) {\r\n        var edqGlobalIntuitiveSuggestionBox = edqGlobalIntuitiveSuggestionsSelector;\r\n        edqGlobalIntuitiveSuggestionBox.style.display = \"none\";\r\n    }\r\n}\r\nexports.removeGlobalIntuitiveSuggestionBox = removeGlobalIntuitiveSuggestionBox;\r\n/**\r\n * In SFRA the checkout web page contains both billing and shipping in a single page controlled by JavaScript to hide/show elements.\r\n * The setCheckoutFormEvents is intended to set all input address fields variables depending on the stage we are(billing/shipping);\r\n * the selectors choose by this function just appear once the stage is completed; once we click on the selector the other will\r\n * be going to the stage that we're selecting and the will continue the regular workflow.\r\n *\r\n * @param edqCountryElement - Contains the selector of the country input\r\n * @param reloadGIjs - Contains the value to reload Global Intuitive\r\n * @param edqGlobalIntuitiveUnicornJsPath - Contains the Global Intuitive url\r\n * @param edqGlobalIntuitiveIntegrityKey - Contains the Global Intuitive integrity key\r\n */\r\nfunction setCheckoutFormEvents(_a) {\r\n    var reloadGIjs = _a.reloadGIjs, edqGlobalIntuitiveUnicornJsPath = _a.edqGlobalIntuitiveUnicornJsPath, edqGlobalIntuitiveIntegrityKey = _a.edqGlobalIntuitiveIntegrityKey, vDefaultCountry = _a.vDefaultCountry, edqAuthorizationToken = _a.edqAuthorizationToken, edqDataSetUsage = _a.edqDataSetUsage, edqDataSetCode = _a.edqDataSetCode, edqCountryElement = _a.edqCountryElement, edqAddressLine1Element = _a.edqAddressLine1Element, edqAddressLine2Element = _a.edqAddressLine2Element, edqCityLineElement = _a.edqCityLineElement, edqStateLineElement = _a.edqStateLineElement, edqPostalLineElement = _a.edqPostalLineElement;\r\n    if (edqCountryElement != null) {\r\n        if (edqCountryElement.value === \"\") {\r\n            edqCountryElement.value = \"US\";\r\n        }\r\n    }\r\n    /**\r\n     * Autofill after selecting a suggested address is broken.\r\n     * By doing this we can refresh the configuration for Global Intuitive in Checkout stage; we can toogle between\r\n     * shipping and billing address elements; since the webpage doesn't reload, all elements are controlled by js and css;\r\n     * the listeners are set to refresh the configuration for Global Intuitive.\r\n     * For more information see Bug #125898.\r\n     */\r\n    var setEventsForRegistration = function () {\r\n        setEventsForListeners({ \"checkoutStage\": \"\",\r\n            \"vDefaultCountry\": vDefaultCountry,\r\n            \"edqAuthorizationToken\": edqAuthorizationToken,\r\n            \"edqDataSetUsage\": edqDataSetUsage,\r\n            \"edqDataSetCode\": edqDataSetCode,\r\n            \"edqCountryElement\": edqCountryElement,\r\n            \"edqAddressLine1Element\": edqAddressLine1Element,\r\n            \"edqAddressLine2Element\": edqAddressLine2Element,\r\n            \"edqCityLineElement\": edqCityLineElement,\r\n            \"edqStateLineElement\": edqStateLineElement,\r\n            \"edqPostalLineElement\": edqPostalLineElement });\r\n    };\r\n    var setEventsForBilling = function () {\r\n        setEventsForListeners({ \"checkoutStage\": \"billing\",\r\n            \"vDefaultCountry\": vDefaultCountry,\r\n            \"edqAuthorizationToken\": edqAuthorizationToken,\r\n            \"edqDataSetUsage\": edqDataSetUsage,\r\n            \"edqDataSetCode\": edqDataSetCode,\r\n            \"edqCountryElement\": edqCountryElement,\r\n            \"edqAddressLine1Element\": edqAddressLine1Element,\r\n            \"edqAddressLine2Element\": edqAddressLine2Element,\r\n            \"edqCityLineElement\": edqCityLineElement,\r\n            \"edqStateLineElement\": edqStateLineElement,\r\n            \"edqPostalLineElement\": edqPostalLineElement });\r\n        if (reloadGIjs) {\r\n            /** Autofill not working on billing address at all\r\n             * By doing this in the checkout stage for SFRA we can remove the global-intuitive-unicorn.js in order to force to reload all the content with\r\n             * the new parameters that we're including, since the webpage doesn't do a refresh items we're not changing values\r\n             * For more information see Bug #126164 */\r\n            $(\"script[src=\\\"\" + window.sfccConfig.edqGlobalIntuitiveUnicornJsPath + \"\\\"]\").remove();\r\n            $(\"<script>\").attr({\r\n                src: window.sfccConfig.edqGlobalIntuitiveUnicornJsPath,\r\n                integrity: edqGlobalIntuitiveIntegrityKey,\r\n                crossorigin: \"anonymous\"\r\n            }).appendTo(\"body\");\r\n            reloadGIjs = false;\r\n        }\r\n    };\r\n    var setEventsForShipping = function (e) {\r\n        setEventsForListeners({ \"checkoutStage\": \"shipping\",\r\n            \"vDefaultCountry\": vDefaultCountry,\r\n            \"edqAuthorizationToken\": edqAuthorizationToken,\r\n            \"edqDataSetUsage\": edqDataSetUsage,\r\n            \"edqDataSetCode\": edqDataSetCode,\r\n            \"edqCountryElement\": edqCountryElement,\r\n            \"edqAddressLine1Element\": edqAddressLine1Element,\r\n            \"edqAddressLine2Element\": edqAddressLine2Element,\r\n            \"edqCityLineElement\": edqCityLineElement,\r\n            \"edqStateLineElement\": edqStateLineElement,\r\n            \"edqPostalLineElement\": edqPostalLineElement });\r\n    };\r\n    edq_utils_1.addEventOnElement({ \"selector\": \"#country\", \"event\": \"change\", \"fn\": setEventsForRegistration });\r\n    edq_utils_1.addEventOnElement({ \"selector\": \"[name=dwfrm_shipping_shippingAddress_addressFields_country]\", \"event\": \"change\", \"fn\": setEventsForShipping });\r\n    edq_utils_1.addEventOnElement({ \"selector\": \"[name=dwfrm_billing_addressFields_country]\", \"event\": \"change\", \"fn\": setEventsForBilling });\r\n    edq_utils_1.addEventOnElement({ \"selector\": \"#editShipping\", \"event\": \"click\", \"fn\": setEventsForShipping });\r\n    edq_utils_1.addEventOnElement({ \"selector\": \"[name=edqShippingAddAddress]\", \"event\": \"click\", \"fn\": setEventsForShipping });\r\n    edq_utils_1.addEventOnElement({ \"selector\": \"[name=edqShippingEditAddress]\", \"event\": \"click\", \"fn\": setEventsForShipping });\r\n    edq_utils_1.addEventOnElement({ \"selector\": \".address-selector-block\", \"event\": \"click\", \"fn\": setEventsForBilling });\r\n    edq_utils_1.addEventOnElement({ \"selector\": \"#dwfrm_billing\", \"event\": \"click\", \"fn\": setEventsForBilling });\r\n    edq_utils_1.addEventOnElement({ \"selector\": \"[value=submit-shipping]\", \"event\": \"click\", \"fn\": removeGlobalIntuitiveSuggestionBox });\r\n}\r\nexports.setCheckoutFormEvents = setCheckoutFormEvents;\r\n/**\r\n * Set the events for the checkout stage; if shipping stage is selected this function will set the events\r\n * for shipping and when the stage changes to billing the function will set the events for the billing stage.\r\n *\r\n * @param checkoutStage - Contains the stage(shipping/billing) for the checkout page in SFRA\r\n */\r\nfunction setEventsForListeners(_a) {\r\n    var checkoutStage = _a.checkoutStage, vDefaultCountry = _a.vDefaultCountry, edqAuthorizationToken = _a.edqAuthorizationToken, edqDataSetUsage = _a.edqDataSetUsage, edqDataSetCode = _a.edqDataSetCode, edqCountryElement = _a.edqCountryElement, edqAddressLine1Element = _a.edqAddressLine1Element, edqAddressLine2Element = _a.edqAddressLine2Element, edqCityLineElement = _a.edqCityLineElement, edqStateLineElement = _a.edqStateLineElement, edqPostalLineElement = _a.edqPostalLineElement;\r\n    sfra_1.setEdqInputSelectors({ \"stageContentLocation\": checkoutStage });\r\n    edqSetGlobalIntuitiveConfiguration({ vDefaultCountry: vDefaultCountry, edqAuthorizationToken: edqAuthorizationToken, edqDataSetUsage: edqDataSetUsage, edqDataSetCode: edqDataSetCode, edqCountryElement: edqCountryElement, edqAddressLine1Element: edqAddressLine1Element, edqAddressLine2Element: edqAddressLine2Element, edqCityLineElement: edqCityLineElement, edqStateLineElement: edqStateLineElement, edqPostalLineElement: edqPostalLineElement }); /* fn() */\r\n    edq_utils_1.addEventOnElement({ \"selector\": \"[name=\" + edqAddressLine1Element.name + \"]\", \"event\": \"keypress\", \"fn\": function (e) { setCountryField(e, { \"edqCountryElement\": edqCountryElement, \"edqAddressLine1Element\": edqAddressLine1Element }); } });\r\n    edq_utils_1.addEventOnElement({ \"selector\": \"[name=\" + edqAddressLine1Element.name + \"]\", \"event\": \"mouseleave\", \"fn\": function (e) { setCountryField(e, { \"edqCountryElement\": edqCountryElement, \"edqAddressLine1Element\": edqAddressLine1Element }); } });\r\n    edq_utils_1.addEventOnElement({ \"selector\": \"[name=\" + edqAddressLine1Element.name + \"]\", \"event\": \"mouseenter\", \"fn\": function (e) { setCountryField(e, { \"edqCountryElement\": edqCountryElement, \"edqAddressLine1Element\": edqAddressLine1Element }); } });\r\n}\r\nexports.setEventsForListeners = setEventsForListeners;\r\n/**\r\n * Global Intuitive creating multiple elements of suggestion box\r\n * By doing this we remove all edq-verification-suggestion-box that are created; except the one we're using.\r\n * For more information see Bug #108100\r\n *\r\n * @param edqSuggestionBox - Contains the selector \"#edq-verification-suggestion-box\"\r\n */\r\nfunction removeMultipleEDQSuggestion(_a) {\r\n    var edqSuggestionBox = _a.edqSuggestionBox;\r\n    for (var i = 0; i < edqSuggestionBox.length; i++) {\r\n        edqSuggestionBox[i].parentNode.removeChild(edqSuggestionBox[i]);\r\n    }\r\n}\r\nexports.removeMultipleEDQSuggestion = removeMultipleEDQSuggestion;\r\n\n\n//# sourceURL=webpack://EdqDemandware.sfra/../src/utils/edqGlobalIntuitive.ts?

Function Calls

None

Variables

None

Stats

MD5 dd964685236c227e7fa771953146a8c3
Eval Count 0
Decode Time 55 ms