Skip to content

Commit

Permalink
Add 2024 Thank You Banners
Browse files Browse the repository at this point in the history
  • Loading branch information
Abban committed Dec 11, 2024
1 parent d475609 commit a2be3c5
Show file tree
Hide file tree
Showing 31 changed files with 1,148 additions and 56 deletions.
35 changes: 35 additions & 0 deletions banners/thank_you_2024/MembershipFormActions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* eslint-disable camelcase */
import { TrackingParameters } from '@src/domain/TrackingParameters';
import { ImpressionCount } from '@src/utils/ImpressionCount';
import { Locales } from '@src/domain/Locales';

const MEMBERSHIP_FORM_URL = 'https://spenden.wikimedia.de/apply-for-membership';

export interface MembershipFormActions {
create( extraUrlParameters: Record<string, string> ): string;
}

export class TrackingMembershipFormActions implements MembershipFormActions {
private _tracking: TrackingParameters;
private _impressionCount: ImpressionCount;
private readonly _locale: Locales;

public constructor( tracking: TrackingParameters, impressionCount: ImpressionCount, locale: Locales ) {
this._tracking = tracking;
this._impressionCount = impressionCount;
this._locale = locale;
}

public create( extraUrlParameters: Record<string, string> = {} ): string {
const urlParameters = new URLSearchParams( {
piwik_kwd: this._tracking.keyword,
piwik_campaign: this._tracking.campaign,
impCount: String( this._impressionCount.overallCountIncremented ),
bImpCount: String( this._impressionCount.bannerCountIncremented ),
locale: this._locale,
...extraUrlParameters
} );

return `${MEMBERSHIP_FORM_URL}?${urlParameters}`;
}
}
54 changes: 54 additions & 0 deletions banners/thank_you_2024/banner_ctrl.de.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { createVueApp } from '@src/createVueApp';

import './styles/styles.scss';

import PageWPORG from '@src/page/PageWPORG';
import { SkinFactory } from '@src/page/skin/SkinFactory';
import { WindowSizeIssueChecker } from '@src/utils/SizeIssueChecker/WindowSizeIssueChecker';
import { Translator } from '@src/Translator';
import { WindowMediaWiki } from '@src/page/MediaWiki/WindowMediaWiki';
import { UrlRuntimeEnvironment } from '@src/utils/RuntimeEnvironment';
import { LocalImpressionCount } from '@src/utils/LocalImpressionCount';
import { LegacyTrackerWPORG } from '@src/tracking/LegacyTrackerWPORG';
import BannerConductor from '@src/components/BannerConductor/BannerConductor.vue';
import { WindowResizeHandler } from '@src/utils/ResizeHandler';
import Banner from './components/BannerCtrl.de.vue';
import messages from './messages.de';
import eventMappings from './event_map';
import TranslationPlugin from '@src/TranslationPlugin';
import { TrackingMembershipFormActions } from './MembershipFormActions';
import { createTrackedURL, SUBSCRIBE_URL, USE_OF_FUNDS_URL } from './createTrackedURL';
import { createThankYouSettings } from './settings';
import { IntegerDe } from '@src/utils/DynamicContent/formatters/IntegerDe';
import { Locales } from '@src/domain/Locales';
import { WindowTimer } from '@src/utils/Timer';

const translator = new Translator( messages );
const mediaWiki = new WindowMediaWiki();
const page = new PageWPORG( mediaWiki, ( new SkinFactory( mediaWiki ) ).getSkin(), new WindowSizeIssueChecker( 0 ) );
const runtimeEnvironment = new UrlRuntimeEnvironment( window.location );
const impressionCount = new LocalImpressionCount( page.getTracking().keyword, runtimeEnvironment );
const tracker = new LegacyTrackerWPORG( mediaWiki, page.getTracking().keyword, eventMappings, runtimeEnvironment );

