<div class="efl-learner-profile-onboarding-journey hidden" role="dialog" aria-modal="true" data-behavior="efl-learner-profile-onboarding-journey" data-onboarding-journey="false">
    <div class="efl-learner-profile-onboarding-journey__wrapper">
        <picture>
            <source media="(max-width: 819px)" srcset="/assets/example-content/learner-profile-onboarding-journey-1.jpg">
            <source media="(min-width: 820px)" srcset="/assets/example-content/learner-profile-onboarding-journey-2.jpg">
            <img class="bg-image" src="/assets/example-content/learner-profile-onboarding-journey-2.jpg" alt="" loading="lazy">
        </picture>
        <div class="efl-learner-profile-onboarding-journey__overlay first-step">
            <div class="efl-learner-profile-onboarding-journey__overlay--wrapper">
                <h4 class="welcome">Welcome</h4>
                <h2 class="name">Anthony Kelly</h2>
                <!-- <img src="/assets/example-content/onboarding-journey-ball.svg"/> -->
                <canvas id="onboarding-journey-football-animation" width="400" height="135"></canvas>
                <div class="loading-bar"><span></span></div>
                <p data-text-default="Loading your Account <br> Please bare with us. Won’t take long." data-lost-connection="Lost connection">
                    Loading your Account <br> Please bare with us. Won’t take long.
                </p>
                <a href="/" class="cta cta--primary  tryAgain hidden" tabindex="0">Try again</a>

            </div>
        </div>
        <div class="efl-learner-profile-onboarding-journey__overlay carousel-step hidden">
            <div data-glide-el="track">
                <div class="glide__slides">
                    <div class="carousel-skip-step">
                        <div class="step-info">
                            <h2>Your Learner Bio</h2>
                            <p>Small description to give context of this particular area of the account.</p>
                            <button class="cta cta--primary  nextStep" aria-label="Your Learner Bio next">Next</button>
                            <button class="skip-journey" aria-label="Your Learner Bio skip">Skip</button>
                        </div>
                        <div class="carousel-skip-step__player-wrap">
                            <picture>
                                <source media="(max-width: 819px)" srcset="/assets/example-content/onboading-journey-bio-mob.png">
                                <source media="(min-width: 820px)" srcset="/assets/example-content/onboading-journey-bio-desk.png">
                                <img src="/assets/example-content/onboading-journey-bio-desk.png" alt="" loading="lazy">
                            </picture>
                        </div>
                    </div>
                    <div class="carousel-skip-step">
                        <div class="step-info">
                            <h2>Your FA Learnings</h2>
                            <p>Small description to give context of this particular area of the account.</p>
                            <button class="cta cta--primary  nextStep" aria-label="Your FA Learnings next">Next</button>
                            <button class="skip-journey" aria-label="Your FA Learnings skip">Skip</button>
                        </div>
                        <div class="carousel-skip-step__player-wrap">
                            <picture>
                                <source media="(max-width: 819px)" srcset="/assets/example-content/onboading-journey-mylearning-mob.png">
                                <source media="(min-width: 820px)" srcset="/assets/example-content/onboading-journey-mylearning-desk.png">
                                <img src="/assets/example-content/onboading-journey-mylearning-desk.png" alt="" loading="lazy">
                            </picture>
                        </div>
                    </div>
                    <div class="carousel-skip-step">
                        <div class="step-info">
                            <h2>Your FA Bookmarks</h2>
                            <p>Small description to give context of this particular area of the account.</p>
                            <button class="cta cta--primary  nextStep" aria-label="Your FA Bookmarks next">Next</button>
                            <button class="skip-journey" aria-label="Your FA Bookmarks skip">Skip</button>
                        </div>
                        <div class="carousel-skip-step__player-wrap">
                            <picture>
                                <source media="(max-width: 819px)" srcset="/assets/example-content/onboading-journey-bookmark-mob.png">
                                <source media="(min-width: 820px)" srcset="/assets/example-content/onboading-journey-bookmark-desk.png">
                                <img src="/assets/example-content/onboading-journey-bookmark-desk.png" alt="" loading="lazy">
                            </picture>
                        </div>
                    </div>
                    <div class="carousel-skip-step">
                        <div class="step-info">
                            <h2>Your Bundles</h2>
                            <p>Small description to give context of this particular area of the account.</p>
                            <button class="cta cta--primary  nextStep" aria-label="Your Bundles next">Next</button>
                            <button class="skip-journey" aria-label="Your Bundles skip">Skip</button>
                        </div>
                        <div class="carousel-skip-step__player-wrap">
                            <picture>
                                <source media="(max-width: 819px)" srcset="/assets/example-content/onboading-journey-bundle-mob.png">
                                <source media="(min-width: 820px)" srcset="/assets/example-content/onboading-journey-bundle-desk.png">
                                <img src="/assets/example-content/onboading-journey-bundle-desk.png" alt="" loading="lazy">
                            </picture>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

