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

272 Коммитов

Автор SHA1 Сообщение Дата
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
Meghan Sardesai a54331a42f
chore(factories): move factories into their respective shared-contentful directories
Because:

* The main factories file was getting a bit out of hand and separating them keeps everything more organized.

This commit:

* Moves eligibility and services factories into their own directories.
* Updates factories that include more than the single override parameter.
* Updates paths where applicable.
* Updates tests where applicable.
* Adds missing tests for planIdsToClientCapabilities

Closes FXA-8621
2023-11-09 17:31:59 -05:00
Lisa Chan cfa6630009
fix(contentful): Add help text to fields and updated default locale 2023-11-08 13:37:43 -05:00
Meghan Sardesai c8a059e468
feat(contentful): add planIdsToClientCapabilities to capability manager
Because:

* We want to fetch the list of capabilities for the given plan ids.

This commit:

* Adds planIdsToClientCapabilities method to the capability manager.

Closes FXA-8240
2023-11-06 13:39:44 -05:00
Reino Muhl 946397ab10
Merge pull request #16024 from mozilla/fxa-8537-add-query
feat(contentful): add purchase common query
2023-11-03 19:20:01 -04:00
Reino Muhl 9dd63443cb
feat(contentful): add purchase common query
Because:

* Need to query Purchase Details and Common Content for an array of
  stripe plan ids.

This commit:

* Adds PurchaseWithDetailsOfferingContentUtil to retrieve the necessary
  data from Contentful for a specific locale.

Closes #FXA-8537
2023-11-03 18:37:06 -04:00
julianpoyourow 1bfc2df593
fix(contentful): do not reset contentful cache 2023-11-01 20:43:32 +00:00
Ivo Plamenac 843c3f03ad
Merge pull request #15892 from mozilla/stripe-factories
feat(sp3): add Stripe Factories
2023-10-25 11:51:51 -07:00
Ivo Plamenac 5c5b055f86
feat(sp3): add Stripe Factories
Because:

* we want to employ the factory pattern for mocking testing data

This commit:

* adds factory functions for several stripe objects

Closes #FXA-8311
2023-10-25 10:52:05 -07:00
julianpoyourow 75045db430
feat(contentful): setup cachebusting
Because:
* Apollo client provides no means of setting a cache TTL

This commit:
* Sets up cache busting on a 5 minute interval by default, configurable via optional Nestjs config option.
2023-10-25 15:54:33 +00:00
Lisa Chan 1b3f51938d
Merge pull request #15855 from mozilla/FXA-8242
chore(libs): Create getClients method in CapabilityManager
2023-10-24 13:25:15 -04:00
Lisa Chan 3403f3350a
chore(libs): Create getClients method in CapabilityManager 2023-10-24 13:10:29 -04:00
Valerie Pomerleau 2a56432281
fix(l10n): Ensure Settings and Payments are displayed RTL for RTL locales
Because:

* Settings and payments were not automatically displayed in RTL for languages such as Hebrew

This commit:

* Set lang and dir with react helmet
* Add method to determine locale dir, with unit tests
* Add list of rtl locales

Closes #FXA-6234
2023-10-23 13:12:19 -07:00
dschom 3cdfbbfa08
task(content): Activate Mozilla branding
Because:
- We want to Mozilla branding in content server

This Commit:
- Activates the l10n strings fro Mozilla branding
- Updates css to be inline with branding
- Creates 'Old L10N' strings that will be removed. These are placeholders just in case we need to roll something back.
- Moves the mozilla logo out of the footer and to the top left
2023-10-17 14:32:59 -07:00
Lisa Chan 71662e6824
fix(libs): Revise Common Content to include newsletter metadata fields 2023-10-17 08:59:41 -04:00
Lisa Chan 62970afb36
chore(contentful): Update Contentful Content Model with newsletter fields 2023-10-16 17:23:47 -04:00
Reino Muhl 70ebacc772
fix(nx): remove nx prject rootDir and main changes
Because:

* Manual changes were needed to all nx libraries to ensure expected
  TypeScript build and development intellisense behavior.

This commit:

* Removes the "rootDir" build option added to all libraries, to allow
  for relative paths. This is no longer necessary since issues using
  TypeScript path aliases have been resolved.
* Removes changes to "main" build option, which ensured the built
  version of package.json had the correct path to the main index.js.

Closes #
2023-10-16 13:32:53 -04:00
Ben Bangert 3ed06b3843
feat: add getOfferingOverlap to eligibility manager
Because:

* We want to determine whether a customer is eligible for a plan
  offering, and if so, which offering they are eligible for.

This commit:

* Adds the getOfferingOverlap method to the eligibility manager.

Closes FXA-8241
2023-10-11 11:14:00 -07:00
Reino Muhl b3a81a4870
feat(payments): rework nest config loader
Because:

* Nest app config loader needs to support uppercase env vars

This commit:

* Adds support for uppercase env vars to Nest app config loader
* Update MySQLConfig to handle normalization
* Fixes issue loading l10n ftl files

Closes #

Co-authored-by: Ben Bangert <ben@groovie.org>
2023-10-11 09:47:27 -04:00
Reino Muhl 90984ca1b0
feat(contentful): add contentful get locale
Because:

* Need to determine a valid locale configured in Contentful.

This commit:

* Add getLocale method to ContentfulClient to determine locale using
  locales available in Contentful and defaulting to 'en' as a fallback.

Closes #FXA-8225
2023-10-09 19:07:14 -04:00
Reino Muhl 63e5ab95fd
feat(libs): move fxa-shared/l10n to libs/shared/l10n
Because:

* We want to use functions from fxa-shared/l10n in new libs/* libraries
  including libs/shared/contentful.

This commit:

* Moves fxa-shared/l10n to libs/shared/l10n
* Updates all references in packages/*

Closes #FXA-8228
2023-10-04 16:08:01 -04:00
Ben Bangert d802413923
feat: add contentful manager and eligibility helper method
Because:

* We want to easily expose complete type-safe query methods to callers
  of the contentful client.

This commit:

* Adds a contentful manager class that exposes an eleigibility helper
  method along with appropriate types.

Closes FXA-8405

Co-authored-by: Julian Poyourow <7751154+julianpoy@users.noreply.github.com>
2023-10-02 08:18:13 -07:00
Lisa Chan 66f27b9a8b
Merge pull request #15827 from mozilla/FXA-8276_query
feat(contentful): Add query to get upgrade/eligibility-related content for a Plan ID
2023-09-26 14:10:42 -04:00
Lisa Chan e2bdb036db
feat(contentful): Add query to get upgrade/eligibility-related content for a Plan ID 2023-09-25 16:28:03 -04:00
Bianca Danforth 83501ecf83
feat(libs): create EligibilityManager library
Because:

* Plan eligibility depends on a number of factors, including what plans the user is already subscribed to (in Stripe, Google IAP or Apple IAP) and available upgrade paths for those plans per product-specific config (in Stripe metadata currently but soon to live in Contentful).
* We want to break out eligibility checks and types into a separate library from the auth server's `CapabilityService.getPlanEligibility`, since it's not really capability-oriented.

This commit:

* Generates a new nx library in lib/payments/eligibility

Closes #FXA-7582
2023-09-25 16:02:44 -04:00
Lisa Chan 841882800b
feat(contentful): Add query to get all clients 2023-09-21 11:44:23 -04:00
Meghan Sardesai fda5967daf
Merge pull request #15805 from mozilla/FXA-8211
chore(graphql): Add/update Contentful env vars
2023-09-20 12:50:02 -07:00
Lisa Chan ab07758dab
fix(contentful) - Update CouponConfig schema in Contentful 2023-09-20 11:53:25 -04:00
Meghan Sardesai 576a1fee37
chore(graphql): Add/update Contentful env vars
Because:

* We will be using the Contentful hCMS (specifically their GraphQL Content API) to replace Stripe metadata for RP-provided content in SubPlat 3.0.

This commit:

* Updates `CONTENTFUL_API_KEY` to `CONTENTFUL_GRAPHQL_API_KEY`.
* Adds additional properties — `CONTENTFUL_GRAPHQL_SPACE_ID` and `CONTENTFUL_GRAPHQL_ENVIRONMENT`.
* Updates `ContentfulClientConfig` to include `spaceId` and `environment` properties.
* Updates `ContentfulClient` to build the Contentful GraphQL URL from those properties.
* Updates GraphQL codegen after addition (2) and update (1) of aforementioned properties.

Closes FXA-8211
2023-09-19 20:46:16 -04:00
Reino Muhl 534ca6cc8b
Merge pull request #15795 from mozilla/initial-work-polish
feat(next): adjust component styles and polish checkout page
2023-09-15 17:55:07 -04:00
Reino Muhl 8fa9dd70f1
feat(next): adjust component styles
Because:

* With components split into libraries, we don't want to include styles
  in components that are defined/provided by the application consuming
  the components
* Split common JSX into smaller components where it makes sense
* Continue down the div reduction path

This commit:

* Removes non-global CSS files
* Where applicable, replace divs with landmarks that add more value
  for example lists and sections.
* Added <ListLabelItem> to PurchaseDetails component
* Remove unused styles
* Replace non-reused tailwind utility classes with inline declerations

Closes #
2023-09-15 17:38:01 -04:00
Ben Bangert 551ab6f906
feat(payments): add initial NestJS service load on heartbeat
Because:

* We want to load/cache the NestJS services on the first request to the
  app, so that the first request is not slow.
* We should use proper NextJS project organization.

This commit:

* Adds a new route to the app that the loadbalancers utilize, to ensure
  that the NestJS services are loaded before the first request to the
  app.
* Moves internal implementation that shouldn't be routed to, behind the
  underscore directory prefix.
2023-09-15 12:20:11 -07:00
Ben Bangert bc2ca4ac2c
Merge pull request #15796 from mozilla/load-nest-service-in-nextjs
feat: add nestJS service loading to payments-next
2023-09-15 08:23:11 -07:00
Ben Bangert e97fd383b8
feat: add nestJS service loading to payments-next
Because:

* We want to be able to call server-side logic with our business classes
  directly from the nextJS app before rendering on the server.

This pull request:

* Adds a NestJS application context to the NextJS app that can be used
  to load services and call methods on them.
2023-09-14 09:45:37 -07:00
Lisa Chan 8616a34f6d
feat(libs): Create CapabilityManager library 2023-09-14 09:15:26 -04:00
Julian Poyourow de31637b31
Merge pull request #15787 from mozilla/fxa-8314
chore(contentful): update graphql queries and schema
2023-09-12 16:00:49 -07:00
Julian Poyourow 1cb8e405ab
chore(contentful): update graphql queries and schema
Because:

* Purchase was previously only queriable via `linkedFrom`, which
  increased query complexity and was a little cumbersome.

This commit:

* Updates the Contentful typings for the schema change
* Uses the offering directly from the Purchase
* Renames a few things for standardization

Closes FXA-8314
2023-09-12 14:58:14 -07:00
Julian Poyourow adce4cfec1
feat(cart): add cart service skeleton
Because:

* We need a starter for a cart service as described in FXA-8130

This commit:

* Adds a skeleton for a cart service with the methods described in
  FXA-8130

Closes FXA-8130

Co-authored-by: Ben Bangert <100193+bbangert@users.noreply.github.com>
2023-09-12 14:23:58 -07:00
Julian Poyourow 5a442f76b8
Merge pull request #15784 from mozilla/fxa-8178
feat(contentful): query for capability by priceId
2023-09-12 13:56:57 -07:00
Reino Muhl 6fd7df90ac
Merge pull request #15710 from mozilla/fxa-8133-payments-next-initial
feat(next): payments-next initial work
2023-09-12 16:53:33 -04:00
Reino Muhl 3894a65527
feat(next): payments-next initial work
Because:

* Create the initial work for the Checkout page as a starting point and
  example for the rest of the SP3 components and pages.

This commit:

* Adds the payments/next/ui Next.js library.
* Move Header JSX into layout.tsx and remove ExampleHeader component.
* Add RSC PurchaseDetails, using JSX from SP2.5 PlanDetails component.
* Add RSC TermsAndPrivacy component
* Add various stubs functions for illustration purposes. These will be
  replaced with actual implementations in future tickets.
  * Cart fetch
  * Contentful fetch
  * Translation using @fluent/bundle

Closes FXA-8133
2023-09-12 14:24:39 -04:00
Julian Poyourow 5e1be3c9eb
feat(contentful): query for capability by priceId
Because:

* We need to be able to fetch a list of capability slugs and client IDs
  based on a list of priceIds.

This commit:

* Adds a query to fetch that information from Contentful via a GraphQL
  query, along with updated typings.

Closes FXA-8178
2023-09-12 09:11:30 -07:00
Julian Poyourow fe8d34f3da
Merge pull request #15782 from mozilla/fxa-8179
feat(contentful): query for stripe purhase details
2023-09-12 08:47:41 -07:00
Julian Poyourow 3df9d30534
feat(contentful): query for stripe purhase details
Because:

* We need to fetch purchase details with many other joined fields from
  contentful.

This commit:

* Adds a query that joins in all dependent data.

Closes FXA-8179

Co-authored-by: Meghan Sardesai <104124653+sardesam@users.noreply.github.com>
2023-09-12 08:00:31 -07:00
Meghan Sardesai a999afd748
chore(next): add Storybook to NextJS setup
Because:

* We want to include Storybook in 3.0.

This commit:

* Ensures Storybook component loads as expected.
* Ensures shared Tailwind styles can be used in payments-next and works with hot-reloading.
* Ensures the build script executes without any errors.

Closes FXA-7503
2023-09-11 17:26:30 -04:00
Ben Bangert 3c96bb79da
Merge pull request #15727 from mozilla/contentful-manager-typed-config
refactor: use typed config for Contentful client
2023-08-30 11:13:20 -07:00
Bianca Danforth 6e3a0a695a
refactor: use typed config for Contentful client
Because:

* We'd like to be able to use Nest-Typed-Config with a structured config file that can be validated at runtime if desired.

This commit:

* Adds a typed config class for the Contentful client.
* Reference PR: https://github.com/mozilla/fxa/pull/15724

Closes #No ticket
2023-08-30 13:04:34 -04:00
Dan Schomburg d29151935c
Merge pull request #15698 from mozilla/nx/ci-build-cache
task(CI): Improve nx caching for CI pipelines
2023-08-29 17:22:00 -04: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
Ben Bangert ae0230f7bb
refactor: use typed config for paypal client
Because:

* The paypal client config is a basic interface, and we'd like to be
  able to use Nest-Typed-Config with a structured config file.

This commit:

* Adds a typed config class for the paypal client.
2023-08-28 15:56:33 -07:00
Julian Poyourow 5b6060df51
chore(libs): add injectable to all library classes, centralize nest
Because:

* We want to easily be able to consume library classes within NestJS.
Adding the injectable decorator to all library classes means we can do
so with ease, but also doesn't prevent us from using the class outside
of the NestJS DI system.
* We want all dependencies (such as nest) centralized to the main
package.json

This commit:

* Adds the injectable decorator to every library class.
* Centralizes the NestJS dependency to the root package.json.

Closes: no relevant issue - polish PR.
2023-08-28 11:54:12 -07:00
Ben Bangert 832347e64c
refactor: switch to kysley cart manager
Because:

* We want to try out kysley for all db operations including the cart
  manager.

This commit:

* Switches the cart manager to use kysley.
2023-08-19 19:07:46 -07:00
Ben Bangert 0be6fd95c5
feat: add account manager class
Because:

* We want to have a single place to manage account related operations in
  the database layer.

This commit:

* Adds a new AccountManager class and account package.

Closes #FXA-6623
2023-08-18 09:06:28 -07:00
Julian Poyourow d65c9f9cc7
feat(shared): contentful client
Because
- We need a reusable client for accessing contentful

This Commit
- Adds a contentful client with automated codegen
- Creates a reusable query system

Closes FXA-7501
2023-08-16 16:27:12 +00:00
Reino Muhl 9c1afee646
feat(carts): refactor cart manager to match layers
Because:
- Refactor the Cart Manager to serve as higher level logic for the
  cart db model.

This commit:
- Removes service level logic.
- Adds common methods to be used by Cart Manager consumers.
- Adds checks for valid state by action and valid state transitions.
- Reverts playwright tests back to xlarge instance size

Closes FXA-8128
2023-08-15 18:03:36 -04:00
Reino Muhl f8e2a53bbb
Merge pull request #15666 from mozilla/fxa-8132-cart-add-version
feat(carts): Add version to carts table
2023-08-10 15:08:36 -04:00
Reino Muhl e2ecdbd46b
Merge pull request #15662 from mozilla/fxa-8119-ts-paths-alias-imports
feat(libs): allow packagename-based imports
2023-08-08 16:52:30 -04:00
Reino Muhl 633e5dca05
feat(carts): Add version to carts table
Because:
- Allow for optimistic locking for the carts table

This commit:
- Adds migrations to add version field to carts table.
- Updates patchById with version logic
- Updates cart model and test scripts

Closes FXA-8132
2023-08-08 13:49:54 -04:00
Reino Muhl 26537a484e
feat(libs): allow packagename-based imports
Because:
- we want to be able to use packagename based imports, defined in
  tsconfig.base.json paths, throughout the repo.

This commit:
- Adds a workaround fix to libs/**/project.json > main properties to
  ensure that the built dist/libs/**/.package.json has the correct
  main property.
