Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CL-18] toast component and service #6490

Merged
merged 37 commits into from
Apr 18, 2024
Merged

[CL-18] toast component and service #6490

merged 37 commits into from
Apr 18, 2024

Conversation

willmartian
Copy link
Contributor

@willmartian willmartian commented Oct 3, 2023

Type of change

- [ ] Bug fix
- [x] New feature development
- [x] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

Adds a toast component and service to the CL. Remove direct client references to ngx-toastr

Code changes

  • apps
    • Removed toast css from all clients and consolidated in CL
    • Replaced ToastrService with ToastService in app components
    • messages.json: Added variant name so SR can announce it upon opening
  • libs/components
    • toast.component: Presentational component
    • toastr.component: ngx-toastr wrapper for bit-toast
    • toast.service: Facade over ToastrService
      • removed functionality to use custom HTML in toasts
  • libs/common
    • deprecated PlatfromUtilsService.showToast

Screenshots

See new stories in Storybook.

image image
Screen.Recording.2024-02-25.at.11.15.07.AM.mov
Screen.Recording.2024-02-25.at.11.16.27.AM.mov

Before you submit

  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team
  • Ensure that all UI additions follow WCAG AA requirements

@github-actions github-actions bot added the needs-qa Marks a PR as requiring QA approval label Oct 3, 2023
@bitwarden-bot
Copy link

bitwarden-bot commented Oct 3, 2023

Logo
Checkmarx One – Scan Summary & Details0d9765b0-74c0-41d3-8e07-468ff8b09f4f

Fixed Issues