No notes defined.

{
  "smallimage": "/assets/example-content/learner-profile-onboarding-journey-1.jpg",
  "bigimage": "/assets/example-content/learner-profile-onboarding-journey-2.jpg",
  "try-again-cta": {
    "copy": "Try again",
    "additionalClass": "tryAgain hidden"
  },
  "skip-video": [
    {
      "title": "Your Learner Bio",
      "copy": "Small description to give context of this particular area of the account.",
      "desktop-image": "/assets/example-content/onboading-journey-bio-desk.png",
      "mobile-image": "/assets/example-content/onboading-journey-bio-mob.png",
      "next-step-cta": {
        "copy": "Next",
        "additionalClass": "nextStep"
      }
    },
    {
      "title": "Your FA Learnings",
      "copy": "Small description to give context of this particular area of the account.",
      "desktop-image": "/assets/example-content/onboading-journey-mylearning-desk.png",
      "mobile-image": "/assets/example-content/onboading-journey-mylearning-mob.png",
      "next-step-cta": {
        "copy": "Next",
        "additionalClass": "nextStep"
      }
    },
    {
      "title": "Your FA Bookmarks",
      "copy": "Small description to give context of this particular area of the account.",
      "desktop-image": "/assets/example-content/onboading-journey-bookmark-desk.png",
      "mobile-image": "/assets/example-content/onboading-journey-bookmark-mob.png",
      "next-step-cta": {
        "copy": "Next",
        "additionalClass": "nextStep"
      }
    },
    {
      "title": "Your Bundles",
      "copy": "Small description to give context of this particular area of the account.",
      "desktop-image": "/assets/example-content/onboading-journey-bundle-desk.png",
      "mobile-image": "/assets/example-content/onboading-journey-bundle-mob.png",
      "next-step-cta": {
        "copy": "Next",
        "additionalClass": "nextStep"
      }
    }
  ]
}
  • Content:
    import Glide from '@glidejs/glide';
    import { Rive, Fit, Layout } from '@rive-app/canvas';
    
    export default parentElement => {
      const { onboardingJourney } = parentElement.dataset;
      const slides = parentElement.querySelectorAll('.glide__slides > *');
      const loader = parentElement.querySelector('.loading-bar > span');
      let loaderPercentage = 0;
      const firstStep = parentElement.querySelector('.first-step');
      const carouselStep = parentElement.querySelector('.carousel-step');
      const skipLinks = carouselStep.querySelectorAll('.skip-journey');
      const tryAgainCta = parentElement.querySelector('.tryAgain');
      const copyText = firstStep.querySelector('p');
      const { textDefault, lostConnection } = copyText.dataset;
      let glide;
      const profileTabPanels = document.querySelectorAll(
        '.efl-page-content-subpage[data-page]'
      );
      const MOBILE_BREAKPOINT = 820;
    
      document.addEventListener('readystatechange', () => {
        if (onboardingJourney === 'true') {
          profileTabPanels.forEach(panel => {
            panel.classList.add('onboarding-loading');
          });
        } else {
          profileTabPanels.forEach(panel => {
            panel.classList.remove('onboarding-loading');
          });
        }
      });
    
      async function createPlayerProfileCallback() {
        const url = `/Personalise/CreatePlayerProfile`;
        // eslint-disable-next-line compat/compat
        const response = await fetch(url, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
          },
        });
    
        return response.json();
      }
      function createPlayerProfile() {
        try {
          tryAgainCta.classList.add('hidden');
          copyText.innerHTML = textDefault;
          createPlayerProfileCallback().then(response => {
            if (response && response.isFirstTimeVisit) {
              setTimeout(() => {
                firstStep.classList.add('hidden');
                carouselStep.classList.remove('hidden');
                parentElement.classList.add('ajax-completed');
    
                const bulletContainer = parentElement.querySelector(
                  '.efl-learner-profile-onboarding-journey__bullets'
                );
                const firstpip = bulletContainer.firstElementChild;
    
                firstpip.focus();
    
                // profile completion notification
                const notification = document.querySelector(
                  '.efl-global-notifications.priority-3'
                );
    
                if (notification) {
                  const notifyBell = document.querySelector(
                    '.global-site-navigation__level1.site-notification'
                  );
    
                  notifyBell.classList.add('new');
                  notification.classList.remove('hidden');
                }
    
                glide.update({
                  autoplay: 10000,
                });
              }, 1000);
            }
          });
        } catch (e) {
          tryAgainCta.classList.remove('hidden');
          copyText.innerHTML = lostConnection;
          throw new Error('Unable to create profile ::', e);
        }
      }
    
      if (onboardingJourney === 'true') {
        parentElement.classList.remove('hidden');
        skipLinks.forEach(link => {
          link.addEventListener('click', e => {
            e.preventDefault();
            parentElement.classList.add('hidden');
            profileTabPanels.forEach(panel => {
              panel.classList.remove('onboarding-loading');
            });
          });
        });
        tryAgainCta.addEventListener('click', e => {
          e.preventDefault();
          createPlayerProfile();
        });
        createPlayerProfile();
      }
    
      const defaultOptions = {
        perView: 1,
        autoplay: false,
        animationDuration: '600',
        animationTimingFunc: 'cubic-bezier(0.16, 1, 0.3, 1)',
        hoverpause: false,
        type: 'slider',
        gap: 0,
      };
    
      // Rive
      const footballCanvas = parentElement.querySelector(
        '#onboarding-journey-football-animation'
      );
    
      const lyout = new Layout({
        fit: Fit.Cover,
      });
    
      const riveAnimation = new Rive({
        src: '/assets/example-content/learner_profile_onboarding.riv',
        canvas: footballCanvas,
        layout: lyout,
        onLoad: () => {
          riveAnimation.resizeDrawingSurfaceToCanvas();
        },
      });
    
      riveAnimation.play('Load in');
      riveAnimation.play('Ball spin');
    
      const timer = setInterval(() => {
        if (loaderPercentage < 100) {
          loaderPercentage += 1;
          loader.style.width = `${loaderPercentage}%`;
        } else {
          clearInterval(timer);
        }
      }, 100);
    
      glide = new Glide(parentElement, { ...defaultOptions });
      const bulletContainer = document.createElement('div');
    
      bulletContainer.classList.add(
        'efl-learner-profile-onboarding-journey__bullets'
      );
      bulletContainer.dataset.glideEl = 'controls[nav]';
    
      slides.forEach((slide, index) => {
        const button = document.createElement('button');
    
        button.dataset.glideDir = `=${index}`;
        if (!index) {
          button.ariaLabel = `Onboarding Journey Page - ${index + 1} active`;
        } else {
          button.ariaLabel = `Onboarding Journey Page - ${index + 1}`;
        }
        button.style.animationDuration = `${600 / 1000}s`;
        bulletContainer.appendChild(button);
    
        const stepInfo = slide.querySelector('.step-info');
    
        if (stepInfo) {
          const nextCta = stepInfo.querySelector('.cta');
    
          if (nextCta) {
            nextCta.addEventListener('click', event => {
              event.preventDefault();
              const nextSlide = index + 1;
    
              if (nextSlide < slides.length) {
                glide.go(`=${nextSlide}`);
                setTimeout(() => {
                  const firstpip = bulletContainer.firstElementChild;
    
                  firstpip.focus();
                }, 50);
              } else {
                parentElement.classList.add('hidden');
                profileTabPanels.forEach(panel => {
                  panel.classList.remove('onboarding-loading');
                });
              }
            });
    
            nextCta.addEventListener('keydown', event => {
              if (event.keyCode === 13) {
                nextCta.click();
              } else if (event.shiftKey && event.keyCode === 9) {
                setTimeout(() => {
                  const lastpip = bulletContainer.lastElementChild;
    
                  lastpip.focus();
                }, 50);
              }
            });
          }
        }
      });
    
      const alignTitle = () => {
        slides.forEach(slide => {
          const stepInfo = slide.querySelector('.step-info');
    
          if (stepInfo) {
            const nextCta = stepInfo.querySelector('.cta');
            const heading = stepInfo.querySelector('h2');
            const img = slide.querySelector('img');
            const imgWrapper = slide.querySelector(
              '.carousel-skip-step__player-wrap'
            );
    
            if (nextCta) {
              if (window.innerWidth < MOBILE_BREAKPOINT) {
                nextCta.style.top = `${window.innerHeight - 68}px`;
                heading.style.marginTop = `${(window.innerHeight - 510) / 2 - 5}px`;
                if (window.innerHeight <= 700) {
                  img.style.width = `34rem`;
                  imgWrapper.style.left = `calc(50vw - 17rem)`;
                  heading.style.marginTop = `${(window.innerHeight - 510) / 2 -
                    5}px`;
                } else {
                  img.removeAttribute('style');
                  imgWrapper.removeAttribute('style');
                }
              } else {
                nextCta.removeAttribute('style');
                heading.removeAttribute('style');
              }
            }
          }
        });
      };
    
      window.addEventListener('DOMContentLoaded', () => {
        alignTitle();
      });
    
      window.addEventListener('resize', () => {
        alignTitle();
      });
    
      parentElement.querySelector('.carousel-step').appendChild(bulletContainer);
    
      glide.mount();
    
      glide.on('run.after', () => {
        if (glide.index + 1 === slides.length) {
          glide.update({
            autoplay: false,
          });
        }
      });
    
      // Accessiblity Features
      const paginationElements = bulletContainer.querySelectorAll(`button`);
    
      const pipsAccessibility = () => {
        glide.on('run.after', () => {
          paginationElements.forEach(item => {
            if (item.classList.contains('glide__bullet--active')) {
              // eslint-disable-next-line no-param-reassign
              item.ariaSelected = true;
    
              // eslint-disable-next-line no-param-reassign
              const label = item.ariaLabel;
    
              // eslint-disable-next-line no-param-reassign
              item.ariaLabel = `${label} active`;
            } else {
              // eslint-disable-next-line no-param-reassign
              item.ariaSelected = false;
              if (item.ariaLabel) {
                const label = item.ariaLabel.replace(' active', '');
    
                // eslint-disable-next-line no-param-reassign
                item.ariaLabel = `${label}`;
              }
            }
          });
        });
      };
    
      const focuslooponslide = () => {
        const lastpip = bulletContainer.lastElementChild;
    
        lastpip.addEventListener('keydown', e => {
          if (e.shiftKey && e.keyCode === 9) {
            // empty
          } else if (e.keyCode === 9) {
            e.preventDefault();
            slides.forEach(slide => {
              if (slide.classList.contains('glide__slide--active')) {
                slide.querySelector('.nextStep').focus();
              }
            });
          }
        });
      };
    
      pipsAccessibility();
      focuslooponslide();
    
      const tabIndexUpdate = () => {
        slides.forEach(slide => {
          if (slide.classList.contains('glide__slide--active')) {
            if (slide.querySelector('.cta')) {
              slide.querySelector('.cta').setAttribute('tabindex', '0');
            }
            if (slide.querySelector('.skip-journey')) {
              slide.querySelector('.skip-journey').setAttribute('tabindex', '0');
            }
            setTimeout(() => {
              const firstpip = bulletContainer.firstElementChild;
    
              firstpip.focus();
            }, 50);
          } else if (slide.querySelector('.cta')) {
            slide.querySelector('.cta').setAttribute('tabindex', '-1');
            if (slide.querySelector('.skip-journey')) {
              slide.querySelector('.skip-journey').setAttribute('tabindex', '-1');
            }
          }
        });
      };
    
      glide.on('run.before', () => {
        tabIndexUpdate();
      });
    
      glide.on('run.after', () => {
        tabIndexUpdate();
      });
    
      glide.on('build.after', () => {
        tabIndexUpdate();
      });
    
      return glide;
    };
    
  • URL: /components/raw/efl-learner-profile-onboarding-journey/efl-learner-profile-onboarding-journey.js
  • Filesystem Path: src/library/components/efl-learner-profile-onboarding-journey/efl-learner-profile-onboarding-journey.js
  • Size: 10.1 KB
  • Content:
    .efl-learner-profile-onboarding-journey {
      position: fixed;
      z-index: 100;
      width: 100vw;
      height: 100vh;
      left: 0;
      top: 0;
      overflow: hidden;
      .carousel-skip-step {
        position: relative;
      }
      &__wrapper {
        height: 100%;
        background-color: #214c99;
        .bg-image {
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
      }
      &__overlay {
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: $white;
        text-align: center;
        z-index: 2;
        .welcome {
          @extend .efl-heading-4;
    
          margin-bottom: 4px;
        }
        .name {
          @extend .efl-heading-2;
    
          margin-bottom: 2rem;
        }
        canvas {
          margin-bottom: 2.4rem;
          width: 40rem;
          height: 13.5rem;
        }
        .loading-bar {
          width: 13.8rem;
          height: 0.5rem;
          border-radius: 5px;
          background-color: $white;
          display: flex;
          margin: 0 auto;
          margin-bottom: 1.6rem;
          span {
            width: 50%;
            background-color: $red;
            border-radius: 5px;
          }
        }
        p {
          @extend .efl-p-small;
    
          letter-spacing: -0.01em;
          color: $light-blue;
          max-width: 24.8rem;
          margin: 0 auto;
        }
        .cta {
          position: absolute;
          top: calc(100vh - 68px);
          width: 100%;
          max-width: 311px;
          background-color: $red;
          color: $white;
          border-color: $red;
          &:hover {
            background-color: $white;
            color: $red;
            border-color: $red;
          }
          &.tryAgain {
            position: initial;
            margin-top: 2.4rem;
          }
        }
        .step-info {
          position: absolute;
          width: 100%;
          top: 0;
          display: flex;
          white-space: initial;
          margin: 0 auto;
          flex-direction: column;
          text-align: center;
          max-width: 305px;
          left: 0;
          right: 0;
          z-index: 11;
          h2 {
            @extend .efl-heading-2;
    
            margin-bottom: 8px;
            margin-top: calc(50vh - 299px - 4px);
          }
          p {
            @extend .efl-p-medium;
    
            font-weight: 400;
            letter-spacing: 0.02em;
            max-width: 100%;
          }
          .skip-journey {
            @extend .efl-p-small;
    
            position: absolute;
            top: 1.6rem;
            right: 0;
            color: $white;
            text-decoration: none;
            border: none;
            background: none;
            padding: initial;
            cursor: pointer;
          }
        }
        .carousel-skip-step {
          &::after {
            content: '';
            position: absolute;
            bottom: 0;
            height: 167px;
            width: 100%;
            background: linear-gradient(
              180deg,
              rgba(1, 30, 65, 0) 0%,
              rgba(1, 30, 65, 0.7) 63.54%,
              #011e41 100%
            );
            display: flex;
          }
        }
        .carousel-skip-step__player-wrap {
          position: absolute;
          top: initial;
          left: calc(50vw - 18rem);
          overflow: hidden;
          bottom: 0;
          width: 36rem;
          max-width: 36rem;
          img {
            width: 36rem;
            margin-bottom: -1.6rem;
          }
        }
      }
      &__bullets {
        top: 2.5rem;
        display: flex;
        gap: 1.7rem;
        justify-content: space-between;
        left: 50%;
        padding: 0 $spacing-m;
        position: absolute;
        transform: translateX(-50%);
        width: fit-content;
    
        button {
          appearance: none;
          background: $white;
          border: none;
          border-radius: $border-radius;
          cursor: pointer;
          height: 0.6rem;
          width: 0.6rem;
          overflow: hidden;
          padding: 0;
    
          &::after {
            content: '';
            background-color: $white;
            display: block;
            height: 100%;
            width: 0;
          }
        }
      }
      .glide__slides {
        height: 100%;
      }
    
      .glide__bullet--active {
        background: $red;
      }
      [data-glide-el='track'] {
        height: 100%;
      }
    
      @media screen and (min-width: $mq-medium) {
        &__overlay {
          canvas {
            width: 40rem;
            height: 13.5rem;
          }
          .loading-bar {
            width: 19.2rem;
          }
          p {
            font-size: 1.8rem;
            letter-spacing: 0.02em;
          }
          .step-info {
            max-width: 30rem;
            margin: initial;
            margin-left: calc(50vw - 300px - 60px);
            margin-top: calc(50vh - 12.5rem);
            h2 {
              margin-top: 0;
            }
            p {
              font-size: 2rem;
              line-height: 3.2rem;
              letter-spacing: normal;
            }
            .cta {
              font-weight: 500;
              line-height: 1.8rem;
              letter-spacing: 0.02em;
              position: initial;
              margin-top: 1.6rem;
              &::after {
                content: none;
              }
              &:focus {
                border: 0.1rem solid $white;
              }
            }
            .skip-journey {
              position: initial;
              margin-top: 3.2rem;
            }
          }
          .carousel-skip-step {
            &::after {
              display: none;
            }
          }
          .carousel-skip-step__player-wrap {
            position: relative;
            left: calc(50vw - 10px);
            top: calc(50vh - 25rem);
            img {
              max-width: 36rem;
              margin-bottom: 0;
            }
          }
        }
        &__bullets {
          right: calc(50vw + 150px);
          left: initial;
          transform: translateX(0);
          top: calc(50vh - 15.7rem);
        }
      }
    }
    
  • URL: /components/raw/efl-learner-profile-onboarding-journey/efl-learner-profile-onboarding-journey.scss
  • Filesystem Path: src/library/components/efl-learner-profile-onboarding-journey/efl-learner-profile-onboarding-journey.scss
  • Size: 5.3 KB
<div class="efl-learner-profile-onboarding-journey hidden" role="dialog" aria-modal="true" data-behavior="efl-learner-profile-onboarding-journey" data-onboarding-journey="false">
    <div class="efl-learner-profile-onboarding-journey__wrapper">
        <picture>
            <source media="(max-width: 819px)" srcset="{{smallimage}}">
            <source media="(min-width: 820px)" srcset="{{bigimage}}">
            <img class="bg-image" src="{{bigimage}}" alt="" loading="lazy">
        </picture>
        <div class="efl-learner-profile-onboarding-journey__overlay first-step">
            <div class="efl-learner-profile-onboarding-journey__overlay--wrapper">
                <h4 class="welcome">Welcome</h4>
                <h2 class="name">Anthony Kelly</h2>
                <!-- <img src="/assets/example-content/onboarding-journey-ball.svg"/> -->
                <canvas id="onboarding-journey-football-animation" width="400" height="135"></canvas>
                <div class="loading-bar"><span></span></div>
                <p data-text-default="Loading your Account <br> Please bare with us. Won’t take long." data-lost-connection="Lost connection">
                    Loading your Account <br> Please bare with us. Won’t take long. 
                </p>
                {{render '@cta' try-again-cta merge="true"}}
            </div>
        </div>
        <div class="efl-learner-profile-onboarding-journey__overlay carousel-step hidden">
            <div data-glide-el="track">
                <div class="glide__slides">
                    {{#each skip-video}}
                    <div class="carousel-skip-step">
                        <div class="step-info">
                            <h2>{{title}}</h2>
                            <p>{{copy}}</p>
                            <button class="cta cta--primary  nextStep" aria-label="{{title}} next">Next</button>
                            <button class="skip-journey" aria-label="{{title}} skip">Skip</button>
                        </div>
                        <div class="carousel-skip-step__player-wrap">
                            <picture>
                                <source media="(max-width: 819px)" srcset="{{mobile-image}}">
                                <source media="(min-width: 820px)" srcset="{{desktop-image}}">
                                <img src="{{desktop-image}}" alt="" loading="lazy">
                            </picture>
                        </div>
                    </div>
                    {{/each}}
                </div>
            </div>
        </div>
    </div>
</div>
  • Handle: @efl-learner-profile-onboarding-journey
  • Preview:
  • Filesystem Path: src/library/components/efl-learner-profile-onboarding-journey/efl-learner-profile-onboarding-journey.hbs
  • References (1): @cta
  • Referenced by (1): @efl-profile-page