- Upgrades esbuild-register to latest version, which includes
  tsconfig path resolution.
- Adds tsconfig-paths to auth-server mocha based tests.
- Adds various workarounds to fxa-graphql-api including the following
  - Adds paths from `tsconfig.base.json` to `tsconfig.build.json`
    excluding the extension.
  - Add pathToModuleNameMapper to all jest*.config.js
  - Add build step before tests are run
2023-08-07 14:01:05 -04:00
Dan Schomburg 5571e80284
Merge pull request #15656 from mozilla/change-test-target-for-nx-projects
task(many): Switch nx test target to be test-unit
2023-08-04 10:00:20 -07:00
dschom 535498214a
task(many): Switch nx test target to be test-unit
Because:
- The CI already targets test-unit
- We want to draw a distinction between unit and integration tests.

This Commit:
- Renames "test" to "test-unit" in lib packages.
- Sets up CI to run integration tests on 'libs' folder packages
- Adds tags to nx projects in libs folder
2023-08-03 15:38:16 -07:00
Ben Bangert 1ca77c5ffd
fix: add remaining rootDir for build to complete
Because:

* The build was failing due to missing rootDir in the project.json files.

This commit:

* Adds the missing rootDir to the project.json files.
2023-08-03 13:54:18 -07:00
Reino Muhl 1b9cbff619
feat(payments): cart manager cleanup
Because:

