ouisys-engine 4.3.0-alpha.0 → 4.5.0-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.
Files changed (158) hide show
  1. package/dist/@types/window.d.js +1 -1
  2. package/dist/api/index.d.ts +43 -0
  3. package/dist/api/index.js +1 -728
  4. package/dist/common-types/AppThunk.d.ts +13 -0
  5. package/dist/common-types/AppThunk.js +1 -1
  6. package/dist/common-types/Either.d.ts +8 -0
  7. package/dist/common-types/Either.js +1 -1
  8. package/dist/common-types/IError.d.ts +3 -0
  9. package/dist/common-types/IError.js +1 -1
  10. package/dist/common-types/IOptInFlowName.d.ts +1 -0
  11. package/dist/common-types/ITracker.d.ts +9 -0
  12. package/dist/common-types/ITracker.js +1 -3
  13. package/dist/common-types/IVisitor.d.ts +14 -0
  14. package/dist/common-types/IVisitor.js +1 -1
  15. package/dist/common-types/RemoteDataState.d.ts +38 -0
  16. package/dist/common-types/RemoteDataState.js +1 -135
  17. package/dist/custom-hooks/useOneClickRedirectUrl.d.ts +3 -0
  18. package/dist/custom-hooks/useOneClickRedirectUrl.js +1 -0
  19. package/dist/custom-hooks/usePinEntryState.d.ts +8 -0
  20. package/dist/custom-hooks/usePinEntryState.js +1 -0
  21. package/dist/custom-hooks/useStrategyConfig.d.ts +4 -0
  22. package/dist/custom-hooks/useStrategyConfig.js +1 -0
  23. package/dist/flows/click2smsFlow.d.ts +6 -0
  24. package/dist/flows/click2smsFlow.js +1 -19
  25. package/dist/flows/creditCardFlow.d.ts +6 -0
  26. package/dist/flows/creditCardFlow.js +1 -0
  27. package/dist/flows/moFlow.d.ts +6 -0
  28. package/dist/flows/moFlow.js +1 -19
  29. package/dist/flows/moRedirFlow.d.ts +6 -0
  30. package/dist/flows/moRedirFlow.js +1 -19
  31. package/dist/flows/oneClickFlow.d.ts +7 -0
  32. package/dist/flows/oneClickFlow.js +1 -23
  33. package/dist/flows/pinFlow.d.ts +7 -0
  34. package/dist/flows/pinFlow.js +1 -23
  35. package/dist/flows/strategy.d.ts +14 -0
  36. package/dist/flows/strategy.js +1 -53
  37. package/dist/flows/ussdFlow.d.ts +6 -0
  38. package/dist/flows/ussdFlow.js +1 -19
  39. package/dist/index.d.ts +0 -0
  40. package/dist/index.js +0 -2
  41. package/dist/ips/tryGetIPRangeName.d.ts +2 -0
  42. package/dist/ips/tryGetIPRangeName.js +1 -74
  43. package/dist/jest.config.js +194 -0
  44. package/dist/pacman/index.d.ts +6 -0
  45. package/dist/pacman/index.js +1 -108
  46. package/dist/pacman/queryString.d.ts +3 -0
  47. package/dist/pacman/queryString.js +1 -45
  48. package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +76 -0
  49. package/dist/reducers/click2smsFlow/Click2smsTypes.js +1 -1
  50. package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +2 -0
  51. package/dist/reducers/click2smsFlow/IClick2smsConstants.js +1 -1
  52. package/dist/reducers/click2smsFlow/index.d.ts +5 -0
  53. package/dist/reducers/click2smsFlow/index.js +1 -183
  54. package/dist/reducers/click2smsFlow/utils.d.ts +4 -0
  55. package/dist/reducers/click2smsFlow/utils.js +1 -357
  56. package/dist/reducers/creditCardFlow/CreditCardTypes.d.ts +79 -0
  57. package/dist/reducers/creditCardFlow/CreditCardTypes.js +1 -0
  58. package/dist/reducers/creditCardFlow/ICreditCardConstants.d.ts +2 -0
  59. package/dist/reducers/creditCardFlow/ICreditCardConstants.js +1 -0
  60. package/dist/reducers/creditCardFlow/index.d.ts +5 -0
  61. package/dist/reducers/creditCardFlow/index.js +1 -0
  62. package/dist/reducers/creditCardFlow/utils.d.ts +8 -0
  63. package/dist/reducers/creditCardFlow/utils.js +1 -0
  64. package/dist/reducers/moFlow/IMoConstants.d.ts +2 -0
  65. package/dist/reducers/moFlow/IMoConstants.js +1 -1
  66. package/dist/reducers/moFlow/MoTypes.d.ts +88 -0
  67. package/dist/reducers/moFlow/MoTypes.js +1 -1
  68. package/dist/reducers/moFlow/index.d.ts +16 -0
  69. package/dist/reducers/moFlow/index.js +1 -251
  70. package/dist/reducers/moFlow/utils.d.ts +12 -0
  71. package/dist/reducers/moFlow/utils.js +1 -284
  72. package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +2 -0
  73. package/dist/reducers/moRedirFlow/IMoRedirConstants.js +1 -1
  74. package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +64 -0
  75. package/dist/reducers/moRedirFlow/MoRedirTypes.js +1 -1
  76. package/dist/reducers/moRedirFlow/index.d.ts +14 -0
  77. package/dist/reducers/moRedirFlow/index.js +1 -226
  78. package/dist/reducers/moRedirFlow/utils.d.ts +10 -0
  79. package/dist/reducers/moRedirFlow/utils.js +1 -186
  80. package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +2 -0
  81. package/dist/reducers/oneClickFlow/IOneClickConstants.js +1 -1
  82. package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +85 -0
  83. package/dist/reducers/oneClickFlow/OneClickTypes.js +1 -1
  84. package/dist/reducers/oneClickFlow/index.d.ts +13 -0
  85. package/dist/reducers/oneClickFlow/index.js +1 -409
  86. package/dist/reducers/oneClickFlow/utils.d.ts +16 -0
  87. package/dist/reducers/oneClickFlow/utils.js +1 -366
  88. package/dist/reducers/pinFlow/IPinConstants.d.ts +2 -0
  89. package/dist/reducers/pinFlow/IPinConstants.js +1 -1
  90. package/dist/reducers/pinFlow/PinTypes.d.ts +156 -0
  91. package/dist/reducers/pinFlow/PinTypes.js +1 -1
  92. package/dist/reducers/pinFlow/index.d.ts +19 -0
  93. package/dist/reducers/pinFlow/index.js +1 -514
  94. package/dist/reducers/pinFlow/utils.d.ts +11 -0
  95. package/dist/reducers/pinFlow/utils.js +1 -494
  96. package/dist/reducers/strategy/IStategyActionContants.d.ts +2 -0
  97. package/dist/reducers/strategy/IStategyActionContants.js +1 -1
  98. package/dist/reducers/strategy/StrategyTypes.d.ts +248 -0
  99. package/dist/reducers/strategy/StrategyTypes.js +1 -1
  100. package/dist/reducers/strategy/index.d.ts +13 -0
  101. package/dist/reducers/strategy/index.js +1 -389
  102. package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +15 -0
  103. package/dist/reducers/strategy/strategies/ask_mobile_number.js +1 -403
  104. package/dist/reducers/strategy/strategies/ask_operator.d.ts +5 -0
  105. package/dist/reducers/strategy/strategies/ask_operator.js +1 -305
  106. package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +10 -0
  107. package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +1 -459
  108. package/dist/reducers/strategy/strategies/header_enrichment.d.ts +7 -0
  109. package/dist/reducers/strategy/strategies/header_enrichment.js +1 -783
  110. package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.d.ts +2 -0
  111. package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.js +1 -0
  112. package/dist/reducers/strategy/utils.d.ts +30 -0
  113. package/dist/reducers/strategy/utils.js +1 -702
  114. package/dist/reducers/ussdFlow/IUssdConstants.d.ts +2 -0
  115. package/dist/reducers/ussdFlow/IUssdConstants.js +1 -1
  116. package/dist/reducers/ussdFlow/UssdTypes.d.ts +77 -0
  117. package/dist/reducers/ussdFlow/UssdTypes.js +1 -1
  118. package/dist/reducers/ussdFlow/index.d.ts +14 -0
  119. package/dist/reducers/ussdFlow/index.js +1 -251
  120. package/dist/reducers/ussdFlow/utils.d.ts +11 -0
  121. package/dist/reducers/ussdFlow/utils.js +1 -225
  122. package/dist/store/index.d.ts +14 -0
  123. package/dist/store/index.js +1 -177
  124. package/dist/store/reducers.d.ts +20 -0
  125. package/dist/store/reducers.js +1 -41
  126. package/dist/utilities/addEmpelloToken.d.ts +4 -0
  127. package/dist/utilities/addEmpelloToken.js +1 -0
  128. package/dist/utilities/handleSubmitNumber.d.ts +21 -0
  129. package/dist/utilities/handleSubmitNumber.js +1 -59
  130. package/dist/utilities/index.d.ts +14 -0
  131. package/dist/utilities/index.js +1 -0
  132. package/dist/utilities/loadScriptInnerHtml.d.ts +2 -0
  133. package/dist/utilities/loadScriptInnerHtml.js +1 -0
  134. package/dist/utilities/loadScriptSrc.d.ts +8 -0
  135. package/dist/utilities/loadScriptSrc.js +1 -0
  136. package/dist/utilities/replaceUrlParam.d.ts +1 -0
  137. package/dist/utilities/replaceUrlParam.js +1 -0
  138. package/dist/utilities/storeMsisdn.d.ts +3 -0
  139. package/dist/utilities/storeMsisdn.js +1 -0
  140. package/package.json +1 -1
  141. package/dist/app/store.js +0 -20
  142. package/dist/features/strategies/categories/askMobileNumber.js +0 -388
  143. package/dist/features/strategies/categories/askOperator.js +0 -313
  144. package/dist/features/strategies/categories/detectOperatorByIp.js +0 -599
  145. package/dist/features/strategies/categories/headerEnrichment.js +0 -665
  146. package/dist/features/strategies/categories/singleFlows/pin.js +0 -1
  147. package/dist/features/strategies/identifySlice.js +0 -355
  148. package/dist/features/strategies/pinFlowSlice.js +0 -338
  149. package/dist/flows/tpayHeFlow.js +0 -23
  150. package/dist/mockServer/browser.js +0 -48
  151. package/dist/mockServer/handlers.js +0 -22
  152. package/dist/mockServer/server.js +0 -48
  153. package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
  154. package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
  155. package/dist/reducers/tpayHeFlow/index.js +0 -331
  156. package/dist/reducers/tpayHeFlow/utils.js +0 -510
  157. package/dist/test/setup.js +0 -24
  158. package/dist/test/test-utils.js +0 -51
