FxaForm.getExtraURLParams = function()

in media/js/base/fxa-form.es6.js [164:215]


FxaForm.getExtraURLParams = function () {
    const utmSource = document.getElementById('fxa-email-form-utm-source');
    const utmCampaign = document.getElementById('fxa-email-form-utm-campaign');
    const entrypointExp = document.getElementById(
        'fxa-email-form-entrypoint-experiment'
    );
    const entrypointVar = document.getElementById(
        'fxa-email-form-entrypoint-variation'
    );

    // Only include basic page source/campaign if attribution is skipped.
    if (FxaForm.skipAttribution) {
        return utmSource.value && utmCampaign.value
            ? {
                  utm_source: utmSource.value,
                  utm_campaign: utmCampaign.value
              }
            : null;
    }

    const extraURLParams = FxaForm.getUTMParams();
    if (entrypointExp && entrypointExp.value) {
        extraURLParams['entrypoint_experiment'] = entrypointExp.value;
    }
    if (entrypointVar && entrypointVar.value) {
        extraURLParams['entrypoint_variation'] = entrypointVar.value;
    }

    const formElem = document.getElementById('fxa-email-form');

    if (formElem) {
        const deviceId = formElem.querySelector('[name="device_id"]');
        const flowId = formElem.querySelector('[name="flow_id"]');
        const flowBeginTime = formElem.querySelector(
            '[name="flow_begin_time"]'
        );
        if (deviceId && deviceId.value) {
            extraURLParams['device_id'] = deviceId.value;
        }
        if (flowId && flowId.value) {
            extraURLParams['flow_id'] = flowId.value;
        }
        if (flowBeginTime && flowBeginTime.value) {
            extraURLParams['flow_begin_time'] = parseInt(
                flowBeginTime.value,
                10
            );
        }
    }

    return extraURLParams;
};