<section class="bundled-learning-promo onboarding" id="bundled-learning-promo" data-behavior="bundled-learning-promo" data-redirect-url="/components/preview/efl-bundle-recommendations" data-fanid="76667" data-bundle-id="11112" data-article-id="221211" data-quiz-redirect-url="/components/preview/efl-bundled-learning-quiz-results">
    <div class="bundled-learning-promo__wrapper">

        <picture>
            <source media="(max-width: 819px)" srcset="/assets/example-content/bundle-onboarding-background-image-mob.jpg">
            <source media="(min-width: 820px)" srcset="/assets/example-content/bundle-onboarding-background-image.jpg">
            <img src="/assets/example-content/bundle-onboarding-background-image.jpg" class="promo-background" alt="">
        </picture>

        <div class="bundled-learning-promo__overlay">
            <div class="bundled-learning-promo__overlay--wrapper">
                <img src="/assets/example-content/logo-trophy.svg" alt="">
                <h2>Unlock your potential with bundled learning!</h2>
                <p>Advance your skills and achieve your goals with our comprehensive bundled learning packages.</p>
                <button class="cta cta--efl  bundled-learning-promo-start" aria-label="start the bundle onboarding">start</button>
            </div>
        </div>

        <div class="bundled-learning-promo__questions" role="dialog" aria-modal="true">
            <div class="bundled-learning-promo__questions--container">
                <progress value="1" class="progress-bar-line"></progress>
                <button class="close-btn" tabindex="-1" aria-label="close bundle onboarding">
                    <span class="visually-hidden">Close dialog</span>
                </button>
                <div class="bundled-learning-promo__questions--list">
                    <div class="all-questions">

                        <div class="all-questions__single ">
                            <div class="all-questions__questions-sector">
                                <div class="all-questions__single--section">
                                    <div class="all-questions__single__index">Question 01/02</div>
                                    <div class="question" data-question-id="8421c03d-7ef5-4a61-995f-c83ed1fdb8d4">
                                        What can we help you with?</div>
                                    <p class="info">Please select a multiple answer</p>
                                    <div class="all-questions__single--alert" role="alert">Please select a single answer</div>
                                </div>
                                <div class="all-questions__question-wrap">
                                    <ul class="all-questions__single--options" data-answer='[ "", "" ]'>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-1" type="checkbox" class="multi-answer" id="answer-1-option-1" value="Start or continue my coaching career" tabindex="-1">
                                            <label for="answer-1-option-1">Start or continue my coaching career</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-1" type="checkbox" class="multi-answer" id="answer-1-option-2" value="Help me coach a local team" tabindex="-1">
                                            <label for="answer-1-option-2">Help me coach a local team</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-1" type="checkbox" class="multi-answer" id="answer-1-option-3" value="Top up my knowledge" tabindex="-1">
                                            <label for="answer-1-option-3">Top up my knowledge</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-1" type="checkbox" class="multi-answer" id="answer-1-option-4" value="Top up my knowledge" tabindex="-1">
                                            <label for="answer-1-option-4">Top up my knowledge</label>
                                        </div>
                                    </ul>
                                </div>
                            </div>
                            <div class="bundled-learning-promo__questions--list__navigation">
                                <div class="bundled-learning-promo__questions--list__navigation--up-down">
                                    <button aria-disabled="true" class="previous" aria-label="previous Question"></button>
                                    <button aria-disabled="true" class="next" aria-label="Next Question"></button>
                                </div>
                                <button class="cta cta--efl  personalisationNext" id="next-cta" aria-disabled="true" aria-label="Next Question" data-cta-text="Next">Next</button>
                            </div>
                        </div>

                        <div class="all-questions__single ">
                            <div class="all-questions__questions-sector">
                                <div class="all-questions__single--section">
                                    <div class="all-questions__single__index">Question 01/02</div>
                                    <div class="question" data-question-id="8421c03d-7ef5-4a61-995f-c83ed1fdb8d4">
                                        How would you rate your coaching experience?</div>
                                    <p class="info">Please select a single answer</p>
                                    <div class="all-questions__single--alert" role="alert">Please select a single answer</div>
                                </div>
                                <div class="all-questions__question-wrap">
                                    <ul class="all-questions__single--options" data-answer='[ "", "" ]'>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-2" type="radio" class="single-answer" id="answer-2-option-1" value="Advanced (UEFA B and above)" tabindex="-1">
                                            <label for="answer-2-option-1">Advanced (UEFA B and above)</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-2" type="radio" class="single-answer" id="answer-2-option-2" value="Help me coach a local team" tabindex="-1">
                                            <label for="answer-2-option-2">Help me coach a local team</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-2" type="radio" class="single-answer" id="answer-2-option-3" value="Top up my knowledge" tabindex="-1">
                                            <label for="answer-2-option-3">Top up my knowledge</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-2" type="radio" class="single-answer" id="answer-2-option-4" value="Top up my knowledge 2" tabindex="-1">
                                            <label for="answer-2-option-4">Top up my knowledge 2</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-2" type="radio" class="single-answer" id="answer-2-option-5" value="Top up my knowledge 3" tabindex="-1">
                                            <label for="answer-2-option-5">Top up my knowledge 3</label>
                                        </div>
                                    </ul>
                                </div>
                            </div>
                            <div class="bundled-learning-promo__questions--list__navigation">
                                <div class="bundled-learning-promo__questions--list__navigation--up-down">
                                    <button aria-disabled="true" class="previous" aria-label="previous Question"></button>
                                    <button aria-disabled="true" class="next" aria-label="Next Question"></button>
                                </div>
                                <button class="cta cta--efl  personalisationNext" id="next-cta" aria-disabled="true" aria-label="Next Question" data-cta-text="Next">Next</button>
                            </div>
                        </div>

                        <div class="all-questions__single ">
                            <div class="all-questions__questions-sector">
                                <div class="all-questions__single--section">
                                    <div class="all-questions__single__index">Question 01/02</div>
                                    <div class="question" data-question-id="8421c03d-7ef5-4a61-995f-c83ed1fdb8d4">
                                        When preparing to volley a finish, what do your players need to consider?</div>
                                    <p class="info">Please select a single answer</p>
                                    <div class="all-questions__single--alert" role="alert">Please select a single answer</div>
                                </div>
                                <div class="all-questions__question-wrap">
                                    <ul class="all-questions__single--options" data-answer='[ "", "" ]'>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-3" type="radio" class="single-answer" id="answer-3-option-1" value="Advanced (UEFA B and above)" tabindex="-1">
                                            <label for="answer-3-option-1">Advanced (UEFA B and above)</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-3" type="radio" class="single-answer" id="answer-3-option-2" value="Help me coach a local team" tabindex="-1">
                                            <label for="answer-3-option-2">Help me coach a local team</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-3" type="radio" class="single-answer" id="answer-3-option-3" value="Top up my knowledge" tabindex="-1">
                                            <label for="answer-3-option-3">Top up my knowledge</label>
                                        </div>
                                        <div class="all-questions__single--answers" data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            <input name="question-3" type="radio" class="single-answer" id="answer-3-option-4" value="Top up my knowledge 2" tabindex="-1">
                                            <label for="answer-3-option-4">Top up my knowledge 2</label>
                                        </div>
                                    </ul>
                                </div>
                            </div>
                            <div class="bundled-learning-promo__questions--list__navigation">
                                <div class="bundled-learning-promo__questions--list__navigation--up-down">
                                    <button aria-disabled="true" class="previous" aria-label="previous Question"></button>
                                    <button aria-disabled="true" class="next" aria-label="Next Question"></button>
                                </div>
                                <button class="cta cta--efl  personalisationNext" id="next-cta" aria-disabled="true" aria-label="Next Question" data-cta-text="Next">Next</button>
                            </div>
                        </div>

                        <div class="bundled-learning-promo__sign-in benefits">
                            <div class="bundled-learning-promo__sign-in--inner benefits">
                                <div class="bundled-learning-promo__sign-in__content">
                                    <h3 class="title">In order to see your results, you can sign up or sign in</h3>
                                    <p class="copy">Benefits of creating your own personalised experience</p>
                                    <ul>
                                        <li>Content you care about</li>
                                        <li>Sessions tailored to your team</li>
                                        <li>Course information and alerts</li>
                                    </ul>
                                </div>
                                <div class="bundled-learning-promo__sign-in__registration">
                                    <div class="bundled-learning-promo__sign-in__registration--links">
                                        <a href="/" class="cta cta--efl  sign-up-cta" tabindex="0">Sign Up</a>

                                        <a href="/" class="cta cta--secondary  sign-in-cta" tabindex="0">Sign In</a>

                                    </div>
                                </div>
                            </div>
                            <div class="bundled-learning-promo__questions--list__navigation">
                                <div class="bundled-learning-promo__questions--list__navigation--up-down">
                                    <button aria-disabled="true" class="previous" aria-label="previous Question"></button>
                                    <button aria-disabled="false" class="next" aria-label="Next Question"></button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</section>

No notes defined.

