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,23 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- function tpayHeFlowMatch(_ref) {
9
- var loadTpay = _ref.loadTpay,
10
- confirmTpay = _ref.confirmTpay;
11
- return function (state) {
12
- switch (state.type) {
13
- case 'LOAD_TPAY_HE':
14
- return loadTpay(state.result);
15
-
16
- case 'CONFIRM_TPAY':
17
- return confirmTpay(state.result);
18
- }
19
- };
20
- }
21
-
22
- var _default = tpayHeFlowMatch;
23
- exports.default = _default;
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol");
4
-
5
- require("core-js/modules/es.symbol.description");
6
-
7
- require("core-js/modules/es.symbol.iterator");
8
-
9
- require("core-js/modules/es.array.from");
10
-
11
- require("core-js/modules/es.array.iterator");
12
-
13
- require("core-js/modules/es.array.slice");
14
-
15
- require("core-js/modules/es.function.name");
16
-
17
- require("core-js/modules/es.object.to-string");
18
-
19
- require("core-js/modules/es.regexp.to-string");
20
-
21
- require("core-js/modules/es.string.iterator");
22
-
23
- require("core-js/modules/web.dom-collections.iterator");
24
-
25
- Object.defineProperty(exports, "__esModule", {
26
- value: true
27
- });
28
- exports.worker = void 0;
29
-
30
- var _msw = require("msw");
31
-
32
- var _handlers = require("./handlers");
33
-
34
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
35
-
36
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
37
-
38
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
39
-
40
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
41
-
42
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
43
-
44
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
45
-
46
- var worker = _msw.setupWorker.apply(void 0, _toConsumableArray(_handlers.handlers));
47
-
48
- exports.worker = worker;
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.handlers = void 0;
7
-
8
- var _msw = require("msw");
9
-
10
- var handlers = [_msw.rest.get('http://127.0.0.1:8080/sockjs-node/info/*', function (_, res, ctx) {
11
- return res(ctx.json({
12
- websocket: true,
13
- origins: ['*:*'],
14
- cookie_needed: false,
15
- entropy: 1975621412
16
- }));
17
- }), _msw.rest.get('https://stats.g.doubleclick.net/j/collect/*', function (_, res, ctx) {
18
- return res(ctx.json({}));
19
- }), _msw.rest.get('https://de-pacman.analytickz.com/api/v2/mstore/*', function (_, res, ctx) {
20
- return res(ctx.json({}));
21
- })];
22
- exports.handlers = handlers;
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol");
4
-
5
- require("core-js/modules/es.symbol.description");
6
-
7
- require("core-js/modules/es.symbol.iterator");
8
-
9
- require("core-js/modules/es.array.from");
10
-
11
- require("core-js/modules/es.array.iterator");
12
-
13
- require("core-js/modules/es.array.slice");
14
-
15
- require("core-js/modules/es.function.name");
16
-
17
- require("core-js/modules/es.object.to-string");
18
-
19
- require("core-js/modules/es.regexp.to-string");
20
-
21
- require("core-js/modules/es.string.iterator");
22
-
23
- require("core-js/modules/web.dom-collections.iterator");
24
-
25
- Object.defineProperty(exports, "__esModule", {
26
- value: true
27
- });
28
- exports.server = void 0;
29
-
30
- var _node = require("msw/node");
31
-
32
- var _handlers = require("./handlers");
33
-
34
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
35
-
36
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
37
-
38
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
39
-
40
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
41
-
42
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
43
-
44
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
45
-
46
- var server = _node.setupServer.apply(void 0, _toConsumableArray(_handlers.handlers));
47
-
48
- exports.server = server;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,331 +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.iterator");
12
-
13
- require("core-js/modules/es.object.get-own-property-descriptor");
14
-
15
- require("core-js/modules/es.object.to-string");
16
-
17
- require("core-js/modules/es.promise");
18
-
19
- require("core-js/modules/es.string.iterator");
20
-
21
- require("core-js/modules/es.weak-map");
22
-
23
- require("core-js/modules/web.dom-collections.iterator");
24
-
25
- Object.defineProperty(exports, "__esModule", {
26
- value: true
27
- });
28
- exports.loadTpayAction = loadTpayAction;
29
- exports.confirmTpayAction = confirmTpayAction;
30
- exports.mockTpayFlow = mockTpayFlow;
31
- exports.default = TpayHeFlowReducer;
32
- exports.TpayHeFlowFlowActionMaps = void 0;
33
-
34
- require("regenerator-runtime/runtime");
35
-
36
- var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
37
-
38
- var _utils = require("./utils");
39
-
40
- var _strategy = require("../strategy");
41
-
42
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
43
-
44
- 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; }
45
-
46
- 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); } }
47
-
48
- 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); }); }; }
49
-
50
- //ACTION CREATORS
51
- function loadTpayAction(theme, locale) {
52
- return /*#__PURE__*/function () {
53
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(dispatch, store) {
54
- var currentState, config, product_url, result, errorType;
55
- return regeneratorRuntime.wrap(function _callee$(_context) {
56
- while (1) {
57
- switch (_context.prev = _context.next) {
58
- case 0:
59
- currentState = store().strategy.currentState;
60
-
61
- if (!(currentState.type === "TPAY_HE")) {
62
- _context.next = 28;
63
- break;
64
- }
65
-
66
- config = currentState.result.config;
67
- _context.prev = 3;
68
- _context.next = 6;
69
- return (0, _utils.confirmTPayCheck)();
70
-
71
- case 6:
72
- product_url = _context.sent;
73
-
74
- if (!(product_url !== null)) {
75
- _context.next = 11;
76
- break;
77
- }
78
-
79
- window.location.href = product_url;
80
- _context.next = 17;
81
- break;
82
-
83
- case 11:
84
- dispatch({
85
- type: "LOAD_TPAY_HE",
86
- payload: {
87
- type: "LOAD_TPAY_HE",
88
- result: RDS.Loading()
89
- }
90
- });
91
- _context.next = 14;
92
- return (0, _utils.getTpayConfig)(window, config);
93
-
94
- case 14:
95
- result = _context.sent;
96
-
97
- // await addLookUpTpay(result, theme, locale);
98
- _strategy.tracker.advancedInFlow('tallyman.v1-tpay-he', 'load-tpay-success');
99
-
100
- dispatch({
101
- type: "LOAD_TPAY_HE_SUCCESS",
102
- payload: {
103
- type: "LOAD_TPAY_HE",
104
- result: RDS.Success(result)
105
- }
106
- });
107
-
108
- case 17:
109
- _context.next = 26;
110
- break;
111
-
112
- case 19:
113
- _context.prev = 19;
114
- _context.t0 = _context["catch"](3);
115
- console.warn(_context.t0); //@ts-ignore
116
-
117
- errorType = "AlreadySubscribed" === _context.t0.type ? "AlreadySubscribed" : "NotSupported" === _context.t0.type ? "NotSupported" : "SubscriptionFailed" === _context.t0.type ? "SubscriptionFailed" : "UnknownError";
118
-
119
- _strategy.tracker.recedeInFlow('tallyman.v1-tpay-he', 'tpay-config-failure', {
120
- errorType: errorType || 'UnknownError'
121
- });
122
-
123
- dispatch({
124
- type: "LOAD_TPAY_HE",
125
- payload: {
126
- type: "LOAD_TPAY_HE",
127
- result: RDS.Failure({
128
- errorType: errorType,
129
- error: _context.t0
130
- })
131
- }
132
- });
133
- dispatch({
134
- type: "IDENTIFY_STRATEGY",
135
- payload: {
136
- type: "PIN",
137
- result: {
138
- nextAction: "submitMSISDNAction",
139
- config: config
140
- }
141
- }
142
- });
143
-
144
- case 26:
145
- _context.next = 31;
146
- break;
147
-
148
- case 28:
149
- _strategy.tracker.recedeInFlow('tallyman.v1-tpay-he', 'tpay-config-failure', {
150
- errorType: 'UnknownError'
151
- });
152
-
153
- dispatch({
154
- type: "LOAD_TPAY_HE",
155
- payload: {
156
- type: "LOAD_TPAY_HE",
157
- result: RDS.Failure({
158
- errorType: "UnexpectedState"
159
- })
160
- }
161
- });
162
- throw "Unexpected state";
163
-
164
- case 31:
165
- case "end":
166
- return _context.stop();
167
- }
168
- }
169
- }, _callee, null, [[3, 19]]);
170
- }));
171
-
172
- return function (_x, _x2) {
173
- return _ref.apply(this, arguments);
174
- };
175
- }();
176
- }
177
-
178
- function confirmTpayAction(locale, redirectUrl) {
179
- return /*#__PURE__*/function () {
180
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(dispatch, store) {
181
- var currentState, tpayConfig, result, errorType;
182
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
183
- while (1) {
184
- switch (_context2.prev = _context2.next) {
185
- case 0:
186
- _context2.prev = 0;
187
- dispatch({
188
- type: "CONFIRM_TPAY_CLICK",
189
- payload: {
190
- type: "CONFIRM_TPAY",
191
- result: RDS.Loading()
192
- }
193
- });
194
-
195
- _strategy.tracker.advancedInFlow('tallyman.v1-tpay-he', 'confirm-tpay-clicked', {});
196
-
197
- currentState = store().strategy.currentState;
198
-
199
- if (!(currentState.type === "TPAY_HE")) {
200
- _context2.next = 13;
201
- break;
202
- }
203
-
204
- tpayConfig = store().tpayHeFlow.tpayConfig; //@ts-ignore
205
-
206
- _context2.next = 8;
207
- return (0, _utils.confirmTPay)(window, tpayConfig, locale, redirectUrl);
208
-
209
- case 8:
210
- result = _context2.sent;
211
-
212
- _strategy.tracker.advancedInFlow('tallyman.v1-tpay-he', 'confirm-tpay-success', {
213
- finalUrl: result
214
- });
215
-
216
- dispatch({
217
- type: "CONFIRM_TPAY_CLICK",
218
- payload: {
219
- type: "CONFIRM_TPAY",
220
- result: RDS.Success({
221
- finalUrl: ""
222
- })
223
- }
224
- });
225
- _context2.next = 16;
226
- break;
227
-
228
- case 13:
229
- _strategy.tracker.recedeInFlow('tallyman.v1-tpay-he', 'confirm-tpay-failure', {});
230
-
231
- dispatch({
232
- type: "CONFIRM_TPAY_CLICK",
233
- payload: {
234
- type: "CONFIRM_TPAY",
235
- result: RDS.Failure({
236
- errorType: "UnexpectedState"
237
- })
238
- }
239
- });
240
- throw "Unexpected state";
241
-
242
- case 16:
243
- _context2.next = 24;
244
- break;
245
-
246
- case 18:
247
- _context2.prev = 18;
248
- _context2.t0 = _context2["catch"](0);
249
- console.error(_context2.t0);
250
- errorType = "AlreadySubscribed" === _context2.t0.type ? "AlreadySubscribed" : "ConfirmError" === _context2.t0.type ? "ConfirmError" : "UnknownError";
251
-
252
- _strategy.tracker.recedeInFlow('tallyman.v1-tpay-he', 'confirm-tpay', {
253
- errorType: errorType || 'UnknownError'
254
- });
255
-
256
- dispatch({
257
- type: "CONFIRM_TPAY_CLICK",
258
- payload: {
259
- type: "CONFIRM_TPAY",
260
- result: RDS.Failure({
261
- errorType: errorType || 'UnknownError'
262
- })
263
- }
264
- });
265
-
266
- case 24:
267
- case "end":
268
- return _context2.stop();
269
- }
270
- }
271
- }, _callee2, null, [[0, 18]]);
272
- }));
273
-
274
- return function (_x3, _x4) {
275
- return _ref2.apply(this, arguments);
276
- };
277
- }();
278
- }
279
-
280
- function mockTpayFlow(mockState) {
281
- return function (dispatch) {
282
- if (mockState !== undefined) {
283
- switch (mockState) {
284
- case "confirm-state":
285
- return dispatch({
286
- type: "MOCK_TPAY_FLOW_STATE",
287
- payload: _utils.mockedConfirmState.currentState
288
- });
289
-
290
- default:
291
- throw "Mock Flow not supported";
292
- }
293
- }
294
- };
295
- }
296
-
297
- var initialState = {
298
- currentState: {
299
- type: "LOAD_TPAY_HE",
300
- result: RDS.NothingYet()
301
- },
302
- tpayConfig: null
303
- };
304
- var TpayHeFlowFlowActionMaps = {
305
- loadTpayAction: loadTpayAction
306
- };
307
- exports.TpayHeFlowFlowActionMaps = TpayHeFlowFlowActionMaps;
308
-
309
- function TpayHeFlowReducer() {
310
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
311
- var action = arguments.length > 1 ? arguments[1] : undefined;
312
-
313
- switch (action.type) {
314
- case "LOAD_TPAY_HE":
315
- return (0, _strategy.genericHandler)(state, action.payload);
316
-
317
- case "CONFIRM_TPAY_CLICK":
318
- //@ts-ignore
319
- return (0, _strategy.genericHandler)(state, action.payload);
320
-
321
- case "LOAD_TPAY_HE_SUCCESS":
322
- return (0, _strategy.genericHandler)(state, action.payload);
323
-
324
- case "MOCK_TPAY_FLOW_STATE":
325
- //@ts-ignore
326
- return handleMockFlow(state, action.payload);
327
-
328
- default:
329
- return state;
330
- }
331
- }