const app = createVueApp( BannerConductor, {
page,
bannerConfig: {
delay: 0,
transitionDuration: 0
},
bannerProps: {
settings: createThankYouSettings( new IntegerDe(), page.getCampaignParameters().thankYouCampaign ),
subscribeURL: createTrackedURL( SUBSCRIBE_URL, page.getTracking(), impressionCount, Locales.DE ),
useOfFundsURL: createTrackedURL( USE_OF_FUNDS_URL, page.getTracking(), impressionCount, Locales.DE )
},
resizeHandler: new WindowResizeHandler(),
banner: Banner,
impressionCount
} );

app.use( TranslationPlugin, translator );
app.provide( 'tracker', tracker );
app.provide( 'formActions', new TrackingMembershipFormActions( page.getTracking(), impressionCount, Locales.DE ) );
app.provide( 'timer', new WindowTimer() );

app.mount( page.getBannerContainer() );
54 changes: 54 additions & 0 deletions banners/thank_you_2024/banner_ctrl.en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { createVueApp } from '@src/createVueApp';

import './styles/styles.scss';

import PageWPORG from '@src/page/PageWPORG';
import { SkinFactory } from '@src/page/skin/SkinFactory';
import { WindowSizeIssueChecker } from '@src/utils/SizeIssueChecker/WindowSizeIssueChecker';
import { Translator } from '@src/Translator';
import { WindowMediaWiki } from '@src/page/MediaWiki/WindowMediaWiki';
import { UrlRuntimeEnvironment } from '@src/utils/RuntimeEnvironment';
import { LocalImpressionCount } from '@src/utils/LocalImpressionCount';
import { LegacyTrackerWPORG } from '@src/tracking/LegacyTrackerWPORG';
import BannerConductor from '@src/components/BannerConductor/BannerConductor.vue';
import { WindowResizeHandler } from '@src/utils/ResizeHandler';
import Banner from './components/BannerCtrl.en.vue';
import messages from './messages.en';
import eventMappings from './event_map';
import TranslationPlugin from '@src/TranslationPlugin';
import { TrackingMembershipFormActions } from './MembershipFormActions';
import { createTrackedURL, SUBSCRIBE_URL, USE_OF_FUNDS_URL } from './createTrackedURL';
import { createThankYouSettings } from './settings';
import { IntegerEn } from '@src/utils/DynamicContent/formatters/IntegerEn';
import { Locales } from '@src/domain/Locales';
import { WindowTimer } from '@src/utils/Timer';

const translator = new Translator( messages );
const mediaWiki = new WindowMediaWiki();
const page = new PageWPORG( mediaWiki, ( new SkinFactory( mediaWiki ) ).getSkin(), new WindowSizeIssueChecker( 0 ) );
const runtimeEnvironment = new UrlRuntimeEnvironment( window.location );
const impressionCount = new LocalImpressionCount( page.getTracking().keyword, runtimeEnvironment );
const tracker = new LegacyTrackerWPORG( mediaWiki, page.getTracking().keyword, eventMappings, runtimeEnvironment );

const app = createVueApp( BannerConductor, {
page,
bannerConfig: {
delay: 0,
transitionDuration: 0
},
bannerProps: {
settings: createThankYouSettings( new IntegerEn(), page.getCampaignParameters().thankYouCampaign ),
subscribeURL: createTrackedURL( SUBSCRIBE_URL, page.getTracking(), impressionCount, Locales.EN ),
useOfFundsURL: createTrackedURL( USE_OF_FUNDS_URL, page.getTracking(), impressionCount, Locales.EN )
},
resizeHandler: new WindowResizeHandler(),
banner: Banner,
impressionCount
} );

app.use( TranslationPlugin, translator );
app.provide( 'tracker', tracker );
app.provide( 'formActions', new TrackingMembershipFormActions( page.getTracking(), impressionCount, Locales.EN ) );
app.provide( 'timer', new WindowTimer() );