{
  "promo-type": "onboarding",
  "smallimage": "/assets/example-content/bundle-onboarding-background-image-mob.jpg",
  "bigimage": "/assets/example-content/bundle-onboarding-background-image.jpg",
  "title": "Unlock your potential with bundled learning!",
  "copy": "Advance your skills and achieve your goals with our comprehensive bundled learning packages.",
  "questions-list": [
    {
      "number": 1,
      "question": "What can we help you with?",
      "multi-answer": true,
      "answer-tip": "Please select a multiple answer",
      "answers": [
        {
          "name": "question-1",
          "value": "Start or continue my coaching career",
          "id": "answer-1-option-1"
        },
        {
          "name": "question-1",
          "value": "Help me coach a local team",
          "id": "answer-1-option-2"
        },
        {
          "name": "question-1",
          "value": "Top up my knowledge",
          "id": "answer-1-option-3"
        },
        {
          "name": "question-1",
          "value": "Top up my knowledge",
          "id": "answer-1-option-4"
        }
      ]
    },
    {
      "number": 2,
      "question": "How would you rate your coaching experience?",
      "multi-answer": false,
      "answer-tip": "Please select a single answer",
      "answers": [
        {
          "name": "question-2",
          "value": "Advanced (UEFA B and above)",
          "id": "answer-2-option-1"
        },
        {
          "name": "question-2",
          "value": "Help me coach a local team",
          "id": "answer-2-option-2"
        },
        {
          "name": "question-2",
          "value": "Top up my knowledge",
          "id": "answer-2-option-3"
        },
        {
          "name": "question-2",
          "value": "Top up my knowledge 2",
          "id": "answer-2-option-4"
        },
        {
          "name": "question-2",
          "value": "Top up my knowledge 3",
          "id": "answer-2-option-5"
        }
      ]
    },
    {
      "number": 3,
      "question": "When preparing to volley a finish, what do your players need to consider?",
      "multi-answer": false,
      "answer-tip": "Please select a single answer",
      "answers": [
        {
          "name": "question-3",
          "value": "Advanced (UEFA B and above)",
          "id": "answer-3-option-1"
        },
        {
          "name": "question-3",
          "value": "Help me coach a local team",
          "id": "answer-3-option-2"
        },
        {
          "name": "question-3",
          "value": "Top up my knowledge",
          "id": "answer-3-option-3"
        },
        {
          "name": "question-3",
          "value": "Top up my knowledge 2",
          "id": "answer-3-option-4"
        }
      ]
    }
  ],
  "sign-up-cta": {
    "copy": "Sign Up",
    "additionalClass": "sign-up-cta"
  },
  "sign-in-cta": {
    "copy": "Sign In",
    "additionalClass": "sign-in-cta"
  }
}
  • Content:
    import { gsap } from 'gsap';
    import { Rive, Fit, Layout } from '@rive-app/canvas';
    import Player from '@vimeo/player';
    import { loadYouTubeApi } from '../video/video';
    
    export default parentElement => {
      // Declarations
      const MOBILE_BREAKPOINT = 820;
      const startBtn = parentElement.querySelector('.bundled-learning-promo-start');
      const closeBtns = parentElement.querySelector(
        '.bundled-learning-promo__questions--container .close-btn'
      );
      const progressBar = parentElement.querySelector('.progress-bar-line');
      const bannerOverlay = parentElement.querySelector(
        '.bundled-learning-promo__overlay'
      );
      const wrapper = parentElement.querySelector(
        '.bundled-learning-promo__wrapper'
      );
      const questionsList = parentElement.querySelector(
        '.bundled-learning-promo__questions--list'
      );
      const allQuestions = parentElement.querySelector('.all-questions');
      const allQuestionsItem = parentElement.querySelectorAll('.all-questions > *');
      const questions = parentElement.querySelectorAll('.all-questions__single');
      const questionVideo = parentElement.querySelectorAll(
        '.all-questions__single.question-video'
      );
      const signIn = parentElement.querySelector(
        '.bundled-learning-promo__sign-in'
      );
      const promoType = parentElement.classList.contains('quiz');
      const {
        fanid,
        redirectUrl,
        bundleId,
        articleId,
        quizRedirectUrl,
      } = parentElement.dataset;
      const totalCorrectAns = [];
    
      async function updateOnboardingDetailsCallback(updateData, type) {
        let url;
    
        if (type === 'quiz') {
          url = `/Bundling/UpdateBundledLearning`;
        } else {
          url = `/Bundling/UpdateOnboardingDetails`;
        }
        // eslint-disable-next-line compat/compat
        const response = await fetch(url, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'Cache-Control': 'no-cache',
            Pragma: 'no-cache',
            Expires: '0',
          },
          body: updateData,
        });
    
        return response.json();
      }
    
      function updateOnboardingData(updateData, type) {
        try {
          // isAjaxRuning = true;
          updateOnboardingDetailsCallback(updateData, type).then(response => {
            if (type === 'quiz') {
              console.log(response.id);
              if (response && response.id && response.id !== null) {
                let bundleQuizPromo = [];
                const quizArticles = `{"id":"${fanid}","articleId": "${articleId}"}`;
    
                if (localStorage.getItem('bundleQuizPromo')) {
                  bundleQuizPromo = JSON.parse(
                    localStorage.getItem('bundleQuizPromo')
                  );
                  const idExist = bundleQuizPromo.find(
                    val => val.articleId === articleId
                  );
    
                  if (!idExist) {
                    bundleQuizPromo[bundleQuizPromo.length] = JSON.parse(
                      quizArticles
                    );
                    localStorage.setItem(
                      'bundleQuizPromo',
                      JSON.stringify(bundleQuizPromo)
                    );
                  }
                } else {
                  localStorage.setItem('bundleQuizPromo', `[${quizArticles}]`);
                }
    
                // eslint-disable-next-line no-restricted-globals
                location.href = quizRedirectUrl;
              }
            } else if (response) {
              // eslint-disable-next-line no-restricted-globals
              location.href = redirectUrl;
            }
          });
        } catch (e) {
          throw new Error('Unable to update onboarding details ::', e);
        }
      }
    
      const generateQuizJsonData = rightAns => {
        return `{
          "id": "${fanid}",
          "bundles": [
            {
              "bundleId": "${bundleId}",
              "isCompletedFirstTime": null,
              "bundleArticles": [
                {
                "articleID": "${articleId}",
                "totalQuestion":"${questions.length}",
                "noOfCorrectAnswer":"${rightAns}"
                }
              ]
            }
          ]
        }`;
      };
    
      const generateJsonData = () => {
        const bundledOnboardingQues = [];
    
        questions.forEach((question, index) => {
          const questionElment = question.querySelector('.question');
          const { questionId } = questionElment.dataset;
          const questionText = questionElment.innerText;
    
          const answerDetails = [];
          const answerOptions = question.querySelectorAll('input');
          let inc = 0;
    
          answerOptions.forEach(option => {
            if (option.checked) {
              const { answerId } = option.closest(
                '.all-questions__single--answers'
              ).dataset;
              const answer = `{
                "answer": "${option.value}",
                "answerId": "${answerId}"
              }`;
    
              answerDetails[inc] = JSON.parse(answer);
              inc += 1;
            }
          });
    
          const questionDetails = `{
            "question": "${questionText}",
            "questionId": "${questionId}",
            "answerDetails": ${JSON.stringify(answerDetails)}
          }`;
    
          bundledOnboardingQues[index] = JSON.parse(questionDetails);
        });
    
        const updateData = `{
          "id": "${fanid}",
          "bundledOnboardingQues": ${JSON.stringify(bundledOnboardingQues)}
        }`;
    
        return updateData;
      };
    
      document.addEventListener('readystatechange', () => {
        if (!fanid) {
          localStorage.removeItem('bundleQuizPromo');
        }
    
        if (localStorage.getItem('bundleQuizPromo')) {
          const quizArticles = JSON.parse(localStorage.getItem('bundleQuizPromo'));
    
          quizArticles.forEach(article => {
            if (
              article.id === fanid &&
              article.articleId === articleId &&
              document.querySelector(`[data-article-id="${article.articleId}"]`)
            ) {
              document
                .querySelector(`[data-article-id="${article.articleId}"]`)
                .classList.add('hidden');
            }
          });
        }
      });
    
      // Accessibility
      const updateTabIndex = activeItem => {
        allQuestionsItem.forEach(item => {
          const allInputs = item.querySelectorAll('input, a, button');
    
          allInputs.forEach(element => {
            // eslint-disable-next-line no-param-reassign
            element.tabIndex = '-1';
            if (element.type === 'checkbox') {
              // eslint-disable-next-line no-param-reassign
              element.tabIndex = '-1';
            } else if (element.type === 'radio') {
              // eslint-disable-next-line no-param-reassign
              element.nextElementSibling.tabIndex = '-1';
              // eslint-disable-next-line no-param-reassign
              element.tabIndex = '-1';
            }
          });
        });
    
        if (activeItem) {
          const activeItemEle = activeItem.querySelectorAll('input, a, button');
    
          activeItemEle.forEach(element => {
            // eslint-disable-next-line no-param-reassign
            element.tabIndex = '0';
    
            if (element.type === 'checkbox') {
              // eslint-disable-next-line no-param-reassign
              element.tabIndex = '0';
            } else if (element.type === 'radio') {
              // eslint-disable-next-line no-param-reassign
              element.nextElementSibling.tabIndex = '0';
              // eslint-disable-next-line no-param-reassign
              element.tabIndex = '-1';
            }
          });
        }
      };
    
      // functions
      questions.forEach((question, index) => {
        const text = question.querySelector('.all-questions__single__index');
        const currentnextBtn = question.querySelector(
          '.bundled-learning-promo__questions--list__navigation--up-down .next'
        );
        const currentprevBtn = question.querySelector(
          '.bundled-learning-promo__questions--list__navigation--up-down .previous'
        );
        const nextCta = question.querySelector('.cta.cta--efl.personalisationNext');
        const feedBack = question.nextElementSibling;
        const feedbackCta = feedBack.querySelectorAll('.cta.cta--efl.feedbackNext');
        const signinprevBtn = parentElement.querySelector(
          '.bundled-learning-promo__sign-in .previous'
        );
        const getSelectedOptions = question.querySelectorAll('input');
    
        const currentIndex = index < 9 ? `0${index + 1}` : index + 1;
    
        const totalQuestions =
          questions.length < 9 ? `0${questions.length}` : questions.length;
    
        if (!promoType) {
          text.style.display = 'none';
        }
    
        text.innerHTML = `Question ${currentIndex}/${totalQuestions}`;
    
        // previous question
        const goToPrevQuestion = () => {
          const prevQuestion = questions[progressBar.value - 2];
          const prevBtn = prevQuestion.querySelector(
            '.bundled-learning-promo__questions--list__navigation--up-down .previous'
          );
          const nextBtn = prevQuestion.querySelector(
            '.bundled-learning-promo__questions--list__navigation--up-down .next'
          );
          const prevnextCta = prevQuestion.querySelector(
            '.cta.cta--efl.personalisationNext'
          );
          const getRightFeedback = parentElement.querySelectorAll(
            '.right-feedback'
          );
          const getWrongFeedback = parentElement.querySelectorAll(
            '.wrong-feedback'
          );
    
          if (!prevQuestion) {
            currentprevBtn.setAttribute('aria-disabled', 'false');
            return;
          }
    
          if (promoType) {
            getRightFeedback.forEach(feedback => {
              feedback.classList.add('hidden');
            });
            getWrongFeedback.forEach(feedback => {
              feedback.classList.add('hidden');
            });
          }
    
          const questionHeight = prevQuestion.clientHeight;
    
          allQuestions.style.minHeight = `${questionHeight}px`;
    
          if (progressBar.value <= 2) {
            progressBar.value -= 1;
            prevBtn.setAttribute('aria-disabled', 'true');
          } else {
            progressBar.value -= 1;
          }
    
          if (prevQuestion.getAttribute('data-answered') === 'true') {
            prevnextCta.setAttribute('aria-disabled', 'false');
            nextBtn.setAttribute('aria-disabled', 'false');
          } else {
            prevnextCta.setAttribute('aria-disabled', 'true');
            nextBtn.setAttribute('aria-disabled', 'true');
          }
    
          updateTabIndex(prevQuestion);
    
          gsap.to(allQuestions, {
            transform: `translateY(-${prevQuestion.offsetTop}px)`,
            ease: 'power2',
            scrub: true,
            yoyo: 'true',
          });
        };
    
        // next question
        const goToNextQuestion = () => {
          const signinnextBtn = parentElement.querySelector(
            '.bundled-learning-promo__sign-in .next'
          );
    
          if (!fanid) {
            signinnextBtn.setAttribute('aria-disabled', 'true');
            allQuestions.classList.add('sign-in');
            allQuestions.style.minHeight = `${signIn.clientHeight}px`;
    
            gsap.to(allQuestions, {
              transform: `translateY(-${signIn.offsetTop}px)`,
              ease: 'power2',
              scrub: true,
              yoyo: 'true',
            });
            updateTabIndex(signIn);
          } else if (progressBar.value === progressBar.max) {
            // last question
            if (promoType) {
              let rightAns = 0;
    
              totalCorrectAns.forEach(ans => {
                if (ans) {
                  rightAns += 1;
                }
              });
    
              // console.log(totalCorrectAns);
              // console.log(rightAns);
              const updateData = generateQuizJsonData(rightAns);
    
              updateOnboardingData(updateData, 'quiz');
            } else {
              const updateData = generateJsonData();
    
              updateOnboardingData(updateData, 'onboarding');
            }
          }
    
          if (!fanid || progressBar.value === progressBar.max) {
            return;
          }
    
          const nextQuestion = questions[progressBar.value];
          const prevBtn = nextQuestion.querySelector(
            '.bundled-learning-promo__questions--list__navigation--up-down .previous'
          );
          const nextBtn = nextQuestion.querySelector(
            '.bundled-learning-promo__questions--list__navigation--up-down .next'
          );
          const nextCTA = nextQuestion.querySelector(
            '.cta.cta--efl.personalisationNext'
          );
          const questionHeight = nextQuestion.clientHeight;
    
          allQuestions.style.minHeight = `${questionHeight}px`;
    
          if (progressBar.value < progressBar.max - 1) {
            progressBar.value += 1;
          } else {
            progressBar.value += 1;
            nextBtn.setAttribute('aria-disabled', 'true');
          }
    
          if (progressBar.value >= 2) {
            prevBtn.setAttribute('aria-disabled', 'false');
          }
    
          if (nextQuestion.getAttribute('data-answered') === 'true') {
            nextCTA.setAttribute('aria-disabled', 'false');
            nextBtn.setAttribute('aria-disabled', 'false');
          } else {
            nextCTA.setAttribute('aria-disabled', 'true');
            nextBtn.setAttribute('aria-disabled', 'true');
          }
    
          updateTabIndex(nextQuestion);
    
          gsap.to(allQuestions, {
            transform: `translateY(-${nextQuestion.offsetTop}px)`,
            ease: 'power2',
            scrub: true,
            yoyo: 'true',
          });
        };
    
        const goToFeedback = () => {
          const selectedAnswers = [];
          const optionContainer = question.querySelector(
            '.all-questions__single--options'
          );
          const getCorrectAnswer = JSON.parse(optionContainer.dataset.answer);
          const correctAnswer = getCorrectAnswer.filter(item => item);
          const currentQuestion = questions[progressBar.value - 1];
          const getFeedbackContainer = currentQuestion.nextElementSibling;
          const lastFeedbackCta = getFeedbackContainer.querySelectorAll(
            '.cta.cta--efl.feedbackNext'
          );
          const getRightFeedback = getFeedbackContainer.querySelector(
            '.right-feedback'
          );
          const getWrongFeedback = getFeedbackContainer.querySelector(
            '.wrong-feedback'
          );
          const rightfeedbackCanvas = getFeedbackContainer.querySelector(
            '.all-questions__feedback--right-icon'
          );
          const wrongfeedbackCanvas = getFeedbackContainer.querySelector(
            '.all-questions__feedback--wrong-icon'
          );
          const lyout = new Layout({
            fit: Fit.Cover,
          });
    
          // last question
          if (progressBar.value === progressBar.max) {
            lastFeedbackCta.forEach(lastCta => {
              lastCta.innerHTML = lastCta.getAttribute('data-last-cta'); // eslint-disable-line no-param-reassign
            });
          }
    
          getSelectedOptions.forEach(option => {
            if (option.checked) {
              selectedAnswers.push(option.value);
            }
          });
    
          if (
            selectedAnswers.length === correctAnswer.length &&
            selectedAnswers.every(answer => correctAnswer.includes(answer))
          ) {
            getRightFeedback.classList.remove('hidden');
            getWrongFeedback.classList.add('hidden');
    
            const rightAnimation = new Rive({
              src: '/assets/example-content/quiz-correct-feedback.riv',
              canvas: rightfeedbackCanvas,
              layout: lyout,
              onLoad: () => {
                rightAnimation.resizeDrawingSurfaceToCanvas();
              },
            });
    
            rightAnimation.play('Correct');
    
            totalCorrectAns[progressBar.value - 1] = true;
          } else {
            getRightFeedback.classList.add('hidden');
            getWrongFeedback.classList.remove('hidden');
    
            const wrongAnimation = new Rive({
              src: '/assets/example-content/quiz-incorrect-feedback.riv',
              canvas: wrongfeedbackCanvas,
              layout: lyout,
              onLoad: () => {
                wrongAnimation.resizeDrawingSurfaceToCanvas();
              },
            });
    
            wrongAnimation.play('Incorrect');
            totalCorrectAns[progressBar.value - 1] = false;
          }
    
          allQuestions.style.minHeight = `${feedBack.clientHeight}px`;
    
          updateTabIndex(feedBack);
    
          gsap.to(allQuestions, {
            transform: `translateY(-${feedBack.offsetTop}px)`,
            ease: 'power2',
            scrub: true,
            yoyo: 'true',
          });
        };
    
        // Alert
        const openAlert = () => {
          const alert = questions[progressBar.value - 1].querySelector(
            '.all-questions__single--alert'
          );
    
          alert.classList.add('active');
        };
    
        if (feedbackCta) {
          feedbackCta.forEach(cta => {
            cta.addEventListener('click', e => {
              e.preventDefault();
    
              goToNextQuestion();
    
              setTimeout(() => {
                closeBtns.focus();
              }, 100);
            });
    
            cta.addEventListener('keydown', e => {
              if (e.keyCode === 13) {
                cta.click();
                cta.blur();
              } else {
                e.preventDefault();
    
                closeBtns.focus();
              }
            });
          });
        }
    
        nextCta.addEventListener('click', e => {
          e.preventDefault();
    
          if (nextCta.getAttribute('aria-disabled') === 'true') {
            openAlert();
            const currentQuestion = questions[progressBar.value - 1];
            const questionHeight = currentQuestion.clientHeight;
    
            allQuestions.style.minHeight = `${questionHeight}px`;
            return;
          }
    
          if (promoType) {
            goToFeedback();
          } else {
            goToNextQuestion();
          }
    
          setTimeout(() => {
            closeBtns.focus();
          }, 100);
        });
    
        nextCta.addEventListener('keydown', e => {
          if (e.keyCode === 13) {
            nextCta.click();
            nextCta.blur();
          } else {
            e.preventDefault();
    
            closeBtns.focus();
          }
        });
    
        currentnextBtn.addEventListener('click', e => {
          e.preventDefault();
    
          if (currentnextBtn.getAttribute('aria-disabled') === 'true') {
            return;
          }
    
          if (promoType) {
            goToFeedback();
          } else {
            goToNextQuestion();
          }
    
          closeBtns.focus();
        });
    
        currentnextBtn.addEventListener('keydown', e => {
          if (e.keyCode === 13) {
            e.preventDefault();
            currentnextBtn.click();
          }
        });
    
        currentprevBtn.addEventListener('click', e => {
          e.preventDefault();
    
          if (currentprevBtn.getAttribute('aria-disabled') === 'true') {
            return;
          }
    
          goToPrevQuestion();
    
          closeBtns.focus();
        });
    
        currentprevBtn.addEventListener('keydown', e => {
          if (e.keyCode === 13) {
            e.preventDefault();
            currentprevBtn.click();
          }
        });
    
        // sign in functions
        signinprevBtn.addEventListener('click', e => {
          e.preventDefault();
    
          if (currentprevBtn.getAttribute('aria-disabled') === 'true') {
            return;
          }
    
          const prevQuestion = questions[progressBar.value - 2];
          const prevBtn = prevQuestion.querySelector(
            '.bundled-learning-promo__questions--list__navigation--up-down .previous'
          );
          const nextBtn = prevQuestion.querySelector(
            '.bundled-learning-promo__questions--list__navigation--up-down .next'
          );
          const prevFeedBack = signIn.previousElementSibling;
          const getRightFeedback = prevFeedBack.querySelector('.right-feedback');
          const getWrongFeedback = prevFeedBack.querySelector('.wrong-feedback');
    
          if (promoType) {
            getRightFeedback.classList.add('hidden');
            getWrongFeedback.classList.add('hidden');
          }
    
          // at sign in section
          if (allQuestions.classList.contains('sign-in')) {
            const lastQuestion = questions[progressBar.value - 1];
    
            if (lastQuestion.getAttribute('data-answered') === 'true') {
              nextBtn.setAttribute('aria-disabled', 'false');
            } else {
              nextBtn.setAttribute('aria-disabled', 'true');
            }
    
            if (progressBar.value < 2) {
              prevBtn.setAttribute('aria-disabled', 'true');
            }
    
            allQuestions.style.minHeight = `${lastQuestion.clientHeight}px`;
            allQuestions.classList.remove('sign-in');
            updateTabIndex(lastQuestion);
            gsap.to(allQuestions, {
              transform: `translateY(-${lastQuestion.offsetTop}px)`,
              ease: 'power2',
              scrub: true,
              yoyo: 'true',
            });
          }
        });
    
        signinprevBtn.addEventListener('keydown', e => {
          if (e.keyCode === 13) {
            e.preventDefault();
            signinprevBtn.click();
          }
        });
    
        // Accessibility
        const updateOptLabel = () => {
          const questionElement = question.querySelector('.question');
          const questionText = questionElement.innerText;
          const answerOptions = question.querySelectorAll('input');
          const firstOpt = answerOptions[0];
          const optLabel = firstOpt.nextElementSibling;
          const optText = optLabel.innerText;
    
          if (firstOpt.type === 'checkbox') {
            firstOpt.setAttribute('aria-label', `${questionText} ${optText}`);
          } else if (firstOpt.type === 'radio') {
            const firstoptLabel = document.createElement('div');
    
            firstoptLabel.className = 'visually-hidden';
            firstoptLabel.innerText = `${questionText}`;
            optLabel.prepend(firstoptLabel);
          }
        };
    
        updateOptLabel();
      });
    
      // Open Question Modal
      startBtn.addEventListener('click', e => {
        e.preventDefault();
    
        document.body.style.overflow = 'hidden';
        wrapper.classList.add('enlarged-image');
        /* eslint-disable no-param-reassign */
        parentElement.classList.add('expanded');
        parentElement.style.marginTop = `${-(
          parentElement.offsetTop - window.scrollY
        )}px`;
        /* eslint-disable no-param-reassign */
        bannerOverlay.classList.add('bundle-hidden');
    
        setTimeout(() => {
          questionsList.classList.add('expanded');
        }, 10);
    
        progressBar.value = 1;
        gsap.to(allQuestions, {
          transform: '',
          ease: 'power2',
          scrub: true,
          yoyo: 'true',
        });
        updateTabIndex(allQuestionsItem[0]);
        closeBtns.tabIndex = '0';
        closeBtns.focus();
    
        if (window.innerWidth < MOBILE_BREAKPOINT) {
          const containerHeight = document.documentElement.clientHeight;
          const allNavigation = parentElement.querySelectorAll(
            '.bundled-learning-promo__questions--list__navigation--up-down'
          );
          const bottomGap = 102;
    
          allNavigation.forEach(navigation => {
            navigation.style.top = `${containerHeight - bottomGap}px`;
          });
        }
      });
    
      // Close Question Modal
      if (closeBtns) {
        closeBtns.addEventListener('click', e => {
          e.preventDefault();
    
          document.body.style.overflow = null;
          wrapper.classList.remove('enlarged-image');
          /* eslint-disable no-param-reassign */
          parentElement.classList.remove('expanded');
          parentElement.style.marginTop = ``;
          /* eslint-disable no-param-reassign */
          bannerOverlay.classList.remove('bundle-hidden');
    
          setTimeout(() => {
            questionsList.classList.remove('expanded');
          }, 10);
          closeBtns.blur();
          closeBtns.tabIndex = '-1';
          startBtn.focus();
          updateTabIndex();
        });
    
        closeBtns.addEventListener('keydown', e => {
          if (e.keyCode === 13) {
            e.preventDefault();
    
            closeBtns.click();
          } else if (e.shiftKey && e.keyCode === 9) {
            e.preventDefault();
          } else {
            // empty
          }
        });
      }
    
      window.addEventListener('DOMContentLoaded', () => {
        progressBar.setAttribute('max', questions.length);
      });
    
      window.addEventListener('scroll', () => {
        if (window.innerWidth < MOBILE_BREAKPOINT) {
          const containerHeight = document.documentElement.clientHeight;
          const allNavigation = parentElement.querySelectorAll(
            '.bundled-learning-promo__questions--list__navigation--up-down'
          );
          const bottomGap = 102;
    
          allNavigation.forEach(navigation => {
            navigation.style.top = `${containerHeight - bottomGap}px`;
          });
        }
      });
    
      window.addEventListener('click', e => {
        const clickedElement = e.target;
    
        if (clickedElement.tagName === 'INPUT') {
          const allQuestionsParent = clickedElement.closest(
            '.all-questions__single'
          );
          const bundleLearnPromo = clickedElement.closest(
            '.bundled-learning-promo'
          );
    
          if (!allQuestionsParent || !bundleLearnPromo) {
            return;
          }
    
          const alert = allQuestionsParent.querySelector(
            '.all-questions__single--alert'
          );
          const inputs = allQuestionsParent.querySelectorAll('input');
          const parentnextBtn = allQuestionsParent.querySelector(
            '.bundled-learning-promo__questions--list__navigation--up-down .next'
          );
          const parentnextCta = allQuestionsParent.querySelector(
            '.cta.cta--efl.personalisationNext'
          );
    
          if (clickedElement.type === 'checkbox') {
            let answered = false;
    
            inputs.forEach(element => {
              if (element.checked) {
                answered = true;
              }
            });
    
            if (answered === true) {
              allQuestionsParent.setAttribute('data-answered', 'true');
              parentnextCta.setAttribute('aria-disabled', 'false');
              parentnextBtn.setAttribute('aria-disabled', 'false');
              // if alert is active, remove it
              alert.classList.remove('active');
              const currentQuestion = questions[progressBar.value - 1];
              const questionHeight = currentQuestion.clientHeight;
    
              allQuestions.style.minHeight = `${questionHeight}px`;
            } else {
              allQuestionsParent.setAttribute('data-answered', 'false');
              parentnextCta.setAttribute('aria-disabled', 'true');
              parentnextBtn.setAttribute('aria-disabled', 'true');
            }
          } else if (clickedElement.type === 'radio') {
            allQuestionsParent.setAttribute('data-answered', 'true');
            parentnextCta.setAttribute('aria-disabled', 'false');
            parentnextBtn.setAttribute('aria-disabled', 'false');
            alert.classList.remove('active');
            const currentQuestion = questions[progressBar.value - 1];
            const questionHeight = currentQuestion.clientHeight;
    
            allQuestions.style.minHeight = `${questionHeight}px`;
          }
        }
      });
    
      window.addEventListener('keydown', event => {
        if ((event.keyCode === 13 || event.keyCode === 32) && parentElement) {
          const { target } = event;
          const bundleLearnPromo = target.closest('.bundled-learning-promo');
    
          if (!bundleLearnPromo) {
            return;
          }
    
          if (target.previousElementSibling) {
            if (target.previousElementSibling.type === 'radio') {
              target.click();
              target.focus();
            }
          } else if (target.type === 'checkbox') {
            target.click();
            target.focus();
          }
        }
      });
    
      // video functions
      const checkThumbnail = currentEle => {
        const playButton = currentEle.querySelector(
          '.all-questions__video-thumbnail button'
        );
        const thumbnailImg = currentEle.querySelector(
          '.all-questions__video-thumbnail'
        );
    
        if (playButton.querySelector('img')) {
          // eslint-disable-next-line no-param-reassign
          currentEle.querySelector('.all-questions__player').style.display = 'none';
          // eslint-disable-next-line no-param-reassign
          thumbnailImg.style.display = 'block';
        } else {
          // eslint-disable-next-line no-param-reassign
          currentEle.querySelector('.all-questions__player').style.display =
            'block';
          // eslint-disable-next-line no-param-reassign
          thumbnailImg.style.display = 'none';
        }
      };
    
      const onPlayerReady = event => {
        // To capture error on video
        event.target.playVideo();
        event.target.stopVideo();
      };
    
      const onPlayerError = currentEle => {
        const errorImg = currentEle.querySelector('.all-questions__video-poster');
        const thumbnailImg = currentEle.querySelector(
          '.all-questions__video-thumbnail'
        );
    
        if (errorImg.querySelector('img')) {
          // eslint-disable-next-line no-param-reassign
          errorImg.style.display = 'block';
          // eslint-disable-next-line no-param-reassign
          thumbnailImg.style.display = 'none';
          // eslint-disable-next-line no-param-reassign
          currentEle.querySelector('.all-questions__player').style.display = 'none';
        } else {
          // eslint-disable-next-line no-param-reassign
          errorImg.style.display = 'none';
          // eslint-disable-next-line no-param-reassign
          thumbnailImg.style.display = 'none';
          // eslint-disable-next-line no-param-reassign
          currentEle.querySelector('.all-questions__player').style.display =
            'block';
        }
      };
    
      const onPlayerStateChange = (event, currentEle) => {
        if (event.data === 0) {
          checkThumbnail(currentEle);
        }
      };
    
      const initVimeoPlayer = (videoPlayerId, videoId, currentEle) => {
        const playButton = currentEle.querySelector(
          '.all-questions__video-thumbnail button'
        );
        const thumbnailImg = currentEle.querySelector(
          '.all-questions__video-thumbnail'
        );
        const videoPlayer = new Player(videoPlayerId, {
          id: videoId,
          autoplay: 0,
          muted: 0,
          title: 0,
          sidedock: 0,
          controls: 1,
        });
    
        videoPlayer
          .pause()
          .then(() => {
            // The video is loadded
          })
          .catch(() => {
            onPlayerError(currentEle);
          });
    
        videoPlayer.on('ended', () => {
          checkThumbnail(currentEle);
        });
    
        playButton.addEventListener('click', () => {
          videoPlayer.play();
          // eslint-disable-next-line no-param-reassign
          thumbnailImg.style.display = 'none';
          // eslint-disable-next-line no-param-reassign
          currentEle.querySelector('.all-questions__player').style.display =
            'block';
        });
    
        playButton.addEventListener('keyup', event => {
          if (event.keyCode === 13) {
            // Cancel the default action, if needed
            event.preventDefault();
            playButton.click();
          }
        });
    
        checkThumbnail(currentEle);
      };
    
      const initYTPlayer = (videoPlayerId, videoId, currentEle) => {
        return new window.YT.Player(videoPlayerId, {
          height: '390',
          width: '640',
          videoId,
          playsinline: 1,
          events: {
            onReady: onPlayerReady,
            onStateChange: event => {
              onPlayerStateChange(event, currentEle);
            },
            onError: () => {
              onPlayerError(currentEle);
            },
          },
        });
      };
    
      const initVideo = () => {
        questionVideo.forEach(currentEle => {
          const videoWrap = currentEle.querySelector('.all-questions__video-wrap');
          const videoPlayerId = currentEle
            .querySelector('.all-questions__player')
            .getAttribute('id');
          const { videoId, videoType } = videoWrap.dataset;
          const playButton = currentEle.querySelector(
            '.all-questions__video-thumbnail button'
          );
          const thumbnailImg = currentEle.querySelector(
            '.all-questions__video-thumbnail'
          );
    
          if (videoType === 'youtube') {
            const player = initYTPlayer(videoPlayerId, videoId, currentEle);
    
            playButton.addEventListener('click', () => {
              player.playVideo();
              // eslint-disable-next-line no-param-reassign
              thumbnailImg.style.display = 'none';
              // eslint-disable-next-line no-param-reassign
              currentEle.querySelector('.all-questions__player').style.display =
                'block';
            });
    
            playButton.addEventListener('keyup', event => {
              if (event.keyCode === 13) {
                // Cancel the default action, if needed
                event.preventDefault();
                playButton.click();
              }
            });
    
            checkThumbnail(currentEle);
          }
        });
        window.YouTubeIframeApiReady = true;
      };
    
      const initYTApi = () => {
        if (window.YouTubeIframeApiReady === undefined) {
          loadYouTubeApi();
          window.onYouTubeIframeAPIReady = () => {
            initVideo();
          };
          const autoplayYT = document.querySelector(
            '[data-behavior=autoplay-hero-video]'
          );
          const largevideoYT = document.querySelector(
            '[data-behavior=efl-large-video-player]'
          );
          const largevideoType = document.querySelector(
            '.efl-large-video-player__video-wrap'
          );
    
          if (
            autoplayYT &&
            autoplayYT.getAttribute('data-video-type') === 'youtube'
          ) {
            const autoplayTime = setInterval(() => {
              if (window.YouTubeIframeApiReady === true) {
                initVideo();
                clearInterval(autoplayTime);
              }
            }, 100);
          } else if (
            largevideoYT &&
            largevideoType &&
            largevideoType.getAttribute('data-video-type') === 'youtube'
          ) {
            const largevideoTime = setInterval(() => {
              if (window.YouTubeIframeApiReady === true) {
                initVideo();
                clearInterval(largevideoTime);
              }
            }, 100);
          }
        } else if (window.YouTubeIframeApiReady === false) {
          window.onYouTubeIframeAPIReady = () => {
            initVideo();
          };
        } else {
          initVideo();
        }
      };
    
      let youtubeVid = false;
    
      // check all video questions
      questionVideo.forEach((currentEle, index) => {
        const videoWrap = currentEle.querySelector('.all-questions__video-wrap');
        const tempVideoPlayerId = currentEle
          .querySelector('.all-questions__player')
          .getAttribute('id');
    
        // dynamic video player id update
        currentEle
          .querySelector('.all-questions__player')
          .setAttribute('id', `${tempVideoPlayerId}-${index}`);
    
        const videoPlayerId = currentEle
          .querySelector('.all-questions__player')
          .getAttribute('id');
    
        const { videoId, videoType } = videoWrap.dataset;
    
        if (videoType === 'youtube') {
          youtubeVid = true;
        } else {
          initVimeoPlayer(videoPlayerId, videoId, currentEle);
        }
    
        if (youtubeVid) {
          initYTApi();
        }
      });
    
      updateTabIndex();
    };
    
  • URL: /components/raw/bundled-learning-promo/bundled-learning-promo.js
  • Filesystem Path: src/library/components/bundled-learning-promo/bundled-learning-promo.js
  • Size: 33.4 KB
  • Content:
    /* stylelint-disable no-descending-specificity */
    .bundled-learning-promo {
      width: 100%;
      min-height: 57rem;
      overflow: hidden;
      justify-content: center;
      margin: 0 auto;
      position: relative;
      transition: margin-top 0.8s cubic-bezier(0.83, 0, 0.17, 1);
    
      &.expanded {
        z-index: 220;
      }
    
      // custom class for hide bundle sections
      .bundle-hidden {
        opacity: 0;
        transform: translateY(-100%);
        transition: all 0.8s linear;
      }
    
      &__sign-in {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 100vh;
    
        &__content {
          max-width: 44.6rem;
          h2,
          h3 {
            @extend .efl-heading-3;
    
            font-weight: 400;
            margin-bottom: 1.6rem;
          }
          p {
            @extend .efl-p-medium;
    
            color: $light-blue;
            letter-spacing: 0.02em;
            margin-bottom: 1.6rem;
          }
          ul {
            padding-left: 0;
            li {
              display: flex;
              gap: 1.5rem;
              align-items: center;
              font-weight: 700;
    
              @extend .efl-p-large;
              &::marker {
                content: '';
              }
              &::before {
                content: '';
                display: block;
                background-image: url('./assets/images/Tick.svg');
                background-repeat: no-repeat;
                background-size: cover;
                width: 3rem;
                height: 3rem;
              }
            }
          }
          .efl-category-title {
            &--desktop {
              display: none;
            }
          }
        }
    
        &--inner {
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          max-width: 113.2rem;
    
          &.benefits {
            .progressive-profile__sign-in__content {
              border-bottom: 0.1rem solid rgba(255, 255, 255, 0.3);
              border-right: none;
            }
    
            // gap between keyline
            > *:last-child {
              padding-top: 2rem;
            }
    
            .not-today {
              text-align: center;
              color: $white;
              opacity: 0.7;
            }
          }
        }
    
        &__cards {
          display: flex;
          overflow-x: scroll;
          margin-right: -2rem;
          gap: 1.6rem;
          height: 100%;
    
          &::-webkit-scrollbar {
            width: 0.2rem;
          }
    
          .registration {
            display: flex;
            flex-direction: column;
            flex-wrap: wrap;
            gap: 2rem;
          }
        }
    
        &__registration {
          display: flex;
          justify-content: center;
          flex-direction: column;
          gap: 2rem;
    
          &--links {
            display: flex;
            flex-direction: column;
    
            .cta {
              width: 100%;
              text-decoration: none;
              max-width: none;
              &:hover {
                text-decoration: none;
              }
            }
    
            .sign-in-cta {
              color: $white;
              border: 0.2rem solid $white;
              background: rgba($white, 0.1);
              &:hover {
                background-color: $white;
                color: $blue;
              }
            }
    
            .sign-up-cta {
              border: none;
              margin-bottom: 2rem;
              &:hover {
                color: $white;
              }
            }
          }
        }
      }
    
      &__overlay {
        width: 100%;
        max-width: 29.3rem;
        position: relative;
        display: flex;
        margin: 0 auto;
        z-index: 2;
        height: 57rem;
        opacity: 1;
        transform: translateY(0);
        transition: all 0.8s linear;
        &--wrapper {
          display: flex;
          align-items: center;
          flex-direction: column;
          margin: auto auto;
          position: initial;
          z-index: 2;
          color: $white;
          text-align: center;
          img {
            margin-bottom: 1.6rem;
            width: 9.6rem;
            height: 9.6rem;
          }
          h2 {
            @extend .efl-heading-1-hp;
    
            @include text-limit(2);
    
            margin-bottom: 1.6rem;
            max-width: 26.6rem;
          }
          p {
            @extend .efl-p-1;
    
            @include text-limit(3);
    
            letter-spacing: 0.02em;
            margin-bottom: 1.6rem;
          }
          .cta {
            width: 100%;
            max-width: 26.3rem;
            border: none;
            line-height: 1.8rem;
            letter-spacing: 0.02em;
            font-weight: 500;
            &:hover {
              background-color: $white;
              color: $red;
            }
          }
        }
    
        &--details {
          display: grid;
          grid-template-columns: 1fr 1fr;
          margin-top: 3.4rem;
          p {
            display: flex !important;
            align-items: center !important;
            &:first-child {
              padding-right: 1.6rem;
              border-right: 0.1rem solid $grey-light;
            }
            &:last-child {
              padding-left: 1.6rem;
            }
    
            &.minutes {
              @extend .efl-p-1;
    
              letter-spacing: -0.01em;
              &::before {
                content: '';
                display: inline-block;
                background: url('./assets/images/time.svg') no-repeat center;
                background-size: contain;
                width: 2rem;
                height: 2.3rem;
                margin-right: 0.8rem;
              }
            }
    
            &.quizzes {
              @extend .efl-p-1;
    
              letter-spacing: -0.01em;
              &::before {
                content: '';
                display: inline-block;
                background: url('./assets/images/quiz.svg') no-repeat center;
                background-size: contain;
                width: 2rem;
                height: 2.2rem;
                margin-right: 0.8rem;
              }
            }
          }
        }
      }
    
      &__wrapper {
        height: 57rem;
        transition: height 0.8s cubic-bezier(0.83, 0, 0.17, 1);
        overflow: hidden;
        &::before {
          content: '';
          background: url('./assets/images/bundled-learning-shape-mob-1.png')
            no-repeat right top;
          position: absolute;
          display: block;
          width: 37.7rem;
          height: 32.4rem;
          z-index: 1;
          right: 0;
          top: 0;
          transform: translateY(0);
          transition: transform 0.8s linear;
        }
        &::after {
          content: '';
          background: url('./assets/images/bundled-learning-shape-mob-2.png')
            no-repeat left bottom;
          position: absolute;
          display: block;
          width: 31.6rem;
          height: 27.2rem;
          left: 0;
          bottom: 0;
          z-index: 1;
          pointer-events: none;
          transform: translateY(0);
          transition: transform 0.8s linear;
        }
    
        &.enlarged-image {
          height: 100vh;
          position: fixed;
          top: 0;
          left: 0;
          right: 0;
          bottom: 0;
          z-index: 110;
          &::before {
            transform: translateY(-100%);
            transition: transform 0.8s linear;
          }
          &::after {
            transform: translateY(100%);
            transition: transform 0.8s linear;
          }
          .promo-background {
            filter: blur(1px);
          }
          .progress-bar-line {
            opacity: 1;
            transition: opacity 0.8s;
            transition-delay: 1.5s;
          }
          .close-btn {
            opacity: 1;
            transition: opacity 0.8s;
            transition-delay: 1.5s;
          }
        }
    
        picture {
          .promo-background {
            position: absolute;
            height: 100%;
            z-index: 0;
            top: 0;
            left: 0;
            right: 0;
            width: 100%;
            object-fit: cover;
          }
        }
      }
    
      .progress-bar-line {
        width: 100%;
        height: 0.5rem;
        background-color: $grey-light;
        border-radius: 1rem;
        position: relative;
        left: 0;
        bottom: 0;
        display: block;
        opacity: 0;
    
        span {
          height: 0.2rem;
          background-color: $red;
          border-radius: 1rem;
          position: absolute;
          left: 0;
          bottom: 0;
          z-index: 1;
          display: inline-block;
        }
      }
    
      progress {
        background-color: $grey-light;
    
        &::-webkit-progress-bar {
          background-color: $grey-light;
        }
    
        &::-webkit-progress-value {
          background-color: $red;
          transition: width ease-in 0.3s;
        }
    
        &::-moz-progress-bar {
          background-color: $red;
          transition: all ease-in 0.3s;
        }
      }
    
      &__questions {
        position: absolute;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        color: $white;
        overflow: hidden;
        &--container {
          position: relative;
          .close-btn {
            content: '';
            cursor: pointer;
            display: block;
            position: absolute;
            width: 4rem;
            height: 4rem;
            top: 2.3rem;
            right: 3.2rem;
            background: url('./assets/images/close-onboard.svg') no-repeat;
            background-size: cover;
            border: none;
            border-radius: 50%;
            z-index: 2;
            opacity: 0;
          }
        }
        &--list {
          display: flex;
          position: relative;
          flex-direction: column;
          justify-content: center;
          align-items: center;
          padding: 0 3.2rem;
          background-repeat: no-repeat;
          background-position: left bottom;
          opacity: 0;
          transform: translateY(100%);
          transition: all 0.8s linear;
    
          &.expanded {
            min-height: calc(100vh - 1.1rem);
            opacity: 1;
            transform: translateY(0);
            transition: all 0.8s linear;
            &::after {
              filter: blur(2px);
            }
          }
    
          .glide-carousel__pagination {
            margin-top: 2.4rem;
            padding-bottom: 3.2rem;
          }
    
          .all-questions {
            position: relative;
            max-height: 100vh;
    
            .question {
              color: $white;
              display: flex;
              align-items: center;
    
              @extend .efl-heading-3;
    
              span {
                background: url('./assets/images/arrow-next-white.svg') no-repeat
                  center right;
                display: inline-block;
                padding-right: 2.4rem;
                font-size: 1.8rem;
                line-height: 1.6rem;
                margin-right: 0.8rem;
              }
            }
            .info {
              @extend .efl-p-small;
    
              color: $grey-light;
              margin-bottom: 1.6rem;
            }
    
            &__questions-sector {
              display: flex;
              flex-direction: column;
              justify-content: space-between;
            }
    
            &__single {
              display: flex;
              flex-direction: column;
              justify-content: center;
              min-height: 100vh;
              transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
              &__index {
                font-family: $text-font-ef;
                text-transform: uppercase;
                color: $grey-light;
                margin-bottom: 1.6rem;
    
                @extend .efl-category-title;
              }
              &--answers {
                position: relative;
                input[type='checkbox'] {
                  position: absolute;
                  width: 1.8rem;
                  height: 1.8rem;
                  top: 0.5rem;
                  left: 1.3rem;
                  border: 0.1rem solid $light-blue;
                  -webkit-appearance: none;
                  appearance: none;
                }
                input[type='checkbox']:checked {
                  background-image: url('./assets/images/bundle-tick-option-icon.svg');
                  background-position: center;
                  background-repeat: no-repeat;
                  background-size: contain;
                  border: none;
                }
                input[type='radio'] {
                  display: none;
                }
                input[type='radio'] + label {
                  padding-left: 1.2rem;
                }
                label {
                  display: flex;
                  align-items: center;
                  justify-content: center;
                  text-align: center;
                  padding: 0.4rem 1.2rem;
                  border: 0.2rem solid $white;
                  border-radius: 0.4rem;
                  margin-bottom: 0.8rem;
                  padding-left: 4rem;
                  transition: background-color 0.2s ease-in-out;
                  cursor: pointer;
    
                  @extend .efl-p-medium;
                }
                input:checked + label {
                  background-color: $white;
                  color: $blue;
                }
              }
              &--options {
                display: flex;
                flex-direction: column;
                width: auto;
                max-width: none;
    
                .cta.personalisationNext {
                  height: 4.4rem;
                  max-width: none;
                  width: 100%;
                  border: none;
                  border-radius: 0.2rem;
                  margin-top: 1.6rem;
    
                  @extend .efl-p-small;
                  &:hover {
                    background-color: $white;
                    color: $blue;
                  }
                  &:disabled,
                  &[aria-disabled='true'] {
                    background-color: rgba(236, 238, 243, 0.5);
                    color: $white;
                    cursor: default;
                    &:hover {
                      background-color: rgba(236, 238, 243, 0.5);
                      color: $white;
                    }
                  }
                }
              }
              &--alert {
                display: none;
                align-items: center;
                max-width: fit-content;
                border-radius: 0.4rem;
                padding: 0.6rem 2.3rem 0.6rem 1.6rem;
                background-color: $white;
                color: $blue;
                line-height: 2.4rem;
                letter-spacing: 0;
    
                @extend .efl-heading-6;
    
                &.active {
                  display: flex;
                  margin: 1.6rem 0 2.4rem 0;
                }
                &::before {
                  content: '';
                  display: block;
                  background: url('./assets/images/alert-icon.svg') no-repeat center;
                  width: 1.8rem;
                  height: 1.8rem;
                  margin-right: 1rem;
                }
              }
            }
    
            &__feedback {
              display: flex;
              flex-direction: column;
              justify-content: center;
              text-align: center;
              width: 100%;
              max-width: 50.1rem;
              margin: 0 auto;
              min-height: 100vh;
              &--right-icon {
                width: 9.6rem;
                height: 9.6rem;
                margin: 0 auto;
                margin-bottom: 1.6rem;
              }
              &--wrong-icon {
                width: 9.6rem;
                height: 9.6rem;
                margin: 0 auto;
                margin-bottom: 1.6rem;
              }
              .feedback {
                color: #fff;
                margin-bottom: 0.8rem;
    
                @extend .efl-heading-2;
              }
              p {
                color: #b7c5e9;
                margin-bottom: 1.6rem;
    
                @extend .efl-p-medium;
              }
              .feedbackNext {
                margin: 0 auto;
                width: 100%;
                max-width: 31.1rem;
                border: none;
                &:hover {
                  color: $crest-blue;
                  background-color: $white;
                }
              }
            }
    
            &__video-wrap {
              iframe {
                width: 100%;
                height: calc(56.25vw);
              }
            }
            &__video-poster {
              display: none;
            }
            &__player {
              display: none;
            }
            &__video-thumbnail {
              button {
                display: block;
                position: relative;
                border: none;
                background: transparent;
                cursor: pointer;
                width: 100%;
                padding: 0;
                &::after {
                  content: '';
                  background: url(./assets/images/bundled-play-button.svg) no-repeat
                    center;
                  display: block;
                  position: absolute;
                  left: 0;
                  width: 5.2rem;
                  height: 5.2rem;
                  bottom: 0;
                  border: 0;
                  border-radius: 0;
                }
                img {
                  width: 100%;
                  object-fit: cover;
                }
              }
            }
    
            .question-video {
              .all-questions__single--section {
                max-width: none;
              }
              .all-questions__questions-sector {
                flex-direction: column;
              }
              .all-questions__question-wrap {
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                max-width: none;
              }
            }
          }
    
          &__navigation {
            display: flex;
            flex-direction: column;
            justify-content: space-between;
            max-width: 87.3rem;
            width: 100%;
            margin-top: 1.6rem;
            &--up-down {
              position: initial;
              display: flex;
              margin-top: 0.2rem;
              button {
                height: 4.2rem;
                width: 4.2rem;
                border: 0.2rem solid $white;
                border-radius: 0.4rem;
                background-color: rgba(255, 255, 255, 0.1);
                background-image: url('./assets/images/caret-white.svg');
                background-repeat: no-repeat;
                background-position: center;
                background-size: 1.1rem 0.6rem;
                cursor: pointer;
                &:hover {
                  background-color: rgba(183, 197, 233, 0.5);
                }
                &[aria-disabled='true'] {
                  border: none;
                  background-color: rgba($light-blue, 0.5);
                  cursor: default;
                }
              }
              .previous {
                margin-right: 0.8rem;
                transform: rotate(180deg);
              }
            }
    
            .cta.personalisationNext {
              height: 4.4rem;
              max-width: none;
              width: 100%;
              border: none;
              border-radius: 0.2rem;
              font-weight: 700;
    
              @extend .efl-p-small;
              &:hover {
                background-color: $white;
                color: $blue;
              }
              &:disabled,
              &[aria-disabled='true'] {
                background-color: rgba(236, 238, 243, 0.5);
                color: $white;
                cursor: default;
                &:hover {
                  background-color: rgba(236, 238, 243, 0.5);
                  color: $white;
                }
              }
            }
          }
    
          .all-questions,
          .bundled-learning-promo__questions--list__navigation {
            max-width: 87.5rem;
            width: 100%;
            z-index: 99;
          }
        }
      }
    
      &.quiz {
        .bundled-learning-promo__overlay--wrapper h2 {
          font-size: 8rem;
          line-height: 7rem;
        }
      }
    
      @media screen and (min-width: $mq-medium) {
        min-height: 44rem;
        &__questions {
          &--container {
            .close-btn {
              top: 5.9rem;
              right: 5.6rem;
              width: 5.1rem;
              height: 5.1rem;
            }
          }
          &--list {
            &__navigation {
              flex-direction: row;
              button {
                margin-left: auto;
              }
              .cta.personalisationNext {
                max-width: 37.3rem;
              }
            }
          }
        }
    
        .progress-bar-line {
          height: 1.1rem;
        }
    
        &__sign-in {
          grid-template-columns: 1fr 1fr;
    
          &__content {
            align-items: start;
            justify-content: center;
            display: flex;
            flex-direction: column;
            h2,
            h3 {
              font-weight: 700;
              font-size: 4.2rem;
              line-height: 4rem;
              margin-bottom: 0.9rem;
            }
            p {
              font-size: 2rem;
              line-height: 3.2rem;
              letter-spacing: 0;
              margin-bottom: 1.1rem;
            }
          }
    
          &__cards {
            overflow-x: unset;
            justify-content: center;
            margin-right: 0;
          }
    
          &--inner {
            flex-direction: row;
          }
    
          &--inner.benefits {
            min-height: 32.2rem;
            > div:last-child {
              display: flex;
              flex-direction: column;
              align-items: center;
              padding-top: 3.2rem;
              gap: 3.2rem;
            }
          }
    
          &__registration {
            flex-direction: column;
            gap: 2.6rem;
    
            &--links {
              .cta {
                min-width: 37.3rem;
              }
            }
          }
        }
    
        &__overlay {
          height: 44rem;
          max-width: 82.7rem;
          &--wrapper {
            h2 {
              max-width: 100%;
            }
            p {
              @include text-limit(2);
    
              font-size: 2rem;
              line-height: 3.2rem;
            }
            .cta {
              width: 100%;
              max-width: 27rem;
            }
          }
          &--details {
            p {
              &:first-child {
                padding-right: 2.4rem;
              }
              &:last-child {
                padding-left: 2.4rem;
              }
            }
          }
        }
    
        .all-questions {
          .question {
            font-weight: 700;
            font-size: 4.2rem;
            line-height: 4rem;
            margin-bottom: 0.8rem;
          }
          .info {
            font-size: 1.8rem;
            letter-spacing: 0.02em;
          }
          &__questions-sector {
            flex-direction: row;
          }
          &__question-wrap {
            width: 100%;
            max-width: 37.3rem;
          }
          &__single {
            &__index {
              line-height: 2rem;
            }
            &--answers {
              input[type='checkbox'] {
                top: 1rem;
              }
              label {
                font-size: 2rem;
                line-height: 3.2rem;
              }
            }
            &--options {
              width: 100%;
              max-width: 37.3rem;
    
              .cta.personalisationNext {
                max-width: 37.3rem;
              }
            }
            &--section {
              width: 100%;
              max-width: 44.6rem;
              display: flex;
              flex-direction: column;
              justify-content: center;
            }
          }
    
          &__video-wrap {
            width: 46.1rem;
            height: 27.2rem;
            margin-right: 2rem;
            iframe {
              width: 46.1rem;
              height: 27.2rem;
            }
          }
    
          .question-video {
            .all-questions__question-wrap {
              flex-direction: row;
            }
            .bundled-learning-promo__questions--list__navigation {
              margin-top: 3.8rem;
            }
          }
        }
    
        &__wrapper {
          height: 44rem;
          &::before {
            content: '';
            background: url('./assets/images/bundled-learning-shape-desk-1.png')
              no-repeat right top;
            width: 61.4rem;
            height: 44rem;
          }
          &::after {
            content: '';
            background: url('./assets/images/bundled-learning-shape-desk-2.png')
              no-repeat left center;
            width: 60.8rem;
            height: 44rem;
          }
        }
    
        &.onboarding {
          .bundled-learning-promo__overlay--wrapper img {
            width: 12rem;
            height: 12rem;
          }
        }
    
        &.quiz {
          .bundled-learning-promo__overlay--wrapper h2 {
            font-size: 9rem;
            line-height: 9.5rem;
            text-transform: uppercase;
          }
          .bundled-learning-promo__overlay--wrapper img {
            margin-bottom: 1.2rem;
          }
        }
      }
    
      @media screen and (max-width: 819px) {
        &__questions {
          &--list {
            .all-questions {
              &__single {
                position: relative;
              }
              .question-video {
                .all-questions__video-wrap {
                  margin-bottom: 2.4rem;
                }
              }
            }
            &__navigation {
              &--up-down {
                position: absolute;
                right: 0;
                order: 1;
                margin-top: 2.8rem;
                justify-content: end;
              }
            }
          }
        }
    
        &__sign-in {
          position: relative;
          padding-top: 7rem;
        }
    
        &.quiz {
          .bundled-learning-promo__overlay--wrapper p:first-of-type {
            font-size: 1.8rem;
          }
        }
      }
    }
    
  • URL: /components/raw/bundled-learning-promo/bundled-learning-promo.scss
  • Filesystem Path: src/library/components/bundled-learning-promo/bundled-learning-promo.scss
  • Size: 23.2 KB
