PageSourceSearch

https://www.aderma.fr/assets/build/dfp/ad/crm-form.a18daf83.js

js aderma.fr collected 2026-09-26 08:46:13 UTC 8,573 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[328],{9546:(e,t,r)=>{r.r(t),r.d(t,{default:()=>y});var i=r(6070),n=r(8909),a=r(5968);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var i,n,a,o,s=[],c=!0,l=!1;try{if(a=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(i=a.call(r)).done)&&(s.push(i.value),s.length!==t);c=!0);}catch(e){l=!0,n=e}finally{try{if(!c&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(l)throw n}}return s}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function m(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,d(i.key),i)}}function d(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=o(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}var h="checkbox",p="multiple",f="list",y=function(){return e=function e(t){var r;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.element=t,this.form=this.element.querySelector("form"),this.mainContainer=this.element.querySelector('[data-crm-form-element="main"]'),this.successMsg=this.element.querySelector('[data-crm-form-element="success-msg"]'),this.errorMsg=this.element.querySelector('[data-crm-form-element="error-msg"]'),this.caracteristicField=this.element.querySelector(".characteristic"),this.needtypologiesCharacteristicField=this.element.querySelector(".needtypologies_characteristic"),this.formValidator=null,this.reCaptchaKey=window.landing_page_crm.recaptchaKey,this.actionUrl=this.form.dataset.urlEmbasement,this.crmOptionsUrl=null===(r=this.form.querySelector('[data-crm-form-element="crm-options-field"]'))||void 0===r?void 0:r.dataset.urlGetCrmOptions,this.formValues={},this.submitForm=this.submitForm.bind(this),this.updateCaracteristicField=this.updateCaracteristicField.bind(this),this.updateTypologyField=this.updateTypologyField.bind(this),this.initForm(),this.bindEvents()},t=[{key:"bindEvents",value:function(){this.formValidator.form.onSuccess(this.submitForm),this.caracteristicField&&this.caracteristicField.addEventListener("change",this.updateCaracteristicField),this.needtypologiesCharacteristicField&&this.needtypologiesCharacteristicField.addEventListener("change",this.updateTypologyField)}},{key:"initForm",value:function(){this.formValidator=new i.default(this.form,{submitForm:!1})}},{key:"submitForm",value:function(){var e=this;if(document.querySelector(".grecaptcha-badge")){var t=document.querySelector(".error-reCaptcha");t&&t.classList.add(n.FY),grecaptcha.ready((function(){grecaptcha.execute(window.landing_page_crm.recaptchaKey).then((function(){e.sendForm()})).catch((function(){t.show()}))}))}else this.sendForm()}},{key:"sendForm",value:function(){var e=this;(0,n.ro)(!0),this.prepareData(),fetch(this.actionUrl,{method:"POST",headers:{"X-Requested-With":"XMLHttpRequest","Content-Type":"application/json"},body:JSON.stringify(this.formValues)}).then((function(e){return e.json()})).then((function(t){t&&"200"===t.code&&(e.successMsg.classList.remove(n.FY),e.mainContainer.classList.add(n.FY),(0,a.pushTrackingData)({event:"sign_up",type:"newsletter"}),setTimeout((function(){window.scrollTo(0,0),(0,n.ro)(!1)}),50))})).catch((function(){e.errorMsg.classList.remove(n.FY),(0,n.ro)(!1)}))}},{key:"prepareData",value:function(){this.setFormParams("sourceId",'[type="email"]');var e=this.getLandingPageId();e&&(this.formValues.landingPageContentId=e),this.setFormParams("acceptNewsletter",'input[id$="_accept_newsletter"]',h),this.setFormParams("firstName",'input[id$="_first_name"]'),this.setFormParams("lastName",'input[id$="_last_name"]'),this.setFormParams("personBirthdate",'input[id$="_birthdate"]'),this.setFormParams("personMobilePhone",'inputinput[id$="_mobile_phone"]'),this.setFormParams("childName",'input[id$="_childName"]',p),this.setFormParams("childBirthdate",'input[id$="_childBirthdate"]',p),this.setFormParams("data-selection-code",".crm_characteristics",f),this.setFormParams("needTypologies_characteristic",'select[id$="_characteristic"]'),this.setFormParams("needTypologies",'select[id$="_needTypologies"]');var t=c(this.form.querySelectorAll('select[id$="_characteristic"]')).pop();t&&(this.formValues.problematicTypes_characteristic=t.multiple?Array.from(t.selectedOptions).map((function(e){return e.value})):t.value),this.setFormParams("problematicTypes",'select[id$="_problematicTypes"]'),this.setFormParams("acceptBrandSubProgramNewsletter",'input[name$="acceptBrandSubProgramNewsletter"]',h),this.setFormParams("acceptSegmentationFamily",'input[name$="acceptSegmentationFamily"]',h),this.setFormParams("personMailingStreet",'input[id$="_mailing_street"]'),this.setFormParams("personMailingPostalCode",'input[id$="_mailing_zib_postalcode"]'),this.setFormParams("personMailingCity",'input[id$="_mailing_city"]'),this.setFormParams("personMailingCountry",'select[id$="_crm_country_fields"]'),this.setFormParams("acceptProfiling",'input[id$="_crm_accept_profiling"]',h)}},{key:"setFormParams",value:function(e,t){var r=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(i===p||i===f){var n=this.form.querySelectorAll(t);if(n&&n.length>0)switch(i){case p:this.formValues[e]=Array.from(n).map((function(e){return e.value}));break;
1case f:c(n).forEach((function(t){r.formValues[t.getAttribute(e)]=t.multiple?Array.from(t.selectedOptions).map((function(e){return e.value})):t.value}))}}else{var a=this.form.querySelector(t);a&&(this.formValues[e]=i===h?a.checked:a.multiple?Array.from(a.selectedOptions).map((function(e){return e.value})):a.value)}}},{key:"getLandingPageId",value:function(){var e=c(document.body.classList).find((function(e){return e.startsWith("page_builder_")}));return e?e.replace("page_builder_",""):null}},{key:"updateCaracteristicField",value:function(e){var t,r,i=e.currentTarget,n=i.id.replace("characteristic","hiddenField"),a=null===(t=document.getElementById(n))||void 0===t?void 0:t.value,o=null===(r=i.options[i.selectedIndex])||void 0===r?void 0:r.dataset.locationId,s=this.form.querySelector("select.problematicTypes");s&&(s.innerHTML=""),s&&o&&a&&this.getCrmOptions(s,o,a)}},{key:"updateTypologyField",value:function(e){var t,r,i=e.currentTarget,n=i.id.replace("needtypologies_characteristic","hiddenField"),a=null===(t=document.getElementById(n))||void 0===t?void 0:t.value,o=null===(r=i.options[i.selectedIndex])||void 0===r?void 0:r.dataset.locationId,s=this.form.querySelector("select.needTypologies");s&&(s.innerHTML=""),s&&o&&a&&this.getCrmOptions(s,o,a)}},{key:"getCrmOptions",value:function(e,t,r){var i=e,n=new URLSearchParams({locationId:t,parentLocationId:r}).toString();fetch("".concat(this.crmOptionsUrl,"?").concat(n),{headers:{"X-Requested-With":"XMLHttpRequest"}}).then((function(e){return e.json()})).then((function(e){e&&(i.disabled=!1,Object.entries(e).forEach((function(e){var t=s(e,2),r=t[0],n=t[1],a=document.createElement("option");a.value=r,a.textContent=n,i.appendChild(a)})))})).catch((function(e){console.error(e)}))}}],t&&m(e.prototype,t),r&&m(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t,r}()}}]);

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.