app.mount( page.getBannerContainer() );
56 changes: 56 additions & 0 deletions banners/thank_you_2024/banner_ctrl.wpde.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { createVueApp } from '@src/createVueApp';

import './styles/styles.scss';
import { Translator } from '@src/Translator';
import { UrlRuntimeEnvironment } from '@src/utils/RuntimeEnvironment';
import { LocalImpressionCount } from '@src/utils/LocalImpressionCount';
import BannerConductor from '@src/components/BannerConductor/BannerConductor.vue';
import { WindowResizeHandler } from '@src/utils/ResizeHandler';
import Banner from './components/BannerCtrl.de.vue';
import messages from './messages.de';
import TranslationPlugin from '@src/TranslationPlugin';
import { TrackingMembershipFormActions } from './MembershipFormActions';
import { createTrackedURL, SUBSCRIBE_URL, USE_OF_FUNDS_URL } from './createTrackedURL';
import PageWPDE from '@src/page/PageWPDE';
import { TrackerWPDE } from '@src/tracking/TrackerWPDE';
import eventMap from './event_map.wpde';
import { createThankYouSettings } from './settings';
import { IntegerDe } from '@src/utils/DynamicContent/formatters/IntegerDe';
import { Locales } from '@src/domain/Locales';
import { WindowTimer } from '@src/utils/Timer';

// Tracking placeholders will be replaced by webpack string-replace-loader
// using the campaign configuration ( campaign_info.toml ) for the correct values
const tracking = {
campaign: '!insert-campaign-here!',
keyword: '!insert-keyword-here!'
};

const translator = new Translator( messages );
const page = new PageWPDE( tracking );
const runtimeEnvironment = new UrlRuntimeEnvironment( window.location );
const impressionCount = new LocalImpressionCount( page.getTracking().keyword, runtimeEnvironment );
const tracker = new TrackerWPDE( 'FundraisingTracker', page.getTracking().keyword, eventMap, runtimeEnvironment );

const app = createVueApp( BannerConductor, {
page,
bannerConfig: {
delay: 0,
transitionDuration: 0
},
bannerProps: {
settings: createThankYouSettings( new IntegerDe(), page.getCampaignParameters().thankYouCampaign ),
subscribeURL: createTrackedURL( SUBSCRIBE_URL, page.getTracking(), impressionCount, Locales.DE ),
useOfFundsURL: createTrackedURL( USE_OF_FUNDS_URL, page.getTracking(), impressionCount, Locales.DE )
},
resizeHandler: new WindowResizeHandler(),
banner: Banner,
impressionCount
} );

app.use( TranslationPlugin, translator );
app.provide( 'tracker', tracker );
app.provide( 'formActions', new TrackingMembershipFormActions( page.getTracking(), impressionCount, Locales.DE ) );
app.provide( 'timer', new WindowTimer() );

app.mount( page.getBannerContainer() );
54 changes: 54 additions & 0 deletions banners/thank_you_2024/banner_var.de.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { createVueApp } from '@src/createVueApp';

import './styles/styles.scss';

import PageWPORG from '@src/page/PageWPORG';
import { SkinFactory } from '@src/page/skin/SkinFactory';
import { WindowSizeIssueChecker } from '@src/utils/SizeIssueChecker/WindowSizeIssueChecker';
import { Translator } from '@src/Translator';
import { WindowMediaWiki } from '@src/page/MediaWiki/WindowMediaWiki';
import { UrlRuntimeEnvironment } from '@src/utils/RuntimeEnvironment';
import { LocalImpressionCount } from '@src/utils/LocalImpressionCount';
import { LegacyTrackerWPORG } from '@src/tracking/LegacyTrackerWPORG';
import BannerConductor from '@src/components/BannerConductor/BannerConductor.vue';
import { WindowResizeHandler } from '@src/utils/ResizeHandler';
import Banner from './components/BannerVar.de.vue';
import messages from './messages.de';
import eventMappings from './event_map';
import TranslationPlugin from '@src/TranslationPlugin';
import { TrackingMembershipFormActions } from './MembershipFormActions';
import { createTrackedURL, SUBSCRIBE_URL, USE_OF_FUNDS_URL } from './createTrackedURL';
import { createThankYouSettings } from './settings';
import { IntegerDe } from '@src/utils/DynamicContent/formatters/IntegerDe';
import { Locales } from '@src/domain/Locales';
import { WindowTimer } from '@src/utils/Timer';

