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

74 Коммитов

Автор SHA1 Сообщение Дата
dschom 914afe5343
bug(settings): Hash l10n files for cdn deployment
Because:
- We need cache busting file names when deploying new content to the CDN

This Commit:
- Adds grunt-hash job
- Configures grunt has to hash ftl files and create mapping files
- Adjusts AppLocalizationProvider to use the mapping file to load l10n files
2024-10-02 10:14:47 -07:00
Reino Muhl 7dd569d383
feat(next): glean emit view event
Because:

- Record SubPlat P1 metric view event using glean

This commit:

- Adds payments-metrics library
- Adds PaymentsGleanManager to format events data and CMS data into the
  required format for Glean events recording.
- Adds PaymentsGleanService to handle metrics events emitted by Next.js
- Adds the manager and service to the NestApp
- Adds new config values to payments-next for Glean reporting
- Emit view event from Checkout start page

Closes #FXA-10087
2024-09-19 15:38:27 -04:00
Reino Muhl 54fefd2872
feat(next): add sentry to payments-next
Because:

- Be able to use Sentry in Next.js on both the client and the server

This commit:

- Add Sentry to payments-next using the installation wizard

Closes #FXA-9998
2024-09-09 13:21:21 -04:00
Reino Muhl d5526d8b05
feat(next): add subplat glean server yaml
Because:

- Define glean events and metrics for subplat backend events

This commit:

- Adds metrics and events to subplat backend metrics yaml

Closes #FXA-10086
2024-09-04 14:05:01 -04:00
Lisa Chan 66d28d6e16
refactor(libs): Rename Contentful library to generic name 2024-06-28 17:00:27 -04:00
Ben Bangert 39efc8ddf4
chore: update nx to 19.3
Because:

* We want to use the latest version of Nx.

This commit:

* Updates Nx to 19.3.
2024-06-20 17:34:39 +00:00
Reino Muhl ab8ae37229
feat(next): update payments-next build and restart
Because:

- Starting and restarting payments-next takes a long time due to always
  building the app first, which isn't necessary during development.
- When changes are made to NestApp or its dependencies, these are not
  hot reloaded by Next.js, requiring a full Next.js restart.

This commit:

- Adopt Nx plugin for Next.js which more closely aligns with Next.js
  standard dev commands.
- Retained Nx Next.js executors for build, since it more closely fits
  into the current FxA build and deploy CI logic.
- Added a watcher to NestApp which calls a NestApp restart api, only
  available in development, to restart the NestApp on any changes.
- Adds a function to get the NestApp, instead of a const, thus ensuring,
  in dev mode, the latest NestApp is always returned.

Closes #FXA-9706
2024-06-18 10:45:04 -04:00
Lisa Chan 765d851168
fix(git): Ignore shared-contentful generated files 2024-03-26 16:44:25 -04:00
Reino Muhl f80ba7ff45
feat(l10n): update l10n ftl scripts for nx apps v2
Because:

* Fluent ftl files need to be added to apps in the nx apps/ directory.

This commit:

* Updates bundle and prime scripts to support the apps/ directory, without affecting existing packages apps.

Closes #FXA-8823
2024-03-14 10:41:02 -04:00
Reino Muhl a4cb70fa6c
Revert "feat(l10n): update l10n ftl scripts for nx apps" 2024-03-13 15:47:02 -04:00
Reino Muhl 50c0e85430
feat(l10n): update l10n ftl scripts for nx apps
Because:

* Fluent ftl files need to be added to apps in the nx apps/ directory.

This commit:

* Updates bundle and prime scripts to support the apps/ directory,
  without affecting existing packages apps.

Closes #FXA-8823
2024-03-07 13:05:29 -05:00
Ben Bangert 5b6b9a0a8d
feat: add eligibility manager to capability service
Because:

* We want to use the new eligibilitymanager in the capability service
  and compare its results to the existing check, reporting any
  differences in the eligibility comparison.

