ouisys-engine 4.6.7 → 4.7.0-alpha.11
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/RemoteDataState-lcf8PfJd.js +2 -0
- package/dist/RemoteDataState-lcf8PfJd.js.map +1 -0
- package/dist/bupperizeCountry-CEtt0MKz.js +2 -0
- package/dist/bupperizeCountry-CEtt0MKz.js.map +1 -0
- package/dist/checkSubscriptionByRockmanIdOnly-BwR1un1L.js +2 -0
- package/dist/checkSubscriptionByRockmanIdOnly-BwR1un1L.js.map +1 -0
- package/dist/checkSubscriptionHander.js +2 -0
- package/dist/checkSubscriptionHander.js.map +1 -0
- package/dist/click2smsFlow.js +2 -0
- package/dist/click2smsFlow.js.map +1 -0
- package/dist/creditCardFlow.js +2 -0
- package/dist/creditCardFlow.js.map +1 -0
- package/dist/getConfig.js +2 -0
- package/dist/getConfig.js.map +1 -0
- package/dist/handleClickChainFlow.js +2 -0
- package/dist/handleClickChainFlow.js.map +1 -0
- package/dist/handleSubmitNumber.js +2 -0
- package/dist/handleSubmitNumber.js.map +1 -0
- package/dist/helpers-xPhGBX-B.js +2 -0
- package/dist/helpers-xPhGBX-B.js.map +1 -0
- package/dist/loadScriptInnerHtml-BzQm-AFb.js +2 -0
- package/dist/loadScriptInnerHtml-BzQm-AFb.js.map +1 -0
- package/dist/loadScriptSrc-Da4autZd.js +2 -0
- package/dist/loadScriptSrc-Da4autZd.js.map +1 -0
- package/dist/moFlow.js +2 -0
- package/dist/moFlow.js.map +1 -0
- package/dist/moRedirFlow.js +2 -0
- package/dist/moRedirFlow.js.map +1 -0
- package/dist/oneClickFlow.js +2 -0
- package/dist/oneClickFlow.js.map +1 -0
- package/dist/pinFlow.js +2 -0
- package/dist/pinFlow.js.map +1 -0
- package/dist/searchToObject.js +2 -0
- package/dist/searchToObject.js.map +1 -0
- package/dist/storeMsisdn-Cjq8_qYH.js +2 -0
- package/dist/storeMsisdn-Cjq8_qYH.js.map +1 -0
- package/dist/strategy.js +2 -0
- package/dist/strategy.js.map +1 -0
- package/dist/strategySlice-Dw14E22-.js +2 -0
- package/dist/strategySlice-Dw14E22-.js.map +1 -0
- package/dist/tracker-DaaILhEr.js +2 -0
- package/dist/tracker-DaaILhEr.js.map +1 -0
- package/dist/tracker.js +2 -0
- package/dist/tracker.js.map +1 -0
- package/dist/tryGetIPRangeName-QW-9NgzE.js +2 -0
- package/dist/tryGetIPRangeName-QW-9NgzE.js.map +1 -0
- package/dist/types/CreditCardTypes-B-IT-l6I.d.ts +72 -0
- package/dist/types/IHash-0OgZ_1ij.d.ts +5 -0
- package/dist/types/MoRedirTypes-4tEJjT1g.d.ts +31 -0
- package/dist/types/MoTypes-D-UK92gs.d.ts +45 -0
- package/dist/types/OneClickTypes-DjOesaHp.d.ts +69 -0
- package/dist/types/PinTypes-BLJDBZe6.d.ts +128 -0
- package/dist/types/RemoteDataState-D1aFrz8W.d.ts +61 -0
- package/dist/types/StrategyTypes-CbOgk0N4.d.ts +326 -0
- package/dist/types/UssdTypes-C7QlIW11.d.ts +34 -0
- package/dist/types/checkSubscriptionHander.d.ts +8 -0
- package/dist/types/click2smsFlow.d.ts +37 -0
- package/dist/types/creditCardFlow.d.ts +37 -0
- package/dist/types/getConfig.d.ts +38 -0
- package/dist/types/handleClickChainFlow.d.ts +6 -0
- package/dist/types/handleSubmitNumber.d.ts +26 -0
- package/dist/types/moFlow.d.ts +70 -0
- package/dist/types/moRedirFlow.d.ts +82 -0
- package/dist/types/oneClickFlow.d.ts +56 -0
- package/dist/types/pinFlow.d.ts +179 -0
- package/dist/types/searchToObject.d.ts +3 -0
- package/dist/types/strategy.d.ts +94 -0
- package/dist/types/tracker.d.ts +5 -0
- package/dist/types/ussdFlow.d.ts +84 -0
- package/dist/ussdFlow.js +2 -0
- package/dist/ussdFlow.js.map +1 -0
- package/package.json +88 -12
- package/.babelrc +0 -30
- package/.browserslistrc +0 -6
- package/.eslintrc.js +0 -3
- package/.nvmrc +0 -1
- package/.prettierignore +0 -4
- package/dist/@types/react-tracker.d.js +0 -1
- package/dist/@types/redux-cli-logger.d.js +0 -1
- package/dist/@types/tiny-async-pool.d.js +0 -1
- package/dist/@types/window.d.js +0 -1
- package/dist/api/index.d.ts +0 -43
- package/dist/api/index.js +0 -1
- package/dist/common-types/AppThunk.d.ts +0 -13
- package/dist/common-types/AppThunk.js +0 -1
- package/dist/common-types/Either.d.ts +0 -8
- package/dist/common-types/Either.js +0 -1
- package/dist/common-types/IError.d.ts +0 -3
- package/dist/common-types/IError.js +0 -1
- package/dist/common-types/IOptInFlowName.d.ts +0 -1
- package/dist/common-types/IOptInFlowName.js +0 -1
- package/dist/common-types/ITracker.d.ts +0 -9
- package/dist/common-types/ITracker.js +0 -1
- package/dist/common-types/IVisitor.d.ts +0 -14
- package/dist/common-types/IVisitor.js +0 -1
- package/dist/common-types/RemoteDataState.d.ts +0 -38
- package/dist/common-types/RemoteDataState.js +0 -1
- package/dist/custom-hooks/useOneClickRedirectUrl.d.ts +0 -3
- package/dist/custom-hooks/useOneClickRedirectUrl.js +0 -1
- package/dist/custom-hooks/usePinEntryState.d.ts +0 -8
- package/dist/custom-hooks/usePinEntryState.js +0 -1
- package/dist/custom-hooks/useStrategyConfig.d.ts +0 -4
- package/dist/custom-hooks/useStrategyConfig.js +0 -1
- package/dist/flows/click2smsFlow.d.ts +0 -6
- package/dist/flows/click2smsFlow.js +0 -1
- package/dist/flows/creditCardFlow.d.ts +0 -6
- package/dist/flows/creditCardFlow.js +0 -1
- package/dist/flows/moFlow.d.ts +0 -6
- package/dist/flows/moFlow.js +0 -1
- package/dist/flows/moRedirFlow.d.ts +0 -6
- package/dist/flows/moRedirFlow.js +0 -1
- package/dist/flows/oneClickFlow.d.ts +0 -7
- package/dist/flows/oneClickFlow.js +0 -1
- package/dist/flows/pinFlow.d.ts +0 -7
- package/dist/flows/pinFlow.js +0 -1
- package/dist/flows/strategy.d.ts +0 -14
- package/dist/flows/strategy.js +0 -1
- package/dist/flows/ussdFlow.d.ts +0 -6
- package/dist/flows/ussdFlow.js +0 -1
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -1
- package/dist/ips/tryGetIPRangeName.d.ts +0 -2
- package/dist/ips/tryGetIPRangeName.js +0 -1
- package/dist/jest.config.js +0 -194
- package/dist/pacman/index.d.ts +0 -6
- package/dist/pacman/index.js +0 -1
- package/dist/pacman/queryString.d.ts +0 -3
- package/dist/pacman/queryString.js +0 -1
- package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +0 -76
- package/dist/reducers/click2smsFlow/Click2smsTypes.js +0 -1
- package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +0 -2
- package/dist/reducers/click2smsFlow/IClick2smsConstants.js +0 -1
- package/dist/reducers/click2smsFlow/index.d.ts +0 -5
- package/dist/reducers/click2smsFlow/index.js +0 -1
- package/dist/reducers/click2smsFlow/utils.d.ts +0 -4
- package/dist/reducers/click2smsFlow/utils.js +0 -1
- package/dist/reducers/creditCardFlow/CreditCardTypes.d.ts +0 -79
- package/dist/reducers/creditCardFlow/CreditCardTypes.js +0 -1
- package/dist/reducers/creditCardFlow/ICreditCardConstants.d.ts +0 -2
- package/dist/reducers/creditCardFlow/ICreditCardConstants.js +0 -1
- package/dist/reducers/creditCardFlow/index.d.ts +0 -5
- package/dist/reducers/creditCardFlow/index.js +0 -1
- package/dist/reducers/creditCardFlow/utils.d.ts +0 -8
- package/dist/reducers/creditCardFlow/utils.js +0 -1
- package/dist/reducers/moFlow/IMoConstants.d.ts +0 -2
- package/dist/reducers/moFlow/IMoConstants.js +0 -1
- package/dist/reducers/moFlow/MoTypes.d.ts +0 -88
- package/dist/reducers/moFlow/MoTypes.js +0 -1
- package/dist/reducers/moFlow/index.d.ts +0 -16
- package/dist/reducers/moFlow/index.js +0 -1
- package/dist/reducers/moFlow/utils.d.ts +0 -12
- package/dist/reducers/moFlow/utils.js +0 -1
- package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +0 -2
- package/dist/reducers/moRedirFlow/IMoRedirConstants.js +0 -1
- package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +0 -64
- package/dist/reducers/moRedirFlow/MoRedirTypes.js +0 -1
- package/dist/reducers/moRedirFlow/index.d.ts +0 -14
- package/dist/reducers/moRedirFlow/index.js +0 -1
- package/dist/reducers/moRedirFlow/utils.d.ts +0 -10
- package/dist/reducers/moRedirFlow/utils.js +0 -1
- package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +0 -2
- package/dist/reducers/oneClickFlow/IOneClickConstants.js +0 -1
- package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +0 -85
- package/dist/reducers/oneClickFlow/OneClickTypes.js +0 -1
- package/dist/reducers/oneClickFlow/index.d.ts +0 -13
- package/dist/reducers/oneClickFlow/index.js +0 -1
- package/dist/reducers/oneClickFlow/utils.d.ts +0 -16
- package/dist/reducers/oneClickFlow/utils.js +0 -1
- package/dist/reducers/pinFlow/IPinConstants.d.ts +0 -2
- package/dist/reducers/pinFlow/IPinConstants.js +0 -1
- package/dist/reducers/pinFlow/PinTypes.d.ts +0 -157
- package/dist/reducers/pinFlow/PinTypes.js +0 -1
- package/dist/reducers/pinFlow/index.d.ts +0 -19
- package/dist/reducers/pinFlow/index.js +0 -1
- package/dist/reducers/pinFlow/utils.d.ts +0 -11
- package/dist/reducers/pinFlow/utils.js +0 -1
- package/dist/reducers/strategy/IStategyActionContants.d.ts +0 -2
- package/dist/reducers/strategy/IStategyActionContants.js +0 -1
- package/dist/reducers/strategy/StrategyTypes.d.ts +0 -248
- package/dist/reducers/strategy/StrategyTypes.js +0 -1
- package/dist/reducers/strategy/index.d.ts +0 -13
- package/dist/reducers/strategy/index.js +0 -1
- package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +0 -15
- package/dist/reducers/strategy/strategies/ask_mobile_number.js +0 -1
- package/dist/reducers/strategy/strategies/ask_operator.d.ts +0 -5
- package/dist/reducers/strategy/strategies/ask_operator.js +0 -1
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +0 -10
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +0 -1
- package/dist/reducers/strategy/strategies/header_enrichment.d.ts +0 -7
- package/dist/reducers/strategy/strategies/header_enrichment.js +0 -1
- package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.d.ts +0 -7
- package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.js +0 -1
- package/dist/reducers/strategy/utils.d.ts +0 -30
- package/dist/reducers/strategy/utils.js +0 -1
- package/dist/reducers/ussdFlow/IUssdConstants.d.ts +0 -2
- package/dist/reducers/ussdFlow/IUssdConstants.js +0 -1
- package/dist/reducers/ussdFlow/UssdTypes.d.ts +0 -77
- package/dist/reducers/ussdFlow/UssdTypes.js +0 -1
- package/dist/reducers/ussdFlow/index.d.ts +0 -14
- package/dist/reducers/ussdFlow/index.js +0 -1
- package/dist/reducers/ussdFlow/utils.d.ts +0 -11
- package/dist/reducers/ussdFlow/utils.js +0 -1
- package/dist/store/index.d.ts +0 -14
- package/dist/store/index.js +0 -1
- package/dist/store/reducers.d.ts +0 -20
- package/dist/store/reducers.js +0 -1
- package/dist/utilities/addEmpelloToken.d.ts +0 -4
- package/dist/utilities/addEmpelloToken.js +0 -1
- package/dist/utilities/handleSubmitNumber.d.ts +0 -21
- package/dist/utilities/handleSubmitNumber.js +0 -1
- package/dist/utilities/index.d.ts +0 -17
- package/dist/utilities/index.js +0 -1
- package/dist/utilities/loadScriptInnerHtml.d.ts +0 -2
- package/dist/utilities/loadScriptInnerHtml.js +0 -1
- package/dist/utilities/loadScriptSrc.d.ts +0 -8
- package/dist/utilities/loadScriptSrc.js +0 -1
- package/dist/utilities/replaceUrlParam.d.ts +0 -1
- package/dist/utilities/replaceUrlParam.js +0 -1
- package/dist/utilities/storeMsisdn.d.ts +0 -3
- package/dist/utilities/storeMsisdn.js +0 -1
- package/index.html +0 -49
- package/mockData/config.json +0 -28
- package/setupJest.js +0 -6
- package/tsconfig.json +0 -28
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var _utils=require("../strategy/utils");function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.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"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.checkSubscription=checkSubscription,exports.default=load,exports.load1=load1,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.concat.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.array.map.js");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 loadOnce(){return _loadOnce.apply(this,arguments)}function _loadOnce(){return _loadOnce=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(window,maybeConfig,operator,keyword){var keywordFromConfig,shortcodeFromConfig,offer,config,host,country,slug,rockmanId,search,result;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(!maybeConfig||"keywordAndShortCode"!==maybeConfig.tag){_context.next=3;break}return keywordFromConfig=maybeConfig.keyword,shortcodeFromConfig=maybeConfig.shortcode,_context.abrupt("return",_objectSpread({type:"SingleSubmissionResult"},{keyword:keywordFromConfig,shortcode:shortcodeFromConfig}));case 3:return offer=window.pac_analytics.visitor.offer,config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig),host=config.host,country=config.country,slug=config.slug,rockmanId=window.pac_analytics.visitor.rockmanId,search=window.location.search.substr(1)||"",_context.next=10,window.tallymanApi.oc2sms(host,country,slug,offer,rockmanId,keyword,operator,search);case 10:if(result=_context.sent,result.success){_context.next=15;break}throw result.message;case 15:return _context.abrupt("return",_objectSpread({type:"SingleSubmissionResult"},{keyword:"".concat(keyword||result.displayKeyword).concat(result.uid?" ".concat(result.uid):""),shortcode:result.shortcode}));case 16:case"end":return _context.stop();}},_callee)})),_loadOnce.apply(this,arguments)}function right(r){return{type:"right",value:r}}function left(l){return{type:"left",value:l}}function loadForMultipleOperators(_x6,_x7,_x8,_x9,_x10){return _loadForMultipleOperators.apply(this,arguments)}function _loadForMultipleOperators(){return _loadForMultipleOperators=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(window,maybeConfig,operators,keyword,shortcode){var results,finalResults,arrResult;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:return results=Promise.all(operators.map(function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(o){var singleResult;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:return _context2.prev=0,_context2.next=3,loadOnce(window,maybeConfig,o,keyword,shortcode);case 3:return singleResult=_context2.sent,_context2.abrupt("return",right(_objectSpread(_objectSpread({},singleResult),{},{operator:o})));case 7:return _context2.prev=7,_context2.t0=_context2["catch"](0),_context2.abrupt("return",left(_context2.t0));case 10:case"end":return _context2.stop();}},_callee2,null,[[0,7]])}));return function(_x21){return _ref.apply(this,arguments)}}())),_context3.next=3,Promise.resolve(results);case 3:if(finalResults=_context3.sent,!finalResults.every(function(r){return"left"===r.type})){_context3.next=8;break}throw finalResults[0].value;case 8:return arrResult=[],finalResults.map(function(obj){if("right"===obj.type){var r=obj.value;arrResult.push({keyword:null===r||void 0===r?void 0:r.keyword,shortcode:null===r||void 0===r?void 0:r.shortcode,operator:null===r||void 0===r?void 0:r.operator})}return obj}),_context3.abrupt("return",{type:"MultiOperatorSubmissionResult",data:arrResult});case 11:case"end":return _context3.stop();}},_callee3)})),_loadForMultipleOperators.apply(this,arguments)}function load(_x11,_x12,_x13,_x14){return _load.apply(this,arguments)}function _load(){return _load=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(window,maybeConfig,keyword,shortcode){return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:if(!maybeConfig||"keywordAndShortCode"!==maybeConfig.tag){_context4.next=2;break}return _context4.abrupt("return",_objectSpread({type:"SingleSubmissionResult"},{keyword:maybeConfig.keyword,shortcode:maybeConfig.shortcode}));case 2:if(!maybeConfig||"keyword"!==maybeConfig.tag){_context4.next=4;break}return _context4.abrupt("return",load1(window,maybeConfig,keyword,shortcode));case 4:return _context4.abrupt("return",load1(window,maybeConfig,null,null));case 5:case"end":return _context4.stop();}},_callee4)})),_load.apply(this,arguments)}function load1(_x15,_x16,_x17,_x18){return _load2.apply(this,arguments)}function _load2(){return _load2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(window,maybeConfig,keyword,shortcode){var config,singleOperator;return _regeneratorRuntime().wrap(function _callee5$(_context5){for(;1;)switch(_context5.prev=_context5.next){case 0:if(config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig),!0!==config.automaticallySubmitAllOperators||!config.operators||!(0<config.operators.length)){_context5.next=3;break}return _context5.abrupt("return",loadForMultipleOperators(window,maybeConfig,config.operators,keyword,shortcode));case 3:return singleOperator=maybeConfig.operators&&0<maybeConfig.operators.length?maybeConfig.operators[0]:null,_context5.abrupt("return",loadOnce(window,maybeConfig,singleOperator,keyword,shortcode));case 5:case"end":return _context5.stop();}},_callee5)})),_load2.apply(this,arguments)}function checkSubscription(_x19,_x20){return _checkSubscription.apply(this,arguments)}function _checkSubscription(){return _checkSubscription=_asyncToGenerator(_regeneratorRuntime().mark(function _callee6(window,maybeConfig){var config,host,rockmanId,search,isMock,check,checkResult,error;return _regeneratorRuntime().wrap(function _callee6$(_context6){for(;1;)switch(_context6.prev=_context6.next){case 0:return config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig),host=config.host,rockmanId=window.pac_analytics.visitor.rockmanId,search=(0,_utils.searchToObject)(),isMock="check-subscription-success-state"===search["current-state"],isMock&&console.log("isMock is true"),check=function check(){return isMock?Promise.resolve({success:!0,rockman_id:rockmanId,product_url:"/product",msisdn:"000"}):window.tallymanApi.checkSubscriptionByRockmanIdOnly(host,rockmanId)},_context6.next=9,(0,_utils.loop)(check,60,function(r){return r.success},0);case 9:if(checkResult=_context6.sent,!0!==checkResult.success){_context6.next=13;break}return window.location.href=checkResult.product_url,_context6.abrupt("return",checkResult.product_url||null);case 13:throw error=new Error("SubscriptionFailed".concat(":\n",checkResult.message)),error.type="SubscriptionFailed",error;case 16:case"end":return _context6.stop();}},_callee6)})),_checkSubscription.apply(this,arguments)}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import * as RDS from '../../common-types/RemoteDataState';
|
|
2
|
-
export interface IUserDetails {
|
|
3
|
-
first_name: string;
|
|
4
|
-
last_name: string;
|
|
5
|
-
email: string;
|
|
6
|
-
password?: string;
|
|
7
|
-
address: string;
|
|
8
|
-
postcode: string;
|
|
9
|
-
city: string;
|
|
10
|
-
country_code: string;
|
|
11
|
-
cc_number: string;
|
|
12
|
-
cc_holder: string;
|
|
13
|
-
cc_exp_month: string;
|
|
14
|
-
cc_exp_year: string;
|
|
15
|
-
cvv: string;
|
|
16
|
-
}
|
|
17
|
-
export interface IUserDetailsEcardon {
|
|
18
|
-
email: string;
|
|
19
|
-
password?: string;
|
|
20
|
-
name: string | null;
|
|
21
|
-
first_name: string | null;
|
|
22
|
-
last_name: string | null;
|
|
23
|
-
address: string | null;
|
|
24
|
-
postcode: string | null;
|
|
25
|
-
city: string | null;
|
|
26
|
-
country_code: string | null;
|
|
27
|
-
}
|
|
28
|
-
export declare type IEmailPasswordSubmissionResult = {
|
|
29
|
-
success: true;
|
|
30
|
-
rockman_id: string;
|
|
31
|
-
redirect_url: string;
|
|
32
|
-
} | {
|
|
33
|
-
success: false;
|
|
34
|
-
rockman_id: string;
|
|
35
|
-
message: string;
|
|
36
|
-
};
|
|
37
|
-
export declare type ICreditCardFlowCurrentState = {
|
|
38
|
-
type: 'USER_DETAILS_ENTRY';
|
|
39
|
-
result: RDS.RemoteDataState<SubmitUserDetailsFailure, SubmitUserDetailsSuccess>;
|
|
40
|
-
};
|
|
41
|
-
export declare type SubmitUserDetailsErrorTypes = 'AlreadySubscribed' | 'UnknownError' | 'InvalidUserDetails' | 'UnexpectedState';
|
|
42
|
-
export declare type SubmitUserDetailsFailure = {
|
|
43
|
-
errorType: SubmitUserDetailsErrorTypes;
|
|
44
|
-
error: any;
|
|
45
|
-
productUrl?: string;
|
|
46
|
-
};
|
|
47
|
-
export declare type SubmitUserDetailsSuccess = {
|
|
48
|
-
gateway_url: string;
|
|
49
|
-
method: string;
|
|
50
|
-
};
|
|
51
|
-
export declare type IUserDetailsSubmissionResult = {
|
|
52
|
-
success: true;
|
|
53
|
-
state?: string;
|
|
54
|
-
gateway_url?: string;
|
|
55
|
-
redirect_url?: string;
|
|
56
|
-
method?: string;
|
|
57
|
-
} | {
|
|
58
|
-
success: false;
|
|
59
|
-
message: string;
|
|
60
|
-
rockman_id: string;
|
|
61
|
-
errors?: {
|
|
62
|
-
[key: string]: string[];
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
export declare type IUserDetailsSubmitActionPayload = {
|
|
66
|
-
type: 'USER_DETAILS_ENTRY';
|
|
67
|
-
result: RDS.RemoteDataState<SubmitUserDetailsFailure, SubmitUserDetailsSuccess>;
|
|
68
|
-
};
|
|
69
|
-
export interface ICreditCardFlowReducerState {
|
|
70
|
-
currentState: ICreditCardFlowCurrentState;
|
|
71
|
-
}
|
|
72
|
-
export declare type ICreditCardActions = {
|
|
73
|
-
type: 'CREDIT_CARD_USER_DETAILS_SUBMIT';
|
|
74
|
-
payload: IUserDetailsSubmitActionPayload;
|
|
75
|
-
} | {
|
|
76
|
-
type: 'MOCK_CREDIT_CARD_USER_DETAILS_FLOW_STATE';
|
|
77
|
-
payload: ICreditCardFlowCurrentState;
|
|
78
|
-
};
|
|
79
|
-
export declare type IMockCreditCardFlowStates = 'user-details-entry-success-state' | 'user-details-entry-failure-state';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { AppThunk } from '../../common-types/AppThunk';
|
|
2
|
-
import { ICreditCardActions, ICreditCardFlowReducerState, IMockCreditCardFlowStates, IUserDetails, IUserDetailsEcardon } from './CreditCardTypes';
|
|
3
|
-
export declare function mockCreditCardFlow(mockState: IMockCreditCardFlowStates): AppThunk;
|
|
4
|
-
export declare function submitUserDetailsAction(userDetails: IUserDetails | IUserDetailsEcardon): AppThunk;
|
|
5
|
-
export default function CreditCardFlowReducer(state: ICreditCardFlowReducerState, action: ICreditCardActions): ICreditCardFlowReducerState;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.weak-map.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=CreditCardFlowReducer,exports.mockCreditCardFlow=mockCreditCardFlow,exports.submitUserDetailsAction=submitUserDetailsAction,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_loadScriptSrc=_interopRequireDefault(require("../../utilities/loadScriptSrc")),_strategy=require("../strategy"),_utils=require("./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 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 mockCreditCardFlow(mockState){return function(dispatch){if(mockState!==void 0)switch(mockState){case"user-details-entry-failure-state":return dispatch({type:"MOCK_CREDIT_CARD_USER_DETAILS_FLOW_STATE",payload:_utils.mockedUserDetailsEntryFailure.currentState});case"user-details-entry-success-state":return dispatch({type:"MOCK_CREDIT_CARD_USER_DETAILS_FLOW_STATE",payload:_utils.mockedUserDetailsEntrySuccess.currentState});default:throw"Mock Flow not supported";}}}function submitUserDetailsAction(userDetails){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch,store){var currentState,config,_yield$submitUserDeta,gateway_url,method,errorType;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(currentState=store().strategy.currentState,"CREDIT_CARD"!==currentState.type){_context.next=25;break}return config=currentState.result.config,_context.prev=3,dispatch({type:"CREDIT_CARD_USER_DETAILS_SUBMIT",payload:{type:"USER_DETAILS_ENTRY",result:RDS.Loading()}}),_strategy.tracker.advancedInFlow("tallyman.v1-credit-card","cc-form-submitted",{email:null===userDetails||void 0===userDetails?void 0:userDetails.email}),_context.next=8,(0,_utils.submitUserDetails)(window,config,userDetails);case 8:_yield$submitUserDeta=_context.sent,gateway_url=_yield$submitUserDeta.gateway_url,method=_yield$submitUserDeta.method,_strategy.tracker.advancedInFlow("tallyman.v1-credit-card","cc-form-submission-success",{email:null===userDetails||void 0===userDetails?void 0:userDetails.email,gateway_url:gateway_url}),"jslink"===method&&gateway_url&&(_strategy.tracker.advancedInFlow("tallyman.v1-credit-card","load-script-start",{gateway_url:gateway_url}),(0,_loadScriptSrc.default)({id:"ecardon-credit-card",url:gateway_url,callBack:function callBack(){_strategy.tracker.advancedInFlow("tallyman.v1-credit-card","load-script-success",{gateway_url:gateway_url})}})),"redirection"===method&&gateway_url&&(_strategy.tracker.customEvent("Flow","advance-auto","redirect-success",{redirect_url:gateway_url}),window.location.href=gateway_url),dispatch({type:"CREDIT_CARD_USER_DETAILS_SUBMIT",payload:{type:"USER_DETAILS_ENTRY",result:RDS.Success({gateway_url:gateway_url,method:method})}}),_context.next=23;break;case 17:_context.prev=17,_context.t0=_context["catch"](3),console.warn(_context.t0),errorType="AlreadySubscribed"===_context.t0.type?"AlreadySubscribed":"InvalidUserDetails"===_context.t0.type?"InvalidUserDetails":"UnknownError",_strategy.tracker.recedeInFlow("tallyman.v1-credit-card","cc-form-submission-failure",{email:null===userDetails||void 0===userDetails?void 0:userDetails.email,errorType:errorType||_context.t0.type}),dispatch({type:"CREDIT_CARD_USER_DETAILS_SUBMIT",payload:{type:"USER_DETAILS_ENTRY",result:RDS.Failure({errorType:errorType,error:_context.t0,productUrl:_context.t0.productUrl})}});case 23:_context.next=28;break;case 25:throw _strategy.tracker.recedeInFlow("tallyman.v1-credit-card","user-details-failure",{email:null===userDetails||void 0===userDetails?void 0:userDetails.email,errorType:"UnknownError"}),dispatch({type:"CREDIT_CARD_USER_DETAILS_SUBMIT",payload:{type:"USER_DETAILS_ENTRY",result:RDS.Failure({errorType:"UnexpectedState",error:null})}}),"Unexpected state";case 28:case"end":return _context.stop();}},_callee,null,[[3,17]])}));return function(_x,_x2){return _ref.apply(this,arguments)}}()}var initialState={currentState:{type:"USER_DETAILS_ENTRY",result:RDS.NothingYet()}};function CreditCardFlowReducer(){var state=0<arguments.length&&arguments[0]!==void 0?arguments[0]:initialState,action=1<arguments.length?arguments[1]:void 0;switch(action.type){case"CREDIT_CARD_USER_DETAILS_SUBMIT":return(0,_strategy.genericHandler)(state,action.payload);case"MOCK_CREDIT_CARD_USER_DETAILS_FLOW_STATE":return(0,_strategy.genericHandler)(state,action.payload);default:return state;}}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { IConfig } from '../strategy/StrategyTypes';
|
|
2
|
-
import { ICreditCardFlowReducerState, IUserDetails, IUserDetailsEcardon } from './CreditCardTypes';
|
|
3
|
-
export declare function submitUserDetails(window: Window, config: IConfig, userDetails: IUserDetails | IUserDetailsEcardon): Promise<{
|
|
4
|
-
gateway_url: string;
|
|
5
|
-
method: string;
|
|
6
|
-
}>;
|
|
7
|
-
export declare const mockedUserDetailsEntrySuccess: ICreditCardFlowReducerState;
|
|
8
|
-
export declare const mockedUserDetailsEntryFailure: ICreditCardFlowReducerState;
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { AppThunk } from '../../common-types/AppThunk';
|
|
2
|
-
import * as RDS from '../../common-types/RemoteDataState';
|
|
3
|
-
export declare type IMoFlowCurrentState = {
|
|
4
|
-
type: 'MSISDNEntry';
|
|
5
|
-
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
6
|
-
};
|
|
7
|
-
export declare type MSISDNEntryErrorTypes = 'AlreadySubscribed' | 'UnknownError' | 'InvalidMSISDN' | 'UnexpectedState';
|
|
8
|
-
export declare type MSISDNEntryFailure = {
|
|
9
|
-
errorType: MSISDNEntryErrorTypes;
|
|
10
|
-
error: any;
|
|
11
|
-
productUrl?: string;
|
|
12
|
-
};
|
|
13
|
-
export declare type MSISDNEntrySuccess = IKeywordShortcode;
|
|
14
|
-
export declare type IMsisnSubmitActionPayload = {
|
|
15
|
-
type: 'MSISDNEntry';
|
|
16
|
-
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
17
|
-
};
|
|
18
|
-
export interface IMoFlowReducerState {
|
|
19
|
-
currentState: IMoFlowCurrentState;
|
|
20
|
-
}
|
|
21
|
-
export declare type IConfig = {
|
|
22
|
-
offer?: number;
|
|
23
|
-
slug?: string;
|
|
24
|
-
country?: string;
|
|
25
|
-
host?: string;
|
|
26
|
-
device?: 'smart' | 'feature';
|
|
27
|
-
operators?: string[];
|
|
28
|
-
};
|
|
29
|
-
export declare type IKeywordShortcode = {
|
|
30
|
-
keyword: string;
|
|
31
|
-
shortcode: string;
|
|
32
|
-
};
|
|
33
|
-
export declare type IMSISDNSubmissionResult = {
|
|
34
|
-
success: true;
|
|
35
|
-
rockman_id: string;
|
|
36
|
-
keyword: string;
|
|
37
|
-
shortcode: string;
|
|
38
|
-
displayKeyword: string;
|
|
39
|
-
} | {
|
|
40
|
-
success: false;
|
|
41
|
-
rockman_id: string;
|
|
42
|
-
message: string;
|
|
43
|
-
product_url?: string;
|
|
44
|
-
};
|
|
45
|
-
export declare type ICheckSubscriptionResult = {
|
|
46
|
-
success: false;
|
|
47
|
-
rockman_id: string;
|
|
48
|
-
message: string;
|
|
49
|
-
} | {
|
|
50
|
-
success: true;
|
|
51
|
-
msisdn: string;
|
|
52
|
-
product_url?: string;
|
|
53
|
-
rockman_id: string;
|
|
54
|
-
};
|
|
55
|
-
export declare type IBackToStartPayload = {
|
|
56
|
-
type: 'MSISDNEntry';
|
|
57
|
-
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
58
|
-
};
|
|
59
|
-
export declare type IMoActions = {
|
|
60
|
-
type: 'MO_MSISDN_SUBMIT';
|
|
61
|
-
payload: IMsisnSubmitActionPayload;
|
|
62
|
-
} | {
|
|
63
|
-
type: 'MO_MSISDN_SUBMIT_ERROR';
|
|
64
|
-
payload: IMsisdnSubmitErrorPayload;
|
|
65
|
-
} | {
|
|
66
|
-
type: 'MO_BACK_TO_START';
|
|
67
|
-
payload: IBackToStartPayload;
|
|
68
|
-
} | {
|
|
69
|
-
type: 'MOCK_MO_FLOW_STATE';
|
|
70
|
-
payload: IMoFlowCurrentState;
|
|
71
|
-
};
|
|
72
|
-
export declare type IMsisdnSubmitErrorPayload = {
|
|
73
|
-
type: 'MSISDNEntry';
|
|
74
|
-
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
75
|
-
};
|
|
76
|
-
export declare type IMoFlowActionMaps = {
|
|
77
|
-
submitMSISDNAction: (msisdn: string) => AppThunk;
|
|
78
|
-
};
|
|
79
|
-
export declare type IMockMoFlowStates = 'msisdn-entry-success-state' | 'msisdn-entry-failure-state';
|
|
80
|
-
export declare type IGoogleReCaptcha = {
|
|
81
|
-
site_key: string;
|
|
82
|
-
secret_key: string;
|
|
83
|
-
domains: string;
|
|
84
|
-
success: true;
|
|
85
|
-
} | {
|
|
86
|
-
message: string;
|
|
87
|
-
success: false;
|
|
88
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AppThunk } from '../../common-types/AppThunk';
|
|
2
|
-
import * as RDS from '../../common-types/RemoteDataState';
|
|
3
|
-
import { IMoActions, IMockMoFlowStates, IMoFlowActionMaps, IMoFlowReducerState, MSISDNEntryFailure } from './MoTypes';
|
|
4
|
-
export declare function submitMSISDNAction(msisdn: string, extraParams?: {
|
|
5
|
-
[key: string]: string;
|
|
6
|
-
}): AppThunk;
|
|
7
|
-
export declare function backToStart(): {
|
|
8
|
-
type: string;
|
|
9
|
-
payload: {
|
|
10
|
-
type: string;
|
|
11
|
-
result: RDS.RemoteDataState<MSISDNEntryFailure, import("./MoTypes").IKeywordShortcode>;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
export declare function mockMoFlow(mockState: IMockMoFlowStates): AppThunk;
|
|
15
|
-
export declare const MoFlowActionMaps: IMoFlowActionMaps;
|
|
16
|
-
export default function MoFlowReducer(state: IMoFlowReducerState, action: IMoActions): IMoFlowReducerState;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.object.get-own-property-descriptors.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.symbol.async-iterator.js"),require("core-js/modules/es.symbol.to-string-tag.js"),require("core-js/modules/es.json.to-string-tag.js"),require("core-js/modules/es.math.to-string-tag.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.function.name.js"),require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.array.slice.js"),require("core-js/modules/es.weak-map.js"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.MoFlowActionMaps=void 0,exports.backToStart=backToStart,exports.default=MoFlowReducer,exports.mockMoFlow=mockMoFlow,exports.submitMSISDNAction=submitMSISDNAction,require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js");var RDS=_interopRequireWildcard(require("../../common-types/RemoteDataState")),_storeMsisdn=require("../../utilities/storeMsisdn"),_strategy=require("../strategy"),_utils=_interopRequireWildcard(require("./utils"));function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!==_typeof(obj)&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!=key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}function _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 submitMSISDNAction(msisdn,extraParams){return function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(dispatch,store){var currentState,config,keywordAndShortcode,errorType;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if(currentState=store().strategy.currentState,"MO"!==currentState.type){_context.next=25;break}return config=currentState.result.config,_context.prev=3,dispatch({type:"MO_MSISDN_SUBMIT",payload:{type:"MSISDNEntry",result:RDS.Loading()}}),_strategy.tracker.advancedInFlow("tallyman.v1-mo","msisdn-submitted",{msisdn:msisdn}),_context.next=8,(0,_utils.default)(window,config,msisdn,extraParams);case 8:if(keywordAndShortcode=_context.sent,_strategy.tracker.advancedInFlow("tallyman.v1-mo","msisdn-submission-success",{msisdn:msisdn}),!(extraParams&&extraParams.storeMsisdn&&"true"===extraParams.storeMsisdn)){_context.next=13;break}return _context.next=13,(0,_storeMsisdn.storeMsisdn)(msisdn).then(function(data){data&&data.data&&data.data.success?_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-success"):_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-failed")}).catch(function(error){_strategy.tracker.customEvent("Flow","advance-auto","msisdn-stored-error",error)});case 13:dispatch({type:"MO_MSISDN_SUBMIT",payload:{type:"MSISDNEntry",result:RDS.Success(_objectSpread({},keywordAndShortcode))}}),(0,_utils.checkSubscription)(window,config).then(function(product_url){_strategy.tracker.advancedInFlow("tallyman.v1-mo","sale",{msisdn:msisdn}),setTimeout(function(){window.location.href=product_url},1e3)}),_context.next=23;break;case 17:_context.prev=17,_context.t0=_context["catch"](3),console.warn(_context.t0),errorType="AlreadySubscribed"===_context.t0.type?"AlreadySubscribed":"InvalidMSISDN"===_context.t0.type?"InvalidMSISDN":"UnknownError",_strategy.tracker.recedeInFlow("tallyman.v1-mo","msisdn-submission-failure",{msisdn:msisdn,errorType:errorType||"UnknownError"}),dispatch({type:"MO_MSISDN_SUBMIT_ERROR",payload:{type:"MSISDNEntry",result:RDS.Failure({errorType:errorType,error:_context.t0,productUrl:_context.t0.productUrl})}});case 23:_context.next=27;break;case 25:throw dispatch({type:"MO_MSISDN_SUBMIT_ERROR",payload:{type:"MSISDNEntry",result:RDS.Failure({errorType:"UnexpectedState",error:null})}}),new Error("Unexpected state");case 27:case"end":return _context.stop();}},_callee,null,[[3,17]])}));return function(_x,_x2){return _ref.apply(this,arguments)}}()}function backToStart(){return{type:"MO_BACK_TO_START",payload:{type:"MSISDNEntry",result:RDS.NothingYet()}}}function mockMoFlow(mockState){return function(dispatch){if(mockState!==void 0)switch(mockState){case"msisdn-entry-failure-state":return dispatch({type:"MOCK_MO_FLOW_STATE",payload:_utils.mockedMSISDNEntryFailure.currentState});case"msisdn-entry-success-state":return dispatch({type:"MOCK_MO_FLOW_STATE",payload:_utils.mockedMSISDNEntrySuccess.currentState});}}}var initialState={currentState:{type:"MSISDNEntry",result:RDS.NothingYet()}},MoFlowActionMaps={submitMSISDNAction:submitMSISDNAction};exports.MoFlowActionMaps=MoFlowActionMaps;function MoFlowReducer(){var state=0<arguments.length&&arguments[0]!==void 0?arguments[0]:initialState,action=1<arguments.length?arguments[1]:void 0;switch(action.type){case"MO_MSISDN_SUBMIT":return(0,_strategy.genericHandler)(state,action.payload);case"MO_BACK_TO_START":return(0,_strategy.genericHandler)(state,action.payload);case"MO_MSISDN_SUBMIT_ERROR":return(0,_strategy.genericHandler)(state,action.payload);case"MOCK_MO_FLOW_STATE":return(0,_strategy.genericHandler)(state,action.payload);default:return state;}}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IConfig, IGoogleReCaptcha, IKeywordShortcode, IMoFlowReducerState } from './MoTypes';
|
|
2
|
-
export default function submitMSISDN(window: Window, maybeConfig: IConfig, internationalMSISDN: string, extraParams?: {
|
|
3
|
-
[key: string]: string;
|
|
4
|
-
}): Promise<IKeywordShortcode>;
|
|
5
|
-
export declare const getGoogleReCaptchaConfig: ({ slug, country, device, host }: IConfig) => Promise<IGoogleReCaptcha>;
|
|
6
|
-
export declare function submitMSISDNWithConfig(window: Window, config: IConfig, internationalMSISDN: string, extraParams?: {
|
|
7
|
-
[key: string]: string;
|
|
8
|
-
}): Promise<IKeywordShortcode>;
|
|
9
|
-
export declare function checkSubscription(window: Window, maybeConfig: IConfig): Promise<string>;
|
|
10
|
-
export declare const formatSMSLink: (keywordAndShortcode: IKeywordShortcode) => string;
|
|
11
|
-
export declare const mockedMSISDNEntrySuccess: IMoFlowReducerState;
|
|
12
|
-
export declare const mockedMSISDNEntryFailure: IMoFlowReducerState;
|
|
@@ -1 +0,0 @@
|
|
|
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.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.checkSubscription=checkSubscription,exports.default=submitMSISDN,exports.mockedMSISDNEntrySuccess=exports.mockedMSISDNEntryFailure=exports.getGoogleReCaptchaConfig=exports.formatSMSLink=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.array.concat.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.regexp.test.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")),_loadScriptSrc=_interopRequireDefault(require("../../utilities/loadScriptSrc"));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 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)})},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)}}();function submitMSISDN(_x5,_x6,_x7,_x8){return _submitMSISDN.apply(this,arguments)}function _submitMSISDN(){return _submitMSISDN=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(window,maybeConfig,internationalMSISDN,extraParams){var config;return _regeneratorRuntime().wrap(function _callee3$(_context3){for(;1;)switch(_context3.prev=_context3.next){case 0:return config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig||{}),_context3.abrupt("return",submitMSISDNWithConfig(window,config,internationalMSISDN,extraParams));case 2:case"end":return _context3.stop();}},_callee3)})),_submitMSISDN.apply(this,arguments)}var getGoogleReCaptchaConfig=function(){var _ref3=_asyncToGenerator(_regeneratorRuntime().mark(function _callee2(_ref2){var slug,country,device,host,domain,result,srcUrl;return _regeneratorRuntime().wrap(function _callee2$(_context2){for(;1;)switch(_context2.prev=_context2.next){case 0:return slug=_ref2.slug,country=_ref2.country,device=_ref2.device,host=_ref2.host,domain=window.location.hostname,_context2.next=4,window.tallymanApi.getGoogleCaptcha(host,country,slug,device,domain);case 4:return result=_context2.sent,!0===result.success&&(srcUrl="https://www.google.com/recaptcha/api.js?render=".concat(result.site_key),(0,_loadScriptSrc.default)({url:srcUrl,key:result.site_key,isRecaptcha:!0})),_context2.abrupt("return",result);case 7:case"end":return _context2.stop();}},_callee2)}));return function getGoogleReCaptchaConfig(_x9){return _ref3.apply(this,arguments)}}();exports.getGoogleReCaptchaConfig=getGoogleReCaptchaConfig;function submitMSISDNWithConfig(_x10,_x11,_x12,_x13){return _submitMSISDNWithConfig.apply(this,arguments)}function _submitMSISDNWithConfig(){return _submitMSISDNWithConfig=_asyncToGenerator(_regeneratorRuntime().mark(function _callee4(window,config,internationalMSISDN,extraParams){var slug,country,device,offer,host,search,extraParamsQs,msisdn,rockmanId,result,type,error;return _regeneratorRuntime().wrap(function _callee4$(_context4){for(;1;)switch(_context4.prev=_context4.next){case 0:return 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(""),rockmanId=window.pac_analytics.visitor.rockmanId,_context4.next=7,window.tallymanApi.triggerMessage(host,slug,country,msisdn,device,offer,rockmanId,search,extraParamsQs);case 7:if(result=_context4.sent,!1!==result.success){_context4.next=17;break}throw type="ALREADY SUBSCRIBED"===result.message?"AlreadySubscribed":"InvalidMSISDN",error=new Error("".concat(type,":\n").concat(result.message)),error.type=type,error.productUrl=result.product_url?result.product_url:"",console.error(error),error;case 17:return _context4.abrupt("return",_objectSpread(_objectSpread({},result),{},{keyword:result.displayKeyword}));case 18:case"end":return _context4.stop();}},_callee4)})),_submitMSISDNWithConfig.apply(this,arguments)}function checkSubscription(_x14,_x15){return _checkSubscription.apply(this,arguments)}function _checkSubscription(){return _checkSubscription=_asyncToGenerator(_regeneratorRuntime().mark(function _callee5(window,maybeConfig){var config,host,rockmanId,check,checkResult,error;return _regeneratorRuntime().wrap(function _callee5$(_context5){for(;1;)switch(_context5.prev=_context5.next){case 0:return config=_objectSpread({offer:window.pac_analytics.visitor.offer},maybeConfig||{}),host=config.host,rockmanId=window.pac_analytics.visitor.rockmanId,check=function check(){return window.tallymanApi.checkSubscriptionByRockmanIdOnly(host,rockmanId)},_context5.next=6,loop(check,60,function(r){return r.success},0);case 6:if(checkResult=_context5.sent,!(!0===checkResult.success&&checkResult.product_url&&""!==checkResult.product_url)){_context5.next=10;break}return window.location.href=checkResult.product_url,_context5.abrupt("return",checkResult.product_url);case 10:throw error=new Error("SubscriptionFailed".concat(":\n",checkResult.message)),error.type="SubscriptionFailed",error;case 13:case"end":return _context5.stop();}},_callee5)})),_checkSubscription.apply(this,arguments)}var formatSMSLink=function formatSMSLink(keywordAndShortcode){return!window.pac_analytics.visitor["x-requested-with"]||null===window.pac_analytics.visitor["x-requested-with"]||-1===window.pac_analytics.visitor["x-requested-with"].indexOf("com.facebook")?"undefined"!=typeof navigator&&(/iPhone/i.test(navigator.userAgent)||/Mac OS/i.test(navigator.userAgent))?"sms:".concat(keywordAndShortcode.shortcode,"&body=").concat(keywordAndShortcode.keyword):"sms:".concat(keywordAndShortcode.shortcode,"?body=").concat(keywordAndShortcode.keyword):"sms://".concat(keywordAndShortcode.shortcode,"?body=").concat(keywordAndShortcode.keyword)};exports.formatSMSLink=formatSMSLink;var mockedMSISDNEntrySuccess={currentState:{type:"MSISDNEntry",result:RDS.Success({keyword:"TEST OK",shortcode:"777"})}};exports.mockedMSISDNEntrySuccess=mockedMSISDNEntrySuccess;var mockedMSISDNEntryFailure={currentState:{type:"MSISDNEntry",result:RDS.Failure({errorType:"InvalidMSISDN",error:"Invalid Mobile Number"})}};exports.mockedMSISDNEntryFailure=mockedMSISDNEntryFailure;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { AppThunk } from '../../common-types/AppThunk';
|
|
2
|
-
import * as RDS from '../../common-types/RemoteDataState';
|
|
3
|
-
export declare type IMoRedirFlowCurrentState = {
|
|
4
|
-
type: 'MSISDNEntry';
|
|
5
|
-
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
6
|
-
};
|
|
7
|
-
export declare type MSISDNEntryErrorTypes = 'AlreadySubscribed' | 'UnknownError' | 'InvalidMSISDN' | 'UnexpectedState';
|
|
8
|
-
export declare type MSISDNEntryFailure = {
|
|
9
|
-
errorType: MSISDNEntryErrorTypes;
|
|
10
|
-
error: any;
|
|
11
|
-
productUrl?: string;
|
|
12
|
-
};
|
|
13
|
-
export declare type MSISDNEntrySuccess = {
|
|
14
|
-
href: string;
|
|
15
|
-
};
|
|
16
|
-
export declare type IMsisnSubmitActionPayload = {
|
|
17
|
-
type: 'MSISDNEntry';
|
|
18
|
-
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
19
|
-
};
|
|
20
|
-
export interface IMoRedirFlowReducerState {
|
|
21
|
-
currentState: IMoRedirFlowCurrentState;
|
|
22
|
-
}
|
|
23
|
-
export declare type IConfig = {
|
|
24
|
-
offer?: number;
|
|
25
|
-
slug?: string;
|
|
26
|
-
country?: string;
|
|
27
|
-
host?: string;
|
|
28
|
-
device?: 'smart' | 'feature';
|
|
29
|
-
operators?: string[];
|
|
30
|
-
};
|
|
31
|
-
export declare type IMSISDNSubmissionResult = {
|
|
32
|
-
success: true;
|
|
33
|
-
rockman_id: string;
|
|
34
|
-
redirect_url: string;
|
|
35
|
-
} | {
|
|
36
|
-
success: false;
|
|
37
|
-
rockman_id: string;
|
|
38
|
-
message: string;
|
|
39
|
-
};
|
|
40
|
-
export declare type IBackToStartPayload = {
|
|
41
|
-
type: 'MSISDNEntry';
|
|
42
|
-
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
43
|
-
};
|
|
44
|
-
export declare type IMoRedirActions = {
|
|
45
|
-
type: 'MO_REDIR_MSISDN_SUBMIT';
|
|
46
|
-
payload: IMsisnSubmitActionPayload;
|
|
47
|
-
} | {
|
|
48
|
-
type: 'MO_REDIR_MSISDN_SUBMIT_ERROR';
|
|
49
|
-
payload: IMsisdnSubmitErrorPayload;
|
|
50
|
-
} | {
|
|
51
|
-
type: 'MO_REDIR_BACK_TO_START';
|
|
52
|
-
payload: IBackToStartPayload;
|
|
53
|
-
} | {
|
|
54
|
-
type: 'MOCK_MO_REDIR_FLOW_STATE';
|
|
55
|
-
payload: IMoRedirFlowCurrentState;
|
|
56
|
-
};
|
|
57
|
-
export declare type IMsisdnSubmitErrorPayload = {
|
|
58
|
-
type: 'MSISDNEntry';
|
|
59
|
-
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
60
|
-
};
|
|
61
|
-
export declare type IMoRedirFlowActionMaps = {
|
|
62
|
-
submitMSISDNAction: (internationalMSISDN: string, bupperMSISDN?: string, rockman_id?: string) => AppThunk;
|
|
63
|
-
};
|
|
64
|
-
export declare type IMockMoRedirFlowStates = 'msisdn-entry-success-state' | 'msisdn-entry-failure-state';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AppThunk } from '../../common-types/AppThunk';
|
|
2
|
-
import * as RDS from '../../common-types/RemoteDataState';
|
|
3
|
-
import { IMockMoRedirFlowStates, IMoRedirActions, IMoRedirFlowActionMaps, IMoRedirFlowReducerState, MSISDNEntryFailure, MSISDNEntrySuccess } from './MoRedirTypes';
|
|
4
|
-
export declare function submitMSISDNAction(msisdn: string): AppThunk;
|
|
5
|
-
export declare function backToStart(): {
|
|
6
|
-
type: string;
|
|
7
|
-
payload: {
|
|
8
|
-
type: string;
|
|
9
|
-
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export declare function mockMoRedirFlow(mockState: IMockMoRedirFlowStates): AppThunk;
|
|
13
|
-
export declare const MoRedirFlowActionMaps: IMoRedirFlowActionMaps;
|
|
14
|
-
export default function MoRedirFlowReducer(state: IMoRedirFlowReducerState, action: IMoRedirActions): IMoRedirFlowReducerState;
|