Skip to content

Commit 76cebf0

Browse files
committed
feat: restructure promotions data into separate files for banners, videos, and popups
1 parent a6f216e commit 76cebf0

5 files changed

Lines changed: 434 additions & 399 deletions

File tree

src/assets/data/promos/banners.ts

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
import type { PromoData } from "./types";
2+
3+
export const bannerPromos: Record<string, PromoData> = {
4+
audacity4Alpha: {
5+
type: "banner",
6+
isActive: false,
7+
priority: 50,
8+
suppressOnPaths: ["/next", "/download"],
9+
message: "Want a peek at our next big release?",
10+
cta: {
11+
text: "Try the Audacity 4 Alpha",
12+
link: "/next",
13+
},
14+
tracking: {
15+
category: "Promo CTA",
16+
action: "Promo CTA button",
17+
name: "Audacity 4 Alpha",
18+
},
19+
styles: {
20+
container: "bg-[#0f004d]",
21+
message: "text-gray-100",
22+
button: "bg-[#ff3254] hover:bg-[#ff1a3c] text-white",
23+
},
24+
},
25+
voiceByAuribus: {
26+
type: "banner",
27+
isActive: false,
28+
priority: 50,
29+
osTargets: ["Windows", "OS X"],
30+
message:
31+
"AI powered professional vocals. Transform any track with Voice by Auribus!",
32+
styles: {
33+
container: "bg-yellow-300",
34+
message: "text-gray-900",
35+
button: "bg-gray-100 hover:bg-white",
36+
},
37+
tracking: {
38+
category: "Promo CTA",
39+
action: "Promo CTA button",
40+
name: "Voice by Auribus MuseHub",
41+
},
42+
cta: {
43+
text: "Get it on MuseHub",
44+
link: "https://www.musehub.com/plugin/auribus?utm_source=au-web&utm_medium=au-banner&utm_campaign=au-web-mh-web-auribus",
45+
},
46+
},
47+
soapVoiceCleaner: {
48+
type: "banner",
49+
isActive: false,
50+
priority: 50,
51+
osTargets: ["Windows", "OS X"],
52+
message:
53+
"Soap Voice Cleaner: Professional spoken voice in 3 simple clicks!",
54+
styles: {
55+
container: "bg-yellow-300",
56+
message: "text-gray-900 font-bold",
57+
button:
58+
"font-bold border-2 border-gray-900 bg-gray-900 text-white hover:bg-yellow-300 hover:text-gray-900 hover:border-gray-900",
59+
},
60+
tracking: {
61+
category: "Promo CTA",
62+
action: "Promo CTA button",
63+
name: "Soap MuseHub",
64+
},
65+
cta: {
66+
text: "Get it on MuseHub",
67+
link: "https://www.musehub.com/plugin/soap-voice-cleaner?utm_source=au-web-banner-mh-web&utm_medium=soap-voice-cleaner&utm_campaign=au-web-banner-mh-web-soap-voice-cleaner&utm_id=au-web-banner",
68+
},
69+
},
70+
aceStudio2: {
71+
type: "banner",
72+
isActive: false,
73+
priority: 50,
74+
osTargets: ["Windows"],
75+
message:
76+
"ACE Studio 2.0 is here! The all-in-one workstation for AI voices, instruments and generative tools",
77+
styles: {
78+
container: "bg-yellow-300",
79+
message: "text-gray-900 font-bold",
80+
button:
81+
"font-bold border-2 border-gray-900 bg-gray-900 text-white hover:bg-yellow-300 hover:text-gray-900 hover:border-gray-900",
82+
},
83+
tracking: {
84+
category: "Promo CTA",
85+
action: "Promo CTA button",
86+
name: "ACE Studio 2.0 MuseHub",
87+
},
88+
cta: {
89+
text: "Get it on MuseHub",
90+
link: "https://www.musehub.com/app/ace-studio?utm_source=au-web-banner-mh-web&utm_medium=ace-studio-2&utm_campaign=au-web-banner-mh-web-ace-studio-2&utm_id=au-web-banner",
91+
},
92+
},
93+
soapTranscriber: {
94+
type: "banner",
95+
isActive: false,
96+
priority: 50,
97+
osTargets: ["Windows", "OS X"],
98+
message:
99+
"SOAP Transcriber: One click voice to text. Clean and instant transcripts. Made for Audacity.",
100+
styles: {
101+
container: "bg-yellow-300",
102+
message: "text-gray-900 font-bold",
103+
button:
104+
"font-bold border-2 border-gray-900 bg-gray-900 text-white hover:bg-yellow-300 hover:text-gray-900 hover:border-gray-900",
105+
},
106+
tracking: {
107+
category: "Promo CTA",
108+
action: "Promo CTA button",
109+
name: "SOAP Transcriber MuseHub",
110+
},
111+
cta: {
112+
text: "Get it on MuseHub",
113+
link: "https://www.musehub.com/plugin/soap-transcriber?utm_source=au-web-banner-mh-web&utm_medium=soap-transcriber&utm_campaign=au-web-banner-mh-web-soap-transcriber&utm_id=au-web-banner",
114+
},
115+
},
116+
overtuneBanner: {
117+
type: "banner",
118+
isActive: true,
119+
priority: 50,
120+
osTargets: ["Windows", "OS X"],
121+
message:
122+
"Overtune: The beat maker for rappers and singers. Sing, polish, and share.",
123+
styles: {
124+
container: "bg-yellow-300",
125+
message: "text-gray-900 font-bold",
126+
button:
127+
"font-bold border-2 border-gray-900 bg-gray-900 text-white hover:bg-yellow-300 hover:text-gray-900 hover:border-gray-900",
128+
},
129+
tracking: {
130+
category: "Promo CTA",
131+
action: "Promo CTA button",
132+
name: "Overtune MuseHub",
133+
},
134+
cta: {
135+
text: "Get it on MuseHub",
136+
link: "https://www.musehub.com/app/overtune-studio?utm_source=au-web-banner-mh-web&utm_medium=overtune-2&utm_campaign=au-web-banner-mh-web-overtune-2r&utm_id=au-web-banner",
137+
},
138+
},
139+
ampknob: {
140+
type: "banner",
141+
isActive: false,
142+
priority: 50,
143+
osTargets: ["Windows", "OS X"],
144+
message: "Heavy guitar tone in seconds. One knob, no distractions.",
145+
styles: {
146+
container: "bg-yellow-300",
147+
message: "text-gray-900 font-bold",
148+
button:
149+
"font-bold border-2 border-gray-900 bg-gray-900 text-white hover:bg-yellow-300 hover:text-gray-900 hover:border-gray-900",
150+
},
151+
tracking: {
152+
category: "Promo CTA",
153+
action: "Promo CTA button",
154+
name: "Ampknob Revc MuseHub",
155+
},
156+
cta: {
157+
text: "Try for free",
158+
link: "https://www.musehub.com/plugin/ampknob-revc?utm_source=audacity&utm_medium=web&utm_campaign=auampknob-revc",
159+
},
160+
},
161+
survey: {
162+
type: "banner",
163+
isActive: false,
164+
priority: 50,
165+
message: "3 minute survey:\nHelp us understand what features you want next",
166+
styles: {
167+
container: "bg-yellow-300",
168+
message: "text-lg text-gray-900",
169+
button:
170+
"h-10 bg-gray-100 hover:bg-white border border-gray-900 text-gray-900",
171+
},
172+
tracking: {
173+
category: "Promo CTA",
174+
action: "Survey CTA button",
175+
name: "Go to Survey",
176+
},
177+
cta: {
178+
text: "Take the survey",
179+
link: "https://docs.google.com/forms/d/e/1FAIpQLScxH_f64JPCWt5nwqa8MTPXfmi453mqYwy1xZFPF_mx9mYkNw/viewform",
180+
},
181+
},
182+
};

