ouisys-engine 4.1.23 → 4.1.24

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.
@@ -237,6 +237,7 @@ export interface IMockFlowParams<T> {
237
237
  'show-pin-entry': '1' | '0';
238
238
  'show-thank-you': '1' | '0';
239
239
  operator: string;
240
+ msisdn?: string;
240
241
  }
241
242
  export interface IScriptHeaderEnrichmentSuccess extends CustomEvent {
242
243
  detail: {
@@ -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.object.keys.js"),require("core-js/modules/es.array.filter.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.weak-map.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.StrategyFlowActionMaps=void 0,exports.checkSubscriptionAction=checkSubscriptionAction,exports.default=StrategyReducer,exports.genericHandler=genericHandler,exports.identifyStrategy=identifyStrategy,exports.mockStrategyStateByUrlParam=mockStrategyStateByUrlParam,exports.tracker=void 0,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js");var _immutabilityHelper=_interopRequireDefault(require("immutability-helper")),RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_pacman=_interopRequireDefault(require("../../pacman")),_utilities=require("../../utilities"),_click2smsFlow=require("../click2smsFlow"),_utils=require("../click2smsFlow/utils"),_creditCardFlow=require("../creditCardFlow"),_moFlow=require("../moFlow"),_moRedirFlow=require("../moRedirFlow"),_oneClickFlow=require("../oneClickFlow"),_pinFlow=require("../pinFlow"),_ussdFlow=require("../ussdFlow"),_ask_mobile_number=_interopRequireWildcard(require("./strategies/ask_mobile_number")),_ask_operator=_interopRequireWildcard(require("./strategies/ask_operator")),_detect_operator_by_ip=_interopRequireDefault(require("./strategies/detect_operator_by_ip")),_header_enrichment=_interopRequireDefault(require("./strategies/header_enrichment")),_injectHeaderEnrichmentScript=_interopRequireDefault(require("./strategies/injectHeaderEnrichmentScript")),_utils2=require("./utils");function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function 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 tracker=(0,_pacman.default)("undefined"==typeof window?null:window);exports.tracker=tracker;function mockStrategyStateByUrlParam(){return function(dispatch){var search=(0,_utils2.searchToObject)();if(void 0!==search["mock-flow"])switch(void 0!==search.operator&&(window.operator=search.operator),search["mock-flow"]){case"pin":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedPinFlow.currentState}),dispatch((0,_pinFlow.mockPinFlow)(search["current-state"]));break;case"mo":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedMoFlow.currentState}),dispatch((0,_moFlow.mockMoFlow)(search["current-state"]));break;case"moredir":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedMoRdirFlow.currentState}),dispatch((0,_moRedirFlow.mockMoRedirFlow)(search["current-state"]));break;case"oneclick":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedOneClickFlow.currentState}),setTimeout(function(){dispatch((0,_oneClickFlow.mockOneClickFlow)(search["current-state"]))},2e3);break;case"click2sms":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedClick2smsFlow.currentState});break;case"ussd":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedUssdFlow.currentState}),dispatch((0,_ussdFlow.mockUssdFlow)(search["current-state"]));break;case"creditcard":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedCreditCardFlow.currentState}),dispatch((0,_creditCardFlow.mockCreditCardFlow)(search["current-state"]));break;default:throw new Error("(mockStrategyStateByUrlParam) Strategy Mock Flow not supported");}}}function identifyStrategy(){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch){var _getConfig,strategy,strategyConfigs,isUseMsisdnPrefix,search,_strategyConfigs$defa,flowObj;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(_getConfig=(0,_utils2.getConfig)(),strategy=_getConfig.strategy,strategyConfigs=_getConfig.strategyConfigs,isUseMsisdnPrefix=strategyConfigs.isUseMsisdnPrefix,search=(0,_utils2.searchToObject)(),dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"IDENTIFY_STRATEGY",result:RDS.Loading()}}),void 0===search["mock-flow"]){_context.next=8;break}dispatch(mockStrategyStateByUrlParam()),_context.next=39;break;case 8:if(!(search["show-pin-entry"]&&"1"===search["show-pin-entry"]||search["show-thank-you"]&&"1"===search["show-thank-you"])){_context.next=13;break}flowObj=(0,_utils2.determineFlowByOperator)(search.operator),dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:(null===flowObj||void 0===flowObj?void 0:flowObj.flowConfig)||(null===strategyConfigs||void 0===strategyConfigs||null===(_strategyConfigs$defa=strategyConfigs.default)||void 0===_strategyConfigs$defa?void 0:_strategyConfigs$defa.flowConfig),isUseMsisdnPrefix:isUseMsisdnPrefix}}}),_context.next=39;break;case 13:_context.t0=strategy,_context.next="pin-mo-ask-operator"===_context.t0?16:"pin-mo-redir-ask-mobile-number"===_context.t0?17:"pin-mo-ask-mobile-number"===_context.t0?17:"pin-combo-ask-mobile-number"===_context.t0?17:"pin-one-click-detect-operator-by-ip"===_context.t0?18:"one-click-mo-pin-detect-operator-by-ip-or-msisdn"===_context.t0?18:"mo-redir-one-click-detect-operator-by-ip"===_context.t0?18:"mo-one-click-detect-operator-by-ip"===_context.t0?18:"click2sms-one-click-detect-operator-by-ip"===_context.t0?18:"pin-mo-detect-operator-by-ip"===_context.t0?18:"mo-redir-mo-click2sms-one-click-detect-operator-by-ip-or-msisdn"===_context.t0?18:"pin-click2sms-ask-operator"===_context.t0?19:"he-pin-one-click-ask-operator"===_context.t0?19:"click2sms-one-click-ask-operator"===_context.t0?19:"pin-one-click-ask-operator"===_context.t0?19:"pin-header-enrichment"===_context.t0?20:"he-pin-mo-redir-header-enrichment"===_context.t0?20:"he-pin-one-click-header-enrichment"===_context.t0?20:"he-mo-redir-one-click-header-enrichment"===_context.t0?20:"header-enrichment-script"===_context.t0?21:"pin"===_context.t0?22:"mo"===_context.t0?25:"mo-redir"===_context.t0?27:"one-click"===_context.t0?29:"click2sms"===_context.t0?31:"ussd"===_context.t0?33:"tpay-he"===_context.t0?35:"credit-card"===_context.t0?37:38;break;case 16:return _context.abrupt("return",dispatch((0,_ask_operator.default)()));case 17:return _context.abrupt("return",dispatch((0,_ask_mobile_number.default)()));case 18:return _context.abrupt("return",dispatch((0,_detect_operator_by_ip.default)()));case 19:return _context.abrupt("return",dispatch((0,_ask_operator.default)()));case 20:return _context.abrupt("return",dispatch((0,_header_enrichment.default)()));case 21:return _context.abrupt("return",dispatch((0,_injectHeaderEnrichmentScript.default)()));case 22:return tracker.sendOptInFlowEvent("Pin"),!0===window.isLoading&&dispatch((0,_pinFlow.checkLoadingAction)()),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig,isUseMsisdnPrefix:isUseMsisdnPrefix,isHeaderEnrichmentSuccess:(0,_utilities.isCookieExists)("OMEU")&&"ES"===strategyConfigs.default.flowConfig.country}}}));case 25:return tracker.sendOptInFlowEvent("Msisdn to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"MO",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 27:return tracker.sendOptInFlowEvent("Redirect"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 29:return tracker.sendOptInFlowEvent("3G click"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"ONE_CLICK",result:{nextAction:"getRedirectUrlAction",config:strategyConfigs.default.flowConfig}}}));case 31:return tracker.sendOptInFlowEvent("Click to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"CLICK2SMS",result:{nextAction:"loadOc2sms",config:strategyConfigs.default.flowConfig}}}));case 33:return tracker.sendOptInFlowEvent("Msisdn to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"USSD",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 35:return tracker.sendOptInFlowEvent("Hybrid Pin"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"TPAY_HE",result:{nextAction:"loadTpayAction",config:strategyConfigs.default.flowConfig}}}));case 37:return _context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"CREDIT_CARD",result:{config:strategyConfigs.default.flowConfig,isUseMsisdnPrefix:isUseMsisdnPrefix}}}));case 38:throw new Error("Strategy not supported");case 39:case"end":return _context.stop();}},_callee)}));return function(_x){return _ref.apply(this,arguments)}}()}function checkSubscriptionAction(trackingArgs){return function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(dispatch,store){var currentState,maybeConfig;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:currentState=store().strategy.currentState,maybeConfig=currentState.result.config;try{dispatch({type:"CHECK_SUBSCRIPTION"}),(0,_utils.checkSubscription)(window,maybeConfig).then(function(product_url){product_url&&""!==product_url&&(tracker.advancedInFlow(trackingArgs.flow,trackingArgs.action,_objectSpread(_objectSpread({},trackingArgs.args),{},{url:product_url})),setTimeout(function(){window.location.href=product_url},1e3))})}catch(ex){console.warn(ex)}case 3:case"end":return _context2.stop();}},_callee2)}));return function(_x2,_x3){return _ref2.apply(this,arguments)}}()}function genericHandler(state,payload){return(0,_immutabilityHelper.default)(state,{currentState:{$set:payload}})}var search=(0,_utils2.searchToObject)(),isPinEntryStep=search["show-pin-entry"]&&"1"===search["show-pin-entry"],configs=(0,_utils2.getConfig)(),defaultFlowConfig=configs.strategyConfigs.default,initialStateDefault={currentState:{type:"IDENTIFY_STRATEGY",result:RDS.NothingYet()}},initalPinEntryState={currentState:{type:"IDENTIFY_STRATEGY",result:RDS.Success({type:"PIN",result:{nextAction:"submitMSISDNAction",config:defaultFlowConfig.flowConfig}})}},initialState=isPinEntryStep?initalPinEntryState:initialStateDefault,StrategyFlowActionMaps={selectOperator:_ask_operator.selectOperator,submitMSISDNAction:_ask_mobile_number.submitMSISDNAction,loadOc2sms:_click2smsFlow.loadOc2sms};exports.StrategyFlowActionMaps=StrategyFlowActionMaps;function StrategyReducer(){var state=0<arguments.length&&arguments[0]!==void 0?arguments[0]:initialState,action=1<arguments.length?arguments[1]:void 0;switch(action.type){case"IDENTIFY_STRATEGY":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_OPERATOR_SELECT":return genericHandler(state,action.payload);case"OPERATOR_SELECT":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_MSISDN":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_MSISDN_SUBMIT":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_IP":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_IP_OPERATOR":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_HE":return genericHandler(state,action.payload);case"HE_IDENTIFY":return genericHandler(state,action.payload);case"MOCK_STRATEGY_STATE":return genericHandler(state,action.payload);default:return state;}}
1
+ "use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.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.object.keys.js"),require("core-js/modules/es.array.filter.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.weak-map.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.StrategyFlowActionMaps=void 0,exports.checkSubscriptionAction=checkSubscriptionAction,exports.default=StrategyReducer,exports.genericHandler=genericHandler,exports.identifyStrategy=identifyStrategy,exports.mockStrategyStateByUrlParam=mockStrategyStateByUrlParam,exports.tracker=void 0,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js");var _immutabilityHelper=_interopRequireDefault(require("immutability-helper")),RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_pacman=_interopRequireDefault(require("../../pacman")),_utilities=require("../../utilities"),_click2smsFlow=require("../click2smsFlow"),_utils=require("../click2smsFlow/utils"),_creditCardFlow=require("../creditCardFlow"),_moFlow=require("../moFlow"),_moRedirFlow=require("../moRedirFlow"),_oneClickFlow=require("../oneClickFlow"),_pinFlow=require("../pinFlow"),_ussdFlow=require("../ussdFlow"),_ask_mobile_number=_interopRequireWildcard(require("./strategies/ask_mobile_number")),_ask_operator=_interopRequireWildcard(require("./strategies/ask_operator")),_detect_operator_by_ip=_interopRequireDefault(require("./strategies/detect_operator_by_ip")),_header_enrichment=_interopRequireDefault(require("./strategies/header_enrichment")),_injectHeaderEnrichmentScript=_interopRequireDefault(require("./strategies/injectHeaderEnrichmentScript")),_utils2=require("./utils");function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function 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 tracker=(0,_pacman.default)("undefined"==typeof window?null:window);exports.tracker=tracker;function mockStrategyStateByUrlParam(){return function(dispatch){var search=(0,_utils2.searchToObject)();if(void 0!==search["mock-flow"])switch(void 0!==search.operator&&(window.operator=search.operator),search["mock-flow"]){case"pin":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedPinFlow.currentState}),dispatch((0,_pinFlow.mockPinFlow)(search["current-state"]));break;case"mo":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedMoFlow.currentState}),dispatch((0,_moFlow.mockMoFlow)(search["current-state"]));break;case"moredir":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedMoRdirFlow.currentState}),dispatch((0,_moRedirFlow.mockMoRedirFlow)(search["current-state"]));break;case"oneclick":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedOneClickFlow.currentState}),setTimeout(function(){dispatch((0,_oneClickFlow.mockOneClickFlow)(search["current-state"]))},2e3);break;case"click2sms":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedClick2smsFlow.currentState});break;case"ussd":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedUssdFlow.currentState}),dispatch((0,_ussdFlow.mockUssdFlow)(search["current-state"]));break;case"creditcard":dispatch({type:"MOCK_STRATEGY_STATE",payload:_utils2.mockedCreditCardFlow.currentState}),dispatch((0,_creditCardFlow.mockCreditCardFlow)(search["current-state"]));break;default:throw new Error("(mockStrategyStateByUrlParam) Strategy Mock Flow not supported");}}}function identifyStrategy(){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch){var _getConfig,strategy,strategyConfigs,isUseMsisdnPrefix,search,_strategyConfigs$defa,flowObj;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(_getConfig=(0,_utils2.getConfig)(),strategy=_getConfig.strategy,strategyConfigs=_getConfig.strategyConfigs,isUseMsisdnPrefix=strategyConfigs.isUseMsisdnPrefix,search=(0,_utils2.searchToObject)(),dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"IDENTIFY_STRATEGY",result:RDS.Loading()}}),void 0===search["mock-flow"]){_context.next=8;break}dispatch(mockStrategyStateByUrlParam()),_context.next=40;break;case 8:if(!(search["show-pin-entry"]&&"1"===search["show-pin-entry"]||search["show-thank-you"]&&"1"===search["show-thank-you"])){_context.next=13;break}flowObj=(0,_utils2.determineFlowByOperator)(search.operator),dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:(null===flowObj||void 0===flowObj?void 0:flowObj.flowConfig)||(null===strategyConfigs||void 0===strategyConfigs||null===(_strategyConfigs$defa=strategyConfigs.default)||void 0===_strategyConfigs$defa?void 0:_strategyConfigs$defa.flowConfig),isUseMsisdnPrefix:isUseMsisdnPrefix}}}),_context.next=40;break;case 13:_context.t0=strategy,_context.next="pin-mo-ask-operator"===_context.t0?16:"pin-mo-redir-ask-mobile-number"===_context.t0?17:"pin-mo-ask-mobile-number"===_context.t0?17:"pin-combo-ask-mobile-number"===_context.t0?17:"pin-one-click-detect-operator-by-ip"===_context.t0?18:"one-click-mo-pin-detect-operator-by-ip-or-msisdn"===_context.t0?18:"mo-redir-one-click-detect-operator-by-ip"===_context.t0?18:"mo-one-click-detect-operator-by-ip"===_context.t0?18:"click2sms-one-click-detect-operator-by-ip"===_context.t0?18:"pin-mo-detect-operator-by-ip"===_context.t0?18:"mo-redir-mo-click2sms-one-click-detect-operator-by-ip-or-msisdn"===_context.t0?18:"pin-click2sms-ask-operator"===_context.t0?19:"he-pin-one-click-ask-operator"===_context.t0?19:"click2sms-one-click-ask-operator"===_context.t0?19:"pin-one-click-ask-operator"===_context.t0?19:"pin-header-enrichment"===_context.t0?20:"he-pin-mo-redir-header-enrichment"===_context.t0?20:"he-pin-one-click-header-enrichment"===_context.t0?20:"he-mo-redir-one-click-header-enrichment"===_context.t0?20:"header-enrichment-script"===_context.t0?21:"pin"===_context.t0?22:"mo"===_context.t0?26:"mo-redir"===_context.t0?28:"one-click"===_context.t0?30:"click2sms"===_context.t0?32:"ussd"===_context.t0?34:"tpay-he"===_context.t0?36:"credit-card"===_context.t0?38:39;break;case 16:return _context.abrupt("return",dispatch((0,_ask_operator.default)()));case 17:return _context.abrupt("return",dispatch((0,_ask_mobile_number.default)()));case 18:return _context.abrupt("return",dispatch((0,_detect_operator_by_ip.default)()));case 19:return _context.abrupt("return",dispatch((0,_ask_operator.default)()));case 20:return _context.abrupt("return",dispatch((0,_header_enrichment.default)()));case 21:return _context.abrupt("return",dispatch((0,_injectHeaderEnrichmentScript.default)()));case 22:return tracker.sendOptInFlowEvent("Pin"),search.msisdn&&tracker.customEvent("Flow","advance-auto","got-msisdn-from-url",{msisdn:search.msisdn}),!0===window.isLoading&&dispatch((0,_pinFlow.checkLoadingAction)()),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"PIN",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig,isUseMsisdnPrefix:isUseMsisdnPrefix,msisdn:search.msisdn,isHeaderEnrichmentSuccess:(0,_utilities.isCookieExists)("OMEU")&&"ES"===strategyConfigs.default.flowConfig.country||search.msisdn}}}));case 26:return tracker.sendOptInFlowEvent("Msisdn to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"MO",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 28:return tracker.sendOptInFlowEvent("Redirect"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"MO_REDIR",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 30:return tracker.sendOptInFlowEvent("3G click"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"ONE_CLICK",result:{nextAction:"getRedirectUrlAction",config:strategyConfigs.default.flowConfig}}}));case 32:return tracker.sendOptInFlowEvent("Click to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"CLICK2SMS",result:{nextAction:"loadOc2sms",config:strategyConfigs.default.flowConfig}}}));case 34:return tracker.sendOptInFlowEvent("Msisdn to sms"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"USSD",result:{nextAction:"submitMSISDNAction",config:strategyConfigs.default.flowConfig}}}));case 36:return tracker.sendOptInFlowEvent("Hybrid Pin"),_context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"TPAY_HE",result:{nextAction:"loadTpayAction",config:strategyConfigs.default.flowConfig}}}));case 38:return _context.abrupt("return",dispatch({type:"IDENTIFY_STRATEGY",payload:{type:"CREDIT_CARD",result:{config:strategyConfigs.default.flowConfig,isUseMsisdnPrefix:isUseMsisdnPrefix}}}));case 39:throw new Error("Strategy not supported");case 40:case"end":return _context.stop();}},_callee)}));return function(_x){return _ref.apply(this,arguments)}}()}function checkSubscriptionAction(trackingArgs){return function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(dispatch,store){var currentState,maybeConfig;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:currentState=store().strategy.currentState,maybeConfig=currentState.result.config;try{dispatch({type:"CHECK_SUBSCRIPTION"}),(0,_utils.checkSubscription)(window,maybeConfig).then(function(product_url){product_url&&""!==product_url&&(tracker.advancedInFlow(trackingArgs.flow,trackingArgs.action,_objectSpread(_objectSpread({},trackingArgs.args),{},{url:product_url})),setTimeout(function(){window.location.href=product_url},1e3))})}catch(ex){console.warn(ex)}case 3:case"end":return _context2.stop();}},_callee2)}));return function(_x2,_x3){return _ref2.apply(this,arguments)}}()}function genericHandler(state,payload){return(0,_immutabilityHelper.default)(state,{currentState:{$set:payload}})}var search=(0,_utils2.searchToObject)(),isPinEntryStep=search["show-pin-entry"]&&"1"===search["show-pin-entry"],configs=(0,_utils2.getConfig)(),defaultFlowConfig=configs.strategyConfigs.default,initialStateDefault={currentState:{type:"IDENTIFY_STRATEGY",result:RDS.NothingYet()}},initalPinEntryState={currentState:{type:"IDENTIFY_STRATEGY",result:RDS.Success({type:"PIN",result:{nextAction:"submitMSISDNAction",config:defaultFlowConfig.flowConfig}})}},initialState=isPinEntryStep?initalPinEntryState:initialStateDefault,StrategyFlowActionMaps={selectOperator:_ask_operator.selectOperator,submitMSISDNAction:_ask_mobile_number.submitMSISDNAction,loadOc2sms:_click2smsFlow.loadOc2sms};exports.StrategyFlowActionMaps=StrategyFlowActionMaps;function StrategyReducer(){var state=0<arguments.length&&arguments[0]!==void 0?arguments[0]:initialState,action=1<arguments.length?arguments[1]:void 0;switch(action.type){case"IDENTIFY_STRATEGY":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_OPERATOR_SELECT":return genericHandler(state,action.payload);case"OPERATOR_SELECT":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_MSISDN":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_MSISDN_SUBMIT":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_IP":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_IP_OPERATOR":return genericHandler(state,action.payload);case"IDENTIFY_FLOW_BY_HE":return genericHandler(state,action.payload);case"HE_IDENTIFY":return genericHandler(state,action.payload);case"MOCK_STRATEGY_STATE":return genericHandler(state,action.payload);default:return state;}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "4.1.23",
3
+ "version": "4.1.24",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",