Severity Issue Source File / Package
HIGH Client_DOM_Code_Injection /apps/web/src/connectors/common.ts: 2
HIGH Client_DOM_Code_Injection /apps/browser/src/autofill/services/collect-autofill-content.service.ts: 1054
HIGH Client_DOM_Stored_XSS /apps/web/src/connectors/sso.ts: 33
HIGH Client_DOM_XSS /apps/browser/src/auth/scripts/duo.js: 285
HIGH Client_DOM_XSS /apps/browser/src/auth/scripts/duo.js: 285
HIGH Client_DOM_XSS /apps/desktop/src/auth/scripts/duo.js: 285
HIGH Client_DOM_XSS /apps/desktop/src/auth/scripts/duo.js: 285
HIGH Client_DOM_XSS /apps/web/src/connectors/common.ts: 2
HIGH Client_DOM_XSS /apps/web/src/connectors/common.ts: 2
HIGH Client_DOM_XSS /apps/web/src/connectors/common.ts: 2
HIGH Client_DOM_XSS /apps/web/src/connectors/common.ts: 2
HIGH Client_DOM_XSS /apps/web/src/connectors/sso.ts: 21
HIGH Client_DOM_XSS /apps/web/src/connectors/sso.ts: 19
HIGH Client_DOM_XSS /apps/web/src/connectors/sso.ts: 15
MEDIUM Absolute_Path_Traversal /apps/cli/src/commands/serve.command.ts: 343
MEDIUM Absolute_Path_Traversal /apps/cli/src/commands/serve.command.ts: 343
MEDIUM Absolute_Path_Traversal /apps/cli/src/commands/serve.command.ts: 311
MEDIUM Absolute_Path_Traversal /apps/cli/src/commands/serve.command.ts: 311
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/browser/src/vault/popup/components/fido2/fido2-use-browser-link.component.html: 1
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/web/src/app/billing/organizations/adjust-subscription.component.html: 54
MEDIUM Angular_Improper_Type_Pipe_Usage /apps/web/src/app/billing/organizations/adjust-subscription.component.html: 18
MEDIUM Client_Privacy_Violation /apps/browser/src/background/runtime.background.ts: 279
MEDIUM Client_Privacy_Violation /apps/web/src/app/tools/reports/pages/breach-report.component.html: 14
MEDIUM Client_Privacy_Violation /apps/browser/src/auth/popup/account-switching/account.component.ts: 12
MEDIUM Client_Privacy_Violation /apps/browser/src/auth/popup/account-switching/account.component.ts: 12
MEDIUM Client_Privacy_Violation /apps/browser/src/auth/popup/account-switching/account.component.ts: 12
MEDIUM Client_Privacy_Violation /apps/web/src/app/auth/settings/two-factor-verify.component.html: 3
MEDIUM Client_Privacy_Violation /libs/components/src/color-password/color-password.component.ts: 25
MEDIUM Client_Privacy_Violation /libs/components/src/color-password/color-password.component.ts: 26
MEDIUM Client_Privacy_Violation /apps/desktop/src/auth/lock.component.html: 32
MEDIUM Client_Privacy_Violation /apps/web/src/app/auth/lock.component.html: 18
MEDIUM Client_Privacy_Violation /apps/web/src/app/billing/shared/add-credit.component.ts: 135
MEDIUM Client_Privacy_Violation /apps/web/src/app/billing/shared/add-credit.component.ts: 30
MEDIUM Client_Privacy_Violation /apps/web/src/app/billing/shared/add-credit.component.ts: 70
MEDIUM Client_Privacy_Violation /apps/web/src/app/billing/shared/add-credit.component.ts: 80
MEDIUM Client_Privacy_Violation /apps/web/src/app/billing/shared/add-credit.component.ts: 146
MEDIUM Client_Privacy_Violation /apps/web/src/app/auth/lock.component.html: 18
MEDIUM Client_Privacy_Violation /apps/desktop/src/auth/lock.component.html: 32
MEDIUM Client_Privacy_Violation /apps/web/src/app/auth/recover-two-factor.component.html: 37
MEDIUM Client_Privacy_Violation /apps/web/src/app/billing/shared/add-credit.component.html: 46
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 534
MEDIUM Client_Privacy_Violation /apps/web/src/connectors/webauthn-fallback.ts: 116
MEDIUM Client_Privacy_Violation /bitwarden_license/bit-web/src/app/auth/sso/sso.component.ts: 161
MEDIUM Client_Privacy_Violation /bitwarden_license/bit-web/src/app/auth/sso/sso.component.ts: 161
MEDIUM Client_Privacy_Violation /libs/components/src/color-password/color-password.component.ts: 14
MEDIUM Client_Privacy_Violation /libs/components/src/color-password/color-password.component.ts: 14
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 60
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 56
MEDIUM Client_Privacy_Violation /apps/browser/src/tools/popup/generator/password-generator-history.component.html: 26
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/password-history.component.html: 18
MEDIUM Client_Privacy_Violation /apps/desktop/src/app/tools/password-generator-history.component.html: 15
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/password-history.component.html: 12
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/view.component.html: 50
MEDIUM Client_Privacy_Violation /libs/components/src/color-password/color-password.component.ts: 14
MEDIUM Client_Privacy_Violation /libs/components/src/color-password/color-password.component.ts: 14
MEDIUM Client_Privacy_Violation /apps/browser/src/tools/popup/generator/password-generator-history.component.html: 26
MEDIUM Client_Privacy_Violation /apps/browser/src/vault/popup/components/vault/password-history.component.html: 18
MEDIUM Client_Privacy_Violation /apps/desktop/src/app/tools/password-generator-history.component.html: 15
MEDIUM Client_Privacy_Violation /apps/desktop/src/vault/app/vault/password-history.component.html: 12
MEDIUM Missing_HSTS_Header /apps/cli/src/auth/commands/login.command.ts: 705
MEDIUM SSRF /libs/importer/src/importers/lastpass/access/services/rest-client.ts: 69
MEDIUM SSRF /libs/importer/src/importers/lastpass/access/services/rest-client.ts: 69
LOW Angular_Usage_of_Unsafe_DOM_Sanitizer /libs/components/src/avatar/avatar.component.ts: 80
LOW Angular_Usage_of_Unsafe_DOM_Sanitizer /apps/desktop/src/app/components/avatar.component.ts: 75
LOW Angular_Usage_of_Unsafe_DOM_Sanitizer /libs/components/src/icon/icon.component.ts: 18
LOW Angular_Usage_of_Unsafe_DOM_Sanitizer /libs/components/src/icon/icon.component.ts: 18
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/accessibility-cookie.component.html: 18
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/common.ts: 2
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/common.ts: 2
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/common.ts: 2
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/sso.ts: 21
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/common.ts: 2
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/sso.ts: 19
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/common.ts: 2
LOW Client_DOM_Open_Redirect /apps/web/src/connectors/sso.ts: 15
LOW Client_DOM_Open_Redirect /apps/browser/src/tools/popup/generator/password-generator-history.component.ts: 18
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/popup/login-via-auth-request.component.ts: 54
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/popup/account-switching/current-account.component.ts: 31
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/popup/login-via-auth-request.component.ts: 54
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/login/login-via-auth-request.component.ts: 62
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/popup/account-switching/account.component.ts: 25
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/login/login-via-auth-request.component.ts: 62
LOW Client_DOM_Open_Redirect /apps/browser/src/vault/popup/components/vault/password-history.component.ts: 21
LOW Client_DOM_Open_Redirect /apps/browser/src/vault/popup/components/vault/attachments.component.ts: 32
LOW Client_DOM_Open_Redirect /apps/browser/src/popup/settings/premium.component.ts: 27
LOW Client_DOM_Open_Redirect /libs/common/src/auth/iframe-component.ts: 49
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /libs/common/src/auth/webauthn-iframe.ts: 25
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /libs/common/src/auth/webauthn-iframe.ts: 25
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/desktop/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/scripts/duo.js: 277
LOW Client_DOM_Open_Redirect /apps/browser/src/auth/scripts/duo.js: 277
LOW Client_Hardcoded_Domain /apps/web/src/app/billing/shared/payment.component.ts: 56
LOW Client_Hardcoded_Domain /apps/web/src/app/billing/shared/payment.component.ts: 56
LOW Client_Hardcoded_Domain /apps/web/src/connectors/captcha.ts: 57
LOW Client_Password_In_Comment /libs/angular/src/vault/components/add-edit.component.ts: 663
LOW Client_Password_In_Comment /apps/web/src/app/vault/org-vault/add-edit.component.ts: 108
LOW Client_Password_In_Comment /apps/web/src/app/vault/org-vault/collections.component.ts: 59
LOW Client_Password_In_Comment /libs/angular/src/platform/utils/safe-provider.ts: 108
LOW Client_Password_In_Comment /libs/common/src/state-migrations/migrations/30-move-policy-state-to-state-provider.ts: 13
LOW Client_Password_In_Comment /apps/browser/src/autofill/background/notification.background.ts: 566
LOW Client_Password_In_Comment /libs/common/src/services/event/event-collection.service.ts: 93
LOW Client_Password_In_Comment /libs/common/src/services/event/event-collection.service.ts: 88
LOW Client_Password_In_Comment /libs/common/src/platform/biometrics/biometric-state.service.ts: 62
LOW Client_Password_In_Comment /libs/common/src/platform/biometrics/biometric-state.service.ts: 30
LOW Client_Password_In_Comment /apps/web/src/app/auth/key-rotation/user-key-rotation.service.ts: 46
LOW Client_Password_In_Comment /apps/browser/src/autofill/overlay/pages/list/autofill-overlay-list.ts: 274
LOW Client_Password_In_Comment /apps/browser/src/autofill/overlay/pages/list/autofill-overlay-list.ts: 224
LOW Client_Password_In_Comment /apps/browser/src/autofill/background/overlay.background.ts: 516
LOW Client_Password_In_Comment /apps/browser/src/autofill/background/overlay.background.ts: 516
LOW Client_Password_In_Comment /apps/browser/src/autofill/background/overlay.background.ts: 227
LOW Client_Password_In_Comment /apps/browser/src/autofill/background/overlay.background.ts: 227
LOW Client_Password_In_Comment /apps/browser/src/autofill/overlay/pages/list/autofill-overlay-list.ts: 455
LOW Client_Password_In_Comment /apps/browser/src/autofill/overlay/pages/list/autofill-overlay-list.ts: 437
LOW Client_Password_In_Comment /apps/browser/src/autofill/overlay/pages/list/autofill-overlay-list.ts: 416
LOW Client_Password_In_Comment /apps/browser/src/autofill/overlay/pages/list/autofill-overlay-list.ts: 387
LOW Client_Password_In_Comment /apps/browser/src/autofill/overlay/pages/list/autofill-overlay-list.ts: 340
LOW Client_Password_In_Comment /apps/browser/src/autofill/overlay/pages/list/autofill-overlay-list.ts: 340
LOW Client_Password_In_Comment /apps/browser/src/autofill/overlay/pages/list/autofill-overlay-list.ts: 319
LOW Client_Password_In_Comment /apps/browser/src/autofill/overlay/pages/list/autofill-overlay-list.ts: 319
LOW Client_Password_In_Comment /apps/browser/src/autofill/overlay/pages/list/autofill-overlay-list.ts: 246
LOW Client_Password_In_Comment /libs/angular/src/auth/components/sso.component.ts: 225
LOW Client_Password_In_Comment /apps/browser/src/autofill/services/autofill.service.ts: 446
LOW Client_Password_In_Comment /apps/web/src/app/vault/org-vault/vault.component.ts: 785
LOW Client_Password_In_Comment /apps/web/src/app/vault/org-vault/vault.component.ts: 785
LOW Client_Password_In_Comment /apps/web/src/app/vault/individual-vault/vault.component.ts: 603
LOW Client_Password_In_Comment /apps/web/src/app/vault/individual-vault/vault.component.ts: 603
LOW Client_Password_In_Comment /libs/angular/src/auth/components/sso.component.ts: 254
LOW Client_Password_In_Comment /libs/angular/src/auth/components/two-factor.component.ts: 321
LOW Client_Password_In_Comment /libs/tools/export/vault-export/vault-export-core/src/types/bitwarden-json-export-types.ts: 40
LOW Client_Password_In_Comment /apps/web/src/app/auth/settings/emergency-access/attachments/emergency-access-attachments.component.ts: 52
LOW Client_Password_In_Comment /apps/web/src/app/vault/individual-vault/add-edit.component.ts: 129
LOW Client_Password_In_Comment /libs/angular/src/vault/components/add-edit.component.ts: 258
LOW Client_Password_In_Comment /libs/auth/src/common/login-strategies/password-login.strategy.ts: 160
LOW Client_Password_In_Comment /libs/common/src/auth/services/user-verification/user-verification.service.ts: 100
LOW Client_Password_In_Comment /libs/importer/src/importers/bitwarden/bitwarden-password-protected-importer.ts: 51
LOW

