ouisys-engine 3.0.3 → 3.0.5

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 (195) hide show
  1. package/.babelrc +4 -8
  2. package/.eslintrc.js +1 -1
  3. package/.husky/pre-commit +4 -0
  4. package/.nvmrc +1 -1
  5. package/.prettierignore +2 -1
  6. package/.vscode/settings.json +1 -1
  7. package/README.md +2 -4
  8. package/dist/api/index.d.ts +5 -5
  9. package/dist/api/index.js +76 -76
  10. package/dist/common-types/AppThunk.d.ts +11 -12
  11. package/dist/common-types/IOptInFlowName.d.ts +1 -1
  12. package/dist/common-types/ITracker.js +1 -2
  13. package/dist/common-types/RemoteDataState.d.ts +4 -4
  14. package/dist/common-types/RemoteDataState.js +17 -17
  15. package/dist/flows/click2smsFlow.d.ts +2 -2
  16. package/dist/flows/moFlow.d.ts +2 -2
  17. package/dist/flows/moRedirFlow.d.ts +2 -2
  18. package/dist/flows/oneClickFlow.d.ts +2 -2
  19. package/dist/flows/pinFlow.d.ts +2 -2
  20. package/dist/flows/pinFlow.js +2 -0
  21. package/dist/flows/strategy.d.ts +8 -8
  22. package/dist/flows/ussdFlow.d.ts +2 -2
  23. package/dist/ips/tryGetIPRangeName.d.ts +1 -1
  24. package/dist/ips/tryGetIPRangeName.js +7 -5
  25. package/dist/jest.config.js +1 -1
  26. package/dist/pacman/index.d.ts +2 -2
  27. package/dist/pacman/index.js +41 -41
  28. package/dist/pacman/queryString.js +11 -9
  29. package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +19 -19
  30. package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +1 -1
  31. package/dist/reducers/click2smsFlow/index.d.ts +2 -2
  32. package/dist/reducers/click2smsFlow/index.js +24 -24
  33. package/dist/reducers/click2smsFlow/utils.d.ts +1 -1
  34. package/dist/reducers/click2smsFlow/utils.js +30 -30
  35. package/dist/reducers/moFlow/IMoConstants.d.ts +1 -1
  36. package/dist/reducers/moFlow/MoTypes.d.ts +13 -13
  37. package/dist/reducers/moFlow/index.d.ts +3 -3
  38. package/dist/reducers/moFlow/index.js +27 -27
  39. package/dist/reducers/moFlow/utils.d.ts +1 -2
  40. package/dist/reducers/moFlow/utils.js +28 -26
  41. package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +1 -1
  42. package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +13 -13
  43. package/dist/reducers/moRedirFlow/index.d.ts +3 -3
  44. package/dist/reducers/moRedirFlow/index.js +27 -27
  45. package/dist/reducers/moRedirFlow/utils.d.ts +1 -1
  46. package/dist/reducers/moRedirFlow/utils.js +17 -17
  47. package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +1 -1
  48. package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +10 -10
  49. package/dist/reducers/oneClickFlow/index.d.ts +3 -3
  50. package/dist/reducers/oneClickFlow/index.js +75 -68
  51. package/dist/reducers/oneClickFlow/utils.d.ts +2 -2
  52. package/dist/reducers/oneClickFlow/utils.js +38 -38
  53. package/dist/reducers/pinFlow/IPinConstants.d.ts +1 -1
  54. package/dist/reducers/pinFlow/PinTypes.d.ts +23 -23
  55. package/dist/reducers/pinFlow/index.d.ts +3 -3
  56. package/dist/reducers/pinFlow/index.js +76 -76
  57. package/dist/reducers/pinFlow/utils.d.ts +1 -1
  58. package/dist/reducers/pinFlow/utils.js +61 -65
  59. package/dist/reducers/strategy/IStategyActionContants.d.ts +1 -1
  60. package/dist/reducers/strategy/StrategyTypes.d.ts +56 -56
  61. package/dist/reducers/strategy/index.d.ts +2 -2
  62. package/dist/reducers/strategy/index.js +99 -99
  63. package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +2 -2
  64. package/dist/reducers/strategy/strategies/ask_mobile_number.js +78 -78
  65. package/dist/reducers/strategy/strategies/ask_operator.d.ts +2 -2
  66. package/dist/reducers/strategy/strategies/ask_operator.js +64 -68
  67. package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +2 -2
  68. package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +97 -97
  69. package/dist/reducers/strategy/strategies/header_enrichment.d.ts +2 -2
  70. package/dist/reducers/strategy/strategies/header_enrichment.js +116 -120
  71. package/dist/reducers/strategy/utils.d.ts +3 -3
  72. package/dist/reducers/strategy/utils.js +115 -111
  73. package/dist/reducers/ussdFlow/IUssdConstants.d.ts +1 -1
  74. package/dist/reducers/ussdFlow/UssdTypes.d.ts +13 -13
  75. package/dist/reducers/ussdFlow/index.d.ts +3 -3
  76. package/dist/reducers/ussdFlow/index.js +27 -27
  77. package/dist/reducers/ussdFlow/utils.d.ts +1 -2
  78. package/dist/reducers/ussdFlow/utils.js +19 -17
  79. package/dist/store/index.d.ts +8 -8
  80. package/dist/store/index.js +87 -83
  81. package/dist/store/reducers.d.ts +7 -7
  82. package/dist/store/reducers.js +4 -4
  83. package/dist/utilities/handleSubmitNumber.d.ts +7 -3
  84. package/dist/utilities/handleSubmitNumber.js +15 -18
  85. package/dist/utilities/index.d.ts +1 -1
  86. package/dist/utilities/index.js +13 -11
  87. package/dist/utilities/loadScriptInnerHtml.js +0 -1
  88. package/index.html +21 -28
  89. package/mockData/config.json +1 -1
  90. package/package.json +23 -15
  91. package/setupJest.js +1 -1
  92. package/tsconfig.json +2 -2
  93. package/dist/api/click2sms.js +0 -357
  94. package/dist/api/mo.js +0 -274
  95. package/dist/api/moRedir.js +0 -186
  96. package/dist/api/oneClick.js +0 -366
  97. package/dist/api/pin.js +0 -493
  98. package/dist/api/strategies.js +0 -704
  99. package/dist/api/ussd.js +0 -1
  100. package/dist/app/store.js +0 -35
  101. package/dist/features/strategies/categories/askMobileNumber.js +0 -395
  102. package/dist/features/strategies/categories/askOperator.js +0 -311
  103. package/dist/features/strategies/categories/detectOperatorByIp.js +0 -606
  104. package/dist/features/strategies/categories/headerEnrichment.js +0 -670
  105. package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +0 -12
  106. package/dist/features/strategies/categories/typings/identifySliceTypes.js +0 -22
  107. package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +0 -22
  108. package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +0 -21
  109. package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +0 -13
  110. package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +0 -13
  111. package/dist/features/strategies/click2smsFlowSlice.js +0 -172
  112. package/dist/features/strategies/identifySlice.js +0 -455
  113. package/dist/features/strategies/moFlowSlice.js +0 -196
  114. package/dist/features/strategies/moRedirFlowSlice.js +0 -190
  115. package/dist/features/strategies/oneClickFlowSlice.js +0 -277
  116. package/dist/features/strategies/pinFlowSlice.js +0 -313
  117. package/dist/features/strategies/ussdFlowSlice.js +0 -1
  118. package/dist/flows/tpayHeFlow.d.ts +0 -7
  119. package/dist/flows/tpayHeFlow.js +0 -23
  120. package/dist/mockServer/browser.js +0 -48
  121. package/dist/mockServer/handlers.js +0 -22
  122. package/dist/mockServer/server.js +0 -48
  123. package/dist/reducers/tpayHeFlow/ITpayHeConstants.d.ts +0 -2
  124. package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
  125. package/dist/reducers/tpayHeFlow/TpayHeTypes.d.ts +0 -114
  126. package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
  127. package/dist/reducers/tpayHeFlow/index.d.ts +0 -7
  128. package/dist/reducers/tpayHeFlow/index.js +0 -331
  129. package/dist/reducers/tpayHeFlow/utils.d.ts +0 -20
  130. package/dist/reducers/tpayHeFlow/utils.js +0 -510
  131. package/dist/test/setup.js +0 -24
  132. package/dist/test/test-utils.js +0 -51
  133. package/prettier.config.js +0 -7
  134. package/src/@types/react-tracker.d.ts +0 -16
  135. package/src/@types/redux-cli-logger.d.ts +0 -1
  136. package/src/@types/tiny-async-pool.d.ts +0 -3
  137. package/src/@types/window.d.ts +0 -74
  138. package/src/api/index.ts +0 -225
  139. package/src/common-types/AppThunk.ts +0 -19
  140. package/src/common-types/Either.ts +0 -3
  141. package/src/common-types/IError.ts +0 -5
  142. package/src/common-types/IOptInFlowName.ts +0 -1
  143. package/src/common-types/ITracker.ts +0 -10
  144. package/src/common-types/IVisitor.ts +0 -16
  145. package/src/common-types/RemoteDataState.ts +0 -88
  146. package/src/flows/click2smsFlow.ts +0 -18
  147. package/src/flows/moFlow.ts +0 -20
  148. package/src/flows/moRedirFlow.ts +0 -20
  149. package/src/flows/oneClickFlow.ts +0 -20
  150. package/src/flows/pinFlow.ts +0 -25
  151. package/src/flows/strategy.ts +0 -51
  152. package/src/flows/ussdFlow.ts +0 -20
  153. package/src/index.ts +0 -3
  154. package/src/ips/tryGetIPRangeName.ts +0 -22
  155. package/src/jest.config.js +0 -194
  156. package/src/pacman/index.ts +0 -71
  157. package/src/pacman/queryString.ts +0 -24
  158. package/src/reducers/click2smsFlow/Click2smsTypes.ts +0 -93
  159. package/src/reducers/click2smsFlow/IClick2smsConstants.ts +0 -4
  160. package/src/reducers/click2smsFlow/index.ts +0 -105
  161. package/src/reducers/click2smsFlow/utils.ts +0 -126
  162. package/src/reducers/moFlow/IMoConstants.ts +0 -7
  163. package/src/reducers/moFlow/MoTypes.ts +0 -125
  164. package/src/reducers/moFlow/index.ts +0 -150
  165. package/src/reducers/moFlow/utils.ts +0 -135
  166. package/src/reducers/moRedirFlow/IMoRedirConstants.ts +0 -7
  167. package/src/reducers/moRedirFlow/MoRedirTypes.ts +0 -99
  168. package/src/reducers/moRedirFlow/index.ts +0 -137
  169. package/src/reducers/moRedirFlow/utils.ts +0 -78
  170. package/src/reducers/oneClickFlow/IOneClickConstants.ts +0 -3
  171. package/src/reducers/oneClickFlow/OneClickTypes.ts +0 -108
  172. package/src/reducers/oneClickFlow/index.ts +0 -268
  173. package/src/reducers/oneClickFlow/utils.ts +0 -219
  174. package/src/reducers/pinFlow/IPinConstants.ts +0 -9
  175. package/src/reducers/pinFlow/PinTypes.ts +0 -190
  176. package/src/reducers/pinFlow/index.ts +0 -331
  177. package/src/reducers/pinFlow/utils.ts +0 -232
  178. package/src/reducers/strategy/IStategyActionContants.ts +0 -17
  179. package/src/reducers/strategy/StrategyTypes.ts +0 -376
  180. package/src/reducers/strategy/index.ts +0 -322
  181. package/src/reducers/strategy/strategies/ask_mobile_number.ts +0 -366
  182. package/src/reducers/strategy/strategies/ask_operator.ts +0 -195
  183. package/src/reducers/strategy/strategies/detect_operator_by_ip.ts +0 -414
  184. package/src/reducers/strategy/strategies/header_enrichment.ts +0 -489
  185. package/src/reducers/strategy/utils.ts +0 -357
  186. package/src/reducers/ussdFlow/IUssdConstants.ts +0 -7
  187. package/src/reducers/ussdFlow/UssdTypes.ts +0 -112
  188. package/src/reducers/ussdFlow/index.ts +0 -146
  189. package/src/reducers/ussdFlow/utils.ts +0 -88
  190. package/src/store/index.ts +0 -150
  191. package/src/store/reducers.ts +0 -37
  192. package/src/utilities/handleSubmitNumber.ts +0 -65
  193. package/src/utilities/index.ts +0 -114
  194. package/src/utilities/loadScriptInnerHtml.ts +0 -14
  195. package/src/utilities/loadScriptSrc.ts +0 -26
