summaryrefslogtreecommitdiffstats
path: root/browser/components/pocket/content
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/pocket/content')
-rw-r--r--browser/components/pocket/content/SaveToPocket.sys.mjs2
-rw-r--r--browser/components/pocket/content/panels/js/components/Home/Home.jsx2
-rw-r--r--browser/components/pocket/content/panels/js/components/Saved/Saved.jsx2
-rw-r--r--browser/components/pocket/content/panels/js/home/overlay.jsx2
-rw-r--r--browser/components/pocket/content/panels/js/main.bundle.js14
-rw-r--r--browser/components/pocket/content/panels/js/main.mjs2
-rw-r--r--browser/components/pocket/content/panels/js/saved/overlay.jsx2
-rw-r--r--browser/components/pocket/content/panels/js/signup/overlay.jsx2
-rw-r--r--browser/components/pocket/content/panels/js/style-guide/overlay.jsx2
-rw-r--r--browser/components/pocket/content/pktApi.sys.mjs27
-rw-r--r--browser/components/pocket/content/pktUI.js28
11 files changed, 48 insertions, 37 deletions
diff --git a/browser/components/pocket/content/SaveToPocket.sys.mjs b/browser/components/pocket/content/SaveToPocket.sys.mjs
index 60674acc82..9b9a30b4a2 100644
--- a/browser/components/pocket/content/SaveToPocket.sys.mjs
+++ b/browser/components/pocket/content/SaveToPocket.sys.mjs
@@ -101,7 +101,7 @@ export var SaveToPocket = {
);
},
- observe(subject, topic, data) {
+ observe(subject, topic) {
if (topic == "browser-delayed-startup-finished") {
// We only get here if pocket is disabled; the observer is removed when
// we're enabled.
diff --git a/browser/components/pocket/content/panels/js/components/Home/Home.jsx b/browser/components/pocket/content/panels/js/components/Home/Home.jsx
index 1036876725..8e15df1869 100644
--- a/browser/components/pocket/content/panels/js/components/Home/Home.jsx
+++ b/browser/components/pocket/content/panels/js/components/Home/Home.jsx
@@ -32,7 +32,7 @@ function Home(props) {
: ``
}`;
- const loadingRecentSaves = useCallback(resp => {
+ const loadingRecentSaves = useCallback(() => {
setArticlesState(prevState => ({
...prevState,
status: "loading",
diff --git a/browser/components/pocket/content/panels/js/components/Saved/Saved.jsx b/browser/components/pocket/content/panels/js/components/Saved/Saved.jsx
index 502c73b0a5..b750946234 100644
--- a/browser/components/pocket/content/panels/js/components/Saved/Saved.jsx
+++ b/browser/components/pocket/content/panels/js/components/Saved/Saved.jsx
@@ -85,7 +85,7 @@ function Saved(props) {
panelMessaging.addMessageListener(
"PKT_getArticleInfoAttempted",
- function (resp) {
+ function () {
setArticleInfoAttempted(true);
}
);
diff --git a/browser/components/pocket/content/panels/js/home/overlay.jsx b/browser/components/pocket/content/panels/js/home/overlay.jsx
index 4d49a09470..f8ee1578ba 100644
--- a/browser/components/pocket/content/panels/js/home/overlay.jsx
+++ b/browser/components/pocket/content/panels/js/home/overlay.jsx
@@ -7,7 +7,7 @@ import React from "react";
import ReactDOM from "react-dom";
import Home from "../components/Home/Home.jsx";
-var HomeOverlay = function (options) {
+var HomeOverlay = function () {
this.inited = false;
this.active = false;
};
diff --git a/browser/components/pocket/content/panels/js/main.bundle.js b/browser/components/pocket/content/panels/js/main.bundle.js
index 36e2f82973..39a3dbccd7 100644
--- a/browser/components/pocket/content/panels/js/main.bundle.js
+++ b/browser/components/pocket/content/panels/js/main.bundle.js
@@ -275,7 +275,7 @@ function Home(props) {
status: ""
});
const utmParams = `utm_source=${utmSource}${utmCampaign && utmContent ? `&utm_campaign=${utmCampaign}&utm_content=${utmContent}` : ``}`;
- const loadingRecentSaves = (0,react.useCallback)(resp => {
+ const loadingRecentSaves = (0,react.useCallback)(() => {
setArticlesState(prevState => ({
...prevState,
status: "loading"
@@ -381,7 +381,7 @@ It does not contain any logic for saving or communication with the extension or
-var HomeOverlay = function (options) {
+var HomeOverlay = function () {
this.inited = false;
this.active = false;
};
@@ -487,7 +487,7 @@ It does not contain any logic for saving or communication with the extension or
-var SignupOverlay = function (options) {
+var SignupOverlay = function () {
this.inited = false;
this.active = false;
this.create = function ({
@@ -772,7 +772,7 @@ function Saved(props) {
messages.addMessageListener("PKT_articleInfoFetched", function (resp) {
setSavedStoryState(resp?.data?.item_preview);
});
- messages.addMessageListener("PKT_getArticleInfoAttempted", function (resp) {
+ messages.addMessageListener("PKT_getArticleInfoAttempted", function () {
setArticleInfoAttempted(true);
});
@@ -843,7 +843,7 @@ It does not contain any logic for saving or communication with the extension or
-var SavedOverlay = function (options) {
+var SavedOverlay = function () {
this.inited = false;
this.active = false;
};
@@ -883,7 +883,7 @@ SavedOverlay.prototype = {
-var StyleGuideOverlay = function (options) {};
+var StyleGuideOverlay = function () {};
StyleGuideOverlay.prototype = {
create() {
// TODO: Wrap popular topics component in JSX to work without needing an explicit container hierarchy for styling
@@ -1072,7 +1072,7 @@ PKT_PANEL.prototype = {
const config = { attributes: false, childList: true, subtree: true };
// Callback function to execute when mutations are observed
- const callback = (mutationList, observer) => {
+ const callback = mutationList => {
mutationList.forEach(mutation => {
switch (mutation.type) {
case "childList": {
diff --git a/browser/components/pocket/content/panels/js/main.mjs b/browser/components/pocket/content/panels/js/main.mjs
index b5ae0e9c3a..2c1da9528c 100644
--- a/browser/components/pocket/content/panels/js/main.mjs
+++ b/browser/components/pocket/content/panels/js/main.mjs
@@ -86,7 +86,7 @@ PKT_PANEL.prototype = {
const config = { attributes: false, childList: true, subtree: true };
// Callback function to execute when mutations are observed
- const callback = (mutationList, observer) => {
+ const callback = mutationList => {
mutationList.forEach(mutation => {
switch (mutation.type) {
case "childList": {
diff --git a/browser/components/pocket/content/panels/js/saved/overlay.jsx b/browser/components/pocket/content/panels/js/saved/overlay.jsx
index ab2617f112..091821c149 100644
--- a/browser/components/pocket/content/panels/js/saved/overlay.jsx
+++ b/browser/components/pocket/content/panels/js/saved/overlay.jsx
@@ -7,7 +7,7 @@ import React from "react";
import ReactDOM from "react-dom";
import Saved from "../components/Saved/Saved.jsx";
-var SavedOverlay = function (options) {
+var SavedOverlay = function () {
this.inited = false;
this.active = false;
};
diff --git a/browser/components/pocket/content/panels/js/signup/overlay.jsx b/browser/components/pocket/content/panels/js/signup/overlay.jsx
index 6143afbc83..ce3b681f15 100644
--- a/browser/components/pocket/content/panels/js/signup/overlay.jsx
+++ b/browser/components/pocket/content/panels/js/signup/overlay.jsx
@@ -8,7 +8,7 @@ import ReactDOM from "react-dom";
import pktPanelMessaging from "../messages.mjs";
import Signup from "../components/Signup/Signup.jsx";
-var SignupOverlay = function (options) {
+var SignupOverlay = function () {
this.inited = false;
this.active = false;
diff --git a/browser/components/pocket/content/panels/js/style-guide/overlay.jsx b/browser/components/pocket/content/panels/js/style-guide/overlay.jsx
index fbc0dac069..b802a9159b 100644
--- a/browser/components/pocket/content/panels/js/style-guide/overlay.jsx
+++ b/browser/components/pocket/content/panels/js/style-guide/overlay.jsx
@@ -6,7 +6,7 @@ import Button from "../components/Button/Button.jsx";
import PopularTopics from "../components/PopularTopics/PopularTopics.jsx";
import TagPicker from "../components/TagPicker/TagPicker.jsx";
-var StyleGuideOverlay = function (options) {};
+var StyleGuideOverlay = function () {};
StyleGuideOverlay.prototype = {
create() {
diff --git a/browser/components/pocket/content/pktApi.sys.mjs b/browser/components/pocket/content/pktApi.sys.mjs
index 16d0948b36..132f9369ce 100644
--- a/browser/components/pocket/content/pktApi.sys.mjs
+++ b/browser/components/pocket/content/pktApi.sys.mjs
@@ -47,7 +47,6 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
IndexedDB: "resource://gre/modules/IndexedDB.sys.mjs",
- NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
});
@@ -291,12 +290,12 @@ export var pktApi = (function () {
"extensions.pocket.oAuthConsumerKey"
);
} else {
- baseAPIUrl = `https://${lazy.NimbusFeatures.saveToPocket.getVariable(
- "bffApi"
+ baseAPIUrl = `https://${Services.prefs.getStringPref(
+ "extensions.pocket.bffApi"
)}/desktop/v1`;
- oAuthConsumerKey = lazy.NimbusFeatures.saveToPocket.getVariable(
- "oAuthConsumerKeyBff"
+ oAuthConsumerKey = Services.prefs.getStringPref(
+ "extensions.pocket.oAuthConsumerKeyBff"
);
}
@@ -309,7 +308,7 @@ export var pktApi = (function () {
data.locale_lang = Services.locale.appLocaleAsBCP47;
data.consumer_key = oAuthConsumerKey;
- var request = new XMLHttpRequest();
+ var request = new XMLHttpRequest({ mozAnon: false });
if (!useBFF) {
request.open("POST", url, true);
@@ -317,7 +316,7 @@ export var pktApi = (function () {
request.open("GET", url, true);
}
- request.onreadystatechange = function (e) {
+ request.onreadystatechange = function () {
if (request.readyState == 4) {
// "done" is a completed XHR regardless of success/error:
if (options.done) {
@@ -487,7 +486,7 @@ export var pktApi = (function () {
access_token: getAccessToken(),
url,
},
- success(data) {
+ success() {
if (options.success) {
options.success.apply(options, Array.apply(null, arguments));
}
@@ -508,7 +507,7 @@ export var pktApi = (function () {
data: {
access_token: getAccessToken(),
},
- success(data) {
+ success() {
if (options.success) {
options.success.apply(options, Array.apply(null, arguments));
}
@@ -761,8 +760,9 @@ export var pktApi = (function () {
access_token: getAccessToken(),
});
- const useBFF =
- lazy.NimbusFeatures.saveToPocket.getVariable("bffRecentSaves");
+ const useBFF = Services.prefs.getBoolPref(
+ "extensions.pocket.bffRecentSaves"
+ );
return apiRequest(
{
@@ -816,8 +816,9 @@ export var pktApi = (function () {
{ count: 4 },
{
success(data) {
- const useBFF =
- lazy.NimbusFeatures.saveToPocket.getVariable("bffRecentSaves");
+ const useBFF = Services.prefs.getBoolPref(
+ "extensions.pocket.bffRecentSaves"
+ );
// Don't try to parse bad or missing data
if (
diff --git a/browser/components/pocket/content/pktUI.js b/browser/components/pocket/content/pktUI.js
index 60b7e3bcc3..05e31b5c30 100644
--- a/browser/components/pocket/content/pktUI.js
+++ b/browser/components/pocket/content/pktUI.js
@@ -46,7 +46,6 @@
ChromeUtils.defineESModuleGetters(this, {
ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs",
- NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
pktApi: "chrome://pocket/content/pktApi.sys.mjs",
pktTelemetry: "chrome://pocket/content/pktTelemetry.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
@@ -125,11 +124,13 @@ var pktUI = (function () {
* Show the sign-up panel
*/
function showSignUp() {
- getFirefoxAccountSignedInUser(function (userdata) {
+ getFirefoxAccountSignedInUser(function () {
showPanel(
"about:pocket-signup?" +
"emailButton=" +
- NimbusFeatures.saveToPocket.getVariable("emailButton"),
+ Services.prefs.getBoolPref(
+ "extensions.pocket.refresh.emailButton.enabled"
+ ),
`signup`
);
});
@@ -154,8 +155,9 @@ var pktUI = (function () {
* Show the Pocket home panel state
*/
function showPocketHome() {
- const hideRecentSaves =
- NimbusFeatures.saveToPocket.getVariable("hideRecentSaves");
+ const hideRecentSaves = Services.prefs.getBoolPref(
+ "extensions.pocket.refresh.hideRecentSaves.enabled"
+ );
const locale = getUILocale();
let panel = `home_no_topics`;
if (locale.startsWith("en-")) {
@@ -232,7 +234,11 @@ var pktUI = (function () {
async function onShowHome() {
pktTelemetry.submitPocketButtonPing("click", "home_button");
- if (!NimbusFeatures.saveToPocket.getVariable("hideRecentSaves")) {
+ if (
+ !Services.prefs.getBoolPref(
+ "extensions.pocket.refresh.hideRecentSaves.enabled"
+ )
+ ) {
let recentSaves = await pktApi.getRecentSavesCache();
if (recentSaves) {
// We have cache, so we can use those.
@@ -284,7 +290,7 @@ var pktUI = (function () {
// Add url
var options = {
- success(data, request) {
+ success(data) {
var item = data.item;
var ho2 = data.ho2;
var accountState = data.account_state;
@@ -299,7 +305,11 @@ var pktUI = (function () {
pktUIMessaging.sendMessageToPanel(saveLinkMessageId, successResponse);
SaveToPocket.itemSaved();
- if (!NimbusFeatures.saveToPocket.getVariable("hideRecentSaves")) {
+ if (
+ !Services.prefs.getBoolPref(
+ "extensions.pocket.refresh.hideRecentSaves.enabled"
+ )
+ ) {
// Articles saved for the first time (by anyone) won't have a resolved_id
if (item?.resolved_id && item?.resolved_id !== "0") {
pktApi.getArticleInfo(item.resolved_url, {
@@ -493,7 +503,7 @@ var pktUI = (function () {
.then(userData => {
callback(userData);
})
- .then(null, error => {
+ .then(null, () => {
callback();
});
}