@@ -0,0 +1,2 @@
1
+ import { AppThunk } from '../../../common-types/AppThunk';
2
+ export default function injectHeaderEnrichmentScript(): AppThunk;
@@ -0,0 +1 @@
1
+ "use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),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.regexp.exec.js"),require("core-js/modules/es.string.split.js"),require("core-js/modules/es.array.join.js"),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");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 getRootDomain(){var parts=window.location.hostname.split(".");return 2<parts.length?parts.slice(-2).join("."):window.location.hostname}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,domainName,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||(domainName=getRootDomain(),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,"&domain=").concat(domainName),_.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)}}()}
@@ -0,0 +1,30 @@
1
+ import Either from '../../common-types/Either';
2
+ import { ILinkExtraParams } from '../oneClickFlow/OneClickTypes';
3
+ import { IConfig, IFlow, IStrategy, IStrategyReducerState } from './StrategyTypes';
4
+ export declare const wait: (ms: number) => Promise<unknown>;
5
+ export declare const loop: <_I extends {}, R extends {}>(f: () => Promise<R>, max: number, stop: (r: R) => boolean, i: number) => Promise<R>;
6
+ export declare function right<L, R>(r: R): Either<L, R>;
7
+ export declare function left<L, R>(l: L): Either<L, R>;
8
+ export declare const getConfig: () => IStrategy;
9
+ export declare const searchToObject: () => {};
10
+ export declare function determineFlowByMsidn(internationalMSISDN: string): Promise<IFlow>;
11
+ export declare function determineFlowByOperator(operator: string): IFlow;
12
+ export declare function determineFlowByOperatorFromIp(): Promise<IFlow>;
13
+ export declare function getOperators(): Array<string>;
14
+ export declare const identifyUser: (extraParams?: ILinkExtraParams) => Promise<{
15
+ msisdn: string;
16
+ operator: string;
17
+ subscription_url?: string;
18
+ redirect_url?: string;
19
+ action?: () => Promise<string>;
20
+ }>;
21
+ export declare const subscribe: (_url: string) => Promise<string>;
22
+ export declare function mockConfig(flow: string): IConfig;
23
+ export declare const mockedPinFlow: IStrategyReducerState;
24
+ export declare const mockedMoFlow: IStrategyReducerState;
25
+ export declare const mockedUssdFlow: IStrategyReducerState;
26
+ export declare const mockedMoRdirFlow: IStrategyReducerState;
27
+ export declare const mockedClick2smsFlow: IStrategyReducerState;
28
+ export declare const mockedOneClickFlow: IStrategyReducerState;
29
+ export declare const mockedTPayFlow: IStrategyReducerState;
30
+ export declare const mockedCreditCardFlow: IStrategyReducerState;