* Some items were identified not to meet code organization standards
  the team is implementing with Nx.
* Nx identified some circular dependencies that need resolving.

This commit:

* Resolves circular dependencies.
* More to do
2023-08-03 16:28:48 -04:00
Ben Bangert a1e6cbe52d
feat: polsih error refactor
Because:

* We had some last minute tweaks to the error arrangement.

This commit:

* Moves the error class to the library using it and inherits from a
  shared base error.
2023-08-02 16:24:29 -07:00
Bianca Danforth 616e24978c
Merge pull request #15627 from mozilla/FXA-7656
feat(shared): create error library
2023-08-02 12:15:22 -04:00
Bianca Danforth a9dc3372fe
feat(shared): create error library with initial error classes
Because:

* We want an error library to generalize error handling across all new integrated libraries.

This commit:

* Generates a new JS library with nx called shared-error that exports a few error classes.
* Ports the PayPalClientError to the new library as an example error (renamed to PayPalNVPError with PayPalClientError becoming a MultiError composed of one or more PayPalNVPErrors), refactoring the multiple error handling logic to a new helper.

Closes #FXA-7656
2023-08-02 11:26:54 -04:00
Ben Bangert 62cedecbac
fix: remove circular dependency between account and core
Because:

* The circular dependency between account and core was causing
  problems with the build.

