ouisys-engine 4.1.45 → 4.1.47-alpha.0
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/creditCardFlow/utils.js +1 -1
- package/dist/reducers/moRedirFlow/utils.js +1 -1
- package/dist/reducers/oneClickFlow/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.d.ts +0 -3
- package/dist/utilities/index.js +1 -1
- package/package.json +1 -1
- package/rollup.config.mjs +27 -0
package/dist/api/index.js
CHANGED
|
@@ -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.array.from.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.RealTallyman=exports.MockTallyman=void 0,require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.entries.js"),require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.regexp.test.js"),require("core-js/modules/es.json.stringify.js");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 _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 _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)})}}var bupperizeCountry=function(c){return"gb"===c?"uk":c},logMockTallyman=function(mock){return console.log(mock)},checkIsCleanTraffic=function(country){return"be"===country?"undefined"!=typeof window&&!0===window.shouldBlock?"&is-clean-traffic=false":"&is-clean-traffic=true":""};function sleep(milliseconds){var date=Date.now(),currentDate=null;do currentDate=Date.now();while(currentDate-date<milliseconds)}var MockTallyman={identify:function(){function identify(){return _identify.apply(this,arguments)}var _identify=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context.abrupt("return",{operator:"",flow:"",success:!0,rockman_id:""});case 3:case"end":return _context.stop();}},_callee)}));return identify}(),triggerPin:function(){function triggerPin(_x8,_x9,_x10,_x11,_x12,_x13,_x14,_x15,_x16,_x17,_x18){return _triggerPin.apply(this,arguments)}var _triggerPin=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(_host,_country,_slug,_device,_offer,_msisdn,_rockmanId,_extraParams,_search,_uniqid,_evinaTid){return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context2.abrupt("return",{success:!0,operator:"",rockman_id:"",pin:"",product_url:""});case 3:case"end":return _context2.stop();}},_callee2)}));return triggerPin}(),verifyPin:function(){function verifyPin(_x19,_x20,_x21,_x22,_x23,_x24,_x25,_x26,_x27){return _verifyPin.apply(this,arguments)}var _verifyPin=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(_host,_country,_slug,_device,_offer,_rockmanId,_pin,_extraParams,_uniqid){return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context3.abrupt("return",{success:!0,rockman_id:"000",product_url:"/product",async:!1});case 3:case"end":return _context3.stop();}},_callee3)}));return verifyPin}(),checkSubscription:function(){function checkSubscription(_x28,_x29,_x30,_x31,_x32,_x33,_x34,_x35){return _checkSubscription.apply(this,arguments)}var _checkSubscription=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(_host,_country,_slug,_device,_offer,_rockmanId,_pin,extraParams){return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context4.abrupt("return",{success:!0,rockman_id:"000",product_url:"/product",msisdn:"000"});case 3:case"end":return _context4.stop();}},_callee4)}));return checkSubscription}(),checkSubscriptionByRockmanIdOnly:function(){function checkSubscriptionByRockmanIdOnly(_x36,_x37){return _checkSubscriptionByRockmanIdOnly.apply(this,arguments)}var _checkSubscriptionByRockmanIdOnly=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(_host,_rockmanId){return _regeneratorRuntime().wrap(function _callee5$(_context5){for(;1;)switch(_context5.prev=_context5.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context5.abrupt("return",{success:!0,rockman_id:"000",product_url:"/product",msisdn:"000"});case 3:case"end":return _context5.stop();}},_callee5)}));return checkSubscriptionByRockmanIdOnly}(),redirect:function(){function redirect(_x38){return _redirect.apply(this,arguments)}var _redirect=_asyncToGenerator(_regeneratorRuntime().mark(function _callee6(_ref){var host,slug,country,msisdn,device,offer,rockmanId,ip_range_name,search,extraParamsQs,email,password;return _regeneratorRuntime().wrap(function _callee6$(_context6){for(;1;)switch(_context6.prev=_context6.next){case 0:return host=_ref.host,slug=_ref.slug,country=_ref.country,msisdn=_ref.msisdn,device=_ref.device,offer=_ref.offer,rockmanId=_ref.rockmanId,ip_range_name=_ref.ip_range_name,search=_ref.search,extraParamsQs=_ref.extraParamsQs,email=_ref.email,password=_ref.password,logMockTallyman("MockTallyman"),sleep(2e3),_context6.abrupt("return",{success:!0,rockman_id:"000",redirect_url:"/product"});case 4:case"end":return _context6.stop();}},_callee6)}));return redirect}(),triggerMessage:function(){function triggerMessage(_x39,_x40,_x41,_x42,_x43,_x44,_x45,_x46,_x47){return _triggerMessage.apply(this,arguments)}var _triggerMessage=_asyncToGenerator(_regeneratorRuntime().mark(function _callee7(_host,_slug,_country,_msisdn,_device,_offer,_rockmanId,_search,_extraParamsQs){return _regeneratorRuntime().wrap(function _callee7$(_context7){for(;1;)switch(_context7.prev=_context7.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context7.abrupt("return",{success:!0,rockman_id:"0000",keyword:"TEST OK",shortcode:"777",displayKeyword:"TEST OK"});case 3:case"end":return _context7.stop();}},_callee7)}));return triggerMessage}(),ussd:function(){function ussd(_x48,_x49,_x50,_x51,_x52,_x53,_x54,_x55,_x56){return _ussd.apply(this,arguments)}var _ussd=_asyncToGenerator(_regeneratorRuntime().mark(function _callee8(_host,_slug,_country,_msisdn,_device,_offer,_rockmanId,_search,_extraParamsQs){return _regeneratorRuntime().wrap(function _callee8$(_context8){for(;1;)switch(_context8.prev=_context8.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context8.abrupt("return",{success:!0,rockman_id:"0000",keyword:"TEST OK",shortcode:"777",displayKeyword:"TEST OK"});case 3:case"end":return _context8.stop();}},_callee8)}));return ussd}(),oc2sms:function(){function oc2sms(_x57,_x58,_x59,_x60,_x61,_x62,_x63,_x64){return _oc2sms.apply(this,arguments)}var _oc2sms=_asyncToGenerator(_regeneratorRuntime().mark(function _callee9(_host,_country,_slug,_offer,_rockmanId,_keyword,_operator,_search){return _regeneratorRuntime().wrap(function _callee9$(_context9){for(;1;)switch(_context9.prev=_context9.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context9.abrupt("return",{success:!0,uid:"1",keyword:"TEST OK",displayKeyword:"TEST OK",shortcode:"777"});case 3:case"end":return _context9.stop();}},_callee9)}));return oc2sms}(),mcpShield:function(){function mcpShield(_x65,_x66,_x67,_x68,_x69,_x70,_x71){return _mcpShield.apply(this,arguments)}var _mcpShield=_asyncToGenerator(_regeneratorRuntime().mark(function _callee10(_host,_country,_slug,_device,_offer,_rockmanId,_operator){return _regeneratorRuntime().wrap(function _callee10$(_context10){for(;1;)switch(_context10.prev=_context10.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context10.abrupt("return",{source:"**********some very long text**********",uniqid:"a26e7c3983a9cebd469601d695c7dbc4",success:!0,rockman_id:"d66ac1a3ee6d40c289c23322ecd9aa79"});case 3:case"end":return _context10.stop();}},_callee10)}));return mcpShield}(),getGoogleCaptcha:function(){function getGoogleCaptcha(_x72,_x73,_x74,_x75,_x76){return _getGoogleCaptcha.apply(this,arguments)}var _getGoogleCaptcha=_asyncToGenerator(_regeneratorRuntime().mark(function _callee11(_host,_country,_slug,_device,_domain){return _regeneratorRuntime().wrap(function _callee11$(_context11){for(;1;)switch(_context11.prev=_context11.next){case 0:return _context11.abrupt("return",{site_key:"6LfMTS8fAAAAAHw-cibJXMfnsIYNpWh81GatD1lw",secret_key:"6LfMTS8fAAAAAIAET7tvHjrU-tRPGuqSdfCZZX6G",domains:"",success:!0});case 1:case"end":return _context11.stop();}},_callee11)}));return getGoogleCaptcha}(),storeEmail:function(){function storeEmail(_x77,_x78,_x79,_x80,_x81){return _storeEmail.apply(this,arguments)}var _storeEmail=_asyncToGenerator(_regeneratorRuntime().mark(function _callee12(_host,_slug,_service,_rockmanId,_email){return _regeneratorRuntime().wrap(function _callee12$(_context12){for(;1;)switch(_context12.prev=_context12.next){case 0:return _context12.abrupt("return",{success:!0});case 1:case"end":return _context12.stop();}},_callee12)}));return storeEmail}(),creditCardPayment:function creditCardPayment(_userDetails,_extraConfig){return{gateway_url:"/product",success:!0}}};exports.MockTallyman=MockTallyman;var RealTallyman={identify:function(){function identify(_x82,_x83,_x84,_x85,_x86,_x87,_x88){return _identify2.apply(this,arguments)}var _identify2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee13(host,slug,country,msisdn,device,offer,rockmanId){var _window$pac_analytics,_window$pac_analytics2,_window$pac_analytics3,_window$pac_analytics4,_window,_window$location,isDMB,newHost,languageCode;return _regeneratorRuntime().wrap(function _callee13$(_context13){for(;1;)switch(_context13.prev=_context13.next){case 0:return isDMB=null!==window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics||null===(_window$pac_analytics2=_window$pac_analytics.toLowerCase())||void 0===_window$pac_analytics2?void 0:_window$pac_analytics2.indexOf("dmb"))||(null===(_window$pac_analytics3=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics3||null===(_window$pac_analytics4=_window$pac_analytics3.toLowerCase())||void 0===_window$pac_analytics4?void 0:_window$pac_analytics4.indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,languageCode=window.languageCode?"&language_code=".concat(window.languageCode):"",_context13.abrupt("return",fetch("https://".concat(newHost,"/tallyman/v1/?action=identify&slug=").concat(slug,"&country=").concat(country,"&msisdn=").concat(msisdn,"&device=").concat(device,"&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&page=").concat(encodeURIComponent(null===(_window=window)||void 0===_window||null===(_window$location=_window.location)||void 0===_window$location?void 0:_window$location.href)).concat(languageCode)).then(function(x){return x.json()}));case 4:case"end":return _context13.stop();}},_callee13)}));return identify}(),triggerPin:function(){function triggerPin(_x89,_x90,_x91,_x92,_x93,_x94,_x95,_x96,_x97,_x98,_x99){return _triggerPin2.apply(this,arguments)}var _triggerPin2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee14(host,country,slug,device,offer,msisdn,rockmanId,extraParams,search,uniqid,evinaTid){var _window$pac_analytics5,_window$pac_analytics6,_window$pac_analytics7,_window$pac_analytics8,_window2,_window2$location,isDMB,newHost,cleanTrafficString,extraParamsQs,params,queryString,url;return _regeneratorRuntime().wrap(function _callee14$(_context14){for(;1;)switch(_context14.prev=_context14.next){case 0:return isDMB=null!==window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics5=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics5||null===(_window$pac_analytics6=_window$pac_analytics5.toLowerCase())||void 0===_window$pac_analytics6?void 0:_window$pac_analytics6.indexOf("dmb"))||(null===(_window$pac_analytics7=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics7||null===(_window$pac_analytics8=_window$pac_analytics7.toLowerCase())||void 0===_window$pac_analytics8?void 0:_window$pac_analytics8.indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,cleanTrafficString=checkIsCleanTraffic(country),extraParamsQs="&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")),params={action:"trigger-pin",country:bupperizeCountry(country),slug:slug,device:device,offerId:offer,msisdn:msisdn,rockman_id:rockmanId,sam_evina_tid:evinaTid,page:encodeURIComponent(null===(_window2=window)||void 0===_window2||null===(_window2$location=_window2.location)||void 0===_window2$location?void 0:_window2$location.href),language_code:window.languageCode||"",antifraud_id:window.antifraud_id||"",partner_transaction_id:window.partner_transaction_id||"",partner_timestamp:window.partner_timestamp||"",partner_cid:window.partner_cid||"",uniqid:uniqid||""},queryString=Object.entries(params).filter(function(_ref2){var _ref3=_slicedToArray(_ref2,2),_=_ref3[0],value=_ref3[1];return value}).map(function(_ref4){var _ref5=_slicedToArray(_ref4,2),key=_ref5[0],value=_ref5[1];return"".concat(key,"=").concat(value)}).join("&"),url="https://".concat(newHost,"/tallyman/v1/?").concat(queryString).concat(cleanTrafficString).concat(extraParamsQs,"&").concat(search),_context14.abrupt("return",fetch(url).then(function(x){return x.json()}));case 8:case"end":return _context14.stop();}},_callee14)}));return triggerPin}(),verifyPin:function(){function verifyPin(_x100,_x101,_x102,_x103,_x104,_x105,_x106,_x107,_x108,_x109){return _verifyPin2.apply(this,arguments)}var _verifyPin2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee15(host,country,slug,device,offer,rockmanId,pin,extraParams,uniqid,evinaTid){var _window$pac_analytics9,_window$pac_analytics10,_window$pac_analytics11,_window$pac_analytics12,_window3,_window3$location,isDMB,newHost,cleanTrafficString,extraParamsQs,params,queryString,url;return _regeneratorRuntime().wrap(function _callee15$(_context15){for(;1;)switch(_context15.prev=_context15.next){case 0:return isDMB=null!==window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics9=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics9||null===(_window$pac_analytics10=_window$pac_analytics9.toLowerCase())||void 0===_window$pac_analytics10?void 0:_window$pac_analytics10.indexOf("dmb"))||(null===(_window$pac_analytics11=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics11||null===(_window$pac_analytics12=_window$pac_analytics11.toLowerCase())||void 0===_window$pac_analytics12?void 0:_window$pac_analytics12.indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,cleanTrafficString=checkIsCleanTraffic(country),extraParamsQs="&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")),params={action:"verify-pin",country:bupperizeCountry(country),slug:slug,device:device,offerId:offer,rockman_id:rockmanId,pin:pin,page:encodeURIComponent(null===(_window3=window)||void 0===_window3||null===(_window3$location=_window3.location)||void 0===_window3$location?void 0:_window3$location.href),language_code:window.languageCode||"",antifraud_id:window.antifraud_id||"",ClickID:window.antifraud_click_id||"",partner_cid:window.partner_cid||"",sam_evina_tid:evinaTid,uniqid:uniqid},queryString=Object.entries(params).filter(function(_ref6){var _ref7=_slicedToArray(_ref6,2),_=_ref7[0],value=_ref7[1];return value}).map(function(_ref8){var _ref9=_slicedToArray(_ref8,2),key=_ref9[0],value=_ref9[1];return"".concat(key,"=").concat(value)}).join("&"),url="https://".concat(newHost,"/tallyman/v1/?").concat(queryString).concat(cleanTrafficString).concat(extraParamsQs),_context15.abrupt("return",fetch(url).then(function(x){return x.json()}));case 8:case"end":return _context15.stop();}},_callee15)}));return verifyPin}(),checkSubscription:function(){function checkSubscription(_x110,_x111,_x112,_x113,_x114,_x115,_x116,_x117){return _checkSubscription2.apply(this,arguments)}var _checkSubscription2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee16(host,country,slug,device,offer,rockmanId,_pin,_extraParams){var _window$pac_analytics13,_window$pac_analytics14,_window$pac_analytics15,_window$pac_analytics16,isDMB,newHost;return _regeneratorRuntime().wrap(function _callee16$(_context16){for(;1;)switch(_context16.prev=_context16.next){case 0:return isDMB=null!==window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics13=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics13||null===(_window$pac_analytics14=_window$pac_analytics13.toLowerCase())||void 0===_window$pac_analytics14?void 0:_window$pac_analytics14.indexOf("dmb"))||(null===(_window$pac_analytics15=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics15||null===(_window$pac_analytics16=_window$pac_analytics15.toLowerCase())||void 0===_window$pac_analytics16?void 0:_window$pac_analytics16.indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,_context16.abrupt("return",fetch("https://".concat(newHost,"/tallyman/v1/?action=check-subscription&country=").concat(bupperizeCountry(country),"&slug=").concat(slug,"&device=").concat(device,"&offerId=").concat(offer,"&rockman_id=").concat(rockmanId)).then(function(x){return x.json()}));case 3:case"end":return _context16.stop();}},_callee16)}));return checkSubscription}(),checkSubscriptionByRockmanIdOnly:function(){function checkSubscriptionByRockmanIdOnly(_x118,_x119){return _checkSubscriptionByRockmanIdOnly2.apply(this,arguments)}var _checkSubscriptionByRockmanIdOnly2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee17(host,rockmanId){var _window$pac_analytics17,_window$pac_analytics18,_window$pac_analytics19,_window$pac_analytics20,isDMB,newHost;return _regeneratorRuntime().wrap(function _callee17$(_context17){for(;1;)switch(_context17.prev=_context17.next){case 0:return isDMB=null!==window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics17=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics17||null===(_window$pac_analytics18=_window$pac_analytics17.toLowerCase())||void 0===_window$pac_analytics18?void 0:_window$pac_analytics18.indexOf("dmb"))||(null===(_window$pac_analytics19=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics19||null===(_window$pac_analytics20=_window$pac_analytics19.toLowerCase())||void 0===_window$pac_analytics20?void 0:_window$pac_analytics20.indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,_context17.abrupt("return",fetch("https://".concat(newHost,"/tallyman/v1/?action=check-subscription&rockman_id=").concat(rockmanId)).then(function(x){return x.json()}));case 3:case"end":return _context17.stop();}},_callee17)}));return checkSubscriptionByRockmanIdOnly}(),redirect:function(){function redirect(_x120){return _redirect2.apply(this,arguments)}var _redirect2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee18(_ref10){var _window$pac_analytics21,_window$pac_analytics22,_window4,_window5,_window5$location,host,slug,country,msisdn,device,offer,rockmanId,ip_range_name,search,extraParamsQs,email,password,isDMB,newHost,evinaTid,securityProcessId,languageCode,userDetails,searchQs,url;return _regeneratorRuntime().wrap(function _callee18$(_context18){for(;1;)switch(_context18.prev=_context18.next){case 0:if(host=_ref10.host,slug=_ref10.slug,country=_ref10.country,msisdn=_ref10.msisdn,device=_ref10.device,offer=_ref10.offer,rockmanId=_ref10.rockmanId,ip_range_name=_ref10.ip_range_name,search=_ref10.search,extraParamsQs=_ref10.extraParamsQs,email=_ref10.email,password=_ref10.password,isDMB=null!==window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics21=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics21?void 0:_window$pac_analytics21.toLowerCase().indexOf("dmb"))||(null===(_window$pac_analytics22=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics22?void 0:_window$pac_analytics22.toLowerCase().indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,evinaTid="a2"===(null===country||void 0===country?void 0:country.toLowerCase())?"&evinaTi=".concat(rockmanId):"",securityProcessId=null!==(_window4=window)&&void 0!==_window4&&_window4.securityProcessId?"&securityProcessId=".concat(window.securityProcessId):"",languageCode=window.languageCode?"&language_code=".concat(window.languageCode):"",userDetails=email&&password?"&email=".concat(email,"&password=").concat(password):"&msisdn=".concat(msisdn),searchQs=search&&""!==search?"".concat(search,"&"):"",url="https://".concat(newHost,"/tallyman/v1/?action=redirect&slug=").concat(slug,"&country=").concat(country,"&device=").concat(device,"&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&page=").concat(encodeURIComponent(null===(_window5=window)||void 0===_window5||null===(_window5$location=_window5.location)||void 0===_window5$location?void 0:_window5$location.href),"&network_type=").concat(ip_range_name?"":"wifi","&").concat(searchQs,"&").concat(evinaTid).concat(securityProcessId).concat(languageCode).concat(userDetails,"&").concat(extraParamsQs||""),!slug.includes("za-mtn-beyondvr-r7")){_context18.next=11;break}return _context18.abrupt("return",{success:!0,rockman_id:rockmanId,redirect_url:url});case 11:return _context18.abrupt("return",fetch(url).then(function(x){return x.json()}));case 12:case"end":return _context18.stop();}},_callee18)}));return redirect}(),triggerMessage:function(){function triggerMessage(_x121,_x122,_x123,_x124,_x125,_x126,_x127,_x128,_x129){return _triggerMessage2.apply(this,arguments)}var _triggerMessage2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee19(host,slug,country,msisdn,device,offer,rockmanId,search,extraParamsQs){var _window6,_window6$location,isDMB,newHost,partnerAjaxResopnse,params,queryString,url;return _regeneratorRuntime().wrap(function _callee19$(_context19){for(;1;)switch(_context19.prev=_context19.next){case 0:if(isDMB=null!==window.pac_analytics.visitor.xaid&&/dmb|amb/i.test(window.pac_analytics.visitor.xaid),newHost=isDMB?"de.tallymans.com":host,!window.api_ajax_url){_context19.next=8;break}return _context19.next=5,fetch(window.api_ajax_url).then(function(x){return x.json()});case 5:_context19.t0=_context19.sent,_context19.next=9;break;case 8:_context19.t0=null;case 9:return partnerAjaxResopnse=_context19.t0,params={action:"trigger-message",slug:slug,country:country,msisdn:msisdn,device:device,offerId:offer,rockman_id:rockmanId,page:encodeURIComponent(null===(_window6=window)||void 0===_window6||null===(_window6$location=_window6.location)||void 0===_window6$location?void 0:_window6$location.href),sam_g_token:window.reCaptchaToken||"",antifraud_id:window.antifraud_id||"",language_code:window.languageCode||"",partner_form_action:(null===partnerAjaxResopnse||void 0===partnerAjaxResopnse?void 0:partnerAjaxResopnse.form_action)||""},queryString=Object.entries(params).filter(function(_ref11){var _ref12=_slicedToArray(_ref11,2),_=_ref12[0],value=_ref12[1];return value}).map(function(_ref13){var _ref14=_slicedToArray(_ref13,2),key=_ref14[0],value=_ref14[1];return"".concat(key,"=").concat(value)}).join("&"),url="https://".concat(newHost,"/tallyman/v1/?").concat(queryString).concat(search).concat(extraParamsQs),_context19.abrupt("return",fetch(url).then(function(x){return x.json()}));case 14:case"end":return _context19.stop();}},_callee19)}));return triggerMessage}(),ussd:function(){function ussd(_x130,_x131,_x132,_x133,_x134,_x135,_x136,_x137,_x138){return _ussd2.apply(this,arguments)}var _ussd2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee20(host,slug,country,msisdn,device,offer,rockmanId,search,extraParamsQs){var _window$pac_analytics23,_window$pac_analytics24,_window$pac_analytics25,_window$pac_analytics26,isDMB,newHost;return _regeneratorRuntime().wrap(function _callee20$(_context20){for(;1;)switch(_context20.prev=_context20.next){case 0:return isDMB=null!==window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics23=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics23||null===(_window$pac_analytics24=_window$pac_analytics23.toLowerCase())||void 0===_window$pac_analytics24?void 0:_window$pac_analytics24.indexOf("dmb"))||(null===(_window$pac_analytics25=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics25||null===(_window$pac_analytics26=_window$pac_analytics25.toLowerCase())||void 0===_window$pac_analytics26?void 0:_window$pac_analytics26.indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,_context20.abrupt("return",fetch("https://".concat(newHost,"/tallyman/v1/?action=ussd&slug=").concat(slug,"&country=").concat(country,"&msisdn=").concat(msisdn,"&device=").concat(device,"&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&").concat(search).concat(extraParamsQs)).then(function(x){return x.json()}));case 3:case"end":return _context20.stop();}},_callee20)}));return ussd}(),oc2sms:function(){function oc2sms(_x139,_x140,_x141,_x142,_x143,_x144,_x145,_x146){return _oc2sms2.apply(this,arguments)}var _oc2sms2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee21(host,country,slug,offer,rockmanId,keyword,operator,search){var _window$pac_analytics27,_window$pac_analytics28,_window$pac_analytics29,_window$pac_analytics30,_window$pac_analytics31,_window7,_window7$location,isDMB,newHost;return _regeneratorRuntime().wrap(function _callee21$(_context21){for(;1;)switch(_context21.prev=_context21.next){case 0:return isDMB=null!==(null===(_window$pac_analytics27=window.pac_analytics.visitor)||void 0===_window$pac_analytics27?void 0:_window$pac_analytics27.xaid)&&-1!==(-1!==(null===(_window$pac_analytics28=window.pac_analytics.visitor)||void 0===_window$pac_analytics28||null===(_window$pac_analytics29=_window$pac_analytics28.xaid)||void 0===_window$pac_analytics29?void 0:_window$pac_analytics29.toLowerCase().indexOf("dmb"))||(null===(_window$pac_analytics30=window.pac_analytics.visitor)||void 0===_window$pac_analytics30||null===(_window$pac_analytics31=_window$pac_analytics30.xaid)||void 0===_window$pac_analytics31?void 0:_window$pac_analytics31.toLowerCase().indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,_context21.abrupt("return",fetch("https://".concat(newHost,"/tallyman/v1/?action=oc2sms&country=").concat(country,"&slug=").concat(slug,"&offerId=").concat(offer,"&page=").concat(encodeURIComponent(null===(_window7=window)||void 0===_window7||null===(_window7$location=_window7.location)||void 0===_window7$location?void 0:_window7$location.href)).concat(keyword?"&keyword=".concat(keyword):"","&device=smart&rockman_id=").concat(rockmanId).concat(operator?"&operator=".concat(operator):"","&").concat(search)).then(function(x){return x.json()}));case 3:case"end":return _context21.stop();}},_callee21)}));return oc2sms}(),mcpShield:function(){function mcpShield(_x147,_x148,_x149,_x150,_x151,_x152,_x153,_x154){return _mcpShield2.apply(this,arguments)}var _mcpShield2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee22(host,country,slug,device,offer,rockmanId,operator,uniqid){var _window$pac_analytics32,_window$pac_analytics33,_window$pac_analytics34,_window$pac_analytics35,isDMB,newHost,pageUrl,ipAdd,userIp;return _regeneratorRuntime().wrap(function _callee22$(_context22){for(;1;)switch(_context22.prev=_context22.next){case 0:return isDMB=null!=window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics32=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics32||null===(_window$pac_analytics33=_window$pac_analytics32.toLowerCase())||void 0===_window$pac_analytics33?void 0:_window$pac_analytics33.indexOf("dmb"))||(null===(_window$pac_analytics34=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics34||null===(_window$pac_analytics35=_window$pac_analytics34.toLowerCase())||void 0===_window$pac_analytics35?void 0:_window$pac_analytics35.indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,pageUrl=window.location.href,ipAdd=window.pac_analytics.visitor.ip,userIp=ipAdd?"&client_ip=".concat(ipAdd):"",_context22.abrupt("return",fetch("https://".concat(newHost,"/tallyman/v1/?action=mcp-shield&country=").concat(country,"&slug=").concat(slug,"&device=").concat(device,"&offerId=").concat(offer,"&operator=").concat(operator||"","&rockman_id=").concat(rockmanId,"&client_lpu=").concat(pageUrl).concat(userIp).concat(uniqid||"")).then(function(x){return x.json()}));case 6:case"end":return _context22.stop();}},_callee22)}));return mcpShield}(),getGoogleCaptcha:function(){function getGoogleCaptcha(_x155,_x156,_x157,_x158,_x159){return _getGoogleCaptcha2.apply(this,arguments)}var _getGoogleCaptcha2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee23(host,country,slug,device,domain){var _window$pac_analytics36,_window$pac_analytics37,_window$pac_analytics38,_window$pac_analytics39,isDMB,newHost;return _regeneratorRuntime().wrap(function _callee23$(_context23){for(;1;)switch(_context23.prev=_context23.next){case 0:return isDMB=null!=window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics36=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics36||null===(_window$pac_analytics37=_window$pac_analytics36.toLowerCase())||void 0===_window$pac_analytics37?void 0:_window$pac_analytics37.indexOf("dmb"))||(null===(_window$pac_analytics38=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics38||null===(_window$pac_analytics39=_window$pac_analytics38.toLowerCase())||void 0===_window$pac_analytics39?void 0:_window$pac_analytics39.indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,_context23.abrupt("return",fetch("https://".concat(newHost,"/tallyman/helper/?action=google-captcha-v3-config&country=").concat(country,"&slug=").concat(slug,"&device=").concat(device,"&domain=").concat(domain)).then(function(x){return x.json()}));case 3:case"end":return _context23.stop();}},_callee23)}));return getGoogleCaptcha}(),storeEmail:function(){function storeEmail(_x160,_x161,_x162,_x163,_x164){return _storeEmail2.apply(this,arguments)}var _storeEmail2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee24(host,slug,service,rockmanId,email){var _window$pac_analytics40,_window$pac_analytics41,_window$pac_analytics42,_window$pac_analytics43,isDMB,newHost;return _regeneratorRuntime().wrap(function _callee24$(_context24){for(;1;)switch(_context24.prev=_context24.next){case 0:return isDMB=null!=window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics40=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics40||null===(_window$pac_analytics41=_window$pac_analytics40.toLowerCase())||void 0===_window$pac_analytics41?void 0:_window$pac_analytics41.indexOf("dmb"))||(null===(_window$pac_analytics42=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics42||null===(_window$pac_analytics43=_window$pac_analytics42.toLowerCase())||void 0===_window$pac_analytics43?void 0:_window$pac_analytics43.indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,_context24.abrupt("return",fetch("https://".concat(newHost,"/tallyman/helper/?action=store-email&slug=").concat(slug,"&rockman_id=").concat(rockmanId,"&email=").concat(email,"&product_identifier=").concat(service)).then(function(x){return x.json()}));case 3:case"end":return _context24.stop();}},_callee24)}));return storeEmail}(),creditCardPayment:function creditCardPayment(userDetails,extraConfig){var _window9,_window9$pac_analytic,_window9$pac_analytic2,myHeaders=new Headers;if(myHeaders.append("Content-Type","application/json"),"cc_number"in userDetails){var _window8,_window8$pac_analytic,_window8$pac_analytic2,_newUserDetails=_objectSpread({rockman_id:null===(_window8=window)||void 0===_window8||null===(_window8$pac_analytic=_window8.pac_analytics)||void 0===_window8$pac_analytic||null===(_window8$pac_analytic2=_window8$pac_analytic.visitor)||void 0===_window8$pac_analytic2?void 0:_window8$pac_analytic2.rockmanId,landing_page_url:window.location.href,service_id:null===extraConfig||void 0===extraConfig?void 0:extraConfig.serviceId},userDetails),_requestOptions={method:"POST",body:JSON.stringify(_newUserDetails),headers:myHeaders};return fetch("https://cc.tallymans.com/api/v1/maxpay/frontend/initiate-payment",_requestOptions).then(function(x){return x.json()})}var newUserDetails=_objectSpread({rockman_id:null===(_window9=window)||void 0===_window9||null===(_window9$pac_analytic=_window9.pac_analytics)||void 0===_window9$pac_analytic||null===(_window9$pac_analytic2=_window9$pac_analytic.visitor)||void 0===_window9$pac_analytic2?void 0:_window9$pac_analytic2.rockmanId,landing_page_url:window.location.href,service_id:2,user_agent:window.navigator.userAgent,ip:window.pac_analytics.visitor.ip},userDetails),requestOptions={method:"POST",body:JSON.stringify(newUserDetails),headers:myHeaders};return fetch("https://cc.tallymans.com/api/v1/ecardon/frontend/initiate-payment",requestOptions).then(function(x){return x.json()})}};exports.RealTallyman=RealTallyman;
|
|
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.array.from.js"),require("core-js/modules/es.regexp.test.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.RealTallyman=exports.MockTallyman=void 0,require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.join.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.entries.js"),require("core-js/modules/es.array.includes.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.json.stringify.js");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 _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 _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)})}}var bupperizeCountry=function(c){return"gb"===c?"uk":c},logMockTallyman=function(mock){return console.log(mock)},checkIsCleanTraffic=function(country){return"be"===country?"undefined"!=typeof window&&!0===window.shouldBlock?"&is-clean-traffic=false":"&is-clean-traffic=true":""};function sleep(milliseconds){var date=Date.now(),currentDate=null;do currentDate=Date.now();while(currentDate-date<milliseconds)}var MockTallyman={identify:function(){function identify(){return _identify.apply(this,arguments)}var _identify=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(){return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context.abrupt("return",{operator:"",flow:"",success:!0,rockman_id:""});case 3:case"end":return _context.stop();}},_callee)}));return identify}(),triggerPin:function(){function triggerPin(_x8,_x9,_x10,_x11,_x12,_x13,_x14,_x15,_x16,_x17,_x18){return _triggerPin.apply(this,arguments)}var _triggerPin=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(_host,_country,_slug,_device,_offer,_msisdn,_rockmanId,_extraParams,_search,_uniqid,_evinaTid){return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context2.abrupt("return",{success:!0,operator:"",rockman_id:"",pin:"",product_url:""});case 3:case"end":return _context2.stop();}},_callee2)}));return triggerPin}(),verifyPin:function(){function verifyPin(_x19,_x20,_x21,_x22,_x23,_x24,_x25,_x26,_x27){return _verifyPin.apply(this,arguments)}var _verifyPin=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(_host,_country,_slug,_device,_offer,_rockmanId,_pin,_extraParams,_uniqid){return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context3.abrupt("return",{success:!0,rockman_id:"000",product_url:"/product",async:!1});case 3:case"end":return _context3.stop();}},_callee3)}));return verifyPin}(),checkSubscription:function(){function checkSubscription(_x28,_x29,_x30,_x31,_x32,_x33,_x34,_x35){return _checkSubscription.apply(this,arguments)}var _checkSubscription=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(_host,_country,_slug,_device,_offer,_rockmanId,_pin,extraParams){return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context4.abrupt("return",{success:!0,rockman_id:"000",product_url:"/product",msisdn:"000"});case 3:case"end":return _context4.stop();}},_callee4)}));return checkSubscription}(),checkSubscriptionByRockmanIdOnly:function(){function checkSubscriptionByRockmanIdOnly(_x36,_x37){return _checkSubscriptionByRockmanIdOnly.apply(this,arguments)}var _checkSubscriptionByRockmanIdOnly=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(_host,_rockmanId){return _regeneratorRuntime().wrap(function _callee5$(_context5){for(;1;)switch(_context5.prev=_context5.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context5.abrupt("return",{success:!0,rockman_id:"000",product_url:"/product",msisdn:"000"});case 3:case"end":return _context5.stop();}},_callee5)}));return checkSubscriptionByRockmanIdOnly}(),redirect:function(){function redirect(_x38){return _redirect.apply(this,arguments)}var _redirect=_asyncToGenerator(_regeneratorRuntime().mark(function _callee6(_ref){var host,slug,country,msisdn,device,offer,rockmanId,ip_range_name,search,extraParamsQs,email,password;return _regeneratorRuntime().wrap(function _callee6$(_context6){for(;1;)switch(_context6.prev=_context6.next){case 0:return host=_ref.host,slug=_ref.slug,country=_ref.country,msisdn=_ref.msisdn,device=_ref.device,offer=_ref.offer,rockmanId=_ref.rockmanId,ip_range_name=_ref.ip_range_name,search=_ref.search,extraParamsQs=_ref.extraParamsQs,email=_ref.email,password=_ref.password,logMockTallyman("MockTallyman"),sleep(2e3),_context6.abrupt("return",{success:!0,rockman_id:"000",redirect_url:"/product"});case 4:case"end":return _context6.stop();}},_callee6)}));return redirect}(),triggerMessage:function(){function triggerMessage(_x39,_x40,_x41,_x42,_x43,_x44,_x45,_x46,_x47){return _triggerMessage.apply(this,arguments)}var _triggerMessage=_asyncToGenerator(_regeneratorRuntime().mark(function _callee7(_host,_slug,_country,_msisdn,_device,_offer,_rockmanId,_search,_extraParamsQs){return _regeneratorRuntime().wrap(function _callee7$(_context7){for(;1;)switch(_context7.prev=_context7.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context7.abrupt("return",{success:!0,rockman_id:"0000",keyword:"TEST OK",shortcode:"777",displayKeyword:"TEST OK"});case 3:case"end":return _context7.stop();}},_callee7)}));return triggerMessage}(),ussd:function(){function ussd(_x48,_x49,_x50,_x51,_x52,_x53,_x54,_x55,_x56){return _ussd.apply(this,arguments)}var _ussd=_asyncToGenerator(_regeneratorRuntime().mark(function _callee8(_host,_slug,_country,_msisdn,_device,_offer,_rockmanId,_search,_extraParamsQs){return _regeneratorRuntime().wrap(function _callee8$(_context8){for(;1;)switch(_context8.prev=_context8.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context8.abrupt("return",{success:!0,rockman_id:"0000",keyword:"TEST OK",shortcode:"777",displayKeyword:"TEST OK"});case 3:case"end":return _context8.stop();}},_callee8)}));return ussd}(),oc2sms:function(){function oc2sms(_x57,_x58,_x59,_x60,_x61,_x62,_x63,_x64){return _oc2sms.apply(this,arguments)}var _oc2sms=_asyncToGenerator(_regeneratorRuntime().mark(function _callee9(_host,_country,_slug,_offer,_rockmanId,_keyword,_operator,_search){return _regeneratorRuntime().wrap(function _callee9$(_context9){for(;1;)switch(_context9.prev=_context9.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context9.abrupt("return",{success:!0,uid:"1",keyword:"TEST OK",displayKeyword:"TEST OK",shortcode:"777"});case 3:case"end":return _context9.stop();}},_callee9)}));return oc2sms}(),mcpShield:function(){function mcpShield(_x65,_x66,_x67,_x68,_x69,_x70,_x71){return _mcpShield.apply(this,arguments)}var _mcpShield=_asyncToGenerator(_regeneratorRuntime().mark(function _callee10(_host,_country,_slug,_device,_offer,_rockmanId,_operator){return _regeneratorRuntime().wrap(function _callee10$(_context10){for(;1;)switch(_context10.prev=_context10.next){case 0:return logMockTallyman("MockTallyman"),sleep(2e3),_context10.abrupt("return",{source:"**********some very long text**********",uniqid:"a26e7c3983a9cebd469601d695c7dbc4",success:!0,rockman_id:"d66ac1a3ee6d40c289c23322ecd9aa79"});case 3:case"end":return _context10.stop();}},_callee10)}));return mcpShield}(),getGoogleCaptcha:function(){function getGoogleCaptcha(_x72,_x73,_x74,_x75,_x76){return _getGoogleCaptcha.apply(this,arguments)}var _getGoogleCaptcha=_asyncToGenerator(_regeneratorRuntime().mark(function _callee11(_host,_country,_slug,_device,_domain){return _regeneratorRuntime().wrap(function _callee11$(_context11){for(;1;)switch(_context11.prev=_context11.next){case 0:return _context11.abrupt("return",{site_key:"6LfMTS8fAAAAAHw-cibJXMfnsIYNpWh81GatD1lw",secret_key:"6LfMTS8fAAAAAIAET7tvHjrU-tRPGuqSdfCZZX6G",domains:"",success:!0});case 1:case"end":return _context11.stop();}},_callee11)}));return getGoogleCaptcha}(),storeEmail:function(){function storeEmail(_x77,_x78,_x79,_x80,_x81){return _storeEmail.apply(this,arguments)}var _storeEmail=_asyncToGenerator(_regeneratorRuntime().mark(function _callee12(_host,_slug,_service,_rockmanId,_email){return _regeneratorRuntime().wrap(function _callee12$(_context12){for(;1;)switch(_context12.prev=_context12.next){case 0:return _context12.abrupt("return",{success:!0});case 1:case"end":return _context12.stop();}},_callee12)}));return storeEmail}(),creditCardPayment:function creditCardPayment(_userDetails,_extraConfig){return{gateway_url:"/product",success:!0}}};exports.MockTallyman=MockTallyman;var RealTallyman={identify:function(){function identify(_x82,_x83,_x84,_x85,_x86,_x87,_x88){return _identify2.apply(this,arguments)}var _identify2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee13(host,slug,country,msisdn,device,offer,rockmanId){var _window,_window$location,languageCode;return _regeneratorRuntime().wrap(function _callee13$(_context13){for(;1;)switch(_context13.prev=_context13.next){case 0:return languageCode=window.languageCode?"&language_code=".concat(window.languageCode):"",_context13.abrupt("return",fetch("/tallyman/v1/?action=identify&slug=".concat(slug,"&country=").concat(country,"&msisdn=").concat(msisdn,"&device=").concat(device,"&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&page=").concat(encodeURIComponent(null===(_window=window)||void 0===_window||null===(_window$location=_window.location)||void 0===_window$location?void 0:_window$location.href)).concat(languageCode)).then(function(x){return x.json()}));case 2:case"end":return _context13.stop();}},_callee13)}));return identify}(),triggerPin:function(){function triggerPin(_x89,_x90,_x91,_x92,_x93,_x94,_x95,_x96,_x97,_x98,_x99){return _triggerPin2.apply(this,arguments)}var _triggerPin2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee14(host,country,slug,device,offer,msisdn,rockmanId,extraParams,search,uniqid,evinaTid){var _window2,_window2$location,cleanTrafficString,extraParamsQs,params,queryString,url;return _regeneratorRuntime().wrap(function _callee14$(_context14){for(;1;)switch(_context14.prev=_context14.next){case 0:return cleanTrafficString=checkIsCleanTraffic(country),extraParamsQs="&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")),params={action:"trigger-pin",country:bupperizeCountry(country),slug:slug,device:device,offerId:offer,msisdn:msisdn,rockman_id:rockmanId,sam_evina_tid:evinaTid,page:encodeURIComponent(null===(_window2=window)||void 0===_window2||null===(_window2$location=_window2.location)||void 0===_window2$location?void 0:_window2$location.href),language_code:window.languageCode||"",antifraud_id:window.antifraud_id||"",partner_transaction_id:window.partner_transaction_id||"",partner_timestamp:window.partner_timestamp||"",partner_cid:window.partner_cid||"",uniqid:uniqid||""},queryString=Object.entries(params).filter(function(_ref2){var _ref3=_slicedToArray(_ref2,2),_=_ref3[0],value=_ref3[1];return value}).map(function(_ref4){var _ref5=_slicedToArray(_ref4,2),key=_ref5[0],value=_ref5[1];return"".concat(key,"=").concat(value)}).join("&"),url="/tallyman/v1/?".concat(queryString).concat(cleanTrafficString).concat(extraParamsQs,"&").concat(search),_context14.abrupt("return",fetch(url).then(function(x){return x.json()}));case 6:case"end":return _context14.stop();}},_callee14)}));return triggerPin}(),verifyPin:function(){function verifyPin(_x100,_x101,_x102,_x103,_x104,_x105,_x106,_x107,_x108,_x109){return _verifyPin2.apply(this,arguments)}var _verifyPin2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee15(host,country,slug,device,offer,rockmanId,pin,extraParams,uniqid,evinaTid){var _window3,_window3$location,cleanTrafficString,extraParamsQs,params,queryString,url;return _regeneratorRuntime().wrap(function _callee15$(_context15){for(;1;)switch(_context15.prev=_context15.next){case 0:return cleanTrafficString=checkIsCleanTraffic(country),extraParamsQs="&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")),params={action:"verify-pin",country:bupperizeCountry(country),slug:slug,device:device,offerId:offer,rockman_id:rockmanId,pin:pin,page:encodeURIComponent(null===(_window3=window)||void 0===_window3||null===(_window3$location=_window3.location)||void 0===_window3$location?void 0:_window3$location.href),language_code:window.languageCode||"",antifraud_id:window.antifraud_id||"",ClickID:window.antifraud_click_id||"",partner_cid:window.partner_cid||"",sam_evina_tid:evinaTid,uniqid:uniqid},queryString=Object.entries(params).filter(function(_ref6){var _ref7=_slicedToArray(_ref6,2),_=_ref7[0],value=_ref7[1];return value}).map(function(_ref8){var _ref9=_slicedToArray(_ref8,2),key=_ref9[0],value=_ref9[1];return"".concat(key,"=").concat(value)}).join("&"),url="/tallyman/v1/?".concat(queryString).concat(cleanTrafficString).concat(extraParamsQs),_context15.abrupt("return",fetch(url).then(function(x){return x.json()}));case 6:case"end":return _context15.stop();}},_callee15)}));return verifyPin}(),checkSubscription:function(){function checkSubscription(_x110,_x111,_x112,_x113,_x114,_x115,_x116,_x117){return _checkSubscription2.apply(this,arguments)}var _checkSubscription2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee16(host,country,slug,device,offer,rockmanId,_pin,_extraParams){return _regeneratorRuntime().wrap(function _callee16$(_context16){for(;1;)switch(_context16.prev=_context16.next){case 0:return _context16.abrupt("return",fetch("/tallyman/v1/?action=check-subscription&country=".concat(bupperizeCountry(country),"&slug=").concat(slug,"&device=").concat(device,"&offerId=").concat(offer,"&rockman_id=").concat(rockmanId)).then(function(x){return x.json()}));case 1:case"end":return _context16.stop();}},_callee16)}));return checkSubscription}(),checkSubscriptionByRockmanIdOnly:function(){function checkSubscriptionByRockmanIdOnly(_x118,_x119){return _checkSubscriptionByRockmanIdOnly2.apply(this,arguments)}var _checkSubscriptionByRockmanIdOnly2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee17(host,rockmanId){var _window$pac_analytics,_window$pac_analytics2,_window$pac_analytics3,_window$pac_analytics4,isDMB;return _regeneratorRuntime().wrap(function _callee17$(_context17){for(;1;)switch(_context17.prev=_context17.next){case 0:return isDMB=null!==window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics||null===(_window$pac_analytics2=_window$pac_analytics.toLowerCase())||void 0===_window$pac_analytics2?void 0:_window$pac_analytics2.indexOf("dmb"))||(null===(_window$pac_analytics3=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics3||null===(_window$pac_analytics4=_window$pac_analytics3.toLowerCase())||void 0===_window$pac_analytics4?void 0:_window$pac_analytics4.indexOf("amb"))),_context17.abrupt("return",fetch("/tallyman/v1/?action=check-subscription&rockman_id=".concat(rockmanId)).then(function(x){return x.json()}));case 2:case"end":return _context17.stop();}},_callee17)}));return checkSubscriptionByRockmanIdOnly}(),redirect:function(){function redirect(_x120){return _redirect2.apply(this,arguments)}var _redirect2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee18(_ref10){var _window$pac_analytics5,_window$pac_analytics6,_window4,_window5,_window5$location,host,slug,country,msisdn,device,offer,rockmanId,ip_range_name,search,extraParamsQs,email,password,isDMB,evinaTid,securityProcessId,languageCode,userDetails,searchQs,url;return _regeneratorRuntime().wrap(function _callee18$(_context18){for(;1;)switch(_context18.prev=_context18.next){case 0:if(host=_ref10.host,slug=_ref10.slug,country=_ref10.country,msisdn=_ref10.msisdn,device=_ref10.device,offer=_ref10.offer,rockmanId=_ref10.rockmanId,ip_range_name=_ref10.ip_range_name,search=_ref10.search,extraParamsQs=_ref10.extraParamsQs,email=_ref10.email,password=_ref10.password,isDMB=null!==window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics5=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics5?void 0:_window$pac_analytics5.toLowerCase().indexOf("dmb"))||(null===(_window$pac_analytics6=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics6?void 0:_window$pac_analytics6.toLowerCase().indexOf("amb"))),evinaTid="a2"===(null===country||void 0===country?void 0:country.toLowerCase())?"&evinaTi=".concat(rockmanId):"",securityProcessId=null!==(_window4=window)&&void 0!==_window4&&_window4.securityProcessId?"&securityProcessId=".concat(window.securityProcessId):"",languageCode=window.languageCode?"&language_code=".concat(window.languageCode):"",userDetails=email&&password?"&email=".concat(email,"&password=").concat(password):"&msisdn=".concat(msisdn),searchQs=search&&""!==search?"".concat(search,"&"):"",url="/tallyman/v1/?action=redirect&slug=".concat(slug,"&country=").concat(country,"&device=").concat(device,"&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&page=").concat(encodeURIComponent(null===(_window5=window)||void 0===_window5||null===(_window5$location=_window5.location)||void 0===_window5$location?void 0:_window5$location.href),"&network_type=").concat(ip_range_name?"":"wifi","&").concat(searchQs,"&").concat(evinaTid).concat(securityProcessId).concat(languageCode).concat(userDetails,"&").concat(extraParamsQs||""),!slug.includes("za-mtn-beyondvr-r7")){_context18.next=10;break}return _context18.abrupt("return",{success:!0,rockman_id:rockmanId,redirect_url:url});case 10:return _context18.abrupt("return",fetch(url).then(function(x){return x.json()}));case 11:case"end":return _context18.stop();}},_callee18)}));return redirect}(),triggerMessage:function(){function triggerMessage(_x121,_x122,_x123,_x124,_x125,_x126,_x127,_x128,_x129){return _triggerMessage2.apply(this,arguments)}var _triggerMessage2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee19(host,slug,country,msisdn,device,offer,rockmanId,search,extraParamsQs){var _window6,_window6$location,partnerAjaxResopnse,params,queryString,url;return _regeneratorRuntime().wrap(function _callee19$(_context19){for(;1;)switch(_context19.prev=_context19.next){case 0:if(!window.api_ajax_url){_context19.next=6;break}return _context19.next=3,fetch(window.api_ajax_url).then(function(x){return x.json()});case 3:_context19.t0=_context19.sent,_context19.next=7;break;case 6:_context19.t0=null;case 7:return partnerAjaxResopnse=_context19.t0,params={action:"trigger-message",slug:slug,country:country,msisdn:msisdn,device:device,offerId:offer,rockman_id:rockmanId,page:encodeURIComponent(null===(_window6=window)||void 0===_window6||null===(_window6$location=_window6.location)||void 0===_window6$location?void 0:_window6$location.href),sam_g_token:window.reCaptchaToken||"",antifraud_id:window.antifraud_id||"",language_code:window.languageCode||"",partner_form_action:(null===partnerAjaxResopnse||void 0===partnerAjaxResopnse?void 0:partnerAjaxResopnse.form_action)||""},queryString=Object.entries(params).filter(function(_ref11){var _ref12=_slicedToArray(_ref11,2),_=_ref12[0],value=_ref12[1];return value}).map(function(_ref13){var _ref14=_slicedToArray(_ref13,2),key=_ref14[0],value=_ref14[1];return"".concat(key,"=").concat(value)}).join("&"),url="/tallyman/v1/?".concat(queryString).concat(search).concat(extraParamsQs),_context19.abrupt("return",fetch(url).then(function(x){return x.json()}));case 12:case"end":return _context19.stop();}},_callee19)}));return triggerMessage}(),ussd:function(){function ussd(_x130,_x131,_x132,_x133,_x134,_x135,_x136,_x137,_x138){return _ussd2.apply(this,arguments)}var _ussd2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee20(host,slug,country,msisdn,device,offer,rockmanId,search,extraParamsQs){return _regeneratorRuntime().wrap(function _callee20$(_context20){for(;1;)switch(_context20.prev=_context20.next){case 0:return _context20.abrupt("return",fetch("/tallyman/v1/?action=ussd&slug=".concat(slug,"&country=").concat(country,"&msisdn=").concat(msisdn,"&device=").concat(device,"&offerId=").concat(offer,"&rockman_id=").concat(rockmanId,"&").concat(search).concat(extraParamsQs)).then(function(x){return x.json()}));case 1:case"end":return _context20.stop();}},_callee20)}));return ussd}(),oc2sms:function(){function oc2sms(_x139,_x140,_x141,_x142,_x143,_x144,_x145,_x146){return _oc2sms2.apply(this,arguments)}var _oc2sms2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee21(host,country,slug,offer,rockmanId,keyword,operator,search){var _window7,_window7$location;return _regeneratorRuntime().wrap(function _callee21$(_context21){for(;1;)switch(_context21.prev=_context21.next){case 0:return _context21.abrupt("return",fetch("/tallyman/v1/?action=oc2sms&country=".concat(country,"&slug=").concat(slug,"&offerId=").concat(offer,"&page=").concat(encodeURIComponent(null===(_window7=window)||void 0===_window7||null===(_window7$location=_window7.location)||void 0===_window7$location?void 0:_window7$location.href)).concat(keyword?"&keyword=".concat(keyword):"","&device=smart&rockman_id=").concat(rockmanId).concat(operator?"&operator=".concat(operator):"","&").concat(search)).then(function(x){return x.json()}));case 1:case"end":return _context21.stop();}},_callee21)}));return oc2sms}(),mcpShield:function(){function mcpShield(_x147,_x148,_x149,_x150,_x151,_x152,_x153,_x154){return _mcpShield2.apply(this,arguments)}var _mcpShield2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee22(host,country,slug,device,offer,rockmanId,operator,uniqid){var pageUrl,ipAdd,userIp;return _regeneratorRuntime().wrap(function _callee22$(_context22){for(;1;)switch(_context22.prev=_context22.next){case 0:return pageUrl=window.location.href,ipAdd=window.pac_analytics.visitor.ip,userIp=ipAdd?"&client_ip=".concat(ipAdd):"",_context22.abrupt("return",fetch("/tallyman/v1/?action=mcp-shield&country=".concat(country,"&slug=").concat(slug,"&device=").concat(device,"&offerId=").concat(offer,"&operator=").concat(operator||"","&rockman_id=").concat(rockmanId,"&client_lpu=").concat(pageUrl).concat(userIp).concat(uniqid||"")).then(function(x){return x.json()}));case 4:case"end":return _context22.stop();}},_callee22)}));return mcpShield}(),getGoogleCaptcha:function(){function getGoogleCaptcha(_x155,_x156,_x157,_x158,_x159){return _getGoogleCaptcha2.apply(this,arguments)}var _getGoogleCaptcha2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee23(host,country,slug,device,domain){return _regeneratorRuntime().wrap(function _callee23$(_context23){for(;1;)switch(_context23.prev=_context23.next){case 0:return _context23.abrupt("return",fetch("/tallyman/helper/?action=google-captcha-v3-config&country=".concat(country,"&slug=").concat(slug,"&device=").concat(device,"&domain=").concat(domain)).then(function(x){return x.json()}));case 1:case"end":return _context23.stop();}},_callee23)}));return getGoogleCaptcha}(),storeEmail:function(){function storeEmail(_x160,_x161,_x162,_x163,_x164){return _storeEmail2.apply(this,arguments)}var _storeEmail2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee24(host,slug,service,rockmanId,email){return _regeneratorRuntime().wrap(function _callee24$(_context24){for(;1;)switch(_context24.prev=_context24.next){case 0:return _context24.abrupt("return",fetch("/tallyman/helper/?action=store-email&slug=".concat(slug,"&rockman_id=").concat(rockmanId,"&email=").concat(email,"&product_identifier=").concat(service)).then(function(x){return x.json()}));case 1:case"end":return _context24.stop();}},_callee24)}));return storeEmail}(),creditCardPayment:function creditCardPayment(userDetails,extraConfig){var _window9,_window9$pac_analytic,_window9$pac_analytic2,myHeaders=new Headers;if(myHeaders.append("Content-Type","application/json"),"cc_number"in userDetails){var _window8,_window8$pac_analytic,_window8$pac_analytic2,_newUserDetails=_objectSpread({rockman_id:null===(_window8=window)||void 0===_window8||null===(_window8$pac_analytic=_window8.pac_analytics)||void 0===_window8$pac_analytic||null===(_window8$pac_analytic2=_window8$pac_analytic.visitor)||void 0===_window8$pac_analytic2?void 0:_window8$pac_analytic2.rockmanId,landing_page_url:window.location.href,service_id:null===extraConfig||void 0===extraConfig?void 0:extraConfig.serviceId},userDetails),_requestOptions={method:"POST",body:JSON.stringify(_newUserDetails),headers:myHeaders};return fetch("/api/v1/maxpay/frontend/initiate-payment",_requestOptions).then(function(x){return x.json()})}var newUserDetails=_objectSpread({rockman_id:null===(_window9=window)||void 0===_window9||null===(_window9$pac_analytic=_window9.pac_analytics)||void 0===_window9$pac_analytic||null===(_window9$pac_analytic2=_window9$pac_analytic.visitor)||void 0===_window9$pac_analytic2?void 0:_window9$pac_analytic2.rockmanId,landing_page_url:window.location.href,service_id:2,user_agent:window.navigator.userAgent,ip:window.pac_analytics.visitor.ip},userDetails),requestOptions={method:"POST",body:JSON.stringify(newUserDetails),headers:myHeaders};return fetch("/api/v1/ecardon/frontend/initiate-payment",requestOptions).then(function(x){return x.json()})}};exports.RealTallyman=RealTallyman;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState"));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.mockedUserDetailsEntrySuccess=exports.mockedUserDetailsEntryFailure=void 0,exports.submitUserDetails=submitUserDetails,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.includes.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.array.concat.js");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 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 submitUserDetails(){return _submitUserDetails.apply(this,arguments)}function _submitUserDetails(){return _submitUserDetails=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(window,config,userDetails){var _window$pac_analytics,_window$pac_analytics2,_window$pac_analytics3,_window$pac_analytics4,_window$pac_analytics5,slug,country,device,host,serviceId,search,visitor,rockmanId,extraConfig,result,type,error;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(slug=config.slug,country=config.country,device=config.device,host=config.host,serviceId=config.serviceId,search=window.location.search.substr(1)||"",visitor=window.pac_analytics.visitor,rockmanId=visitor.rockmanId,extraConfig={serviceId:serviceId},!(null!==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.page)&&void 0!==_window$pac_analytics3&&_window$pac_analytics3.includes("agency"))){_context.next=11;break}return _context.next=8,window.tallymanApi.redirect({host:host,slug:slug,country:country,device:device,offer:null===window||void 0===window||null===(_window$pac_analytics4=window.pac_analytics)||void 0===_window$pac_analytics4||null===(_window$pac_analytics5=_window$pac_analytics4.visitor)||void 0===_window$pac_analytics5?void 0:_window$pac_analytics5.offer,rockmanId:rockmanId,email:null===userDetails||void 0===userDetails?void 0:userDetails.email,password:null===userDetails||void 0===userDetails?void 0:userDetails.password,search:search});case 8:_context.t0=_context.sent,_context.next=14;break;case 11:return _context.next=13,window.tallymanApi.creditCardPayment(userDetails,extraConfig);case 13:_context.t0=_context.sent;case 14:if(result=_context.t0,!1!==result.success){_context.next=23;break}throw type="ALREADY SUBSCRIBED"===result.message?"AlreadySubscribed":result.message,error=new Error("".concat(type,":\n").concat(result.message)),error.type=type,console.error(error),error;case 23:return _context.abrupt("return",{gateway_url:result.gateway_url||result.redirect_url,method:result.redirect_url?"redirection":result.method});case 24:case"end":return _context.stop();}},_callee)})),_submitUserDetails.apply(this,arguments)}var mockedUserDetailsEntrySuccess={currentState:{type:"USER_DETAILS_ENTRY",result:RDS.Success({gateway_url:"https://www.google.com",method:"jslink"})}};exports.mockedUserDetailsEntrySuccess=mockedUserDetailsEntrySuccess;var mockedUserDetailsEntryFailure={currentState:{type:"USER_DETAILS_ENTRY",result:RDS.Failure({errorType:"AlreadySubscribed",error:"Already Subscribed"})}};exports.mockedUserDetailsEntryFailure=mockedUserDetailsEntryFailure;
|
|
1
|
+
"use strict";var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState"));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.mockedUserDetailsEntrySuccess=exports.mockedUserDetailsEntryFailure=void 0,exports.submitUserDetails=submitUserDetails,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.includes.js"),require("core-js/modules/es.string.includes.js"),require("core-js/modules/es.array.concat.js");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 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 submitUserDetails(){return _submitUserDetails.apply(this,arguments)}function _submitUserDetails(){return _submitUserDetails=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(window,config,userDetails){var _window$pac_analytics,_window$pac_analytics2,_window$pac_analytics3,_window$pac_analytics4,_window$pac_analytics5,slug,country,device,host,serviceId,search,visitor,rockmanId,extraConfig,result,type,error;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(slug=config.slug,country=config.country,device=config.device,host=config.host,serviceId=config.serviceId,search=window.location.search.substr(1)||"",visitor=window.pac_analytics.visitor,rockmanId=visitor.rockmanId,extraConfig={serviceId:serviceId},!(null!==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.page)&&void 0!==_window$pac_analytics3&&_window$pac_analytics3.includes("agency"))){_context.next=11;break}return _context.next=8,window.tallymanApi.redirect({host:host,slug:slug,country:country,device:device,offer:null===window||void 0===window||null===(_window$pac_analytics4=window.pac_analytics)||void 0===_window$pac_analytics4||null===(_window$pac_analytics5=_window$pac_analytics4.visitor)||void 0===_window$pac_analytics5?void 0:_window$pac_analytics5.offer,rockmanId:rockmanId,email:null===userDetails||void 0===userDetails?void 0:userDetails.email,password:null===userDetails||void 0===userDetails?void 0:userDetails.password,search:search});case 8:_context.t0=_context.sent,_context.next=14;break;case 11:return _context.next=13,window.tallymanApi.creditCardPayment(userDetails,extraConfig);case 13:_context.t0=_context.sent;case 14:if(result=_context.t0,!1!==result.success){_context.next=23;break}throw type="ALREADY SUBSCRIBED"===result.message?"AlreadySubscribed":result.message,error=new Error("".concat(type,":\n").concat(result.message)),error.type=type,console.error(error),error;case 23:return _context.abrupt("return",{gateway_url:result.gateway_url||result.redirect_url,method:result.redirect_url?"redirection":result.method});case 24:case"end":return _context.stop();}},_callee)})),_submitUserDetails.apply(this,arguments)}var mockedUserDetailsEntrySuccess={currentState:{type:"USER_DETAILS_ENTRY",result:RDS.Success({gateway_url:"gateway_url",method:"jslink"})}};exports.mockedUserDetailsEntrySuccess=mockedUserDetailsEntrySuccess;var mockedUserDetailsEntryFailure={currentState:{type:"USER_DETAILS_ENTRY",result:RDS.Failure({errorType:"AlreadySubscribed",error:"Already Subscribed"})}};exports.mockedUserDetailsEntryFailure=mockedUserDetailsEntryFailure;
|
|
@@ -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.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.default=submitMSISDN,exports.startEvinaAgency=exports.mockedMSISDNEntrySuccess=exports.mockedMSISDNEntryFailure=void 0,exports.submitMSISDNWithConfig=submitMSISDNWithConfig,require("core-js/modules/es.array.concat.js"),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.map.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.string.match.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_tryGetIPRangeName=_interopRequireDefault(require("../../ips/tryGetIPRangeName")),_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:return config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig||{}),_context.abrupt("return",submitMSISDNWithConfig(window,config,internationalMSISDN,extraParams));case 2:case"end":return _context.stop();}},_callee)})),_submitMSISDN.apply(this,arguments)}function submitMSISDNWithConfig(_x5,_x6,_x7,_x8){return _submitMSISDNWithConfig.apply(this,arguments)}function _submitMSISDNWithConfig(){return _submitMSISDNWithConfig=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(window,config,internationalMSISDN,extraParams){var slug,country,device,offer,host,search,extraParamsQs,msisdn,visitor,rockmanId,ip_range_name,result,type,error;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:if(slug=config.slug,country=config.country,device=config.device,offer=config.offer,host=config.host,search=window.location.search.substr(1)||"",extraParamsQs=extraParams?"&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")):"",msisdn=internationalMSISDN.match(/\d+/gi).join(""),visitor=window.pac_analytics.visitor,rockmanId=visitor.rockmanId,"ci"!==country){_context2.next=12;break}return _context2.next=9,(0,_tryGetIPRangeName.default)(visitor);case 9:_context2.t0=_context2.sent,_context2.next=13;break;case 12:_context2.t0=null;case 13:return ip_range_name=_context2.t0,_context2.next=16,window.tallymanApi.redirect({host:host,slug:slug,country:country,msisdn:msisdn,device:device,offer:offer,rockmanId:rockmanId,ip_range_name:ip_range_name,search:search,extraParamsQs:extraParamsQs});case 16:if(result=_context2.sent,!1!==result.success){_context2.next=25;break}throw type="ALREADY SUBSCRIBED"===result.message?"AlreadySubscribed":"InvalidMSISDN",error=new Error("".concat(type,":\n").concat(result.message)),error.type=type,console.error(error),error;case 25:return _context2.abrupt("return",result.redirect_url);case 26:case"end":return _context2.stop();}},_callee2)})),_submitMSISDNWithConfig.apply(this,arguments)}var startEvinaAgency=function startEvinaAgency(config){try{var configs=(0,_utils.getConfig)(),defaultFlowConfig=configs.strategyConfigs.default,_ref=config||defaultFlowConfig.flowConfig,host=_ref.host,newHost=(0,_utilities.getHost)({host:host}),rockmanId=window.pac_analytics.visitor.rockmanId,url="https://".concat(newHost,"/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=").concat(rockmanId);fetch(url).then(function(x){return x.text()}).then(function(txt){return(0,_loadScriptInnerHtml.default)(txt)}).then(function(){console.log("Ev ready");var event=new Event("DCBProtectRun");"undefined"!=typeof window&&document.dispatchEvent(event)})}catch(err){console.error("startEvinaAgency ERROR",err)}};exports.startEvinaAgency=startEvinaAgency;var mockedMSISDNEntrySuccess={currentState:{type:"MSISDNEntry",result:RDS.Success({href:"/product"})}};exports.mockedMSISDNEntrySuccess=mockedMSISDNEntrySuccess;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.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.default=submitMSISDN,exports.startEvinaAgency=exports.mockedMSISDNEntrySuccess=exports.mockedMSISDNEntryFailure=void 0,exports.submitMSISDNWithConfig=submitMSISDNWithConfig,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.map.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.string.match.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_tryGetIPRangeName=_interopRequireDefault(require("../../ips/tryGetIPRangeName")),_loadScriptInnerHtml=_interopRequireDefault(require("../../utilities/loadScriptInnerHtml"));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:return config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig||{}),_context.abrupt("return",submitMSISDNWithConfig(window,config,internationalMSISDN,extraParams));case 2:case"end":return _context.stop();}},_callee)})),_submitMSISDN.apply(this,arguments)}function submitMSISDNWithConfig(_x5,_x6,_x7,_x8){return _submitMSISDNWithConfig.apply(this,arguments)}function _submitMSISDNWithConfig(){return _submitMSISDNWithConfig=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(window,config,internationalMSISDN,extraParams){var slug,country,device,offer,host,search,extraParamsQs,msisdn,visitor,rockmanId,ip_range_name,result,type,error;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:if(slug=config.slug,country=config.country,device=config.device,offer=config.offer,host=config.host,search=window.location.search.substr(1)||"",extraParamsQs=extraParams?"&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")):"",msisdn=internationalMSISDN.match(/\d+/gi).join(""),visitor=window.pac_analytics.visitor,rockmanId=visitor.rockmanId,"ci"!==country){_context2.next=12;break}return _context2.next=9,(0,_tryGetIPRangeName.default)(visitor);case 9:_context2.t0=_context2.sent,_context2.next=13;break;case 12:_context2.t0=null;case 13:return ip_range_name=_context2.t0,_context2.next=16,window.tallymanApi.redirect({host:host,slug:slug,country:country,msisdn:msisdn,device:device,offer:offer,rockmanId:rockmanId,ip_range_name:ip_range_name,search:search,extraParamsQs:extraParamsQs});case 16:if(result=_context2.sent,!1!==result.success){_context2.next=25;break}throw type="ALREADY SUBSCRIBED"===result.message?"AlreadySubscribed":"InvalidMSISDN",error=new Error("".concat(type,":\n").concat(result.message)),error.type=type,console.error(error),error;case 25:return _context2.abrupt("return",result.redirect_url);case 26:case"end":return _context2.stop();}},_callee2)})),_submitMSISDNWithConfig.apply(this,arguments)}var startEvinaAgency=function startEvinaAgency(config){try{var rockmanId=window.pac_analytics.visitor.rockmanId,url="/tallyman/helper/?action=mi-agency&process=a2-du-evina-start&rockman_id=".concat(rockmanId);fetch(url).then(function(x){return x.text()}).then(function(txt){return(0,_loadScriptInnerHtml.default)(txt)}).then(function(){console.log("Ev ready");var event=new Event("DCBProtectRun");"undefined"!=typeof window&&document.dispatchEvent(event)})}catch(err){console.error("startEvinaAgency ERROR",err)}};exports.startEvinaAgency=startEvinaAgency;var mockedMSISDNEntrySuccess={currentState:{type:"MSISDNEntry",result:RDS.Success({href:"/product"})}};exports.mockedMSISDNEntrySuccess=mockedMSISDNEntrySuccess;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.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 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,country,slug,queryString,apiAction,customDomain,evinaTid,bupperizeCountry,offer,s,search,rockmanId,_url2,result,identifyError,_url3,_result,_identifyError,_window$location,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(country=maybeConfig.country,slug=maybeConfig.slug,queryString=maybeConfig.queryString,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=63;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=63;break;case 43:if("om"!==country.toLowerCase()){_context.next=52;break}if(searchObj=(0,_utils.searchToObject)(),"false"!==searchObj.success){_context.next=51;break}throw _identifyError2=new Error("Error in getRedirectUrl() identify-user"),_identifyError2.type="NotOn3g",_identifyError2;case 51:return _context.abrupt("return",{redirect_url:searchObj.redirect_url||searchObj.url});case 52: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=55,fetch(_url4).then(function(x){return x.json()});case 55:if(_result2=_context.sent,!1!==_result2.success){_context.next=62;break}throw _identifyError3=new Error("Error in getRedirectUrl() identify-user action:\n".concat(_result2.message)),_identifyError3.type="NotOn3g",_identifyError3;case 62:return _context.abrupt("return",{redirect_url:_result2.redirect_url});case 63:case"end":return _context.stop();}},_callee)}));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:"/product"})}};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 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,country,slug,queryString,apiAction,evinaTid,bupperizeCountry,offer,s,search,rockmanId,_url2,result,identifyError,_url3,_result,_identifyError,_window$location,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(country=maybeConfig.country,slug=maybeConfig.slug,queryString=maybeConfig.queryString,apiAction=maybeConfig.apiAction,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=27;break}return _url2="/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=17,fetchJsonp(_url2);case 17:if(result=_context.sent,!1!==result.success){_context.next=24;break}throw identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat(result.message)),identifyError.type="NotOn3g",identifyError;case 24:return _context.abrupt("return",{subscription_url:result.subscription_url||result.redirect_url,action:function action(){return subscribe(result.subscription_url)}});case 25:_context.next=62;break;case 27:if("he"!==apiAction){_context.next=42;break}return _url3="/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=31,fetch(_url3).then(function(x){return x.json()});case 31:if(_result=_context.sent,!1!==_result.success){_context.next=38;break}throw _identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat(_result.message)),_identifyError.type="NotOn3g",_identifyError;case 38:return(0,_loadScriptInnerHtml.default)(_result.source),_context.abrupt("return",{redirect_url:_result.redirectUrlWithReplacedUniqid});case 40:_context.next=62;break;case 42:if("om"!==country.toLowerCase()){_context.next=51;break}if(searchObj=(0,_utils.searchToObject)(),"false"!==searchObj.success){_context.next=50;break}throw _identifyError2=new Error("Error in getRedirectUrl() identify-user"),_identifyError2.type="NotOn3g",_identifyError2;case 50:return _context.abrupt("return",{redirect_url:searchObj.redirect_url||searchObj.url});case 51:return _url4="/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=54,fetch(_url4).then(function(x){return x.json()});case 54:if(_result2=_context.sent,!1!==_result2.success){_context.next=61;break}throw _identifyError3=new Error("Error in getRedirectUrl() identify-user action:\n".concat(_result2.message)),_identifyError3.type="NotOn3g",_identifyError3;case 61:return _context.abrupt("return",{redirect_url:_result2.redirect_url});case 62:case"end":return _context.stop();}},_callee)}));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:"/product"})}};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.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.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.array.slice.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 _awesomePhonenumber=_interopRequireDefault(require("awesome-phonenumber")),_=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,_window5,_window5$pac_analytic,_window5$pac_analytic2,gateway,heMsisdn,heOperator,page,country,msisdnDetected,timerExpired,timerId,abTestPages,_window6,_window6$pac_analytic,_window6$pac_analytic2,_window7,_window7$pac_analytic,_window7$pac_analytic2,url,_window8,_window8$pac_analytic,_window8$pac_analytic2,_window8$pac_analytic3,_window9,_window9$TPay,_window9$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,country=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,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","ae-video-beyondvr-cta-visible"],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===(_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.country,"&rockman_id=").concat(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?void 0:_window7$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){var _ref2=event,detail=_ref2.detail,pn=new _awesomePhonenumber.default(null===detail||void 0===detail?void 0:detail.msisdn,country),internationalMsisdn=pn.getNumber("e164"),internationalMsisdnWithoutPrefix=internationalMsisdn.slice(1);abTestPages.includes(page)?!1===timerExpired&&(msisdnDetected=!0,clearTimeout(timerId),_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:internationalMsisdnWithoutPrefix}),dispatch((0,_ask_mobile_number.submitMSISDNAction)(internationalMsisdnWithoutPrefix,!0))):(_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:internationalMsisdnWithoutPrefix,operator:null===detail||void 0===detail?void 0:detail.operator_code}),dispatch((0,_ask_mobile_number.submitMSISDNAction)(internationalMsisdnWithoutPrefix,!0)))}),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===(_window8=window)||void 0===_window8||null===(_window8$pac_analytic=_window8.pac_analytics)||void 0===_window8$pac_analytic||null===(_window8$pac_analytic2=_window8$pac_analytic.visitor)||void 0===_window8$pac_analytic2||null===(_window8$pac_analytic3=_window8$pac_analytic2.genericJsLinkResult)||void 0===_window8$pac_analytic3?void 0:_window8$pac_analytic3.jsLink}),isEnriched=null===(_window9=window)||void 0===_window9||null===(_window9$TPay=_window9.TPay)||void 0===_window9$TPay||null===(_window9$TPay$HeaderE=_window9$TPay.HeaderEnrichment)||void 0===_window9$TPay$HeaderE?void 0:_window9$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.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.slice.js"),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 _awesomePhonenumber=_interopRequireDefault(require("awesome-phonenumber")),_=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,_window5,_window5$pac_analytic,_window5$pac_analytic2,gateway,heMsisdn,heOperator,page,country,pn,internationalMsisdn,msisdnDetected,timerExpired,timerId,abTestPages,_window6,_window6$pac_analytic,_window6$pac_analytic2,_window7,_window7$pac_analytic,_window7$pac_analytic2,url,_window8,_window8$pac_analytic,_window8$pac_analytic2,_window8$pac_analytic3,_window9,_window9$TPay,_window9$TPay$HeaderE,isEnriched,heMsisdnTpay,_pn2,_internationalMsisdn2,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,country=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,heMsisdn&&(pn=new _awesomePhonenumber.default(heMsisdn,country),internationalMsisdn=pn.getNumber("e164"),heMsisdn=internationalMsisdn.slice(1)),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","ae-video-beyondvr-cta-visible"],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="/tallyman/he?country=".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.country,"&rockman_id=").concat(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?void 0:_window7$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){var msisdn,_ref2=event,detail=_ref2.detail;if(detail.msisdn){var _pn=new _awesomePhonenumber.default(null===detail||void 0===detail?void 0:detail.msisdn,country),_internationalMsisdn=_pn.getNumber("e164");msisdn=_internationalMsisdn.slice(1)}abTestPages.includes(page)?!1===timerExpired&&(msisdnDetected=!0,clearTimeout(timerId),_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:msisdn}),dispatch((0,_ask_mobile_number.submitMSISDNAction)(msisdn,!0))):(_.tracker.customEvent("Flow","advance-auto","msisdn-detected",{msisdn:msisdn,operator:null===detail||void 0===detail?void 0:detail.operator_code}),dispatch((0,_ask_mobile_number.submitMSISDNAction)(msisdn,!0)))}),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===(_window8=window)||void 0===_window8||null===(_window8$pac_analytic=_window8.pac_analytics)||void 0===_window8$pac_analytic||null===(_window8$pac_analytic2=_window8$pac_analytic.visitor)||void 0===_window8$pac_analytic2||null===(_window8$pac_analytic3=_window8$pac_analytic2.genericJsLinkResult)||void 0===_window8$pac_analytic3?void 0:_window8$pac_analytic3.jsLink}),isEnriched=null===(_window9=window)||void 0===_window9||null===(_window9$TPay=_window9.TPay)||void 0===_window9$TPay||null===(_window9$TPay$HeaderE=_window9$TPay.HeaderEnrichment)||void 0===_window9$TPay$HeaderE?void 0:_window9$TPay$HeaderE.enriched(),isEnriched?(heMsisdnTpay=window.TPay.HeaderEnrichment.msisdn(),heMsisdnTpay&&(_pn2=new _awesomePhonenumber.default(heMsisdnTpay,country),_internationalMsisdn2=_pn2.getNumber("e164"),heMsisdnTpay=_internationalMsisdn2.slice(1)),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 +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.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.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.regexp.test.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.determineFlowByMsidn=determineFlowByMsidn,exports.determineFlowByOperator=determineFlowByOperator,exports.determineFlowByOperatorFromIp=determineFlowByOperatorFromIp,exports.getConfig=void 0,exports.getOperators=getOperators,exports.identifyUser=void 0,exports.left=left,exports.loop=void 0,exports.mockConfig=mockConfig,exports.mockedUssdFlow=exports.mockedTPayFlow=exports.mockedPinFlow=exports.mockedOneClickFlow=exports.mockedMoRdirFlow=exports.mockedMoFlow=exports.mockedCreditCardFlow=exports.mockedClick2smsFlow=void 0,exports.right=right,exports.wait=exports.subscribe=exports.searchToObject=void 0,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.split.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.join.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/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.string.match.js");var _awesomePhonenumber=_interopRequireDefault(require("awesome-phonenumber")),_tryGetIPRangeName=_interopRequireDefault(require("../../ips/tryGetIPRangeName")),_utilities=require("../../utilities");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}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 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 _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)})}}var wait=function(ms){return new Promise(function(resolve){return setTimeout(function(){return resolve()},ms)})};exports.wait=wait;var loop=function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(f,max,stop,i){var r;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:return _context.next=2,f();case 2:if(r=_context.sent,!(stop(r)||i>=max)){_context.next=5;break}return _context.abrupt("return",r);case 5:return _context.next=7,wait(1e3);case 7:return _context.abrupt("return",loop(f,max,stop,i+1));case 8:case"end":return _context.stop();}},_callee)}));return function loop(_x,_x2,_x3,_x4){return _ref.apply(this,arguments)}}();exports.loop=loop;function right(r){return{type:"right",value:r}}function left(l){return{type:"left",value:l}}var getConfig=function getConfig(){try{if("true"===process.env.testing){var _configs2=require("../../../mockData/config.json");return _configs2}var _configs=require("../../../../../config.json");return _configs}catch(ex){throw new Error("config.json not found")}};exports.getConfig=getConfig;var configs=getConfig(),defaultFlowConfig=configs.strategyConfigs.default,operatorsConfig=configs.strategyConfigs.operators,searchToObject=function searchToObject(){return"undefined"==typeof window?{}:window.location.search.substring(1).split("&").filter(function(x){return!!x&&0<x.length}).map(function(kv){return kv.split("=")}).reduce(function(a,b){return _objectSpread(_objectSpread({},a),{},_defineProperty({},b[0],b[1]))},{})};exports.searchToObject=searchToObject;function determineFlowByMsidn(_x5){return _determineFlowByMsidn.apply(this,arguments)}function _determineFlowByMsidn(){return _determineFlowByMsidn=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(internationalMSISDN){var submissionError,msisdn,indentifyFlow,theResult,flow,cannotDetect,hlrError,_submissionError,flowObj,_flowObj,_submissionError2;return _regeneratorRuntime().wrap(function _callee5$(_context5){for(;1;)switch(_context5.prev=_context5.next){case 0:if(internationalMSISDN){_context5.next=4;break}throw submissionError=new Error("Error in submitMSISDN() trigger-pin action"),submissionError.type="SEInvalidMSISDN",submissionError;case 4:return msisdn=internationalMSISDN.match(/\d+/gi).join(""),indentifyFlow=function(){var _ref6=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(){var config,slug,country,device,host,rockmanId,offer,flowOperatorResult;return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:return config=defaultFlowConfig.flowConfig,slug=config.slug,country=config.country,device=config.device,host=config.host,rockmanId=window.pac_analytics.visitor.rockmanId,offer=window.pac_analytics.visitor.offer,_context4.next=6,window.tallymanApi.identify(host,slug,country,msisdn,device,offer,rockmanId);case 6:return flowOperatorResult=_context4.sent,_context4.abrupt("return",flowOperatorResult);case 8:case"end":return _context4.stop();}},_callee4)}));return function indentifyFlow(){return _ref6.apply(this,arguments)}}(),_context5.next=8,indentifyFlow();case 8:if(theResult=_context5.sent,flow=operatorsConfig[theResult.operator]||operatorsConfig[_utilities.mapAgencyOperator[theResult.operator]]?operatorsConfig[theResult.operator]||operatorsConfig[_utilities.mapAgencyOperator[theResult.operator]]:null,cannotDetect=!1===theResult.success&&"Operator could not be found for the given MSISDN"===theResult.message,hlrError=!1===theResult.success&&-1!==theResult.message.indexOf("HLR did not find the operator for given MSISDN"),!(cannotDetect||hlrError)){_context5.next=19;break}throw _submissionError=new Error("Error in submitMSISDN() identify flow"),_submissionError.type="FlowDetectFailed",_submissionError.msisdn=msisdn,_submissionError;case 19:if(null===flow){_context5.next=24;break}return flowObj=_objectSpread({operator:theResult.operator,default:defaultFlowConfig},flow),_context5.abrupt("return",flowObj);case 24:if(null!==flow){_context5.next=29;break}return _flowObj=_objectSpread({operator:theResult.operator},defaultFlowConfig),_context5.abrupt("return",_flowObj);case 29:throw _submissionError2=new Error("Error in submitMSISDN() trigger-pin action"),_submissionError2.type="SEInvalidMSISDN",_submissionError2;case 32:case"end":return _context5.stop();}},_callee5)})),_determineFlowByMsidn.apply(this,arguments)}function determineFlowByOperator(operator){var flowObj=_objectSpread({operator:null===operator||void 0===operator?void 0:operator.toUpperCase(),default:defaultFlowConfig},operatorsConfig[null===operator||void 0===operator?void 0:operator.toUpperCase()]);return flowObj}function determineFlowByOperatorFromIp(){return _determineFlowByOperatorFromIp.apply(this,arguments)}function _determineFlowByOperatorFromIp(){return _determineFlowByOperatorFromIp=_asyncToGenerator(_regeneratorRuntime().mark(function _callee6(){var operator,flowObj;return _regeneratorRuntime().wrap(function _callee6$(_context6){for(;1;)switch(_context6.prev=_context6.next){case 0:return _context6.next=2,(0,_tryGetIPRangeName.default)(window.pac_analytics.visitor);case 2:return operator=_context6.sent,flowObj=determineFlowByOperator(operator?operator.toUpperCase():""),_context6.abrupt("return",flowObj);case 5:case"end":return _context6.stop();}},_callee6)})),_determineFlowByOperatorFromIp.apply(this,arguments)}function getOperators(){var operators=Object.keys(operatorsConfig);return operators}var fetchJsonp=function fetchJsonp(_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")))}})},identifyUser=function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(extraParams){var _window$pac_analytics,_window$pac_analytics2,_window$pac_analytics3,_window$pac_analytics4,config,host,country,slug,queryString,device,bupperizeCountry,offer,rockmanId,s,search,extraParamsQs,isDMB,newHost,searchObj,identifyError,subscription_url,_newUrl,_newQueryString,_urlParams,_msisdn,_operator,_window,_window$pac_analytics5,_window$pac_analytics6,pn,internationalMsisdn,redirect_url,_newUrl2,_newQueryString2,_urlParams2,_msisdn2,_operator2,_window2,_window2$pac_analytic,_window2$pac_analytic2,_pn,_internationalMsisdn,newUrl,newQueryString,urlParams,msisdn,operator,_window3,_window3$pac_analytic,_window3$pac_analytic2,_pn2,_internationalMsisdn2,url,result,_identifyError,_msisdn3,_window4,_window4$pac_analytic,_window4$pac_analytic2,_pn3,_internationalMsisdn3;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:if("undefined"!=typeof window){_context2.next=4;break}throw new Error("Error");case 4:if(config=defaultFlowConfig.flowConfig,host=config.host,country=config.country,slug=config.slug,queryString=config.queryString,device=config.device,bupperizeCountry=function bupperizeCountry(c){return"gb"===c?"uk":c},offer=window.pac_analytics.visitor.offer,rockmanId=window.pac_analytics.visitor.rockmanId,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("&"),extraParamsQs=extraParams?"&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")):"",isDMB=null!==window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics||null===(_window$pac_analytics2=_window$pac_analytics.toLowerCase())||void 0===_window$pac_analytics2?void 0:_window$pac_analytics2.indexOf("dmb"))||(null===(_window$pac_analytics3=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics3||null===(_window$pac_analytics4=_window$pac_analytics3.toLowerCase())||void 0===_window$pac_analytics4?void 0:_window$pac_analytics4.indexOf("amb"))),newHost=isDMB?"de.tallymans.com":host,searchObj=searchToObject(),!searchObj["redirect-back"]){_context2.next=49;break}if("false"!==(null===searchObj||void 0===searchObj?void 0:searchObj.success)){_context2.next=22;break}throw identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat((null===searchObj||void 0===searchObj?void 0:searchObj.message)||"NotOn3g")),identifyError.type="NotOn3g",identifyError;case 22:if(!searchObj.subscription_url){_context2.next=31;break}return subscription_url=window.atob(searchObj.subscription_url),_newUrl=new URL(subscription_url),_newQueryString=_newUrl.search,_urlParams=new URLSearchParams(_newQueryString),_msisdn=_urlParams.get("msisdn")||(null===searchObj||void 0===searchObj?void 0:searchObj.msisdn)||null,_operator=_urlParams.get("operator")||(null===searchObj||void 0===searchObj?void 0:searchObj.operator)||null,_msisdn&&(pn=new _awesomePhonenumber.default(_msisdn,null===(_window=window)||void 0===_window||null===(_window$pac_analytics5=_window.pac_analytics)||void 0===_window$pac_analytics5||null===(_window$pac_analytics6=_window$pac_analytics5.visitor)||void 0===_window$pac_analytics6?void 0:_window$pac_analytics6.country),internationalMsisdn=pn.getNumber("e164"),_msisdn=internationalMsisdn.slice(1)),_context2.abrupt("return",{subscription_url:subscription_url,action:function action(){return subscribe(subscription_url)},msisdn:_msisdn,operator:_operator});case 31:if(!(null!==searchObj&&void 0!==searchObj&&searchObj.redirect_url)){_context2.next=40;break}return redirect_url=window.atob(null===searchObj||void 0===searchObj?void 0:searchObj.redirect_url),_newUrl2=new URL(redirect_url),_newQueryString2=_newUrl2.search,_urlParams2=new URLSearchParams(_newQueryString2),_msisdn2=_urlParams2.get("msisdn")||(null===searchObj||void 0===searchObj?void 0:searchObj.msisdn)||null,_operator2=_urlParams2.get("operator")||(null===searchObj||void 0===searchObj?void 0:searchObj.operator)||null,_msisdn2&&(_pn=new _awesomePhonenumber.default(_msisdn2,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.country),_internationalMsisdn=_pn.getNumber("e164"),_msisdn2=_internationalMsisdn.slice(1)),_context2.abrupt("return",{redirect_url:redirect_url,msisdn:_msisdn2,operator:_operator2});case 40:return newUrl=new URL(window.location.href),newQueryString=newUrl.search,urlParams=new URLSearchParams(newQueryString),msisdn=urlParams.get("msisdn")||(null===searchObj||void 0===searchObj?void 0:searchObj.msisdn)||null,operator=urlParams.get("operator")||(null===searchObj||void 0===searchObj?void 0:searchObj.operator)||null,msisdn&&(_pn2=new _awesomePhonenumber.default(msisdn,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.country),_internationalMsisdn2=_pn2.getNumber("e164"),msisdn=_internationalMsisdn2.slice(1)),_context2.abrupt("return",{msisdn:msisdn,operator:operator});case 47:_context2.next=61;break;case 49:return url="https://".concat(newHost,"/tallyman/v1/?action=identify-user&country=").concat(bupperizeCountry(country),"&slug=").concat(slug,"&device=").concat(device,"&offerId=").concat(offer,"&page=").concat(window.location.href,"&pixel_url=").concat(encodeURIComponent("http://".concat(window.location.host,"/pixels?xcid=").concat(window.location.pathname.replace("/",""),"&xaid=").concat(window.pac_analytics.visitor.xaid,"&country=").concat(bupperizeCountry(country))),"&rockman_id=").concat(rockmanId).concat(extraParamsQs,"&").concat(search),_context2.next=52,fetchJsonp(url);case 52:if(result=_context2.sent,"false"!==result.success){_context2.next=59;break}throw _identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat(result.message)),_identifyError.type="NotOn3g",_identifyError;case 59:return result.msisdn&&(_pn3=new _awesomePhonenumber.default(result.msisdn,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.country),_internationalMsisdn3=_pn3.getNumber("e164"),_msisdn3=_internationalMsisdn3.slice(1)),_context2.abrupt("return",{subscription_url:result.subscription_url||result.redirect_url,action:function action(){return subscribe(result.subscription_url)},msisdn:_msisdn3,operator:result.operator});case 61:case"end":return _context2.stop();}},_callee2)}));return function identifyUser(_x6){return _ref2.apply(this,arguments)}}();exports.identifyUser=identifyUser;var subscribe=function(){var _ref5=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(_url){return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:return _context3.abrupt("return","/product");case 1:case"end":return _context3.stop();}},_callee3)}));return function subscribe(_x7){return _ref5.apply(this,arguments)}}();exports.subscribe=subscribe;function mockConfig(flow){var opArr=Object.keys(operatorsConfig),r=opArr.filter(function(o){return operatorsConfig[o].flow===flow}),operator=r[0],flowObj=_objectSpread({offer:1,operator:operator,default:defaultFlowConfig},operatorsConfig[operator]);return flowObj}var mockedPinFlow={currentState:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:mockConfig("pin")}}};exports.mockedPinFlow=mockedPinFlow;var mockedMoFlow={currentState:{type:"MO",result:{nextAction:"submitMSISDNAction",config:mockConfig("mo")}}};exports.mockedMoFlow=mockedMoFlow;var mockedUssdFlow={currentState:{type:"USSD",result:{nextAction:"submitMSISDNAction",config:mockConfig("ussd")}}};exports.mockedUssdFlow=mockedUssdFlow;var mockedMoRdirFlow={currentState:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:mockConfig("moRedir")}}};exports.mockedMoRdirFlow=mockedMoRdirFlow;var mockedClick2smsFlow={currentState:{type:"CLICK2SMS",result:{nextAction:"loadOc2sms",config:mockConfig("click2sms")}}};exports.mockedClick2smsFlow=mockedClick2smsFlow;var mockedOneClickFlow={currentState:{type:"ONE_CLICK",result:{nextAction:"getRedirectUrlAction",config:mockConfig("oneClick")}}};exports.mockedOneClickFlow=mockedOneClickFlow;var mockedTPayFlow={currentState:{type:"TPAY_HE",result:{nextAction:"loadTpayAction",config:mockConfig("tpayHe")}}};exports.mockedTPayFlow=mockedTPayFlow;var mockedCreditCardFlow={currentState:{type:"CREDIT_CARD",result:{config:mockConfig("creditCard")}}};exports.mockedCreditCardFlow=mockedCreditCardFlow;
|
|
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.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.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.regexp.test.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.determineFlowByMsidn=determineFlowByMsidn,exports.determineFlowByOperator=determineFlowByOperator,exports.determineFlowByOperatorFromIp=determineFlowByOperatorFromIp,exports.getConfig=void 0,exports.getOperators=getOperators,exports.identifyUser=void 0,exports.left=left,exports.loop=void 0,exports.mockConfig=mockConfig,exports.mockedUssdFlow=exports.mockedTPayFlow=exports.mockedPinFlow=exports.mockedOneClickFlow=exports.mockedMoRdirFlow=exports.mockedMoFlow=exports.mockedCreditCardFlow=exports.mockedClick2smsFlow=void 0,exports.right=right,exports.wait=exports.subscribe=exports.searchToObject=void 0,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.split.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.join.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/web.url.js"),require("core-js/modules/web.url-search-params.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.string.match.js");var _awesomePhonenumber=_interopRequireDefault(require("awesome-phonenumber")),_tryGetIPRangeName=_interopRequireDefault(require("../../ips/tryGetIPRangeName")),_utilities=require("../../utilities");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}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 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 _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)})}}var wait=function(ms){return new Promise(function(resolve){return setTimeout(function(){return resolve()},ms)})};exports.wait=wait;var loop=function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(f,max,stop,i){var r;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:return _context.next=2,f();case 2:if(r=_context.sent,!(stop(r)||i>=max)){_context.next=5;break}return _context.abrupt("return",r);case 5:return _context.next=7,wait(1e3);case 7:return _context.abrupt("return",loop(f,max,stop,i+1));case 8:case"end":return _context.stop();}},_callee)}));return function loop(_x,_x2,_x3,_x4){return _ref.apply(this,arguments)}}();exports.loop=loop;function right(r){return{type:"right",value:r}}function left(l){return{type:"left",value:l}}var getConfig=function getConfig(){try{if("true"===process.env.testing){var _configs2=require("../../../mockData/config.json");return _configs2}var _configs=require("../../../../../config.json");return _configs}catch(ex){throw new Error("config.json not found")}};exports.getConfig=getConfig;var configs=getConfig(),defaultFlowConfig=configs.strategyConfigs.default,operatorsConfig=configs.strategyConfigs.operators,searchToObject=function searchToObject(){return"undefined"==typeof window?{}:window.location.search.substring(1).split("&").filter(function(x){return!!x&&0<x.length}).map(function(kv){return kv.split("=")}).reduce(function(a,b){return _objectSpread(_objectSpread({},a),{},_defineProperty({},b[0],b[1]))},{})};exports.searchToObject=searchToObject;function determineFlowByMsidn(_x5){return _determineFlowByMsidn.apply(this,arguments)}function _determineFlowByMsidn(){return _determineFlowByMsidn=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(internationalMSISDN){var submissionError,msisdn,indentifyFlow,theResult,flow,cannotDetect,hlrError,_submissionError,flowObj,_flowObj,_submissionError2;return _regeneratorRuntime().wrap(function _callee5$(_context5){for(;1;)switch(_context5.prev=_context5.next){case 0:if(internationalMSISDN){_context5.next=4;break}throw submissionError=new Error("Error in submitMSISDN() trigger-pin action"),submissionError.type="SEInvalidMSISDN",submissionError;case 4:return msisdn=internationalMSISDN.match(/\d+/gi).join(""),indentifyFlow=function(){var _ref6=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(){var config,slug,country,device,host,rockmanId,offer,flowOperatorResult;return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:return config=defaultFlowConfig.flowConfig,slug=config.slug,country=config.country,device=config.device,host=config.host,rockmanId=window.pac_analytics.visitor.rockmanId,offer=window.pac_analytics.visitor.offer,_context4.next=6,window.tallymanApi.identify(host,slug,country,msisdn,device,offer,rockmanId);case 6:return flowOperatorResult=_context4.sent,_context4.abrupt("return",flowOperatorResult);case 8:case"end":return _context4.stop();}},_callee4)}));return function indentifyFlow(){return _ref6.apply(this,arguments)}}(),_context5.next=8,indentifyFlow();case 8:if(theResult=_context5.sent,flow=operatorsConfig[theResult.operator]||operatorsConfig[_utilities.mapAgencyOperator[theResult.operator]]?operatorsConfig[theResult.operator]||operatorsConfig[_utilities.mapAgencyOperator[theResult.operator]]:null,cannotDetect=!1===theResult.success&&"Operator could not be found for the given MSISDN"===theResult.message,hlrError=!1===theResult.success&&-1!==theResult.message.indexOf("HLR did not find the operator for given MSISDN"),!(cannotDetect||hlrError)){_context5.next=19;break}throw _submissionError=new Error("Error in submitMSISDN() identify flow"),_submissionError.type="FlowDetectFailed",_submissionError.msisdn=msisdn,_submissionError;case 19:if(null===flow){_context5.next=24;break}return flowObj=_objectSpread({operator:theResult.operator,default:defaultFlowConfig},flow),_context5.abrupt("return",flowObj);case 24:if(null!==flow){_context5.next=29;break}return _flowObj=_objectSpread({operator:theResult.operator},defaultFlowConfig),_context5.abrupt("return",_flowObj);case 29:throw _submissionError2=new Error("Error in submitMSISDN() trigger-pin action"),_submissionError2.type="SEInvalidMSISDN",_submissionError2;case 32:case"end":return _context5.stop();}},_callee5)})),_determineFlowByMsidn.apply(this,arguments)}function determineFlowByOperator(operator){var flowObj=_objectSpread({operator:null===operator||void 0===operator?void 0:operator.toUpperCase(),default:defaultFlowConfig},operatorsConfig[null===operator||void 0===operator?void 0:operator.toUpperCase()]);return flowObj}function determineFlowByOperatorFromIp(){return _determineFlowByOperatorFromIp.apply(this,arguments)}function _determineFlowByOperatorFromIp(){return _determineFlowByOperatorFromIp=_asyncToGenerator(_regeneratorRuntime().mark(function _callee6(){var operator,flowObj;return _regeneratorRuntime().wrap(function _callee6$(_context6){for(;1;)switch(_context6.prev=_context6.next){case 0:return _context6.next=2,(0,_tryGetIPRangeName.default)(window.pac_analytics.visitor);case 2:return operator=_context6.sent,flowObj=determineFlowByOperator(operator?operator.toUpperCase():""),_context6.abrupt("return",flowObj);case 5:case"end":return _context6.stop();}},_callee6)})),_determineFlowByOperatorFromIp.apply(this,arguments)}function getOperators(){var operators=Object.keys(operatorsConfig);return operators}var fetchJsonp=function fetchJsonp(_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")))}})},identifyUser=function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(extraParams){var _window$pac_analytics,_window$pac_analytics2,_window$pac_analytics3,_window$pac_analytics4,config,host,country,slug,queryString,device,bupperizeCountry,offer,rockmanId,s,search,extraParamsQs,isDMB,searchObj,identifyError,subscription_url,_newUrl,_newQueryString,_urlParams,_msisdn,_operator,_window,_window$pac_analytics5,_window$pac_analytics6,pn,internationalMsisdn,redirect_url,_newUrl2,_newQueryString2,_urlParams2,_msisdn2,_operator2,_window2,_window2$pac_analytic,_window2$pac_analytic2,_pn,_internationalMsisdn,newUrl,newQueryString,urlParams,msisdn,operator,_window3,_window3$pac_analytic,_window3$pac_analytic2,_pn2,_internationalMsisdn2,url,result,_identifyError,_msisdn3,_window4,_window4$pac_analytic,_window4$pac_analytic2,_pn3,_internationalMsisdn3;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:if("undefined"!=typeof window){_context2.next=4;break}throw new Error("Error");case 4:if(config=defaultFlowConfig.flowConfig,host=config.host,country=config.country,slug=config.slug,queryString=config.queryString,device=config.device,bupperizeCountry=function bupperizeCountry(c){return"gb"===c?"uk":c},offer=window.pac_analytics.visitor.offer,rockmanId=window.pac_analytics.visitor.rockmanId,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("&"),extraParamsQs=extraParams?"&".concat(Object.keys(extraParams).map(function(k){return"".concat(k,"=").concat(extraParams[k])}).join("&")):"",isDMB=null!==window.pac_analytics.visitor.xaid&&-1!==(-1!==(null===(_window$pac_analytics=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics||null===(_window$pac_analytics2=_window$pac_analytics.toLowerCase())||void 0===_window$pac_analytics2?void 0:_window$pac_analytics2.indexOf("dmb"))||(null===(_window$pac_analytics3=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics3||null===(_window$pac_analytics4=_window$pac_analytics3.toLowerCase())||void 0===_window$pac_analytics4?void 0:_window$pac_analytics4.indexOf("amb"))),searchObj=searchToObject(),!searchObj["redirect-back"]){_context2.next=48;break}if("false"!==(null===searchObj||void 0===searchObj?void 0:searchObj.success)){_context2.next=21;break}throw identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat((null===searchObj||void 0===searchObj?void 0:searchObj.message)||"NotOn3g")),identifyError.type="NotOn3g",identifyError;case 21:if(!searchObj.subscription_url){_context2.next=30;break}return subscription_url=window.atob(searchObj.subscription_url),_newUrl=new URL(subscription_url),_newQueryString=_newUrl.search,_urlParams=new URLSearchParams(_newQueryString),_msisdn=_urlParams.get("msisdn")||(null===searchObj||void 0===searchObj?void 0:searchObj.msisdn)||null,_operator=_urlParams.get("operator")||(null===searchObj||void 0===searchObj?void 0:searchObj.operator)||null,_msisdn&&(pn=new _awesomePhonenumber.default(_msisdn,null===(_window=window)||void 0===_window||null===(_window$pac_analytics5=_window.pac_analytics)||void 0===_window$pac_analytics5||null===(_window$pac_analytics6=_window$pac_analytics5.visitor)||void 0===_window$pac_analytics6?void 0:_window$pac_analytics6.country),internationalMsisdn=pn.getNumber("e164"),_msisdn=internationalMsisdn.slice(1)),_context2.abrupt("return",{subscription_url:subscription_url,action:function action(){return subscribe(subscription_url)},msisdn:_msisdn,operator:_operator});case 30:if(!(null!==searchObj&&void 0!==searchObj&&searchObj.redirect_url)){_context2.next=39;break}return redirect_url=window.atob(null===searchObj||void 0===searchObj?void 0:searchObj.redirect_url),_newUrl2=new URL(redirect_url),_newQueryString2=_newUrl2.search,_urlParams2=new URLSearchParams(_newQueryString2),_msisdn2=_urlParams2.get("msisdn")||(null===searchObj||void 0===searchObj?void 0:searchObj.msisdn)||null,_operator2=_urlParams2.get("operator")||(null===searchObj||void 0===searchObj?void 0:searchObj.operator)||null,_msisdn2&&(_pn=new _awesomePhonenumber.default(_msisdn2,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.country),_internationalMsisdn=_pn.getNumber("e164"),_msisdn2=_internationalMsisdn.slice(1)),_context2.abrupt("return",{redirect_url:redirect_url,msisdn:_msisdn2,operator:_operator2});case 39:return newUrl=new URL(window.location.href),newQueryString=newUrl.search,urlParams=new URLSearchParams(newQueryString),msisdn=urlParams.get("msisdn")||(null===searchObj||void 0===searchObj?void 0:searchObj.msisdn)||null,operator=urlParams.get("operator")||(null===searchObj||void 0===searchObj?void 0:searchObj.operator)||null,msisdn&&(_pn2=new _awesomePhonenumber.default(msisdn,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.country),_internationalMsisdn2=_pn2.getNumber("e164"),msisdn=_internationalMsisdn2.slice(1)),_context2.abrupt("return",{msisdn:msisdn,operator:operator});case 46:_context2.next=60;break;case 48:return url="/tallyman/v1/?action=identify-user&country=".concat(bupperizeCountry(country),"&slug=").concat(slug,"&device=").concat(device,"&offerId=").concat(offer,"&page=").concat(window.location.href,"&pixel_url=").concat(encodeURIComponent("http://".concat(window.location.host,"/pixels?xcid=").concat(window.location.pathname.replace("/",""),"&xaid=").concat(window.pac_analytics.visitor.xaid,"&country=").concat(bupperizeCountry(country))),"&rockman_id=").concat(rockmanId).concat(extraParamsQs,"&").concat(search),_context2.next=51,fetchJsonp(url);case 51:if(result=_context2.sent,"false"!==result.success){_context2.next=58;break}throw _identifyError=new Error("Error in getRedirectUrl() identify-user action:\n".concat(result.message)),_identifyError.type="NotOn3g",_identifyError;case 58:return result.msisdn&&(_pn3=new _awesomePhonenumber.default(result.msisdn,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.country),_internationalMsisdn3=_pn3.getNumber("e164"),_msisdn3=_internationalMsisdn3.slice(1)),_context2.abrupt("return",{subscription_url:result.subscription_url||result.redirect_url,action:function action(){return subscribe(result.subscription_url)},msisdn:_msisdn3,operator:result.operator});case 60:case"end":return _context2.stop();}},_callee2)}));return function identifyUser(_x6){return _ref2.apply(this,arguments)}}();exports.identifyUser=identifyUser;var subscribe=function(){var _ref5=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(_url){return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:return _context3.abrupt("return","/product");case 1:case"end":return _context3.stop();}},_callee3)}));return function subscribe(_x7){return _ref5.apply(this,arguments)}}();exports.subscribe=subscribe;function mockConfig(flow){var opArr=Object.keys(operatorsConfig),r=opArr.filter(function(o){return operatorsConfig[o].flow===flow}),operator=r[0],flowObj=_objectSpread({offer:1,operator:operator,default:defaultFlowConfig},operatorsConfig[operator]);return flowObj}var mockedPinFlow={currentState:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:mockConfig("pin")}}};exports.mockedPinFlow=mockedPinFlow;var mockedMoFlow={currentState:{type:"MO",result:{nextAction:"submitMSISDNAction",config:mockConfig("mo")}}};exports.mockedMoFlow=mockedMoFlow;var mockedUssdFlow={currentState:{type:"USSD",result:{nextAction:"submitMSISDNAction",config:mockConfig("ussd")}}};exports.mockedUssdFlow=mockedUssdFlow;var mockedMoRdirFlow={currentState:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:mockConfig("moRedir")}}};exports.mockedMoRdirFlow=mockedMoRdirFlow;var mockedClick2smsFlow={currentState:{type:"CLICK2SMS",result:{nextAction:"loadOc2sms",config:mockConfig("click2sms")}}};exports.mockedClick2smsFlow=mockedClick2smsFlow;var mockedOneClickFlow={currentState:{type:"ONE_CLICK",result:{nextAction:"getRedirectUrlAction",config:mockConfig("oneClick")}}};exports.mockedOneClickFlow=mockedOneClickFlow;var mockedTPayFlow={currentState:{type:"TPAY_HE",result:{nextAction:"loadTpayAction",config:mockConfig("tpayHe")}}};exports.mockedTPayFlow=mockedTPayFlow;var mockedCreditCardFlow={currentState:{type:"CREDIT_CARD",result:{config:mockConfig("creditCard")}}};exports.mockedCreditCardFlow=mockedCreditCardFlow;
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { IConfig } from '../reducers/strategy/StrategyTypes';
|
|
2
2
|
export declare const isDMBCheck: () => boolean;
|
|
3
|
-
export declare const getHost: ({ host }: {
|
|
4
|
-
host: string;
|
|
5
|
-
}) => string;
|
|
6
3
|
export declare const setOnLoadUtilities: (config: IConfig) => void;
|
|
7
4
|
export declare type SAOperators = 'SA_VIRGIN' | 'SA_MOBILY' | 'SA_STC' | 'SA_ZAIN';
|
|
8
5
|
export declare function getSAOperatorByMsisdnPrefix(msisdn: string): SAOperators | undefined;
|
package/dist/utilities/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getKeyByValue=exports.
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getKeyByValue=exports.getCookie=void 0,exports.getSAOperatorByMsisdnPrefix=getSAOperatorByMsisdnPrefix,exports.setOnLoadUtilities=exports.mapAgencyOperator=exports.isDMBCheck=exports.isCookieExists=exports.hasNumber=void 0,require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.map.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.regexp.test.js"),require("core-js/modules/es.array.find.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.string.match.js"),require("core-js/modules/es.regexp.constructor.js"),require("core-js/modules/es.regexp.sticky.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.string.split.js");var _utils=require("../reducers/moFlow/utils"),_utils2=require("../reducers/moRedirFlow/utils"),_utils3=require("../reducers/pinFlow/utils"),isDMBCheck=function(){var _window$pac_analytics,_window$pac_analytics2,_window$pac_analytics3,_window$pac_analytics4;return!(null===window.pac_analytics.visitor.xaid||-1===(-1!==(null===(_window$pac_analytics=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics||null===(_window$pac_analytics2=_window$pac_analytics.toLowerCase())||void 0===_window$pac_analytics2?void 0:_window$pac_analytics2.indexOf("dmb"))||(null===(_window$pac_analytics3=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics3||null===(_window$pac_analytics4=_window$pac_analytics3.toLowerCase())||void 0===_window$pac_analytics4?void 0:_window$pac_analytics4.indexOf("amb"))))};exports.isDMBCheck=isDMBCheck;var setOnLoadUtilities=function(config){"undefined"!=typeof window&&("cz"===process.env.country.toLowerCase()&&(0,_utils.getGoogleReCaptchaConfig)(config),"a2"===process.env.country.toLowerCase()&&"production"===process.env.NODE_ENV&&(0,_utils2.startEvinaAgency)(config),("sa"===process.env.country.toLowerCase()||"iq"===process.env.country.toLowerCase()||"k2"===process.env.country.toLowerCase()||"bh"===process.env.country.toLowerCase())&&(0,_utils3.loadMcpShield)(window,config))};exports.setOnLoadUtilities=setOnLoadUtilities;var saPrefixOperatorMap=new Map([["966571","SA_VIRGIN"],["966500","SA_STC"],["966501","SA_STC"],["966502","SA_STC"],["966503","SA_STC"],["966504","SA_STC"],["966505","SA_STC"],["966506","SA_STC"],["966507","SA_STC"],["966508","SA_STC"],["966509","SA_STC"],["966512","SA_STC"],["966514","SA_STC"],["966515","SA_STC"],["966517","SA_STC"],["966530","SA_STC"],["966531","SA_STC"],["966532","SA_STC"],["966533","SA_STC"],["966534","SA_STC"],["966535","SA_STC"],["966536","SA_STC"],["966537","SA_STC"],["966538","SA_STC"],["966539","SA_STC"],["966540","SA_MOBILY"],["966541","SA_MOBILY"],["966542","SA_MOBILY"],["966543","SA_MOBILY"],["966544","SA_MOBILY"],["966545","SA_MOBILY"],["966546","SA_MOBILY"],["966547","SA_MOBILY"],["966548","SA_MOBILY"],["966549","SA_MOBILY"],["966550","SA_STC"],["966551","SA_STC"],["966552","SA_STC"],["966553","SA_STC"],["966554","SA_STC"],["966555","SA_STC"],["966556","SA_STC"],["966557","SA_STC"],["966558","SA_STC"],["966559","SA_STC"],["966560","SA_MOBILY"],["966561","SA_MOBILY"],["966562","SA_MOBILY"],["966563","SA_MOBILY"],["966564","SA_MOBILY"],["966565","SA_MOBILY"],["966566","SA_MOBILY"],["966567","SA_MOBILY"],["966568","SA_MOBILY"],["966569","SA_MOBILY"],["966570","SA_VIRGIN"],["966572","SA_VIRGIN"],["966573","SA_VIRGIN"],["966580","SA_ZAIN"],["966581","SA_ZAIN"],["966582","SA_ZAIN"],["966583","SA_ZAIN"],["966586","SA_ZAIN"],["966588","SA_ZAIN"],["966589","SA_ZAIN"],["966590","SA_ZAIN"],["966591","SA_ZAIN"],["966592","SA_ZAIN"],["966593","SA_ZAIN"],["966594","SA_ZAIN"],["966595","SA_ZAIN"],["966596","SA_ZAIN"],["966597","SA_ZAIN"],["966598","SA_ZAIN"],["966599","SA_ZAIN"]]);function getSAOperatorByMsisdnPrefix(msisdn){var msisdnF=msisdn;"0"===msisdnF[0]&&(msisdnF="966".concat(msisdnF.substring(1)));var prefix=msisdnF.substring(0,6);return saPrefixOperatorMap.get(prefix)}var hasNumber=function(myString){return /\d/.test(myString)};exports.hasNumber=hasNumber;var mapAgencyOperator={SA_STC:"S2_STC",SA_MOBILY:"S2_MOBILY",SA_ZAIN:"S2_ZAIN",KW_ZAIN:"K2_ZAIN",KW_OOREDOO:"K2_OOREDOO",KW_VIVA:"K2_VIVA",AE_DU:"A2_DU",AE_ETISALAT:"A2_ETISALAT",CA_SUNRISE:"C2_SUNRISE",CA_TELE2:"C2_TELE2",CA_SWISSCOM:"C2_SWISSCOM",CA_SALT:"C2_SALT",OM_OOREDOO:"O2_OOREDOO",OM_OMANTEL:"O2_OMANTEL",RS_TELEKOM:"R2_TELEKOM",RS_VIP:"R2_VIP",RS_TELIM:"R2_TELIM",BH_ZAIN:"B2_ZAIN",BH_BATELCO:"B2_BATELCO",BH_STC:"B2_STC",GR_VODAFONE:"G2_VODAFONE",GR_WIND:"G2_WIND",GR_COSMOTE:"G2_COSMOTE",AT_TELECOM:"A3_TELECOM",AT_DRIE:"A3_DRIE",AT_TMOBILE:"A3_TMOBILE"};exports.mapAgencyOperator=mapAgencyOperator;var getKeyByValue=function(object,value){return Object.keys(object).find(function(key){return object[key]===value})};exports.getKeyByValue=getKeyByValue;var isCookieExists=function(cookieName){return"undefined"!=typeof window&&null!==document.cookie.match(new RegExp("^(.*;)?\\s*".concat(cookieName,"\\s*=\\s*[^;]+(.*)?$")))};exports.isCookieExists=isCookieExists;var getCookie=function(cookieName){for(var cookie,name="".concat(cookieName,"="),decodedCookie=decodeURIComponent(document.cookie),cookieArray=decodedCookie.split(";"),i=0;i<cookieArray.length;i++){for(cookie=cookieArray[i];" "===cookie.charAt(0);)cookie=cookie.substring(1);if(0===cookie.indexOf(name))return cookie.substring(name.length,cookie.length)}return null};exports.getCookie=getCookie;
|
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import typescript from '@rollup/plugin-typescript';
|
|
2
|
+
import { terser } from 'rollup-plugin-terser';
|
|
3
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
4
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
5
|
+
|
|
6
|
+
const flowModules = [
|
|
7
|
+
'pinFlow',
|
|
8
|
+
'moFlow'
|
|
9
|
+
// Add other flows as needed
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
export default flowModules.map((flow) => ({
|
|
13
|
+
input: `src/reducers/${flow}/index.ts`,
|
|
14
|
+
output: [
|
|
15
|
+
{
|
|
16
|
+
file: `dist/flows/${flow}/index.js`,
|
|
17
|
+
format: 'esm',
|
|
18
|
+
sourcemap: true
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
plugins: [
|
|
22
|
+
resolve(), // Resolves node modules
|
|
23
|
+
commonjs(), // Converts CommonJS modules to ES6
|
|
24
|
+
typescript(), // Compiles TypeScript
|
|
25
|
+
terser() // Minify the output (optional)
|
|
26
|
+
]
|
|
27
|
+
}));
|