src/analytics/cookies/validate.js
/**
 * ConsentProvidedCallback: function - generic callback that will be called
 *                                     if and only if the user provides consent
 */
generic callback that will be called
if and only if the user provides consent
generic callback that will be called if and only if the user provides consent
function showBannerIfConsentNotSet (consentProvidedCallback = () => {}) {
  const consentCookieNotSet = !Cookies.get(GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME)
  const banner = document.querySelector(`#${ANALYTICS_CONSENT_BANNER_ID}`)
  if (consentCookieNotSet && !banner) {
    const banner = createBannerHTMLElement(consentProvidedCallback)
    document.body.prepend(banner)
  }
}
function showBannerIfConsentNotSet ( consentProvidedCallback = ( ) => { } ) { const consentCookieNotSet = ! Cookies . get ( GOVUK_PAY_ANALYTICS_CONSENT_COOKIE_NAME ) const banner = document . querySelector ( ` ${ ANALYTICS_CONSENT_BANNER_ID } ` ) if ( consentCookieNotSet && ! banner ) { const banner = createBannerHTMLElement ( consentProvidedCallback ) document . body . prepend ( banner ) } }
ConsentProvidedCallback: function - generic callback that will be called
                                     if and only if the user provides consent
ConsentProvidedCallback : function - generic callback that will be called if and only if the user provides consent