summaryrefslogtreecommitdiffstats
path: root/browser/components/pocket/content/panels/js/signup
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/components/pocket/content/panels/js/signup
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/pocket/content/panels/js/signup')
-rw-r--r--browser/components/pocket/content/panels/js/signup/entry.js17
-rw-r--r--browser/components/pocket/content/panels/js/signup/overlay.js50
2 files changed, 67 insertions, 0 deletions
diff --git a/browser/components/pocket/content/panels/js/signup/entry.js b/browser/components/pocket/content/panels/js/signup/entry.js
new file mode 100644
index 0000000000..4beae984bb
--- /dev/null
+++ b/browser/components/pocket/content/panels/js/signup/entry.js
@@ -0,0 +1,17 @@
+/* global PKT_PANEL:false */
+
+function onDOMLoaded() {
+ if (!window.thePKT_PANEL) {
+ var thePKT_PANEL = new PKT_PANEL();
+ /* global thePKT_PANEL */
+ window.thePKT_PANEL = thePKT_PANEL;
+ thePKT_PANEL.initSignup();
+ }
+ window.thePKT_PANEL.create();
+}
+
+if (document.readyState != `loading`) {
+ onDOMLoaded();
+} else {
+ document.addEventListener(`DOMContentLoaded`, onDOMLoaded);
+}
diff --git a/browser/components/pocket/content/panels/js/signup/overlay.js b/browser/components/pocket/content/panels/js/signup/overlay.js
new file mode 100644
index 0000000000..319ff18938
--- /dev/null
+++ b/browser/components/pocket/content/panels/js/signup/overlay.js
@@ -0,0 +1,50 @@
+/*
+SignupOverlay is the view itself and contains all of the methods to manipute the overlay and messaging.
+It does not contain any logic for saving or communication with the extension or server.
+*/
+
+import React from "react";
+import ReactDOM from "react-dom";
+import pktPanelMessaging from "../messages.js";
+import Signup from "../components/Signup/Signup";
+
+var SignupOverlay = function(options) {
+ this.inited = false;
+ this.active = false;
+
+ this.create = function({ pockethost }) {
+ // Extract local variables passed into template via URL query params
+ const { searchParams } = new URL(window.location.href);
+ const locale = searchParams.get(`locale`) || ``;
+ const utmSource = searchParams.get(`utmSource`);
+ const utmCampaign = searchParams.get(`utmCampaign`);
+ const utmContent = searchParams.get(`utmContent`);
+
+ if (this.active) {
+ return;
+ }
+
+ this.active = true;
+
+ // Create actual content
+ ReactDOM.render(
+ <Signup
+ pockethost={pockethost}
+ utmSource={utmSource}
+ utmCampaign={utmCampaign}
+ utmContent={utmContent}
+ locale={locale}
+ />,
+ document.querySelector(`body`)
+ );
+
+ if (window?.matchMedia(`(prefers-color-scheme: dark)`).matches) {
+ document.querySelector(`body`).classList.add(`theme_dark`);
+ }
+
+ // tell back end we're ready
+ pktPanelMessaging.sendMessage("PKT_show_signup");
+ };
+};
+
+export default SignupOverlay;