Skip to content

Commit

Permalink
Prepare VAR for C24_WMDE_Desktop_DE_22
Browse files Browse the repository at this point in the history
  • Loading branch information
Sperling-0 committed Dec 17, 2024
1 parent 7fada76 commit 72dd734
Show file tree
Hide file tree
Showing 5 changed files with 439 additions and 1 deletion.
2 changes: 1 addition & 1 deletion banners/desktop/C24_WMDE_Desktop_DE_22/banner_var.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { createVueApp } from '@src/createVueApp';
import './styles/styles.scss';

import BannerConductor from '@src/components/BannerConductor/FallbackBannerConductor.vue';
import Banner from './components/BannerCtrl.vue';
import Banner from './components/BannerVar.vue';
import FallbackBanner from './components/FallbackBanner.vue';
import { UrlRuntimeEnvironment } from '@src/utils/RuntimeEnvironment';
import { WindowResizeHandler } from '@src/utils/ResizeHandler';
Expand Down
180 changes: 180 additions & 0 deletions banners/desktop/C24_WMDE_Desktop_DE_22/components/BannerVar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
<template>
<div class="wmde-banner-wrapper" :class="contentState">
<MainBanner
@form-interaction="$emit( 'bannerContentChanged' )"
v-if="contentState === ContentStates.Main"
:bannerState="bannerState"
>
<template #close-button>
<ButtonClose @close="onCloseMain"/>
</template>

<template #banner-title>
<BannerTitle/>
</template>

<template #banner-text>
<BannerText/>
</template>

<template #banner-slides="{ play }: any">
<KeenSlider :with-navigation="true" :play="play" :interval="10000" :delay="2000" :navigation-color="'#ffffff'">

<template #slides="{ currentSlide }: any">
<BannerSlides :currentSlide="currentSlide"/>
</template>

</KeenSlider>
</template>

<template #progress>
<DoubleProgressBar/>
</template>

<template #donation-form="{ formInteraction }: any">
<MultiStepDonation
:step-controllers="stepControllers"
@form-interaction="formInteraction"
:submit-callback="onSubmit"
>

<template #[FormStepNames.MainDonationFormStep]="{ pageIndex, submit, isCurrent, previous }: any">
<MainDonationForm :page-index="pageIndex" @submit="submit" :is-current="isCurrent" @previous="previous"/>
</template>

<template #[FormStepNames.UpgradeToYearlyFormStep]="{ pageIndex, submit, isCurrent, previous }: any">
<UpgradeToYearlyButtonForm :page-index="pageIndex" :show-manual-upgrade-option="false" @submit="submit" :is-current="isCurrent" @previous="previous"/>
</template>

</MultiStepDonation>
</template>

<template #footer>
<FooterAlreadyDonated
@showFundsModal="onModalOpened"
@clickedAlreadyDonatedLink="onClose( 'AlreadyDonated', CloseChoices.AlreadyDonated )"
/>
</template>

</MainBanner>

<SoftClose
v-if="contentState === ContentStates.SoftClosing"
:show-close-icon="true"
@close="() => onClose( 'SoftClose', CloseChoices.Close )"
@maybeLater="() => onClose( 'SoftClose', CloseChoices.MaybeLater )"
@timeOutClose="() => onClose( 'SoftClose', CloseChoices.TimeOut )"
@maybeLater7Days="() => onClose('SoftClose', CloseChoices.Close)"
/>

<FundsModal
:content="useOfFundsContent"
:is-funds-modal-visible="isFundsModalVisible"
@hideFundsModal="onHideFundsModal"
>
<template #infographic>
<WMDEFundsForwardingDE/>
</template>
</FundsModal>
</div>
</template>

