ouisys-engine 4.1.21 → 4.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.js +1 -1
- package/dist/reducers/click2smsFlow/utils.js +1 -1
- package/dist/reducers/creditCardFlow/utils.js +1 -1
- package/dist/reducers/moRedirFlow/utils.js +1 -1
- package/dist/reducers/oneClickFlow/utils.js +1 -1
- package/dist/reducers/pinFlow/index.js +1 -1
- package/dist/reducers/pinFlow/utils.js +1 -1
- package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.js +1 -1
- package/dist/reducers/strategy/utils.js +1 -1
- package/dist/utilities/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.regexp.test.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.subscribe=exports.mockedSubscribeAjaxState=exports.mockedRedirectUrlSuccessState=exports.getRedirectUrlBupperWay=exports.getRedirectUrl=exports.additionalQueryString=void 0,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.string.split.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_loadScriptInnerHtml=_interopRequireDefault(require("../../utilities/loadScriptInnerHtml")),_replaceUrlParam=require("../../utilities/replaceUrlParam"),_utils=require("../strategy/utils");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _regeneratorRuntime(){"use strict";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}(innerFn,self,context),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(void 0===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method")}return ContinueSentinel}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(object){var keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_arr=[],_n=!0,_d=!1;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!(i&&_arr.length===i));_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i["return"]||_i["return"]()}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}var additionalQueryString="msisdnSubmitted=Y&legalCheckbox=Y&incentivizedCheckbox=Y&op_confirmCheckbox=N";exports.additionalQueryString=additionalQueryString;var uniqidResult,fetchJsonp=function(_url){var url=_url,ouisys_callback_function="ouisys_callback_function".concat(Math.floor(1e4*Math.random()));return new Promise(function(resolve,reject){window[ouisys_callback_function]=function(arg){resolve(arg)},url+=-1===url.indexOf("?")?"?":"&",url+="jsonp=".concat(ouisys_callback_function);var script=document.createElement("script");script.src=url,script.id=ouisys_callback_function,document.body.appendChild(script),script.onerror=function(){reject(new Error("JSONP request to ".concat(_url," failed")))}})},getRedirectUrl=function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(_ref){var window,maybeConfig,extraParams,host,country,slug,queryString,device,apiAction,customDomain,evinaTid,bupperizeCountry,offer,s,search,rockmanId,_url2,result,identifyError,_url3,_result,_identifyError,_window$location,mcpShieldResult,mcpSessionCheckWithBlock,searchObj,_identifyError2,_url4,_result2,_identifyError3;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(window=_ref.window,maybeConfig=_ref.maybeConfig,extraParams=_ref.extraParams,"undefined"!=typeof window){_context.next=5;break}throw"javascript: console.error('SSR'); void 6";case 5:if(host=maybeConfig.host,country=maybeConfig.country,slug=maybeConfig.slug,queryString=maybeConfig.queryString,device=maybeConfig.device,apiAction=maybeConfig.apiAction,customDomain="tallymans.activeonvr.com",evinaTid="undefined"!=typeof window&&window.tid?window.tid:"",bupperizeCountry=function bupperizeCountry(c){return"gb"===c?"uk":c},offer=window.pac_analytics.visitor.offer,s=window.location.search.substr(1),search=(!!s&&0<s.length?[s]:[]).concat((queryString||[]).map(function(_ref3){var _ref4=_slicedToArray(_ref3,2),k=_ref4[0],v=_ref4[1];return"".concat(k,"=").concat(v)})).join("&"),Object.keys(extraParams).forEach(function(element,index){0<search.length&&(search+="&"),search="".concat((0,_replaceUrlParam.replaceUrlParam)(search,element,extraParams[element])).concat(1===index?"&":"")}),rockmanId=window.pac_analytics.visitor.rockmanId,"identify-user"!==apiAction){_context.next=28;break}return _url2="https://tallymans.activeonvr.com/tallyman/v1/?action=identify-user&country=".concat(bupperizeCountry(country),"&slug=").concat(slug,"&device=","smart","&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&sam_evina_tid=").concat(evinaTid,"&").concat(search),_context.next=18,fetchJsonp(_url2);case 18:if(result=_context.sent,!1!==result.success){_context.next=25;break}throw identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat(result.message)),identifyError.type="NotOn3g",identifyError;case 25:return _context.abrupt("return",{subscription_url:result.subscription_url||result.redirect_url,action:function action(){return subscribe(result.subscription_url)}});case 26:_context.next=74;break;case 28:if("he"!==apiAction){_context.next=43;break}return _url3="https://tallymans.activeonvr.com/tallyman/v1/?action=he&country=".concat(bupperizeCountry(country),"&slug=").concat(slug,"&device=","smart","&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&sam_evina_tid=").concat(evinaTid,"&").concat(search),_context.next=32,fetch(_url3).then(function(x){return x.json()});case 32:if(_result=_context.sent,!1!==_result.success){_context.next=39;break}throw _identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat(_result.message)),_identifyError.type="NotOn3g",_identifyError;case 39:return(0,_loadScriptInnerHtml.default)(_result.source),_context.abrupt("return",{redirect_url:_result.redirectUrlWithReplacedUniqid});case 41:_context.next=74;break;case 43:if("za"!==country.toLowerCase()||"evina-test-handle"===slug){_context.next=54;break}return _context.prev=44,_context.next=47,window.tallymanApi.mcpShield(host,country,slug,device,offer,rockmanId);case 47:mcpShieldResult=_context.sent,!1===mcpShieldResult.success?console.warn(mcpShieldResult.message):((0,_loadScriptInnerHtml.default)(mcpShieldResult.source),uniqidResult=mcpShieldResult.uniqid,mcpSessionCheckWithBlock="\n \n document.addEventListener('click', function (event) {\n \n event.preventDefault();\n try{\n if (!event.target.matches('.mcp')) return;\n if (!window.isMcpSessionChecked) {\n \n var url = \"https://tallymans.activeonvr.com/tallyman/v1/?action=mcp-session-check&slug=".concat(slug,"&country=").concat(country,"&device=").concat(device,"&rockman_id=").concat(rockmanId,"&mcpUniqid=").concat(uniqidResult,"\";\n \n fetch(url).then(function(res) {\n return res.json()\n }).then(function(resJson) {\n window.isMcpSessionChecked = true;\n console.log('MCP');\n \n if (resJson[\"should-block\"] === true) {\n document.body.innerHTML = \"\"\n \n var div = document.createElement(\"div\");\n div.setAttribute(\"id\", \"page_blocked\")\n div.style.width = \"100%\";\n div.style.height = \"100%\";\n div.style.background = \"#fff\";\n div.style.color = \"#000\";\n div.style.position = \"fixed\";\n div.style.display = \"flex\";\n div.style.justifyContent = \"center\";\n div.style.alignItems = \"center\";\n div.style.fontSize = \"40px\";\n div.style.top = \"0\";\n div.style.bottom = \"0\";\n div.style.left = \"0\";\n div.style.right = \"0\";\n div.innerHTML = \"Offer Expired\";\n document.body.appendChild(div);\n }else{\n const target = event.target || event.srcElement;\n\n while (target) {\n if (target instanceof HTMLAnchorElement) {\n console.log(target.getAttribute('href'));\n window.location.href = target.getAttribute('href')\n break;\n }\n \n target = target.parentNode;\n }\n }\n });\n }\n }catch(err){\n console.error(err);\n }\n },false)\n "),(0,_loadScriptInnerHtml.default)(mcpSessionCheckWithBlock)),_context.next=54;break;case 51:_context.prev=51,_context.t0=_context["catch"](44),console.warn(_context.t0);case 54:if("om"!==country.toLowerCase()){_context.next=63;break}if(searchObj=(0,_utils.searchToObject)(),"false"!==searchObj.success){_context.next=62;break}throw _identifyError2=new Error("Error in getRedirectUrl() identify-user"),_identifyError2.type="NotOn3g",_identifyError2;case 62:return _context.abrupt("return",{redirect_url:searchObj.redirect_url||searchObj.url});case 63:return _url4="https://".concat(customDomain,"/tallyman/v1/?action=redirect&country=").concat(bupperizeCountry(country),"&slug=").concat(slug,"&device=","smart","&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&page=").concat(encodeURIComponent(null===window||void 0===window||null===(_window$location=window.location)||void 0===_window$location?void 0:_window$location.href),"&sam_evina_tid=").concat(evinaTid,"&").concat(search),_context.next=66,fetch(_url4).then(function(x){return x.json()});case 66:if(_result2=_context.sent,!1!==_result2.success){_context.next=73;break}throw _identifyError3=new Error("Error in getRedirectUrl() identify-user action:\n".concat(_result2.message)),_identifyError3.type="NotOn3g",_identifyError3;case 73:return _context.abrupt("return",{redirect_url:_result2.redirect_url});case 74:case"end":return _context.stop();}},_callee,null,[[44,51]])}));return function getRedirectUrl(_x){return _ref2.apply(this,arguments)}}();exports.getRedirectUrl=getRedirectUrl;var subscribe=function(){var _ref5=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(url,extraParams){var evinaTid,extraParamsQs,isCleanTraffic,result,subscribeError;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:return evinaTid="undefined"!=typeof window&&window.tid?window.tid:"",extraParamsQs=extraParams?"&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")):"",isCleanTraffic="undefined"!=typeof window&&!0===window.shouldBlock?"&is-clean-traffic=false":"&is-clean-traffic=true",_context2.next=5,fetch("".concat(url,"&sam_evina_tid=").concat(evinaTid).concat(isCleanTraffic).concat(extraParamsQs)).then(function(x){return x.json()});case 5:if(result=_context2.sent,!1!==result.success){_context2.next=13;break}throw subscribeError=new Error("Error in subscribe() one-click-subscribe action:\n".concat(result.message)),subscribeError.type="ALREADY SUBSCRIBED"===result.message?"AlreadySubscribed":"SubscriptionError",subscribeError.productUrl=result.product_url?result.product_url:"",subscribeError;case 13:return _context2.abrupt("return",result.product_url||result.redirect_url);case 14:case"end":return _context2.stop();}},_callee2)}));return function subscribe(_x2,_x3){return _ref5.apply(this,arguments)}}();exports.subscribe=subscribe;var getRedirectUrlBupperWay=function(){var _ref6=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(window,maybeConfig,extraParams){var host,country,slug,queryString,bupperizeCountry,offer,s,search,extraParamsQs,xcid,evinaTid;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:if("undefined"!=typeof window){_context3.next=2;break}return _context3.abrupt("return","javascript: console.error('SSR'); void 6");case 2:return host=maybeConfig.host,country=maybeConfig.country,slug=maybeConfig.slug,queryString=maybeConfig.queryString,bupperizeCountry=function bupperizeCountry(c){return"gb"===c?"uk":c},offer=window.pac_analytics.visitor.offer,s=window.location.search.substr(1),search=(!!s&&0<s.length?[s]:[]).concat((queryString||[]).map(function(_ref7){var _ref8=_slicedToArray(_ref7,2),k=_ref8[0],v=_ref8[1];return"".concat(k,"=").concat(v)})).join("&"),extraParamsQs=extraParams?"&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")):"",xcid=window.location.href.split("/")[3].split("?")[0],evinaTid="undefined"!=typeof window&&window.tid?window.tid:"",_context3.abrupt("return","http://".concat(host,"/").concat(bupperizeCountry(country),"/").concat(slug,"?offer=").concat(offer,"&atmobirun=1&rockman_id=").concat(window.pac_analytics.visitor.rockmanId,"&redirPixels=").concat(window.location.host,"&sam_evina_tid=").concat(evinaTid,"&x-xcid=").concat(xcid).concat(extraParamsQs,"&").concat(search));case 11:case"end":return _context3.stop();}},_callee3)}));return function getRedirectUrlBupperWay(_x4,_x5,_x6){return _ref6.apply(this,arguments)}}();exports.getRedirectUrlBupperWay=getRedirectUrlBupperWay;var mockedRedirectUrlSuccessState={currentState:{type:"GET_REDIRECT_URL",result:RDS.Success({redirectUrl:""})}};exports.mockedRedirectUrlSuccessState=mockedRedirectUrlSuccessState;var mockedSubscribeAjaxState={currentState:{type:"SUBCRIBE_AJAX",result:RDS.NothingYet()}};exports.mockedSubscribeAjaxState=mockedSubscribeAjaxState;
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.regexp.test.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.subscribe=exports.mockedSubscribeAjaxState=exports.mockedRedirectUrlSuccessState=exports.getRedirectUrlBupperWay=exports.getRedirectUrl=exports.additionalQueryString=void 0,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.string.split.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_loadScriptInnerHtml=_interopRequireDefault(require("../../utilities/loadScriptInnerHtml")),_replaceUrlParam=require("../../utilities/replaceUrlParam"),_utils=require("../strategy/utils");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _regeneratorRuntime(){"use strict";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}(innerFn,self,context),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(void 0===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method")}return ContinueSentinel}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(object){var keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(o){if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);return"Object"===n&&o.constructor&&(n=o.constructor.name),"Map"===n||"Set"===n?Array.from(o):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(o,minLen):void 0}}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_arr=[],_n=!0,_d=!1;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!(i&&_arr.length===i));_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i["return"]||_i["return"]()}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}var additionalQueryString="msisdnSubmitted=Y&legalCheckbox=Y&incentivizedCheckbox=Y&op_confirmCheckbox=N";exports.additionalQueryString=additionalQueryString;var uniqidResult,fetchJsonp=function(_url){var url=_url,ouisys_callback_function="ouisys_callback_function".concat(Math.floor(1e4*Math.random()));return new Promise(function(resolve,reject){window[ouisys_callback_function]=function(arg){resolve(arg)},url+=-1===url.indexOf("?")?"?":"&",url+="jsonp=".concat(ouisys_callback_function);var script=document.createElement("script");script.src=url,script.id=ouisys_callback_function,document.body.appendChild(script),script.onerror=function(){reject(new Error("JSONP request to ".concat(_url," failed")))}})},getRedirectUrl=function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(_ref){var window,maybeConfig,extraParams,host,country,slug,queryString,device,apiAction,customDomain,evinaTid,bupperizeCountry,offer,s,search,rockmanId,_url2,result,identifyError,_url3,_result,_identifyError,_window$location,mcpShieldResult,mcpSessionCheckWithBlock,searchObj,_identifyError2,_url4,_result2,_identifyError3;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(window=_ref.window,maybeConfig=_ref.maybeConfig,extraParams=_ref.extraParams,"undefined"!=typeof window){_context.next=5;break}throw"javascript: console.error('SSR'); void 6";case 5:if(host=maybeConfig.host,country=maybeConfig.country,slug=maybeConfig.slug,queryString=maybeConfig.queryString,device=maybeConfig.device,apiAction=maybeConfig.apiAction,customDomain="de-ads.tallymans.com",evinaTid="undefined"!=typeof window&&window.tid?window.tid:"",bupperizeCountry=function bupperizeCountry(c){return"gb"===c?"uk":c},offer=window.pac_analytics.visitor.offer,s=window.location.search.substr(1),search=(!!s&&0<s.length?[s]:[]).concat((queryString||[]).map(function(_ref3){var _ref4=_slicedToArray(_ref3,2),k=_ref4[0],v=_ref4[1];return"".concat(k,"=").concat(v)})).join("&"),Object.keys(extraParams).forEach(function(element,index){0<search.length&&(search+="&"),search="".concat((0,_replaceUrlParam.replaceUrlParam)(search,element,extraParams[element])).concat(1===index?"&":"")}),rockmanId=window.pac_analytics.visitor.rockmanId,"identify-user"!==apiAction){_context.next=28;break}return _url2="https://de.tallymans.com/tallyman/v1/?action=identify-user&country=".concat(bupperizeCountry(country),"&slug=").concat(slug,"&device=","smart","&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&sam_evina_tid=").concat(evinaTid,"&").concat(search),_context.next=18,fetchJsonp(_url2);case 18:if(result=_context.sent,!1!==result.success){_context.next=25;break}throw identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat(result.message)),identifyError.type="NotOn3g",identifyError;case 25:return _context.abrupt("return",{subscription_url:result.subscription_url||result.redirect_url,action:function action(){return subscribe(result.subscription_url)}});case 26:_context.next=74;break;case 28:if("he"!==apiAction){_context.next=43;break}return _url3="https://de.tallymans.com/tallyman/v1/?action=he&country=".concat(bupperizeCountry(country),"&slug=").concat(slug,"&device=","smart","&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&sam_evina_tid=").concat(evinaTid,"&").concat(search),_context.next=32,fetch(_url3).then(function(x){return x.json()});case 32:if(_result=_context.sent,!1!==_result.success){_context.next=39;break}throw _identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat(_result.message)),_identifyError.type="NotOn3g",_identifyError;case 39:return(0,_loadScriptInnerHtml.default)(_result.source),_context.abrupt("return",{redirect_url:_result.redirectUrlWithReplacedUniqid});case 41:_context.next=74;break;case 43:if("za"!==country.toLowerCase()||"evina-test-handle"===slug){_context.next=54;break}return _context.prev=44,_context.next=47,window.tallymanApi.mcpShield(host,country,slug,device,offer,rockmanId);case 47:mcpShieldResult=_context.sent,!1===mcpShieldResult.success?console.warn(mcpShieldResult.message):((0,_loadScriptInnerHtml.default)(mcpShieldResult.source),uniqidResult=mcpShieldResult.uniqid,mcpSessionCheckWithBlock="\n \n document.addEventListener('click', function (event) {\n \n event.preventDefault();\n try{\n if (!event.target.matches('.mcp')) return;\n if (!window.isMcpSessionChecked) {\n \n var url = \"https://de-ads.tallymans.com/tallyman/v1/?action=mcp-session-check&slug=".concat(slug,"&country=").concat(country,"&device=").concat(device,"&rockman_id=").concat(rockmanId,"&mcpUniqid=").concat(uniqidResult,"\";\n \n fetch(url).then(function(res) {\n return res.json()\n }).then(function(resJson) {\n window.isMcpSessionChecked = true;\n console.log('MCP');\n \n if (resJson[\"should-block\"] === true) {\n document.body.innerHTML = \"\"\n \n var div = document.createElement(\"div\");\n div.setAttribute(\"id\", \"page_blocked\")\n div.style.width = \"100%\";\n div.style.height = \"100%\";\n div.style.background = \"#fff\";\n div.style.color = \"#000\";\n div.style.position = \"fixed\";\n div.style.display = \"flex\";\n div.style.justifyContent = \"center\";\n div.style.alignItems = \"center\";\n div.style.fontSize = \"40px\";\n div.style.top = \"0\";\n div.style.bottom = \"0\";\n div.style.left = \"0\";\n div.style.right = \"0\";\n div.innerHTML = \"Offer Expired\";\n document.body.appendChild(div);\n }else{\n const target = event.target || event.srcElement;\n\n while (target) {\n if (target instanceof HTMLAnchorElement) {\n console.log(target.getAttribute('href'));\n window.location.href = target.getAttribute('href')\n break;\n }\n \n target = target.parentNode;\n }\n }\n });\n }\n }catch(err){\n console.error(err);\n }\n },false)\n "),(0,_loadScriptInnerHtml.default)(mcpSessionCheckWithBlock)),_context.next=54;break;case 51:_context.prev=51,_context.t0=_context["catch"](44),console.warn(_context.t0);case 54:if("om"!==country.toLowerCase()){_context.next=63;break}if(searchObj=(0,_utils.searchToObject)(),"false"!==searchObj.success){_context.next=62;break}throw _identifyError2=new Error("Error in getRedirectUrl() identify-user"),_identifyError2.type="NotOn3g",_identifyError2;case 62:return _context.abrupt("return",{redirect_url:searchObj.redirect_url||searchObj.url});case 63:return _url4="https://".concat(customDomain,"/tallyman/v1/?action=redirect&country=").concat(bupperizeCountry(country),"&slug=").concat(slug,"&device=","smart","&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&page=").concat(encodeURIComponent(null===window||void 0===window||null===(_window$location=window.location)||void 0===_window$location?void 0:_window$location.href),"&sam_evina_tid=").concat(evinaTid,"&").concat(search),_context.next=66,fetch(_url4).then(function(x){return x.json()});case 66:if(_result2=_context.sent,!1!==_result2.success){_context.next=73;break}throw _identifyError3=new Error("Error in getRedirectUrl() identify-user action:\n".concat(_result2.message)),_identifyError3.type="NotOn3g",_identifyError3;case 73:return _context.abrupt("return",{redirect_url:_result2.redirect_url});case 74:case"end":return _context.stop();}},_callee,null,[[44,51]])}));return function getRedirectUrl(_x){return _ref2.apply(this,arguments)}}();exports.getRedirectUrl=getRedirectUrl;var subscribe=function(){var _ref5=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(url,extraParams){var evinaTid,extraParamsQs,isCleanTraffic,result,subscribeError;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:return evinaTid="undefined"!=typeof window&&window.tid?window.tid:"",extraParamsQs=extraParams?"&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")):"",isCleanTraffic="undefined"!=typeof window&&!0===window.shouldBlock?"&is-clean-traffic=false":"&is-clean-traffic=true",_context2.next=5,fetch("".concat(url,"&sam_evina_tid=").concat(evinaTid).concat(isCleanTraffic).concat(extraParamsQs)).then(function(x){return x.json()});case 5:if(result=_context2.sent,!1!==result.success){_context2.next=13;break}throw subscribeError=new Error("Error in subscribe() one-click-subscribe action:\n".concat(result.message)),subscribeError.type="ALREADY SUBSCRIBED"===result.message?"AlreadySubscribed":"SubscriptionError",subscribeError.productUrl=result.product_url?result.product_url:"",subscribeError;case 13:return _context2.abrupt("return",result.product_url||result.redirect_url);case 14:case"end":return _context2.stop();}},_callee2)}));return function subscribe(_x2,_x3){return _ref5.apply(this,arguments)}}();exports.subscribe=subscribe;var getRedirectUrlBupperWay=function(){var _ref6=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(window,maybeConfig,extraParams){var host,country,slug,queryString,bupperizeCountry,offer,s,search,extraParamsQs,xcid,evinaTid;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:if("undefined"!=typeof window){_context3.next=2;break}return _context3.abrupt("return","javascript: console.error('SSR'); void 6");case 2:return host=maybeConfig.host,country=maybeConfig.country,slug=maybeConfig.slug,queryString=maybeConfig.queryString,bupperizeCountry=function bupperizeCountry(c){return"gb"===c?"uk":c},offer=window.pac_analytics.visitor.offer,s=window.location.search.substr(1),search=(!!s&&0<s.length?[s]:[]).concat((queryString||[]).map(function(_ref7){var _ref8=_slicedToArray(_ref7,2),k=_ref8[0],v=_ref8[1];return"".concat(k,"=").concat(v)})).join("&"),extraParamsQs=extraParams?"&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")):"",xcid=window.location.href.split("/")[3].split("?")[0],evinaTid="undefined"!=typeof window&&window.tid?window.tid:"",_context3.abrupt("return","http://".concat(host,"/").concat(bupperizeCountry(country),"/").concat(slug,"?offer=").concat(offer,"&atmobirun=1&rockman_id=").concat(window.pac_analytics.visitor.rockmanId,"&redirPixels=").concat(window.location.host,"&sam_evina_tid=").concat(evinaTid,"&x-xcid=").concat(xcid).concat(extraParamsQs,"&").concat(search));case 11:case"end":return _context3.stop();}},_callee3)}));return function getRedirectUrlBupperWay(_x4,_x5,_x6){return _ref6.apply(this,arguments)}}();exports.getRedirectUrlBupperWay=getRedirectUrlBupperWay;var mockedRedirectUrlSuccessState={currentState:{type:"GET_REDIRECT_URL",result:RDS.Success({redirectUrl:"https://google.com"})}};exports.mockedRedirectUrlSuccessState=mockedRedirectUrlSuccessState;var mockedSubscribeAjaxState={currentState:{type:"SUBCRIBE_AJAX",result:RDS.NothingYet()}};exports.mockedSubscribeAjaxState=mockedSubscribeAjaxState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.weak-map.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.PinFlowActionMaps=void 0,exports.backToStart=backToStart,exports.checkLoadingAction=checkLoadingAction,exports.default=PinFlowReducer,exports.mockPinFlow=mockPinFlow,exports.reSubmitMSISDNAction=reSubmitMSISDNAction,exports.submitMSISDNAction=submitMSISDNAction,exports.submitPinAction=submitPinAction,require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js");var _awesomePhonenumber=_interopRequireDefault(require("awesome-phonenumber")),RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_utilities=require("../../utilities"),_storeMsisdn=require("../../utilities/storeMsisdn"),_strategy=require("../strategy"),_utils=require("../strategy/utils"),_utils2=_interopRequireWildcard(require("./utils"));function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _regeneratorRuntime(){"use strict";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}(innerFn,self,context),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(void 0===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method")}return ContinueSentinel}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(object){var keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}var getConfigByMsisdnPrefix=function(msisdn){var operatorByPrefix=(0,_utilities.getSAOperatorByMsisdnPrefix)(msisdn),flowObj=(0,_utils.determineFlowByOperator)(operatorByPrefix);return flowObj.flowConfig},getInputValuePrefix=function(country,international){var pn=new _awesomePhonenumber.default(international,country.toUpperCase());return country&&international?"+".concat(pn.getCountryCode()):""};function submitMSISDNAction(msisdn,extraParams){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch,store){var currentState,pinFlowCurrentState,_currentState$result,configByStrategy,isUseMsisdnPrefix,isHeaderEnrichmentSuccess,config,prefix,_window,msisdnSubmissionResult,operatorResult,operator,pinMaxLengthByOp,pinPageEvent,errorType;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(currentState=store().strategy.currentState,pinFlowCurrentState=store().pinFlow.currentState,"PIN"!==currentState.type){_context.next=37;break}return _currentState$result=currentState.result,configByStrategy=_currentState$result.config,isUseMsisdnPrefix=_currentState$result.isUseMsisdnPrefix,isHeaderEnrichmentSuccess=_currentState$result.isHeaderEnrichmentSuccess,config=isUseMsisdnPrefix?getConfigByMsisdnPrefix(msisdn):configByStrategy,"ps"===(null===config||void 0===config?void 0:config.country.toLowerCase())&&null!==config&&void 0!==config&&config.slug.includes("shemaroo")&&(prefix=getInputValuePrefix(null===config||void 0===config?void 0:config.country,msisdn),"+970"===prefix&&(msisdn=msisdn.replace("970","972"))),_context.prev=6,dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Loading()})}),_context.next=10,(0,_utils2.default)(window,config,msisdn,extraParams);case 10:if(msisdnSubmissionResult=_context.sent,!("SingleMSISDNSubmissionResult"===msisdnSubmissionResult.type&&msisdnSubmissionResult.redirectUrl)){_context.next=14;break}return _strategy.tracker.customEvent("Flow","advance-auto","msisdn-redirect",{redirectUrl:msisdnSubmissionResult.redirectUrl}),_context.abrupt("return",window.location.href=msisdnSubmissionResult.redirectUrl);case 14:if(operatorResult="SingleMSISDNSubmissionResult"===msisdnSubmissionResult.type?msisdnSubmissionResult.operator:"",operator=(0,_utilities.hasNumber)(operatorResult)?(0,_utilities.getKeyByValue)(_utilities.mapAgencyOperator,operatorResult):operatorResult,!(extraParams&&extraParams.storeMsisdn&&"true"===extraParams.storeMsisdn)){_context.next=19;break}return _context.next=19,(0,_storeMsisdn.storeMsisdn)(msisdn).then(function(data){data&&data.data&&data.data.success?_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-success"):_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-failed")}).catch(function(error){_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-error",error)});case 19:pinMaxLengthByOp={SA_MOBILY:6,SA_STC:4,SA_ZAIN:4},dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Success({})})}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submission-success",{msisdn:msisdn}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.NothingYet(),data:{actualPIN:"SingleMSISDNSubmissionResult"===msisdnSubmissionResult.type?msisdnSubmissionResult.pin:null,nextAction:"submitPinAction",msisdn:msisdn,operator:operator,pinMaxLength:""!==operator&&pinMaxLengthByOp[operator]?pinMaxLengthByOp[operator]:null}})}),pinPageEvent=new Event("onPinPage"),null===(_window=window)||void 0===_window?void 0:_window.dispatchEvent(pinPageEvent),_context.next=35;break;case 27:if(_context.prev=27,_context.t0=_context["catch"](6),console.warn(_context.t0),errorType="AlreadySubscribed"===_context.t0.type?"AlreadySubscribed":"InvalidMSISDN"===_context.t0.type?"InvalidMSISDN":"UnknownError",_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:errorType||"UnknownError"}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:errorType,error:_context.t0,productUrl:_context.t0.productUrl})})}),!isHeaderEnrichmentSuccess){_context.next=35;break}return _context.abrupt("return",dispatch({type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:configByStrategy,msisdn:msisdn,isHeaderEnrichmentSuccess:!1}}}));case 35:_context.next=40;break;case 37:throw dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:"UnknownError",error:null})})}),_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:"UnexpectedState"}),new Error("Unexpected state");case 40:case"end":return _context.stop();}},_callee,null,[[6,27]])}));return function(_x,_x2){return _ref.apply(this,arguments)}}()}function checkLoadingAction(){return function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(dispatch,store){var pinFlowCurrentState,checkIsLoading,intervalId;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:checkIsLoading=function _checkIsLoading(){if(!0===window.isLoading)console.log("isLoading is true");else{console.log("isLoading is false"),clearInterval(intervalId),console.log("Stopped checking isLoading.");var productUrl=(0,_utilities.getCookie)("product_url");if(productUrl){var errorType="AlreadySubscribed";_strategy.tracker.recedeInFlow("tallyman.v1-pin","already-subscribed",{errorType:errorType,product_url:productUrl}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:errorType,error:"AlreadySubscribed",productUrl:productUrl})})})}else dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:{type:"MSISDNEntry",result:RDS.NothingYet()}})}},pinFlowCurrentState=store().pinFlow.currentState,dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Loading()})}),intervalId=setInterval(checkIsLoading,1e3);try{checkIsLoading()}catch(error){console.warn(error),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:{type:"MSISDNEntry",result:RDS.NothingYet()}})}case 5:case"end":return _context2.stop();}},_callee2)}));return function(_x3,_x4){return _ref2.apply(this,arguments)}}()}function reSubmitMSISDNAction(msisdn,extraParams){return function(){var _ref3=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(dispatch,store){var currentState,pinFlowCurrentState,config,msisdnSubmissionResult,errorType;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:if(currentState=store().strategy.currentState,pinFlowCurrentState=store().pinFlow.currentState,"PIN"!==currentState.type){_context3.next=23;break}return config=currentState.result.config,_context3.prev=4,_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-resubmission",{msisdn:msisdn}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submitted",{msisdn:msisdn}),_context3.next=9,(0,_utils2.default)(window,config,msisdn,extraParams);case 9:msisdnSubmissionResult=_context3.sent,dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Success({})})}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submission-success",{msisdn:msisdn}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.NothingYet(),data:{actualPIN:"SingleMSISDNSubmissionResult"===msisdnSubmissionResult.type?msisdnSubmissionResult.pin:null,nextAction:"submitPinAction",msisdn:msisdn}})}),_context3.next=21;break;case 15:_context3.prev=15,_context3.t0=_context3["catch"](4),console.warn(_context3.t0),errorType="AlreadySubscribed"===_context3.t0.type?"AlreadySubscribed":"InvalidMSISDN"===_context3.t0.type?"InvalidMSISDN":"UnknownError",_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:errorType||"UnknownError"}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:errorType,error:_context3.t0,productUrl:_context3.t0.productUrl})})});case 21:_context3.next=26;break;case 23:throw dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:"UnknownError",error:null})})}),_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:"UnexpectedState"}),new Error("Unexpected state");case 26:case"end":return _context3.stop();}},_callee3,null,[[4,15]])}));return function(_x5,_x6){return _ref3.apply(this,arguments)}}()}function submitPinAction(msisdn,pin,extraParams){return function(){var _ref4=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(dispatch,store){var currentState,pinFlowCurrentState,config,result,errorType;return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:if(currentState=store().strategy.currentState,pinFlowCurrentState=store().pinFlow.currentState,_context4.prev=2,dispatch({type:"PIN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Loading()})}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","pin-submitted",{msisdn:msisdn,pin:pin}),"PIN"!==currentState.type){_context4.next=18;break}return config=currentState.result.config,_context4.next=9,(0,_utils2.submitPIN)(window,pin,config,extraParams);case 9:if(result=_context4.sent,_strategy.tracker.advancedInFlow("tallyman.v1-pin","pin-submission-success",{msisdn:msisdn,pin:pin,finalUrl:result.productUrl}),result.gatewayRedirectUrl&&""!==result.gatewayRedirectUrl&&(_strategy.tracker.advancedInFlow("tallyman.v1-pin","gateway-redirect",{msisdn:msisdn,pin:pin,gatewayRedirectUrl:result.gatewayRedirectUrl}),window.location.href=result.gatewayRedirectUrl),!(extraParams&&extraParams.storeMsisdn&&"true"===extraParams.storeMsisdn)){_context4.next=15;break}return _context4.next=15,(0,_storeMsisdn.storeMsisdn)(msisdn).then(function(data){data&&data.data&&data.data.success?_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-success"):_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-failed")}).catch(function(error){_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-error",error)});case 15:dispatch({type:"PIN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Success({finalUrl:result.productUrl,isAlreadySubscribed:result.isAlreadySubscribed||!1})})}),_context4.next=21;break;case 18:throw _strategy.tracker.recedeInFlow("tallyman.v1-pin","pin-submission-failure",{msisdn:msisdn,pin:pin}),dispatch({type:"PIN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Failure({errorType:"UnexpectedState"})})}),new Error("Unexpected state");case 21:_context4.next=30;break;case 23:_context4.prev=23,_context4.t0=_context4["catch"](2),console.error(_context4.t0),errorType=_context4.t0.type||"UnknownError",_strategy.tracker.recedeInFlow("tallyman.v1-pin","pin-submission-failure",{msisdn:msisdn,pin:pin,productUrl:_context4.t0.productUrl}),dispatch({type:"PIN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Failure({errorType:errorType,productUrl:_context4.t0.productUrl})})}),setTimeout(function(){_context4.t0.productUrl&&(window.location.href=_context4.t0.productUrl)},0);case 30:case"end":return _context4.stop();}},_callee4,null,[[2,23]])}));return function(_x7,_x8){return _ref4.apply(this,arguments)}}()}function mockPinFlow(mockState){return function(dispatch){var _window2,pinPageEvent=new Event("onPinPage");if(mockState!==void 0)switch(mockState){case"msisdn-failure-state":return dispatch({type:"MOCK_PIN_FLOW_STATE",payload:_utils2.mockedMSISDNEntryFailure.currentState});case"pin-state":return null===(_window2=window)||void 0===_window2?void 0:_window2.dispatchEvent(pinPageEvent),dispatch({type:"MOCK_PIN_FLOW_STATE",payload:_utils2.mockedPINState.currentState});case"completed-state":return dispatch({type:"MOCK_PIN_FLOW_STATE",payload:_utils2.mockedCompletedState.currentState});default:throw new Error("Mock Flow not supported");}}}function backToStart(){return _strategy.tracker.recedeInFlow("tallyman.v1-pin","pin-submission-backtostart","requested to change phone number"),{type:"BACK_TO_START",payload:{type:"MSISDNEntry",result:RDS.NothingYet()}}}var getInitialState=function getInitialState(){var search=(0,_utils.searchToObject)(),isPinEntryStep=search["show-pin-entry"]&&"1"===search["show-pin-entry"],isShowThankYouStep=search["show-thank-you"]&&"1"===search["show-thank-you"],isShowCustomError=search.show_custom_error&&"1"===search.show_custom_error,initialStateDefault={currentState:{type:"MSISDNEntry",result:RDS.NothingYet()}},msisdnError={currentState:{type:"MSISDNEntry",result:RDS.Failure({errorType:"SomethingWentWrong",error:null})}},thankYouState={currentState:{type:"PINEntry",result:RDS.Success({finalUrl:(null===search||void 0===search?void 0:search.product_url)||""}),data:{nextAction:"submitPinAction",msisdn:(null===search||void 0===search?void 0:search.msisdn)||"",operator:(null===search||void 0===search?void 0:search.operator)||""}}},initalPinEntryState={currentState:{type:"PINEntry",result:RDS.NothingYet(),data:{nextAction:"submitPinAction",msisdn:(null===search||void 0===search?void 0:search.msisdn)||"",operator:(null===search||void 0===search?void 0:search.operator)||""}}};return isPinEntryStep?initalPinEntryState:isShowThankYouStep?thankYouState:isShowCustomError?msisdnError:initialStateDefault},initialState=getInitialState(),PinFlowActionMaps={submitMSISDNAction:submitMSISDNAction,submitPinAction:submitPinAction};exports.PinFlowActionMaps=PinFlowActionMaps;function PinFlowReducer(){var state=0<arguments.length&&arguments[0]!==void 0?arguments[0]:initialState,action=1<arguments.length?arguments[1]:void 0;switch(action.type){case"PIN_FLOW_MSISDN_SUBMIT":return(0,_strategy.genericHandler)(state,action.payload);case"PIN_FLOW_MSISDN_SUBMIT_ERROR":return(0,_strategy.genericHandler)(state,action.payload);case"PIN_SUBMIT":return(0,_strategy.genericHandler)(state,action.payload);case"BACK_TO_START":return(0,_strategy.genericHandler)(state,action.payload);case"PIN_SUBMIT_ERROR":return(0,_strategy.genericHandler)(state,action.payload);case"MOCK_PIN_FLOW_STATE":return(0,_strategy.genericHandler)(state,action.payload);default:return state;}}
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.weak-map.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.PinFlowActionMaps=void 0,exports.backToStart=backToStart,exports.checkLoadingAction=checkLoadingAction,exports.default=PinFlowReducer,exports.mockPinFlow=mockPinFlow,exports.reSubmitMSISDNAction=reSubmitMSISDNAction,exports.submitMSISDNAction=submitMSISDNAction,exports.submitPinAction=submitPinAction,require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js");var _awesomePhonenumber=_interopRequireDefault(require("awesome-phonenumber")),RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_utilities=require("../../utilities"),_storeMsisdn=require("../../utilities/storeMsisdn"),_strategy=require("../strategy"),_utils=require("../strategy/utils"),_utils2=_interopRequireWildcard(require("./utils"));function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _regeneratorRuntime(){"use strict";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}(innerFn,self,context),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(void 0===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method")}return ContinueSentinel}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(object){var keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}var getConfigByMsisdnPrefix=function(msisdn){var operatorByPrefix=(0,_utilities.getSAOperatorByMsisdnPrefix)(msisdn),flowObj=(0,_utils.determineFlowByOperator)(operatorByPrefix);return flowObj.flowConfig},getInputValuePrefix=function(country,international){var pn=new _awesomePhonenumber.default(international,country.toUpperCase());return country&&international?"+".concat(pn.getCountryCode()):""};function submitMSISDNAction(msisdn,extraParams){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch,store){var currentState,pinFlowCurrentState,_currentState$result,configByStrategy,isUseMsisdnPrefix,isHeaderEnrichmentSuccess,config,prefix,_window,msisdnSubmissionResult,operatorResult,operator,pinMaxLengthByOp,pinPageEvent,errorType;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(currentState=store().strategy.currentState,pinFlowCurrentState=store().pinFlow.currentState,"PIN"!==currentState.type){_context.next=39;break}return _currentState$result=currentState.result,configByStrategy=_currentState$result.config,isUseMsisdnPrefix=_currentState$result.isUseMsisdnPrefix,isHeaderEnrichmentSuccess=_currentState$result.isHeaderEnrichmentSuccess,config=isUseMsisdnPrefix?getConfigByMsisdnPrefix(msisdn):configByStrategy,"ps"===(null===config||void 0===config?void 0:config.country.toLowerCase())&&null!==config&&void 0!==config&&config.slug.includes("shemaroo")&&(prefix=getInputValuePrefix(null===config||void 0===config?void 0:config.country,msisdn),"+970"===prefix&&(msisdn=msisdn.replace("970","972"))),_context.prev=6,dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Loading()})}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submitted",{msisdn:msisdn}),_context.next=11,(0,_utils2.default)(window,config,msisdn,extraParams);case 11:if(msisdnSubmissionResult=_context.sent,!("SingleMSISDNSubmissionResult"===msisdnSubmissionResult.type&&msisdnSubmissionResult.redirectUrl)){_context.next=16;break}return _strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submission-success",{msisdn:msisdn}),_strategy.tracker.customEvent("Flow","advance-auto","msisdn-redirect",{redirectUrl:msisdnSubmissionResult.redirectUrl}),_context.abrupt("return",window.location.href=msisdnSubmissionResult.redirectUrl);case 16:if(operatorResult="SingleMSISDNSubmissionResult"===msisdnSubmissionResult.type?msisdnSubmissionResult.operator:"",operator=(0,_utilities.hasNumber)(operatorResult)?(0,_utilities.getKeyByValue)(_utilities.mapAgencyOperator,operatorResult):operatorResult,!(extraParams&&extraParams.storeMsisdn&&"true"===extraParams.storeMsisdn)){_context.next=21;break}return _context.next=21,(0,_storeMsisdn.storeMsisdn)(msisdn).then(function(data){data&&data.data&&data.data.success?_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-success"):_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-failed")}).catch(function(error){_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-error",error)});case 21:pinMaxLengthByOp={SA_MOBILY:6,SA_STC:4,SA_ZAIN:4},dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Success({})})}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submission-success",{msisdn:msisdn}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.NothingYet(),data:{actualPIN:"SingleMSISDNSubmissionResult"===msisdnSubmissionResult.type?msisdnSubmissionResult.pin:null,nextAction:"submitPinAction",msisdn:msisdn,operator:operator,pinMaxLength:""!==operator&&pinMaxLengthByOp[operator]?pinMaxLengthByOp[operator]:null}})}),pinPageEvent=new Event("onPinPage"),null===(_window=window)||void 0===_window?void 0:_window.dispatchEvent(pinPageEvent),_context.next=37;break;case 29:if(_context.prev=29,_context.t0=_context["catch"](6),console.warn(_context.t0),errorType="AlreadySubscribed"===_context.t0.type?"AlreadySubscribed":"InvalidMSISDN"===_context.t0.type?"InvalidMSISDN":"UnknownError",_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:errorType||"UnknownError"}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:errorType,error:_context.t0,productUrl:_context.t0.productUrl})})}),!isHeaderEnrichmentSuccess){_context.next=37;break}return _context.abrupt("return",dispatch({type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:configByStrategy,msisdn:msisdn,isHeaderEnrichmentSuccess:!1}}}));case 37:_context.next=42;break;case 39:throw dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:"UnknownError",error:null})})}),_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:"UnexpectedState"}),new Error("Unexpected state");case 42:case"end":return _context.stop();}},_callee,null,[[6,29]])}));return function(_x,_x2){return _ref.apply(this,arguments)}}()}function checkLoadingAction(){return function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(dispatch,store){var pinFlowCurrentState,checkIsLoading,intervalId;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:checkIsLoading=function _checkIsLoading(){if(!0===window.isLoading)console.log("isLoading is true");else{console.log("isLoading is false"),clearInterval(intervalId),console.log("Stopped checking isLoading.");var productUrl=(0,_utilities.getCookie)("product_url");if(productUrl){var errorType="AlreadySubscribed";_strategy.tracker.recedeInFlow("tallyman.v1-pin","already-subscribed",{errorType:errorType,product_url:productUrl}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:errorType,error:"AlreadySubscribed",productUrl:productUrl})})})}else dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:{type:"MSISDNEntry",result:RDS.NothingYet()}})}},pinFlowCurrentState=store().pinFlow.currentState,dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Loading()})}),intervalId=setInterval(checkIsLoading,1e3);try{checkIsLoading()}catch(error){console.warn(error),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:{type:"MSISDNEntry",result:RDS.NothingYet()}})}case 5:case"end":return _context2.stop();}},_callee2)}));return function(_x3,_x4){return _ref2.apply(this,arguments)}}()}function reSubmitMSISDNAction(msisdn,extraParams){return function(){var _ref3=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(dispatch,store){var currentState,pinFlowCurrentState,config,msisdnSubmissionResult,errorType;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:if(currentState=store().strategy.currentState,pinFlowCurrentState=store().pinFlow.currentState,"PIN"!==currentState.type){_context3.next=23;break}return config=currentState.result.config,_context3.prev=4,_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-resubmission",{msisdn:msisdn}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submitted",{msisdn:msisdn}),_context3.next=9,(0,_utils2.default)(window,config,msisdn,extraParams);case 9:msisdnSubmissionResult=_context3.sent,dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Success({})})}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","msisdn-submission-success",{msisdn:msisdn}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.NothingYet(),data:{actualPIN:"SingleMSISDNSubmissionResult"===msisdnSubmissionResult.type?msisdnSubmissionResult.pin:null,nextAction:"submitPinAction",msisdn:msisdn}})}),_context3.next=21;break;case 15:_context3.prev=15,_context3.t0=_context3["catch"](4),console.warn(_context3.t0),errorType="AlreadySubscribed"===_context3.t0.type?"AlreadySubscribed":"InvalidMSISDN"===_context3.t0.type?"InvalidMSISDN":"UnknownError",_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:errorType||"UnknownError"}),dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:errorType,error:_context3.t0,productUrl:_context3.t0.productUrl})})});case 21:_context3.next=26;break;case 23:throw dispatch({type:"PIN_FLOW_MSISDN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"MSISDNEntry",result:RDS.Failure({errorType:"UnknownError",error:null})})}),_strategy.tracker.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:msisdn,errorType:"UnexpectedState"}),new Error("Unexpected state");case 26:case"end":return _context3.stop();}},_callee3,null,[[4,15]])}));return function(_x5,_x6){return _ref3.apply(this,arguments)}}()}function submitPinAction(msisdn,pin,extraParams){return function(){var _ref4=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(dispatch,store){var currentState,pinFlowCurrentState,config,result,errorType;return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:if(currentState=store().strategy.currentState,pinFlowCurrentState=store().pinFlow.currentState,_context4.prev=2,dispatch({type:"PIN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Loading()})}),_strategy.tracker.advancedInFlow("tallyman.v1-pin","pin-submitted",{msisdn:msisdn,pin:pin}),"PIN"!==currentState.type){_context4.next=18;break}return config=currentState.result.config,_context4.next=9,(0,_utils2.submitPIN)(window,pin,config,extraParams);case 9:if(result=_context4.sent,_strategy.tracker.advancedInFlow("tallyman.v1-pin","pin-submission-success",{msisdn:msisdn,pin:pin,finalUrl:result.productUrl}),result.gatewayRedirectUrl&&""!==result.gatewayRedirectUrl&&(_strategy.tracker.advancedInFlow("tallyman.v1-pin","gateway-redirect",{msisdn:msisdn,pin:pin,gatewayRedirectUrl:result.gatewayRedirectUrl}),window.location.href=result.gatewayRedirectUrl),!(extraParams&&extraParams.storeMsisdn&&"true"===extraParams.storeMsisdn)){_context4.next=15;break}return _context4.next=15,(0,_storeMsisdn.storeMsisdn)(msisdn).then(function(data){data&&data.data&&data.data.success?_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-success"):_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-failed")}).catch(function(error){_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-error",error)});case 15:dispatch({type:"PIN_SUBMIT",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Success({finalUrl:result.productUrl,isAlreadySubscribed:result.isAlreadySubscribed||!1})})}),_context4.next=21;break;case 18:throw _strategy.tracker.recedeInFlow("tallyman.v1-pin","pin-submission-failure",{msisdn:msisdn,pin:pin}),dispatch({type:"PIN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Failure({errorType:"UnexpectedState"})})}),new Error("Unexpected state");case 21:_context4.next=30;break;case 23:_context4.prev=23,_context4.t0=_context4["catch"](2),console.error(_context4.t0),errorType=_context4.t0.type||"UnknownError",_strategy.tracker.recedeInFlow("tallyman.v1-pin","pin-submission-failure",{msisdn:msisdn,pin:pin,productUrl:_context4.t0.productUrl}),dispatch({type:"PIN_SUBMIT_ERROR",payload:_objectSpread(_objectSpread({},pinFlowCurrentState),{},{type:"PINEntry",result:RDS.Failure({errorType:errorType,productUrl:_context4.t0.productUrl})})}),setTimeout(function(){_context4.t0.productUrl&&(window.location.href=_context4.t0.productUrl)},0);case 30:case"end":return _context4.stop();}},_callee4,null,[[2,23]])}));return function(_x7,_x8){return _ref4.apply(this,arguments)}}()}function mockPinFlow(mockState){return function(dispatch){var _window2,pinPageEvent=new Event("onPinPage");if(mockState!==void 0)switch(mockState){case"msisdn-failure-state":return dispatch({type:"MOCK_PIN_FLOW_STATE",payload:_utils2.mockedMSISDNEntryFailure.currentState});case"pin-state":return null===(_window2=window)||void 0===_window2?void 0:_window2.dispatchEvent(pinPageEvent),dispatch({type:"MOCK_PIN_FLOW_STATE",payload:_utils2.mockedPINState.currentState});case"completed-state":return dispatch({type:"MOCK_PIN_FLOW_STATE",payload:_utils2.mockedCompletedState.currentState});default:throw new Error("Mock Flow not supported");}}}function backToStart(){return _strategy.tracker.recedeInFlow("tallyman.v1-pin","pin-submission-backtostart","requested to change phone number"),{type:"BACK_TO_START",payload:{type:"MSISDNEntry",result:RDS.NothingYet()}}}var getInitialState=function getInitialState(){var search=(0,_utils.searchToObject)(),isPinEntryStep=search["show-pin-entry"]&&"1"===search["show-pin-entry"],isShowThankYouStep=search["show-thank-you"]&&"1"===search["show-thank-you"],isShowCustomError=search.show_custom_error&&"1"===search.show_custom_error,initialStateDefault={currentState:{type:"MSISDNEntry",result:RDS.NothingYet()}},msisdnError={currentState:{type:"MSISDNEntry",result:RDS.Failure({errorType:"SomethingWentWrong",error:null})}},thankYouState={currentState:{type:"PINEntry",result:RDS.Success({finalUrl:(null===search||void 0===search?void 0:search.product_url)||""}),data:{nextAction:"submitPinAction",msisdn:(null===search||void 0===search?void 0:search.msisdn)||"",operator:(null===search||void 0===search?void 0:search.operator)||""}}},initalPinEntryState={currentState:{type:"PINEntry",result:RDS.NothingYet(),data:{nextAction:"submitPinAction",msisdn:(null===search||void 0===search?void 0:search.msisdn)||"",operator:(null===search||void 0===search?void 0:search.operator)||""}}};return isPinEntryStep?initalPinEntryState:isShowThankYouStep?thankYouState:isShowCustomError?msisdnError:initialStateDefault},initialState=getInitialState(),PinFlowActionMaps={submitMSISDNAction:submitMSISDNAction,submitPinAction:submitPinAction};exports.PinFlowActionMaps=PinFlowActionMaps;function PinFlowReducer(){var state=0<arguments.length&&arguments[0]!==void 0?arguments[0]:initialState,action=1<arguments.length?arguments[1]:void 0;switch(action.type){case"PIN_FLOW_MSISDN_SUBMIT":return(0,_strategy.genericHandler)(state,action.payload);case"PIN_FLOW_MSISDN_SUBMIT_ERROR":return(0,_strategy.genericHandler)(state,action.payload);case"PIN_SUBMIT":return(0,_strategy.genericHandler)(state,action.payload);case"BACK_TO_START":return(0,_strategy.genericHandler)(state,action.payload);case"PIN_SUBMIT_ERROR":return(0,_strategy.genericHandler)(state,action.payload);case"MOCK_PIN_FLOW_STATE":return(0,_strategy.genericHandler)(state,action.payload);default:return state;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.symbol.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.weak-map.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=submitMSISDN,exports.loadMcpShield=loadMcpShield,exports.mockedPINState=exports.mockedMSISDNEntryFailure=exports.mockedCompletedState=void 0,exports.submitPIN=submitPIN,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.match.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.array.find.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_utilities=require("../../utilities"),_loadScriptInnerHtml=_interopRequireDefault(require("../../utilities/loadScriptInnerHtml")),_utils=require("../strategy/utils");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _regeneratorRuntime(){"use strict";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}(innerFn,self,context),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(void 0===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method")}return ContinueSentinel}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(object){var keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}function submitMSISDN(){return _submitMSISDN.apply(this,arguments)}function _submitMSISDN(){return _submitMSISDN=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(window,maybeConfig,internationalMSISDN,extraParams){var config;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig||{}),!0!==config.automaticallySubmitAllOperators||!config.operators||!(0<config.operators.length)){_context.next=3;break}return _context.abrupt("return",submitMSISDNForMultipleOperators(window,config,internationalMSISDN,config.operators,extraParams));case 3:return _context.abrupt("return",submitMSISDNOnce(window,config,internationalMSISDN,extraParams));case 4:case"end":return _context.stop();}},_callee)})),_submitMSISDN.apply(this,arguments)}var uniqidResult="";function loadMcpShield(_x5,_x6){return _loadMcpShield.apply(this,arguments)}function _loadMcpShield(){return _loadMcpShield=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(window,config){var slug,country,device,host,offer,rockmanId,mcpShieldResult;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:if(!config){_context2.next=20;break}return slug=config.slug,country=config.country,device=config.device,host=config.host,offer=window.pac_analytics.visitor.offer,rockmanId=window.pac_analytics.visitor.rockmanId,_context2.prev=4,_context2.next=7,window.tallymanApi.mcpShield(host,country,slug,device,offer,rockmanId);case 7:if(mcpShieldResult=_context2.sent,!1!==mcpShieldResult.success){_context2.next=12;break}console.warn(mcpShieldResult.message),_context2.next=15;break;case 12:return(0,_loadScriptInnerHtml.default)(mcpShieldResult.source),uniqidResult=mcpShieldResult.uniqid,_context2.abrupt("return",mcpShieldResult);case 15:_context2.next=20;break;case 17:_context2.prev=17,_context2.t0=_context2["catch"](4),console.warn(_context2.t0);case 20:case"end":return _context2.stop();}},_callee2,null,[[4,17]])})),_loadMcpShield.apply(this,arguments)}function submitMSISDNOnce(_x7,_x8,_x9,_x10){return _submitMSISDNOnce.apply(this,arguments)}function _submitMSISDNOnce(){return _submitMSISDNOnce=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(window,config,internationalMSISDN,extraParams){var submissionError,newExtraParams,isSkipValidation,searchObj,msisdn,rockmanId,supportedSlugs,identifiedUser,slug,country,device,offer,host,search,extraParamsQs,uniqid,evinaTid,result,error,codesWithMcpShied,mcpShieldResult;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:if(internationalMSISDN||!1!==(0,_utilities.isCookieExists)("OMEU")){_context3.next=4;break}throw submissionError=new Error("Error in submitMSISDN() trigger-pin action"),submissionError.type="InvalidMSISDN",submissionError;case 4:if(newExtraParams=extraParams||{},isSkipValidation=!1,searchObj=(0,_utils.searchToObject)(),"true"===(null===searchObj||void 0===searchObj?void 0:searchObj.success)&&"1"===searchObj["msisdn-alias"]&&(newExtraParams["skip-validation"]="1"),"1"===newExtraParams["skip-validation"]&&(isSkipValidation=!0),msisdn=isSkipValidation?internationalMSISDN:internationalMSISDN.match(/\d+/gi).join(""),rockmanId=window.pac_analytics.visitor.rockmanId,supportedSlugs={"kuwait-agency-mix-gamezone-puzzle1":"kuwait-agency-mix-gamezone-puzzle1","kuwait-agency-mix-yourspot-riddles":"kuwait-agency-mix-yourspot-riddles"},!("k2"===config.country.toLowerCase()&&supportedSlugs[config.slug])){_context3.next=17;break}return _context3.next=15,window.tallymanApi.identify(config.host,config.slug,config.country,msisdn,config.device,config.offer,rockmanId);case 15:identifiedUser=_context3.sent,identifiedUser.operator&&"K2_ZAIN"===identifiedUser.operator&&(window.hostCountry="KW",window.hostSlug="kw-mt2-hosted-flow-mobfun",config.country=window.hostCountry,config.slug=window.hostSlug);case 17:return slug=config.slug,country=config.country,device=config.device,offer=config.offer,host=config.host,search=-1===window.location.search.indexOf("redirect-back=1")?window.location.search.substr(1)||"":"",extraParamsQs="&".concat(Object.keys(newExtraParams).map(function(k){return"".concat(k,"=").concat(newExtraParams[k])}).join("&")),uniqid=uniqidResult&&""!==uniqidResult?"&mcpUniqid=".concat(uniqidResult):"",evinaTid="undefined"!=typeof window&&window.tid?window.tid:"",_context3.next=24,window.tallymanApi.triggerPin(host,country,slug,device,offer,msisdn,rockmanId,extraParamsQs,search,uniqid,evinaTid);case 24:if(result=_context3.sent,!1!==result.success){_context3.next=33;break}throw error=new Error("Error in submitMSISDN() trigger-pin action:\n".concat(result.message)),error.type="ALREADY SUBSCRIBED"===result.message?"AlreadySubscribed":"InvalidMSISDN",error.productUrl=result.product_url?result.product_url:"",console.error(error),error;case 33:if(window.operator=result.operator,codesWithMcpShied={kw:{kw_viva:"kw_viva"},k2:{k2_viva:"k2_viva"},bh:{bh_viva:"bh_viva"}},!(country&&result.operator&&(codesWithMcpShied[country.toLowerCase()]&&codesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()]||"iq"===country.toLowerCase())&&!window.isCallBlockApi&&!window.Empello)){_context3.next=46;break}return _context3.prev=36,_context3.next=39,window.tallymanApi.mcpShield(host,country,slug,device,offer,rockmanId,result.operator,uniqid);case 39:mcpShieldResult=_context3.sent,!1===mcpShieldResult.success?console.warn(mcpShieldResult.message):((0,_loadScriptInnerHtml.default)(mcpShieldResult.source),uniqidResult=mcpShieldResult.uniqid),_context3.next=46;break;case 43:_context3.prev=43,_context3.t0=_context3["catch"](36),console.warn(_context3.t0);case 46:return result.javascript&&(0,_loadScriptInnerHtml.default)(result.javascript),_context3.abrupt("return",{type:"SingleMSISDNSubmissionResult",pin:result.pin,uniqidResult:uniqidResult,operator:result.operator,redirectUrl:null===result||void 0===result?void 0:result.redirect_to_url});case 48:case"end":return _context3.stop();}},_callee3,null,[[36,43]])})),_submitMSISDNOnce.apply(this,arguments)}function submitMSISDNForMultipleOperators(_x11,_x12,_x13,_x14,_x15){return _submitMSISDNForMultipleOperators.apply(this,arguments)}function _submitMSISDNForMultipleOperators(){return _submitMSISDNForMultipleOperators=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(window,config,internationalMSISDN,operators,extraParams){var results,alreadySubscribed;return _regeneratorRuntime().wrap(function _callee5$(_context5){for(;1;)switch(_context5.prev=_context5.next){case 0:return _context5.next=2,Promise.all(operators.map(function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(o){var singleResult;return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:return _context4.prev=0,_context4.next=3,submitMSISDNOnce(window,config,internationalMSISDN,_objectSpread(_objectSpread({},extraParams),{},{operator:o}));case 3:return singleResult=_context4.sent,_context4.abrupt("return",(0,_utils.right)(_objectSpread(_objectSpread({},singleResult),{},{operator:o})));case 7:return _context4.prev=7,_context4.t0=_context4["catch"](0),_context4.abrupt("return",(0,_utils.left)(_context4.t0));case 10:case"end":return _context4.stop();}},_callee4,null,[[0,7]])}));return function(_x20){return _ref.apply(this,arguments)}}()));case 2:if(results=_context5.sent,alreadySubscribed=results.find(function(r){return"left"===r.type&&"AlreadySubscribed"===r.value.type}),!results.every(function(r){return"left"===r.type})){_context5.next=8;break}throw results[0].value;case 8:if(!alreadySubscribed){_context5.next=12;break}throw alreadySubscribed.value;case 12:return _context5.abrupt("return",{type:"MultiOperatorMSISDNSubmissionResult"});case 13:case"end":return _context5.stop();}},_callee5)})),_submitMSISDNForMultipleOperators.apply(this,arguments)}function submitPIN(_x16,_x17,_x18,_x19){return _submitPIN.apply(this,arguments)}function _submitPIN(){return _submitPIN=_asyncToGenerator(_regeneratorRuntime().mark(function _callee6(window,pin,config,extraParams){var slug,country,device,host,offer,newExtraParams,searchObj,extraParamsQs,rockmanId,emptyPinError,uniqid,evinaTid,pinResult,pinErrorTypeMap,errorMessage,pinError,check,checkResult,isAlreadySubscribed,_pinError,_isAlreadySubscribed;return _regeneratorRuntime().wrap(function _callee6$(_context6){for(;1;)switch(_context6.prev=_context6.next){case 0:if(window.hostCountry&&window.hostSlug&&(config.country=window.hostCountry,config.slug=window.hostSlug),slug=config.slug,country=config.country,device=config.device,host=config.host,offer=window.pac_analytics.visitor.offer,newExtraParams=extraParams||{},searchObj=(0,_utils.searchToObject)(),"true"===(null===searchObj||void 0===searchObj?void 0:searchObj.success)&&"1"===searchObj["msisdn-alias"]&&(newExtraParams["skip-validation"]="1"),extraParamsQs=newExtraParams?"&".concat(Object.keys(newExtraParams).map(function(k){return"".concat(k,"=").concat(newExtraParams[k])}).join("&")):"",rockmanId=window.pac_analytics.visitor.rockmanId,pin){_context6.next=12;break}throw emptyPinError=new Error("Error in submitMSISDN() verify-pin action:\n Pin Cannot Be Empty"),emptyPinError.type="InvalidPIN",emptyPinError;case 12:return uniqid=""===uniqidResult?"":"&mcpUniqid=".concat(uniqidResult),evinaTid="undefined"!=typeof window&&window.tid?window.tid:"",_context6.next=16,window.tallymanApi.verifyPin(host,country,slug,device,offer,rockmanId,pin,extraParamsQs,uniqid,evinaTid);case 16:if(pinResult=_context6.sent,!1!==pinResult.success){_context6.next=25;break}throw pinErrorTypeMap={"pin does not match":"InvalidPIN","mcp blocked":"SessionBlocked"},errorMessage=pinErrorTypeMap[pinResult.message],pinError=new Error("Error in submitMSISDN() verify-pin action:\n".concat(errorMessage)),pinError.type=errorMessage||"InvalidPIN",pinError;case 25:if(!0!==pinResult.async){_context6.next=40;break}if(!(pinResult.product_url&&""!==pinResult.product_url&&"es"===(null===country||void 0===country?void 0:country.toLowerCase()))){_context6.next=28;break}return _context6.abrupt("return",{gatewayRedirectUrl:pinResult.product_url});case 28:return check=function check(){return window.tallymanApi.checkSubscription(host,country,slug,device,offer,rockmanId,pin,extraParamsQs)},_context6.next=31,(0,_utils.loop)(check,100,function(r){return r.success},0);case 31:if(checkResult=_context6.sent,!0!==checkResult.success){_context6.next=35;break}return isAlreadySubscribed="ALREADY SUBSCRIBED"===pinResult.message,_context6.abrupt("return",{productUrl:checkResult.product_url||null,isAlreadySubscribed:isAlreadySubscribed});case 35:throw _pinError=new Error("Error in submitMSISDN() verify-pin action:\n".concat(checkResult.message)),_pinError.type="InvalidPIN",_pinError;case 40:return _isAlreadySubscribed="ALREADY SUBSCRIBED"===pinResult.message,_context6.abrupt("return",{productUrl:pinResult.product_url||null,isAlreadySubscribed:_isAlreadySubscribed});case 42:case"end":return _context6.stop();}},_callee6)})),_submitPIN.apply(this,arguments)}var mockedPINState={currentState:{type:"PINEntry",result:RDS.NothingYet(),data:{actualPIN:"",nextAction:"submitPinAction",msisdn:""}}};exports.mockedPINState=mockedPINState;var mockedCompletedState={currentState:{type:"PINEntry",result:RDS.Success({finalUrl:""}),data:{actualPIN:"",nextAction:"submitPinAction",msisdn:""}}};exports.mockedCompletedState=mockedCompletedState;var mockedMSISDNEntryFailure={currentState:{type:"MSISDNEntry",result:RDS.Failure({errorType:"InvalidMSISDN",error:"Invalid Mobile Number"})}};exports.mockedMSISDNEntryFailure=mockedMSISDNEntryFailure;
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.symbol.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.weak-map.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=submitMSISDN,exports.loadMcpShield=loadMcpShield,exports.mockedPINState=exports.mockedMSISDNEntryFailure=exports.mockedCompletedState=void 0,exports.submitPIN=submitPIN,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.match.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.array.find.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_utilities=require("../../utilities"),_loadScriptInnerHtml=_interopRequireDefault(require("../../utilities/loadScriptInnerHtml")),_utils=require("../strategy/utils");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _regeneratorRuntime(){"use strict";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}(innerFn,self,context),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(void 0===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method")}return ContinueSentinel}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(object){var keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable})),keys.push.apply(keys,symbols)}return keys}function _objectSpread(target){for(var source,i=1;i<arguments.length;i++)source=null==arguments[i]?{}:arguments[i],i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key])}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key))});return target}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}function submitMSISDN(){return _submitMSISDN.apply(this,arguments)}function _submitMSISDN(){return _submitMSISDN=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(window,maybeConfig,internationalMSISDN,extraParams){var config;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig||{}),!0!==config.automaticallySubmitAllOperators||!config.operators||!(0<config.operators.length)){_context.next=3;break}return _context.abrupt("return",submitMSISDNForMultipleOperators(window,config,internationalMSISDN,config.operators,extraParams));case 3:return _context.abrupt("return",submitMSISDNOnce(window,config,internationalMSISDN,extraParams));case 4:case"end":return _context.stop();}},_callee)})),_submitMSISDN.apply(this,arguments)}var uniqidResult="";function loadMcpShield(_x5,_x6){return _loadMcpShield.apply(this,arguments)}function _loadMcpShield(){return _loadMcpShield=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(window,config){var slug,country,device,host,offer,rockmanId,mcpShieldResult;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:if(!config){_context2.next=20;break}return slug=config.slug,country=config.country,device=config.device,host=config.host,offer=window.pac_analytics.visitor.offer,rockmanId=window.pac_analytics.visitor.rockmanId,_context2.prev=4,_context2.next=7,window.tallymanApi.mcpShield(host,country,slug,device,offer,rockmanId);case 7:if(mcpShieldResult=_context2.sent,!1!==mcpShieldResult.success){_context2.next=12;break}console.warn(mcpShieldResult.message),_context2.next=15;break;case 12:return(0,_loadScriptInnerHtml.default)(mcpShieldResult.source),uniqidResult=mcpShieldResult.uniqid,_context2.abrupt("return",mcpShieldResult);case 15:_context2.next=20;break;case 17:_context2.prev=17,_context2.t0=_context2["catch"](4),console.warn(_context2.t0);case 20:case"end":return _context2.stop();}},_callee2,null,[[4,17]])})),_loadMcpShield.apply(this,arguments)}function submitMSISDNOnce(_x7,_x8,_x9,_x10){return _submitMSISDNOnce.apply(this,arguments)}function _submitMSISDNOnce(){return _submitMSISDNOnce=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(window,config,internationalMSISDN,extraParams){var submissionError,newExtraParams,isSkipValidation,searchObj,msisdn,rockmanId,supportedSlugs,identifiedUser,slug,country,device,offer,host,search,extraParamsQs,uniqid,evinaTid,result,error,codesWithMcpShied,mcpShieldResult;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:if(internationalMSISDN||!1!==(0,_utilities.isCookieExists)("OMEU")){_context3.next=4;break}throw submissionError=new Error("Error in submitMSISDN() trigger-pin action"),submissionError.type="InvalidMSISDN",submissionError;case 4:if(newExtraParams=extraParams||{},isSkipValidation=!1,searchObj=(0,_utils.searchToObject)(),"true"===(null===searchObj||void 0===searchObj?void 0:searchObj.success)&&"1"===searchObj["msisdn-alias"]&&(newExtraParams["skip-validation"]="1"),"1"===newExtraParams["skip-validation"]&&(isSkipValidation=!0),msisdn=isSkipValidation?internationalMSISDN:internationalMSISDN.match(/\d+/gi).join(""),rockmanId=window.pac_analytics.visitor.rockmanId,supportedSlugs={"kuwait-agency-mix-gamezone-puzzle1":"kuwait-agency-mix-gamezone-puzzle1","kuwait-agency-mix-yourspot-riddles":"kuwait-agency-mix-yourspot-riddles"},!("k2"===config.country.toLowerCase()&&supportedSlugs[config.slug])){_context3.next=17;break}return _context3.next=15,window.tallymanApi.identify(config.host,config.slug,config.country,msisdn,config.device,config.offer,rockmanId);case 15:identifiedUser=_context3.sent,identifiedUser.operator&&"K2_ZAIN"===identifiedUser.operator&&(window.hostCountry="KW",window.hostSlug="kw-mt2-hosted-flow-mobfun",config.country=window.hostCountry,config.slug=window.hostSlug);case 17:return slug=config.slug,country=config.country,device=config.device,offer=config.offer,host=config.host,search=-1===window.location.search.indexOf("redirect-back=1")?window.location.search.substr(1)||"":"",extraParamsQs="&".concat(Object.keys(newExtraParams).map(function(k){return"".concat(k,"=").concat(newExtraParams[k])}).join("&")),uniqid=uniqidResult&&""!==uniqidResult?"&mcpUniqid=".concat(uniqidResult):"",evinaTid="undefined"!=typeof window&&window.tid?window.tid:"",_context3.next=24,window.tallymanApi.triggerPin(host,country,slug,device,offer,msisdn,rockmanId,extraParamsQs,search,uniqid,evinaTid);case 24:if(result=_context3.sent,!1!==result.success){_context3.next=33;break}throw error=new Error("Error in submitMSISDN() trigger-pin action:\n".concat(result.message)),error.type="ALREADY SUBSCRIBED"===result.message?"AlreadySubscribed":"InvalidMSISDN",error.productUrl=result.product_url?result.product_url:"",console.error(error),error;case 33:if(window.operator=result.operator,codesWithMcpShied={kw:{kw_viva:"kw_viva"},k2:{k2_viva:"k2_viva"},bh:{bh_viva:"bh_viva"}},!(country&&result.operator&&(codesWithMcpShied[country.toLowerCase()]&&codesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()]||"iq"===country.toLowerCase())&&!window.isCallBlockApi&&!window.Empello)){_context3.next=46;break}return _context3.prev=36,_context3.next=39,window.tallymanApi.mcpShield(host,country,slug,device,offer,rockmanId,result.operator,uniqid);case 39:mcpShieldResult=_context3.sent,!1===mcpShieldResult.success?console.warn(mcpShieldResult.message):((0,_loadScriptInnerHtml.default)(mcpShieldResult.source),uniqidResult=mcpShieldResult.uniqid),_context3.next=46;break;case 43:_context3.prev=43,_context3.t0=_context3["catch"](36),console.warn(_context3.t0);case 46:return result.javascript&&(0,_loadScriptInnerHtml.default)(result.javascript),_context3.abrupt("return",{type:"SingleMSISDNSubmissionResult",pin:result.pin,uniqidResult:uniqidResult,operator:result.operator,redirectUrl:null===result||void 0===result?void 0:result.redirect_to_url});case 48:case"end":return _context3.stop();}},_callee3,null,[[36,43]])})),_submitMSISDNOnce.apply(this,arguments)}function submitMSISDNForMultipleOperators(_x11,_x12,_x13,_x14,_x15){return _submitMSISDNForMultipleOperators.apply(this,arguments)}function _submitMSISDNForMultipleOperators(){return _submitMSISDNForMultipleOperators=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(window,config,internationalMSISDN,operators,extraParams){var results,alreadySubscribed;return _regeneratorRuntime().wrap(function _callee5$(_context5){for(;1;)switch(_context5.prev=_context5.next){case 0:return _context5.next=2,Promise.all(operators.map(function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(o){var singleResult;return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:return _context4.prev=0,_context4.next=3,submitMSISDNOnce(window,config,internationalMSISDN,_objectSpread(_objectSpread({},extraParams),{},{operator:o}));case 3:return singleResult=_context4.sent,_context4.abrupt("return",(0,_utils.right)(_objectSpread(_objectSpread({},singleResult),{},{operator:o})));case 7:return _context4.prev=7,_context4.t0=_context4["catch"](0),_context4.abrupt("return",(0,_utils.left)(_context4.t0));case 10:case"end":return _context4.stop();}},_callee4,null,[[0,7]])}));return function(_x20){return _ref.apply(this,arguments)}}()));case 2:if(results=_context5.sent,alreadySubscribed=results.find(function(r){return"left"===r.type&&"AlreadySubscribed"===r.value.type}),!results.every(function(r){return"left"===r.type})){_context5.next=8;break}throw results[0].value;case 8:if(!alreadySubscribed){_context5.next=12;break}throw alreadySubscribed.value;case 12:return _context5.abrupt("return",{type:"MultiOperatorMSISDNSubmissionResult"});case 13:case"end":return _context5.stop();}},_callee5)})),_submitMSISDNForMultipleOperators.apply(this,arguments)}function submitPIN(_x16,_x17,_x18,_x19){return _submitPIN.apply(this,arguments)}function _submitPIN(){return _submitPIN=_asyncToGenerator(_regeneratorRuntime().mark(function _callee6(window,pin,config,extraParams){var slug,country,device,host,offer,newExtraParams,searchObj,extraParamsQs,rockmanId,emptyPinError,uniqid,evinaTid,pinResult,pinErrorTypeMap,errorMessage,pinError,check,checkResult,isAlreadySubscribed,_pinError,_isAlreadySubscribed;return _regeneratorRuntime().wrap(function _callee6$(_context6){for(;1;)switch(_context6.prev=_context6.next){case 0:if(window.hostCountry&&window.hostSlug&&(config.country=window.hostCountry,config.slug=window.hostSlug),slug=config.slug,country=config.country,device=config.device,host=config.host,offer=window.pac_analytics.visitor.offer,newExtraParams=extraParams||{},searchObj=(0,_utils.searchToObject)(),"true"===(null===searchObj||void 0===searchObj?void 0:searchObj.success)&&"1"===searchObj["msisdn-alias"]&&(newExtraParams["skip-validation"]="1"),extraParamsQs=newExtraParams?"&".concat(Object.keys(newExtraParams).map(function(k){return"".concat(k,"=").concat(newExtraParams[k])}).join("&")):"",rockmanId=window.pac_analytics.visitor.rockmanId,pin){_context6.next=12;break}throw emptyPinError=new Error("Error in submitMSISDN() verify-pin action:\n Pin Cannot Be Empty"),emptyPinError.type="InvalidPIN",emptyPinError;case 12:return uniqid=""===uniqidResult?"":"&mcpUniqid=".concat(uniqidResult),evinaTid="undefined"!=typeof window&&window.tid?window.tid:"",_context6.next=16,window.tallymanApi.verifyPin(host,country,slug,device,offer,rockmanId,pin,extraParamsQs,uniqid,evinaTid);case 16:if(pinResult=_context6.sent,!1!==pinResult.success){_context6.next=25;break}throw pinErrorTypeMap={"pin does not match":"InvalidPIN","mcp blocked":"SessionBlocked"},errorMessage=pinErrorTypeMap[pinResult.message],pinError=new Error("Error in submitMSISDN() verify-pin action:\n".concat(errorMessage)),pinError.type=errorMessage||"InvalidPIN",pinError;case 25:if(!0!==pinResult.async){_context6.next=40;break}if(!(pinResult.product_url&&""!==pinResult.product_url&&"es"===(null===country||void 0===country?void 0:country.toLowerCase()))){_context6.next=28;break}return _context6.abrupt("return",{gatewayRedirectUrl:pinResult.product_url});case 28:return check=function check(){return window.tallymanApi.checkSubscription(host,country,slug,device,offer,rockmanId,pin,extraParamsQs)},_context6.next=31,(0,_utils.loop)(check,100,function(r){return r.success},0);case 31:if(checkResult=_context6.sent,!0!==checkResult.success){_context6.next=35;break}return isAlreadySubscribed="ALREADY SUBSCRIBED"===pinResult.message,_context6.abrupt("return",{productUrl:checkResult.product_url||null,isAlreadySubscribed:isAlreadySubscribed});case 35:throw _pinError=new Error("Error in submitMSISDN() verify-pin action:\n".concat(checkResult.message)),_pinError.type="InvalidPIN",_pinError;case 40:return _isAlreadySubscribed="ALREADY SUBSCRIBED"===pinResult.message,_context6.abrupt("return",{productUrl:pinResult.product_url||null,isAlreadySubscribed:_isAlreadySubscribed});case 42:case"end":return _context6.stop();}},_callee6)})),_submitPIN.apply(this,arguments)}var mockedPINState={currentState:{type:"PINEntry",result:RDS.NothingYet(),data:{actualPIN:"",nextAction:"submitPinAction",msisdn:""}}};exports.mockedPINState=mockedPINState;var mockedCompletedState={currentState:{type:"PINEntry",result:RDS.Success({finalUrl:"https://google.com"}),data:{actualPIN:"",nextAction:"submitPinAction",msisdn:""}}};exports.mockedCompletedState=mockedCompletedState;var mockedMSISDNEntryFailure={currentState:{type:"MSISDNEntry",result:RDS.Failure({errorType:"InvalidMSISDN",error:"Invalid Mobile Number"})}};exports.mockedMSISDNEntryFailure=mockedMSISDNEntryFailure;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=injectHeaderEnrichmentScript,require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js");var _=require(".."),_loadScriptSrc=_interopRequireDefault(require("../../../utilities/loadScriptSrc")),_ask_mobile_number=_interopRequireWildcard(require("./ask_mobile_number"));function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _regeneratorRuntime(){"use strict";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}(innerFn,self,context),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(void 0===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method")}return ContinueSentinel}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(object){var keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}function injectHeaderEnrichmentScript(){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch){var _window,_window$pac_analytics,_window$pac_analytics2,_window$pac_analytics3,_window2,_window2$pac_analytic,_window2$pac_analytic2,_window3,_window3$pac_analytic,_window3$pac_analytic2,_window4,_window4$pac_analytic,_window4$pac_analytic2,gateway,heMsisdn,heOperator,page,msisdnDetected,timerExpired,timerId,abTestPages,_window5,_window5$pac_analytic,_window5$pac_analytic2,_window6,_window6$pac_analytic,_window6$pac_analytic2,url,_window7,_window7$pac_analytic,_window7$pac_analytic2,_window7$pac_analytic3,_window8,_window8$TPay,_window8$TPay$HeaderE,isEnriched,heMsisdnTpay,operatorCode,operatorCodeMapping;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:try{if(gateway=null===(_window=window)||void 0===_window||null===(_window$pac_analytics=_window.pac_analytics)||void 0===_window$pac_analytics||null===(_window$pac_analytics2=_window$pac_analytics.visitor)||void 0===_window$pac_analytics2||null===(_window$pac_analytics3=_window$pac_analytics2.genericJsLinkResult)||void 0===_window$pac_analytics3?void 0:_window$pac_analytics3.gateway,heMsisdn=null===(_window2=window)||void 0===_window2||null===(_window2$pac_analytic=_window2.pac_analytics)||void 0===_window2$pac_analytic||null===(_window2$pac_analytic2=_window2$pac_analytic.visitor)||void 0===_window2$pac_analytic2?void 0:_window2$pac_analytic2.heMsisdn,heOperator=null===(_window3=window)||void 0===_window3||null===(_window3$pac_analytic=_window3.pac_analytics)||void 0===_window3$pac_analytic||null===(_window3$pac_analytic2=_window3$pac_analytic.visitor)||void 0===_window3$pac_analytic2?void 0:_window3$pac_analytic2.heOperator,page=null===(_window4=window)||void 0===_window4||null===(_window4$pac_analytic=_window4.pac_analytics)||void 0===_window4$pac_analytic||null===(_window4$pac_analytic2=_window4$pac_analytic.visitor)||void 0===_window4$pac_analytic2?void 0:_window4$pac_analytic2.page,msisdnDetected=!1,timerExpired=!1,abTestPages=["ae-fl-infomedia-evina-hetest","ae-video-beyondvr-he-test","ae-video-beyondvr-3sec-hetest","ae-beyondvr-fileready-he-3sec","ae-video-beyondvr-he-timer"],abTestPages.includes(page)&&(timerId=setTimeout(function(){!1===msisdnDetected&&(timerExpired=!0,_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:"3 second timer expired"}),window.isPrelanderClicked=!0,dispatch((0,_ask_mobile_number.default)()))},3e3)),"tpay"===gateway||heMsisdn||(url="http://tallymans.activeonvr.com/tallyman/he?country=".concat(null===(_window5=window)||void 0===_window5||null===(_window5$pac_analytic=_window5.pac_analytics)||void 0===_window5$pac_analytic||null===(_window5$pac_analytic2=_window5$pac_analytic.visitor)||void 0===_window5$pac_analytic2?void 0:_window5$pac_analytic2.country,"&rockman_id=").concat(null===(_window6=window)||void 0===_window6||null===(_window6$pac_analytic=_window6.pac_analytics)||void 0===_window6$pac_analytic||null===(_window6$pac_analytic2=_window6$pac_analytic.visitor)||void 0===_window6$pac_analytic2?void 0:_window6$pac_analytic2.rockmanId),_.tracker.customEvent("Flow","advance-auto","msisdn-detection-start",{url:url}),(0,_loadScriptSrc.default)({url:url,callBack:function callBack(){_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:"Could not load script possible reason is page is https and script is http"}),dispatch((0,_ask_mobile_number.default)())}})),window.addEventListener("he-success",function(event){if(!abTestPages.includes(page)){var _ref3=event,_detail=_ref3.detail;_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:null===_detail||void 0===_detail?void 0:_detail.msisdn,operator:null===_detail||void 0===_detail?void 0:_detail.operator_code}),dispatch((0,_ask_mobile_number.submitMSISDNAction)(null===_detail||void 0===_detail?void 0:_detail.msisdn,null===_detail||void 0===_detail?void 0:_detail.operator_code))}else if(!1===timerExpired){msisdnDetected=!0,clearTimeout(timerId);var _ref2=event,detail=_ref2.detail;_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:null===detail||void 0===detail?void 0:detail.msisdn}),dispatch((0,_ask_mobile_number.submitMSISDNAction)(null===detail||void 0===detail?void 0:detail.msisdn,null===detail||void 0===detail?void 0:detail.operator_code))}}),window.addEventListener("he-fail",function(){_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:"Header enrichment failed"}),dispatch((0,_ask_mobile_number.default)())}),"tpay"===gateway)try{_.tracker.customEvent("Flow","advance-auto","msisdn-detection-start",{url:null===(_window7=window)||void 0===_window7||null===(_window7$pac_analytic=_window7.pac_analytics)||void 0===_window7$pac_analytic||null===(_window7$pac_analytic2=_window7$pac_analytic.visitor)||void 0===_window7$pac_analytic2||null===(_window7$pac_analytic3=_window7$pac_analytic2.genericJsLinkResult)||void 0===_window7$pac_analytic3?void 0:_window7$pac_analytic3.jsLink}),isEnriched=null===(_window8=window)||void 0===_window8||null===(_window8$TPay=_window8.TPay)||void 0===_window8$TPay||null===(_window8$TPay$HeaderE=_window8$TPay.HeaderEnrichment)||void 0===_window8$TPay$HeaderE?void 0:_window8$TPay$HeaderE.enriched(),isEnriched?(heMsisdnTpay=window.TPay.HeaderEnrichment.msisdn(),operatorCode=window.TPay.HeaderEnrichment.operatorCode(),operatorCodeMapping={42402:"AE_ETISALAT",42403:"AE_DU"},window.dispatchEvent(new CustomEvent("he-success",{detail:{msisdn:heMsisdnTpay,operator_code:operatorCodeMapping[operatorCode]}}))):(console.warn("Enriched() false, no msisdn, user need to submit msisdn"),_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:"Enriched() false, no msisdn, user need to submit msisdn"}),dispatch((0,_ask_mobile_number.default)()))}catch(e){console.error("Tpay Error",e),_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:null===e||void 0===e?void 0:e.message}),dispatch((0,_ask_mobile_number.default)())}heMsisdn&&window.dispatchEvent(new CustomEvent("he-success",{detail:{msisdn:heMsisdn,operator_code:heOperator}}))}catch(err){_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:null===err||void 0===err?void 0:err.message}),dispatch((0,_ask_mobile_number.default)())}case 1:case"end":return _context.stop();}},_callee)}));return function(_x){return _ref.apply(this,arguments)}}()}
|
|
1
|
+
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=injectHeaderEnrichmentScript,require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js");var _=require(".."),_loadScriptSrc=_interopRequireDefault(require("../../../utilities/loadScriptSrc")),_ask_mobile_number=_interopRequireWildcard(require("./ask_mobile_number"));function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _regeneratorRuntime(){"use strict";function define(obj,key,value){return Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}),obj[key]}function wrap(innerFn,outerFn,self,tryLocsList){var protoGenerator=outerFn&&outerFn.prototype instanceof Generator?outerFn:Generator,generator=Object.create(protoGenerator.prototype),context=new Context(tryLocsList||[]);return generator._invoke=function(innerFn,self,context){var state="suspendedStart";return function(method,arg){if("executing"===state)throw new Error("Generator is already running");if("completed"===state){if("throw"===method)throw arg;return doneResult()}for(context.method=method,context.arg=arg;;){var delegate=context.delegate;if(delegate){var delegateResult=maybeInvokeDelegate(delegate,context);if(delegateResult){if(delegateResult===ContinueSentinel)continue;return delegateResult}}if("next"===context.method)context.sent=context._sent=context.arg;else if("throw"===context.method){if("suspendedStart"===state)throw state="completed",context.arg;context.dispatchException(context.arg)}else"return"===context.method&&context.abrupt("return",context.arg);state="executing";var record=tryCatch(innerFn,self,context);if("normal"===record.type){if(state=context.done?"completed":"suspendedYield",record.arg===ContinueSentinel)continue;return{value:record.arg,done:context.done}}"throw"===record.type&&(state="completed",context.method="throw",context.arg=record.arg)}}}(innerFn,self,context),generator}function tryCatch(fn,obj,arg){try{return{type:"normal",arg:fn.call(obj,arg)}}catch(err){return{type:"throw",arg:err}}}function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}function defineIteratorMethods(prototype){["next","throw","return"].forEach(function(method){define(prototype,method,function(arg){return this._invoke(method,arg)})})}function AsyncIterator(generator,PromiseImpl){function invoke(method,arg,resolve,reject){var record=tryCatch(generator[method],generator,arg);if("throw"!==record.type){var result=record.arg,value=result.value;return value&&"object"==_typeof(value)&&hasOwn.call(value,"__await")?PromiseImpl.resolve(value.__await).then(function(value){invoke("next",value,resolve,reject)},function(err){invoke("throw",err,resolve,reject)}):PromiseImpl.resolve(value).then(function(unwrapped){result.value=unwrapped,resolve(result)},function(error){return invoke("throw",error,resolve,reject)})}reject(record.arg)}var previousPromise;this._invoke=function(method,arg){function callInvokeWithMethodAndArg(){return new PromiseImpl(function(resolve,reject){invoke(method,arg,resolve,reject)})}return previousPromise=previousPromise?previousPromise.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg()}}function maybeInvokeDelegate(delegate,context){var method=delegate.iterator[context.method];if(void 0===method){if(context.delegate=null,"throw"===context.method){if(delegate.iterator.return&&(context.method="return",context.arg=void 0,maybeInvokeDelegate(delegate,context),"throw"===context.method))return ContinueSentinel;context.method="throw",context.arg=new TypeError("The iterator does not provide a 'throw' method")}return ContinueSentinel}var record=tryCatch(method,delegate.iterator,context.arg);if("throw"===record.type)return context.method="throw",context.arg=record.arg,context.delegate=null,ContinueSentinel;var info=record.arg;return info?info.done?(context[delegate.resultName]=info.value,context.next=delegate.nextLoc,"return"!==context.method&&(context.method="next",context.arg=void 0),context.delegate=null,ContinueSentinel):info:(context.method="throw",context.arg=new TypeError("iterator result is not an object"),context.delegate=null,ContinueSentinel)}function pushTryEntry(locs){var entry={tryLoc:locs[0]};1 in locs&&(entry.catchLoc=locs[1]),2 in locs&&(entry.finallyLoc=locs[2],entry.afterLoc=locs[3]),this.tryEntries.push(entry)}function resetTryEntry(entry){var record=entry.completion||{};record.type="normal",delete record.arg,entry.completion=record}function Context(tryLocsList){this.tryEntries=[{tryLoc:"root"}],tryLocsList.forEach(pushTryEntry,this),this.reset(!0)}function values(iterable){if(iterable){var iteratorMethod=iterable[iteratorSymbol];if(iteratorMethod)return iteratorMethod.call(iterable);if("function"==typeof iterable.next)return iterable;if(!isNaN(iterable.length)){var i=-1,next=function next(){for(;++i<iterable.length;)if(hasOwn.call(iterable,i))return next.value=iterable[i],next.done=!1,next;return next.value=void 0,next.done=!0,next};return next.next=next}}return{next:doneResult}}function doneResult(){return{value:void 0,done:!0}}_regeneratorRuntime=function(){return exports};var exports={},Op=Object.prototype,hasOwn=Op.hasOwnProperty,$Symbol="function"==typeof Symbol?Symbol:{},iteratorSymbol=$Symbol.iterator||"@@iterator",asyncIteratorSymbol=$Symbol.asyncIterator||"@@asyncIterator",toStringTagSymbol=$Symbol.toStringTag||"@@toStringTag";try{define({},"")}catch(err){define=function(obj,key,value){return obj[key]=value}}exports.wrap=wrap;var ContinueSentinel={},IteratorPrototype={};define(IteratorPrototype,iteratorSymbol,function(){return this});var getProto=Object.getPrototypeOf,NativeIteratorPrototype=getProto&&getProto(getProto(values([])));NativeIteratorPrototype&&NativeIteratorPrototype!==Op&&hasOwn.call(NativeIteratorPrototype,iteratorSymbol)&&(IteratorPrototype=NativeIteratorPrototype);var Gp=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(IteratorPrototype);return GeneratorFunction.prototype=GeneratorFunctionPrototype,define(Gp,"constructor",GeneratorFunctionPrototype),define(GeneratorFunctionPrototype,"constructor",GeneratorFunction),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,toStringTagSymbol,"GeneratorFunction"),exports.isGeneratorFunction=function(genFun){var ctor="function"==typeof genFun&&genFun.constructor;return!!ctor&&(ctor===GeneratorFunction||"GeneratorFunction"===(ctor.displayName||ctor.name))},exports.mark=function(genFun){return Object.setPrototypeOf?Object.setPrototypeOf(genFun,GeneratorFunctionPrototype):(genFun.__proto__=GeneratorFunctionPrototype,define(genFun,toStringTagSymbol,"GeneratorFunction")),genFun.prototype=Object.create(Gp),genFun},exports.awrap=function(arg){return{__await:arg}},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,asyncIteratorSymbol,function(){return this}),exports.AsyncIterator=AsyncIterator,exports.async=function(innerFn,outerFn,self,tryLocsList,PromiseImpl){void 0===PromiseImpl&&(PromiseImpl=Promise);var iter=new AsyncIterator(wrap(innerFn,outerFn,self,tryLocsList),PromiseImpl);return exports.isGeneratorFunction(outerFn)?iter:iter.next().then(function(result){return result.done?result.value:iter.next()})},defineIteratorMethods(Gp),define(Gp,toStringTagSymbol,"Generator"),define(Gp,iteratorSymbol,function(){return this}),define(Gp,"toString",function(){return"[object Generator]"}),exports.keys=function(object){var keys=[];for(var key in object)keys.push(key);return keys.reverse(),function next(){for(;keys.length;){var key=keys.pop();if(key in object)return next.value=key,next.done=!1,next}return next.done=!0,next}},exports.values=values,Context.prototype={constructor:Context,reset:function reset(skipTempReset){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(resetTryEntry),!skipTempReset)for(var name in this)"t"===name.charAt(0)&&hasOwn.call(this,name)&&!isNaN(+name.slice(1))&&(this[name]=void 0)},stop:function stop(){this.done=!0;var rootRecord=this.tryEntries[0].completion;if("throw"===rootRecord.type)throw rootRecord.arg;return this.rval},dispatchException:function dispatchException(exception){function handle(loc,caught){return record.type="throw",record.arg=exception,context.next=loc,caught&&(context.method="next",context.arg=void 0),!!caught}if(this.done)throw exception;for(var context=this,i=this.tryEntries.length-1;0<=i;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0);if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(!hasCatch){if(!hasFinally)throw new Error("try statement without catch or finally");if(this.prev<entry.finallyLoc)return handle(entry.finallyLoc)}else if(this.prev<entry.catchLoc)return handle(entry.catchLoc,!0)}}},abrupt:function abrupt(type,arg){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev<entry.finallyLoc){var finallyEntry=entry;break}finallyEntry&&("break"===type||"continue"===type)&&finallyEntry.tryLoc<=arg&&arg<=finallyEntry.finallyLoc&&(finallyEntry=null);var record=finallyEntry?finallyEntry.completion:{};return record.type=type,record.arg=arg,finallyEntry?(this.method="next",this.next=finallyEntry.finallyLoc,ContinueSentinel):this.complete(record)},complete:function complete(record,afterLoc){if("throw"===record.type)throw record.arg;return"break"===record.type||"continue"===record.type?this.next=record.arg:"return"===record.type?(this.rval=this.arg=record.arg,this.method="return",this.next="end"):"normal"===record.type&&afterLoc&&(this.next=afterLoc),ContinueSentinel},finish:function finish(finallyLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel},catch:function _catch(tryLoc){for(var entry,i=this.tryEntries.length-1;0<=i;--i)if(entry=this.tryEntries[i],entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=void 0),ContinueSentinel}},exports}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}var gen=fn.apply(self,args);_next(void 0)})}}function injectHeaderEnrichmentScript(){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch){var _window,_window$pac_analytics,_window$pac_analytics2,_window$pac_analytics3,_window2,_window2$pac_analytic,_window2$pac_analytic2,_window3,_window3$pac_analytic,_window3$pac_analytic2,_window4,_window4$pac_analytic,_window4$pac_analytic2,gateway,heMsisdn,heOperator,page,msisdnDetected,timerExpired,timerId,abTestPages,_window5,_window5$pac_analytic,_window5$pac_analytic2,_window6,_window6$pac_analytic,_window6$pac_analytic2,url,_window7,_window7$pac_analytic,_window7$pac_analytic2,_window7$pac_analytic3,_window8,_window8$TPay,_window8$TPay$HeaderE,isEnriched,heMsisdnTpay,operatorCode,operatorCodeMapping;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:try{if(gateway=null===(_window=window)||void 0===_window||null===(_window$pac_analytics=_window.pac_analytics)||void 0===_window$pac_analytics||null===(_window$pac_analytics2=_window$pac_analytics.visitor)||void 0===_window$pac_analytics2||null===(_window$pac_analytics3=_window$pac_analytics2.genericJsLinkResult)||void 0===_window$pac_analytics3?void 0:_window$pac_analytics3.gateway,heMsisdn=null===(_window2=window)||void 0===_window2||null===(_window2$pac_analytic=_window2.pac_analytics)||void 0===_window2$pac_analytic||null===(_window2$pac_analytic2=_window2$pac_analytic.visitor)||void 0===_window2$pac_analytic2?void 0:_window2$pac_analytic2.heMsisdn,heOperator=null===(_window3=window)||void 0===_window3||null===(_window3$pac_analytic=_window3.pac_analytics)||void 0===_window3$pac_analytic||null===(_window3$pac_analytic2=_window3$pac_analytic.visitor)||void 0===_window3$pac_analytic2?void 0:_window3$pac_analytic2.heOperator,page=null===(_window4=window)||void 0===_window4||null===(_window4$pac_analytic=_window4.pac_analytics)||void 0===_window4$pac_analytic||null===(_window4$pac_analytic2=_window4$pac_analytic.visitor)||void 0===_window4$pac_analytic2?void 0:_window4$pac_analytic2.page,msisdnDetected=!1,timerExpired=!1,abTestPages=["ae-fl-infomedia-evina-hetest","ae-video-beyondvr-he-test","ae-video-beyondvr-3sec-hetest","ae-beyondvr-fileready-he-3sec","ae-video-beyondvr-he-timer"],abTestPages.includes(page)&&(timerId=setTimeout(function(){!1===msisdnDetected&&(timerExpired=!0,_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:"3 second timer expired"}),window.isPrelanderClicked=!0,dispatch((0,_ask_mobile_number.default)()))},3e3)),"tpay"===gateway||heMsisdn||(url="http://de-he.tallymans.com/tallyman/he?country=".concat(null===(_window5=window)||void 0===_window5||null===(_window5$pac_analytic=_window5.pac_analytics)||void 0===_window5$pac_analytic||null===(_window5$pac_analytic2=_window5$pac_analytic.visitor)||void 0===_window5$pac_analytic2?void 0:_window5$pac_analytic2.country,"&rockman_id=").concat(null===(_window6=window)||void 0===_window6||null===(_window6$pac_analytic=_window6.pac_analytics)||void 0===_window6$pac_analytic||null===(_window6$pac_analytic2=_window6$pac_analytic.visitor)||void 0===_window6$pac_analytic2?void 0:_window6$pac_analytic2.rockmanId),_.tracker.customEvent("Flow","advance-auto","msisdn-detection-start",{url:url}),(0,_loadScriptSrc.default)({url:url,callBack:function callBack(){_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:"Could not load script possible reason is page is https and script is http"}),dispatch((0,_ask_mobile_number.default)())}})),window.addEventListener("he-success",function(event){if(!abTestPages.includes(page)){var _ref3=event,_detail=_ref3.detail;_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:null===_detail||void 0===_detail?void 0:_detail.msisdn,operator:null===_detail||void 0===_detail?void 0:_detail.operator_code}),dispatch((0,_ask_mobile_number.submitMSISDNAction)(null===_detail||void 0===_detail?void 0:_detail.msisdn,null===_detail||void 0===_detail?void 0:_detail.operator_code))}else if(!1===timerExpired){msisdnDetected=!0,clearTimeout(timerId);var _ref2=event,detail=_ref2.detail;_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:null===detail||void 0===detail?void 0:detail.msisdn}),dispatch((0,_ask_mobile_number.submitMSISDNAction)(null===detail||void 0===detail?void 0:detail.msisdn,null===detail||void 0===detail?void 0:detail.operator_code))}}),window.addEventListener("he-fail",function(){_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:"Header enrichment failed"}),dispatch((0,_ask_mobile_number.default)())}),"tpay"===gateway)try{_.tracker.customEvent("Flow","advance-auto","msisdn-detection-start",{url:null===(_window7=window)||void 0===_window7||null===(_window7$pac_analytic=_window7.pac_analytics)||void 0===_window7$pac_analytic||null===(_window7$pac_analytic2=_window7$pac_analytic.visitor)||void 0===_window7$pac_analytic2||null===(_window7$pac_analytic3=_window7$pac_analytic2.genericJsLinkResult)||void 0===_window7$pac_analytic3?void 0:_window7$pac_analytic3.jsLink}),isEnriched=null===(_window8=window)||void 0===_window8||null===(_window8$TPay=_window8.TPay)||void 0===_window8$TPay||null===(_window8$TPay$HeaderE=_window8$TPay.HeaderEnrichment)||void 0===_window8$TPay$HeaderE?void 0:_window8$TPay$HeaderE.enriched(),isEnriched?(heMsisdnTpay=window.TPay.HeaderEnrichment.msisdn(),operatorCode=window.TPay.HeaderEnrichment.operatorCode(),operatorCodeMapping={42402:"AE_ETISALAT",42403:"AE_DU"},window.dispatchEvent(new CustomEvent("he-success",{detail:{msisdn:heMsisdnTpay,operator_code:operatorCodeMapping[operatorCode]}}))):(console.warn("Enriched() false, no msisdn, user need to submit msisdn"),_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:"Enriched() false, no msisdn, user need to submit msisdn"}),dispatch((0,_ask_mobile_number.default)()))}catch(e){console.error("Tpay Error",e),_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:null===e||void 0===e?void 0:e.message}),dispatch((0,_ask_mobile_number.default)())}heMsisdn&&window.dispatchEvent(new CustomEvent("he-success",{detail:{msisdn:heMsisdn,operator_code:heOperator}}))}catch(err){_.tracker.customEvent("Flow","recede-auto","msisdn-detection-failure",{errorType:null===err||void 0===err?void 0:err.message}),dispatch((0,_ask_mobile_number.default)())}case 1:case"end":return _context.stop();}},_callee)}));return function(_x){return _ref.apply(this,arguments)}}()}
|