Backed out 2 changesets (bug 1847307, bug 1837696) for bc failure on browser_inprogress_analysis.js . CLOSED TREE

Backed out changeset 6e5768f3fc48 (bug 1837696)
Backed out changeset c3a616c4d136 (bug 1847307)
This commit is contained in:
Narcis Beleuzu 2023-09-07 01:12:56 +03:00
parent 67e97e0d91
commit 7a36a26eb0
15 changed files with 163 additions and 234 deletions

View File

@ -88,7 +88,6 @@
<link rel="localization" href="preview/enUS-searchFeatures.ftl" />
<link rel="localization" href="preview/interventions.ftl" />
#ifdef NIGHTLY_BUILD
<link rel="localization" href="browser/shopping.ftl"/>
<link rel="localization" href="preview/shopping.ftl"/>
#endif

View File

@ -5,10 +5,16 @@
@import url("chrome://global/skin/in-content/common.css");
#analysis-explainer-wrapper p,
#analysis-explainer-grades-list > li,
.analysis-explainer-grading-scale-description {
line-height: 150%;
}
#analysis-explainer-grades-list {
padding: 0;
margin-inline-start: 1.05em;
}
#analysis-explainer-grading-scale-wrapper {
margin-inline-start: 0.54em;
}

View File

@ -23,14 +23,18 @@ const VALID_EXPLAINER_L10N_IDS = new Map([
* Class for displaying details about letter grades, adjusted rating, and highlights.
*/
class AnalysisExplainer extends MozLitElement {
static properties = {
productURL: { type: String, reflect: true },
};
getGradesDescriptionTemplate() {
return html`
<section id="analysis-explainer-grades-wrapper">
<p data-l10n-id="shopping-analysis-explainer-grades-intro"></p>
<ul id="analysis-explainer-grades-list">
<li
data-l10n-id="shopping-analysis-explainer-higher-grade-description"
></li>
<li
data-l10n-id="shopping-analysis-explainer-lower-grade-description"
></li>
</ul>
</section>
`;
}
@ -60,6 +64,10 @@ class AnalysisExplainer extends MozLitElement {
getGradingScaleListTemplate() {
return html`
<section id="analysis-explainer-grading-scale-wrapper">
<p
id="analysis-explainer-grading-scale-header"
data-l10n-id="shopping-analysis-explainer-review-grading-scale"
></p>
<dl id="analysis-explainer-grading-scale-list">
${this.createGradingScaleEntry(
["A", "B"],
@ -78,20 +86,6 @@ class AnalysisExplainer extends MozLitElement {
`;
}
getRetailerDisplayName() {
if (!this.productURL) {
return "";
}
let url = new URL(this.productURL);
let hostname = url.hostname;
let displayNames = {
"www.amazon.com": "Amazon",
"www.bestbuy.com": "Best Buy",
"www.walmart.com": "Walmart",
};
return displayNames[hostname];
}
render() {
return html`
<link
@ -107,15 +101,11 @@ class AnalysisExplainer extends MozLitElement {
<div id="analysis-explainer-wrapper">
<p data-l10n-id="shopping-analysis-explainer-intro"></p>
${this.getGradesDescriptionTemplate()}
${this.getGradingScaleListTemplate()}
<p
data-l10n-id="shopping-analysis-explainer-adjusted-rating-description"
></p>
<p
data-l10n-id="shopping-analysis-explainer-highlights-description"
data-l10n-args="${JSON.stringify({
retailer: this.getRetailerDisplayName(),
})}"
></p>
<p data-l10n-id="shopping-analysis-explainer-learn-more">
<a
@ -124,6 +114,7 @@ class AnalysisExplainer extends MozLitElement {
data-l10n-name="review-quality-url"
></a>
</p>
${this.getGradingScaleListTemplate()}
</div>
</div>
</shopping-card>

View File

@ -25,7 +25,7 @@ class LetterGrade extends MozLitElement {
get fluentStrings() {
if (!this._fluentStrings) {
this._fluentStrings = new Localization(["browser/shopping.ftl"], true);
this._fluentStrings = new Localization(["preview/shopping.ftl"], true);
}
return this._fluentStrings;
}

View File

@ -111,7 +111,6 @@ class RecommendedAd extends MozLitElement {
</div>
</a>
</shopping-card>
<p data-l10n-id="ad-by-fakespot"></p>
`;
}
}

View File

@ -14,13 +14,3 @@
display: flex;
justify-self: center;
}
#powered-by-fakespot {
font-size: 12px;
color: var(--text-color-deemphasized);
}
#shopping-ads-learn-more {
margin-inline-end: 20px;
color: var(--text-color-deemphasized);
}

