-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare VAR for C24_WMDE_Mobile_DE_11
- Loading branch information
1 parent
d091010
commit 5590e59
Showing
33 changed files
with
1,973 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
253 changes: 253 additions & 0 deletions
253
banners/mobile/C24_WMDE_Mobile_DE_11/components/BannerVar.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,253 @@ | ||
<template> | ||
<div class="wmde-banner-wrapper" :class="contentState"> | ||
<MiniBanner | ||
@close="onCloseMiniBanner" | ||
@show-full-page-banner="onshowFullPageBanner" | ||
@show-full-page-banner-preselected="onshowFullPageBannerPreselected" | ||
> | ||
<template #banner-slides> | ||
<KeenSlider :with-navigation="false" :play="slideshowShouldPlay" :interval="5000"> | ||
|
||
<template #slides="{ currentSlide }: any"> | ||
<BannerSlides :currentSlide="currentSlide" :play-live-text="contentState === ContentStates.Mini"/> | ||
</template> | ||
|
||
</KeenSlider> | ||
</template> | ||
</MiniBanner> | ||
|
||
<FullPageBanner | ||
@showFundsModal="isFundsModalVisible = true" | ||
@close="() => onClose( 'FullPageBanner', CloseChoices.Hide )" | ||
> | ||
<template #banner-text> | ||
<BannerText :play-live-text="contentState === ContentStates.FullPage"/> | ||
</template> | ||
|
||
<template #progress> | ||
<ProgressBar amount-to-show-on-right="TARGET"/> | ||
</template> | ||
|
||
<template #donation-form="{ formInteraction }: any"> | ||
<MultiStepDonation | ||
:step-controllers="stepControllers" | ||
@form-interaction="formInteraction" | ||
:page-scroller="pageScroller" | ||
:submit-callback="onSubmit" | ||
> | ||
|
||
<template #[FormStepNames.MainDonationFormStep]="{ pageIndex, submit, isCurrent, previous }: any"> | ||
<MainDonationFormAdaptiveAmounts | ||
:page-index="pageIndex" | ||
@submit="submit" | ||
:is-current="isCurrent" | ||
@previous="previous" | ||
:amounts-for-form-items="amountOptionsForForm" | ||
> | ||
|
||
<template #button> | ||
<MainDonationFormButton/> | ||
</template> | ||
|
||
</MainDonationFormAdaptiveAmounts> | ||
</template> | ||
|
||
<template #[FormStepNames.UpgradeToYearlyFormStep]="{ pageIndex, submit, isCurrent, previous }: any"> | ||
<UpgradeToYearlyButtonForm | ||
:show-manual-upgrade-option = false | ||
:page-index="pageIndex" | ||
@submit="submit" | ||
:is-current="isCurrent" | ||
@previous="previous" | ||
> | ||
<template #back> | ||
<ChevronLeftIcon/> {{ $translate( 'back-button' ) }} | ||
</template> | ||
</UpgradeToYearlyButtonForm> | ||
</template> | ||
|
||
</MultiStepDonation> | ||
</template> | ||
|
||
<template #footer> | ||
<BannerFooter :show-funds-link="false"/> | ||
</template> | ||
</FullPageBanner> | ||
|
||
<SoftClose | ||
v-if="contentState === ContentStates.SoftClosing" | ||
:show-close-icon="true" | ||
@close="() => onClose( 'SoftClose', CloseChoices.Close )" | ||
@maybe-later="() => onClose( 'SoftClose', CloseChoices.MaybeLater )" | ||
@time-out-close="() => onClose( 'SoftClose', CloseChoices.TimeOut )" | ||
> | ||
<template #buttons="{ timer }: any"> | ||
<button | ||
class="wmde-banner-soft-close-button wmde-banner-soft-close-button-maybe-later" | ||
@click="() => onSoftCloseClose( timer, 'SoftClose', CloseChoices.MaybeLater )"> | ||
{{ $translate( 'soft-close-button-maybe-later' ) }} | ||
</button> | ||
<button | ||
class="wmde-banner-soft-close-button wmde-banner-soft-close-button-close" | ||
@click="() => onSoftCloseClose( timer, 'SoftClose', CloseChoices.Close )"> | ||
{{ $translate( 'soft-close-button-close' ) }} | ||
</button> | ||
<button | ||
class="wmde-banner-soft-close-button wmde-banner-soft-close-button-already-donated" | ||
@click="() => onSoftCloseClose( timer, 'SoftClose', CloseChoices.AlreadyDonated )"> | ||
{{ $translate( 'soft-close-button-already-donated' ) }} | ||
</button> | ||
</template> | ||
</SoftClose> | ||
|
||
<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 { computed, inject, ref, watch } from 'vue'; | ||
import FullPageBanner from './FullPageBannerVar.vue'; | ||
import MiniBanner from './MiniBanner.vue'; | ||
import FundsModal from '@src/components/UseOfFunds/FundsModal.vue'; | ||
import { UseOfFundsContent as useOfFundsContentInterface } from '@src/domain/UseOfFunds/UseOfFundsContent'; | ||
import { UseOfFundsCloseSources } from '@src/components/UseOfFunds/UseOfFundsCloseSources'; | ||
import { PageScroller } from '@src/utils/PageScroller/PageScroller'; | ||
import MainDonationFormAdaptiveAmounts from '@src/components/DonationForm/Forms/MainDonationFormAdaptiveAmounts.vue'; | ||
import MultiStepDonation from '@src/components/DonationForm/MultiStepDonation.vue'; | ||
import BannerText from '../content/BannerText.vue'; | ||
import BannerSlides from '../content/BannerSlides.vue'; | ||
import BannerFooter from '@src/components/Footer/BannerFooter.vue'; | ||
import KeenSlider from '@src/components/Slider/KeenSlider.vue'; | ||
import { Tracker } from '@src/tracking/Tracker'; | ||
import { MobileMiniBannerExpandedEvent } from '@src/tracking/events/MobileMiniBannerExpandedEvent'; | ||
import { useFormModel } from '@src/components/composables/useFormModel'; | ||
import UpgradeToYearlyButtonForm from '@src/components/DonationForm/Forms/UpgradeToYearlyButtonForm.vue'; | ||
import ChevronLeftIcon from '@src/components/Icons/ChevronLeftIcon.vue'; | ||
import { CloseChoices } from '@src/domain/CloseChoices'; | ||
import { CloseEvent } from '@src/tracking/events/CloseEvent'; | ||
import { TrackingFeatureName } from '@src/tracking/TrackingEvent'; | ||
import { | ||
createSubmittableMainDonationForm | ||
} from '@src/components/DonationForm/StepControllers/SubmittableMainDonationForm'; | ||
import { | ||
createSubmittableUpgradeToYearly | ||
} from '@src/components/DonationForm/StepControllers/SubmittableUpgradeToYearly'; | ||
import MainDonationFormButton from '@src/components/DonationForm/Forms/MainDonationFormButton.vue'; | ||
import WMDEFundsForwardingDE from '@src/components/UseOfFunds/Infographics/WMDEFundsForwardingDE.vue'; | ||
import ProgressBar from '@src/components/ProgressBar/ProgressBar.vue'; | ||
import { LocalCloseTracker } from '@src/utils/LocalCloseTracker'; | ||
import { BannerSubmitOnReturnEvent } from '@src/tracking/events/BannerSubmitOnReturnEvent'; | ||
import SoftClose from '@src/components/SoftClose/SoftClose.vue'; | ||
import { FormItem } from '@src/utils/FormItemsBuilder/FormItem'; | ||
import FormItemsBuilder from '@src/utils/FormItemsBuilder/FormItemsBuilder'; | ||
import { Translator } from '@src/Translator'; | ||
import { Currency } from '@src/utils/DynamicContent/formatters/Currency'; | ||
enum ContentStates { | ||
Mini = 'wmde-banner-wrapper--mini', | ||
FullPage = 'wmde-banner-wrapper--full-page', | ||
SoftClosing = 'wmde-banner-wrapper--soft-closing' | ||
} | ||
enum FormStepNames { | ||
MainDonationFormStep = 'MainDonationForm', | ||
UpgradeToYearlyFormStep = 'UpgradeToYearlyForm' | ||
} | ||
interface Props { | ||
bannerState: BannerStates; | ||
useOfFundsContent: useOfFundsContentInterface; | ||
pageScroller: PageScroller; | ||
remainingImpressions: number; | ||
localCloseTracker: LocalCloseTracker; | ||
} | ||
const props = defineProps<Props>(); | ||
const emit = defineEmits( [ 'bannerClosed', 'bannerContentChanged' ] ); | ||
const tracker = inject<Tracker>( 'tracker' ); | ||
const isFundsModalVisible = ref<boolean>( false ); | ||
const slideShowStopped = ref<boolean>( false ); | ||
const slideshowShouldPlay = computed( () => props.bannerState === BannerStates.Visible && !slideShowStopped.value ); | ||
const contentState = ref<ContentStates>( ContentStates.Mini ); | ||
const formModel = useFormModel(); | ||
const stepControllers = [ | ||
createSubmittableMainDonationForm( formModel, FormStepNames.UpgradeToYearlyFormStep ), | ||
createSubmittableUpgradeToYearly( formModel, FormStepNames.MainDonationFormStep, FormStepNames.MainDonationFormStep ) | ||
]; | ||
const localTranslator = inject<Translator>( 'translator' ); | ||
const currencyFormatter = inject<Currency>( 'currencyFormatter' ); | ||
const localFormItemsBuilder = new FormItemsBuilder( localTranslator, currencyFormatter.euroAmount.bind( currencyFormatter ) ); | ||
const amountOptionsFive = localFormItemsBuilder.setAmounts( 5, 15, 25, 50, 100 ).getItems().amounts; | ||
const amountOptionsTen = localFormItemsBuilder.setAmounts( 10, 15, 25, 50, 100 ).getItems().amounts; | ||
const amountOptionsForForm = ref<FormItem[]>( amountOptionsTen ); | ||
watch( contentState, async () => { | ||
emit( 'bannerContentChanged' ); | ||
} ); | ||
function onCloseMiniBanner(): 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 ) ); | ||
props.localCloseTracker.setItem( feature, userChoice ); | ||
} | ||
function onSoftCloseClose( timer: number, feature: TrackingFeatureName, userChoice: CloseChoices ): void { | ||
window.clearInterval( timer ); | ||
onClose( feature, userChoice ); | ||
} | ||
const onSubmit = (): void => { | ||
const closeChoice = props.localCloseTracker.getItem(); | ||
if ( closeChoice !== '' ) { | ||
tracker.trackEvent( new BannerSubmitOnReturnEvent( closeChoice ) ); | ||
} | ||
}; | ||
function onshowFullPageBanner(): void { | ||
slideShowStopped.value = true; | ||
contentState.value = ContentStates.FullPage; | ||
amountOptionsForForm.value = amountOptionsFive; | ||
tracker.trackEvent( new MobileMiniBannerExpandedEvent() ); | ||
} | ||
function onshowFullPageBannerPreselected(): void { | ||
slideShowStopped.value = true; | ||
amountOptionsForForm.value = amountOptionsTen; | ||
formModel.selectedAmount.value = '10'; | ||
contentState.value = ContentStates.FullPage; | ||
tracker.trackEvent( new MobileMiniBannerExpandedEvent( 'preselected' ) ); | ||
} | ||
const onHideFundsModal = ( payload: { source: UseOfFundsCloseSources } ): void => { | ||
props.pageScroller.scrollIntoView( payload.source === UseOfFundsCloseSources.callToAction ? | ||
'.wmde-banner-form' : | ||
'.wmde-banner-full-small-print .wmde-banner-footer-usage-link' | ||
); | ||
isFundsModalVisible.value = false; | ||
}; | ||
</script> |
43 changes: 43 additions & 0 deletions
43
banners/mobile/C24_WMDE_Mobile_DE_11/components/FullPageBannerVar.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<template> | ||
<div class="wmde-banner-full"> | ||
<button class="wmde-banner-full-close t-close-full-banner" @click.prevent="$emit( 'close' )"> | ||
<CloseIconMobile/> | ||
</button> | ||
<div class="wmde-banner-full-content"> | ||
<div class="wmde-banner-full-info"> | ||
<slot name="banner-text"/> | ||
<slot name="progress"/> | ||
</div> | ||
<div class="wmde-banner-full-call-to-action"> | ||
Jetzt sind Sie <span class="wmde-banner-full-call-to-action-optional-text">in Deutschland</span> gefragt. | ||
</div> | ||
|
||
<slot name="donation-form"/> | ||
|
||
<ThankYouBox/> | ||
|
||
<div class="wmde-banner-full-small-print"> | ||
<span> | ||
<a | ||
id="application-of-funds-link" | ||
class="wmde-banner-footer-usage-link t-use-of-funds-link" | ||
@click.prevent="$emit( 'showFundsModal' )" | ||
> | ||
{{ $translate( 'use-of-funds-link' ) }} | ||
</a> | ||
</span> | ||
</div> | ||
|
||
<slot name="footer"/> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import CloseIconMobile from '@src/components/Icons/CloseIconMobile.vue'; | ||
import ThankYouBox from '@src/components/ThankYouBox/ThankYouBox.vue'; | ||
defineEmits( [ 'close', 'showFundsModal' ] ); | ||
</script> |
37 changes: 37 additions & 0 deletions
37
banners/mobile/C24_WMDE_Mobile_DE_11/components/MiniBannerVar.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<template> | ||
<div class="wmde-banner-mini"> | ||
<div class="wmde-banner-mini-close"> | ||
<button class="wmde-banner-mini-close-button t-close-main-banner" @click.prevent="$emit( 'close' )"> | ||
<CloseIconMobile/> | ||
</button> | ||
</div> | ||
|
||
<header class="wmde-banner-mini-headline"> | ||
<div class="wmde-banner-mini-headline-background"> | ||
<span class="wmde-banner-mini-headline-content">Wikipedia ist unverkäuflich</span> | ||
</div> | ||
</header> | ||
|
||
<div class="wmde-banner-mini-slideshow"> | ||
<slot name="banner-slides"/> | ||
</div> | ||
|
||
<div class="wmde-banner-mini-button-group"> | ||
<button class="wmde-banner-mini-button-preselect" @click="$emit( 'showFullPageBannerPreselected' )"> | ||
Jetzt 10 € spenden | ||
</button> | ||
<button class="wmde-banner-mini-button" @click="$emit( 'showFullPageBanner' )"> | ||
Anderen Betrag | ||
</button> | ||
</div> | ||
|
||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import CloseIconMobile from '@src/components/Icons/CloseIconMobile.vue'; | ||
defineEmits( [ 'showFullPageBanner', 'showFullPageBannerPreselected', 'close' ] ); | ||
</script> |
Oops, something went wrong.