const translator = new Translator( messages );
const mediaWiki = new WindowMediaWiki();
const page = new PageWPORG( mediaWiki, ( new SkinFactory( mediaWiki ) ).getSkin(), new WindowSizeIssueChecker( 0 ) );
const runtimeEnvironment = new UrlRuntimeEnvironment( window.location );
const impressionCount = new LocalImpressionCount( page.getTracking().keyword, runtimeEnvironment );
const tracker = new LegacyTrackerWPORG( mediaWiki, page.getTracking().keyword, eventMappings, runtimeEnvironment );

const app = createVueApp( BannerConductor, {
page,
bannerConfig: {
delay: 0,
transitionDuration: 0
},
bannerProps: {
settings: createThankYouSettings( new IntegerDe(), page.getCampaignParameters().thankYouCampaign ),
subscribeURL: createTrackedURL( SUBSCRIBE_URL, page.getTracking(), impressionCount, Locales.DE ),
useOfFundsURL: createTrackedURL( USE_OF_FUNDS_URL, page.getTracking(), impressionCount, Locales.DE )
},
resizeHandler: new WindowResizeHandler(),
banner: Banner,
impressionCount
} );

app.use( TranslationPlugin, translator );
app.provide( 'tracker', tracker );
app.provide( 'formActions', new TrackingMembershipFormActions( page.getTracking(), impressionCount, Locales.DE ) );
app.provide( 'timer', new WindowTimer() );

app.mount( page.getBannerContainer() );
54 changes: 54 additions & 0 deletions banners/thank_you_2024/banner_var.en.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { createVueApp } from '@src/createVueApp';

import './styles/styles.scss';

import PageWPORG from '@src/page/PageWPORG';
import { SkinFactory } from '@src/page/skin/SkinFactory';
import { WindowSizeIssueChecker } from '@src/utils/SizeIssueChecker/WindowSizeIssueChecker';
import { Translator } from '@src/Translator';
import { WindowMediaWiki } from '@src/page/MediaWiki/WindowMediaWiki';
import { UrlRuntimeEnvironment } from '@src/utils/RuntimeEnvironment';
import { LocalImpressionCount } from '@src/utils/LocalImpressionCount';
import { LegacyTrackerWPORG } from '@src/tracking/LegacyTrackerWPORG';
import BannerConductor from '@src/components/BannerConductor/BannerConductor.vue';
import { WindowResizeHandler } from '@src/utils/ResizeHandler';
import Banner from './components/BannerVar.en.vue';
import messages from './messages.en';
import eventMappings from './event_map';
import TranslationPlugin from '@src/TranslationPlugin';
import { TrackingMembershipFormActions } from './MembershipFormActions';
import { createTrackedURL, SUBSCRIBE_URL, USE_OF_FUNDS_URL } from './createTrackedURL';
import { createThankYouSettings } from './settings';
import { IntegerEn } from '@src/utils/DynamicContent/formatters/IntegerEn';
import { Locales } from '@src/domain/Locales';
import { WindowTimer } from '@src/utils/Timer';

const translator = new Translator( messages );
const mediaWiki = new WindowMediaWiki();
const page = new PageWPORG( mediaWiki, ( new SkinFactory( mediaWiki ) ).getSkin(), new WindowSizeIssueChecker( 0 ) );
const runtimeEnvironment = new UrlRuntimeEnvironment( window.location );
const impressionCount = new LocalImpressionCount( page.getTracking().keyword, runtimeEnvironment );
const tracker = new LegacyTrackerWPORG( mediaWiki, page.getTracking().keyword, eventMappings, runtimeEnvironment );