<script setup lang="ts">
import { BannerStates } from '@src/components/BannerConductor/StateMachine/BannerStates';
import { inject, ref, watch } from 'vue';
import { UseOfFundsContent as useOfFundsContentInterface } from '@src/domain/UseOfFunds/UseOfFundsContent';
import MainBanner from './MainBanner.vue';
import FundsModal from '@src/components/UseOfFunds/FundsModal.vue';
import BannerText from '../content/BannerTextVar.vue';
import BannerSlides from '../content/BannerSlidesVar.vue';
import MultiStepDonation from '@src/components/DonationForm/MultiStepDonation.vue';
import MainDonationForm from '@src/components/DonationForm/Forms/MainDonationForm.vue';
import UpgradeToYearlyButtonForm from '@src/components/DonationForm/Forms/UpgradeToYearlyButtonForm.vue';
import KeenSlider from '@src/components/Slider/KeenSlider.vue';
import { useFormModel } from '@src/components/composables/useFormModel';
import {
createSubmittableMainDonationForm
} from '@src/components/DonationForm/StepControllers/SubmittableMainDonationForm';
import {
createSubmittableUpgradeToYearly
} from '@src/components/DonationForm/StepControllers/SubmittableUpgradeToYearly';
import { CloseChoices } from '@src/domain/CloseChoices';
import { CloseEvent } from '@src/tracking/events/CloseEvent';
import { TrackingFeatureName } from '@src/tracking/TrackingEvent';
import ButtonClose from '@src/components/ButtonClose/ButtonClose.vue';
import FooterAlreadyDonated from '@src/components/Footer/FooterAlreadyDonated.vue';
import WMDEFundsForwardingDE from '@src/components/UseOfFunds/Infographics/WMDEFundsForwardingDE.vue';
import DoubleProgressBar from '@src/components/ProgressBar/DoubleProgressBar.vue';
import SoftClose from '@src/components/SoftClose/SoftClose.vue';
import { LocalCloseTracker } from '@src/utils/LocalCloseTracker';
import { BannerSubmitOnReturnEvent } from '@src/tracking/events/BannerSubmitOnReturnEvent';
import { Tracker } from '@src/tracking/Tracker';
import { useBannerHider } from '@src/components/composables/useBannerHider';
import BannerTitle from '@banners/desktop/C24_WMDE_Desktop_DE_15/content/BannerTitle.vue';
enum ContentStates {
Main = 'wmde-banner-wrapper--main',
SoftClosing = 'wmde-banner-wrapper--soft-closing',
}
enum FormStepNames {
MainDonationFormStep = 'MainDonationForm',
UpgradeToYearlyFormStep = 'UpgradeToYearlyForm'
}
interface Props {
bannerState: BannerStates;
useOfFundsContent: useOfFundsContentInterface;
remainingImpressions: number;
localCloseTracker: LocalCloseTracker;
}
const props = defineProps<Props>();
const emit = defineEmits( [ 'bannerClosed', 'bannerContentChanged', 'modalOpened', 'modalClosed' ] );
useBannerHider( 800, emit );
const tracker = inject<Tracker>( 'tracker' );
const isFundsModalVisible = ref<boolean>( false );
const contentState = ref<ContentStates>( ContentStates.Main );
const formModel = useFormModel();
const stepControllers = [
createSubmittableMainDonationForm( formModel, FormStepNames.UpgradeToYearlyFormStep ),
createSubmittableUpgradeToYearly( formModel, FormStepNames.MainDonationFormStep, FormStepNames.MainDonationFormStep )
];
watch( contentState, async () => {
emit( 'bannerContentChanged' );
} );
const onSubmit = (): void => {
// special callback function: asking for previous close choices
const closeChoice = props.localCloseTracker.getItem();
if ( closeChoice !== '' ) {
tracker.trackEvent( new BannerSubmitOnReturnEvent( closeChoice ) );
}
};
function onCloseMain(): void {
if ( props.remainingImpressions > 0 ) {
contentState.value = ContentStates.SoftClosing;
} else {
onClose( 'MainBanner', CloseChoices.Close );
}
}
function onClose( feature: TrackingFeatureName, userChoice: CloseChoices ): void {
emit( 'bannerClosed', new CloseEvent( feature, userChoice ) );
}
function onHideFundsModal(): void {
isFundsModalVisible.value = false;
emit( 'modalClosed' );
}
function onModalOpened(): void {
isFundsModalVisible.value = true;
emit( 'modalOpened' );
}
</script>
48 changes: 48 additions & 0 deletions banners/desktop/C24_WMDE_Desktop_DE_22/content/BannerSlidesVar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<template>
<KeenSliderSlide :is-current="currentSlide === 0">
<p>
Vielleicht kommen wir gerade ungelegen, aber dennoch: Klicken Sie jetzt bitte nicht weg! Am heutigen
{{ currentDayName }}, den {{ currentDate }}, bitten wir Sie, die Unabhängigkeit von Wikipedia zu unterstützen.
</p>
</KeenSliderSlide>
<KeenSliderSlide :is-current="currentSlide === 1">
<p>
{{campaignDaySentence}}
<AnimatedText :content="visitorsVsDonorsSentence"/>
Die meisten Menschen spenden, weil sie Wikipedia nützlich finden.
</p>
</KeenSliderSlide>
<KeenSliderSlide :is-current="currentSlide === 2">
<p>
Die durchschnittliche Spende beträgt {{ averageDonation }}, doch bereits 5&nbsp;€ helfen uns weiter. Hat Wikipedia
Ihnen in diesem Jahr Wissen im Wert einer Tasse Kaffee geschenkt?
</p>
</KeenSliderSlide>
<KeenSliderSlide :is-current="currentSlide === 3">
<p>
Dann entscheiden Sie sich, eine der seltenen Ausnahmen zu sein, und geben Sie etwas zurück. Vielen Dank!
</p>
</KeenSliderSlide>
</template>

