Skip to content

Commit

Permalink
Prepare camapign for C23_WMDE_Desktop_04
Browse files Browse the repository at this point in the history
- text changes in both banners
- based on desktop DE 03
- custom amount form page is removed from both banners, link leads back to mainpage

- fix feature tests

https://phabricator.wikimedia.org/T344423
  • Loading branch information
moiikana committed Sep 5, 2023
1 parent 3f88a6a commit 78b7ce0
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 32 deletions.
2 changes: 1 addition & 1 deletion banners/desktop/banner_var.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const currencyFormatter = localeFactory.getCurrencyFormatter();

app.provide( 'currencyFormatter', currencyFormatter );
app.provide( 'formItems', createFormItems( translator, currencyFormatter.euroAmount.bind( currencyFormatter ) ) );
app.provide( 'formActions', createFormActions( page.getTracking(), impressionCount, { ast: '2' } ) );
app.provide( 'formActions', createFormActions( page.getTracking(), impressionCount, { ast: '0' } ) );
app.provide( 'tracker', tracker );

app.mount( page.getBannerContainer() );
4 changes: 1 addition & 3 deletions banners/desktop/components/BannerCtrl.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ import {
import {
createSubmittableUpgradeToYearly
} from '@src/components/DonationForm/StepControllers/SubmittableUpgradeToYearly';
import { createSubmittableCustomAmount } from '@src/components/DonationForm/StepControllers/SubmittableCustomAmount';
import { CloseChoices } from '@src/domain/CloseChoices';
import { CloseEvent } from '@src/tracking/events/CloseEvent';
import { TrackingFeatureName } from '@src/tracking/TrackingEvent';
Expand Down Expand Up @@ -109,8 +108,7 @@ const contentState = ref<ContentStates>( ContentStates.Main );
const formModel = useFormModel();
const stepControllers = [
createSubmittableMainDonationForm( formModel, FormStepNames.UpgradeToYearlyFormStep ),
createSubmittableUpgradeToYearly( formModel, FormStepNames.CustomAmountFormStep, FormStepNames.MainDonationFormStep ),
createSubmittableCustomAmount( formModel, FormStepNames.UpgradeToYearlyFormStep )
createSubmittableUpgradeToYearly( formModel, FormStepNames.MainDonationFormStep, FormStepNames.MainDonationFormStep )
];
watch( contentState, async () => {
Expand Down
26 changes: 12 additions & 14 deletions banners/desktop/components/BannerVar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
<template #donation-form="{ formInteraction }: any">
<MultiStepDonation :step-controllers="stepControllers" @form-interaction="formInteraction">

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

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

</MultiStepDonation>
</template>
Expand Down Expand Up @@ -65,8 +65,8 @@ import { UseOfFundsContent as useOfFundsContentInterface } from '@src/domain/Use
import SoftClose from '@src/components/SoftClose/SoftClose.vue';
import MainBanner from './MainBanner.vue';
import FundsModal from '@src/components/UseOfFunds/FundsModal.vue';
import BannerText from '../content/BannerText.vue';
import BannerSlides from '../content/BannerSlides.vue';
import BannerText from '../content/BannerText_var.vue';
import BannerSlides from '../content/BannerSlides_var.vue';
import MultiStepDonation from '@src/components/DonationForm/MultiStepDonation.vue';
import BannerFooter from '@src/components/Footer/BannerFooter.vue';
import MainDonationForm from '@src/components/DonationForm/Forms/MainDonationForm.vue';
Expand All @@ -80,7 +80,6 @@ import {
import {
createSubmittableUpgradeToYearly
} from '@src/components/DonationForm/StepControllers/SubmittableUpgradeToYearly';
import { createSubmittableCustomAmount } from '@src/components/DonationForm/StepControllers/SubmittableCustomAmount';
import { CloseChoices } from '@src/domain/CloseChoices';
import { CloseEvent } from '@src/tracking/events/CloseEvent';
import { TrackingFeatureName } from '@src/tracking/TrackingEvent';
Expand Down Expand Up @@ -109,8 +108,7 @@ const contentState = ref<ContentStates>( ContentStates.Main );
const formModel = useFormModel();
const stepControllers = [
createSubmittableMainDonationForm( formModel, FormStepNames.UpgradeToYearlyFormStep ),
createSubmittableUpgradeToYearly( formModel, FormStepNames.CustomAmountFormStep, FormStepNames.MainDonationFormStep ),
createSubmittableCustomAmount( formModel, FormStepNames.UpgradeToYearlyFormStep )
createSubmittableUpgradeToYearly( formModel, FormStepNames.MainDonationFormStep, FormStepNames.MainDonationFormStep )
];
watch( contentState, async () => {
Expand Down
52 changes: 52 additions & 0 deletions banners/desktop/content/BannerSlides_var.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<KeenSliderSlide :is-current="currentSlide === 0">
<p class="headline">
<InfoIcon fill="#990a00"/> <strong> An alle, die Wikipedia in Deutschland nutzen </strong>
</p>
<p>
Vielleicht kommen wir gerade ungelegen, aber dennoch: Klicken Sie jetzt bitte nicht weg!
Am heutigen {{ currentDayName }}, den {{ currentDate }}, bitten wir Sie bescheiden, die Unabhängigkeit von Wikipedia zu unterstützen.
</p>
</KeenSliderSlide>
<KeenSliderSlide :is-current="currentSlide === 1">
<p>
<span class="wmde-banner-text-animated-highlight">Millionen Menschen nutzen Wikipedia, aber 99&nbsp;% spenden
nicht – sie übergehen diesen Aufruf.</span>
Die meisten Menschen spenden, weil sie Wikipedia nützlich finden.
</p>
</KeenSliderSlide>
<KeenSliderSlide :is-current="currentSlide === 2">
<p>
Die durchschnittliche Spende beträgt 22,25&nbsp;€, 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 { computed, inject } from 'vue';
import InfoIcon from '@src/components/Icons/InfoIcon.vue';
import KeenSliderSlide from '@src/components/Slider/KeenSliderSlide.vue';
interface Props {
currentSlide: number
}
defineProps<Props>();
const { currentDayName }: DynamicContent = inject( 'dynamicCampaignText' );
const currentDate = computed( () => {
return new Intl.DateTimeFormat( 'de-DE', {
day: '2-digit',
month: 'long'
} ).format( new Date() );
} );
</script>
35 changes: 35 additions & 0 deletions banners/desktop/content/BannerText_var.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template>
<div class="wmde-banner-message">
<div>
<p>
<InfoIcon fill="#990a00"/>
<strong> An alle, die Wikipedia in Deutschland nutzen </strong>
</p>
<p>
Vielleicht kommen wir gerade ungelegen, aber dennoch: Klicken Sie jetzt bitte nicht weg! Am
heutigen {{ currentDayName }}, den {{ currentDate }}, bitten wir Sie bescheiden, die Unabhängigkeit von Wikipedia zu
unterstützen. <span class="wmde-banner-text-animated-highlight">Millionen Menschen nutzen Wikipedia,
aber 99&nbsp;% spenden nicht – sie übergehen diesen Aufruf.</span> Die meisten Menschen spenden, weil sie
Wikipedia nützlich finden. Die durchschnittliche Spende beträgt 22,25&nbsp;€, 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 { computed, inject } from 'vue';
import { DynamicContent } from '@src/utils/DynamicContent/DynamicContent';
import InfoIcon from '@src/components/Icons/InfoIcon.vue';
const { currentDayName }: DynamicContent = inject( 'dynamicCampaignText' );
const currentDate = computed( () => {
return new Intl.DateTimeFormat( 'de-DE', {
day: '2-digit',
month: 'long'
} ).format( new Date() );
} );
</script>
14 changes: 7 additions & 7 deletions campaign_info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
[desktop]
name = "Desktop"
icon = "desktop"
campaign = "C23_WMDE_Desktop_DE_03"
description = "Address type options test on the Fundraising Application"
campaign_tracking = "03-ba-230810"
campaign = "C23_WMDE_Desktop_DE_04"
description = "Small text changes, Custom Amount Form Page is removed from both banners."
campaign_tracking = "04-ba-230828"
preview_link = "/wiki/Wikipedia:Hauptseite?devbanner={{banner}}&banner=B22_WMDE_local_prototype"
preview_url = 'https://de.wikipedia.org/wiki/Wikipedia:Hauptseite?banner={{banner}}&devMode'
wrapper_template = "wikipedia_org"
Expand All @@ -17,13 +17,13 @@ use_of_funds_source = "MediaWiki:WMDE_Fundraising/UseOfFunds_2023_DE"
# Banners of the campaign, key after "banners" can be anything
[desktop.banners.ctrl]
filename = "./banners/desktop/banner_ctrl.ts"
pagename = "B23_WMDE_Desktop_DE_03_ctrl"
tracking = "org-03-230810-ctrl"
pagename = "B23_WMDE_Desktop_DE_04_ctrl"
tracking = "org-04-230828-ctrl"

[desktop.banners.var]
filename = "./banners/desktop/banner_var.ts"
pagename = "B23_WMDE_Desktop_DE_03_var"
tracking = "org-03-230810-var"
pagename = "B23_WMDE_Desktop_DE_04_var"
tracking = "org-04-230828-var"

[desktop.test_matrix]
platform = ["edge", "firefox_win10", "chrome_win10", "safari", "firefox_macos", "chrome_macos", "firefox_linux", "chrome_linux"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const translations: TranslationMessages = {
'interval-yearly': 'jährlich',

'payment-direct-debit': 'Lastschrift',
'payment-bank-transfer': 'Überweisung',
'payment-bank-transfer': 'Banküberweisung',
'payment-credit-card': 'Kreditkarte',
'payment-paypal': 'PayPal',
'payment-sofort': 'Sofortüberweisung'
Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer/FooterAlreadyDonated.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<TickIcon :fill="'#5B5B5B'"/> {{ $translate( 'already-donated-open-link' ) }}
</a>
<label class="wmde-banner-footer-bank-item account">{{ $translate( 'donation-account' ) }}:
<SelectionInput :value="'Wikimedia'"/>
<SelectionInput :value="'Wikimedia e. V.'"/>
</label>
<label class="wmde-banner-footer-bank-item bic">BIC:
<SelectionInput :value="'BFSWDE33BER'"/>
Expand Down
5 changes: 2 additions & 3 deletions test/banners/desktop/components/BannerCtrl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
bannerContentDisplaySwitchFeatures,
bannerContentFeatures
} from '@test/features/BannerContent';
import { donationFormFeatures } from '@test/features/forms/MainDonation_UpgradeToYearly_CustomAmount';
import { donationFormFeatures } from '@test/features/forms/MainDonation_UpgradeToYearlyLink';
import { useFormModel } from '@src/components/composables/useFormModel';
import { resetFormModel } from '@test/resetFormModel';
import { DynamicContent } from '@src/utils/DynamicContent/DynamicContent';
Expand Down Expand Up @@ -91,8 +91,7 @@ describe( 'BannerCtrl.vue', () => {
[ 'expectMainDonationFormGoesToUpgrade' ],
[ 'expectUpgradeToYearlyFormSubmitsUpgrade' ],
[ 'expectUpgradeToYearlyFormSubmitsDontUpgrade' ],
[ 'expectUpgradeToYearlyFormGoesToCustomAmount' ],
[ 'expectCustomAmountFormSubmits' ]
[ 'expectUpgradeToYearlyFormGoesToMainDonation' ]
] )( '%s', async ( testName: string ) => {
await donationFormFeatures[ testName ]( getWrapper() );
} );
Expand Down
4 changes: 2 additions & 2 deletions test/banners/desktop/components/BannerVar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
bannerContentDisplaySwitchFeatures,
bannerContentFeatures
} from '@test/features/BannerContent';
import { donationFormFeatures } from '@test/features/forms/MainDonation_UpgradeToYearly_CustomAmount_AddressType';
import { donationFormFeatures } from '@test/features/forms/MainDonation_UpgradeToYearlyLink';
import { useFormModel } from '@src/components/composables/useFormModel';
import { resetFormModel } from '@test/resetFormModel';
import { DynamicContent } from '@src/utils/DynamicContent/DynamicContent';
Expand Down Expand Up @@ -87,7 +87,7 @@ describe( 'BannerVar.vue', () => {
describe( 'Donation Form Happy Paths', () => {
test.each( [
[ 'expectMainDonationFormGoesToUpgrade' ],
[ 'expectUpgradeToYearlyFormGoesToCustomAmount' ]
[ 'expectUpgradeToYearlyFormGoesToMainDonation' ]
] )( '%s', async ( testName: string ) => {
await donationFormFeatures[ testName ]( getWrapper() );
} );
Expand Down
47 changes: 47 additions & 0 deletions test/features/forms/MainDonation_UpgradeToYearlyLink.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { VueWrapper } from '@vue/test-utils';
import {
expectMainDonationFormGoesToPageOnSubmit,
expectMainDonationFormSubmits,
submitMainDonationForm
} from '@test/features/forms/subForms/MainDonationForm';
import {
expectUpgradeToYearlyFormGoesToPageOnLinkClick,
expectUpgradeToYearlyFormSubmits
} from '@test/features/forms/subForms/UpgradeToYearlyForm';
import { Intervals } from '@src/utils/FormItemsBuilder/fields/Intervals';
import { PaymentMethods } from '@src/utils/FormItemsBuilder/fields/PaymentMethods';

enum Pages {
MainDonation = 1,
UpgradeToYearly = 2
}

export const donationFormFeatures: Record<string, ( wrapper: VueWrapper<any> ) => Promise<any>> = {
expectMainDonationFormSubmitsWhenSofortIsSelected: ( wrapper: VueWrapper<any> ) => expectMainDonationFormSubmits(
wrapper,
Intervals.ONCE,
PaymentMethods.SOFORT
),
expectMainDonationFormSubmitsWhenYearlyIsSelected: ( wrapper: VueWrapper<any> ) => expectMainDonationFormSubmits(
wrapper,
Intervals.YEARLY,
PaymentMethods.PAYPAL
),
expectMainDonationFormGoesToUpgrade: ( wrapper: VueWrapper<any> ) => expectMainDonationFormGoesToPageOnSubmit( wrapper,
Pages.UpgradeToYearly,
Intervals.ONCE,
PaymentMethods.PAYPAL
),
expectUpgradeToYearlyFormSubmitsUpgrade: async ( wrapper: VueWrapper<any> ) => {
await submitMainDonationForm( wrapper, Intervals.ONCE, '5', PaymentMethods.PAYPAL );
await expectUpgradeToYearlyFormSubmits( wrapper, 'yes' );
},
expectUpgradeToYearlyFormSubmitsDontUpgrade: async ( wrapper: VueWrapper<any> ) => {
await submitMainDonationForm( wrapper, Intervals.ONCE, '5', PaymentMethods.PAYPAL );
await expectUpgradeToYearlyFormSubmits( wrapper, 'no' );
},
expectUpgradeToYearlyFormGoesToMainDonation: async ( wrapper: VueWrapper<any> ) => {
await submitMainDonationForm( wrapper, Intervals.ONCE, '5', PaymentMethods.PAYPAL );
await expectUpgradeToYearlyFormGoesToPageOnLinkClick( wrapper, Pages.MainDonation );
}
};

0 comments on commit 78b7ce0

Please sign in to comment.