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

57 Коммитов

Автор SHA1 Сообщение Дата
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