diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 2a51f008d262..de5601fb0da1 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -571,6 +571,9 @@ "blockaidDescriptionBlurFarming": { "message": "If you approve this request, someone can steal your assets listed on Blur." }, + "blockaidDescriptionFailed": { + "message": "Because of an error, this request was not verified by the security provider. Proceed with caution." + }, "blockaidDescriptionMaliciousDomain": { "message": "You're interacting with a malicious domain. If you approve this request, you might lose your assets." }, @@ -586,6 +589,9 @@ "blockaidTitleDeceptive": { "message": "This is a deceptive request" }, + "blockaidTitleMayNotBeSafe": { + "message": "Request may not be safe" + }, "blockaidTitleSuspicious": { "message": "This is a suspicious request" }, diff --git a/ui/components/app/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap b/ui/components/app/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap index 326a98ce000a..9a6da7ddbaa5 100644 --- a/ui/components/app/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap +++ b/ui/components/app/security-provider-banner-alert/blockaid-banner-alert/__snapshots__/blockaid-banner-alert.test.js.snap @@ -46,6 +46,52 @@ exports[`Blockaid Banner Alert should render 'danger' UI when securityAlertRespo `; +exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResponse.result_type is 'Failed 1`] = ` +
+ +
+
+ Request may not be safe +
+

+ Because of an error, this request was not verified by the security provider. Proceed with caution. +

+

+ + + + Security advice by + + Blockaid + + + + +

+
+
+`; + exports[`Blockaid Banner Alert should render 'warning' UI when securityAlertResponse.result_type is 'Warning 1`] = `
{features.map((feature, i) => ( @@ -74,10 +75,14 @@ function BlockaidBannerAlert({ securityAlertResponse }) { ? Severity.Danger : Severity.Warning; - const title = - SUSPCIOUS_REASON.indexOf(reason) > -1 - ? t('blockaidTitleSuspicious') - : t('blockaidTitleDeceptive'); + let title; + if (resultType === BlockaidResultType.Failed) { + title = t('blockaidTitleMayNotBeSafe'); + } else if (SUSPCIOUS_REASON.indexOf(reason) > -1) { + title = t('blockaidTitleSuspicious'); + } else { + title = t('blockaidTitleDeceptive'); + } return ( { expect(container.querySelector('.mm-banner-alert')).toBeNull(); }); - it(`should not render when securityAlertResponse.result_type is '${BlockaidResultType.Failed}'`, () => { - const { container } = renderWithLocalization( + it(`should render '${Severity.Warning}' UI when securityAlertResponse.result_type is '${BlockaidResultType.Failed}`, () => { + const { container, getByText } = renderWithLocalization( { }} />, ); + const warningBannerAlert = container.querySelector( + '.mm-banner-alert--severity-warning', + ); - expect(container.querySelector('.mm-banner-alert')).toBeNull(); + expect(warningBannerAlert).toBeInTheDocument(); + expect(warningBannerAlert).toMatchSnapshot(); + + expect(getByText('Request may not be safe')).toBeInTheDocument(); + expect( + getByText( + 'Because of an error, this request was not verified by the security provider. Proceed with caution.', + ), + ).toBeInTheDocument(); + }); + + it(`should render '${Severity.Warning}' UI when securityAlertResponse.result_type is '${BlockaidResultType.Warning}`, () => { + const { container } = renderWithLocalization( + , + ); + const warningBannerAlert = container.querySelector( + '.mm-banner-alert--severity-warning', + ); + + expect(warningBannerAlert).toBeInTheDocument(); + expect(warningBannerAlert).toMatchSnapshot(); }); it(`should render '${Severity.Danger}' UI when securityAlertResponse.result_type is '${BlockaidResultType.Malicious}`, () => { @@ -70,18 +93,6 @@ describe('Blockaid Banner Alert', () => { expect(dangerBannerAlert).toMatchSnapshot(); }); - it(`should render '${Severity.Warning}' UI when securityAlertResponse.result_type is '${BlockaidResultType.Warning}`, () => { - const { container } = renderWithLocalization( - , - ); - const warningBannerAlert = container.querySelector( - '.mm-banner-alert--severity-warning', - ); - - expect(warningBannerAlert).toBeInTheDocument(); - expect(warningBannerAlert).toMatchSnapshot(); - }); - it('should render title, "This is a deceptive request"', () => { const { getByText } = renderWithLocalization( ,