!function(){"use strict";angular.module("myProximus.glp.pointsTransfer",[]).constant("PointsTransferConstants",{FILES:[]})}();
!function(){"use strict";function e(e,i,r,t,n){return{execute:function(){var o=e.defer(),s={loyaltyProgramSubscriptionId:n.loyaltyProgramSubscriptionId};return i.getEntity(t.transferPointsEligibility_v1,s).subscribe(function(e){r.setEligibleToTransfer(e.value),o.resolve(e.value)},function(e){o.reject(e)}),o.promise}}}commangular.create("CheckUserEligibleToTransferPointsCommand",e,{resultKey:"transferPointsEligibility"}),e.$inject=["$q","$entityManager","PointsTransferService","GlpEntityConfig","loyaltyProgramSubscription"]}();
!function(){angular.module("myProximus.glp.pointstransfer.templates",[]).run(["$templateCache",function(n){n.put("/pointsTransferTemplate",'\n
\n\n\n \n\n'),n.put("/pointsTransferThankYouTemplate",'\n \n\n')}])}();
!function(){"use strict";function t(t,r,e,o,n){return{execute:function(){var i=t.defer(),u={customerId:r.customerId};return e.getEntity(n.loyaltyProgramSubscription_v1,u).subscribe(function(t){o.setLoyaltyProgramSubscriptionId(t.value.loyaltyProgramSubscriptionId),o.setLoyaltyPoints(t.value.currentPoints),i.resolve(t.value)},function(t){i.reject(t)}),i.promise}}}commangular.create("GetLoyaltyProgramSubscriptionCommand",t,{resultKey:"loyaltyProgramSubscription"}),t.$inject=["$q","customerAccount","$entityManager","PointsTransferService","GlpEntityConfig"]}();
!function(){"use strict";function e(e,t,r,n,i,a,o,s,c,d){return{execute:function(){var r=e.defer(),u={loyaltyProgramSubscriptionId:o.data.loyaltyProgramSubscriptionId},f=t.createEntity(a.transfer_v1,u);return f.value={destinationIdentifier:i,pointQuantity:n},t.saveEntity(f,u).subscribe(function(e){o.setCurrentTransfer(n,i),r.resolve(e.value)},function(e){if(!_.isEqual(e.status,0)){var t={translationKey:"myProximus.myAdvantages.messages",id:"myAdvantages.messages.error.transferFailed",displayContext:s.DISPLAY_CONTEXT.AUTO_REMOVE};_.isUndefined(e.errorData)||_.isUndefined(e.errorData.code)||(t.id=t.id+".errorCode."+e.errorData.code),c.dispatch(d.SHOW_ERROR_NOTIFICATION.EVENT,{notification:t})}r.reject(e)},function(){}),r.promise}}}commangular.create("TransferPointsCommand",e,{resultKey:"transferPoints"}),e.$inject=["$q","$entityManager","$state","points","membershipId","GlpEntityConfig","PointsTransferService","NotificationService","$commangular","CommonCommandConfig"]}();
!function(){"use strict";function n(){var n={restrict:"A",templateUrl:"/pointsTransferTemplate",controller:t};return n}function t(n,t,r,a,i,s,e){function o(){var r={points:n.mpPointsTransferData.pointsToTransfer,membershipId:n.mpPointsTransferData.memberId};p=!0,a.dispatch(s.TRANSFER_POINTS.EVENT,r).then(function(){t.go("glp.transferPointsThankYou")})["catch"](function(){p=!1})}function f(){var t=i.calculateRemainingPoints(n.mpPointsTransferData.pointsToTransfer);n.mpPointsTransferData.formattedRemainingPoints=e.format(t),m()}function m(){var t=!1;return _.isUndefined(n.mpPointsTransferData.memberId)||_.isUndefined(n.mpPointsTransferData.pointsToTransfer)?t=!0:(!n.mpPointsTransferData.memberId.toString().match("^2440[0-9]{12}$")||!n.mpPointsTransferData.pointsToTransfer.toString().match("^[0-9]+$")||parseInt(n.mpPointsTransferData.pointsToTransfer)<=0||parseInt(n.mpPointsTransferData.pointsToTransfer)>n.mpPointsTransferData.transferEligibility.maxPoints)&&(t=!0),t}function T(n){return m()||!_.isEmpty(n)||p}var p=!1;n.valueChanged=f,n.transferPoints=o,n.isTransferDisabled=T,n.mpPointsTransferData={transferEligibility:void 0,pointsToTransfer:void 0,memberId:void 0,formattedRemainingPoints:0,isTransferDisabled:!0},a.dispatch(s.CHECK_USER_ELIGIBLE_TO_TRANSFER_POINTS.EVENT)["catch"](function(){n.mpPointsTransferData.componentError=r.error}),n.$watch(function(){return i.data.transferEligibility},function(t){_.isUndefined(t)||(n.mpPointsTransferData.transferEligibility=t,n.mpPointsTransferData.transferEligibility.formattedMaxPoints=e.format(t.maxPoints))})}angular.module("myProximus.glp.pointsTransfer").directive("mpPointsTransfer",n),n.$inject=[],t.$inject=["$scope","$state","$attrs","$commangular","PointsTransferService","PointsTransferCommandConfig","NumberFormatter"]}();
!function(){"use strict";function r(){var r={restrict:"A",templateUrl:"/pointsTransferThankYouTemplate",controller:n};return r}function n(r,n,t,e,a){function o(n){var t=_.parseInt(n.pointsToTransfer,10);_.isNaN(t)?r.mpPointsTransferThankYouData.currentTransfer.formattedPointsToTransfer=n.pointsToTransfer:r.mpPointsTransferThankYouData.currentTransfer.formattedPointsToTransfer=e.format(t)}r.mpPointsTransferThankYouData={isMyProximusMobileAppV2:a.isMyProximusMobileAppV2()},r.$watch(function(){return t.data.currentTransfer},function(t){_.isUndefined(t)?n.go("glp.overview"):(r.mpPointsTransferThankYouData.currentTransfer=t,o(t),r.mpPointsTransferThankYouData.currentTransfer.formattedPointsRemaining=e.format(t.pointsRemaining))})}angular.module("myProximus.glp.pointsTransfer").directive("mpPointsTransferThankYou",r),r.$inject=[],n.$inject=["$scope","$state","PointsTransferService","NumberFormatter","$environment"]}();
!function(){"use strict";function t(){function t(t){return _.max([0,s.data.loyaltyPoints-t])}function n(t){s.data.errors=t}function r(t){s.data.transferEligibility=t}function a(t){s.data.loyaltyProgramSubscriptionId=t}function i(t){s.data.loyaltyPoints=t}function o(n,r){s.data.currentTransfer={pointsToTransfer:n,pointsRemaining:t(n),membershipId:r}}var s={calculateRemainingPoints:t,setErrors:n,setEligibleToTransfer:r,setLoyaltyProgramSubscriptionId:a,setLoyaltyPoints:i,setCurrentTransfer:o,data:{loyaltyPoints:0,errors:void 0}};return s}angular.module("myProximus.glp.pointsTransfer").factory("PointsTransferService",t),t.$inject=[]}();
!function(){"use strict";function n(n,T,E){n.mapTo(E.CHECK_USER_ELIGIBLE_TO_TRANSFER_POINTS.EVENT).asSequence().add(T.GET_CUSTOMER_ACCOUNT.COMMAND).add(E.GET_LOYALTY_PROGRAM_SUBSCRIPTION.COMMAND).add(E.CHECK_USER_ELIGIBLE_TO_TRANSFER_POINTS.COMMAND),n.mapTo(E.TRANSFER_POINTS.EVENT).asSequence().add(E.TRANSFER_POINTS.COMMAND)}var T={TRANSFER_POINTS:{EVENT:"TransferPointsEvent",COMMAND:"TransferPointsCommand"},CHECK_USER_ELIGIBLE_TO_TRANSFER_POINTS:{EVENT:"CheckUserEligibleToTransferPointsEvent",COMMAND:"CheckUserEligibleToTransferPointsCommand"},GET_LOYALTY_PROGRAM_SUBSCRIPTION:{COMMAND:"GetLoyaltyProgramSubscriptionCommand"}};angular.module("myProximus.glp.pointsTransfer").config(n).constant("PointsTransferCommandConfig",T),n.$inject=["$commangularProvider","CommonCommandConfig","PointsTransferCommandConfig"]}();
//# sourceMappingURL=pointstransfer.myProximus.process.js.map