passbolt-styleguide 5.17.2 → 5.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/RELEASE_NOTES.md +2 -4
  2. package/build/css/help.min.css +2 -2
  3. package/build/css/public.min.css +2 -2
  4. package/build/css/themes/default/api_authentication.min.css +2 -2
  5. package/build/css/themes/default/api_cloud.min.css +2 -2
  6. package/build/css/themes/default/api_main.min.css +2 -2
  7. package/build/css/themes/default/api_reports.min.css +2 -2
  8. package/build/css/themes/default/api_webinstaller.min.css +2 -2
  9. package/build/css/themes/default/ext_app.min.css +3 -3
  10. package/build/css/themes/default/ext_authentication.min.css +2 -2
  11. package/build/css/themes/default/ext_external.min.css +2 -2
  12. package/build/css/themes/default/ext_in_form_cta.min.css +2 -2
  13. package/build/css/themes/default/ext_in_form_menu.min.css +2 -2
  14. package/build/css/themes/default/ext_quickaccess.min.css +2 -2
  15. package/build/css/themes/midgar/api_authentication.min.css +2 -2
  16. package/build/css/themes/midgar/api_main.min.css +2 -2
  17. package/build/css/themes/midgar/api_reports.min.css +2 -2
  18. package/build/css/themes/midgar/ext_app.min.css +3 -3
  19. package/build/css/themes/midgar/ext_authentication.min.css +2 -2
  20. package/build/css/themes/midgar/ext_in_form_cta.min.css +2 -2
  21. package/build/css/themes/midgar/ext_in_form_menu.min.css +2 -2
  22. package/build/css/themes/midgar/ext_quickaccess.min.css +2 -2
  23. package/build/css/themes/solarized_dark/api_authentication.min.css +2 -2
  24. package/build/css/themes/solarized_dark/api_main.min.css +2 -2
  25. package/build/css/themes/solarized_dark/api_reports.min.css +2 -2
  26. package/build/css/themes/solarized_dark/ext_app.min.css +3 -3
  27. package/build/css/themes/solarized_dark/ext_authentication.min.css +2 -2
  28. package/build/css/themes/solarized_dark/ext_in_form_cta.min.css +2 -2
  29. package/build/css/themes/solarized_dark/ext_in_form_menu.min.css +2 -2
  30. package/build/css/themes/solarized_dark/ext_quickaccess.min.css +2 -2
  31. package/build/css/themes/solarized_light/api_authentication.min.css +2 -2
  32. package/build/css/themes/solarized_light/api_main.min.css +2 -2
  33. package/build/css/themes/solarized_light/api_reports.min.css +2 -2
  34. package/build/css/themes/solarized_light/ext_app.min.css +3 -3
  35. package/build/css/themes/solarized_light/ext_authentication.min.css +2 -2
  36. package/build/css/themes/solarized_light/ext_in_form_cta.min.css +2 -2
  37. package/build/css/themes/solarized_light/ext_in_form_menu.min.css +2 -2
  38. package/build/css/themes/solarized_light/ext_quickaccess.min.css +2 -2
  39. package/build/js/dist/api-app.js +1 -1
  40. package/build/locales/cs-CZ/common.json +96 -158
  41. package/build/locales/de-DE/common.json +90 -146
  42. package/build/locales/en-UK/common.json +1 -0
  43. package/build/locales/es-ES/common.json +92 -148
  44. package/build/locales/fr-FR/common.json +92 -148
  45. package/build/locales/it-IT/common.json +93 -149
  46. package/build/locales/ja-JP/common.json +92 -145
  47. package/build/locales/ko-KR/common.json +14 -67
  48. package/build/locales/lt-LT/common.json +101 -163
  49. package/build/locales/nl-NL/common.json +95 -151
  50. package/build/locales/pl-PL/common.json +93 -155
  51. package/build/locales/pt-BR/common.json +94 -150
  52. package/build/locales/ro-RO/common.json +88 -147
  53. package/build/locales/ru-RU/common.json +96 -158
  54. package/build/locales/sl-SI/common.json +96 -158
  55. package/build/locales/sv-SE/common.json +95 -151
  56. package/build/locales/uk-UA/common.json +104 -166
  57. package/package.json +1 -1
  58. package/src/locales/cs-CZ/common.json +96 -158
  59. package/src/locales/de-DE/common.json +90 -146
  60. package/src/locales/en-UK/common.json +1 -0
  61. package/src/locales/es-ES/common.json +92 -148
  62. package/src/locales/fr-FR/common.json +92 -148
  63. package/src/locales/it-IT/common.json +93 -149
  64. package/src/locales/ja-JP/common.json +92 -145
  65. package/src/locales/ko-KR/common.json +14 -67
  66. package/src/locales/lt-LT/common.json +101 -163
  67. package/src/locales/nl-NL/common.json +95 -151
  68. package/src/locales/pl-PL/common.json +93 -155
  69. package/src/locales/pt-BR/common.json +94 -150
  70. package/src/locales/ro-RO/common.json +88 -147
  71. package/src/locales/ru-RU/common.json +96 -158
  72. package/src/locales/sl-SI/common.json +96 -158
  73. package/src/locales/sv-SE/common.json +95 -151
  74. package/src/locales/uk-UA/common.json +104 -166
  75. package/src/react-extension/components/Administration/DisplayAdministrationWorkspaceActions/DisplayAdministrationMfaActions/DisplayAdministrationMfaActions.js +6 -14
  76. package/src/react-extension/components/Administration/DisplayOfflineAdministration/DisplayOfflineAdministration.js +29 -6
  77. package/src/react-extension/components/Administration/DisplayOfflineAdministration/DisplayOfflineAdministration.test.js +28 -0
  78. package/src/react-extension/components/Administration/DisplayOfflineAdministration/DisplayOfflineAdministration.test.page.js +10 -0
  79. package/src/react-extension/components/MFA/DisplayProviderList/DisplayProviderList.js +14 -0
  80. package/src/react-extension/components/MFA/DisplayProviderList/DisplayProviderList.test.js +15 -0
  81. package/src/react-extension/components/Resource/DisplayResourcesList/DisplayResourcesListContextualMenu.js +1 -1
  82. package/src/react-extension/components/Resource/DisplayResourcesList/DisplayResourcesListContextualMenu.test.js +4 -3
  83. package/src/react-extension/contexts/Authentication/AuthenticationLoginContext.js +15 -3
  84. package/src/react-extension/contexts/Authentication/AuthenticationLoginContext.test.js +50 -0
  85. package/src/react-quickaccess/components/LoginPage/LoginPage.js +6 -1
  86. package/src/react-quickaccess/components/LoginPage/LoginPage.test.js +16 -0
  87. package/src/react-web-integration/lib/InForm/InFormManager.js +4 -14
  88. package/src/react-web-integration/lib/InForm/InformManager.test.js +6 -53
  89. package/src/react-web-integration/services/DomExtraction/FieldAggregatorService.js +1 -23
  90. package/src/react-web-integration/services/DomExtraction/FieldAggregatorService.test.js +0 -37
  91. package/src/react-web-integration/services/ShadowDom/ShadowDomFocusHealerService.js +2 -2
  92. package/src/react-web-integration/services/ShadowDom/ShadowDomFocusHealerService.test.js +6 -18
  93. package/src/react-web-integration/services/ShadowDom/ShadowMutationObserverService.js +3 -5
  94. package/src/react-web-integration/services/ShadowDom/ShadowMutationObserverService.test.js +1 -12
  95. package/src/shared/services/rbacs/uiActionEnumeration.js +1 -0
  96. package/src/shared/services/rbacs/uiActionEnumeration.test.js +3 -2