More results are available on AST platform

Copy link

codecov bot commented Feb 19, 2024

Codecov Report

Attention: Patch coverage is 6.17284% with 76 lines in your changes are missing coverage. Please review.

Project coverage is 27.63%. Comparing base (9277465) to head (b4e59a1).

Files Patch % Lines
libs/components/src/toast/toast.stories.ts 0.00% 21 Missing ⚠️
libs/components/src/toast/toast.component.ts 0.00% 11 Missing ⚠️
libs/components/src/toast/toast.service.ts 0.00% 10 Missing ⚠️
libs/components/src/toast/toast.module.ts 0.00% 9 Missing ⚠️
apps/browser/src/popup/app.component.ts 0.00% 6 Missing ⚠️
apps/web/src/app/app.component.ts 0.00% 4 Missing ⚠️
libs/components/src/toast/toastr.component.ts 0.00% 4 Missing ⚠️
apps/desktop/src/app/app.component.ts 0.00% 3 Missing ⚠️
...latform-utils/foreground-platform-utils.service.ts 0.00% 2 Missing ⚠️
libs/components/src/toast/index.ts 0.00% 2 Missing ⚠️
... and 4 more
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6490   +/-   ##
=======================================
  Coverage   27.62%   27.63%           
=======================================
  Files        2356     2362    +6     
  Lines       68972    68971    -1     
  Branches    12924    12913   -11     
