diff --git a/src/background.ts b/src/background.ts
index e07fc8fe..fab49f4a 100644
--- a/src/background.ts
+++ b/src/background.ts
@@ -19,6 +19,7 @@ import {
registerGoogleCalendarMessageHandlers,
registerOutlookCalendarMessageHandlers,
} from "./background/calendarBackground";
+import { createCustomThemesHandlers } from "./background/customThemesHandlers";
import {
createRemoteConfigHandlers,
initRemoteConfigBackground,
diff --git a/src/css/injected.scss b/src/css/injected.scss
index 040f993e..a55815e9 100644
--- a/src/css/injected.scss
+++ b/src/css/injected.scss
@@ -4101,6 +4101,24 @@ div.day-empty {
.bsplus-founder-badge-hero__stage .bsplus-founder-badge {
pointer-events: auto;
}
+
+.bsplus-remote-page-banner {
+ width: 90%;
+ margin: 0 auto 0.75rem;
+ padding: 0.65rem 0.85rem;
+ border-radius: 12px;
+ border: 1px solid color-mix(in srgb, var(--text-primary) 14%, transparent);
+ background: color-mix(in srgb, var(--text-primary) 5%, var(--background-primary));
+ font-size: 0.95rem;
+ line-height: 1.5;
+ color: var(--text-primary);
+}
+
+.bsplus-remote-page-banner__title {
+ font-weight: 600;
+ margin: 0 0 0.35rem;
+}
+
.whatsnewTextContainer.bsplus-founder-badge-body p {
margin: 0 0 1rem;
font-size: 1.2rem;
diff --git a/src/seqta/utils/Openers/openRemoteCampaignPopup.ts b/src/seqta/utils/Openers/openRemoteCampaignPopup.ts
index e4ff1e5b..bbf0f34e 100644
--- a/src/seqta/utils/Openers/openRemoteCampaignPopup.ts
+++ b/src/seqta/utils/Openers/openRemoteCampaignPopup.ts
@@ -6,20 +6,6 @@ import type { RemoteCampaign } from "@/seqta/utils/remoteConfig/types";
import { requestSettingsDestination } from "@/seqta/utils/settingsNavigation";
import { openSettingsPopup } from "@/seqta/utils/setupSettingsButton";
-function campaignHero(campaign: RemoteCampaign): HTMLElement | null {
- const hero = campaign.hero;
- if (!hero?.url) return null;
- if (hero.type === "video") {
- return createPopupHeroVideo(hero.url, hero.alt ?? "");
- }
- const img = document.createElement("img");
- img.src = hero.url;
- img.alt = hero.alt ?? "";
- img.className = "whatsnewHeroImage";
- img.loading = "lazy";
- return img;
-}
-
export function openRemoteCampaignPopup(
campaign: RemoteCampaign,
onDismissed?: () => void,
@@ -31,27 +17,45 @@ export function openRemoteCampaignPopup(
/* html */ `
`,
).firstChild as HTMLElement;
- const body = stringToHTML(/* html */ ``)
- .firstChild as HTMLElement;
- if (campaign.bodyHtml) body.innerHTML = campaign.bodyHtml;
-
const buttons = campaign.buttons?.length
? campaign.buttons
: [{ id: "dismiss", label: "Dismiss", action: "dismiss" as const }];
- const footer = stringToHTML(
- /* html */ `${buttons
- .map(
- (btn) =>
- ``,
- )
- .join("")}
`,
- ).firstChild as HTMLElement;
+ const actionsHtml = buttons
+ .map(
+ (btn, i) =>
+ ``,
+ )
+ .join("");
+
+ const text = stringToHTML(/* html */ `
+
+ `).firstChild as HTMLElement;
+
+ const bodySlot = text.querySelector(".bsplus-campaign-body");
+ if (bodySlot && campaign.bodyHtml) bodySlot.innerHTML = campaign.bodyHtml;
const content: HTMLElement[] = [];
- const hero = campaignHero(campaign);
- if (hero) content.push(hero);
- content.push(body, footer);
+ const hero = campaign.hero;
+ if (hero?.url) {
+ if (hero.type === "video") {
+ content.push(createPopupHeroVideo(hero.url, hero.alt ?? ""));
+ } else {
+ const wrap = stringToHTML(/* html */ ``)
+ .firstChild as HTMLElement;
+ const img = document.createElement("img");
+ img.src = hero.url;
+ img.alt = hero.alt ?? "";
+ img.className = "whatsnewImg";
+ img.loading = "lazy";
+ wrap.append(img);
+ content.push(wrap);
+ }
+ }
+ content.push(text);
const actions = buttons.map((btn) => ({
id: `bsplus-campaign-${campaign.id}-${btn.id}`,
@@ -70,6 +74,7 @@ export function openRemoteCampaignPopup(
openPopup({
header,
content,
+ animateSelector: ".whatsnewImgContainer, .whatsnewTextContainer *",
actions,
afterClose: () => {
void markCampaignSeen(campaign.id);
diff --git a/src/seqta/utils/cloudSettingsSync.ts b/src/seqta/utils/cloudSettingsSync.ts
index 62e42850..ab6dcbfe 100644
--- a/src/seqta/utils/cloudSettingsSync.ts
+++ b/src/seqta/utils/cloudSettingsSync.ts
@@ -7,7 +7,10 @@ import {
BSPLUS_INSTALL_REGISTERED_AT_KEY,
BSPLUS_LOCAL_OVERRIDE_ONOFF_KEY,
BSPLUS_REMOTE_CONFIG_ETAG_KEY,
+ BSPLUS_REMOTE_CONFIG_FETCHED_AT_KEY,
+ BSPLUS_REMOTE_CONFIG_LAST_HOSTNAME_KEY,
BSPLUS_REMOTE_CONFIG_SNAPSHOT_KEY,
+ BSPLUS_REMOTE_LAST_PRIMARY_OK_KEY,
} from "@/seqta/utils/remoteConfig/storageKeys";
/** Matches the contract in docs/CLOUD_SETTINGS_SYNC_SERVER.md */
diff --git a/src/seqta/utils/remoteConfig/apply.test.ts b/src/seqta/utils/remoteConfig/apply.test.ts
index 7622ad19..504158ff 100644
--- a/src/seqta/utils/remoteConfig/apply.test.ts
+++ b/src/seqta/utils/remoteConfig/apply.test.ts
@@ -121,13 +121,15 @@ describe("hydrateRemoteConfigFromStorage", () => {
jest.doMock("@/seqta/utils/listeners/SettingsState", () => ({
settingsState: { onoff: true },
}));
- const { hydrateRemoteConfigFromStorage } = await import("./runtime");
+ const { hydrateRemoteConfigFromStorage, notifyRemoteConfigPageContext } = await import("./runtime");
await hydrateRemoteConfigFromStorage();
+ notifyRemoteConfigPageContext("learn.example.edu.au");
const browser = jest.requireMock("webextension-polyfill");
const types = browser.runtime.sendMessage.mock.calls.map(
(c: [{ type?: string }]) => c[0]?.type,
);
expect(types).toContain("getRemoteConfigSnapshot");
+ expect(types).toContain("setRemoteConfigPageContext");
expect(types).toContain("refreshRemoteConfig");
expect(types.indexOf("getRemoteConfigSnapshot")).toBeLessThan(
types.indexOf("refreshRemoteConfig"),
diff --git a/src/seqta/utils/remoteConfig/runtime.ts b/src/seqta/utils/remoteConfig/runtime.ts
index 76371c4e..2d507a0a 100644
--- a/src/seqta/utils/remoteConfig/runtime.ts
+++ b/src/seqta/utils/remoteConfig/runtime.ts
@@ -111,7 +111,6 @@ export async function hydrateRemoteConfigFromStorage(): Promise {});
}
applyRemoteRuntime(
@@ -123,11 +122,16 @@ export async function hydrateRemoteConfigFromStorage(): Promise {});
+}
+
export function notifyRemoteConfigPageContext(hostname: string): void {
void browser.storage.local.set({ [BSPLUS_REMOTE_CONFIG_LAST_HOSTNAME_KEY]: hostname });
void browser.runtime
.sendMessage({ type: "setRemoteConfigPageContext", hostname })
.catch(() => {});
+ syncRemoteConfigFromBackend();
}
export async function markCampaignSeen(campaignId: string, ack?: boolean): Promise {