Граф коммитов

321 Коммитов

Автор SHA1 Сообщение Дата
Florian Zia 91c3c8b15c
Merge branch 'main' into MNTOR-1878-Location-autocomplete-api 2023-07-11 10:25:48 +02:00
Robert Helmer 7107f728e0
MNTOR-1403 - land mock data, type definition, and faker code for OneRep types (#3166)
* MNTOR-1403 - land mock data, type definition, and faker code for OneRepScan
* base64-encode conflict markers
* do not run on merges to main, just pull requests
2023-07-10 23:50:41 -07:00
Florian Zia ccea89babe
chore: Resolve ts errors 2023-07-10 12:59:57 +02:00
Vincent dc98deeddd Add first screen of the onboarding flow 2023-07-07 18:15:09 +02:00
Florian Zia f34bd51f5e
fix: Build command 2023-07-07 14:46:08 +02:00
Florian Zia 6629669b3a
merge: main -> MNTOR-1878-Location-autocomplete-api 2023-07-07 14:40:49 +02:00
Florian Zia 2c46792816
chore: Separate out location script 2023-07-07 14:38:48 +02:00
Vincent 1a0b03656e Replace Chart.js by a plain SVG 2023-07-06 00:25:16 +02:00
Kaitlyn f0be2a4714 MNTOR-1689 - Fixed chart component (WIP) 2023-07-06 00:25:16 +02:00
Kaitlyn Andres 3cc3a2a9d2
Merge branch 'main' into react-aria-dialog-box 2023-07-05 02:45:34 -04:00
Florian Zia cbd8c4c935
chore: Move createLocationAutocompleteData script 2023-07-04 16:46:50 +02:00
Florian Zia c89769d855
feat: Make script createLocationAutocompleteData part of the build step 2023-07-04 16:10:03 +02:00
Florian Zia bc66af1101
merge: main -> MNTOR-1878-Location-autocomplete-api 2023-07-04 12:32:51 +02:00
Florian Zia a7abfc5aa2
merge: main -> MNTOR-1878-Location-autocomplete-api 2023-07-04 12:26:27 +02:00
Vincent c9416df615 Convert test setup to Jest
Next.js has integrated support for Jest.

This also uncovered that we were ignoring the user's country and
thus defaulting to the US in the Next.js port, so this also sets
up country code detection for Next.js.

This ports a couple of the existing tests; more complex ones will
be ported in followup commits.
2023-07-04 12:19:45 +02:00
Vincent 1d97cc90ea Treat ESLint warnings as errors
Since ESLint failures do not block development (they're only run
in CI and when committing), there's no value in warnings. Either we
fix them, or if it's not worth fixing, then we should disable the
rule to avoid extra noise.
2023-06-29 14:26:22 +02:00
Vincent 9196af05d9 Add eslint-plugin-import
This adds an ESLint plugin that prevents potential import bugs, and
fixes issues it uncovered — primarily, a duplicate export, multiple
imports from the same file, and giving a name to the default export
that matches one of the named exports.
2023-06-29 14:26:22 +02:00
Florian Zia 344a93017a
feat: Add fuzzy search for locations 2023-06-29 13:27:52 +02:00
Kaitlyn ca8230d670 reformat modal element to use useDialog from reactaria 2023-06-28 15:50:55 -04:00
Vincent 539b827be6 Migrate to V3 of the AWS SDK
This migration was done using

    npx aws-sdk-js-codemod -t v2-to-v3

As listed on https://www.npmjs.com/package/aws-sdk:

> AWS SDK for JavaScript v3 is the latest and recommended version,
> which has been GA since December 2020.

The new version also modularises the different clients, hopefully
resulting in less frequent dependency updates that mostly do not
affect us.
2023-06-28 19:37:20 +02:00
Vincent 0f3e5c6835 Set up app for React Aria 2023-06-28 17:35:11 +02:00
mansaj e9d403b0bb review comments 2023-06-27 09:56:11 -07:00
Florian Zia 93a912f81f
fix: Add missing packages 2023-06-26 21:20:53 +02:00
Florian Zia 1601eb0f5b
chore: Move and add missing types 2023-06-26 19:38:33 +02:00
Joey Zhou 8f62e2a8c8 draft 2023-06-23 13:31:34 -07:00
Joey Zhou 5466150b2f update syncBreaches 2023-06-23 11:58:49 -07:00
Robert Helmer 27f4c84724
Revert "Start local built server on same port as dev one" (#3156)
This reverts commit 6d11d7d86b.
2023-06-21 13:38:46 -07:00
Vincent 6d11d7d86b Start local built server on same port as dev one 2023-06-21 15:22:15 +02:00
Vincent 7575b860fa Add accessibility add-on for Storybook
This will make it easier to detect and debug accessibility issues
inside Storybook.
2023-06-15 21:20:51 +02:00
Joey Zhou 83a74b4d9d add types 2023-06-12 15:48:02 -07:00
Vincent b56993359e
Merge Next.js into `main` (#3116)
* Initialise Next.js app using create-next-app

Command run: npx create-next-app@latest

* Also tell VSCode to format TS and TSX files

* WIP: Sign in with next-auth

* Add Fluent

Unfortunately, since the ReactLocalization object contains
functions, it can't be shared between client and server (because
functions can't be serialized), so in effect every page that uses
localisation has to be a client component.

But at least we can set the correct `lang` attribute on <html> on
the server, so there's that :)

* Copy-paste public breach scan into Next.js

* Halfway migrate public breach list

Did not do: breach icons and getLocale() (for list and date
formatting).

* Enable SSR for localised strings

This allows our pages to be Server Components now.

* Download breach logos in Next.js server

* Tell search engines not to index non-prod envs

* Port existing security headers from Helmet to Next

* Add a 404 page

* Relax CSP in local development

* Set up Next-Auth for server components

It still doesn't work at the moment because the correct redirect
URL hasn't yet been set up on FxA.

* Apply Prettier to Next.js files on commit

* Enable Sass

* feat: Port existing landing page

* fix: Set hibp footer as html

* Wire up Next.js to FxA using iron-session

* feat: Port main layout for authenticated pages

* chore: Get session in layout

* Set up Prettier for VSCode users

* fix: Provide fxa user menu with data

* chore: Format Create Next App template

* Make Next-Auth work with FxA

To test, add the following two variables to your .env:

  NEXTAUTH_URL=http://localhost:6060
  NEXTAUTH_SECRET=<generate using `openssl rand -base64 32`>

You can then add <SignInButton/> to e.g. the landing page to kick
off authentication.

* Port breach-detail page to Next.js

* Add pending translations

* Access session data in React components

* Use Prettier as the formatter in VSCode

* Port Nebula & Protocol tokens into tokens file

* merge: Resolve conflicts

* fix: Move hr into li element

* feat: Handle authenticated users

* chore: Add todo note

* chore: Don’t use default exports for SignInButton and UserMenu

* chore: Move site navigation to client-side component

* Make mozlog work with Next.js

Unfortunately, this required patching the `intel` package. That
said, since that package hasn't been updated in six years, this
should be relatively safe.

The problem is that `intel` was trying to dynamically determine
which modules to load based on which files were present in its
directory. However, since Next.js moves (and presumably bundles)
Node modules into the `.next` folder, it was unable to find the
modules that `mozlog` was expecting to use.

The patch fixes this by simply explicitly importing those four
modules.

* Add back a couple of authentication logs

* add woff files and metropolis css file

* add right font path

* format scss file to include camelcase

* chore: Move components into (nextjs_migration) and remove redundant layout file

* chore: Remove redirect landing page -> dashboard

* chore: Redirect to dashboard upon signin

* add title and body copy variables

* use token variables in landing scss file instead of old variables from variables.css

* feat: Add basic dashboard page elements

* chore: Add circle chart web component

* chore: Add custom select web component

* breaches get and put calls

* cleanup

* get rid of debug logs

* Add sentry to nextJS branch (#3075)

MNTOR-1641 - enable Sentry for NextJS, for front- and back-end code

* chore: Render user breaches

* feat: Port breach resolution api

* fix: Check breach resolution filter by default

* chore: Add redirect /user/dashboard -> /user/breaches

* feat: Add breach page types

* chore: Remove breach resolution API call headers

* fix: Rename changed API response data key

* add template button component

* remove assets

* add button styling

* chore: Trigger auto signIn for pages that require authentication

* chore: Update breach types

* chore: Repurpose HIBP BreachDataTypes

* chore: Don’t capitalize first letter of chart label

* chore: Remove duplicate font size

* chore: Rename BreachResolutionApiBody -> BreachResolutionRequest

* Add a redirect from /security-tips for Next.js

This was already present in the Express-based website.

* Add the app shell for the React-based website

* chore: Re-enable gtag

* use old font code and add status pill component

* remove unnecessary package additions and style status pills

* lint

* test exposurecard data func

* MNTOR-1765 - set title, favicon, and meta tag correctly for nextjs app (#3082)

* Port unsubscribe-monthly page to Next.js

* add toggle to exposurecard accordion

* add icons to exposure type

* Ease transition from `getMessage`

This adds a `getStringLookup` API to ease the transition from old
Fluent functions (which depend on the user's locale being stored in
AsyncLocalStorage). It will behave the same as the old getMessage()
when called as-is, but when passed an instance of ReactLocalization
(which we have access to in Next.js routes), it will retrieve the
localised string from that.

* Add preliminary Subscriber table type definition

* Process new user sign-in

This does a couple of things:
- It updates the code that sends the breach check email on
  first sign-in to pass an instance of ReactLocalization.
- It splits session data and JWT properties to separate data
  provided to use by FxA from data we store in our own database.
- It checks if the user that signs in is already known in our
  database, and if not, it adds them. It does so using mostly the
  same code as in /src/controllers/auth.js's `confirmed` function.

* dockerflow endpoints

* remove introduction.mdx for now, refine button states

* apply some changes

* Move new components out of migration dir

* Delete .bash_profile

* Delete storybook.log

* Delete main.js

* Delete preview.js

* remove use of inter for now

* feat: add email api

* feat: remove email api

* verify email

* update comms options

* light refactoring

* take shared function out to util

* send verification email

* add another property to EmailRow

* add some types

* rename route

* fix review comment

* Fix MNTOR-1634: Stub /settings page (auth)

* Remove commented code, add CSS, match HTML markup from previous iterations

* Remove/comment out logic dependent on session info

* Wire up settings page and new APIs

* Work around radio button unchecking on page load

* Adding a catch all 404

Not ideal but the best solution at the moment

Co-authored-by: Vincent <Vinnl@users.noreply.github.com>

* version route

* remove log

* Port admin pages to Next.js

The Notification email doesn't work yet, because it's not clear yet
how to trigger the Cloud Function.

* Add Storybook build output folder to gitignore

* Set up Netlify

* Group Storybook ignores together

* add node env

Co-authored-by: Vincent <Vinnl@users.noreply.github.com>

* fix test

* fix npm test

* fix css lint

* fix lint js

* exclude sentry.*

* Set up the actual linting we'll use

* Prettier-ignore appropriate files, format the rest

* Fix/ignore ESLint and TypeScript errors

* Make tests work with getStringLookup

* Remove now-unused dependencies and build scripts

* Update CI scripts for Next.js

* Add missing Next.js dependencies to the lockfile

These were added when running `next build`.

* Tag Next.js migration TODOs

* Make "add email" dialog work on dashboard

* Load client-side scripts as modules

This is the same the old website did, and avoids e.g. different
`init` functions overriding each other.

* Fix loading of FxA avatar

* Use <BreachLogo> component

* Allow Next.js's inline scripts/styles in prod

For `style-src`, the current website already enables
'unsafe-inline'. For script-src, it looks like we currently cannot
avoid that: https://github.com/vercel/next.js/discussions/51039

* Debug Playwright (#3118)

---------

Co-authored-by: Florian Zia <zia.florian@gmail.com>
Co-authored-by: Kaitlyn <kandres@mozilla.com>
Co-authored-by: Joey Zhou <jozhou@mozilla.com>
Co-authored-by: Robert Helmer <rhelmer@mozilla.com>
Co-authored-by: maxxcrawford <maxx.crawford@gmail.com>
2023-06-12 13:35:35 -07:00
Robert Helmer f8650b59f5
Rename cloud-functions dir, and make missing required env vars warning not error (#3059)
* rename functions dir to cloud-functions

* warn instead of throwing exception for missing required env vars

* only assign variable if set
2023-05-22 07:59:26 -07:00
Robert Helmer 0bb98e8778
Mntor 1539/separate data ingestion (#3034)
MNTOR-1539 - create Google Cloud Function version of /hibp/notify API endpoint
2023-05-18 15:17:23 -07:00
Joey Zhou e9f7990a87 add jwt dependencies back 2023-04-27 23:09:35 -07:00
Amri Toufali 9a7efc86b7
fix AVA ignore path 2023-04-24 23:09:51 -07:00
Amri Toufali d612dfa46a
fix e2e test config 2023-04-24 23:07:07 -07:00
Amri Toufali 397b4a94b8
fix typescript lint 2023-04-24 21:44:55 -07:00
Amri Toufali 2aabb1a860
add typescript, stylelint, and associated deps 2023-04-24 17:14:32 -07:00
Amri Toufali b3e2b1537b
Update package.json description
Co-authored-by: Vincent <Vinnl@users.noreply.github.com>
2023-04-24 16:28:16 -07:00
Amri Toufali 3c50bc296b
move esbuild and package.json to root 2023-04-20 15:25:51 -07:00
Vincent 1f4b4b94b7 Allow scanning for exposures without logging in
Co-authored-by: Robert Helmer <rhelmer@mozilla.com>
2023-04-11 16:56:47 +02:00
Vincent b3d094cf0d Only lint used JS files 2023-04-04 10:58:03 +02:00
Vincent f7f80b0f5d Ensure that @ts-ignore is always commented
It's an escape hatch, so we want to know why it was added (and when
it can be removed again).
2023-04-04 10:58:03 +02:00
Vincent de286b256c Add a bunch of initial type annotations 2023-04-04 10:58:03 +02:00
Vincent 8d264907d7 Check type annotations in CI 2023-04-04 10:58:03 +02:00
dependabot[bot] 4d1020f55f
Bump intl-pluralrules from 1.2.1 to 1.3.1 (#2660)
Bumps [intl-pluralrules](https://github.com/eemeli/intl-pluralrules) from 1.2.1 to 1.3.1.
- [Release notes](https://github.com/eemeli/intl-pluralrules/releases)
- [Commits](https://github.com/eemeli/intl-pluralrules/compare/v1.2.1...v1.3.1)

---
updated-dependencies:
- dependency-name: intl-pluralrules
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-03 08:38:44 -07:00
Florian Zia b3b6550de5 merge: main -> MNTOR-1039-Unsubscribe-endpoint 2023-03-09 13:44:50 +01:00
Amri Toufali f82b4a708c
fix redis overwriting `AsyncLocalStore` 2023-02-28 14:02:02 -08:00
Florian Zia b6c88cc27e Merge branch 'main' into MNTO-1039-Unsubscribe-endpoint 2023-02-28 12:25:03 -05:00
Florian Zia 70b05456b5 wip: Add endpoints 2023-02-28 12:20:30 -05:00