ouisys-engine 4.3.0-alpha.0 → 4.5.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/dist/@types/window.d.js +1 -1
  2. package/dist/api/index.d.ts +43 -0
  3. package/dist/api/index.js +1 -728
  4. package/dist/common-types/AppThunk.d.ts +13 -0
  5. package/dist/common-types/AppThunk.js +1 -1
  6. package/dist/common-types/Either.d.ts +8 -0
  7. package/dist/common-types/Either.js +1 -1
  8. package/dist/common-types/IError.d.ts +3 -0
  9. package/dist/common-types/IError.js +1 -1
  10. package/dist/common-types/IOptInFlowName.d.ts +1 -0
  11. package/dist/common-types/ITracker.d.ts +9 -0
  12. package/dist/common-types/ITracker.js +1 -3
  13. package/dist/common-types/IVisitor.d.ts +14 -0
  14. package/dist/common-types/IVisitor.js +1 -1
  15. package/dist/common-types/RemoteDataState.d.ts +38 -0
  16. package/dist/common-types/RemoteDataState.js +1 -135
  17. package/dist/custom-hooks/useOneClickRedirectUrl.d.ts +3 -0
  18. package/dist/custom-hooks/useOneClickRedirectUrl.js +1 -0
  19. package/dist/custom-hooks/usePinEntryState.d.ts +8 -0
  20. package/dist/custom-hooks/usePinEntryState.js +1 -0
  21. package/dist/custom-hooks/useStrategyConfig.d.ts +4 -0
  22. package/dist/custom-hooks/useStrategyConfig.js +1 -0
  23. package/dist/flows/click2smsFlow.d.ts +6 -0
  24. package/dist/flows/click2smsFlow.js +1 -19
  25. package/dist/flows/creditCardFlow.d.ts +6 -0
  26. package/dist/flows/creditCardFlow.js +1 -0
  27. package/dist/flows/moFlow.d.ts +6 -0
  28. package/dist/flows/moFlow.js +1 -19
  29. package/dist/flows/moRedirFlow.d.ts +6 -0
  30. package/dist/flows/moRedirFlow.js +1 -19
  31. package/dist/flows/oneClickFlow.d.ts +7 -0
  32. package/dist/flows/oneClickFlow.js +1 -23
  33. package/dist/flows/pinFlow.d.ts +7 -0
  34. package/dist/flows/pinFlow.js +1 -23
  35. package/dist/flows/strategy.d.ts +14 -0
  36. package/dist/flows/strategy.js +1 -53
  37. package/dist/flows/ussdFlow.d.ts +6 -0
  38. package/dist/flows/ussdFlow.js +1 -19
  39. package/dist/index.d.ts +0 -0
  40. package/dist/index.js +0 -2
  41. package/dist/ips/tryGetIPRangeName.d.ts +2 -0
  42. package/dist/ips/tryGetIPRangeName.js +1 -74
  43. package/dist/jest.config.js +194 -0
  44. package/dist/pacman/index.d.ts +6 -0
  45. package/dist/pacman/index.js +1 -108
  46. package/dist/pacman/queryString.d.ts +3 -0
  47. package/dist/pacman/queryString.js +1 -45
  48. package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +76 -0
  49. package/dist/reducers/click2smsFlow/Click2smsTypes.js +1 -1
  50. package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +2 -0
  51. package/dist/reducers/click2smsFlow/IClick2smsConstants.js +1 -1
  52. package/dist/reducers/click2smsFlow/index.d.ts +5 -0
  53. package/dist/reducers/click2smsFlow/index.js +1 -183
  54. package/dist/reducers/click2smsFlow/utils.d.ts +4 -0
  55. package/dist/reducers/click2smsFlow/utils.js +1 -357
  56. package/dist/reducers/creditCardFlow/CreditCardTypes.d.ts +79 -0
  57. package/dist/reducers/creditCardFlow/CreditCardTypes.js +1 -0
  58. package/dist/reducers/creditCardFlow/ICreditCardConstants.d.ts +2 -0
  59. package/dist/reducers/creditCardFlow/ICreditCardConstants.js +1 -0
  60. package/dist/reducers/creditCardFlow/index.d.ts +5 -0
  61. package/dist/reducers/creditCardFlow/index.js +1 -0
  62. package/dist/reducers/creditCardFlow/utils.d.ts +8 -0
  63. package/dist/reducers/creditCardFlow/utils.js +1 -0
  64. package/dist/reducers/moFlow/IMoConstants.d.ts +2 -0
  65. package/dist/reducers/moFlow/IMoConstants.js +1 -1
  66. package/dist/reducers/moFlow/MoTypes.d.ts +88 -0
  67. package/dist/reducers/moFlow/MoTypes.js +1 -1
  68. package/dist/reducers/moFlow/index.d.ts +16 -0
  69. package/dist/reducers/moFlow/index.js +1 -251
  70. package/dist/reducers/moFlow/utils.d.ts +12 -0
  71. package/dist/reducers/moFlow/utils.js +1 -284
  72. package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +2 -0
  73. package/dist/reducers/moRedirFlow/IMoRedirConstants.js +1 -1
  74. package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +64 -0
  75. package/dist/reducers/moRedirFlow/MoRedirTypes.js +1 -1
  76. package/dist/reducers/moRedirFlow/index.d.ts +14 -0
  77. package/dist/reducers/moRedirFlow/index.js +1 -226
  78. package/dist/reducers/moRedirFlow/utils.d.ts +10 -0
  79. package/dist/reducers/moRedirFlow/utils.js +1 -186
  80. package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +2 -0
  81. package/dist/reducers/oneClickFlow/IOneClickConstants.js +1 -1
  82. package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +85 -0
  83. package/dist/reducers/oneClickFlow/OneClickTypes.js +1 -1
  84. package/dist/reducers/oneClickFlow/index.d.ts +13 -0
  85. package/dist/reducers/oneClickFlow/index.js +1 -409
  86. package/dist/reducers/oneClickFlow/utils.d.ts +16 -0
  87. package/dist/reducers/oneClickFlow/utils.js +1 -366
  88. package/dist/reducers/pinFlow/IPinConstants.d.ts +2 -0
  89. package/dist/reducers/pinFlow/IPinConstants.js +1 -1
  90. package/dist/reducers/pinFlow/PinTypes.d.ts +156 -0
  91. package/dist/reducers/pinFlow/PinTypes.js +1 -1
  92. package/dist/reducers/pinFlow/index.d.ts +19 -0
  93. package/dist/reducers/pinFlow/index.js +1 -514
  94. package/dist/reducers/pinFlow/utils.d.ts +11 -0
  95. package/dist/reducers/pinFlow/utils.js +1 -494
  96. package/dist/reducers/strategy/IStategyActionContants.d.ts +2 -0
  97. package/dist/reducers/strategy/IStategyActionContants.js +1 -1
  98. package/dist/reducers/strategy/StrategyTypes.d.ts +248 -0
  99. package/dist/reducers/strategy/StrategyTypes.js +1 -1
  100. package/dist/reducers/strategy/index.d.ts +13 -0
  101. package/dist/reducers/strategy/index.js +1 -389
  102. package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +15 -0
  103. package/dist/reducers/strategy/strategies/ask_mobile_number.js +1 -403
  104. package/dist/reducers/strategy/strategies/ask_operator.d.ts +5 -0
  105. package/dist/reducers/strategy/strategies/ask_operator.js +1 -305
  106. package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +10 -0
  107. package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +1 -459
  108. package/dist/reducers/strategy/strategies/header_enrichment.d.ts +7 -0
  109. package/dist/reducers/strategy/strategies/header_enrichment.js +1 -783
  110. package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.d.ts +2 -0
  111. package/dist/reducers/strategy/strategies/injectHeaderEnrichmentScript.js +1 -0
  112. package/dist/reducers/strategy/utils.d.ts +30 -0
  113. package/dist/reducers/strategy/utils.js +1 -702
  114. package/dist/reducers/ussdFlow/IUssdConstants.d.ts +2 -0
  115. package/dist/reducers/ussdFlow/IUssdConstants.js +1 -1
  116. package/dist/reducers/ussdFlow/UssdTypes.d.ts +77 -0
  117. package/dist/reducers/ussdFlow/UssdTypes.js +1 -1
  118. package/dist/reducers/ussdFlow/index.d.ts +14 -0
  119. package/dist/reducers/ussdFlow/index.js +1 -251
  120. package/dist/reducers/ussdFlow/utils.d.ts +11 -0
  121. package/dist/reducers/ussdFlow/utils.js +1 -225
  122. package/dist/store/index.d.ts +14 -0
  123. package/dist/store/index.js +1 -177
  124. package/dist/store/reducers.d.ts +20 -0
  125. package/dist/store/reducers.js +1 -41
  126. package/dist/utilities/addEmpelloToken.d.ts +4 -0
  127. package/dist/utilities/addEmpelloToken.js +1 -0
  128. package/dist/utilities/handleSubmitNumber.d.ts +21 -0
  129. package/dist/utilities/handleSubmitNumber.js +1 -59
  130. package/dist/utilities/index.d.ts +14 -0
  131. package/dist/utilities/index.js +1 -0
  132. package/dist/utilities/loadScriptInnerHtml.d.ts +2 -0
  133. package/dist/utilities/loadScriptInnerHtml.js +1 -0
  134. package/dist/utilities/loadScriptSrc.d.ts +8 -0
  135. package/dist/utilities/loadScriptSrc.js +1 -0
  136. package/dist/utilities/replaceUrlParam.d.ts +1 -0
  137. package/dist/utilities/replaceUrlParam.js +1 -0
  138. package/dist/utilities/storeMsisdn.d.ts +3 -0
  139. package/dist/utilities/storeMsisdn.js +1 -0
  140. package/package.json +1 -1
  141. package/dist/app/store.js +0 -20
  142. package/dist/features/strategies/categories/askMobileNumber.js +0 -388
  143. package/dist/features/strategies/categories/askOperator.js +0 -313
  144. package/dist/features/strategies/categories/detectOperatorByIp.js +0 -599
  145. package/dist/features/strategies/categories/headerEnrichment.js +0 -665
  146. package/dist/features/strategies/categories/singleFlows/pin.js +0 -1
  147. package/dist/features/strategies/identifySlice.js +0 -355
  148. package/dist/features/strategies/pinFlowSlice.js +0 -338
  149. package/dist/flows/tpayHeFlow.js +0 -23
  150. package/dist/mockServer/browser.js +0 -48
  151. package/dist/mockServer/handlers.js +0 -22
  152. package/dist/mockServer/server.js +0 -48
  153. package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
  154. package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
  155. package/dist/reducers/tpayHeFlow/index.js +0 -331
  156. package/dist/reducers/tpayHeFlow/utils.js +0 -510
  157. package/dist/test/setup.js +0 -24
  158. package/dist/test/test-utils.js +0 -51