This commit:

* Moves the setup function from core to account.
2023-08-01 18:50:51 -07:00
Reino Muhl 868a723be6
feat(payments): add cart library and factories
Because:

* Need a library to handle the cart db table and related functions

This commit:

* Add cart DB model
* Initializes the Cart library and creates factories and types
* Adds CartManager library
* Adds Cart related resolvers with basic Cart DB queries

Closes: #FXA-7508 #FXA-7505
2023-08-01 14:42:42 -04:00
Ben Bangert 9e1670ab30
feat: add foundational db classes
Because:

 * We want to use clean and well tested code for our new integrated
   account database layer.
 * We don't want to use stored procedures for new code.

This commit:

 * Adds a new library that contains core mysql connection functionality.
 * Duplicates core objection classes and setup from fxa-shared without
   stored procedure functionality.

Closes FXA-6622
2023-07-24 14:44:12 -04:00
Lisa Chan d4bf24117c
chore(next): Add Next.js to fxa and initial setup 2023-07-19 14:57:15 -04:00
Reino Muhl dd5eb6d772
fix(payments/paypal): convert undefined before request
Because:

* objectToNVP converts object properties with undefined values to a
  string with value undefined. PayPal expects undefined values to be
  an empty string param.

This commit:

* Converts object properties with an undefined value to empty string.
2023-06-28 10:34:05 -04:00
Julian Poyourow 1faa33a353
feat(payments/paypal): add subs/paypal library
Because:

* Nx gives us the ability to break things up into smaller libraries with
  individual responsibilities.
* Paypal logic can exist in a standalone library for reusability in SP3

This commit:

* Moves PayPalClient and associated utils/typings to a library named
  `subs/paypal`. It can be imported via `@fxa/payments/paypal` in any
  TypeScript code.

Closes FXA-7610
2023-06-07 11:40:10 -07:00