"use strict"; angular.module("vocabulary") .service("messageBoxService", ["premadeNavigationService", "MessageBox", "$window", "SAZ_FREE_TRIAL_URL","RAZ_ELL_FREE_TRIAL_URL", "RAZ_FREE_TRIAL_URL", "LEARN_MORE_URL", function(premadeNavigationService, MessageBox, $window, SAZ_FREE_TRIAL_URL, RAZ_ELL_FREE_TRIAL_URL, RAZ_FREE_TRIAL_URL, LEARN_MORE_URL){ function showSubscriptionRequiredMessageBox(){ var requiredSubscriptionName = premadeNavigationService.getRequiredSubscriptionName(); var subscriptionMessage = requiredSubscriptionName + " is required to gain access to these lessons."; MessageBox.show({ message: subscriptionMessage, responses: [ { id: 'learn', subtle: true, label: 'Learn More' }, { id: 'trial', confirm: true, label: 'Free 14 Day Trial' } ] }).then(function(response){ if(response.id === 'trial' || response.id === 'learn') { var destUrl = LEARN_MORE_URL; if (response.id === 'trial') { destUrl = RAZ_FREE_TRIAL_URL; if (premadeNavigationService.isRazEllSelectedCategory()) { destUrl = RAZ_ELL_FREE_TRIAL_URL; } else if (premadeNavigationService.isSazSelectedCategory()) { destUrl = SAZ_FREE_TRIAL_URL; } } $window.location.assign(destUrl); } }); } return { showSubscriptionRequiredMessageBox: showSubscriptionRequiredMessageBox } }]);