|
| 1 | +import { createVueApp } from '@src/createVueApp'; |
| 2 | + |
| 3 | +import './styles/styles_var.scss'; |
| 4 | + |
| 5 | +import BannerConductor from '@src/components/BannerConductor/BannerConductor.vue'; |
| 6 | +import Banner from './components/BannerVar.vue'; |
| 7 | +import { UrlRuntimeEnvironment } from '@src/utils/RuntimeEnvironment'; |
| 8 | +import { WindowResizeHandler } from '@src/utils/ResizeHandler'; |
| 9 | +import PageWPORG from '@src/page/PageWPORG'; |
| 10 | +import { WindowMediaWiki } from '@src/page/MediaWiki/WindowMediaWiki'; |
| 11 | +import { SkinFactory } from '@src/page/skin/SkinFactory'; |
| 12 | +import { WindowSizeIssueChecker } from '@src/utils/SizeIssueChecker/WindowSizeIssueChecker'; |
| 13 | +import TranslationPlugin from '@src/TranslationPlugin'; |
| 14 | +import { Translator } from '@src/Translator'; |
| 15 | +import DynamicTextPlugin from '@src/DynamicTextPlugin'; |
| 16 | +import { LocalImpressionCount } from '@src/utils/LocalImpressionCount'; |
| 17 | +import { WindowPageScroller } from '@src/utils/PageScroller/WindowPageScroller'; |
| 18 | +import { LegacyTrackerWPORG } from '@src/tracking/LegacyTrackerWPORG'; |
| 19 | +import eventMappings from './event_map_var'; |
| 20 | +import messages from './messages'; |
| 21 | +import { LocaleFactoryDe } from '@src/utils/LocaleFactory/LocaleFactoryDe'; |
| 22 | +import { createFormItems } from './form_items'; |
| 23 | +import { createFormActions } from '@src/createFormActions'; |
| 24 | +import { LocalStorageCloseTracker } from '@src/utils/LocalCloseTracker'; |
| 25 | +import { WindowTimer } from '@src/utils/Timer'; |
| 26 | +import { currentCampaignTimePercentage } from '@src/components/ProgressBar/currentCampaignTimePercentage'; |
| 27 | + |
| 28 | +const localeFactory = new LocaleFactoryDe(); |
| 29 | +const translator = new Translator( messages ); |
| 30 | +const mediaWiki = new WindowMediaWiki(); |
| 31 | +const page = new PageWPORG( mediaWiki, ( new SkinFactory( mediaWiki ) ).getSkin(), new WindowSizeIssueChecker() ); |
| 32 | +const runtimeEnvironment = new UrlRuntimeEnvironment( window.location ); |
| 33 | +const impressionCount = new LocalImpressionCount( page.getTracking().keyword, runtimeEnvironment ); |
| 34 | +const tracker = new LegacyTrackerWPORG( mediaWiki, page.getTracking().keyword, eventMappings, runtimeEnvironment ); |
| 35 | +const date = new Date(); |
| 36 | +const currencyFormatter = localeFactory.getCurrencyFormatter(); |
| 37 | + |
| 38 | +const app = createVueApp( BannerConductor, { |
| 39 | + page, |
| 40 | + bannerConfig: { |
| 41 | + delay: runtimeEnvironment.getBannerDelay( 7500 ), |
| 42 | + transitionDuration: 1000 |
| 43 | + }, |
| 44 | + bannerProps: { |
| 45 | + useOfFundsContent: localeFactory.getUseOfFundsLoader().getContent(), |
| 46 | + pageScroller: new WindowPageScroller(), |
| 47 | + remainingImpressions: impressionCount.getRemainingImpressions( page.getMaxBannerImpressions( 'mobile' ) ), |
| 48 | + localCloseTracker: new LocalStorageCloseTracker() |
| 49 | + }, |
| 50 | + resizeHandler: new WindowResizeHandler(), |
| 51 | + banner: Banner, |
| 52 | + impressionCount |
| 53 | +} ); |
| 54 | + |
| 55 | +app.use( TranslationPlugin, translator ); |
| 56 | +app.use( DynamicTextPlugin, { |
| 57 | + campaignParameters: page.getCampaignParameters(), |
| 58 | + date, |
| 59 | + formatters: localeFactory.getFormatters(), |
| 60 | + impressionCount, |
| 61 | + translator, |
| 62 | + urgencyMessageDaysLeft: 45 |
| 63 | +} ); |
| 64 | + |
| 65 | +app.provide( 'currencyFormatter', currencyFormatter ); |
| 66 | +app.provide( 'formItems', createFormItems( translator, currencyFormatter.euroAmount.bind( currencyFormatter ) ) ); |
| 67 | +app.provide( 'formActions', createFormActions( page.getTracking(), impressionCount ) ); |
| 68 | +app.provide( 'tracker', tracker ); |
| 69 | +app.provide( 'timer', new WindowTimer() ); |
| 70 | +app.provide( 'currentCampaignTimePercentage', currentCampaignTimePercentage( date, page.getCampaignParameters() ) ); |
| 71 | + |
| 72 | +app.mount( page.getBannerContainer() ); |
0 commit comments