@@ -78,23 +78,15 @@ class DisplayAdministrationMfaActions extends React.Component {
78
78
 
79
79
  /**
80
80
  * Handle save operation error.
81
- * @param {object} e The returned error
81
+ * @param {object} error The returned error
82
82
  */
83
- async handleSaveError(e) {
83
+ async handleSaveError(error) {
84
84
  // It can happen when the user has closed the passphrase entry dialog by instance.
85
- if (e.name === "UserAbortsOperationError") {
86
- return;
85
+ if (error.name !== "UserAbortsOperationError") {
86
+ // Unexpected error occurred.
87
+ console.error(error);
88
+ await this.handleError(error);
87
89
  }
88
-
89
- let error = e;
90
- // Handles specific webauthn error messages
91
- if (error?.data?.body?.webauthn) {
92
- const errorMessage = Object.values(error.data.body.webauthn).join(". ");
93
- error = new Error(errorMessage);
94
- }
95
-
96
- console.error(error);
97
- await this.handleError(error);
98
90
  }
99
91
 
100
92
  /**
@@ -30,6 +30,8 @@ import Select from "../../Common/Select/Select";
30
30
  import { createSafePortal } from "../../../../shared/utils/portals";
31
31
  import DisplayOfflineAdministrationHelp from "./DisplayOfflineAdministrationHelp";
32
32
  import { formatSecondsDuration } from "../../../../shared/utils/dateUtils";
33
+ import Tooltip from "../../Common/Tooltip/Tooltip";
34
+ import FrameSVG from "../../../../img/svg/Frame.svg";
33
35
 
34
36
  const DEFAULT_OFFLINE_SETTINGS = {
35
37
  max_session_duration: SESSION_DURATION_ALLOWED[0],
@@ -281,6 +283,21 @@ class DisplayOfflineAdministration extends Component {
281
283
  }));
282
284
  }
283
285
 
286
+ /**
287
+ * Render the pro teasing icon displayed next to the settings labels for the community edition.
288
+ * @returns {JSX|null}
289
+ */
290
+ renderProTeasingIcon() {
291
+ if (!this.isCommunityEdition) {
292
+ return null;
293
+ }
294
+ return (
295
+ <Tooltip message={this.props.t("Upgrade to Pro Edition to customise offline settings.")}>
296
+ <FrameSVG className="pro-teasing-icon" />
297
+ </Tooltip>
298
+ );
299
+ }
300
+
284
301
  /**
285
302
  * Render the component
286
303
  * @returns {JSX}
@@ -319,9 +336,12 @@ class DisplayOfflineAdministration extends Component {
319
336
  {this.state.enabled && this.state.settings && (
320
337
  <>
321
338
  <div className={`input text input-wrapper ${this.hasAllInputDisabled() ? "disabled" : ""}`}>
322
- <label htmlFor="offline-settings-session-duration">
323
- <Trans>Session duration</Trans>
324
- </label>
339
+ <div className="label-inline">
340
+ <label htmlFor="offline-settings-session-duration">
341
+ <Trans>Session duration</Trans>
342
+ </label>
343
+ {this.renderProTeasingIcon()}
344
+ </div>
325
345
  <Select
326
346
  id="offline-settings-session-duration"
327
347
  items={this.sessionDurationOptions}
@@ -342,9 +362,12 @@ class DisplayOfflineAdministration extends Component {
342
362
  )}
343
363
  </div>
344
364
  <div className={`input text input-wrapper ${this.hasAllInputDisabled() ? "disabled" : ""}`}>
345
- <label htmlFor="offline-settings-maximum-retention-period">
346
- <Trans>Maximum data retention period</Trans>
347
- </label>
365
+ <div className="label-inline">
366
+ <label htmlFor="offline-settings-maximum-retention-period">
367
+ <Trans>Maximum data retention period</Trans>
368
+ </label>
369
+ {this.renderProTeasingIcon()}
370
+ </div>
348
371
  <Select
349
372
  id="offline-settings-maximum-retention-period"
350
373
  items={this.dataRetentionPeriodOptions}
@@ -88,6 +88,19 @@ describe("DisplayOfflineAdministration", () => {
88
88
  expect(page.optionsOf(page.maximumRetentionPeriodSelect)).toEqual(["1 day", "14 days", "30 days"]);
89
89
  });
90
90
 
91
+ it("does not display the pro teasing icon next to the settings labels", async () => {
92
+ expect.assertions(1);
93
+ const props = defaultProps();
94
+ jest.spyOn(props.context.port, "request").mockImplementationOnce(() => defaultOfflineSettingsDtoFromApi());
95
+
96
+ let page;
97
+ await act(async () => {
98
+ page = new DisplayOfflineAdministration(props);
99
+ });
100
+
101
+ expect(page.proTeasingTooltips).toHaveLength(0);
102
+ });
103
+
91
104
  it("can change the session duration and the data retention period", async () => {
92
105
  expect.assertions(2);
93
106
  const props = defaultProps();
@@ -138,6 +151,21 @@ describe("DisplayOfflineAdministration", () => {
138
151
  expect(page.optionsOf(page.maximumRetentionPeriodSelect)).toEqual([]);
139
152
  });
140
153
 
154
+ it("displays the pro teasing icon with an upgrade tooltip next to the settings labels", async () => {
155
+ expect.assertions(3);
156
+ const props = communityEditionProps();
157
+ jest.spyOn(props.context.port, "request").mockImplementationOnce(() => defaultOfflineSettingsDtoFromApi());
158
+
159
+ let page;
160
+ await act(async () => {
161
+ page = new DisplayOfflineAdministration(props);
162
+ });
163
+
164
+ expect(page.proTeasingTooltips).toHaveLength(2);
165
+ expect(page.proTeasingTooltips[0].textContent).toBe("Upgrade to Pro Edition to customise offline settings.");
166
+ expect(page.proTeasingTooltips[1].textContent).toBe("Upgrade to Pro Edition to customise offline settings.");
167
+ });
168
+
141
169
  it("saves the pinned settings when enabling the feature", async () => {
142
170
  expect.assertions(1);
143
171
  const props = communityEditionProps();
@@ -125,6 +125,16 @@ export default class DisplayOfflineAdministrationPage {
125
125
  return [...selectElement.querySelectorAll(".items li")].map((option) => option.textContent);
126
126
  }
127
127
 
128
+ /**
129
+ * Returns the pro teasing tooltips displayed next to the settings labels
130
+ * @returns {HTMLElement[]}
131
+ */
132
+ get proTeasingTooltips() {
133
+ return [...this._page.container.querySelectorAll("#offline-settings .label-inline .tooltip")].filter((tooltip) =>
134
+ tooltip.querySelector(".pro-teasing-icon"),
135
+ );
136
+ }
137
+
128
138
  /**
129
139
  * Returns the session duration error element
130
140
  * @returns {HTMLElement}
@@ -74,6 +74,9 @@ class DisplayProviderList extends Component {
74
74
  if (!this.canUseDuoProvider) {
75
75
  delete providers.duo;
76
76
  }
77
+ if (!this.canUsePasskeysProvider) {
78
+ delete providers.webauthn;
79
+ }
77
80
  return providers;
78
81
  }
79
82
 
@@ -85,6 +88,9 @@ class DisplayProviderList extends Component {
85
88
  if (!this.canUseDuoProvider) {
86
89
  delete settings.duo;
87
90
  }
91
+ if (!this.canUsePasskeysProvider) {
92
+ delete settings.webauthn;
93
+ }
88
94
  return settings;
89
95
  }
90
96
 
@@ -111,6 +117,14 @@ class DisplayProviderList extends Component {
111
117
  return this.props.rbacContext.canIUseAction(uiActions.DUO_CONFIGURATION);
112
118
  }
113
119
 
120
+ /**
121
+ * Can the user configure the passkeys provider.
122
+ * @returns {bool}
123
+ */
124
+ get canUsePasskeysProvider() {
125
+ return this.props.rbacContext.canIUseAction(uiActions.PASSKEYS_CONFIGURATION);
126
+ }
127
+
114
128
  /**
115
129
  * handle provider click
116
130
  * @param {string} provider
@@ -202,5 +202,20 @@ describe("DisplayProviderList", () => {
202
202
 
203
203
  expect(page.duoCard).toBeNull();
204
204
  });
205
+
206
+ it("As a desktop application I should not see the passkeys card", () => {
207
+ expect.assertions(2);
208
+
209
+ window.chrome = { webview: {} };
210
+
211
+ const page = new DisplayProviderListPage(
212
+ propsWithMfaProviders({
213
+ rbacContext: denyRbacContext(),
214
+ }),
215
+ );
216
+
217
+ expect(page.totpCard).not.toBeNull();
218
+ expect(page.webauthnCard).toBeNull();
219
+ });
205
220
  });
206
221
  });
@@ -810,7 +810,7 @@ class DisplayResourcesListContextualMenu extends React.Component {
810
810
  </div>
811
811
  </li>
812
812
  )}
813
- {this.canShare() && (
813
+ {this.canUpdate() && (
814
814
  <li key="option-delete-resource" className="ready">
815
815
  <div className="row">
816
816
  <div className="main-cell-wrapper">
@@ -363,8 +363,8 @@ describe("DisplayResourcesListContextualMenu", () => {
363
363
  page = new DisplayResourcesListContextualMenuPage(props);
364
364
  });
365
365
 
366
- it("As LU I should not be able to share a password I have update access", async () => {
367
- expect.assertions(18);
366
+ it("As LU I should be able to edit and delete but not share a password I have update access", async () => {
367
+ expect.assertions(19);
368
368
  expect(page.copyUsernameItem).not.toBeNull();
369
369
  expect(page.copyUsernameItem.hasAttribute("disabled")).toBeFalsy();
370
370
  expect(page.copyPasswordItem).not.toBeNull();
@@ -378,7 +378,8 @@ describe("DisplayResourcesListContextualMenu", () => {
378
378
  expect(page.editItem).not.toBeNull();
379
379
  expect(page.editItem.hasAttribute("disabled")).toBeFalsy();
380
380
  expect(page.shareItem).toBeNull();
381
- expect(page.deleteItem).toBeNull();
381
+ expect(page.deleteItem).not.toBeNull();
382
+ expect(page.deleteItem.hasAttribute("disabled")).toBeFalsy();
382
383
  expect(page.markAsExpiredItem).not.toBeNull();
383
384
  expect(page.markAsExpiredItem.hasAttribute("disabled")).toBeFalsy();
384
385
  expect(page.setExpiryDateItem).not.toBeNull();
@@ -127,7 +127,11 @@ export class AuthenticationLoginContextProvider extends React.Component {
127
127
  return;
128
128
  }
129
129
 
130
- if (!ssoLocalConfiguredProvider) {
130
+ /*
131
+ * A local SSO kit can remain after the SSO plugin was disabled (i.e. downgrade to CE).
132
+ * In such case fallback on the passphrase sign-in, the kit will be removed after a successful sign-in.
133
+ */
134
+ if (!ssoLocalConfiguredProvider || !this.isSsoPluginEnabled()) {
131
135
  this.setState({ state: AuthenticationLoginWorkflowStates.SIGN_IN });
132
136
  return;
133
137
  }
@@ -361,11 +365,19 @@ export class AuthenticationLoginContextProvider extends React.Component {
361
365
  }
362
366
 
363
367
  /**
364
- * Returns true if the user has an SSO kit registered locally
368
+ * Returns true if the SSO plugin is enabled on the organization
369
+ * @returns {boolean}
370
+ */
371
+ isSsoPluginEnabled() {
372
+ return Boolean(this.props.context.siteSettings?.canIUse("sso"));
373
+ }
374
+
375
+ /**
376
+ * Returns true if the SSO plugin is enabled and the user has an SSO kit registered locally
365
377
  * @returns {boolean}
366
378
  */
367
379
  isSsoAvailable() {
368
- return this.props.ssoContext.hasUserAnSsoKit();
380
+ return this.isSsoPluginEnabled() && this.props.ssoContext.hasUserAnSsoKit();
369
381
  }
370
382
 
371
383
  /**
@@ -19,6 +19,8 @@ import {
19
19
  withServerKeyChanged,
20
20
  } from "./AuthenticationLoginContext.test.data";
21
21
  import InvalidMasterPasswordError from "../../lib/Error/InvalidMasterPasswordError";
22
+ import SiteSettingsEntity from "../../../shared/models/entity/siteSettings/siteSettingsEntity";
23
+ import { siteSettingsCe } from "../../test/fixture/Settings/siteSettings";
22
24
 
23
25
  beforeEach(() => {
24
26
  jest.resetModules();
@@ -99,6 +101,27 @@ describe("AuthenticationLoginContextProvider", () => {
99
101
  expect(contextProvider.state.state).toEqual(AuthenticationLoginWorkflowStates.SIGN_IN_SSO);
100
102
  });
101
103
 
104
+ it("If the user has an SSO kit but the SSO plugin is not available, the machine state should be set to: SIGN_IN", async () => {
105
+ const props = defaultProps({
106
+ ssoContext: {
107
+ loadSsoConfiguration: () => "azure",
108
+ },
109
+ });
110
+ props.context.siteSettings = new SiteSettingsEntity(siteSettingsCe);
111
+ props.context.port.addRequestListener(
112
+ "passbolt.sso.has-sso-login-error",
113
+ jest.fn(async () => false),
114
+ );
115
+ const contextProvider = new AuthenticationLoginContextProvider(props);
116
+ mockComponentSetState(contextProvider);
117
+
118
+ expect.assertions(2);
119
+ await contextProvider.componentDidMount();
120
+
121
+ expect(props.context.port.requestListeners["passbolt.auth.verify-server-key"]).toHaveBeenCalled();
122
+ expect(contextProvider.state.state).toEqual(AuthenticationLoginWorkflowStates.SIGN_IN);
123
+ });
124
+
102
125
  it("If the user attempted an SSO login but the feature is disabled, the machine state should be set to: SSO_DISABLED_ERROR", async () => {
103
126
  const props = defaultProps({
104
127
  ssoContext: {
@@ -180,6 +203,33 @@ describe("AuthenticationLoginContextProvider", () => {
180
203
  });
181
204
  });
182
205
 
206
+ describe("AuthenticationLoginContextProvider::isSsoAvailable", () => {
207
+ it("should return true if the SSO plugin is enabled and the user has an SSO kit", async () => {
208
+ const props = defaultProps({ ssoContext: { hasUserAnSsoKit: () => true } });
209
+ const contextProvider = new AuthenticationLoginContextProvider(props);
210
+
211
+ expect.assertions(1);
212
+ expect(contextProvider.isSsoAvailable()).toStrictEqual(true);
213
+ });
214
+
215
+ it("should return false if the user has no SSO kit", async () => {
216
+ const props = defaultProps({ ssoContext: { hasUserAnSsoKit: () => false } });
217
+ const contextProvider = new AuthenticationLoginContextProvider(props);
218
+
219
+ expect.assertions(1);
220
+ expect(contextProvider.isSsoAvailable()).toStrictEqual(false);
221
+ });
222
+
223
+ it("should return false if the SSO plugin is not available even if the user has an SSO kit", async () => {
224
+ const props = defaultProps({ ssoContext: { hasUserAnSsoKit: () => true } });
225
+ props.context.siteSettings = new SiteSettingsEntity(siteSettingsCe);
226
+ const contextProvider = new AuthenticationLoginContextProvider(props);
227
+
228
+ expect.assertions(1);
229
+ expect(contextProvider.isSsoAvailable()).toStrictEqual(false);
230
+ });
231
+ });
232
+
183
233
  describe("AuthenticationLoginContextProvider::acceptNewServerKey", () => {
184
234
  it("When the new server key is accepted, the machine state should be set to: SIGN_IN", async () => {
185
235
  const props = withServerKeyChanged(defaultProps());
@@ -42,7 +42,12 @@ class LoginPage extends React.Component {
42
42
  async componentDidMount() {
43
43
  this.initDefaultRememberMeChoice();
44
44
  const ssoLocalConfiguredProvider = await this.props.ssoContext.loadSsoConfiguration();
45
- if (ssoLocalConfiguredProvider) {
45
+ /*
46
+ * A local SSO kit can remain after the SSO plugin was disabled (i.e. downgrade to CE).
47
+ * In such case fallback on the passphrase sign-in, the kit will be removed after a successful sign-in.
48
+ */
49
+ const isSsoPluginEnabled = Boolean(this.props.context.siteSettings?.canIUse("sso"));
50
+ if (ssoLocalConfiguredProvider && isSsoPluginEnabled) {
46
51
  this.setState({ isSsoAvailable: true, displaySso: true, isReady: true });
47
52
  } else {
48
53
  this.setState({ isReady: true }, () => this.focusOnPassphrase());
@@ -17,6 +17,8 @@
17
17
  */
18
18
  import LoginPageTest from "./LoginPage.test.page";
19
19
  import { defaultPropsWithSsoDisabled, defaultPropsWithSsoEnabled } from "./LoginPage.test.data";
20
+ import SiteSettingsEntity from "../../../shared/models/entity/siteSettings/siteSettingsEntity";
21
+ import { siteSettingsCe } from "../../../react-extension/test/fixture/Settings/siteSettings";
20
22
 
21
23
  beforeEach(() => {
22
24
  jest.resetModules();
@@ -90,6 +92,20 @@ describe("Quickaccess::LoginPage", () => {
90
92
  expect(page.switchToSsoFormButton).toBeFalsy();
91
93
  });
92
94
 
95
+ it(`As AN I cannot use the SSO login feature if the SSO plugin is not available even if I have an SSO kit on my browser profile`, async () => {
96
+ expect.assertions(3);
97
+
98
+ const props = defaultPropsWithSsoEnabled();
99
+ props.context.siteSettings = new SiteSettingsEntity(siteSettingsCe);
100
+ const page = new LoginPageTest(props);
101
+
102
+ await page.isReady();
103
+
104
+ expect(page.passphraseInput).toBeTruthy();
105
+ expect(page.ssoLoginButton).toBeFalsy();
106
+ expect(page.switchToSsoFormButton).toBeFalsy();
107
+ });
108
+
93
109
  it(`As AN when I try to sign from the quickaccess via SSO, If I close the SSO login popup, the quickaccess should stay on the SSO form`, async () => {
94
110
  expect.assertions(1);
95
111
 
@@ -326,8 +326,7 @@ class InFormManager {
326
326
  * If a field was previously found, we reuse the same InformUsernameField, otherwise we create one.
327
327
  * Else we clean and reset callToActionFields.
328
328
  */
329
- const { fields: classifiedFields } = PageClassificationService.classifyPage();
330
- const fields = classifiedFields.filter(({ element }) => !element.disabled);
329
+ const { fields } = PageClassificationService.classifyPage();
331
330
  const newUsernameFields = fields.filter((field) => IDENTIFIER_ROLES.includes(field.role));
332
331
  const newPasswordFields = fields.filter((field) => PASSWORD_ROLES.includes(field.role));
333
332
  const newOTPFields = fields.filter((field) => field.role === FieldRole.TOTP);
@@ -564,17 +563,15 @@ class InFormManager {
564
563
  * @param {Document|ShadowRoot|Element} root The observed node.
565
564
  * @param {MutationRecord[]} mutations The list of mutations.
566
565
  * @param {boolean} shadowRootsChanged Whether the mutation includes a change in the shadowRoots.
567
- * @param {object} [options]
568
- * @param {boolean} [options.fromFocus=false] Whether the notification comes from the user focusing a field.
569
566
  */
570
- onShadowMutation(root, mutations, shadowRootsChanged, { fromFocus = false } = {}) {
567
+ onShadowMutation(root, mutations, shadowRootsChanged) {
571
568
  // Never scan our own CTA shadow root
572
569
  if (root === this.shadowRoot) {
573
570
  return;
574
571
  }
575
572
 
576
- // The user focused a field: re-scan right away so it gets its call-to-action on first focus
577
- if (fromFocus) {
573
+ // A new shadow root appeared: re-scan right away so the focused field gets its call-to-action
574
+ if (shadowRootsChanged) {
578
575
  this.findAndSetAuthenticationFields();
579
576
  this.handleInformCallToActionClickEvent();
580
577
  this._pendingFieldScan = true;
@@ -582,13 +579,6 @@ class InFormManager {
582
579
  return;
583
580
  }
584
581
 
585
- // A new shadow root appeared: wait for the page to settle, a component-heavy page adds hundreds at once
586
- if (shadowRootsChanged) {
587
- this._pendingFieldScan = true;
588
- this.updateAuthenticationFieldsDebounce?.();
589
- return;
590
- }
591
-
592
582
  // Does this batch actually touch a credential-relevant node or attribute?
593
583
  const affectsFields =
594
584
  this._mutationsAffectAuthenticationFields(mutations) || this._attributeMutationAffectsField(mutations);
@@ -2229,52 +2229,27 @@ describe("InformManager", () => {
2229
2229
  expect(InFormManager._pendingFieldScan).toBe(true);
2230
2230
  });
2231
2231
 
2232
- it("should re-scan synchronously and schedule a debounced follow-up when the user focuses a field", async () => {
2233
- // The focus healer notifies with fromFocus when a field is focused. The re-scan must be synchronous
2234
- // (so the call-to-action is attached within the same focus turn) AND also scheduled once more
2235
- // (debounced) to catch a web component that hydrates just after an autofocus.
2236
- expect.assertions(3);
2232
+ it("should re-scan synchronously and schedule a debounced follow-up when a shadow root becomes known", async () => {
2233
+ // The focus healer signals shadowRootsChanged=true when a field is focused. The re-scan must be
2234
+ // synchronous (so the call-to-action is attached within the same focus turn) AND also scheduled once
2235
+ // more (debounced) to catch a web component that hydrates just after an autofocus.
2236
+ expect.assertions(2);
2237
2237
 
2238
2238
  document.body.innerHTML = domElementLoginWithNameAttributeUsername;
2239
2239
  await act(async () => new InformManagerPage());
2240
2240
  InFormManager.updateAuthenticationFieldsDebounce = jest.fn();
2241
- InFormManager._pendingFieldScan = false;
2242
2241
  const findSpy = jest.spyOn(InFormManager, "findAndSetAuthenticationFields").mockImplementation();
2243
2242
 
2244
- InFormManager.onShadowMutation(document, [], true, { fromFocus: true });
2243
+ InFormManager.onShadowMutation(document, [], true);
2245
2244
 
2246
2245
  expect(InFormManager.findAndSetAuthenticationFields).toHaveBeenCalledTimes(1);
2247
2246
  expect(InFormManager.updateAuthenticationFieldsDebounce).toHaveBeenCalledTimes(1);
2248
- expect(InFormManager._pendingFieldScan).toBe(true);
2249
2247
 
2250
2248
  // The suite clears (not restores) mocks between tests, so restore the persistent no-op now to avoid
2251
2249
  // leaking it into the tests below.
2252
2250
  findSpy.mockRestore();
2253
2251
  });
2254
2252
 
2255
- it("should only schedule a debounced re-scan when a mutation adds shadow roots", async () => {
2256
- // A component-heavy page (e.g. Reddit) adds hundreds of shadow roots per render: each observer batch
2257
- // must not trigger a synchronous full-page scan, only arm the gate and schedule a single debounced one.
2258
- expect.assertions(3);
2259
-
2260
- document.body.innerHTML = domElementLoginWithNameAttributeUsername;
2261
- await act(async () => new InformManagerPage());
2262
- InFormManager.updateAuthenticationFieldsDebounce = jest.fn();
2263
- InFormManager._pendingFieldScan = false;
2264
- const findSpy = jest.spyOn(InFormManager, "findAndSetAuthenticationFields").mockImplementation();
2265
- const otherShadowRoot = document.createElement("div").attachShadow({ mode: "open" });
2266
-
2267
- for (let i = 0; i < 200; i++) {
2268
- InFormManager.onShadowMutation(otherShadowRoot, [], true);
2269
- }
2270
-
2271
- expect(InFormManager.findAndSetAuthenticationFields).not.toHaveBeenCalled();
2272
- expect(InFormManager.updateAuthenticationFieldsDebounce).toHaveBeenCalledTimes(200);
2273
- expect(InFormManager._pendingFieldScan).toBe(true);
2274
-
2275
- findSpy.mockRestore();
2276
- });
2277
-
2278
2253
  it("should NOT queue an expensive field scan for a non-relevant document mutation (only the host check)", async () => {
2279
2254
  expect.assertions(2);
2280
2255
 
@@ -2346,28 +2321,6 @@ describe("InformManager", () => {
2346
2321
 
2347
2322
  expect(InFormManager.callToActionFields).toHaveLength(1);
2348
2323
  });
2349
-
2350
- it("should not attach a call-to-action to a disabled field until it is enabled", async () => {
2351
- expect.assertions(3);
2352
-
2353
- // Second step of a multi-step login: the identifier is recalled in a disabled field above the password.
2354
- document.body.innerHTML = `<form>
2355
- <input type='email' id='email' name='email' disabled value='admin@passbolt.com'/>
2356
- <input type='password' id='password' name='password'/>
2357
- </form>`;
2358
- await act(async () => new InformManagerPage());
2359
- const ctaElements = () => InFormManager.callToActionFields.map(({ field }) => field);
2360
- expect(ctaElements()).not.toContain(document.getElementById("email"));
2361
- expect(ctaElements()).toContain(document.getElementById("password"));
2362
-
2363
- // The site enables the field: the next scan attaches its call-to-action.
2364
- await act(async () => {
2365
- document.getElementById("email").disabled = false;
2366
- });
2367
- InFormManager.findAndSetAuthenticationFields();
2368
-
2369
- expect(ctaElements()).toContain(document.getElementById("email"));
2370
- });
2371
2324
  });
2372
2325
 
2373
2326
  describe("Focus healer integration", () => {
@@ -36,33 +36,11 @@ class FieldAggregatorService {
36
36
  * @returns {Element[]} The visible fillable fields.
37
37
  */
38
38
  static gatherCandidates(containerElement) {
39
- const elements = new Set(ShadowDomQueryService.querySelectorAllDeep(containerElement, TEXT_FIELDS));
40
- FieldAggregatorService.gatherSlottedFields(containerElement).forEach((element) => elements.add(element));
41
-
42
- return [...elements].filter(
39
+ return ShadowDomQueryService.querySelectorAllDeep(containerElement, TEXT_FIELDS).filter(
43
40
  (element) => ShadowDomQueryService.isElement(element) && ElementVisibilityService.isElementViewable(element),
44
41
  );
45
42
  }
46
43
 
47
- /**
48
- * TEXT_FIELDS assigned to the slots of a container. A web component may render the light DOM fields of its host
49
- * through slots of its shadow root: they are displayed inside the container but are not its descendants.
50
- * @param {Element} containerElement The container to scan.
51
- * @returns {Element[]} The slotted fields.
52
- */
53
- static gatherSlottedFields(containerElement) {
54
- const slots = ShadowDomQueryService.querySelectorAllDeep(containerElement, "slot");
55
-
56
- return slots.flatMap((slot) =>
57
- slot
58
- .assignedElements({ flatten: true })
59
- .flatMap((assigned) => [
60
- ...(assigned.matches(TEXT_FIELDS) ? [assigned] : []),
61
- ...ShadowDomQueryService.querySelectorAllDeep(assigned, TEXT_FIELDS),
62
- ]),
63
- );
64
- }
65
-
66
44
  /**
67
45
  * Populate `fields[]` of every container record with `{ fieldElement, deepestFormContainer }`
68
46
  * (replacing whatever seed/skeleton fields it carried), then purge containers left with no field.
@@ -45,43 +45,6 @@ describe("FieldAggregatorService", () => {
45
45
  expect(result[0].fields.map((field) => field.fieldElement.id)).toContain("reg-phone");
46
46
  });
47
47
 
48
- it("should populate the fields slotted into a container living in a web component shadow root", () => {
49
- expect.assertions(2);
50
-
51
- jest.spyOn(ElementVisibilityService, "isElementViewable").mockReturnValue(true);
52
- // The landal.de shape: the host's light DOM inputs are rendered through named slots of its shadow root.
53
- document.body.innerHTML = `<login-panel-component>
54
- <input slot="username" type="email" id="username"/>
55
- <input slot="password" type="password" id="current-password"/>
56
- </login-panel-component>`;
57
- const host = document.querySelector("login-panel-component");
58
- const shadowRoot = host.attachShadow({ mode: "open" });
59
- shadowRoot.innerHTML = '<div id="panel"><slot name="username"></slot><slot name="password"></slot></div>';
60
- const container = shadowRoot.getElementById("panel");
61
-
62
- const result = FieldAggregatorService.aggregateFields([
63
- { containerElement: container, fields: [], isPseudoForm: true },
64
- ]);
65
-
66
- expect(result).toHaveLength(1);
67
- expect(result[0].fields.map((field) => field.fieldElement.id)).toEqual(["username", "current-password"]);
68
- });
69
-
70
- it("should not duplicate a field found both as a descendant and through a slot", () => {
71
- expect.assertions(1);
72
-
73
- jest.spyOn(ElementVisibilityService, "isElementViewable").mockReturnValue(true);
74
- document.body.innerHTML = '<login-panel-component><input slot="username" id="username"/></login-panel-component>';
75
- const host = document.querySelector("login-panel-component");
76
- host.attachShadow({ mode: "open" }).innerHTML = '<slot name="username"></slot>';
77
-
78
- const result = FieldAggregatorService.aggregateFields([
79
- { containerElement: host, fields: [], isPseudoForm: true },
80
- ]);
81
-
82
- expect(result[0].fields).toHaveLength(1);
83
- });
84
-
85
48
  it("should keep only visible fields", () => {
86
49
  expect.assertions(2);
87
50
 
@@ -43,7 +43,7 @@ const focusHandler = (event) => {
43
43
  }
44
44
 
45
45
  if (invalidated) {
46
- ShadowMutationObserverService.notifyShadowMutationSubscribers(document, [], true, { fromFocus: true });
46
+ ShadowMutationObserverService.notifyShadowMutationSubscribers(document, [], true);
47
47
  return;
48
48
  }
49
49
 
@@ -55,7 +55,7 @@ const focusHandler = (event) => {
55
55
  !ShadowDomFocusHealerService._healAttempted.has(target)
56
56
  ) {
57
57
  ShadowDomFocusHealerService._healAttempted.add(target);
58
- ShadowMutationObserverService.notifyShadowMutationSubscribers(document, [], true, { fromFocus: true });
58
+ ShadowMutationObserverService.notifyShadowMutationSubscribers(document, [], true);
59
59
  }
60
60
  };
61
61