This commit:

* Adds the eligibility manager to the capability service.
* Adds a wrapper to the results of the elgibility call to verify it
  matches the existing comparison, and report to Sentry if it doesn't.

Closes FXA-8273
2023-11-15 09:29:50 -08:00
dschom 372c14aaaa
task(all): Ignore all .env files 2023-09-25 16:29:45 -07:00
dschom d96797ae6a
task(CI): Improve nx caching for CI pipelines
Because:
- Not all CI operations where taking advantage of NX caches

This Commit:
- Adjusts nx.json config to ensure correct caching behavior
- Adjusts nx.json config to ensure proper target chains. ie build is dependent on pre-build
- Uses nx to directly run integration tests
- Uses nx to directly run unit tests
- Phases out dependency on generated .list files
- Ensures 'start up' for services for functional tests is done with nx and uses nx caches.
- Creates nx tags to facilitate test commands
- Fixes linter errors encountered
- Updates docker images to nx for builds
- Updates nx ignore files
2023-08-29 11:19:54 -07:00
Lisa Chan d4bf24117c
chore(next): Add Next.js to fxa and initial setup 2023-07-19 14:57:15 -04:00
dschom df7897920d
task(gql-api): Allowlist graphql queries
Because:
- We want to lock down our gql queries as part of good security practices.

This Commit:
- Creates task that extracts existing gql queries from our code
- Applies middleware that checks a allowlist of extracted queries.
- Creates a 403 if the query is not in the allowlist
- Makes all gql parsable by extraction utility. The extraction utility doesn't support string placeholders. e.g. gql` Account { ${ACCOUNT_FIELDS} }`
- Moves all the gql in the admin server into .ts files. Again for consistency and extraction utility support.
- Cleans up some config references at startup
- Adds nx config for extraction & copy tasks
2023-07-18 05:54:28 -07:00
dschom b4cfc9c325
chore(CI): Switch to multi stage docker build and clean up
Because:
- We want to clean up our docker build
- We no longer used our service specific images

This Commit:
- Switches to multi stage docker build
  - Removes unused building of individual services
  - Removes used script that sets environment variables.
  - Removes `workspaces focus` call that resulted in redundant installs
  - Removes trap on build logs.
  - Uses circleci DLC to get cache hits for fxa-utils and fxa-build-utils
- Removes scripts that build service specific images
- Cleans up naming conventions to reflect that only one image is being built
2023-05-11 17:13:06 -07:00
Barry Chen ec34079b91
feat(metrics): add glean.js to content-server
Because:
 - we want to use Glean for our metrics

This commit:
 - integrates glean.js into content-server
 - adds a couple placeholder registration Glean metrics events
2023-05-05 12:45:33 -05:00
dschom ee51f23aa1
bug(content): Fix bad paths to l10n files
Because:
- Content server would not return the l10n version
- Story books in auth server weren't building

This Commit:
- Makes sure l10n:prime is run prior to running tests.
- Makes sure l10n:prime is run prior to building storybooks.
2023-03-22 09:28:54 -07:00
dschom 1d709000fe
task(many): Only clone l10n once and combine ftl files.
Because:
- We want to avoid redundant git clone operations
- We want to reduce the number of ftl bundles requested on the client side.

