@revenuecat/purchases-ui-js
Version:
Web components for Paywalls. Powered by RevenueCat
43 lines (42 loc) • 1.51 kB
JavaScript
import { STORY_BACKGROUND_VIDEO_FILL } from "../../../stories/video-background-story-fixture";
import { SHEET_PAYWALL } from "./sheet-paywall";
/**
* Minimal variant of {@link SHEET_PAYWALL} with a sheet-level video background for
* Storybook z-order regression checks (`rc-sheet-video-bg`).
*/
export const SHEET_PAYWALL_VIDEO_STACKING = (() => {
const data = structuredClone(SHEET_PAYWALL);
data.id = "sheet_paywall_video_stacking";
data.components_localizations ??= {};
data.components_localizations.en_US ??= {};
Object.assign(data.components_localizations.en_US, {
"5GWqi3MXpt": "Content above tinted video",
E6CK5Xd1cE: "Open sheet · video backdrop",
});
const first = data.components_config.base.stack.components[0];
if (!first || first.type !== "button") {
return data;
}
const { action } = first;
if (!action ||
action.type !== "navigate_to" ||
action.destination !== "sheet") {
return data;
}
const { sheet } = action;
if (!sheet) {
return data;
}
sheet.background = STORY_BACKGROUND_VIDEO_FILL;
sheet.stack.background = null;
const headline = sheet.stack.components[0];
if (headline?.type === "text") {
headline.horizontal_alignment = "center";
headline.color = {
light: { type: "hex", value: "#ffffff" },
};
headline.font_size = "heading_m";
headline.font_weight = "semibold";
}
return data;
})();