const app = createVueApp( BannerConductor, {
page,
bannerConfig: {
delay: 0,
transitionDuration: 0
},
bannerProps: {
settings: createThankYouSettings( new IntegerEn(), page.getCampaignParameters().thankYouCampaign ),
subscribeURL: createTrackedURL( SUBSCRIBE_URL, page.getTracking(), impressionCount, Locales.EN ),
useOfFundsURL: createTrackedURL( USE_OF_FUNDS_URL, page.getTracking(), impressionCount, Locales.EN )
},
resizeHandler: new WindowResizeHandler(),
banner: Banner,
impressionCount
} );

app.use( TranslationPlugin, translator );
app.provide( 'tracker', tracker );
app.provide( 'formActions', new TrackingMembershipFormActions( page.getTracking(), impressionCount, Locales.EN ) );
app.provide( 'timer', new WindowTimer() );

app.mount( page.getBannerContainer() );
56 changes: 56 additions & 0 deletions banners/thank_you_2024/banner_var.wpde.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { createVueApp } from '@src/createVueApp';

import './styles/styles.scss';
import { Translator } from '@src/Translator';
import { UrlRuntimeEnvironment } from '@src/utils/RuntimeEnvironment';
import { LocalImpressionCount } from '@src/utils/LocalImpressionCount';
import BannerConductor from '@src/components/BannerConductor/BannerConductor.vue';
import { WindowResizeHandler } from '@src/utils/ResizeHandler';
import Banner from './components/BannerVar.de.vue';
import messages from './messages.de';
import TranslationPlugin from '@src/TranslationPlugin';
import { TrackingMembershipFormActions } from './MembershipFormActions';
import { createTrackedURL, SUBSCRIBE_URL, USE_OF_FUNDS_URL } from './createTrackedURL';
import PageWPDE from '@src/page/PageWPDE';
import { TrackerWPDE } from '@src/tracking/TrackerWPDE';
import eventMap from './event_map.wpde';
import { createThankYouSettings } from './settings';
import { IntegerDe } from '@src/utils/DynamicContent/formatters/IntegerDe';
import { Locales } from '@src/domain/Locales';
import { WindowTimer } from '@src/utils/Timer';

// Tracking placeholders will be replaced by webpack string-replace-loader
// using the campaign configuration ( campaign_info.toml ) for the correct values
const tracking = {
campaign: '!insert-campaign-here!',
keyword: '!insert-keyword-here!'
};

const translator = new Translator( messages );
const page = new PageWPDE( tracking );
const runtimeEnvironment = new UrlRuntimeEnvironment( window.location );
const impressionCount = new LocalImpressionCount( page.getTracking().keyword, runtimeEnvironment );
const tracker = new TrackerWPDE( 'FundraisingTracker', page.getTracking().keyword, eventMap, runtimeEnvironment );

const app = createVueApp( BannerConductor, {
page,
bannerConfig: {
delay: 0,
transitionDuration: 0
},
bannerProps: {
settings: createThankYouSettings( new IntegerDe(), page.getCampaignParameters().thankYouCampaign ),
subscribeURL: createTrackedURL( SUBSCRIBE_URL, page.getTracking(), impressionCount, Locales.DE ),
useOfFundsURL: createTrackedURL( USE_OF_FUNDS_URL, page.getTracking(), impressionCount, Locales.DE )
},
resizeHandler: new WindowResizeHandler(),
banner: Banner,
impressionCount
} );

app.use( TranslationPlugin, translator );
app.provide( 'tracker', tracker );
app.provide( 'formActions', new TrackingMembershipFormActions( page.getTracking(), impressionCount, Locales.DE ) );
app.provide( 'timer', new WindowTimer() );

app.mount( page.getBannerContainer() );
Loading

0 comments on commit a2be3c5

Please sign in to comment.