in media/js/base/fxa-form.es6.js [298:345]
FxaForm.init = function (skipAttr) {
if (!FxaForm.isSupported()) {
return false;
}
FxaForm.skipAttribution = typeof skipAttr === 'boolean' ? skipAttr : true;
formElem = document.getElementById('fxa-email-form');
entrypointInput = document.getElementById('fxa-email-form-entrypoint');
entrypointExp = document.getElementById(
'fxa-email-form-entrypoint-experiment'
);
entrypointVar = document.getElementById(
'fxa-email-form-entrypoint-variation'
);
utmCampaign = document.getElementById('fxa-email-form-utm-campaign');
utmContent = document.getElementById('fxa-email-form-utm-content');
utmSource = document.getElementById('fxa-email-form-utm-source');
utmTerm = document.getElementById('fxa-email-form-utm-term');
return new window.Promise((resolve, reject) => {
if (formElem) {
if (!FxaForm.skipAttribution) {
// Pass through UTM params from the URL to the form.
const utms = FxaForm.getUTMParams();
Object.keys(utms).forEach((i) => {
// check if input is available
if (formElem.querySelector('[name="' + i + '"]')) {
formElem.querySelector('[name="' + i + '"]').value =
utms[i];
} else {
// create input if one is not present
const input = FxaForm.createInput(i, utms[i]);
formElem.appendChild(input);
}
});
FxaForm.fetchTokens().then(() => {
resolve();
});
} else {
resolve();
}
} else {
reject();
}
});
};