{"version":3,"file":"BuyAsSubscriptionModal.js","names":["defineDs","m","Ensighten","BuyAsSubscriptionModal","controller","_ref","Object","assign","modalDictionary","dictionary","bind","prefix","buySubscription","playType","processingPurchase","concat","packageModel","sendToSubscription","pushGaEventOnPageRedirect","toLowerCase","view","headingText","bodyText","buttonState","buttonName","trust","length","class","onclick","src","settings","buyAsSubscriptionLightningIcon","buyAsSubscriptionClassicIcon"],"sources":["DanskeSpil/Domain/NumberGamePackage/Scripts/Templates/MultiPackages/PurchaseFlow/BuyAsSubscriptionModal.js"],"sourcesContent":["defineDs('DanskeSpil/Domain/NumberGamePackage/Scripts/Templates/MultiPackages/PurchaseFlow/BuyAsSubscriptionModal', [\r\n 'Shared/Framework/Mithril/Scripts/Core/Mithril',\r\n 'Shared/Framework/Ensighten/Scripts/Ensighten',\r\n], function (m, Ensighten) {\r\n const BuyAsSubscriptionModal = {\r\n controller: function ({ controller }) {\r\n Object.assign(this, controller);\r\n\r\n this.modalDictionary = this.dictionary.bind({ prefix: 'MultiPackages/BuyAsSubscriptionModal/' });\r\n this.buySubscription = (playType) => {\r\n return () => {\r\n if (this.processingPurchase()) return;\r\n this.processingPurchase(`buySubscription:${playType}`);\r\n this.packageModel().sendToSubscription({ playType });\r\n\r\n Ensighten.pushGaEventOnPageRedirect('week_packages', 'select_coupon_type', playType.toLowerCase());\r\n };\r\n };\r\n },\r\n view: function (controller) {\r\n const headingText = controller.modalDictionary('Heading');\r\n const bodyText = controller.modalDictionary('Body');\r\n\r\n const buttonState = (buttonName) => {\r\n if (controller.processingPurchase()) {\r\n if (controller.processingPurchase() === buttonName) {\r\n return 'btn--loading';\r\n } else {\r\n return 'btn--disabled';\r\n }\r\n }\r\n };\r\n\r\n return m('.multi-packages-subscription-options-modal__content', [\r\n headingText ? m('.multi-packages-subscription-options-modal__heading', m.trust(headingText)) : null,\r\n bodyText.length ? m('.multi-packages-subscription-options-modal__body', m.trust(bodyText)) : null,\r\n m('.multi-packages-subscription-options-modal__options', [\r\n m('.multi-packages-subscription-options-modal__option', {\r\n class: buttonState('buySubscription:Lightning'),\r\n onclick: controller.buySubscription('Lightning')\r\n }, [\r\n m('.multi-packages-subscription-options-modal__option-icon-wrapper',\r\n m('img.multi-packages-subscription-options-modal__option-icon', {\r\n src: controller.settings.buyAsSubscriptionLightningIcon\r\n })\r\n ),\r\n m('.multi-packages-subscription-options-modal__option-title', controller.modalDictionary('LightningTitle')),\r\n m('.multi-packages-subscription-options-modal__option-description', m.trust(controller.modalDictionary('LightningDescription'))),\r\n m('.multi-packages-button', {\r\n class: buttonState('buySubscription:Lightning')\r\n }, controller.modalDictionary('LightningButton'))\r\n ]),\r\n m('.multi-packages-subscription-options-modal__options-divider', controller.modalDictionary('Divider')),\r\n m('.multi-packages-subscription-options-modal__option', {\r\n class: buttonState('buySubscription:Classic'),\r\n onclick: controller.buySubscription('Classic')\r\n }, [\r\n m('.multi-packages-subscription-options-modal__option-icon-wrapper',\r\n m('img.multi-packages-subscription-options-modal__option-icon', {\r\n src: controller.settings.buyAsSubscriptionClassicIcon\r\n })\r\n ),\r\n m('.multi-packages-subscription-options-modal__option-title', controller.modalDictionary('ClassicTitle')),\r\n m('.multi-packages-subscription-options-modal__option-description', m.trust(controller.modalDictionary('ClassicDescription'))),\r\n m('.multi-packages-button', {\r\n class: buttonState('buySubscription:Classic')\r\n }, controller.modalDictionary('ClassicButton'))\r\n ])\r\n ])\r\n ]);\r\n }\r\n };\r\n\r\n return BuyAsSubscriptionModal;\r\n});"],"mappings":"AAAAA,QAAQ,CAAC,yGAAyG,EAAE,CAClH,+CAA+C,EAC/C,8CAA8C,CAC/C,EAAE,UAAUC,CAAC,EAAEC,SAAS,EAAE;EACzB,IAAMC,sBAAsB,GAAG;IAC7BC,UAAU,EAAE,SAAAA,CAAAC,IAAA,EAA0B;MAAA,IAAhB;QAAED;MAAW,CAAC,GAAAC,IAAA;MAClCC,MAAM,CAACC,MAAM,CAAC,IAAI,EAAEH,UAAU,CAAC;MAE/B,IAAI,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