@@ -1,59 +1 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.array.join");
4
-
5
- require("core-js/modules/es.regexp.exec");
6
-
7
- require("core-js/modules/es.string.match");
8
-
9
- Object.defineProperty(exports, "__esModule", {
10
- value: true
11
- });
12
- exports.handleFormSubmit = exports.handleAutoSubmitMsisdn = void 0;
13
-
14
- var _awesomePhonenumber = _interopRequireDefault(require("awesome-phonenumber"));
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
- var handleAutoSubmitMsisdn = function handleAutoSubmitMsisdn(_ref) {
19
- var msisdnValue = _ref.msisdnValue,
20
- dispatch = _ref.dispatch,
21
- submitMSISDNAction = _ref.submitMSISDNAction,
22
- isHeaderEnrichmentSuccess = _ref.isHeaderEnrichmentSuccess,
23
- setMsisdnValue = _ref.setMsisdnValue;
24
-
25
- if (msisdnValue && msisdnValue.length > 3 && isHeaderEnrichmentSuccess == false) {
26
- var pn = new _awesomePhonenumber.default("+" + msisdnValue, process.env.country.toUpperCase());
27
-
28
- if (pn.isValid()) {
29
- dispatch(submitMSISDNAction(msisdnValue));
30
- } else {
31
- setMsisdnValue(pn.getCountryCode() + msisdnValue);
32
- dispatch(submitMSISDNAction(pn.getCountryCode() + msisdnValue));
33
- }
34
- }
35
- };
36
-
37
- exports.handleAutoSubmitMsisdn = handleAutoSubmitMsisdn;
38
-
39
- var handleFormSubmit = function handleFormSubmit(_ref2) {
40
- var isHeaderEnrichmentSuccess = _ref2.isHeaderEnrichmentSuccess,
41
- country = _ref2.country,
42
- setInternationalNumber = _ref2.setInternationalNumber,
43
- onEnd = _ref2.onEnd,
44
- internationalNumber = _ref2.internationalNumber;
45
- var pn = new _awesomePhonenumber.default("+" + internationalNumber, process.env.country.toUpperCase());
46
- var countryCode = pn.getCountryCode();
47
-
48
- if (isHeaderEnrichmentSuccess == true && process.env.country == "kw" && internationalNumber != "" && !pn.isValid()) {
49
- setInternationalNumber(countryCode + internationalNumber);
50
- var newNumber = countryCode + internationalNumber;
51
- onEnd(newNumber.match(/\d+/gi).join(''));
52
- } else {
53
- if (!!internationalNumber) {
54
- onEnd(internationalNumber.match(/\d+/gi).join(''));
55
- }
56
- }
57
- };
58
-
59
- exports.handleFormSubmit = handleFormSubmit;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.handleFormSubmit=exports.handleAutoSubmitMsisdn=void 0,require("core-js/modules/es.array.join.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.match.js");var _awesomePhonenumber=_interopRequireDefault(require("awesome-phonenumber")),_=require("."),_utils=require("../reducers/strategy/utils");function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var handleAutoSubmitMsisdn=function(_ref){var msisdnValue=_ref.msisdnValue,dispatch=_ref.dispatch,submitMSISDNAction=_ref.submitMSISDNAction,isHeaderEnrichmentSuccess=_ref.isHeaderEnrichmentSuccess,setMsisdnValue=_ref.setMsisdnValue,isHeaderEnrichmentAutoSubmit=_ref.isHeaderEnrichmentAutoSubmit;if(msisdnValue&&3<msisdnValue.length&&(!1===isHeaderEnrichmentSuccess||!0===isHeaderEnrichmentSuccess&&!0===isHeaderEnrichmentAutoSubmit)){var pn=new _awesomePhonenumber.default("+".concat(msisdnValue),process.env.country.toUpperCase());pn.isValid()?dispatch(submitMSISDNAction(msisdnValue)):(setMsisdnValue(pn.getCountryCode()+msisdnValue),dispatch(submitMSISDNAction(pn.getCountryCode()+msisdnValue)))}};exports.handleAutoSubmitMsisdn=handleAutoSubmitMsisdn;var handleFormSubmit=function(_ref2){var isHeaderEnrichmentSuccess=_ref2.isHeaderEnrichmentSuccess,setInternationalNumber=_ref2.setInternationalNumber,onEnd=_ref2.onEnd,internationalNumber=_ref2.internationalNumber,pn=new _awesomePhonenumber.default("+".concat(internationalNumber),process.env.country.toUpperCase()),countryCode=pn.getCountryCode(),networkType=isHeaderEnrichmentSuccess?"mobile_data":"wifi",searchObj=(0,_utils.searchToObject)();if(!0===isHeaderEnrichmentSuccess&&"kw"===process.env.country&&""!==internationalNumber&&!pn.isValid()){setInternationalNumber(countryCode+internationalNumber);onEnd((countryCode+internationalNumber).match(/\d+/gi).join(""))}else if(!(!0===isHeaderEnrichmentSuccess&&"true"===(null===searchObj||void 0===searchObj?void 0:searchObj.success)&&"1"===searchObj["msisdn-alias"]))"undefined"!=typeof window&&(0,_.isCookieExists)("OMEU")&&"es"===process.env.country?onEnd("1",{network_type:networkType,"skip-validation":"1"}):internationalNumber&&("ci"===process.env.country?onEnd(internationalNumber.match(/\d+/gi).join(""),{network_type:networkType}):onEnd(internationalNumber.match(/\d+/gi).join("")));else if(null!==searchObj&&void 0!==searchObj&&searchObj.msisdn){var encryptedMsisdn=searchObj.msisdn;onEnd(encryptedMsisdn,{network_type:networkType,"skip-validation":"1"})}};exports.handleFormSubmit=handleFormSubmit;
@@ -0,0 +1,14 @@
1
+ import { IConfig } from '../reducers/strategy/StrategyTypes';
2
+ export declare const isDMBCheck: () => boolean;
3
+ export declare const setOnLoadUtilities: (config: IConfig) => void;
4
+ export declare type SAOperators = 'SA_VIRGIN' | 'SA_MOBILY' | 'SA_STC' | 'SA_ZAIN';
5
+ export declare function getSAOperatorByMsisdnPrefix(msisdn: string): SAOperators | undefined;
6
+ export declare const hasNumber: (myString: string) => boolean;
7
+ export declare const mapAgencyOperator: {
8
+ [key: string]: string;
9
+ };
10
+ export declare const getKeyByValue: (object: {
11
+ [key: string]: string;
12
+ }, value: string | number) => string;
13
+ export declare const isCookieExists: (cookieName: string) => boolean;
14
+ export declare const getCookie: (cookieName: string) => string;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getKeyByValue=exports.getCookie=void 0,exports.getSAOperatorByMsisdnPrefix=getSAOperatorByMsisdnPrefix,exports.setOnLoadUtilities=exports.mapAgencyOperator=exports.isDMBCheck=exports.isCookieExists=exports.hasNumber=void 0,require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.map.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.regexp.test.js"),require("core-js/modules/es.array.find.js"),require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.string.match.js"),require("core-js/modules/es.regexp.constructor.js"),require("core-js/modules/es.regexp.sticky.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.string.split.js");var _utils=require("../reducers/moFlow/utils"),_utils2=require("../reducers/moRedirFlow/utils"),_utils3=require("../reducers/pinFlow/utils"),isDMBCheck=function(){var _window$pac_analytics,_window$pac_analytics2,_window$pac_analytics3,_window$pac_analytics4;return!(null===window.pac_analytics.visitor.xaid||-1===(-1!==(null===(_window$pac_analytics=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics||null===(_window$pac_analytics2=_window$pac_analytics.toLowerCase())||void 0===_window$pac_analytics2?void 0:_window$pac_analytics2.indexOf("dmb"))||(null===(_window$pac_analytics3=window.pac_analytics.visitor.xaid)||void 0===_window$pac_analytics3||null===(_window$pac_analytics4=_window$pac_analytics3.toLowerCase())||void 0===_window$pac_analytics4?void 0:_window$pac_analytics4.indexOf("amb"))))};exports.isDMBCheck=isDMBCheck;var setOnLoadUtilities=function(config){"undefined"!=typeof window&&("cz"===process.env.country.toLowerCase()&&(0,_utils.getGoogleReCaptchaConfig)(config),"a2"===process.env.country.toLowerCase()&&"production"===process.env.NODE_ENV&&(0,_utils2.startEvinaAgency)(config),("sa"===process.env.country.toLowerCase()||"iq"===process.env.country.toLowerCase()||"k2"===process.env.country.toLowerCase()||"bh"===process.env.country.toLowerCase())&&(0,_utils3.loadMcpShield)(window,config))};exports.setOnLoadUtilities=setOnLoadUtilities;var saPrefixOperatorMap=new Map([["966571","SA_VIRGIN"],["966500","SA_STC"],["966501","SA_STC"],["966502","SA_STC"],["966503","SA_STC"],["966504","SA_STC"],["966505","SA_STC"],["966506","SA_STC"],["966507","SA_STC"],["966508","SA_STC"],["966509","SA_STC"],["966512","SA_STC"],["966514","SA_STC"],["966515","SA_STC"],["966517","SA_STC"],["966530","SA_STC"],["966531","SA_STC"],["966532","SA_STC"],["966533","SA_STC"],["966534","SA_STC"],["966535","SA_STC"],["966536","SA_STC"],["966537","SA_STC"],["966538","SA_STC"],["966539","SA_STC"],["966540","SA_MOBILY"],["966541","SA_MOBILY"],["966542","SA_MOBILY"],["966543","SA_MOBILY"],["966544","SA_MOBILY"],["966545","SA_MOBILY"],["966546","SA_MOBILY"],["966547","SA_MOBILY"],["966548","SA_MOBILY"],["966549","SA_MOBILY"],["966550","SA_STC"],["966551","SA_STC"],["966552","SA_STC"],["966553","SA_STC"],["966554","SA_STC"],["966555","SA_STC"],["966556","SA_STC"],["966557","SA_STC"],["966558","SA_STC"],["966559","SA_STC"],["966560","SA_MOBILY"],["966561","SA_MOBILY"],["966562","SA_MOBILY"],["966563","SA_MOBILY"],["966564","SA_MOBILY"],["966565","SA_MOBILY"],["966566","SA_MOBILY"],["966567","SA_MOBILY"],["966568","SA_MOBILY"],["966569","SA_MOBILY"],["966570","SA_VIRGIN"],["966572","SA_VIRGIN"],["966573","SA_VIRGIN"],["966580","SA_ZAIN"],["966581","SA_ZAIN"],["966582","SA_ZAIN"],["966583","SA_ZAIN"],["966586","SA_ZAIN"],["966588","SA_ZAIN"],["966589","SA_ZAIN"],["966590","SA_ZAIN"],["966591","SA_ZAIN"],["966592","SA_ZAIN"],["966593","SA_ZAIN"],["966594","SA_ZAIN"],["966595","SA_ZAIN"],["966596","SA_ZAIN"],["966597","SA_ZAIN"],["966598","SA_ZAIN"],["966599","SA_ZAIN"]]);function getSAOperatorByMsisdnPrefix(msisdn){var msisdnF=msisdn;"0"===msisdnF[0]&&(msisdnF="966".concat(msisdnF.substring(1)));var prefix=msisdnF.substring(0,6);return saPrefixOperatorMap.get(prefix)}var hasNumber=function(myString){return /\d/.test(myString)};exports.hasNumber=hasNumber;var mapAgencyOperator={SA_STC:"S2_STC",SA_MOBILY:"S2_MOBILY",SA_ZAIN:"S2_ZAIN",KW_ZAIN:"K2_ZAIN",KW_OOREDOO:"K2_OOREDOO",KW_VIVA:"K2_VIVA",AE_DU:"A2_DU",AE_ETISALAT:"A2_ETISALAT",CA_SUNRISE:"C2_SUNRISE",CA_TELE2:"C2_TELE2",CA_SWISSCOM:"C2_SWISSCOM",CA_SALT:"C2_SALT",OM_OOREDOO:"O2_OOREDOO",OM_OMANTEL:"O2_OMANTEL",RS_TELEKOM:"R2_TELEKOM",RS_VIP:"R2_VIP",RS_TELIM:"R2_TELIM",BH_ZAIN:"B2_ZAIN",BH_BATELCO:"B2_BATELCO",BH_STC:"B2_STC",GR_VODAFONE:"G2_VODAFONE",GR_WIND:"G2_WIND",GR_COSMOTE:"G2_COSMOTE",AT_TELECOM:"A3_TELECOM",AT_DRIE:"A3_DRIE",AT_TMOBILE:"A3_TMOBILE"};exports.mapAgencyOperator=mapAgencyOperator;var getKeyByValue=function(object,value){return Object.keys(object).find(function(key){return object[key]===value})};exports.getKeyByValue=getKeyByValue;var isCookieExists=function(cookieName){return"undefined"!=typeof window&&null!==document.cookie.match(new RegExp("^(.*;)?\\s*".concat(cookieName,"\\s*=\\s*[^;]+(.*)?$")))};exports.isCookieExists=isCookieExists;var getCookie=function(cookieName){for(var cookie,name="".concat(cookieName,"="),decodedCookie=decodeURIComponent(document.cookie),cookieArray=decodedCookie.split(";"),i=0;i<cookieArray.length;i++){for(cookie=cookieArray[i];" "===cookie.charAt(0);)cookie=cookie.substring(1);if(0===cookie.indexOf(name))return cookie.substring(name.length,cookie.length)}return null};exports.getCookie=getCookie;
@@ -0,0 +1,2 @@
1
+ declare const loadScriptInnerHtml: (innerHTML: string, isBody?: boolean) => void;
2
+ export default loadScriptInnerHtml;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.object.to-string.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");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)}var loadScriptInnerHtml=function(innerHTML,isBody){var script=document.createElement("script");if(script.type="text/javascript",script.innerHTML=innerHTML,script.id="agency_mt2"===window.gateway?"EvinaPinTrigger":"",isBody)document.getElementsByTagName("body")[0].appendChild(script);else{var headElem=document.getElementsByTagName("head")[0];headElem.insertBefore(script,headElem.firstChild),setTimeout(function(){if("agency_mt2"===window.gateway&&void 0!==_typeof(window.evina_dcb)){console.log("Ev ready");var event=new Event("DCBProtectRun");"undefined"!=typeof window&&document.dispatchEvent(event)}},0)}},_default=loadScriptInnerHtml;exports.default=_default;
@@ -0,0 +1,8 @@
1
+ declare const loadScriptSrc: ({ url, key, isRecaptcha, callBack, id }: {
2
+ url: string;
3
+ key?: string;
4
+ isRecaptcha?: boolean;
5
+ callBack?: () => void;
6
+ id?: string;
7
+ }) => void;
8
+ export default loadScriptSrc;
@@ -0,0 +1 @@
1
+ "use strict";var _loadScriptInnerHtml=_interopRequireDefault(require("./loadScriptInnerHtml"));Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}var loadScriptSrc=function(_ref){var url=_ref.url,key=_ref.key,_ref$isRecaptcha=_ref.isRecaptcha,callBack=_ref.callBack,_ref$id=_ref.id,id=void 0===_ref$id?"":_ref$id,script=document.createElement("script");script.type="text/javascript",script.src=url,script.id="injected_script_".concat(id);var headElem=document.getElementsByTagName("head")[0];headElem.insertBefore(script,headElem.firstChild),void 0!==_ref$isRecaptcha&&_ref$isRecaptcha&&(script.onload=function(){var scriptInner="\n grecaptcha.ready(function() {\n grecaptcha.execute(\"".concat(key,"\", {action: 'submit'}).then(function(token) {\n // To be used by tallyman\n window.reCaptchaToken = token;\n console.log(\"-------\" + token);\n });\n });\n ");(0,_loadScriptInnerHtml.default)(scriptInner,!0)}),script.onerror=function(){console.error("Error loading script",url),callBack&&callBack()}},_default=loadScriptSrc;exports.default=_default;
@@ -0,0 +1 @@
1
+ export declare const replaceUrlParam: (url: string, paramName: string, paramValue?: string) => string;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.replaceUrlParam=void 0,require("core-js/modules/es.regexp.constructor.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.regexp.sticky.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.string.search.js"),require("core-js/modules/es.string.replace.js"),require("core-js/modules/es.array.concat.js");var replaceUrlParam=function(url,paramName){var paramValue=2<arguments.length&&arguments[2]!==void 0?arguments[2]:"",pattern=new RegExp("\\b(".concat(paramName,"=).*?(&|#|$)"));if(0<=url.search(pattern))return url.replace(pattern,"$1".concat(paramValue,"$2"));var newUrl=url.replace(/[?#]$/,"");return"".concat(newUrl+paramName,"=").concat(paramValue,"&")};exports.replaceUrlParam=replaceUrlParam;
@@ -0,0 +1,3 @@
1
+ export declare const setCookie: (name: string, value: string, daysToExpire: number, path?: string) => void;
2
+ export declare const getCookie: (name: string) => string;
3
+ export declare function storeMsisdn(msisdn: string): Promise<any>;
@@ -0,0 +1 @@
1
+ "use strict";function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}require("core-js/modules/es.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"),Object.defineProperty(exports,"__esModule",{value:!0}),exports.setCookie=exports.getCookie=void 0,exports.storeMsisdn=storeMsisdn,require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.regexp.exec.js"),require("core-js/modules/es.string.match.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.json.stringify.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 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 setCookie=function(name,value,daysToExpire){var path=3<arguments.length&&arguments[3]!==void 0?arguments[3]:"/",cookieString="".concat(name,"=").concat(encodeURIComponent(value));if(daysToExpire){var date=new Date;date.setTime(date.getTime()+1e3*(60*(60*(24*daysToExpire)))),cookieString+="; expires=".concat(date.toUTCString())}cookieString+="; path=".concat(path),document.cookie=cookieString};exports.setCookie=setCookie;var getCookie=function(name){var cookieValue=document.cookie.match("(^|;)\\s*".concat(name,"\\s*=\\s*([^;]+)"));return cookieValue?decodeURIComponent(cookieValue.pop()):""};exports.getCookie=getCookie;function storeMsisdn(){return _storeMsisdn.apply(this,arguments)}function _storeMsisdn(){return _storeMsisdn=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(msisdn){var encryptedMsisdn,response;return _regeneratorRuntime().wrap(function _callee$(_context){for(;1;)switch(_context.prev=_context.next){case 0:if("undefined"==typeof window){_context.next=18;break}if(encryptedMsisdn=window.btoa(msisdn),setCookie("_uuid",encryptedMsisdn,365,"/"),localStorage.setItem("_uuid",encryptedMsisdn),window.msisdnCookieUrl){_context.next=6;break}return _context.abrupt("return",{data:{success:!0,message:"MSISDN saved on cookies and localStorage"}});case 6:return _context.prev=6,_context.next=9,fetch(window.msisdnCookieUrl,{mode:"cors",method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({_uuid:encryptedMsisdn})});case 9:return response=_context.sent,_context.abrupt("return",response.json());case 13:return _context.prev=13,_context.t0=_context["catch"](6),_context.abrupt("return",_context.t0.message);case 16:_context.next=19;break;case 18:return _context.abrupt("return","Window object is not available");case 19:case"end":return _context.stop();}},_callee,null,[[6,13]])})),_storeMsisdn.apply(this,arguments)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ouisys-engine",
3
- "version": "4.3.0-alpha.0",
3
+ "version": "4.5.0-alpha.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "directories": "dist dev-tools",
package/dist/app/store.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.store = void 0;
7
-
8
- var _toolkit = require("@reduxjs/toolkit");
9
-
10
- var _identifySlice = _interopRequireDefault(require("../features/strategies/identifySlice"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
-
14
- // acts like compbine reducers if we pass an object
15
- var store = (0, _toolkit.configureStore)({
16
- reducer: {
17
- strategy: _identifySlice.default
18
- }
19
- });
20
- exports.store = store;
@@ -1,388 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
- require("core-js/modules/es.symbol");
6
-
7
- require("core-js/modules/es.symbol.description");
8
-
9
- require("core-js/modules/es.symbol.iterator");
10
-
11
- require("core-js/modules/es.array.filter");
12
-
13
- require("core-js/modules/es.array.iterator");
14
-
15
- require("core-js/modules/es.object.get-own-property-descriptor");
16
-
17
- require("core-js/modules/es.object.get-own-property-descriptors");
18
-
19
- require("core-js/modules/es.object.keys");
20
-
21
- require("core-js/modules/es.object.to-string");
22
-
23
- require("core-js/modules/es.promise");
24
-
25
- require("core-js/modules/es.string.iterator");
26
-
27
- require("core-js/modules/es.weak-map");
28
-
29
- require("core-js/modules/web.dom-collections.for-each");
30
-
31
- require("core-js/modules/web.dom-collections.iterator");
32
-
33
- Object.defineProperty(exports, "__esModule", {
34
- value: true
35
- });
36
- exports.identifySubmitMSISDNAction = exports.askMobileNumber = exports.pinMoAskMobileNumber = exports.pinMoRedirAskMobileNumber = exports.pin = void 0;
37
-
38
- require("regenerator-runtime/runtime");
39
-
40
- var _toolkit = require("@reduxjs/toolkit");
41
-
42
- var RDS = _interopRequireWildcard(require("../../../common-types/RemoteDataState"));
43
-
44
- var _utils = require("../../../reducers/strategy/utils");
45
-
46
- var _identifySlice = require("../identifySlice");
47
-
48
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
49
-
50
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
51
-
52
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
53
-
54
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
55
-
56
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
57
-
58
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
59
-
60
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
61
-
62
- var oneClick = function oneClick(_ref) {
63
- var flowObj = _ref.flowObj,
64
- msisdn = _ref.msisdn;
65
-
66
- _identifySlice.tracker.sendOptInFlowEvent('3G click');
67
-
68
- return {
69
- type: _identifySlice.StrategyStates.ONE_CLICK,
70
- result: {
71
- config: flowObj.flowConfig,
72
- operator: flowObj.operator,
73
- msisdn: msisdn
74
- }
75
- };
76
- };
77
-
78
- var pin = function pin(_ref2) {
79
- var flowObj = _ref2.flowObj,
80
- msisdn = _ref2.msisdn;
81
-
82
- _identifySlice.tracker.sendOptInFlowEvent('Pin');
83
-
84
- return {
85
- type: _identifySlice.StrategyStates.PIN,
86
- result: {
87
- config: flowObj.flowConfig,
88
- operator: flowObj.operator,
89
- msisdn: msisdn
90
- }
91
- };
92
- };
93
-
94
- exports.pin = pin;
95
-
96
- var moRedir = function moRedir(_ref3) {
97
- var flowObj = _ref3.flowObj,
98
- msisdn = _ref3.msisdn;
99
-
100
- _identifySlice.tracker.sendOptInFlowEvent('Redirect');
101
-
102
- return {
103
- type: _identifySlice.StrategyStates.MO_REDIR,
104
- result: {
105
- config: flowObj.flowConfig,
106
- operator: flowObj.operator,
107
- msisdn: msisdn
108
- }
109
- };
110
- };
111
-
112
- var click2sms = function click2sms(_ref4) {
113
- var flowObj = _ref4.flowObj,
114
- msisdn = _ref4.msisdn;
115
-
116
- _identifySlice.tracker.sendOptInFlowEvent('Click to sms');
117
-
118
- return {
119
- type: _identifySlice.StrategyStates.CLICK2SMS,
120
- result: {
121
- config: _objectSpread({
122
- operators: [flowObj.operator]
123
- }, flowObj.flowConfig),
124
- operator: flowObj.operator,
125
- msisdn: msisdn
126
- }
127
- };
128
- };
129
-
130
- var mo = function mo(_ref5) {
131
- var flowObj = _ref5.flowObj,
132
- msisdn = _ref5.msisdn;
133
-
134
- _identifySlice.tracker.sendOptInFlowEvent('Msisdn to sms');
135
-
136
- return {
137
- type: _identifySlice.StrategyStates.MO,
138
- result: {
139
- config: flowObj.flowConfig,
140
- operator: flowObj.operator,
141
- msisdn: msisdn
142
- }
143
- };
144
- };
145
-
146
- var pinMoRedirAskMobileNumber = /*#__PURE__*/function () {
147
- var _ref7 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref6) {
148
- var configs, flowObj, internationalMSISDN, strategyConfigs, defaultFlow;
149
- return regeneratorRuntime.wrap(function _callee$(_context) {
150
- while (1) {
151
- switch (_context.prev = _context.next) {
152
- case 0:
153
- configs = _ref6.configs, flowObj = _ref6.flowObj, internationalMSISDN = _ref6.internationalMSISDN;
154
- strategyConfigs = configs.strategyConfigs;
155
- defaultFlow = strategyConfigs.default;
156
- _context.prev = 3;
157
- _context.t0 = flowObj.flow;
158
- _context.next = _context.t0 === 'pin' ? 7 : _context.t0 === 'moRedir' ? 8 : 9;
159
- break;
160
-
161
- case 7:
162
- return _context.abrupt("return", pin({
163
- flowObj: flowObj,
164
- msisdn: internationalMSISDN
165
- }));
166
-
167
- case 8:
168
- return _context.abrupt("return", moRedir({
169
- flowObj: flowObj,
170
- msisdn: internationalMSISDN
171
- }));
172
-
173
- case 9:
174
- return _context.abrupt("return", pin({
175
- flowObj: _objectSpread(_objectSpread({}, defaultFlow), {}, {
176
- operator: flowObj.operator
177
- }),
178
- msisdn: internationalMSISDN
179
- }));
180
-
181
- case 10:
182
- _context.next = 16;
183
- break;
184
-
185
- case 12:
186
- _context.prev = 12;
187
- _context.t1 = _context["catch"](3);
188
- console.warn(_context.t1);
189
- return _context.abrupt("return", pin({
190
- flowObj: defaultFlow,
191
- msisdn: internationalMSISDN
192
- }));
193
-
194
- case 16:
195
- case "end":
196
- return _context.stop();
197
- }
198
- }
199
- }, _callee, null, [[3, 12]]);
200
- }));
201
-
202
- return function pinMoRedirAskMobileNumber(_x) {
203
- return _ref7.apply(this, arguments);
204
- };
205
- }();
206
-
207
- exports.pinMoRedirAskMobileNumber = pinMoRedirAskMobileNumber;
208
-
209
- var pinMoAskMobileNumber = /*#__PURE__*/function () {
210
- var _ref9 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref8) {
211
- var configs, flowObj, internationalMSISDN, strategyConfigs, defaultFlow;
212
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
213
- while (1) {
214
- switch (_context2.prev = _context2.next) {
215
- case 0:
216
- configs = _ref8.configs, flowObj = _ref8.flowObj, internationalMSISDN = _ref8.internationalMSISDN;
217
- strategyConfigs = configs.strategyConfigs;
218
- defaultFlow = strategyConfigs.default;
219
- _context2.prev = 3;
220
- _context2.t0 = flowObj.flow;
221
- _context2.next = _context2.t0 === 'pin' ? 7 : _context2.t0 === 'mo' ? 8 : 9;
222
- break;
223
-
224
- case 7:
225
- return _context2.abrupt("return", pin({
226
- flowObj: flowObj,
227
- msisdn: internationalMSISDN
228
- }));
229
-
230
- case 8:
231
- return _context2.abrupt("return", mo({
232
- flowObj: flowObj,
233
- msisdn: internationalMSISDN
234
- }));
235
-
236
- case 9:
237
- return _context2.abrupt("return", pin({
238
- flowObj: _objectSpread(_objectSpread({}, defaultFlow), {}, {
239
- operator: flowObj.operator
240
- }),
241
- msisdn: internationalMSISDN
242
- }));
243
-
244
- case 10:
245
- _context2.next = 16;
246
- break;
247
-
248
- case 12:
249
- _context2.prev = 12;
250
- _context2.t1 = _context2["catch"](3);
251
- console.warn(_context2.t1);
252
- return _context2.abrupt("return", pin({
253
- flowObj: defaultFlow,
254
- msisdn: internationalMSISDN
255
- }));
256
-
257
- case 16:
258
- case "end":
259
- return _context2.stop();
260
- }
261
- }
262
- }, _callee2, null, [[3, 12]]);
263
- }));
264
-
265
- return function pinMoAskMobileNumber(_x2) {
266
- return _ref9.apply(this, arguments);
267
- };
268
- }();
269
-
270
- exports.pinMoAskMobileNumber = pinMoAskMobileNumber;
271
-
272
- var askMobileNumber = /*#__PURE__*/function () {
273
- var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref10) {
274
- var configs;
275
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
276
- while (1) {
277
- switch (_context3.prev = _context3.next) {
278
- case 0:
279
- configs = _ref10.configs;
280
- return _context3.abrupt("return", {
281
- type: _identifySlice.StrategyStates.IDENTIFY_FLOW_BY_MSISDN,
282
- result: RDS.NothingYet()
283
- });
284
-
285
- case 2:
286
- case "end":
287
- return _context3.stop();
288
- }
289
- }
290
- }, _callee3);
291
- }));
292
-
293
- return function askMobileNumber(_x3) {
294
- return _ref11.apply(this, arguments);
295
- };
296
- }();
297
-
298
- exports.askMobileNumber = askMobileNumber;
299
- var identifySubmitMSISDNAction = (0, _toolkit.createAsyncThunk)('strategy/submitMSISDNAction',
300
- /*#__PURE__*/
301
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
302
- // @ts-ignore
303
- function () {
304
- var _ref12 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(payload, thunkApi) {
305
- var configs, strategy, internationalMSISDN, flowObj, errorType;
306
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
307
- while (1) {
308
- switch (_context4.prev = _context4.next) {
309
- case 0:
310
- configs = payload.configs || (0, _utils.getConfig)();
311
- strategy = configs.strategy;
312
- internationalMSISDN = payload.internationalMSISDN;
313
- _context4.prev = 3;
314
- _context4.next = 6;
315
- return (0, _utils.determineFlowByMsidn)({
316
- internationalMSISDN: internationalMSISDN,
317
- configs: configs
318
- });
319
-
320
- case 6:
321
- flowObj = _context4.sent;
322
- _context4.t0 = strategy;
323
- _context4.next = _context4.t0 === 'pin-mo-redir-ask-mobile-number' ? 10 : _context4.t0 === 'pin-mo-ask-mobile-number' ? 13 : 16;
324
- break;
325
-
326
- case 10:
327
- _context4.next = 12;
328
- return pinMoRedirAskMobileNumber({
329
- configs: configs,
330
- flowObj: flowObj,
331
- internationalMSISDN: internationalMSISDN
332
- });
333
-
334
- case 12:
335
- return _context4.abrupt("return", _context4.sent);
336
-
337
- case 13:
338
- _context4.next = 15;
339
- return pinMoAskMobileNumber({
340
- configs: configs,
341
- flowObj: flowObj,
342
- internationalMSISDN: internationalMSISDN
343
- });
344
-
345
- case 15:
346
- return _context4.abrupt("return", _context4.sent);
347
-
348
- case 16:
349
- console.error('identifySubmitMSISDNAction', 'Strategy not supported');
350
- return _context4.abrupt("return", thunkApi.rejectWithValue({
351
- type: _identifySlice.StrategyStates.IDENTIFY_FLOW_BY_MSISDN,
352
- result: RDS.Failure({
353
- errorType: 'UnknownError',
354
- error: 'Strategy Not Supported'
355
- })
356
- }));
357
-
358
- case 18:
359
- _context4.next = 25;
360
- break;
361
-
362
- case 20:
363
- _context4.prev = 20;
364
- _context4.t1 = _context4["catch"](3);
365
- console.error('identifySubmitMSISDNAction', JSON.stringify(_context4.t1));
366
- errorType = // eslint-disable-next-line no-nested-ternary
367
- _context4.t1.type === 'SEAlreadySubscribed' ? 'AlreadySubscribed' : _context4.t1.type == 'SEInvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
368
- return _context4.abrupt("return", thunkApi.rejectWithValue({
369
- type: _identifySlice.StrategyStates.IDENTIFY_FLOW_BY_MSISDN,
370
- result: RDS.Failure({
371
- errorType: errorType,
372
- error: _context4.t1
373
- })
374
- }));
375
-
376
- case 25:
377
- case "end":
378
- return _context4.stop();
379
- }
380
- }
381
- }, _callee4, null, [[3, 20]]);
382
- }));
383
-
384
- return function (_x4, _x5) {
385
- return _ref12.apply(this, arguments);
386
- };
387
- }());
388
- exports.identifySubmitMSISDNAction = identifySubmitMSISDNAction;