-
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.
Merge pull request #161 from wmde/C23_WMDE_Mobile_DE_02
C23_WMDE_Mobile_DE_02
- Loading branch information
Showing
31 changed files
with
1,238 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { createVueApp } from '@src/createVueApp'; | ||
|
||
import './styles/styles.scss'; | ||
|
||
import BannerConductor from '@src/components/BannerConductor/BannerConductor.vue'; | ||
import Banner from './components/BannerCtrl.vue'; | ||
import getBannerDelay from '@src/utils/getBannerDelay'; | ||
import { WindowResizeHandler } from '@src/utils/ResizeHandler'; | ||
import PageWPORG from '@src/page/PageWPORG'; | ||
import { WindowMediaWiki } from '@src/page/MediaWiki/WindowMediaWiki'; | ||
import { SkinFactory } from '@src/page/skin/SkinFactory'; | ||
import { WindowSizeIssueChecker } from '@src/utils/SizeIssueChecker/WindowSizeIssueChecker'; | ||
import TranslationPlugin from '@src/TranslationPlugin'; | ||
import { Translator } from '@src/Translator'; | ||
import DynamicTextPlugin from '@src/DynamicTextPlugin'; | ||
import { LocalImpressionCount } from '@src/utils/LocalImpressionCount'; | ||
import { WindowPageScroller } from '@src/utils/PageScroller/WindowPageScroller'; | ||
import { LegacyTrackerWPORG } from '@src/tracking/LegacyTrackerWPORG'; | ||
import eventMappings from './event_map'; | ||
|
||
// Locale-specific imports | ||
import messages from './messages'; | ||
import { LocaleFactoryDe } from '@src/utils/LocaleFactory/LocaleFactoryDe'; | ||
|
||
// Channel specific form setup | ||
import { createFormItems } from './form_items'; | ||
import { createFormActions } from '@src/createFormActions'; | ||
|
||
const localeFactory = new LocaleFactoryDe(); | ||
const translator = new Translator( messages ); | ||
const mediaWiki = new WindowMediaWiki(); | ||
const page = new PageWPORG( mediaWiki, ( new SkinFactory( mediaWiki ) ).getSkin(), new WindowSizeIssueChecker() ); | ||
const impressionCount = new LocalImpressionCount( page.getTracking().keyword ); | ||
const tracker = new LegacyTrackerWPORG( mediaWiki, page.getTracking().keyword, eventMappings ); | ||
|
||
const app = createVueApp( BannerConductor, { | ||
page, | ||
bannerConfig: { | ||
delay: getBannerDelay( 7500 ), | ||
transitionDuration: 1000 | ||
}, | ||
bannerProps: { | ||
useOfFundsContent: localeFactory.getUseOfFundsLoader().getContent(), | ||
pageScroller: new WindowPageScroller() | ||
}, | ||
resizeHandler: new WindowResizeHandler(), | ||
banner: Banner, | ||
impressionCount | ||
} ); | ||
|
||
app.use( TranslationPlugin, translator ); | ||
app.use( DynamicTextPlugin, { | ||
campaignParameters: page.getCampaignParameters(), | ||
date: new Date(), | ||
formatters: localeFactory.getFormatters(), | ||
impressionCount, | ||
translator | ||
} ); | ||
const currencyFormatter = localeFactory.getCurrencyFormatter(); | ||
|
||
app.provide( 'currencyFormatter', currencyFormatter ); | ||
app.provide( 'formItems', createFormItems( translator, currencyFormatter.euroAmount.bind( currencyFormatter ) ) ); | ||
app.provide( 'formActions', createFormActions( page.getTracking(), impressionCount ) ); | ||
app.provide( 'tracker', tracker ); | ||
|
||
app.mount( page.getBannerContainer() ); |
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,66 @@ | ||
import { createVueApp } from '@src/createVueApp'; | ||
|
||
import './styles/styles_var.scss'; | ||
|
||
import BannerConductor from '@src/components/BannerConductor/BannerConductor.vue'; | ||
import Banner from './components/BannerCtrl.vue'; | ||
import getBannerDelay from '@src/utils/getBannerDelay'; | ||
import { WindowResizeHandler } from '@src/utils/ResizeHandler'; | ||
import PageWPORG from '@src/page/PageWPORG'; | ||
import { WindowMediaWiki } from '@src/page/MediaWiki/WindowMediaWiki'; | ||
import { SkinFactory } from '@src/page/skin/SkinFactory'; | ||
import { WindowSizeIssueChecker } from '@src/utils/SizeIssueChecker/WindowSizeIssueChecker'; | ||
import TranslationPlugin from '@src/TranslationPlugin'; | ||
import { Translator } from '@src/Translator'; | ||
import DynamicTextPlugin from '@src/DynamicTextPlugin'; | ||
import { LocalImpressionCount } from '@src/utils/LocalImpressionCount'; | ||
import { WindowPageScroller } from '@src/utils/PageScroller/WindowPageScroller'; | ||
import { LegacyTrackerWPORG } from '@src/tracking/LegacyTrackerWPORG'; | ||
import eventMappings from './event_map'; | ||
|
||
// Locale-specific imports | ||
import messages from './messages'; | ||
import { LocaleFactoryDe } from '@src/utils/LocaleFactory/LocaleFactoryDe'; | ||
|
||
// Channel specific form setup | ||
import { createFormItems } from './form_items_var'; | ||
import { createFormActions } from '@src/createFormActions'; | ||
|
||
const localeFactory = new LocaleFactoryDe(); | ||
const translator = new Translator( messages ); | ||
const mediaWiki = new WindowMediaWiki(); | ||
const page = new PageWPORG( mediaWiki, ( new SkinFactory( mediaWiki ) ).getSkin(), new WindowSizeIssueChecker() ); | ||
const impressionCount = new LocalImpressionCount( page.getTracking().keyword ); | ||
const tracker = new LegacyTrackerWPORG( mediaWiki, page.getTracking().keyword, eventMappings ); | ||
|
||
const app = createVueApp( BannerConductor, { | ||
page, | ||
bannerConfig: { | ||
delay: getBannerDelay( 7500 ), | ||
transitionDuration: 1000 | ||
}, | ||
bannerProps: { | ||
useOfFundsContent: localeFactory.getUseOfFundsLoader().getContent(), | ||
pageScroller: new WindowPageScroller() | ||
}, | ||
resizeHandler: new WindowResizeHandler(), | ||
banner: Banner, | ||
impressionCount | ||
} ); | ||
|
||
app.use( TranslationPlugin, translator ); | ||
app.use( DynamicTextPlugin, { | ||
campaignParameters: page.getCampaignParameters(), | ||
date: new Date(), | ||
formatters: localeFactory.getFormatters(), | ||
impressionCount, | ||
translator | ||
} ); | ||
const currencyFormatter = localeFactory.getCurrencyFormatter(); | ||
|
||
app.provide( 'currencyFormatter', currencyFormatter ); | ||
app.provide( 'formItems', createFormItems( translator, currencyFormatter.euroAmount.bind( currencyFormatter ) ) ); | ||
app.provide( 'formActions', createFormActions( page.getTracking(), impressionCount ) ); | ||
app.provide( 'tracker', tracker ); | ||
|
||
app.mount( page.getBannerContainer() ); |
153 changes: 153 additions & 0 deletions
153
archive/mobile/C23_WMDE_Mobile_DE_01/components/BannerCtrl.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,153 @@ | ||
<template> | ||
<div class="wmde-banner-wrapper" :class="contentState"> | ||
<MiniBanner | ||
@close="onCloseMiniBanner" | ||
@show-full-page-banner="onshowFullPageBanner" | ||
> | ||
<template #banner-slides> | ||
<KeenSlider :with-navigation="false" :play="slideshowShouldPlay" :interval="5000"> | ||
|
||
<template #slides="{ currentSlide }: any"> | ||
<BannerSlides :currentSlide="currentSlide"/> | ||
</template> | ||
|
||
</KeenSlider> | ||
</template> | ||
</MiniBanner> | ||
|
||
<FullPageBanner | ||
@showFundsModal="isFundsModalVisible = true" | ||
@close="() => onClose( 'FullPageBanner', CloseChoices.Close )" | ||
> | ||
<template #banner-text> | ||
<BannerText/> | ||
</template> | ||
|
||
<template #donation-form="{ formInteraction }: any"> | ||
<MultiStepDonation :step-controllers="stepControllers" @form-interaction="formInteraction" :page-scroller="pageScroller"> | ||
|
||
<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" @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" | ||
@close="() => onClose( 'SoftClose', CloseChoices.Close )" | ||
@maybe-later="() => onClose( 'SoftClose', CloseChoices.MaybeLater )" | ||
@time-out-close="() => onClose( 'SoftClose', CloseChoices.TimeOut )" | ||
/> | ||
|
||
<FundsModal | ||
:content="useOfFundsContent" | ||
:is-funds-modal-visible="isFundsModalVisible" | ||
@hideFundsModal="onHideFundsModal" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { BannerStates } from '@src/components/BannerConductor/StateMachine/BannerStates'; | ||
import SoftClose from '@src/components/SoftClose/SoftClose.vue'; | ||
import { computed, inject, ref, watch } from 'vue'; | ||
import FullPageBanner from './FullPageBanner.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 MainDonationForm from '@src/components/DonationForm/Forms/MainDonationForm.vue'; | ||
import MultiStepDonation from '@src/components/DonationForm/MultiStepDonation.vue'; | ||
import BannerText from '../content/BannerText.vue'; | ||
import UpgradeToYearlyButtonForm from '@src/components/DonationForm/Forms/UpgradeToYearlyButtonForm.vue'; | ||
import BannerSlides from '../content/BannerSlides.vue'; | ||
import BannerFooter from '@src/components/Footer/BannerFooter.vue'; | ||
import ChevronLeftIcon from '@src/components/Icons/ChevronLeftIcon.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 { | ||
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'; | ||
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; | ||
} | ||
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 ) | ||
]; | ||
watch( contentState, async () => { | ||
emit( 'bannerContentChanged' ); | ||
} ); | ||
function onCloseMiniBanner(): void { | ||
contentState.value = ContentStates.SoftClosing; | ||
} | ||
function onClose( feature: TrackingFeatureName, userChoice: CloseChoices ): void { | ||
emit( 'bannerClosed', new CloseEvent( feature, userChoice ) ); | ||
} | ||
function onshowFullPageBanner(): void { | ||
slideShowStopped.value = true; | ||
contentState.value = ContentStates.FullPage; | ||
tracker.trackEvent( new MobileMiniBannerExpandedEvent() ); | ||
} | ||
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> |
39 changes: 39 additions & 0 deletions
39
archive/mobile/C23_WMDE_Mobile_DE_01/components/FullPageBanner.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,39 @@ | ||
<template> | ||
<div class="wmde-banner-full"> | ||
<div class="wmde-banner-full-content"> | ||
<button class="wmde-banner-full-close t-close-full-banner" @click.prevent="$emit( 'close' )"> | ||
<CloseIconMobile/> | ||
</button> | ||
<div class="wmde-banner-full-info"> | ||
<slot name="banner-text"/> | ||
</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"/> | ||
|
||
<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'; | ||
defineEmits( [ 'close', 'showFundsModal' ] ); | ||
</script> |
32 changes: 32 additions & 0 deletions
32
archive/mobile/C23_WMDE_Mobile_DE_01/components/MiniBanner.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,32 @@ | ||
<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">Ist Ihnen Wikipedia 5 € wert?</span> | ||
</div> | ||
</header> | ||
|
||
<div class="wmde-banner-mini-slideshow"> | ||
<slot name="banner-slides"/> | ||
</div> | ||
|
||
<button class="wmde-banner-mini-button" @click="$emit( 'showFullPageBanner' )"> | ||
Jetzt spenden | ||
</button> | ||
|
||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import CloseIconMobile from '@src/components/Icons/CloseIconMobile.vue'; | ||
defineEmits( [ 'showFullPageBanner', 'close' ] ); | ||
</script> |
Oops, something went wrong.