-
Notifications
You must be signed in to change notification settings - Fork 0
[PROD] - Security fixes & clean up #394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| v22.13.1 |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,8 +2,8 @@ import type { AuthUser } from "./auth-user.model" | |
| import type { ProfileCompletionData } from "./profile-completion.model" | ||
|
|
||
| export interface AuthConfig { | ||
| user: AuthUser | ||
| profileCompletionData: ProfileCompletionData | ||
| user?: AuthUser | ||
| profileCompletionData?: ProfileCompletionData | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [❗❗ |
||
| autoFetchUser?: boolean | ||
| ready: boolean | ||
| signIn: () => void | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| @import 'lib/styles/fonts.scss'; | ||
| @use 'lib/styles/fonts.scss' as *; | ||
|
|
||
| .accordionWrap { | ||
| display: flex; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,8 +4,8 @@ | |
| import { getPublicPath } from 'lib/utils/paths'; | ||
| import styles from './Accordion.module.scss'; | ||
| export let activeRoute: NavMenuItem = undefined; | ||
| export let items: NavMenuItem[]; | ||
| export let activeRoute: NavMenuItem | undefined = undefined; | ||
| export let items: NavMenuItem[] = []; | ||
| export let style: 'primary'|'secondary'|undefined = undefined; | ||
| const toggledItems: {[key: string]: boolean} = {}; | ||
|
|
@@ -42,7 +42,13 @@ | |
| {item.label} | ||
| </a> | ||
| {#if item.children?.length} | ||
| <span class={styles.itemTrigger} on:click={() => toggleItem(item)} on:keydown={() => {}}> | ||
| <span | ||
| class={styles.itemTrigger} | ||
| role="button" | ||
| tabindex="0" | ||
| on:click={() => toggleItem(item)} | ||
| on:keydown={(ev) => ev.key === 'Enter' && toggleItem(item)} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| > | ||
| <img src={iconUrl} alt="^" /> | ||
| </span> | ||
| {/if} | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| @import 'lib/styles/fonts.scss'; | ||
| @use 'lib/styles/fonts.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| $btnSize: 32px; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| @import 'lib/styles/fonts.scss'; | ||
| @use 'lib/styles/fonts.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| .btn { | ||
| all: unset; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| @import 'lib/styles/fonts.scss'; | ||
| @use 'lib/styles/fonts.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| .linksMenuWrap { | ||
| display: flex; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,29 +10,29 @@ | |
| export let ref: Element | undefined = undefined; | ||
| export let style: "primary" | "secondary" | "tertiary" | 'cta'; | ||
| export let menuItems: NavMenuItem[]; | ||
| export let activeRoute: NavMenuItem = undefined; | ||
| export let menuItems: NavMenuItem[] = []; | ||
| export let activeRoute: NavMenuItem | undefined = undefined; | ||
| export let activeRoutePath: NavMenuItem[] = []; | ||
| export let vertical: boolean = false; | ||
| export let navigationHandler: NavigationHandler | undefined = undefined; | ||
| let hoveredMenuItem: NavMenuItem = undefined; | ||
| let hoveredElement: HTMLElement = undefined; | ||
| let hoveredMenuItem: NavMenuItem | undefined = undefined; | ||
| let hoveredElement: HTMLElement | undefined = undefined; | ||
| let isPopupMenuActive: boolean = false; | ||
| function isActiveMenu(menuItem: NavMenuItem, activeMenuItem: NavMenuItem) { | ||
| function isActiveMenu(menuItem: NavMenuItem, activeMenuItem?: NavMenuItem) { | ||
| return activeMenuItem?.url !== undefined && menuItem.url === activeMenuItem?.url | ||
| } | ||
| function itemHasHoverMenu(menuItem: NavMenuItem) { | ||
| return menuItem.children?.length || menuItem.description; | ||
| return !!(menuItem.children?.length) || !!menuItem.description; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| } | ||
| const handleMouseover = (menuItem: NavMenuItem) => async (ev) => { | ||
| const handleMouseover = (menuItem: NavMenuItem) => async (ev: Event) => { | ||
| if (!itemHasHoverMenu(menuItem)) { | ||
| return; | ||
| } | ||
| hoveredElement = ev.target; | ||
| hoveredElement = ev.currentTarget as HTMLElement ?? undefined; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| hoveredMenuItem = menuItem; | ||
| }; | ||
|
|
@@ -53,7 +53,7 @@ | |
| if (typeof navigationHandler === 'function') { | ||
| ev.preventDefault() | ||
| navigationHandler({label: '', path: menuItem.url, isMarketingUrl: !!menuItem.marketingPathname}); | ||
| navigationHandler({label: menuItem.label ?? '', path: menuItem.url, isMarketingUrl: !!menuItem.marketingPathname}); | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| @import 'lib/styles/fonts.scss'; | ||
| @use 'lib/styles/fonts.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| .bannerWrap { | ||
| position: relative; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| const closeMenuIcon = getPublicPath(`/assets/icon-close.svg`); | ||
| export let direction: 'x'|'y'; | ||
| export let handleClose = () => {}; | ||
| export let handleClose: () => void = () => {}; | ||
| let animParams: FlyParams = {duration: 200}; | ||
| $: animParams[direction] = direction === 'x' ? -320 : 50; | ||
|
|
@@ -29,7 +29,7 @@ | |
| return () => window.removeEventListener('resize', updateVh); | ||
| }) | ||
| function toggleOverflow(toggle) { | ||
| function toggleOverflow(toggle: boolean) { | ||
| Object.assign(document.body.style, {overflow: toggle ? 'hidden' : ''}); | ||
| window.scrollTo(0, 0); | ||
| } | ||
|
|
@@ -43,7 +43,7 @@ | |
|
|
||
| <div class={styles.mobileMenuWrap} transition:fade={{duration: 200}}> | ||
| <TopNavbar style="primary" showLogo={false}> | ||
| <div class={styles.closeIcon} slot="right" on:click={handleClose} on:keydown={() => {}}> | ||
| <div class={styles.closeIcon} role="button" tabindex="0" slot="right" on:click={handleClose} on:keydown={() => {}}> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| <img src={closeMenuIcon} alt="close" /> | ||
| </div> | ||
| </TopNavbar> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,13 +86,13 @@ | |
| * Remove the targetKey & mouse event listeners | ||
| * @param el | ||
| */ | ||
| function unBindEvents(el: HTMLElement = targetEl) { | ||
| function unBindEvents(el: HTMLElement | undefined = targetEl) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| if (!el) { | ||
| return | ||
| } | ||
| el.dataset.targetKey = undefined | ||
| delete el.dataset.targetKey | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| el.removeEventListener('mouseenter', handleMouseover) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| @import 'lib/styles/mixins.scss'; | ||
| @import 'lib/styles/fonts.scss'; | ||
| @import 'lib/styles/colors.scss'; | ||
| @use 'lib/styles/mixins.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| @use 'lib/styles/fonts.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| @use 'lib/styles/colors.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| $transitionInDelay: 15ms; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| export let menuItems: NavMenuItem[] = []; | ||
| export let isHovering: boolean = false; | ||
| export let activeRoute: NavMenuItem = undefined; | ||
| export let activeRoute: NavMenuItem | undefined = undefined; | ||
| export let navigationHandler: NavigationHandler | undefined = undefined; | ||
| let elWrap: HTMLElement | undefined; | ||
|
|
@@ -25,9 +25,9 @@ | |
| }) | ||
| function handleNavigation(ev: MouseEvent, menuItem: NavMenuItem) { | ||
| if (typeof navigationHandler === 'function') { | ||
| if (typeof navigationHandler === 'function' && menuItem.url) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| ev.preventDefault() | ||
| navigationHandler({label: '', path: menuItem.url, isMarketingUrl: !!menuItem.marketingPathname}); | ||
| navigationHandler({label: menuItem.label ?? '', path: menuItem.url, isMarketingUrl: !!menuItem.marketingPathname}); | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| @import 'lib/styles/mixins.scss'; | ||
| @use 'lib/styles/mixins.scss' as *; | ||
|
|
||
| .logo { | ||
| display: flex; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| @import 'lib/styles/mixins.scss'; | ||
| @use 'lib/styles/mixins.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| .topNavbarWrap { | ||
| position: relative; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| @import 'lib/styles/mixins.scss'; | ||
| @use 'lib/styles/mixins.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| .verticalSeparator { | ||
| display: block; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| @import 'lib/styles/fonts.scss'; | ||
| @use 'lib/styles/fonts.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| .inputWrap { | ||
| background: #fff; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| @import 'lib/styles/fonts.scss'; | ||
| @import 'lib/styles/mixins.scss'; | ||
| @use 'lib/styles/fonts.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| @use 'lib/styles/mixins.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| .modalWrap { | ||
| position: fixed; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,12 +3,12 @@ | |
| import { classnames } from 'lib/utils/classnames'; | ||
| import styles from './Modal.module.scss'; | ||
| export let isVisible: string = ''; | ||
| export let isVisible: boolean = false; | ||
| export let title: string = ''; | ||
| export let size: 'sm' = undefined; | ||
| export let size: 'sm' | undefined = undefined; | ||
| function toggleOverflow(toggle) { | ||
| function toggleOverflow(toggle: boolean) { | ||
| Object.assign(document.body.style, {overflow: toggle ? 'hidden' : ''}); | ||
| } | ||
|
|
@@ -18,15 +18,15 @@ | |
| {#if isVisible} | ||
| <div class={classnames(styles.modalWrap, $$props.class, size && `size-${size}`)}> | ||
| <div class={styles.modalContainer}> | ||
| <div class={styles.modalOverlay} transition:fade={{duration: 200}} on:click={() => isVisible = false} on:keydown={() => {}} /> | ||
| <div class={styles.modalOverlay} role="button" tabindex="0" transition:fade={{duration: 200}} on:click={() => isVisible = false} on:keydown={() => {}} /> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| <div class={styles.modalWindow} transition:fly={{y: 45, duration: 300}}> | ||
| <div class={styles.modalHeader}> | ||
| <h3 class={styles.modalTitle}> | ||
| {title} | ||
| </h3> | ||
| <button | ||
| class={styles.closeBtn} | ||
| on:click={() => isVisible = ''} | ||
| on:click={() => isVisible = false} | ||
| on:keydown={() => {}} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| > | ||
| <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="2" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,13 +10,19 @@ | |
| let elYOffset = 0; | ||
| function handleScroll() { | ||
| if (!elRef) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| return; | ||
| } | ||
| const { scrollY } = window; | ||
| const isFixed = (scrollY + yOffset - elYOffset) >= 0; | ||
| elRef.classList.toggle(styles.sticky, isFixed); | ||
| } | ||
| onMount(() => { | ||
| if (!elRef) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [💡 |
||
| return; | ||
| } | ||
| elYOffset = elRef.offsetTop; | ||
| handleScroll(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| @import 'lib/styles/mixins.scss'; | ||
| @import 'lib/styles/fonts.scss'; | ||
| @import 'lib/styles/colors.scss'; | ||
| @use 'lib/styles/mixins.scss' as *; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| @use 'lib/styles/fonts.scss' as *; | ||
| @use 'lib/styles/colors.scss' as *; | ||
|
|
||
| .toolMenuWrap { | ||
| width: 472px; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ | |
| import InlineSvg from '../InlineSvg.svelte'; | ||
| import styles from './ToolMenu.module.scss'; | ||
| let navMenuItems = getToolSelectorItems(); | ||
| let navMenuItems: NavMenuItem[] = getToolSelectorItems() ?? []; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| const toolIcon = getPublicPath('/assets/icon-tool.svg'); | ||
| function hasCtas(item: NavMenuItem) { | ||
|
|
@@ -18,13 +18,14 @@ | |
| <div class={styles.toolMenuWrap}> | ||
| <InlineSvg src="/assets/tools/sprite.svg" /> | ||
| {#each navMenuItems as section, sectionIndex} | ||
| <div class={classnames(styles.toolSection, styles[section.label?.toLowerCase()])}> | ||
| {#if section} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| <div class={classnames(styles.toolSection, section.label ? styles[section.label.toLowerCase()] : undefined)}> | ||
| <div class={styles.toolSectionTitle}> | ||
| {section.label} | ||
| </div> | ||
|
|
||
| <div class={styles.toolGroups}> | ||
| {#each section.children as group} | ||
| {#each section.children ?? [] as group} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| <div | ||
| class={classnames(styles.toolGroup, hasCtas(group) && styles.hasCtas)} | ||
| style:--order={group.groupOrder ?? ''} | ||
|
|
@@ -36,7 +37,7 @@ | |
| {/if} | ||
|
|
||
| <div class={styles.toolNavItems}> | ||
| {#each group.children as navItem} | ||
| {#each group.children ?? [] as navItem} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
| <a | ||
| href={navItem.url} | ||
| class={classnames(styles.toolNavItem, navItem.type === 'cta' && 'navButton')} | ||
|
|
@@ -74,5 +75,6 @@ | |
| {#if sectionIndex < navMenuItems.length-1} | ||
| <hr class={styles.toolMenuSpacer} /> | ||
| {/if} | ||
| {/if} | ||
| {/each} | ||
| </div> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,13 +10,15 @@ | |
| const imgUrl = getPublicPath('/assets/tool-trigger.svg'); | ||
| const toolsIcons = getPublicPath('/assets/tools/sprite.svg'); | ||
| let elRef: HTMLElement; | ||
| let elRef: HTMLElement | undefined; | ||
| let popupIsVisible: boolean; | ||
| </script> | ||
|
|
||
| <div | ||
| class={styles.wrap} | ||
| role="button" | ||
| tabindex="0" | ||
| bind:this={elRef} | ||
| on:click={() => popupIsVisible = true} | ||
| on:keydown={() => {}} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [ |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| @import 'lib/styles/mixins.scss'; | ||
| @use 'lib/styles/mixins.scss' as *; | ||
|
|
||
| .userAreaWrap { | ||
| display: flex; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[❗❗
correctness]Making
useroptional in theAuthConfiginterface could lead to runtime errors if the rest of the codebase assumesuseris always defined. Ensure that all usages ofAuthConfighandle the case whereuserisundefined.