=======================================
+ Hits        19055    19059    +4     
+ Misses      48488    48483    -5     
  Partials     1429     1429           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@willmartian willmartian changed the title [CL-18] feat: bit-toast [CL-18] toast component and service Feb 25, 2024
@willmartian willmartian marked this pull request as ready for review February 25, 2024 16:30
@willmartian willmartian requested review from a team as code owners February 25, 2024 16:30
@willmartian willmartian requested review from justindbaur, a team and Hinton February 25, 2024 16:30
@willmartian willmartian dismissed stale reviews from justindbaur and vleague2 via 2e30155 March 11, 2024 22:48
@willmartian willmartian requested a review from vleague2 March 11, 2024 22:49
@willmartian
Copy link
Contributor Author

I wasn't properly passing the title from the service to the component, fixed in 2e30155.

vleague2
vleague2 previously approved these changes Mar 12, 2024
@willmartian
Copy link
Contributor Author

willmartian commented Mar 13, 2024

Latest commits fix the conflicts with #8211 and removes the calls to ngx-toastr that were added to the ForegroundPlatformUtilsService (cc @MGibson1)

@willmartian willmartian requested a review from vleague2 March 13, 2024 16:43
vleague2
vleague2 previously approved these changes Mar 13, 2024
@willmartian
Copy link
Contributor Author

  • Added test ids at QA's request: ef6be25
  • Fixed a bug on desktop where hovering the toast didn't pause it: b83d668
  • Updated colors to align with recent palette changes: 2a52e6b

@willmartian willmartian requested a review from vleague2 April 16, 2024 14:24
@willmartian willmartian requested a review from vleague2 April 16, 2024 18:31
vleague2
vleague2 previously approved these changes Apr 16, 2024
@willmartian willmartian requested a review from vleague2 April 18, 2024 16:45
@willmartian willmartian removed the needs-qa Marks a PR as requiring QA approval label Apr 18, 2024
@willmartian willmartian merged commit d5f503a into main Apr 18, 2024
61 of 63 checks passed
@willmartian willmartian deleted the ps/CL-18/migrate-toasts branch April 18, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants