* [PAM-121] Move shared PAM code to bit-pam and bit-pam-components
Creates two licensed libs owned by team-pam-dev and moves the shared PAM
code into them from bit-web so other clients can consume it:
- bitwarden_license/bit-pam (@bitwarden/bit-pam): framework-free
abstractions, helpers, date formatting and SDK services, usable from the
browser background. ESLint keeps Angular and the UI libraries out of it.
- bitwarden_license/bit-pam-components (@bitwarden/bit-pam-components): the
shared components, pipes, confirm dialogs and Angular-injected services.
Each lib exposes a single barrel. Split out of #22430 to reduce its size;
no behavioural changes.
* [PAM-121] Run Chromatic on bit-pam-components changes
* [PAM-121] Run prettier
* feat(billing): add PM36631_PreviewDrivenCart feature flag
* feat(billing): add authoritative amount and label to Discount
* feat(billing): render per-line discounts as an array in cart summary
* feat(billing): add per-line discount cart summary stories
* feat(billing): add CartPreview types mirroring the server preview model
* feat(billing): add cart preview flow context and translation helpers
* feat(billing): add pure CartPreview to Cart adapter
* feat(billing): add cart and subscription preview response DTOs
* feat(billing): add cart and subscription preview clients and facades
* refactor(billing): rename CartPreview to InvoicePreview per updated PM-39926
* fix(billing): import Discount directly instead of through the pricing barrel
cart.ts imported Discount from the library's own index barrel, which is a
circular-import smell. Point the import at ./discount alongside ./credit.
* docs(billing): align cart-summary docs with the discounts array shape
The cart-summary MDX still described the singular `CartItem.discount` /
`Cart.discount` field this branch replaces, and the invoice-preview header
comment still said "cart preview record family" after the CartPreview to
InvoicePreview rename.
- Update the documented `Cart` type to `discounts?: Discount[]` and add the
optional authoritative `total`.
- Convert the five cart-level `discount: {...}` example literals to
`discounts: [{...}]` and pluralize the `cart` prop-table description.
- Correct the invoice-preview header comment and note that the type is
unrelated to the screen-local `InvoicePreview` in premium-org-upgrade.service.ts,
which it supersedes and which is removed at PM-40422.
* docs(billing): flag unverified discount member casing in invoice preview DTO
InvoicePreviewItemResponse assigns the `Discounts` array raw, which assumes the
server serializes discount members as camelCase even though every enclosing
field is PascalCase. The cart-level discount in cart.response.ts parses through
DiscountResponse, which is PascalCase-aware, so the two paths disagree.
No real PM-39925 response has been observed yet, and the existing spec fixture
hardcodes camelCase members, so it encodes the assumption rather than testing
it. If the server emits PascalCase, every discount field silently deserializes
to undefined with no throw.
Document the assumption with a TODO rather than guessing at the contract; the
casing gets confirmed with the server at the PM-39925 integration checkpoint.
* docs(billing): record camelCase discount-member contract as decided
* fix(billing): parse invoice preview discounts through DiscountResponse
Discount members are PascalCase per the PM-39925/PM-39926 preview contract,
so the raw passthrough would have deserialized every member to undefined.
DiscountResponse gains the amount and label fields the preview carries, and
drops its value import of the @bitwarden/pricing barrel (Angular components)
which libs/common, consumed by the non-Angular CLI, must not load.
* fix(billing): allow absent suspension details on past_due and unpaid previews
Verified against server main: GetSubscriptionSuspensionAsync has five null
paths for past_due/unpaid (e.g. no open overdue invoices), so those
statuses parse through with optional suspension/gracePeriod. Incomplete
statuses and canceled keep hard parse guards because the server always
emits their details. Also fixes the storage fixture to the real
StorageResponse shape and asserts the mapping.
* fix(billing): harden invoice preview money and date parsing
EstimatedTax, Total, and AmountDue now throw on absence instead of
silently becoming undefined on a type declared as number; a malformed
NextPaymentAttempt degrades to absent rather than an Invalid Date.
* fix(billing): map plan-change seat rows to the org plan-price label
OrganizationPlanChange previews rendered a blank seat label and logged an
error because the fan-out had no case for that context. Plan changes
always describe an existing org moving between org tiers, so they take
the same passwordManagerPlanPrice copy as the other org-scoped surfaces;
premium stays unmapped since it cannot be plan-changed into. The
translation-keys spec now asserts the exact documented key set.
* fix(billing): prefer authoritative discount amounts in cart-wide rows
A server-supplied amount now wins over the derived cascade in the
cart-wide loop, matching the per-line path — otherwise a preview cart's
percent-off row would be derived from the locally summed subtotal while
total uses the server figure, and the rows would not reconcile. Discount
rows are tracked by $index because derived labels are not unique (two
unlabeled discounts of the same type and value collide).
* refactor(billing): type preview request planTier as PlanTier
Narrows the placeholder string to the PlanTier union (type-only import)
so the per-screen tickets that finalize these request shapes inherit the
constraint; specs annotate their fixtures to exercise it.
* test: register libs/pricing in the root jest config
The project list never included libs/pricing, so its 200+ suites were
invisible to npm test and CI's libs run.
* Revert "test: register libs/pricing in the root jest config"
This reverts commit 7cfd9095a6.
* refactor(billing): compare subscription statuses as literals in the preview response
The value import of SubscriptionStatuses loaded the @bitwarden/subscription
barrel — and its Angular components — into libs/common at runtime, forcing the
spec to jest.mock the whole package with hand-maintained literals that could
silently drift. Literal constants checked with `satisfies` keep union drift a
compile error (mirroring discount.response.ts) and let the spec drop the mock,
the require, and its eslint suppression.
* test: register libs/pricing in the root jest config
The project list never included libs/pricing, so its 200+ suites were
invisible to npm test and CI's libs run.
* InvoicePreviewDiscount changes
* Remove some comments
* added design review fix
* Add additional review changes
* Address review nits: inline single-use fixture, type premium preview request, clarify service doc
* [PM-39926] Align SubscriptionPreview contract with server
Rename the response's Cart property/key to InvoicePreview to match the
server contract, and add a required nextCharge to the Billable arm of
SubscriptionPreview, populated in toDomain from the invoice preview's
nextPaymentAttempt (mirroring the legacy BitwardenSubscription).
Trialing/active responses now fail parsing when the next payment
attempt is absent, following the response's existing arm-invariant
guards.
* Make Secrets Manager seats optional on the invoice preview
The server can emit a Secrets Manager section without a recurring seat
line (a mid-cycle SM removal leaves only proration credits), so the
response no longer fabricates an empty seat item. The adapter maps the
seat line only when present and omits a group with no line items —
its prorations still feed the credit row — and the cart summary
renders each SM line behind its own guard.
* Add @bitwarden/storybook lib with feature-flags addon
Introduce a dedicated @bitwarden/storybook library housing Storybook
addons and utilities.
feature-flags addon:
- Manager-side "Feature Flags" panel listing every boolean flag from the
FeatureFlag enum; toggles write to a Storybook global.
- Preview-side mock ConfigService whose getFeatureFlag$ values are driven
by that global (reactive, so toggles update stories live).
- Flag catalog seeded into globals so the manager bundle never imports
@bitwarden/* (esbuild can't resolve those aliases).
- featureFlagModes() helper for opt-in Chromatic on/off snapshot modes.
- Documentation/Feature Flags MDX page describing panel + modes usage.
Also:
- Move .storybook/format-args-for-code-snippet into the lib and repoint
the 19 component stories to import from @bitwarden/storybook.
- Enable jsx ("react") in tsconfig.base.json for the manager panel (.tsx);
the Storybook manager builder emits the classic runtime.
- .storybook wiring: preview registers the decorator + seeds globals,
manager loads the panel by relative path.
package-lock.json also picks up npm's normalization of a few pre-existing
entries on main (readdirp dedupe, encoding removal) alongside the new
workspace registration.
* Add enabledFlags helper for per-story flag state
- enabledFlags(...flags) builds a story-level `globals` override so one
story can render with a flag on and another with it off.
- featureFlagModes now reuses enabledFlags for a single source of truth.
- Document the per-story pattern in the Feature Flags MDX.
* Fix CI failures for the feature-flags addon
- Decorator: skip providing the mock ConfigService when a story already
provides one at the application root (applicationConfig). Fixes the
danger-zone story crash "Cannot mix multi providers and regular
providers" — it registers ConfigService as `multi: true`.
- Lib jest: set isolatedModules in tsconfig.spec.json so ts-jest
transpiles without type-checking; its node10 resolution can't read
@storybook/angular's exports-based types (typecheck is covered by tsc).
- Reformat 5 component stories that were left prettier-dirty after the
import repoint (pre-commit runs prettier before eslint's import sort).
* Remove comments from tsconfig.spec.json and manager.js
Add a new libs/pam feature library for Privileged Access Management,
generated via the basic-lib Nx generator.
- Register the "pam" team in the basic-lib generator (schema enum,
interactive prompt, and the @bitwarden/team-pam-dev CODEOWNERS handle)
- Generate libs/pam with standard structure and a placeholder spec
- Wire up tsconfig.base.json path, CODEOWNERS, and root jest.config.js
This change eliminates the circular dependency between messaging and messaging-internal libraries by merging them into a single messaging library.
Previously, messaging-internal imported from @bitwarden/messaging while messaging tried to import from @bitwarden/messaging-internal, creating an unresolvable circular dependency. This also violated Nx best practices by using cross-library file includes in tsconfig.lib.json.
Changes made:
- Moved all messaging-internal code (SubjectMessageSender, helpers, tests) into libs/messaging/src/
- Updated all imports to use relative paths instead of @bitwarden/messaging imports
- Removed the entire messaging-internal library and its configuration files
- Updated external references in apps/browser to import from @bitwarden/messaging
- Fixed libs/messaging/tsconfig.lib.json to use standard src/**/*.ts pattern
- Updated libs/common internal.ts to re-export from messaging instead of messaging-internal
The messaging library now exports both public APIs and internal implementations, which is a cleaner architecture than maintaining two separate libraries with circular dependencies.
Fixes rootDir configuration issues identified in the Nx library systematic fix project.
* feat: create separate bit licensed browser
* feat: refactor webpack config
* fix: mv2 build not working
* feat: add bit versions of all commands
* feat: add bit CI builds
* fix: scss missing from build
* Add missing libs to jest.config.js
Added 15 missing libraries to the jest projects array:
- libs/assets
- libs/client-type
- libs/core-test-utils
- libs/dirt/card
- libs/guid
- libs/logging
- libs/messaging-internal
- libs/messaging
- libs/serialization
- libs/state-test-utils
- libs/state
- libs/storage-core
- libs/storage-test-utils
- libs/tools/export/vault-export/vault-export-ui
- libs/user-core
This ensures all existing libraries with jest.config.js files are included in CI test runs.
* Update basic-lib generator to add new libs to jest.config.js
- Added updateJestConfig function that automatically adds new libraries to jest.config.js
- Function finds the appropriate alphabetical position for the new library
- Added comprehensive tests for the new functionality
- Ensures new libraries are included in CI test runs from creation
This prevents the issue where new libraries are created but their tests
are not run in CI because they are missing from the jest configuration.
* Fix import statements in state-definitions and deserialization-helpers tests
- Fixed ClientLocations import in state-definitions.spec.ts to use @bitwarden/storage-core instead of relative import
- Simplified deserialization-helpers.spec.ts import to use library root @bitwarden/serialization
* Move SendV2component into send-v2 subFolder
* Create SendFormContainer and related services
* Add initial SendFormComponent which uses the SendFormContainer
* Remove AdditionalOptionsSectionComponent which will be added with a future PR
* Add libs/tools/send to root tsconfig
* Register libs/tools/send/send-ui with root jest.config.js
* Register libs/tools/send/send-ui with root tailwind.config.js
* Fix service injection on DefaultSendFormService
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
* Create and register @bitwarden/generator-core
- Create libs/tools/generator/core
- Register new library within tsconfigs
- Register new library within eslint.configs
* Create and register @bitwarden/generator-extensions
- Create libs/tools/generator/extensions
- Register new library within tsconfigs
- Register new library within eslint.configs
* Create and register @bitwarden/generator-components
- Create libs/tools/generator/components
- Register new library within tsconfigs
- Register new library within eslint.configs
* Update libs/tools/generator/components/package.json
Co-authored-by: ✨ Audrey ✨ <ajensen@bitwarden.com>
* Update libs/tools/generator/extensions/package.json
Co-authored-by: ✨ Audrey ✨ <ajensen@bitwarden.com>
* Add empty barrel files for new libs
* Fix extension of test.environment
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: ✨ Audrey ✨ <ajensen@bitwarden.com>
* [AC-2302] Move organization-auth-request.service to bit-common folder
* [AC-2302] Rename organization-auth-request.service to organization-auth-request-api.service
* [AC-2302] Move logic from component to organization-auth-request.service
* [AC-2302] Fix import path in OrganizationAuthRequestService
* [AC-2302] Move imports to OrganizationsModule and delete unused CoreOrganizationModule
* [AC-2302] Move the call to get userResetPasswordDetails into OrganizationAuthRequestService
* [AC-2302] Remove @Injectable() and manually configure dependencies
* [AC-2302] Add OrganizationAuthRequestService unit tests first draft
* [AC-2302] Refactor device-approvals.component.ts to remove unused imports
* [AC-2302] Set up jest on bit-common and add unit tests for OrganizationAuthRequestService
* [AC-2302] Add bit-common to jest.config.js
* [AC-2302] Update organizations.module.ts to include safeProviders declared in variable
* [AC-2302] Remove services and views folders from bit-common
* [AC-2302] Define path mapping
* Adjust an import path
The import path of `PendingAuthRequestView` in
`OrganizationAuthRequestApiService` was pointing to the wrong place. I
think this file was just recently moved, and the import didn't get
updated.
* Get paths working
* Fix import
* Update jest config to use ts-jest adn jsdom
* Copy-paste path mappings from bit-web
* Remove unnecessary test setup file
* Undo unnecessary change
* Fix remaining path mappings
* Remove Bitwarden License mapping from OSS code
* Fix bit-web so it uses its own tsconfig
* Fix import path
* Remove web-bit entrypoint from OSS tsconfig
* Make DeviceApprovalsComponent standalone
* Remove organization-auth-request-api.service export
* Remove OrganizationsRoutingModule from DeviceApprovalsComponent imports
* Remove CoreOrganizationModule from OrganizationsModule imports
* Remove NoItemsModule from OrganizationsModule imports
* Use ApiService from JslibServicesModule
* Update providers in device-approvals.component.ts
---------
Co-authored-by: Addison Beck <hello@addisonbeck.com>
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
* Create bit-cli folder with configs
* Add bit-cli to workspace
* Refactor CLI app structure
* services are managed by the ServiceContainer
* programs are registered by register(Oss|Bit)Program
* the app is bootstrapped by Main
* Reapply changes from #9099
* Reapply changes from #8604
* Reapply changes from #9115
* Move libs/exporter into libs/tools/*
Migrating all files from libs/exporter over to libs/tools/export/vault-export/vault-export-core
Rename package to vault-export-core
Fix all file paths
* Update libs and tsconfig imports
* Fix client imports
* Fix eslint, jest and package-lock.json
* Update CODEOWNERS
* Add README.md to whitelist-capital-letters
* Fix vault-export-service tests not running
* Update libs/tools/export/vault-export/README.md
Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
* Fix types imports
* Export types from vault-export-core
* Fixed content of README
---------
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
Co-authored-by: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com>
* Create and register new libs/exporter
Create package.json
Create tsconfig
Create jest.config
Extend shared and root tsconfig and jest.configs
Register with eslint
* Migrate exportService to libs/exporter
Move exportService (abstraction and impl) into libs/exporter
Refactored exportService to be split into vault-export and event-export
Created barrel-files for both exports
Moved export.service.spec.ts into vault-export
Created an export-helper, which helps build the filename (extract method refactor from ExportService)
* Move components in libs/angular into tools-subfolder
Moved components
Updated imports in jslib-services.module and jslib.module
* Register libs/exporter with browser and fix imports
Move export.component into tools-subfolder
* Register libs/exporter with cli and fix imports
Move export.command into tools-subfolder
* Register libs/exporter with desktop and fix imports
Move export.component into tools-subfolder
* Move export models to libs/exporter
* Update web imports
* Update package-lock.json
* Move export models back as it would create circular dependency
Reponse models in common rely on export models which are in libs/exporter, which relies on common
* Fix up web for event-export
* Update CODEOWNERS
* Add export-models to team-tools-dev
* Simplify domain import
* Moving EventExport into web
* Create and register new libs/importer
Create package.json
Create tsconfig
Create jest.config
Extend shared and root tsconfig and jest.configs
Register with eslint
* Move importer-related files to libs/importer
* Move importer-spec-related files to libs/importer
Move import.service.spec
* Update package-lock.json
* Set CODEOWNERS for new libs/importer
* Register libs/importer with cli and fix imports
* Register libs/importer with web and fix imports
* Move importOption into models
Rename importOptions to import-options
* Fix linting issues after updating prettier
* Only expose necessary files from libs/importer
Fix tsconfig files
- Removes the trailing /index on imports in web/cli
As the spec-files no longer can access the internals via @bitwarden/importer they import by path (../src/importers)
* Add barrel files to vendors with more than one importer
* Replace Permissions enum and helper methods with callbacks
* Remove scim feature flag
* Check if org has feature enabled as part of canManage checks
* Pin jest-mock-extended at v2.0.6 to fix compilation error
* Create base jest.config file
* Fix various tests that were broken
* Add maxWorkers to jest config
* Undo change to testEnvironment
* Enable tsconfig.spec.json
* Initial commit
* Updated stories / Fixed issues with dark theme constrast color
* Force colors so bootstrap doesn't override
* Fixed text colors / Added initial tests
* Added jest debugging ability to components package
* Removed spec file
* Fixed anchor layout
* revert base font-size
* [CL-28] fixed indentation, used focus-visible, adjusted disabled colors
* [CL-28] Reduced ring thickness to better match figma
* [CL-28] Updated story link
* [CL-44] [CL-28] Updated tabs disabled color / Converted to rgb format with helper