src/assets/data/promos/popups.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import type { PromoData } from "./types";
2+
import audioComPromoImage from "../../img/promo/audacity-audiocom-promo.png";
3+
4+
const AUDIO_COM_EXIT_POPUP_IMAGE_SRC =
5+
typeof audioComPromoImage === "string"
6+
? audioComPromoImage
7+
: audioComPromoImage.src;
8+
9+
export const popupPromos: Record<string, PromoData> = {
10+
audioComExitPopup: {
11+
type: "exit-popup",
12+
isActive: true,
13+
priority: 50,
14+
message:
15+
"Use Audio.com to back up your projects, and share them from anywhere!",
16+
cta: {
17+
text: "Join Audio.com",
18+
link: "https://audio.com/audacity/auth/sign-in?mtm_campaign=audacityteamorg&mtm_content=exit-intent-popup",
19+
},
20+
popupOptions: {
21+
title: "Leave before setting up cloud storage?",
22+
routeAllowlist: [],
23+
displayMode: "modal",
24+
promoImageSrc: AUDIO_COM_EXIT_POPUP_IMAGE_SRC,
25+
promoImageAlt: "Audio.com promotion",
26+
dismissText: "Leave site",
27+
policy: {
28+
minDwellMs: 3000,
29+
},
30+
impressionTracking: {
31+
category: "Exit Intent",
32+
action: "exit_intent_impression",
33+
name: "audio.com Exit Intent Popup",
34+
},
35+
dismissTracking: {
36+
category: "Exit Intent",
37+
action: "exit_intent_dismiss",
38+
name: "audio.com Exit Intent Popup",
39+
},
40+
},
41+
tracking: {
42+
category: "Exit Intent",
43+
action: "exit_intent_cta_click",
44+
name: "audio.com Exit Intent Popup",
45+
},
46+
},
47+
};

