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

353 Коммитов

Автор SHA1 Сообщение Дата
Meghan Sardesai 5d5b8f05e0
feat(payments-paypal): create PaypalService createBillingAgreement method
Because:

* Part of M3a.
* We want `createBillingAgreement` added to PaypalService.

This commit:

* Adds `createBillingAgreement` in `PaypalService`.
* Adds `CurrencyManager` library.
* Adds `status` to `createBillingAgreement` in `PaypalRepository`.
* Adds/updates all applicable tests.

Closes FXA-8935
2024-04-24 11:07:34 -07:00
Barry Chen d588eb23e8
feat(password): send OTP to start password reset flow
Because:
 - we want to use OTPs to improve the UX of the password reset flow

This commit:
 - adds a lib for generating and validating random numeric OTPs
 - adds a new auth-server endpoint for requesting the OTP in an email
   - this endpoint does not send an email yet; To Be Implemented
2024-04-24 12:11:14 -05:00
Lisa Chan 3689e4bb13
feat(payments-stripe): Add updateSubscription to stripe manager 2024-04-24 12:10:05 -04:00
Lisa Chan 9b4064ee36
Merge pull request #16775 from mozilla/FXA-9452
feat(payments-stripe): Add subscriptionsUpdate method to StripeClient
2024-04-24 11:45:31 -04:00
Dan Schomburg d4024a6c53
Merge pull request #16742 from mozilla/FXA-9412-send-metrics-opt-out 2024-04-24 08:44:09 -07:00
dschom 8b9051f881
task(graphql): Send notifications when users opt in/out of metrics collection
Because:
- We want to let RPs know when users opt out of metrics collection
- We want to let RPs know when users opt in to metrics collection

This Commit:
- Ports the notifier code over to nx libs from auth server
- Ports other supporting libraries from fxa-shared to nx libs
  - MozLoggerService
  - Sentry
  - Metrics (ie statsd)
- Updates graphql to emit a 'metricsChange' event when users toggle their 'Help improve Mozilla accounts' option in settings.
- Adds support for the metricsChanged event to the fxa-event-broker
2024-04-24 08:10:14 -07:00
Lisa Chan bd52dba43d
fix(tests): Add expect.assertions for tests with `.rejects` 2024-04-24 10:56:53 -04:00
Lisa Chan 796b26b243
feat(payments-stripe): Add subscriptionsUpdate method to StripeClient 2024-04-23 20:20:01 -04:00
Julian Poyourow bccfb27e38
feat(checkout): add checkout service with stripe and paypal
Because:

* We want a service to manage checkout behaviors

This commit:

* Adds a checkout service

Closes FXA-9020
Closes FXA-8943
Closes FXA-9022
Closes FXA-8941
2024-04-23 17:02:47 -07:00
Lisa Chan 4fdd629fce
fix(payments-eligibility): Clean up tests 2024-04-23 18:39:57 -04:00
Lisa Chan 5a39a81604
Merge pull request #16721 from mozilla/FXA-8893
feat(libs): Update CartService setupCart to check eligibility
2024-04-23 18:32:25 -04:00
Reino Muhl 8c41fdb351
feat(cart): add get cart action to pages
Because:

* Pages were still calling mock get cart

This commit:

* Adds getCartOrRedirect to all pages
* Redirects to appropriate page if cart.state does not much current page

Closes #FXA-9039
2024-04-23 17:10:39 -04:00
Lisa Chan 64f1c790b6
Revisions based on feedback 2024-04-23 16:57:05 -04:00
Lisa Chan 2692c78798
WIP Revisions based on feedback 2024-04-23 15:08:54 -04:00
Reino Muhl cb41181b4d
feat(next): add typesafe config
Because:

* Use Next.js standard environment variable procedure
* Provide typed config to be used throughout Payments Next.

This commit:

* Refactor config to use Next.js native environment loaders
* Remove .env.json and .env.production.json
* Add validator and transformer functions to provide
  validated and typesafe config.

Closes #FXA-9436
2024-04-23 12:47:18 -04:00
Lisa Chan 911a4a4d4a
feat(libs): Update CartService setupCart to check eligibility 2024-04-21 15:47:12 -04:00
Reino Muhl 2455e4d5dc
feat(carts): add eligibilityStatus to cart db
Because:

* Cart needs eligibility status of current cart.

This commit:

* Add new field, eligibilityStatus, to cart db as Enum
* Add CartEligibilityStatus enum to kysely types

Closes #FXA-9472
2024-04-19 11:00:44 -04:00
Reino Muhl 7f3d030e8b
feat(next): add handle stripe error action
Because:

* Need a server action to handle errors returned from Stripe elements
  submit function.

This commit:

* Creates handleStripeError action and related Nextjs Action Service
* Adds checkoutErrorCart to Cart Service
* Add cart.utils
* Add tests for cart.utils and checkoutErrorCart

Closes #FXA-8851
2024-04-18 16:16:58 -04:00
dschom b150461189
bug(auth): Accounts aren't fully deleted
Because:
- Accounts were not being fully deleted
- Since do not use a keyfile, the check on whether or not the queue was enabled did not pass, and the explicit check to run in stage/prod was lost in the refactor

This commit:
- Removes the queueEnabled flag check entirely. (Now that a local emulator is present we can assume the queue should always be available.)
- Adds back in the `fallback` option to the CloudTasksClient, which indicates the client should use https instead of grcp, which has proven to be a more reliable setting.
2024-04-16 15:51:14 -07:00
Reino Muhl 9f909792e3
Merge pull request #16676 from mozilla/fxa-8892-sa-setupcart
feat(next): create setupCart server action
2024-04-15 14:52:49 -04:00
Reino Muhl 1af436e8fe
Rename geodb to GeoDB 2024-04-15 12:49:46 -04:00
Reino Muhl 061f09864a
Rebase and refactor to nestjsActionsService 2024-04-15 12:49:36 -04:00
Reino Muhl c595afe4f3
feat(next): create setupCart server action
Because:

* Call CartService.setupCart from payments-next via server action.

This commit:

* Extracts fxa-geodb into libs/* library
* Updates CartService to include GeodbManager
* Call setupCart from payments-next

Closes #FXA-8892
2024-04-15 12:48:35 -04:00
Julian Poyourow 938c3dff58
chore(shared-db-mysql): add account db mock provider 2024-04-15 09:17:22 -07:00
Meghan Sardesai 8f00d29098
feat(payments-ui): add restartCart server action
Because:

* We need a server action to restart the cart.

This commit:

* Adds a simple server action to restart the cart.

Closes FXA-8899
2024-04-14 22:50:01 -04:00
Reino Muhl c1c1d7dddb
feat(next): use next 14.2 instrumentation
Because:

* Want to use Next.js instrumentation featuer to start NestApp on
  Next.js server startup.

This commit:

* Upgrades Next.js to version 14.2 which includes intrumentation fixes.
* Adds instrumentation logic.

Closes #

Co-authored-by: Ben Bangert <100193+bbangert@users.noreply.github.com>
2024-04-11 17:46:56 -04:00
Lisa Chan 8e54c402c7
Merge pull request #16687 from mozilla/FXA-8948
feat(payments-stripe): Create StripeManager cancelIncompleteSubscription
2024-04-11 13:04:00 -04:00
Lisa Chan bc5fe4015e
feat(payments-stripe): Create StripeManager cancelIncompleteSubscription 2024-04-11 12:33:12 -04:00
Lisa Chan a8c4f9a45a
Merge pull request #16690 from mozilla/FXA-7516
feat(payments-ui): Component - SubscriptionTitle
2024-04-10 18:15:45 -04:00
Julian Poyourow f619c142fb
feat(payments-stripe): add cancelSubscription to stripe manager
Because:

* We want to be able to cancel subscriptions from non-stripe lib

This commit:

* Adds a stripe manager method to do so

Closes FXA-9027
2024-04-10 09:26:58 -07:00
Lisa Chan de58e99bc1
feat(payments-ui): Component - SubscriptionTitle 2024-04-10 10:11:49 -04:00
Julian Poyourow 67f81ae927
feat(payments-ui): add class-validator and class-transformer to actions
Because:

* We need validation for the input to our actions. We also use
  class-validator and class-transformer elsewhere, and although I'm not
  the most fond of this syntax/setup vs something like zod, we don't
  have zod as a dependency at the moment.

This commit:

* Adds class-validator and class-transformer as well as validations for
  each for the getCart and updateCart actions
2024-04-10 00:04:44 -07:00
Julian Poyourow e62224e759
feat(payments-ui): add updateCart server action
Because:

* We need a server action to be able to update the cart details

This commit:

* Adds a server action to be able to update the cart details

Closes FXA-8900
2024-04-10 00:04:43 -07:00
Julian Poyourow a9d97ffa05
feat(payments-ui): add getCart server action
Because:

* We need a server action to fetch the cart

This commit:

* Adds a simple server action to fetch the cart

Closes FXA-8902
2024-04-10 00:04:40 -07:00
Reino Muhl 5f27943192
Merge pull request #16669 from mozilla/fxa-8898-setupcart-retrieve-cuid
feat(cart): add stripe customer id on cart setup
2024-04-09 16:46:59 -04:00
Reino Muhl 268a9e357a
feat(cart): add stripe customer id on cart setup
Because:

* On cart setup, add stripe customer id, if it exists, to the cart.

This commit:

* Adds method to AccountCustomerManager to get stripe customer id or
  return null.
* Adds AccountCustomerManager to CartService and fetches stripe customer
  id.
* Splits unit and integration tests for the payments-cart library

Closes #FXA-8898
2024-04-09 16:20:52 -04:00
Lisa Chan 82f7fc2609
fix(libs): Revise tests - test-unit and test-integration 2024-04-08 17:11:06 -04:00
Lisa Chan 3426a28f54
Merge pull request #16662 from mozilla/FXA-8889
feat(payments-stripe): Create AccountCustomer repository
2024-04-08 16:32:52 -04:00
Lisa Chan ebe1d4d267
feat(payments-stripe): Create AccountCustomer repository 2024-04-08 15:50:06 -04:00
Reino Muhl b30ab0345e
Merge pull request #16615 from mozilla/fxa-8822-l10n-localizer
feat(next): add l10n to localizer for next rsc
2024-04-08 15:37:22 -04:00
Reino Muhl 652c09ab50
feat(next): add l10n to localizer for next rsc
Because:

* Ensure all localization strings can be localized in React Server
  Components.

This commit:

* Removes LocalizerServer
* Adds LocalizerRSC to serve as a wrapper for ReactLocalization that can
  be used by React Server Components, as well as a few other utility
  methods.
* Adds LocalizerRscFactory that instantiates LocalizerRSC only with
  bundles for a provided acceptLanguage string.
* Adds LocalizerRscFactoryProvider to be used with the NestApp to
  instantiate and then intialize the LocalizerRscFactory. Initalization
  will fetch all messages from disk and populate the bundles.
* Reorganize shared/l10n library to match Node style guide
* Removes demo l10n code
* Update purchase-details, terms-and-service components, and success and
  error pages to use new LocalizerRSC class for localization.
* Adds temporary l10n-convert script to provide translation for existing
  ftl strings.

Closes #FXA-8822
2024-04-08 14:58:17 -04:00
Julian Poyourow 4b1c2a838f
feat(payments-stripe): add methods to stripe client
Because:

* We need some additional methods in Stripe client

This commit:

* Adds those methods

Closes FXA-9025
2024-04-08 10:51:13 -07:00
Julian Poyourow 3c6b5b5a81
feat(payments-stripe): add new stripe methods and update naming
Because:

* Our naming in our client needlessly renamed Stripe methods making it a
  little harder to understand what is going on

This commit:

* Updates our naming to match what Stripe has, so that it's easier to
  look stuff up.

Closes FXA-9019
2024-04-04 11:19:18 -07:00
Julian Poyourow 089545272e
feat(payments-stripe): add retrieveUpcomingInvoice
Because:

* We need to be able to fetch upcoming invoices via the typed Stripe
  client

This commit:

* Adds retrieveUpcomingInvoice to the typed Stripe client

Closes FXA-8895
2024-04-04 09:49:45 -07:00
Lisa Chan 3354f25b44
Merge pull request #16625 from mozilla/FXA-8946
feat(payments-stripe): Create StripeManager getTaxIdForCurrency
2024-04-03 13:49:31 -04:00
Lisa Chan ce1c451752
feat(payments-stripe): Create StripeManager getTaxIdForCurrency
Co-authored by: Julian Poyourow
2024-04-03 13:20:45 -04:00
Reino Muhl decc372da0
Merge pull request #16647 from mozilla/add-localizer-web
feat(l10n): add localizer client
2024-04-03 08:35:46 -04:00
Reino Muhl 5863d6c042
feat(l10n): add localizer client
Because:

* Need a Localizer implementation that can be used in a react client
  component.

This commit:

* Creates LocalizerClient which instantiates an instance of
  ReactLocalization to be used by the LocalizationProvider.

Closes #
2024-03-29 12:21:03 -04:00
Lisa Chan 98d473ea3d
fix(payments-next): Page - revise Checkout layout 2024-03-28 15:44:20 -04:00
Julian Poyourow 1e907e3b67
fix(stripe-client): fix updateCustomer tax expand 2024-03-28 11:30:57 -07:00
Lisa Chan acd9992ea4
Merge pull request #16638 from mozilla/FXA-9367
fix(payments-next): Move searchParams to params
2024-03-28 13:17:12 -04:00
Lisa Chan bcbb9e7a72
fix(payments-next): Move searchParams to params 2024-03-28 11:02:31 -04:00
dschom d7c703f2fa
task(auth): Have auth-server use cloud-tasks nx lib
Because:
- We want to use the `cloud-tasks` nx lib that introduced last sprint

This commit
- Updates account end points to use the nx lib
- Updates CI to include cloud-task emulator

(cherry picked from commit 7c0c70d2a4)
2024-03-27 16:16:18 -07:00
Valerie Pomerleau 9b820bde13
Revert "task(auth): Have auth-server use cloud-tasks nx lib " 2024-03-27 13:23:46 -07:00
Julian Poyourow be35da3a8f
Merge pull request #16634 from mozilla/FXA-8891
feat(stripe-client): add stripe typings utility type and base types
2024-03-27 09:11:29 -07:00
Dan Schomburg af1691928e
Merge pull request #16626 from mozilla/FXA-9270
task(auth): Have auth-server use cloud-tasks nx lib
2024-03-27 07:28:19 -07:00
Julian Poyourow 46c92b32b8
feat(stripe-client): add stripe typings utility type and base types 2024-03-26 23:53:19 -07:00
dschom 7c0c70d2a4
task(auth): Have auth-server use cloud-tasks nx lib
Because:
- We want to use the `cloud-tasks` nx lib that introduced last sprint

This commit
- Updates account end points to use the nx lib
- Updates CI to include cloud-task emulator
2024-03-26 15:43:57 -07:00
Lisa Chan 500b2a0b09
Merge pull request #16607 from mozilla/FXA-8939
feat(payments-paypal): Create PaypalManager getCustomerBillingAgreementId
2024-03-26 17:10:28 -04:00
Meghan Sardesai 152039c1de
feat(payments-stripe): Create StripeManager addTaxIdToCustomer
Because:

* Part of M3a.
* We want `addTaxIdToCustomer` added to StripeManager.

This commit:

* Adds aforementioned method to `StripeManager` using existing implementation for reference.
* Updates customer metadata with `taxId` when customer `taxId` does not match incoming `taxId`.

Closes FXA-8944
2024-03-26 16:40:23 -04:00
Lisa Chan 2a77b82c98
feat(payments-paypal): Create PaypalManager getCustomerBillingAgreementId 2024-03-26 16:34:39 -04:00
Lisa Chan 9487944698
Merge pull request #16616 from mozilla/FXA-8937
feat(payments-paypal): Create PayPalManager cancelBillingAgreement method
2024-03-25 15:38:18 -04:00
Lisa Chan 66cc0a9446
feat(payments-paypal): Create PayPalManager cancelBillingAgreement method 2024-03-25 15:00:12 -04:00
Reino Muhl 695d791b15
feat(l10n): add localizer class for payments next
Because:

* Create a localizer class that can be used by payments next react
  server components.
* Only generate fluent bundles once on startup.

This commit:

* Moves logic from Localizer class, defined in
  `fxa-auth-server/lib/l10n/index.ts`, to a LocalizerBase class.
* Adds LocalizerServer class to be used by payments next.
* Moves nestapp from payments-next app to a library

Closes #FXA-8821
2024-03-22 08:58:53 -04:00
Lisa Chan 2e55eda99e
Merge pull request #16575 from mozilla/FXA-7518
feat(shared-assets): Create library for shared assets
2024-03-20 19:20:35 -04:00
Lisa Chan 25bcf355ed
feat(shared-assets): Create library for shared assets 2024-03-20 18:54:49 -04:00
Julian Poyourow 473ba056bb
feat(paypal): Add paypal repository
Because:

* We want to be able to interact with the paypalCustomer table from the
  new libs structure

This commit:

* Adds a paypalCustomer repository

Closes FXA-8888
2024-03-19 09:17:01 -07:00
Lisa Chan 489a297ebf
Merge pull request #16552 from mozilla/FXA-8938
feat(payments-paypal): Create PayPalManager getCustomerPayPalSubscriptions
2024-03-18 11:45:22 -04:00
Lisa Chan 10ac42f0ea
feat(payments-paypal): Create PayPalManager getCustomerPayPalSubscriptions 2024-03-18 11:13:28 -04:00
Reino Muhl a13403c726
Merge pull request #16553 from mozilla/fxa-8949-stripe-customer-changed
feat(stripe): add customerChanged method
2024-03-15 15:54:39 -04:00
Lisa Chan e1ae983efb
Merge pull request #16545 from mozilla/FXA-8942
feat(payments-paypal): Create PayPal processInvoice, processZeroInvoice, and processNonZeroInvoice
2024-03-14 18:22:09 -04:00
Lisa Chan accab36bd8
feat(payments-paypal): Create PayPal processInvoice, processZeroInvoice, and processNonZeroInvoice 2024-03-14 17:56:06 -04:00
Ben Bangert c28b061257
chore: update Node to LTS 20, TypeScript, tsconfig
Because:

* We want to update to Node 20 LTS.
* We want to target the JS output of Node 20.
* We want to use the latest TypeScript 5.4

This commit:

* Updates the Node version to 20 LTS.
* Updates the TypeScript version and related TS libs
  to 5.4.
* Updates tsconfig for the new Node 20 target.
2024-03-14 11:54:20 -07:00
Reino Muhl a76ca8e8bf
feat(stripe): add customerChanged method
Because:

* Move customerChanged method to shared library

This commit:

* Moves customerChanged to StripeService
* Adds placeholders and mentioned tickets to add required services

Closes #FXA-8949
2024-03-13 14:51:48 -04:00
dschom aaa625ce15
task(admin-panel): Hookup account delete
Because:
- We want to delete accounts from the admin panel

This Commit:
- Adds cloud task emulator pm2 service
- Creates cloud-task nx lib for interacting with cloud tasks
- Creates PageDeleteAccount in admin panel
- Adds ability to delete accounts to admin server's account resolver
- Fixes broken admin panel configuration
- Fixes broken admin server configuration
2024-03-13 11:26:09 -07:00
Meghan Sardesai 380caf6ab9
feat(auth): add boolean flag that skips Stripe comparison in favour of Contentful
Because:

* We want a seamless cutover from Stripe metadata to Contentful.

This commit:

* Adds a boolean feature flag to use Contentful data directly.

Closes FXA-9062
2024-03-12 21:46:09 -04:00
Reino Muhl 856ccbc87c
Merge pull request #16518 from mozilla/fxa-8819-grunt-l10n-scripts
feat(next): add l10n grunt scripts
2024-03-11 14:39:42 -04:00
Lisa Chan 85422b845d
Merge pull request #16527 from mozilla/FXA-8934
feat(payments-paypal): Create PayPalManager getBillingAgreement
2024-03-11 12:24:21 -04:00
Reino Muhl a11256cb50
feat(next): add l10n grunt scripts
Because:

* Add grunt script used to manage and update l10n ftl files used by
  payments next

This commit:

* Adds grunt scripts copy:branding-ftl, concat:ftl and watch:ftl

Closes #FXA-8819
2024-03-08 10:53:25 -05:00
Lisa Chan 4bcf6313f2
feat(payments-paypal): Create PayPalManager getBillingAgreement 2024-03-08 09:17:18 -05:00
Julian Poyourow eb94bfc9be
Merge pull request #16487 from mozilla/polish-update-type-cacheable
feat(type-cacheable): update to load firestore adapter from lambda
2024-02-28 10:42:56 -08:00
Julian Poyourow 11c48737bc
feat(type-cacheable): update to load firestore adapter from lambda 2024-02-27 15:59:33 -08:00
Lisa Chan f8314a71a7
feat(payments-paypal): Create PayPalManager getCheckoutToken 2024-02-27 15:11:08 -08:00
Lisa Chan e9ecacc892
feat(payments-paypal): Create PayPalService 2024-02-22 16:17:59 -05:00
Lisa Chan 05fc424655
Merge pull request #16465 from mozilla/FXA-8947
feat(payments-stripe): Create StripeManager isCustomerStripeTaxEligible
2024-02-22 14:03:25 -05:00
Lisa Chan d007ec9354
feat(payments-stripe): Create StripeManager isCustomerStripeTaxEligible 2024-02-22 13:11:45 -05:00
Reino Muhl 275ecdb0b8
feat(next): reorg checkout pages
Because:

* Reorganize checkout pages to include intent and cartId in path, and
  allow for landing page.

This commit:

* Reorganizes checkout pages
* Add checkout landing page
* Add getLocaleFromRequest and update l10n locale logic

Closes #FXA-7804
2024-02-22 13:06:09 -05:00
Julian Poyourow 388e01e52d
feat(mysql): add AccountCustomers and PaypalCustomers 2024-02-21 10:34:05 -08:00
Lisa Chan 99f6e5e4c8
fix(payments): Return sorted capabilities 2024-02-16 10:58:26 -05:00
Julian Poyourow 5b03fa14e3
fix(type-cacheable): caching TTL 2024-02-14 10:26:26 -08:00
Julian Poyourow 573a18be60
feat(auth): type-cacheable firestore and networkfirst adapter 2024-02-14 09:01:30 -08:00
Reino Muhl 7e5e74236b
fix(auth): offering comparison upgrade fix
Because:

* Offering comparison in the eligibility manager incorrectly indicates
  a downgrade if the difference between the target and source index
  is greater than 1, which can happen for subgroups with multiple
  offerings.

This commit:

* During offering comparison, if the difference between target and
  source index is positive, return UPGRADE, for values that are the same
  return SAME, and negative values return DOWNGRADE.

Closes #
2024-02-13 19:32:35 -05:00
Lisa Chan 8cfa910972
feat(payments-paypal): Create PayPalManager 2024-02-13 15:54:07 -05:00
Lisa Chan f6bfe1e961
Merge pull request #16408 from mozilla/paypal_files
fix(payments-paypal): Rename PayPal library filenames
2024-02-13 14:49:49 -05:00
Lisa Chan 8119a0a910
Merge pull request #16407 from mozilla/create_stripeclient
feat(payments-stripe): Create StripeClient and StripeManager
2024-02-13 14:46:00 -05:00
dschom 6902ac3b03
task(shared, graphql): Record ip in security events 2024-02-12 18:21:15 -08:00
Lisa Chan de80c7f1bc
Merge pull request #16271 from mozilla/hackathon_bonus
chore(next): Hackathon bonus tasks
2024-02-12 14:06:24 -05:00
Lisa Chan ff7413d833
feat(payments-stripe): Create StripeManager 2024-02-12 13:44:40 -05:00
Lisa Chan 0056e3c812
feat(payments-stripe): Create StripeClient 2024-02-12 13:28:54 -05:00
Lisa Chan d8b074d5e7
fix(payments-paypal): Rename PayPal library filenames 2024-02-12 13:26:08 -05:00
Reino Muhl 40be842af4
Merge pull request #16390 from mozilla/nx-18-upgrade-v2
chore(nx): upgrade to nx 18
2024-02-12 11:34:26 -05:00
Reino Muhl bbcc07802a
feat(contentful): Add statsd metrics to contentful
Because:

* Want to track number of requests and timings of those requests made
  to contentful.

This commit:

* Adds event emitter to Contentful Client, similar to PayPal Client.
* Add statsd to Contentful Manager to to track requests timings on
  contentful client event.

Closes #FXA-9031
2024-02-12 09:42:21 -05:00
Reino Muhl 2df7ca494a
chore(nx): upgrade to nx 18
Because:

* Want to migrate Nx to latest

This commit:

* Migrate nx to 18 using nx cli migrate latest
* Readd a few dev dependancies back into packages/**/package.json
  * Behavior of `npx nx...` commands seems to have changed, resulting in
    multiple "command not found: <library>" errors, where <library>
    refers to libaries used in packages/**/package.json scripts, such as
    tailwindcss, tsc-alias, nx, etc.