View File

@ -12,8 +12,6 @@ import { MozLitElement } from "chrome://global/content/lit-utils.mjs";
// eslint-disable-next-line import/no-unassigned-import
import "chrome://global/content/elements/moz-toggle.mjs";
import { FAKESPOT_BASE_URL } from "chrome://global/content/shopping/ProductConfig.mjs";
class ShoppingSettings extends MozLitElement {
static properties = {
adsEnabledByUser: { type: Boolean },
@ -52,14 +50,7 @@ class ShoppingSettings extends MozLitElement {
data-l10n-id="shopping-settings-recommendations-toggle"
data-l10n-attrs="label"
@toggle=${this.onToggleRecommendations}>
</moz-toggle/>
<span id="shopping-ads-learn-more" data-l10n-id="shopping-settings-recommendations-learn-more">
<a
is="moz-support-link"
support-page="todo"
data-l10n-name="review-quality-url"
></a>
</span>`
</moz-toggle/>`
: null;
return html`
@ -81,17 +72,6 @@ class ShoppingSettings extends MozLitElement {
></button>
</div>
</shopping-card>
<p
id="powered-by-fakespot"
class="deemphasized"
data-l10n-id="powered-by-fakespot"
>
<a
data-l10n-name="fakespot-link"
target="_blank"
href="${FAKESPOT_BASE_URL}"
></a>
</p>
`;
}
}

View File

@ -127,9 +127,7 @@ export class ShoppingContainer extends MozLitElement {
<review-highlights
.highlights=${this.data.highlights}
></review-highlights>
<analysis-explainer
productUrl=${ifDefined(this.productUrl)}
</analysis-explainer>
<analysis-explainer></analysis-explainer>
${this.recommendationTemplate()}
`;
}

View File

@ -6,6 +6,143 @@
### being translated as the feature is still in heavy development
### and strings are likely to change often.
shopping-page-title = { -brand-product-name } Shopping
# Title for page showing where a user can check the
# review quality of online shopping product reviews
shopping-main-container-title = Review quality check
shopping-close-button =
.title = Close
# This string is for notifying screen reader users that the
# sidebar is still loading data.
shopping-a11y-loading =
.aria-label = Loading…
more-to-consider-ad-label =
.label = More to consider
## Strings for the letter grade component.
## For now, we only support letter grades A, B, C, D and F.
## Letter A indicates the highest grade, and F indicates the lowest grade.
## Letters are hardcoded and cannot be localized.
shopping-letter-grade-description-ab = Reliable reviews
shopping-letter-grade-description-c = Only some reliable reviews
shopping-letter-grade-description-df = Unreliable reviews
# This string is displayed in a tooltip that appears when the user hovers
# over the letter grade component without a visible description.
# It is also used for screen readers.
# $letter (String) - The letter grade as A, B, C, D or F (hardcoded).
# $description (String) - The localized letter grade description. See shopping-letter-grade-description-* strings above.
shopping-letter-grade-tooltip =
.title = { $letter } - { $description }
## Strings for the shopping message-bar
shopping-message-bar-warning-stale-analysis-title = Updates available
shopping-message-bar-warning-stale-analysis-message = Re-analyze the reviews for this product, so you have the latest info.
shopping-message-bar-warning-stale-analysis-link = Re-analyze reviews
shopping-message-bar-generic-error-title = Something went wrong
shopping-message-bar-generic-error-message = Couldnt load information. Please try again later.
shopping-message-bar-warning-not-enough-reviews-title = Not enough reviews yet
shopping-message-bar-warning-not-enough-reviews-message = When this product has more reviews, well be able to analyze them.
shopping-message-bar-warning-product-not-available-title = Product is not available
shopping-message-bar-warning-product-not-available-message = If you see that this product is back in stock, report it to us and well work on updating the analysis.
shopping-message-bar-warning-product-not-available-button = Report this product is back in stock
shopping-message-bar-thanks-for-reporting-title = Thanks for reporting!
shopping-message-bar-thanks-for-reporting-message = We should have an updated analysis within 24 hours. Please check back.
shopping-message-bar-warning-product-not-available-reported-title = Analysis coming soon
shopping-message-bar-warning-product-not-available-reported-message = An updated analysis should be ready within 24 hours. Please check back.
shopping-message-bar-warning-offline-title = No network connection
shopping-message-bar-warning-offline-message = Check your network connection. Then, try reloading the page.
shopping-message-bar-analysis-in-progress-title = Analysis coming soon
shopping-message-bar-analysis-in-progress-message = When its done, well automatically show the updated info here.
## Strings for the product review snippets card
shopping-highlights-label =
.label = Snippets from recent reviews
shopping-highlight-price = Price
shopping-highlight-quality = Quality
shopping-highlight-shipping = Shipping
shopping-highlight-competitiveness = Competitiveness
shopping-highlight-packaging = Packaging
## Strings for show more card
shopping-show-more-button = Show more
shopping-show-less-button = Show less
## Strings for the settings card
shopping-settings-label =
.label = Settings
shopping-settings-recommendations-toggle =
.label = Show products recommended by { -brand-product-name }
shopping-settings-opt-out-button = Turn off review quality check
## Strings for the adjusted rating component
shopping-adjusted-rating-label =
.label = Adjusted rating
shopping-adjusted-rating-unreliable-reviews = Unreliable reviews removed
## Strings for the review reliability component
shopping-review-reliability-label =
.label = How reliable are these reviews?
## Strings for the analysis explainer component
shopping-analysis-explainer-label =
.label = How we determine review quality
shopping-analysis-explainer-intro =
{ -brand-product-name } uses AI technology from { -fakespot-brand-name } to analyze the quality and reliability of product reviews.
This is only provided to help you assess review quality, not product quality.
shopping-analysis-explainer-grades-intro =
We assign each products reviews a <strong>letter grade</strong> from A to F.
shopping-analysis-explainer-higher-grade-description =
A higher grade means we believe the reviews are likely from real customers who left honest, unbiased reviews.
shopping-analysis-explainer-lower-grade-description =
A lower grade means we believe the reviews are likely from paid or biased reviewers.
shopping-analysis-explainer-adjusted-rating-description =
The <strong>adjusted rating</strong> is based on review quality, with unreliable reviews removed.
shopping-analysis-explainer-highlights-description =
<strong>Highlights</strong> are pulled from recent Amazon reviews (from the last 80 days), that we believe to be reliable.
shopping-analysis-explainer-learn-more =
Learn more about <a data-l10n-name="review-quality-url">how { -fakespot-brand-name } determines review quality</a>.
shopping-analysis-explainer-review-grading-scale = Review grading scale:
shopping-analysis-explainer-review-grading-scale-reliable = We believe the reviews to be reliable
shopping-analysis-explainer-review-grading-scale-mixed = We believe theres a mix of reliable and unreliable reviews
shopping-analysis-explainer-review-grading-scale-unreliable = We believe the reviews are unreliable
## Strings for UrlBar button
shopping-sidebar-open-button =
.tooltiptext = Open shopping sidebar
shopping-sidebar-close-button =
.tooltiptext = Close shopping sidebar
## Strings for the unanalyzed product card.
shopping-unanalyzed-product-header = No analysis for these reviews yet
shopping-unanalyzed-product-message = Youre about 60 seconds away from knowing whether you can trust the reviews for this product.
shopping-unanalyzed-product-analyze-link = Analyze reviews
## Onboarding message strings.
shopping-onboarding-headline = Try our trusted guide to product reviews

View File

@ -16,7 +16,6 @@
<link rel="localization" href="browser/components/mozSupportLink.ftl" />
<link rel="localization" href="toolkit/global/notification.ftl" />
<link rel="localization" href="preview/shopping.ftl" />
<link rel="localization" href="browser/shopping.ftl" />
<link rel="stylesheet" href="chrome://global/skin/in-content/common.css" />

View File

@ -10,8 +10,6 @@ import { MozLitElement } from "chrome://global/content/lit-utils.mjs";
// eslint-disable-next-line import/no-unassigned-import
import "chrome://browser/content/shopping/shopping-card.mjs";
import { FAKESPOT_ANALYSIS_URL } from "chrome://global/content/shopping/ProductConfig.mjs";
class UnanalyzedProductCard extends MozLitElement {
static properties = {
productURL: { type: String, reflect: true },
@ -32,6 +30,7 @@ class UnanalyzedProductCard extends MozLitElement {
);
}
// TODO: add link for product analysis once finalized
render() {
return html`
<link
@ -49,7 +48,7 @@ class UnanalyzedProductCard extends MozLitElement {
id="unanalyzed-product-analysis-link"
data-l10n-id="shopping-unanalyzed-product-analyze-link"
target="_blank"
href="${FAKESPOT_ANALYSIS_URL}${encodeURIComponent(
href="https://fakespot.com/analyze?url=${encodeURIComponent(
this.productURL
)}"
@click=${this.onClickAnalysisLink}

View File

@ -71,8 +71,6 @@ add_task(async function test_shopping_settings_ads_disabled() {
* Tests that the shopping-settings ads toggle and ad render correctly, even with
* multiple tabs. If `browser.shopping.experience2023.ads.userEnabled`
* is false in one tab, it should be false for all other tabs with the shopping sidebar open.
*
* Temporarily disabled; see bug 1851891 for details.
*/
add_task(async function test_settings_toggle_ad_and_multiple_tabs() {
await SpecialPowers.pushPrefEnv({
@ -189,4 +187,4 @@ add_task(async function test_settings_toggle_ad_and_multiple_tabs() {
await SpecialPowers.popPrefEnv();
await SpecialPowers.popPrefEnv();
}).skip();
});

View File

@ -1,153 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
shopping-page-title = { -brand-product-name } Shopping
# Title for page showing where a user can check the
# review quality of online shopping product reviews
shopping-main-container-title = Review checker
shopping-close-button =
.title = Close
# This string is for notifying screen reader users that the
# sidebar is still loading data.
shopping-a11y-loading =
.aria-label = Loading…
## Strings for the letter grade component.
## For now, we only support letter grades A, B, C, D and F.
## Letter A indicates the highest grade, and F indicates the lowest grade.
## Letters are hardcoded and cannot be localized.
shopping-letter-grade-description-ab = Reliable reviews
shopping-letter-grade-description-c = Mix of reliable and unreliable reviews
shopping-letter-grade-description-df = Unreliable reviews
# This string is displayed in a tooltip that appears when the user hovers
# over the letter grade component without a visible description.
# It is also used for screen readers.
# $letter (String) - The letter grade as A, B, C, D or F (hardcoded).
# $description (String) - The localized letter grade description. See shopping-letter-grade-description-* strings above.
shopping-letter-grade-tooltip =
.title = { $letter } - { $description }
## Strings for the shopping message-bar
shopping-message-bar-warning-stale-analysis-title = Updates available
shopping-message-bar-warning-stale-analysis-message = Launch the { -fakespot-brand-full-name } analyzer to get updated info in about 60 seconds.
shopping-message-bar-generic-error-title = Analysis not available right now
shopping-message-bar-generic-error-message = Were working to resolve the issue. Please check back soon.
shopping-message-bar-warning-not-enough-reviews-title = Not enough reviews yet
shopping-message-bar-warning-not-enough-reviews-message = When this product has more reviews, well be able to analyze them.
shopping-message-bar-warning-product-not-available-title = Product is not available
shopping-message-bar-warning-product-not-available-message = If you see that this product is back in stock, report it to us and well work on updating the analysis.
shopping-message-bar-warning-product-not-available-button = Report this product is back in stock
shopping-message-bar-thanks-for-reporting-title = Thanks for reporting!
shopping-message-bar-thanks-for-reporting-message = We should have an updated analysis within 24 hours. Please check back.
shopping-message-bar-warning-product-not-available-reported-title = Analysis coming soon
shopping-message-bar-warning-product-not-available-reported-message = An updated analysis should be ready within 24 hours. Please check back.
shopping-message-bar-warning-offline-title = No network connection
shopping-message-bar-warning-offline-message = Check your network connection. Then, try reloading the page.
shopping-message-bar-analysis-in-progress-title = Analysis coming soon
shopping-message-bar-analysis-in-progress-message = When its done, well automatically show the updated info here.
## The word 'analyzer' when used here reflects what this tool is called on
## fakespot.com. If possible, a different word should be used for the Fakespot
## tool (the Fakespot by Mozilla 'analyzer') other than 'checker', which is
## used in the name of the Firefox feature ('Review checker'). If that is not
## possible - if these terms are not meaningfully different - that is OK.
shopping-message-bar-warning-stale-analysis-link = Launch analyzer on { -fakespot-website-name }
## Strings for the product review snippets card
shopping-highlights-label =
.label = Highlights from recent reviews
shopping-highlight-price = Price
shopping-highlight-quality = Quality
shopping-highlight-shipping = Shipping
shopping-highlight-competitiveness = Competitiveness
shopping-highlight-packaging = Packaging
## Strings for show more card
shopping-show-more-button = Show more
shopping-show-less-button = Show less
## Strings for the settings card
shopping-settings-label =
.label = Settings
shopping-settings-recommendations-toggle =
.label = Show ads in review checker
shopping-settings-recommendations-learn-more =
Youll see occasional ads for relevant products. All ads must meet our review quality standards. <a data-l10n-name="review-quality-url">Learn more</a>
shopping-settings-opt-out-button = Turn off review checker
powered-by-fakespot = Review checker is powered by <a data-l10n-name="fakespot-link">{ -fakespot-brand-full-name }</a>.
## Strings for the adjusted rating component
shopping-adjusted-rating-label =
.label = Adjusted rating
shopping-adjusted-rating-unreliable-reviews = Unreliable reviews removed
## Strings for the review reliability component
shopping-review-reliability-label =
.label = How reliable are these reviews?
## Strings for the analysis explainer component
shopping-analysis-explainer-label =
.label = How we determine review quality
shopping-analysis-explainer-intro =
We use AI technology from { -fakespot-brand-full-name } to analyze the reliability of product reviews.
This analysis will only help you assess review quality, not product quality.
shopping-analysis-explainer-grades-intro =
We assign each products reviews a <strong>letter grade</strong> from A to F.
shopping-analysis-explainer-adjusted-rating-description =
The <strong>adjusted rating</strong> is based only on reviews we believe to be reliable.
shopping-analysis-explainer-learn-more =
Learn more about <a data-l10n-name="review-quality-url">how { -fakespot-brand-full-name } determines review quality</a>.
# This string includes the short brand name of one of the three supported
# websites, which will be inserted without being translated.
# $retailer (String) - capitalized name of the shopping website, for example, "Amazon".
shopping-analysis-explainer-highlights-description =
<strong>Highlights</strong> are from { $retailer } reviews within the last 80 days that we believe to be reliable.
shopping-analysis-explainer-review-grading-scale-reliable = Reliable reviews. We believe the reviews are likely from real customers who left honest, unbiased reviews.
shopping-analysis-explainer-review-grading-scale-mixed = We believe theres a mix of reliable and unreliable reviews.
shopping-analysis-explainer-review-grading-scale-unreliable = Unreliable reviews. We believe the reviews are likely fake or from biased reviewers.
## Strings for UrlBar button
shopping-sidebar-open-button =
.tooltiptext = Open shopping sidebar
shopping-sidebar-close-button =
.tooltiptext = Close shopping sidebar
## Strings for the unanalyzed product card.
## The word 'analyzer' when used here reflects what this tool is called on
## fakespot.com. If possible, a different word should be used for the Fakespot
## tool (the Fakespot by Mozilla 'analyzer') other than 'checker', which is
## used in the name of the Firefox feature ('Review checker'). If that is not
## possible - if these terms are not meaningfully different - that is OK.
shopping-unanalyzed-product-header = No analysis for these reviews yet
shopping-unanalyzed-product-message = Launch the { -fakespot-brand-full-name } analyzer and youll know in about 60 seconds whether this products reviews are reliable.
shopping-unanalyzed-product-analyze-link = Launch analyzer on { -fakespot-website-name }
## Strings for the advertisement
more-to-consider-ad-label =
.label = More to consider
ad-by-fakespot = Ad by { -fakespot-brand-name }

View File

@ -27,9 +27,6 @@ const REPORTING_RESPONSE_SCHEMA =
const REPORTING_REQUEST_SCHEMA =
"chrome://global/content/shopping/reporting_request.schema.json";
const FAKESPOT_BASE_URL = "https://www.fakespot.com/";
const FAKESPOT_ANALYSIS_URL = "https://www.fakespot.com/analyze?url=";
const ProductConfig = {
amazon: {
productIdFromURLRegex:
@ -47,10 +44,7 @@ const ProductConfig = {
},
};
// Note (bug 1849401): the fakespot URLs are loaded by about page content,
// where `Cu` is undefined--hence the check here. Would be good to find a
// better approach.
if (typeof Cu !== "undefined" && Cu.isInAutomation) {
if (Cu.isInAutomation) {
// Also allow example.com to allow for testing.
ProductConfig.example = ProductConfig.amazon;
ANALYSIS_API =
@ -78,7 +72,5 @@ export {
REPORTING_API,
REPORTING_RESPONSE_SCHEMA,
REPORTING_REQUEST_SCHEMA,
FAKESPOT_BASE_URL,
FAKESPOT_ANALYSIS_URL,
ProductConfig,
};

View File

@ -30,12 +30,6 @@
-relay-brand-short-name = Relay
-fakespot-brand-name = Fakespot
# Note the name of the website is capitalized.
-fakespot-website-name = Fakespot.com
# The particle "by" can be localized, "Fakespot" and "Mozilla" should not be localized or transliterated.
-fakespot-brand-full-name = Fakespot by Mozilla
# “Suggest” can be localized, “Firefox” must be treated as a brand
# and kept in English.
-firefox-suggest-brand-name = Firefox Suggest