This Commit:
- Adds _scripts/l10n/*.sh for conducting l10n build operations
- Bundles ftl files together into ftl main
- Removes bundle prop on AppLocalizer, so that it uses the default, [main.ftl]
- Replace - with _ in locale names when resolving ftl files
- Removes clone-l10n.sh
2023-03-15 11:30:44 -07:00
Lauren Zugai 586a46b9b8
feat(react): Reactify legal, legal/terms, legal/privacy
Because:
* We're refactoring our legacy tech stack to our preferred stack by extending settings

This commit:
* Adds a clone-legal-docs script so we always fetch latest rather than pin to commit
* Reworks the 'react groups' into separate server and router files; router.js needs access, but cannot have any reference to route definitions since they now contain server-side logic and imports
* Moves available content-server routes into a separate file that does not import route definitions
* Uses and accounts for the existing regex for legal, legal/terms, and legal/privacy
* Adds two helper packages to render the MDs once fetched

Closes FXA-6131
2023-02-15 13:02:04 -06:00
dschom a620922422
task(CI): build, unit test, and integration test jobs
Because:
- We wanted to run a few preliminary checks before proceeding to more
  expensive CI jobs. Checks include:
    - Compiling typescript in commonly referenced workspace packages
    - Linting code that has changed
    - Executing Unit Tests for code that has changed
- We wanted to partition test operations into unit tests, and
   integration tests. Unit tests can be run relatively quickly and
   require no additional infrastructure. Integration tests require
   additional infrastructure and generally have longer execution
   times. Now that jobs are blocked from running until preliminary
   checks pass, one of which is unit tests, it is important to draw a
   distinction between these two types of tests.
- We want to avoid unnecessary yarn installs and typescript
  compilations, which are time consuming.
- We want to make sure that test results are published and failing tests
   can be easily viewed in the CI.

This Commit:

- Creates a build-and-validate job in the CI that builds, lints, and
  unit tests code prior to running any other jobs.
- Creates unit-test job in CI config
- Creates integration-test job in CI config
- Removes redundant calls to compile workspace packages. These
  are now built up front, cached, and restored as needed for future
  runs.
- Extends the create-lists script functionality to generate commands
  that can be executed with the parallel command.
- Removes unnecessary yarn install operations. Invoking yarn workspace
   focus results in a yarn install. In the case of running tests this is largely
   unnecessary, because we already do a yarn install in the base-install
   step.
- Make sure test results are exported as junit xml so the CI can report
  back on tests that were failing. This was done for a couple workspace
  packages, but many were lacking the capability. All test:unit and
  test:integration npm scripts now export this data.
- Fixes the following issues encountered along the way:
        - Adds logs to monitor heap usage of jest tests. Some
          jest tests are still using a lot of memory.
        - Moves a few slow / long running tests from unit test to
          integration tests.
        - Ensures that jest.transform for ts-jest is always instructed
           to have the config option isolateModules is set to true. This
           definitely decreases memory overhead and resolves some
           of the OOM errors we were hitting. It was configured in
           some places but not everywhere.
        - Exports test results files for all tests
        - Exports all test artifacts
        - Uses gnu parallel to run tests in parallel. Turns out yarn
          workspaces foreach would give a false positive when an OOM
          was encountered. Fortunately, the parallel command offered an
          acceptable work around, and even offers some nice features
          like the load argument, which allows to control test execution a
          bit more efficiently.
2023-01-10 12:52:01 -08:00
dschom acf3c82590
task(ci): Use docker base image
Because:
- We want to speed up pipeline startup.

This Commit:
- Optimizes docker base image builds for the smallest images possible.
- Enables hard links for yarn cache
- Enables global yarn cache
- Avoids needlessly installing playwright browsers.
- Avoids needlessly running yarn install.
- Uses mozilla/fxa-circleci:ci-base-latest image for running test pipelines
- Uses mozilla/fxa-circleci:ci-base-browsers image for running functional tests pipelines
- Creates configurable executors that can be reused across pipelines
- Upgrades to yarn 3.3.0
- Enabled direct check out of PR code to test, which is faster than circle ci’s checkout command.
- Upgrades functional test to X-Large. This was already the case for playwright tests, but is now extended to content server tests too. This decision was made due to running lots of pipelines and realizing flakiness was largely due to CPU or memory hitting 100% for long periods of time.
- Turns off tracing, since it saves a bit of runtime.
2022-12-15 15:48:16 -08:00
Valerie Pomerleau 499a41a410
refactor(l10n): Ensure shared FTL strings not duplicated on Pontoon
Because:

- Concatenating shared FTL strings into multiple packages before sending for localization created duplication of localization work, and we want each string to only be translated once.

This commit:

- Remove concatenation of shared files (branding.ftl, fxa-react ftl files) from grunttasks
- Add grunttasks in fxa-react to concatenate fxa-react FTL files into one react.ftl file
- Add grunt to fxa-react dev dependencies
- Update fxa-react scripts to run l10n and ftl tasks
- Update clone-l10n script to distribute react.ftl to packages
- Bundle branding and shared into AppLocalizationProvider

Closes #FXA-6388
2022-12-08 15:45:34 -08:00
Valerie Pomerleau d79c30d50a
feat(l10n): Split payments-server single FTL file into per-component files
Because

* Organizing l10n strings in per-component files aligns payments-server with the setup used for auth-server and settings. Splitting the FTL files also improves maintability by more tightling coupling the strings with the components where the strings are used.

This commit

* Create a temporary branding file in fxa-payments-server/src
* Create a gruntfile with tasks for FTL concatenation and watching
* Rename the destination file from main.ftl to payments.ftl
* Switch payments-server's default locale from en-US to en and update all references of en-US to en
* Create individual FTL files per component and move messages to their respective component FTL file
* Add a l10n entry in the package readme
* Update clone-l10n.sh to copy 'payments' ftl files instead of 'main'
* Update AppLocalizationProvider to use 'payments' bundles
* Replace setupFluentLocalizationTest with getFtlBundle/getFtlFromPackage from fxa-react
* Remove setupFluentLocalizationTest function (no longer used in fxa-settings)
* Add merge-ftl:test task to package.json start and test:frontend scripts
* Remove legacy strings from FTL files
* Update currency and date formats to use 'en' as default locale
* Remove legacy paths from .gitignore files in payments-server
* Move remaining paths to global .gitignore
* Delete .gitignore files in payments-server

Closes #FXA-5996 and #FXA-6255
2022-11-09 13:26:40 -08:00
Lauren Zugai befccf53df
feat(l10n): Create Localized wrapper and React l10n test setup
Because:
* We want better l10n testing across the codebase

This commit:
* Creates a Localized wrapper to use in place of Localized that requires children (fallback text)
* Adds a mock for the Localized wrapper in Jest's setupTests to avoid copying and pasting this into every test file
* Creates test-utils in fxa-react and exports functions to use for testing the mock that all IDs exist in the 'en' bundle, that fallback text matches the message in the bundle, and that the message doesn't contain straight apostrophes or quotes
* Adds tests and a test.ftl file for the test-utils l10n functions to ensure they test what we think they do
* Moves concatenating settings.ftl out of webpack and into grunt due to 1) needing a test version of settings.ftl at a different path, else tests may fail in CI with new or changed strings since the l10n repo won't have them immediately, 2) wanting to retest FTL changes without having the settings app running (jest does not run nicely with webpack), 3) consistency with the auth-server
* Uses this new test functionality in a few Settings tests covering various use cases

Closes FXA-5999
2022-10-26 10:14:55 -05:00
Reino Muhl 9fc1193385
feat(scripts): pull pdfs from legal-docs
Because:

- We need to pull the latest pdfs from legal-docs into the fxa
  assets folder.

This commit:

- Create a script to copy the latest pdfs into assets/legal.
- Create a Github Action to automatically pull in the pdfs from
  legal-docs, and open a pull request to move pdfs into assets/legal.

Closes #fxa-5100
2022-10-20 18:22:29 -04:00
Lauren Zugai 024abf0af6
feat(css): Add Tailwind to content-server
Because:
* We are starting a content-server reskin and want to adhere to the existing design guide for consistency and to make converting to React/TW later easier

This commit:
* Adds tailwind v3 to content-server, and includes tailwind.out.css only on the main index page for now
* Adds new script for building and pm2 process for watching

fixes #13480
2022-07-11 17:16:57 -05:00
Barry Chen 91b730e97c
Revert "feat(css): Add Tailwind to content-server" 2022-07-06 09:16:55 -05:00
Lauren Zugai 09cb96eee2
feat(css): Add Tailwind to content-server
Because:
* We are starting a content-server reskin and want to adhere to the existing design guide for consistency and to make converting to React/TW later easier

This commit:
* Adds tailwind v3 to content-server, and includes tailwind.out.css only on the main index page for now
* Adds new script for building and pm2 process for watching

fixes #13480
2022-06-30 18:01:08 -05:00
dschom 17e2f77904
fix(admin-server): Fix broken build command
Because:
- There were issues starting the admin-server.

This Commit:
- Introduces a dev.json to solve issues with missing dev settings.
- Make sure the dist folder is actually cleaned. It was possible that a stale config.js file could cause problems.
- Make sure build is run and config/*.json files are copied over.
2022-05-24 15:56:30 -07:00
dschom 0db515ba4d
feature(admin-panel): Add nestjs subscription service
Because:
- We want to display account subscription data in the admin panel.

This Commit:
- Hooks up the Account React component to real subscription data.

- Fixes a long standing issue with Knex in the admin panel! Knex instance is now bound to BaseAuthModel and repurposed across derived classes.
- Introduces a subscription module that provides the nestjs services necessary to retrieve subscription data.
- Introduces a subscription service that acts as the primary point of request for subscription data.
- Introduces stripe service so that stripe can be dependency injected.
- Introduces firestore service so that firestore can be dependency injected.
- Introduces play store service so that play store accessor can be dependency injected.
- Introduces app store service so that app store accessor can be dependency injected.
- Introduces subscription formatters that unify subscription dtos into standard response format.
- Improves config setup to allow for local.json and secrets.json files to be used.
- Introduces configuration settings so that underlying services can be accessed.
- Introduces feature flags to disable queries to underlying stripe, google or apple apis.
- Hoists a couple joi validators up to fxa-shared for reuse.
- Breaks out an auxiliary method that can determine product ids given iapType and a plan. This exists in in stripe.ts in fxa-shared. (The previous code had zero dependence on the stripe class, which made this possible. This was primarily done for testing purposes.)
- Exposes a couple more fields on AppStoreSubscriptionPurchase to support subscription formatting.
- Fixes typing on MozSubscription.endedAt. Value is allowed to be null | undefined.
- Adds tests and achieves 90+ percent test coverage on all new code.
- Adds reusable mocks for standard services to facilitate testing.
- Updates readme with info about subscriptions, configuration, feature flags, and testing.
- Updates pm2.js with better defaults to support subscription service.
2022-05-24 08:54:17 -07:00
Danny Coates 50e124b518
feat(services): remove fxa-auth-db-mysql, fxa-email-event-proxy, and fxa-email-service
and fxa-metrics-processor
2022-01-13 16:23:22 -08:00
Dan Schomburg 397c590681
feat(auth) - Phaseout mjml auth server (#11482)
* chore(auth) - Phaseout mjml auth server

Because:
- A separate server was required to render templates needed for storybook.

This Commit:
- Creates some bindings to abstract away process context used by FluentLocalizer.
- These bindings support running in either a nodejs process or in the browser.

Fixes: #10218

* Improve ejs install

* Put mjml-browser helper under test

* Update documentation around static storybook build.

* PR feedback

* Try relative path

* Relative paths

* Switch to curl

* PR Feedback
2022-01-04 13:12:59 -08:00
Danny Coates 45a399e8cf
feat(dev): add firebase emulator ui visit http://localhost:9299 2021-10-15 16:48:06 -07:00
Jody Heavener f17a4fa121
chore(auth): set up auth server to generate dist FTL file, clone/import existing FTL locales
Because:

- We want to be able to generate a single FTL file for fxa-content-server-l10n to pick up
- We want to be able to pull in existing auth locales from fxa-content-server-l10n

This commit:

- Adds a new grunt task for generating a single FTL file, placing it in a location fxa-content-server-l10n will find it
- Updates the clone-l10n script to check for auth server locales in the fxa-content-server-l10n repo
2021-09-14 09:40:45 -03:00
yogita aaa8f1da23
feat(fxa-auth-server): Setup CSS solution for emails 2021-07-16 21:38:25 +05:30
Vijay Budhram 5610838255
feat(push): Add views for confirming a push notification login 2021-06-14 13:23:04 -04:00
Danny Coates a1414bfe6a
chore(settings): ignore settings.ftl 2021-02-22 12:42:49 -08:00
Barry Chen 37887cf115
chore(l10n): combine the download l10n scripts
Because:
 - we have multiple similar scripts that pull translations from the
   fxa-content-server-l10n repo
 - we need that functionality for new settings

This commit:
 - combine the scripts into a single one
2021-02-08 12:51:42 -06:00
Michael Kane Juncker 3c978d9d00
Allow environment variable customizations in Docker builds - refs #7118 2021-01-07 14:44:10 +01:00
Ben Bangert 139029248e
feat(graphql-api): convert to NestJS
Because:

* We want to use NestJS for new apps, and graphql-api is still small
  enough to feasibly convert to NestJS.

This commit:

* Converts graphql-api to a NestJS app.

Closes #6263
2020-11-30 15:33:24 -08:00
Vijay Budhram 325c2f4aa2
fix(tests): Store test results in insights 2020-09-25 11:18:44 -04:00
Danny Coates 7358a3cae5
feat(auth-client): replace fxa-js-client with fxa-auth-client
- We have two clients for the auth-server API, one in `content-server/app/scripts/lib/auth` and `fxa-js-client`. The content-server one was meant to replace fxa-js-client but I didn't finish the work to get it running on nodejs.

- Extracts the content-server implementation into `fxa-auth-client`
- Wraps the implementation with shims to work with nodejs in `server.ts`
- Updates references to fxa-js-client to use fxa-auth-client
- Removes fxa-js-client
2020-07-21 09:08:35 -07:00
Danny Coates cbe376905e
fix(lint): lol @ .swp in git 2020-07-09 15:26:36 -07:00
Jody Heavener e6fafda68b
feat(storybook): allow Tailwind scss compilation support
Because:

* Currently fxa-settings imports SCSS into a Tailwind file, but outside of Create React App (which handles SCSS compilation in the React app itself) SCSS is not compiled.

This commit:

* Updates both Tailwind and Storybook's setup so that you can now compile down to CSS or SCSS depending on your needs, and ensure Storybook's SCSS loader picks it up
2020-06-08 09:57:09 -04:00
Jody Heavener 7cd796a3f4
feat(admin-panel+settings+react): set up storybook and tailwind for admin-panel, share tailwind config across all projects, config movement
compile tailwind for use in fxa-react, fxa-settings, and fxa-admin-panel

add script to tailwind configs to only apply postcss output to fxa-react components being used in a given project
2020-06-03 15:46:09 -04:00
Danny Coates c3780546b6
fix(local-dev): added fxa-shared and fxa-react to pm2
In order to keep the typescript shared modules up to date for their dependents to use while running locally this adds them to pm2 so that a `tsc --watch` can run alongside the other services.

Note, this DOES NOT automatically restart dependent javascript service processes.

This change refactors pm2-all.sh in order to start processes in dependency topological order. This requires an update to most pm2.config.js files in order to set PATH correctly while running under yarn.
2020-06-03 10:05:02 -07:00
Danny Coates 17f2311274
fix(content-server): fixed content-server build
@fxa-react is no longer used. content-server should reference
fxa-react through a workspace dependency.

This commit fixes references and build configs for this change.
2020-06-02 10:54:39 -07:00
Danny Coates 81575019a9
refactor(packages): use workspace references 2020-05-21 10:57:21 -07:00