src/assets/data/promos/types.ts

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
export type PromoType = "banner" | "video" | "exit-popup";
2+
3+
export type ExitPopupPolicy = {
4+
sessionCap?: number;
5+
dismissCooldownDays?: number;
6+
minDwellMs?: number;
7+
};
8+
9+
export type ExitPopupOptions = {
10+
routeAllowlist: string[];
11+
displayMode?: "toast" | "modal";
12+
promoImageSrc?: string;
13+
promoImageAlt?: string;
14+
title: string;
15+
body?: string;
16+
dismissText: string;
17+
policy?: ExitPopupPolicy;
18+
impressionTracking?: TrackingConfig;
19+
dismissTracking?: TrackingConfig;
20+
};
21+
22+
export type TrackingConfig = {
23+
category: string;
24+
action: string;
25+
name: string;
26+
};
27+
28+
export type PromoData = {
29+
type: PromoType;
30+
isActive?: boolean;
31+
priority?: number;
32+
slot?: number;
33+
osTargets?: string[];
34+
suppressOnPaths?: string[];
35+
message: string;
36+
styles?: {
37+
container?: string;
38+
message?: string;
39+
button?: string;
40+
};
41+
tracking?: TrackingConfig;
42+
cta?: {
43+
text: string;
44+
link: string;
45+
};
46+
popupOptions?: ExitPopupOptions;
47+
// Video-specific properties
48+
video?: {
49+
placeholderImage: string;
50+
imageAltText: string;
51+
videoURL: string;
52+
};
53+
};
54+
55+
export type FilterOptions = {
56+
type?: PromoType;
57+
os?: string | null;
58+
path?: string | null;
59+
};
60+
61+
const routeMatchesAllowlist = (path: string, allowlist: string[]) =>
62+
allowlist.some((route) => path === route || path.startsWith(`${route}/`));
63+
64+
/** Get all promos matching the filter criteria */
65+
export const getFilteredPromos = (
66+
promos: PromoData[],
67+
options: FilterOptions = {},
68+
): PromoData[] => {
69+
const { type, os, path } = options;
70+
71+
return promos.filter((promo) => {
72+
// Check if active
73+
if (promo.isActive === false) return false;
74+
75+
// Check type match
76+
if (type && promo.type !== type) return false;
77+
78+
if (path && promo.type === "exit-popup") {
79+
const allowlist = promo.popupOptions?.routeAllowlist ?? [];
80+
if (allowlist.length > 0 && !routeMatchesAllowlist(path, allowlist))
81+
return false;
82+
}
83+
84+
// Check path suppression
85+
if (path && promo.suppressOnPaths?.includes(path)) return false;
86+
87+
// Check OS targeting
88+
if (promo.osTargets && promo.osTargets.length > 0) {
89+
if (!os || !promo.osTargets.includes(os)) return false;
90+
}
91+
92+
return true;
93+
});
94+
};

0 commit comments

Comments
 (0)