<script setup lang="ts">
import { DynamicContent } from '@src/utils/DynamicContent/DynamicContent';
import { inject } from 'vue';
import KeenSliderSlide from '@src/components/Slider/KeenSliderSlide.vue';
import AnimatedText from '@src/components/AnimatedText/AnimatedText.vue';
interface Props {
currentSlide: number
}
defineProps<Props>();
const {
currentDayName,
currentDate,
campaignDaySentence,
visitorsVsDonorsSentence,
averageDonation
} = inject<DynamicContent>( 'dynamicCampaignText' );
</script>
32 changes: 32 additions & 0 deletions banners/desktop/C24_WMDE_Desktop_DE_22/content/BannerTextVar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<div class="wmde-banner-message">
<div>
<p>
Vielleicht kommen wir gerade ungelegen, aber dennoch: Klicken Sie jetzt bitte nicht weg! Am heutigen
{{ currentDayName }}, den {{ currentDate }}, bitten wir Sie, die Unabhängigkeit von Wikipedia zu unterstützen.
{{campaignDaySentence}}
<AnimatedText :content="visitorsVsDonorsSentence"/>
Die meisten Menschen spenden, weil sie Wikipedia nützlich finden.
Die durchschnittliche Spende beträgt {{ averageDonation }}, doch bereits 5&nbsp;€ helfen uns weiter.
Hat Wikipedia Ihnen in diesem Jahr Wissen im Wert einer Tasse Kaffee geschenkt?
Dann entscheiden Sie sich, eine der seltenen Ausnahmen zu sein, und geben Sie etwas zurück.
Vielen Dank!
</p>
</div>
</div>
</template>

<script setup lang="ts">
import { inject } from 'vue';
import { DynamicContent } from '@src/utils/DynamicContent/DynamicContent';
import AnimatedText from '@src/components/AnimatedText/AnimatedText.vue';
const {
currentDayName,
currentDate,
campaignDaySentence,
visitorsVsDonorsSentence,
averageDonation
} = inject<DynamicContent>( 'dynamicCampaignText' );
</script>
Loading

0 comments on commit 72dd734

Please sign in to comment.