* Updates nx cache location for Circle CI

Closes #FXA-8880
2024-02-12 09:01:00 -05:00
Lisa Chan c830f10f0e
chore(next): Bonus tasks - update Error page to include error mapping, update pages to include l10n 2024-02-08 10:23:54 -05:00
Meghan Sardesai 293347b191
Merge pull request #16348 from mozilla/update_Contentful_services_capabilities
fix(contentful): update field validation in capabilities and services
2024-02-07 09:40:35 -08:00
Reino Muhl 01a7d0be6b
feat(auth): partial firestore cleanup script
Because:

* Need to remove customers and related subcollections, from firestore,
  for customers already deleted in FxA.

This commit:

* Adds a script that parses through all Firestore customer records, and
  checks if the customer has a valid FxA account. If not, the uid is
  added to the delete account cloud task queue, for deletion.

Closes #FXA-8969
2024-02-07 11:22:16 -05:00
Meghan Sardesai 3f41a85ada
fix(contentful): update field validation in capabilities and services
Because:

* A mismatch was occurring between Stripe and Contentful capabilities due to the latter not being marked as required.

This commit:

* Updates Capability and Service to required to ensure items are populated before publishing.

Relates to FXA-9052
2024-02-06 14:50:55 -08:00
Lisa Chan 0b065c7d1d
Merge pull request #16335 from mozilla/update_newsletterLabelTextCode
fix(contentful): Remove 'default' from newsletterLabelTextCode
2024-02-06 17:08:56 -05:00
Meghan Sardesai 1683e7056a
fix(contentful): validate that items in planIdsToClientCapabilities are populated
Because:

* Sentry is throwing an undefined error when `items` are missing.

This commit:

* Validates that `capabilitiesCollection` items and `servicesCollection` items are populated or returns an empty array.
* Adds additional tests to check that both collections are populated.

Closes FXA-9052
2024-02-05 19:42:11 -08:00
Lisa Chan c843b11c55
fix(contentful): Remove 'default' from newsletterLabelTextCode 2024-02-05 09:43:51 -05:00
Valerie Pomerleau 1558bc05ff
feat(copy): Update references to Firefox Monitor with Mozilla Monitor
Because:

* Monitor is rebranding

This commit:

* Update all references and l10n strings and terms from Firefox Monitor to Mozilla Monitor
* Update link to monitor's site

Closes #FXA-9036
2024-01-24 14:06:29 -08:00
Valerie Pomerleau e6d5833e9a
feat(auth): Add atLeast18AtReg value to account
Because:

* Some RPs (currently only Moz Social) would like to know if users were at least 18 at time of account registration to prevent asking users a second time if we've already confirmed at COPPA check that they are at least 18

This commit:

* Adds a new atLeast18AtReg column in the account database, with default set to null for existing accounts
* At account registration via backbone or React, checks if the submitted age is at least 18 and store the response as a boolean value (we do not store the exact age)
* Makes this value available to RPs at the v1/profile endpoint via account/profile

Closes #FXA-8751
2024-01-22 22:13:41 -08:00
Reino Muhl 5090aa6887
fix(next): error on page refresh
Because:

* Async function in render logic caused hydration error on page refresh

This commit:

* Remove async from `getFormatedMsg` wrapper function

Closes #FXA-8852
2024-01-22 11:45:42 -05:00
dschom 00856bd974
PR Feedback - can just stub a v1 account 2024-01-18 10:20:39 -08:00
dschom dce3709678
PR Feedback - Don't set wrapWrapKb2 on stub account 2024-01-18 10:11:18 -08:00
dschom 447da5eaf6
PR Feedback
(will squash before merge!)
2024-01-17 09:16:58 -08:00
dschom 1d9b18b3fa
task(auth): Support V2 credential format
Because:
- We want to add support for up coming changes to key stretching in the auth server first
- We want to ensure all changes are backwards compatible

This Commit:
- Updates test to use approach for the client side stretch where:
   - Stretch uses 650k iterations
   - Client salt uses random value instead of user's original email
- Updates tests to run using both V1 and V2 credentials
- Updates database to support new  columns for housing V2 credentials
- Updates account models accordingly
- Adds statsd metrics to track use of v2 credentials
- Updates CI tests to run remote integration tests for V2 credentials
2024-01-17 09:16:57 -08:00
Reino Muhl 0a58cf823b
fix(auth): contentful comparison per product
Because:

* The Contentful content is fetched for only one locale, however the
  comparison logic was comparing it against all plan's for all "locales"
  configured for a product.

This commit:

* Updates the error reporting to only include 1 error message per ID.
  Typically this will be a Stripe product ID.
* Adds the request acceptLanguage to Sentry context, so that it is
  easier to identify which language the comparison was done for.

Closes #FXA-8856
2024-01-02 17:43:34 -05:00
Lisa Chan 3c34572801
fix(contentful): Fix Contentful errors around complexity - EligibilityContentByPlanIds 2023-12-22 16:51:25 -05:00
Reino Muhl 7c162af868
fix(contentful): add support for zero results
Because:

* Update ContentfulManager method to account for zero results returned
  by Contentful query.

This commit:

* Updates while loop condition

Closes #FXA-8865
2023-12-22 13:01:55 -05:00
Lisa Chan c76abb30df
fix(shared-contentful): Fix Contentful errors regarding query size 2023-12-19 16:55:21 -05:00
Meghan Sardesai a8803ba203
fix(contentful): Contentful errors around complexity
Because:

* Queries were exceeding complexity and throwing errors in Sentry.

This commit:

* Reduces complexity of the affected query.
* Adds `total` and pagination.

Closes FXA-8747
2023-12-15 11:52:41 -05:00
Lisa Chan 7dd8974a9a
chore(shared-contentful): Add support for Offering.stripeLegacyPlans 2023-12-07 16:11:06 -05:00
Meghan Sardesai 2403735dab
chore(lib): move unsorted queries into their own directories
Because:

* We want SP3 to have a soild foundation, consistency, and organization.

This commit:

* Moves `purchaseWithDetailsQuery` and 'offeringQuery' into their own directories.
* Moves related content into respective directories and updates paths.
* Updates types and factories where applicable.
2023-12-06 19:51:33 -05:00
Ben Bangert 3878034f0b
feat: add winston logger and nest helper
Because:

* We want to use winston for logging in new applications.

This commit:

* Adds winston logging and Nest helpers with a console monkey-patch.
2023-11-30 12:22:35 -08:00
Lauren Zugai 0cdee94037
chore(all): Upgrade GQL and dependencies
Because:
* We want to use the latest graphql dependency

This commit:
* Updates GQL dep and all packages relying on it
* Moves some dependencies to root package.json
* Removes a couple of deps we aren't using
* Addresses breaking changes, updates related tests and mocks
* Fixes type errors
* Prettifies contentful autogenerated files

closes FXA-8489

Co-authored-by: Ben Bangert <100193+bbangert@users.noreply.github.com>
Co-authored-by: Julian Poyourow <julianpoyo@gmail.com>
Co-authored-by: Reino Muhl <reino.muhl@gmail.com>
2023-11-30 11:47:57 -06:00
julianpoyourow fff34584f6
fix(contentful): switch to graphql-request for contentful client
Because:

* We've had numerous problems with Apollo Client server-side (it's intended as a frontend client, mostly for React).

This commit:

* Replaces Apollo Client with graphql-request for server-to-server graphql requests in the Contentful lib.

Closes FXA-8645
2023-11-20 10:56:49 -08:00
Reino Muhl bee0b2c3bc
Merge pull request #16047 from mozilla/fxa-8538-update-plans-with-contentful
fix(auth): add contentful to plans api
2023-11-17 11:48:13 -05:00
Reino Muhl a9259228ad
fix(auth): add contentful to plans api
Because:

* The GET /plans API is used in multiple places to retrieve the relying
  party configuration data currently configured in Stripe.metadata

This commit:

* Updates the logic used by the GET /plans API to retrieve the relying
  party configuration data from Contentful, with Stripe.metadata as a
  fallback
* Reports a Sentry error when the Contentful configuration data does not
  match the Stripe.metadata

Closes #FXA-8538
2023-11-17 10:26:54 -05:00
Meghan Sardesai b5df8d8add
chore(l10n): update fxa-payments to use fxa-shared branding
Because:

* Branding should not have multiple translations and the same terms should be used across FxA and SubPlat.

This commit:

* This reduces clean up, potential translation duplication, and improves maintenance of branding.

Closes FXA-8403
2023-11-16 12:03:25 -05:00
Ben Bangert dc48fa8acf
Merge pull request #15928 from mozilla/FXA-8273-legacycapabilityservice-add-eligibilitymanager-ge
feat: add eligibility manager to capability service
2023-11-15 09:56:03 -08: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
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