<section class="bundled-learning-promo {{promo-type}}" id="bundled-learning-promo"
    data-behavior="bundled-learning-promo" data-redirect-url="/components/preview/efl-bundle-recommendations"
    data-fanid="76667" data-bundle-id="11112" data-article-id="221211"
    data-quiz-redirect-url="/components/preview/efl-bundled-learning-quiz-results">
    <div class="bundled-learning-promo__wrapper">

        <picture>
            <source media="(max-width: 819px)" srcset="{{smallimage}}">
            <source media="(min-width: 820px)" srcset="{{bigimage}}">
            <img src="{{bigimage}}" class="promo-background" alt="">
        </picture>

        <div class="bundled-learning-promo__overlay">
            <div class="bundled-learning-promo__overlay--wrapper">
                <img src="/assets/example-content/logo-trophy.svg" alt="">
                <h2>{{title}}</h2>
                <p>{{copy}}</p>
                <button class="cta cta--efl  bundled-learning-promo-start" aria-label="start the bundle {{promo-type}}">start</button>
                {{#if timequiz}}
                <div class="bundled-learning-promo__overlay--details">
                    <p class="minutes">2 - Minutes</p>
                    <p class="quizzes">6 - Quizzes</p>
                </div>
                {{/if}}
            </div>
        </div>

        <div class="bundled-learning-promo__questions" role="dialog" aria-modal="true">
            <div class="bundled-learning-promo__questions--container">
                <progress value="1" class="progress-bar-line"></progress>
                <button class="close-btn" tabindex="-1" aria-label="close bundle {{promo-type}}">
                    <span class="visually-hidden">Close dialog</span>
                </button>
                <div class="bundled-learning-promo__questions--list">
                    <div class="all-questions">

                        {{#each questions-list}}
                        <div class="all-questions__single {{#if video}}question-video{{/if}}">
                            <div class="all-questions__questions-sector">
                                <div class="all-questions__single--section">
                                    <div class="all-questions__single__index">Question 01/02</div>
                                    <div class="question" data-question-id="8421c03d-7ef5-4a61-995f-c83ed1fdb8d4">
                                        {{question}}</div>
                                    <p class="info">{{answer-tip}}</p>
                                    <div class="all-questions__single--alert" role="alert">Please select a single answer</div>
                                </div>
                                <div class="all-questions__question-wrap">
                                    {{#if video}}
                                    <div class="all-questions__video-wrap" data-video-type="{{type}}"
                                        data-video-id="{{videoId}}">
                                        <div class="all-questions__video-poster">
                                            <img src="/assets/example-content/video-error-poster.jpg" alt="error-video"
                                                loading="lazy" />
                                        </div>
                                        <div class="all-questions__video-thumbnail">
                                            <button tabindex="0" aria-label="play {{type}} video player">
                                                {{#unless no-thumbnail}}
                                                <img src="/assets/example-content/quiz-video-thumbnail.jpg" alt=""
                                                    loading="lazy" />
                                                {{/unless}}
                                            </button>
                                        </div>
                                        <div id="all-questions" class="all-questions__player"></div>
                                    </div>
                                    {{/if}}
                                    <ul class="all-questions__single--options"
                                        data-answer='[ "{{correct-answer.firstAnswer}}", "{{correct-answer.secondAnswer}}" ]'>
                                        {{#each answers}}
                                        <div class="all-questions__single--answers"
                                            data-answer-id="3979cd44-76b6-4013-8e67-858ba0d0e9c4">
                                            {{#if ../multi-answer}}
                                            <input name="{{name}}" type="checkbox" class="multi-answer" id="{{id}}"
                                                value="{{value}}" tabindex="-1">
                                            {{/if}}
                                            {{#unless ../multi-answer}}
                                            <input name="{{name}}" type="radio" class="single-answer" id="{{id}}"
                                                value="{{value}}" tabindex="-1">
                                            {{/unless}}
                                            <label for="{{id}}">{{value}}</label>
                                        </div>
                                        {{/each}}
                                        {{#if video}}
                                        <button class="cta cta--efl  personalisationNext" id="next-cta" aria-disabled="true"
                                            aria-label="Next Question" data-cta-text="Next">Next</button>
                                        {{/if}}
                                    </ul>
                                </div>
                            </div>
                            <div class="bundled-learning-promo__questions--list__navigation">
                                <div class="bundled-learning-promo__questions--list__navigation--up-down">
                                    <button aria-disabled="true" class="previous" aria-label="previous Question"></button>
                                    <button aria-disabled="true" class="next" aria-label="Next Question"></button>
                                </div>
                                {{#unless video}}
                                <button class="cta cta--efl  personalisationNext" id="next-cta" aria-disabled="true"
                                    aria-label="Next Question" data-cta-text="Next">Next</button>
                                {{/unless}}
                            </div>
                        </div>

                        {{#if answer-feedback}}
                        <div class="all-questions__feedback-container">
                            <div class="all-questions__feedback right-feedback">
                                <canvas class="all-questions__feedback--right-icon" width="96" height="96"></canvas>
                                <div class="feedback">That's right.</h3>
                                <p>Young players often use their laces to finish. This is because it's an easy
                                    way to generate a lot of power. </p>
                                <button class="cta cta--efl  feedbackNext" id="next-cta" aria-label="Next Question"
                                    data-cta-text="Next" data-last-cta="See my results">Next</button>
                            </div>
                            <div class="all-questions__feedback wrong-feedback">
                                <canvas class="all-questions__feedback--wrong-icon" width="96" height="96"></canvas>
                                <div class="feedback">Not Quite.</div>
                                <p>Young players often use their laces to finish. This is because it's an easy
                                    way to generate a lot of power. </p>
                                <button class="cta cta--efl  feedbackNext" id="next-cta" aria-label="Next Question"
                                    data-cta-text="Next" data-last-cta="See my results">Next</button>
                            </div>
                        </div>
                        {{/if}}
                        {{/each}}

                        <div class="bundled-learning-promo__sign-in benefits">
                            <div class="bundled-learning-promo__sign-in--inner benefits">
                                <div class="bundled-learning-promo__sign-in__content">
                                    <h3 class="title">In order to see your results, you can sign up or sign in</h3>
                                    <p class="copy">Benefits of creating your own personalised experience</p>
                                    <ul>
                                        <li>Content you care about</li>
                                        <li>Sessions tailored to your team</li>
                                        <li>Course information and alerts</li>
                                    </ul>
                                </div>
                                <div class="bundled-learning-promo__sign-in__registration">
                                    <div class="bundled-learning-promo__sign-in__registration--links">
                                        {{render '@cta--efl' sign-up-cta merge=true}}
                                        {{render '@cta--secondary' sign-in-cta merge=true}}
                                    </div>
                                </div>
                            </div>
                            <div class="bundled-learning-promo__questions--list__navigation">
                                <div class="bundled-learning-promo__questions--list__navigation--up-down">
                                    <button aria-disabled="true" class="previous" aria-label="previous Question"></button>
                                    <button aria-disabled="false" class="next" aria-label="Next Question"></button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
</section>