@@ -1,510 +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.concat");
12
-
13
- require("core-js/modules/es.array.from");
14
-
15
- require("core-js/modules/es.array.iterator");
16
-
17
- require("core-js/modules/es.array.join");
18
-
19
- require("core-js/modules/es.array.map");
20
-
21
- require("core-js/modules/es.array.slice");
22
-
23
- require("core-js/modules/es.function.name");
24
-
25
- require("core-js/modules/es.object.get-own-property-descriptor");
26
-
27
- require("core-js/modules/es.object.to-string");
28
-
29
- require("core-js/modules/es.promise");
30
-
31
- require("core-js/modules/es.regexp.exec");
32
-
33
- require("core-js/modules/es.regexp.to-string");
34
-
35
- require("core-js/modules/es.string.iterator");
36
-
37
- require("core-js/modules/es.string.replace");
38
-
39
- require("core-js/modules/es.string.search");
40
-
41
- require("core-js/modules/es.weak-map");
42
-
43
- require("core-js/modules/web.dom-collections.iterator");
44
-
45
- Object.defineProperty(exports, "__esModule", {
46
- value: true
47
- });
48
- exports.mockedConfirmState = exports.confirmTPay = exports.confirmTPayCheck = exports.getTpayConfig = exports.default = exports.additionalQueryString = void 0;
49
-
50
- require("regenerator-runtime/runtime");
51
-
52
- var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
53
-
54
- var _utils = require("../strategy/utils");
55
-
56
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
57
-
58
- 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; }
59
-
60
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
61
-
62
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
63
-
64
- 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); }
65
-
66
- 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; }
67
-
68
- function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
69
-
70
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
71
-
72
- 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); } }
73
-
74
- 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); }); }; }
75
-
76
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
77
-
78
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
79
-
80
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
81
-
82
- 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; }
83
-
84
- var additionalQueryString = "msisdnSubmitted=Y&legalCheckbox=Y&incentivizedCheckbox=Y&op_confirmCheckbox=N";
85
- exports.additionalQueryString = additionalQueryString;
86
-
87
- var ScriptLoader = /*#__PURE__*/function () {
88
- function ScriptLoader(options) {
89
- _classCallCheck(this, ScriptLoader);
90
-
91
- _defineProperty(this, "src", void 0);
92
-
93
- _defineProperty(this, "global", void 0);
94
-
95
- _defineProperty(this, "protocol", void 0);
96
-
97
- _defineProperty(this, "isLoaded", void 0);
98
-
99
- var src = options.src,
100
- global = options.global,
101
- _options$protocol = options.protocol,
102
- protocol = _options$protocol === void 0 ? document.location.protocol : _options$protocol;
103
- this.src = src;
104
- this.global = global;
105
- this.protocol = protocol;
106
- this.isLoaded = false;
107
- }
108
-
109
- _createClass(ScriptLoader, [{
110
- key: "loadScript",
111
- value: function loadScript() {
112
- var _this = this;
113
-
114
- return new Promise(function (resolve, reject) {
115
- // Create script element and set attributes
116
- var script = document.createElement('script');
117
- script.type = 'text/javascript';
118
- script.async = true;
119
- script.src = "".concat(_this.protocol, "//").concat(_this.src); // Append the script to the DOM
120
-
121
- var el = document.getElementsByTagName('script')[0];
122
- el.parentNode.insertBefore(script, el); // Resolve the promise once the script is loaded
123
-
124
- script.addEventListener('load', function () {
125
- _this.isLoaded = true;
126
- resolve(script);
127
- }); // Catch any errors while loading the script
128
-
129
- script.addEventListener('error', function () {
130
- reject(new Error("".concat(_this.src, " failed to load.")));
131
- });
132
- });
133
- }
134
- }, {
135
- key: "load",
136
- value: function load() {
137
- var _this2 = this;
138
-
139
- return new Promise( /*#__PURE__*/function () {
140
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(resolve, reject) {
141
- return regeneratorRuntime.wrap(function _callee$(_context) {
142
- while (1) {
143
- switch (_context.prev = _context.next) {
144
- case 0:
145
- if (_this2.isLoaded) {
146
- _context.next = 12;
147
- break;
148
- }
149
-
150
- _context.prev = 1;
151
- _context.next = 4;
152
- return _this2.loadScript();
153
-
154
- case 4:
155
- //@ts-ignore
156
- resolve(window[_this2.global]);
157
- _context.next = 10;
158
- break;
159
-
160
- case 7:
161
- _context.prev = 7;
162
- _context.t0 = _context["catch"](1);
163
- reject(_context.t0);
164
-
165
- case 10:
166
- _context.next = 13;
167
- break;
168
-
169
- case 12:
170
- //@ts-ignore
171
- resolve(window[_this2.global]);
172
-
173
- case 13:
174
- case "end":
175
- return _context.stop();
176
- }
177
- }
178
- }, _callee, null, [[1, 7]]);
179
- }));
180
-
181
- return function (_x, _x2) {
182
- return _ref.apply(this, arguments);
183
- };
184
- }());
185
- }
186
- }]);
187
-
188
- return ScriptLoader;
189
- }();
190
-
191
- exports.default = ScriptLoader;
192
-
193
- var getTpayConfig = /*#__PURE__*/function () {
194
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(window, maybeConfig) {
195
- var host, country, slug, queryString, device, offer, s, search, rockmanId, result, error;
196
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
197
- while (1) {
198
- switch (_context2.prev = _context2.next) {
199
- case 0:
200
- if (!(typeof window == "undefined")) {
201
- _context2.next = 4;
202
- break;
203
- }
204
-
205
- throw "javascript: console.error('SSR'); void 6";
206
-
207
- case 4:
208
- host = maybeConfig.host, country = maybeConfig.country, slug = maybeConfig.slug, queryString = maybeConfig.queryString, device = maybeConfig.device;
209
- offer = window.pac_analytics.visitor.offer;
210
- s = window.location.search.substr(1);
211
- search = (!!s && s.length > 0 ? [s] : []).concat((queryString || []).map(function (_ref3) {
212
- var _ref4 = _slicedToArray(_ref3, 2),
213
- k = _ref4[0],
214
- v = _ref4[1];
215
-
216
- return "".concat(k, "=").concat(v);
217
- })).join('&');
218
- rockmanId = window.pac_analytics.visitor.rockmanId;
219
- _context2.next = 11;
220
- return window.tallymanApi.tpayConsentConfig(host, country, slug, device, offer, rockmanId, search);
221
-
222
- case 11:
223
- result = _context2.sent;
224
-
225
- if (!(false == result.success)) {
226
- _context2.next = 19;
227
- break;
228
- }
229
-
230
- error = new Error("Error in getTpayConfig() tpay-consent-config action:\n".concat(result.message));
231
- error['type'] = result.message == 'ALREADY SUBSCRIBED' ? "AlreadySubscribed" : "NotSupported";
232
- console.error(error);
233
- throw error;
234
-
235
- case 19:
236
- return _context2.abrupt("return", result);
237
-
238
- case 20:
239
- case "end":
240
- return _context2.stop();
241
- }
242
- }
243
- }, _callee2);
244
- }));
245
-
246
- return function getTpayConfig(_x3, _x4) {
247
- return _ref2.apply(this, arguments);
248
- };
249
- }(); // export const addLookUpTpay = async(tpayConfig:ITpayConsentResult, theme?:string, locale?:string):Promise<boolean>=>{
250
- // if(tpayConfig.success != false){
251
- // const { config } = tpayConfig;
252
- // const s = document.createElement("script");
253
- // const currentDate = moment().utc().format()
254
- // const digest = ()=>{
255
- // const d = currentDate + locale + theme;
256
- // const hash = HmacSHA256(d, config.private);
257
- // window.tPayhash = hash.toString();
258
- // const base64 = config.public + ":" + hash.toString();
259
- // return base64
260
- // }
261
- // try{
262
- // const loader = new ScriptLoader({
263
- // src: `lookup.tpay.me/idxml.ashx/js?date=${currentDate}&lang=${locale}&theme=${theme}&digest=${digest()}`,
264
- // global: 'TPay'
265
- // });
266
- // await loader.load();
267
- // const operatorCode = window.TPay.HeaderEnrichment.operatorCode();
268
- // console.log("operatorCode", operatorCode)
269
- // if(operatorCode != ""){
270
- // return true;
271
- // }else{
272
- // const error = new Error(`Error in addLookUpTpay() :\n MSISDN Not Detected!`) as IError & {type:string;}
273
- // error['type'] = "3GConnectionError";
274
- // console.error(error)
275
- // throw error
276
- // }
277
- // }catch(err){
278
- // const error = new Error(`Error in addLookUpTpay() :\n Failed To Load Script ${JSON.stringify(err)}`) as IError & {type:string;}
279
- // error['type'] = "InvalidConfig";
280
- // console.error(error)
281
- // throw error
282
- // }
283
- // }else{
284
- // return false;
285
- // }
286
- // }
287
-
288
-
289
- exports.getTpayConfig = getTpayConfig;
290
-
291
- var subscribe = /*#__PURE__*/function () {
292
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(url) {
293
- var result, subscribeError;
294
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
295
- while (1) {
296
- switch (_context3.prev = _context3.next) {
297
- case 0:
298
- _context3.next = 2;
299
- return fetch(url).then(function (x) {
300
- return x.json();
301
- });
302
-
303
- case 2:
304
- result = _context3.sent;
305
-
306
- if (!(false === result.success)) {
307
- _context3.next = 9;
308
- break;
309
- }
310
-
311
- subscribeError = new Error("Error in subscribe() one-click-subscribe action:\n".concat(result.message));
312
- subscribeError['type'] = "SubscriptionError";
313
- throw subscribeError;
314
-
315
- case 9:
316
- return _context3.abrupt("return", result.product_url);
317
-
318
- case 10:
319
- case "end":
320
- return _context3.stop();
321
- }
322
- }
323
- }, _callee3);
324
- }));
325
-
326
- return function subscribe(_x5) {
327
- return _ref5.apply(this, arguments);
328
- };
329
- }();
330
-
331
- var confirmTPayCheck = /*#__PURE__*/function () {
332
- var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
333
- var search, Msisdn, SessionToken, ReferenceCode, Status, Details, subscription_url, _url, product_url, error;
334
-
335
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
336
- while (1) {
337
- switch (_context4.prev = _context4.next) {
338
- case 0:
339
- search = (0, _utils.searchToObject)();
340
- _context4.prev = 1;
341
-
342
- if (!search) {
343
- _context4.next = 12;
344
- break;
345
- }
346
-
347
- if (!(search["Status"] == "Error")) {
348
- _context4.next = 5;
349
- break;
350
- }
351
-
352
- throw search["Details"];
353
-
354
- case 5:
355
- if (!(search["Status"] == "Success")) {
356
- _context4.next = 12;
357
- break;
358
- }
359
-
360
- Msisdn = search.Msisdn, SessionToken = search.SessionToken, ReferenceCode = search.ReferenceCode, Status = search.Status, Details = search.Details, subscription_url = search.subscription_url;
361
- _url = "".concat(decodeURIComponent(subscription_url), "&msisdn=").concat(Msisdn, "&tpaySessionToken=").concat(SessionToken, "&heReferenceCode=").concat(ReferenceCode, "&heStatus=").concat(Status, "&heErrorDetails=").concat(Details);
362
- _context4.next = 10;
363
- return subscribe(_url);
364
-
365
- case 10:
366
- product_url = _context4.sent;
367
- return _context4.abrupt("return", product_url.replace('<%LANG%>', search.language_code));
368
-
369
- case 12:
370
- return _context4.abrupt("return", null);
371
-
372
- case 15:
373
- _context4.prev = 15;
374
- _context4.t0 = _context4["catch"](1);
375
- error = new Error("Error in confirmTPayCheck() :\n ".concat(JSON.stringify(search)));
376
- error['type'] = "SubscriptionFailed";
377
- console.error(error);
378
- throw error;
379
-
380
- case 21:
381
- case "end":
382
- return _context4.stop();
383
- }
384
- }
385
- }, _callee4, null, [[1, 15]]);
386
- }));
387
-
388
- return function confirmTPayCheck() {
389
- return _ref6.apply(this, arguments);
390
- };
391
- }();
392
-
393
- exports.confirmTPayCheck = confirmTPayCheck;
394
-
395
- var confirmTPay = function confirmTPay(window, tpayConfig, locale, redirectUrl) {
396
- //@ts-ignore
397
- if (typeof window.browser == "undefined") {
398
- //@ts-ignore
399
- window.browser = window.chrome;
400
- }
401
-
402
- if (tpayConfig == null || tpayConfig.success != true) {
403
- var error = new Error("Error in confirmTPay() TPay.HeaderEnrichment");
404
- error['type'] = "InvalidConfig";
405
- console.error(error);
406
- throw error;
407
- }
408
-
409
- var config = tpayConfig.config,
410
- prodSku = tpayConfig.prodSku;
411
- var operatorCode = window.TPay.HeaderEnrichment.operatorCode();
412
- var sessionId = window.TPay.HeaderEnrichment.sessionId();
413
- var catName = config["catalog_name"][operatorCode];
414
- var subscriptionPlanId = config["subscription_plan_id"];
415
- var lang = locale;
416
- var rockmanId = window.pac_analytics.visitor.rockmanId;
417
- var operatorFQN = 'EG_ORANGE';
418
-
419
- if (operatorCode == 60202) {
420
- operatorFQN = 'EG_VODAFONE';
421
- } else if (operatorCode == 60303) {
422
- operatorFQN = 'DZ_OOREDOO';
423
- }
424
-
425
- console.log("operatorFQN", operatorFQN);
426
- var availableRdrl = redirectUrl ? redirectUrl : window.location.origin + window.location.pathname;
427
- var rUrl = "".concat(availableRdrl, "?subscription_url=").concat(encodeURIComponent("".concat(tpayConfig.subscription_url, "operator=").concat(operatorFQN, "&language_code=").concat(locale)), "&rockman_id=").concat(rockmanId, "&language_code=").concat(locale, "&");
428
- console.log("Redirect url", rUrl);
429
- var hash = window.tPayhash;
430
- console.log("Operator Code: " + operatorCode);
431
- console.log("Session Id: " + sessionId);
432
- console.log("Product Catalog: " + catName);
433
- console.log("Subscription Plan :" + subscriptionPlanId);
434
- window.TPay.HeaderEnrichment.hasSubscription(prodSku, function (hasSub, subId) {
435
- if (hasSub) {
436
- console.log("hasSubscription"); // User has already a subscription, go to returnSubscription
437
-
438
- console.log('User is already subscribed');
439
- var productUrl = config['product_url'];
440
-
441
- if (config["replace_uid"] != undefined && config['replace_uid'] == true) {
442
- console.log('sub id ' + subId);
443
- productUrl = config['product_full_access'];
444
- fetch("http://de.tallymans.com/api/v2/validate-access/?domain=".concat(config.domain, "&sub_id=").concat(subId, "&country=").concat(tpayConfig.country, "&gateway=tpay")).then(function (response) {
445
- if (response.payload.token) {
446
- productUrl = config['product_url'].replace('<%UID%>', response.payload.token);
447
- }
448
- }).catch(function (err) {
449
- console.warn('validate-access' + err);
450
- });
451
- }
452
-
453
- console.log("productUrl", productUrl);
454
- setTimeout(function () {
455
- window.location.href = productUrl;
456
- }, 1000);
457
- console.log("productUrl", productUrl);
458
-
459
- var _error = new Error("Error in confirmTPay() TPay.HeaderEnrichment.hasSubscription action:\n".concat('ALREADY SUBSCRIBED'));
460
-
461
- _error['type'] = "AlreadySubscribed";
462
- _error['productUrl'] = productUrl;
463
- console.error(_error);
464
- throw _error;
465
- } else {
466
- console.log("NOT ACTIVE");
467
-
468
- if (config.flow != "consent") {
469
- try {
470
- //@ts-ignore
471
- window.TPay.HeaderEnrichment.confirm(subscriptionPlanId, catName, prodSku, sessionId, rUrl, rockmanId, lang, hash);
472
- } catch (err) {
473
- var _error2 = new Error("Error in confirmTPay() TPay.HeaderEnrichment.confirm action:\n".concat(JSON.stringify(err)));
474
-
475
- _error2['type'] = "ConfirmError";
476
- console.error(_error2);
477
- }
478
- } else {
479
- // user is not active subscriber, proceed with subscription(redirect to tpay pin page)
480
- try {
481
- window.TPay.HeaderEnrichment.consent(subscriptionPlanId, catName, prodSku, sessionId, rUrl, rockmanId, lang, hash);
482
- } catch (err) {
483
- var _error3 = new Error("Error in confirmTPay() TPay.HeaderEnrichment.consent action:\n".concat(JSON.stringify(err)));
484
-
485
- _error3['type'] = "ConfirmError";
486
- console.error(_error3);
487
- }
488
- }
489
- }
490
- });
491
- }; // export const mockedSuccessState : IOneClickCurrentState = {
492
- // type: "LOAD_TPAY_HE",
493
- // result: RDS.Success<ILOADTPAYFailure, ILOADTPAYSuccess>({
494
- // redirectUrl: 'https://www.yahoo.com/',
495
- // nextAction:"getRedirectUrlAction"
496
- // })
497
- // }
498
-
499
-
500
- exports.confirmTPay = confirmTPay;
501
- var mockedConfirmState = {
502
- currentState: {
503
- type: "LOAD_TPAY_HE",
504
- //@ts-ignore
505
- result: RDS.Success({}),
506
- //@ts-ignore
507
- tpayConfig: {}
508
- }
509
- };
510
- exports.mockedConfirmState = mockedConfirmState;
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.array.includes");
4
-
5
- require("core-js/modules/es.string.includes");
6
-
7
- require("whatwg-fetch");
8
-
9
- // Jenkins seems to have installed a custom certificate which causes the logs to be poluted
10
- // This little hack fixes that
11
- var logErr = console.error; // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
-
13
- console.error = function (message) {
14
- if (message && message.includes('ERR_TLS_CERT_ALTNAME_INVALID')) return;
15
-
16
- for (var _len = arguments.length, optionalParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
17
- optionalParams[_key - 1] = arguments[_key];
18
- }
19
-
20
- logErr(message, optionalParams);
21
- };
22
-
23
- jest.mock('../auth/authHandler');
24
- global.scrollTo = jest.fn();
@@ -1,51 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.object.keys");
4
-
5
- require("core-js/modules/web.dom-collections.for-each");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- var _exportNames = {
11
- server: true
12
- };
13
- Object.defineProperty(exports, "server", {
14
- enumerable: true,
15
- get: function get() {
16
- return _server.server;
17
- }
18
- });
19
-
20
- require("whatwg-fetch");
21
-
22
- var _server = require("../mockServer/server");
23
-
24
- var _msw = require("msw");
25
-
26
- Object.keys(_msw).forEach(function (key) {
27
- if (key === "default" || key === "__esModule") return;
28
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
29
- if (key in exports && exports[key] === _msw[key]) return;
30
- Object.defineProperty(exports, key, {
31
- enumerable: true,
32
- get: function get() {
33
- return _msw[key];
34
- }
35
- });
36
- });
37
-
38
- /**
39
- * Generic functions for the tests.
40
- */
41
- beforeAll(function () {
42
- _server.server.listen();
43
- });
44
- afterEach(function () {
45
- _server.server.resetHandlers();
46
-
47
- _server.server.restoreHandlers();
48
- });
49
- afterAll(function () {
50
- _server.server.close();
51
- }); // re-export everything
@@ -1,7 +0,0 @@
1
- module.exports = {
2
- "semi": true,
3
- "trailingComma": "none",
4
- "singleQuote": true,
5
- "printWidth": 120,
6
- "tabWidth": 2
7
- };
@@ -1,16 +0,0 @@
1
- declare module 'react-tracker' {
2
- import React from 'react'
3
-
4
- export interface IEvent<EventType extends string> {
5
- type: EventType
6
- }
7
- export type EventTracker<ET extends string, T extends IEvent<ET>> = (event: T, history: T[]) => T | void
8
- export class Tracker<ET extends string, T extends IEvent<ET>> {
9
- constructor(trackers: EventTracker<ET, T>[])
10
- on(type: ET, callback: EventTracker<ET, T>): void;
11
- trackEvent(event: T):void;
12
- getHistory() : T[];
13
- }
14
-
15
- export class TrackerProvider<ET extends string, T extends IEvent<ET>> extends React.Component<{tracker: Tracker<ET, T>}> {}
16
- }
@@ -1 +0,0 @@
1
- declare module 'redux-cli-logger';
@@ -1,3 +0,0 @@
1
- declare module 'tiny-async-pool' {
2
- export default function <T, R>(poolLimit: number, array: T[], iteratorFn: (item: T) => Promise<R>) : Promise<R[]>;
3
- }