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
@@ -59,10 +59,10 @@ require("core-js/modules/es.promise.js");
59
59
 
60
60
  var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
61
61
 
62
- var _utils = require("./utils");
63
-
64
62
  var _strategy = require("../strategy");
65
63
 
64
+ var _utils = require("./utils");
65
+
66
66
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
67
67
 
68
68
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && 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; }
@@ -79,13 +79,14 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
79
79
 
80
80
  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); }); }; }
81
81
 
82
- //ACTION CREATORS
82
+ // ACTION CREATORS
83
83
  function getRedirectUrlAction(_ref) {
84
84
  var extraParams = _ref.extraParams,
85
85
  _ref$autoRedirect = _ref.autoRedirect,
86
86
  autoRedirect = _ref$autoRedirect === void 0 ? false : _ref$autoRedirect,
87
87
  _ref$isGetRedirectBup = _ref.isGetRedirectBupperWay,
88
88
  isGetRedirectBupperWay = _ref$isGetRedirectBup === void 0 ? false : _ref$isGetRedirectBup;
89
+ // eslint-disable-next-line consistent-return
89
90
  return /*#__PURE__*/function () {
90
91
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch, store) {
91
92
  var currentState, _currentState$result, config, subscription_url, redirect_url, redirectUrl, timer, _yield$getRedirectUrl, _redirect_url;
@@ -96,22 +97,23 @@ function getRedirectUrlAction(_ref) {
96
97
  case 0:
97
98
  currentState = store().strategy.currentState;
98
99
 
99
- if (!(currentState.type === "ONE_CLICK")) {
100
- _context.next = 37;
100
+ if (!(currentState.type === 'ONE_CLICK')) {
101
+ _context.next = 34;
101
102
  break;
102
103
  }
103
104
 
105
+ // eslint-disable-next-line camelcase
104
106
  _currentState$result = currentState.result, config = _currentState$result.config, subscription_url = _currentState$result.subscription_url, redirect_url = _currentState$result.redirect_url;
105
107
  _context.prev = 3;
106
108
  dispatch({
107
- type: "GET_REDIRECT_URL",
109
+ type: 'GET_REDIRECT_URL',
108
110
  payload: {
109
- type: "GET_REDIRECT_URL",
111
+ type: 'GET_REDIRECT_URL',
110
112
  result: RDS.Loading()
111
113
  }
112
114
  });
113
115
 
114
- if (!(isGetRedirectBupperWay == true)) {
116
+ if (!(isGetRedirectBupperWay === true)) {
115
117
  _context.next = 13;
116
118
  break;
117
119
  }
@@ -128,8 +130,8 @@ function getRedirectUrlAction(_ref) {
128
130
  redirect_url: redirectUrl
129
131
  });
130
132
 
131
- if (autoRedirect == true || window.isAutoFraudScreener === true) {
132
- if (process.env.NODE_ENV === "production") {
133
+ if (autoRedirect === true || window.isAutoFraudScreener === true) {
134
+ if (process.env.NODE_ENV === 'production') {
133
135
  // Wait for Evina to Check Fraud First
134
136
  timer = setInterval(function () {
135
137
  if (window.isEvinaSessionChecked) {
@@ -155,9 +157,9 @@ function getRedirectUrlAction(_ref) {
155
157
  }
156
158
  } else {
157
159
  dispatch({
158
- type: "GET_REDIRECT_URL",
160
+ type: 'GET_REDIRECT_URL',
159
161
  payload: {
160
- type: "GET_REDIRECT_URL",
162
+ type: 'GET_REDIRECT_URL',
161
163
  result: RDS.Success({
162
164
  redirectUrl: redirectUrl
163
165
  })
@@ -165,26 +167,26 @@ function getRedirectUrlAction(_ref) {
165
167
  });
166
168
  }
167
169
 
168
- _context.next = 28;
170
+ _context.next = 26;
169
171
  break;
170
172
 
171
173
  case 13:
172
174
  if (!(subscription_url && subscription_url != null)) {
173
- _context.next = 17;
175
+ _context.next = 15;
174
176
  break;
175
177
  }
176
178
 
177
179
  return _context.abrupt("return", dispatch({
178
- type: "GET_REDIRECT_URL",
180
+ type: 'GET_REDIRECT_URL',
179
181
  payload: {
180
- type: "SUBCRIBE_AJAX",
182
+ type: 'SUBCRIBE_AJAX',
181
183
  result: RDS.NothingYet()
182
184
  }
183
185
  }));
184
186
 
185
- case 17:
186
- if (!(redirect_url && redirect_url != null)) {
187
- _context.next = 22;
187
+ case 15:
188
+ if (!(redirect_url && redirect_url !== null)) {
189
+ _context.next = 20;
188
190
  break;
189
191
  }
190
192
 
@@ -193,22 +195,22 @@ function getRedirectUrlAction(_ref) {
193
195
  });
194
196
 
195
197
  return _context.abrupt("return", dispatch({
196
- type: "GET_REDIRECT_URL",
198
+ type: 'GET_REDIRECT_URL',
197
199
  payload: {
198
- type: "GET_REDIRECT_URL",
200
+ type: 'GET_REDIRECT_URL',
199
201
  result: RDS.Success({
200
202
  redirectUrl: redirect_url
201
203
  })
202
204
  }
203
205
  }));
204
206
 
205
- case 22:
206
- _context.next = 24;
207
+ case 20:
208
+ _context.next = 22;
207
209
  return (0, _utils.getRedirectUrl)(window, config, _objectSpread(_objectSpread({}, currentState.result.operator && {
208
210
  operator: currentState.result.operator
209
211
  }), extraParams));
210
212
 
211
- case 24:
213
+ case 22:
212
214
  _yield$getRedirectUrl = _context.sent;
213
215
  _redirect_url = _yield$getRedirectUrl.redirect_url;
214
216
 
@@ -216,19 +218,20 @@ function getRedirectUrlAction(_ref) {
216
218
  redirect_url: _redirect_url
217
219
  });
218
220
 
219
- if (autoRedirect == true || window.isAutoFraudScreener === true) {
221
+ if (autoRedirect === true || window.isAutoFraudScreener === true) {
220
222
  _strategy.tracker.advancedInFlow('tallyman.v1-one-click', 'click-redirect-url', {
221
223
  redirect_url: _redirect_url
222
224
  });
223
225
 
224
226
  setTimeout(function () {
227
+ // eslint-disable-next-line camelcase
225
228
  window.location.href = _redirect_url;
226
229
  }, 0);
227
230
  } else {
228
231
  dispatch({
229
- type: "GET_REDIRECT_URL",
232
+ type: 'GET_REDIRECT_URL',
230
233
  payload: {
231
- type: "GET_REDIRECT_URL",
234
+ type: 'GET_REDIRECT_URL',
232
235
  result: RDS.Success({
233
236
  redirectUrl: _redirect_url
234
237
  })
@@ -236,50 +239,49 @@ function getRedirectUrlAction(_ref) {
236
239
  });
237
240
  }
238
241
 
239
- case 28:
240
- _context.next = 35;
242
+ case 26:
243
+ _context.next = 32;
241
244
  break;
242
245
 
243
- case 30:
244
- _context.prev = 30;
246
+ case 28:
247
+ _context.prev = 28;
245
248
  _context.t0 = _context["catch"](3);
246
249
  console.warn(_context.t0);
247
- console.log("Falling back to bupper");
248
250
 
249
- if (autoRedirect != true) {
251
+ if (autoRedirect !== true) {
250
252
  dispatch({
251
- type: "GET_REDIRECT_URL",
253
+ type: 'GET_REDIRECT_URL',
252
254
  payload: {
253
- type: "GET_REDIRECT_URL",
255
+ type: 'GET_REDIRECT_URL',
254
256
  result: RDS.Failure({
255
- errorType: "UnknownError"
257
+ errorType: 'UnknownError'
256
258
  })
257
259
  }
258
260
  });
259
261
  }
260
262
 
261
- case 35:
262
- _context.next = 39;
263
+ case 32:
264
+ _context.next = 36;
263
265
  break;
264
266
 
265
- case 37:
267
+ case 34:
266
268
  dispatch({
267
- type: "GET_REDIRECT_URL",
269
+ type: 'GET_REDIRECT_URL',
268
270
  payload: {
269
- type: "GET_REDIRECT_URL",
271
+ type: 'GET_REDIRECT_URL',
270
272
  result: RDS.Failure({
271
- errorType: "UnexpectedState"
273
+ errorType: 'UnexpectedState'
272
274
  })
273
275
  }
274
276
  });
275
- throw "Unexpected state";
277
+ throw new Error('Unexpected state');
276
278
 
277
- case 39:
279
+ case 36:
278
280
  case "end":
279
281
  return _context.stop();
280
282
  }
281
283
  }
282
- }, _callee, null, [[3, 30]]);
284
+ }, _callee, null, [[3, 28]]);
283
285
  }));
284
286
 
285
287
  return function (_x, _x2) {
@@ -298,22 +300,24 @@ function subscribeUrlAction(autoRedirect, extraParams) {
298
300
  case 0:
299
301
  currentState = store().strategy.currentState;
300
302
 
301
- if (!(currentState.type === "ONE_CLICK")) {
303
+ if (!(currentState.type === 'ONE_CLICK')) {
302
304
  _context2.next = 21;
303
305
  break;
304
306
  }
305
307
 
308
+ // eslint-disable-next-line camelcase
306
309
  subscription_url = currentState.result.subscription_url;
307
310
  _context2.prev = 3;
308
311
  dispatch({
309
- type: "GET_REDIRECT_URL",
312
+ type: 'GET_REDIRECT_URL',
310
313
  payload: {
311
- type: "SUBCRIBE_AJAX",
314
+ type: 'SUBCRIBE_AJAX',
312
315
  result: RDS.Loading()
313
316
  }
314
317
  });
315
318
 
316
- _strategy.tracker.advancedInFlow('tallyman.v1-one-click', 'click-subscribe'); //STILL NEED TO SUPPORT SUBCRIBE AJAX
319
+ _strategy.tracker.advancedInFlow('tallyman.v1-one-click', 'click-subscribe'); // STILL NEED TO SUPPORT SUBCRIBE AJAX
320
+ // eslint-disable-next-line camelcase
317
321
 
318
322
 
319
323
  _context2.next = 8;
@@ -326,17 +330,18 @@ function subscribeUrlAction(autoRedirect, extraParams) {
326
330
  product_url: product_url
327
331
  });
328
332
 
329
- if (autoRedirect == true) {
333
+ if (autoRedirect === true) {
330
334
  _strategy.tracker.customEvent('Flow', 'advance-auto', 'click-product-url', {
331
335
  product_url: product_url
332
- });
336
+ }); // eslint-disable-next-line camelcase
337
+
333
338
 
334
339
  window.location.href = product_url;
335
340
  } else {
336
341
  dispatch({
337
- type: "GET_REDIRECT_URL",
342
+ type: 'GET_REDIRECT_URL',
338
343
  payload: {
339
- type: "SUBCRIBE_AJAX",
344
+ type: 'SUBCRIBE_AJAX',
340
345
  result: RDS.Success({
341
346
  productUrl: product_url
342
347
  })
@@ -351,16 +356,17 @@ function subscribeUrlAction(autoRedirect, extraParams) {
351
356
  _context2.prev = 13;
352
357
  _context2.t0 = _context2["catch"](3);
353
358
  console.warn(_context2.t0);
354
- errorType = "AlreadySubscribed" === _context2.t0.type ? "AlreadySubscribed" : "SubscriptionError" === _context2.t0.type ? "SubscriptionError" : "UnknownError";
359
+ errorType = // eslint-disable-next-line no-nested-ternary
360
+ _context2.t0.type === 'AlreadySubscribed' ? 'AlreadySubscribed' : _context2.t0.type === 'SubscriptionError' ? 'SubscriptionError' : 'UnknownError';
355
361
 
356
362
  _strategy.tracker.recedeInFlow('tallyman.v1-one-click', 'click-subscribe-failure', {
357
363
  error: _context2.t0.toString()
358
364
  });
359
365
 
360
366
  dispatch({
361
- type: "GET_REDIRECT_URL",
367
+ type: 'GET_REDIRECT_URL',
362
368
  payload: {
363
- type: "SUBCRIBE_AJAX",
369
+ type: 'SUBCRIBE_AJAX',
364
370
  result: RDS.Failure({
365
371
  errorType: errorType,
366
372
  error: _context2.t0,
@@ -375,19 +381,19 @@ function subscribeUrlAction(autoRedirect, extraParams) {
375
381
 
376
382
  case 21:
377
383
  _strategy.tracker.recedeInFlow('tallyman.v1-one-click', 'click-subscribe-failure', {
378
- error: "UnexpectedState"
384
+ error: 'UnexpectedState'
379
385
  });
380
386
 
381
387
  dispatch({
382
- type: "GET_REDIRECT_URL",
388
+ type: 'GET_REDIRECT_URL',
383
389
  payload: {
384
- type: "SUBCRIBE_AJAX",
390
+ type: 'SUBCRIBE_AJAX',
385
391
  result: RDS.Failure({
386
- errorType: "UnexpectedState"
392
+ errorType: 'UnexpectedState'
387
393
  })
388
394
  }
389
395
  });
390
- throw "Unexpected state";
396
+ throw new Error('Unexpected state');
391
397
 
392
398
  case 24:
393
399
  case "end":
@@ -404,23 +410,24 @@ function subscribeUrlAction(autoRedirect, extraParams) {
404
410
  }
405
411
 
406
412
  function mockOneClickFlow(mockState) {
413
+ // eslint-disable-next-line consistent-return
407
414
  return function (dispatch) {
408
415
  if (mockState !== undefined) {
409
416
  switch (mockState) {
410
- case "redirect-url-success-state":
417
+ case 'redirect-url-success-state':
411
418
  return dispatch({
412
- type: "GET_REDIRECT_URL",
419
+ type: 'GET_REDIRECT_URL',
413
420
  payload: _utils.mockedRedirectUrlSuccessState.currentState
414
421
  });
415
422
 
416
- case "subscribe-ajax-state":
423
+ case 'subscribe-ajax-state':
417
424
  return dispatch({
418
- type: "GET_REDIRECT_URL",
425
+ type: 'GET_REDIRECT_URL',
419
426
  payload: _utils.mockedSubscribeAjaxState.currentState
420
427
  });
421
428
 
422
429
  default:
423
- throw "Mock Flow not supported";
430
+ throw new Error('Mock Flow not supported');
424
431
  }
425
432
  }
426
433
  };
@@ -428,7 +435,7 @@ function mockOneClickFlow(mockState) {
428
435
 
429
436
  var initialState = {
430
437
  currentState: {
431
- type: "GET_REDIRECT_URL",
438
+ type: 'GET_REDIRECT_URL',
432
439
  result: RDS.NothingYet()
433
440
  }
434
441
  };
@@ -442,7 +449,7 @@ function OneClickFlowReducer() {
442
449
  var action = arguments.length > 1 ? arguments[1] : undefined;
443
450
 
444
451
  switch (action.type) {
445
- case "GET_REDIRECT_URL":
452
+ case 'GET_REDIRECT_URL':
446
453
  return (0, _strategy.genericHandler)(state, action.payload);
447
454
 
448
455
  default:
@@ -1,5 +1,5 @@
1
- import { IConfig, ILinkExtraParams, IOneClickFlowReducerState } from "./OneClickTypes";
2
- import { IHash } from "../strategy/StrategyTypes";
1
+ import { IHash } from '../strategy/StrategyTypes';
2
+ import { IConfig, ILinkExtraParams, IOneClickFlowReducerState } from './OneClickTypes';
3
3
  export declare const additionalQueryString = "msisdnSubmitted=Y&legalCheckbox=Y&incentivizedCheckbox=Y&op_confirmCheckbox=N";
4
4
  export declare const getRedirectUrl: (window: Window, maybeConfig: IConfig, extraParams?: ILinkExtraParams) => Promise<{
5
5
  subscription_url?: string;
@@ -96,16 +96,16 @@ exports.additionalQueryString = additionalQueryString;
96
96
 
97
97
  var fetchJsonp = function fetchJsonp(_url) {
98
98
  var url = _url;
99
- var ouisys_callback_function = "ouisys_callback_function" + Math.floor(Math.random() * 10000);
99
+ var ouisys_callback_function = "ouisys_callback_function".concat(Math.floor(Math.random() * 10000));
100
100
  return new Promise(function (resolve, reject) {
101
- //@ts-ignore
101
+ // @ts-ignore
102
102
  window[ouisys_callback_function] = function (arg) {
103
103
  resolve(arg);
104
104
  };
105
105
 
106
106
  url += url.indexOf('?') === -1 ? '?' : '&';
107
107
  url += "jsonp=".concat(ouisys_callback_function);
108
- var script = document.createElement("script");
108
+ var script = document.createElement('script');
109
109
  script.src = url;
110
110
  script.id = ouisys_callback_function;
111
111
  document.body.appendChild(script); // Caught if got 404/500
@@ -126,7 +126,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
126
126
  while (1) {
127
127
  switch (_context.prev = _context.next) {
128
128
  case 0:
129
- if (!(typeof window == "undefined")) {
129
+ if (!(typeof window === 'undefined')) {
130
130
  _context.next = 4;
131
131
  break;
132
132
  }
@@ -135,7 +135,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
135
135
 
136
136
  case 4:
137
137
  host = maybeConfig.host, country = maybeConfig.country, slug = maybeConfig.slug, queryString = maybeConfig.queryString, device = maybeConfig.device, apiAction = maybeConfig.apiAction;
138
- customDomain = slug === "evina-test-handle" ? "dev.ng.eu.ngrok.io" : "de-ads.tallymans.com";
138
+ customDomain = slug === 'evina-test-handle' ? 'dev.ng.eu.ngrok.io' : 'de-ads.tallymans.com';
139
139
 
140
140
  bupperizeCountry = function bupperizeCountry(c) {
141
141
  return c == 'gb' ? 'uk' : c;
@@ -150,30 +150,30 @@ var getRedirectUrl = /*#__PURE__*/function () {
150
150
 
151
151
  return "".concat(k, "=").concat(v);
152
152
  })).join('&');
153
- extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
153
+ extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
154
154
  return "".concat(k, "=").concat(extraParams[k]);
155
- }).join('&');
155
+ }).join('&'));
156
156
  rockmanId = window.pac_analytics.visitor.rockmanId;
157
157
 
158
- if (!(apiAction == "identify-user")) {
158
+ if (!(apiAction == 'identify-user')) {
159
159
  _context.next = 26;
160
160
  break;
161
161
  }
162
162
 
163
- _url2 = "https://de.tallymans.com/tallyman/v1/?action=identify-user&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", "smart", "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
163
+ _url2 = "https://de.tallymans.com/tallyman/v1/?action=identify-user&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", 'smart', "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
164
164
  _context.next = 16;
165
165
  return fetchJsonp(_url2);
166
166
 
167
167
  case 16:
168
168
  result = _context.sent;
169
169
 
170
- if (!(false === result.success)) {
170
+ if (!(result.success === false)) {
171
171
  _context.next = 23;
172
172
  break;
173
173
  }
174
174
 
175
175
  identifyError = new Error("Error in getRedirectUrl() identify-user action:\n".concat(result.message));
176
- identifyError['type'] = "NotOn3g";
176
+ identifyError.type = 'NotOn3g';
177
177
  throw identifyError;
178
178
 
179
179
  case 23:
@@ -189,12 +189,12 @@ var getRedirectUrl = /*#__PURE__*/function () {
189
189
  break;
190
190
 
191
191
  case 26:
192
- if (!(apiAction == "he")) {
192
+ if (!(apiAction == 'he')) {
193
193
  _context.next = 41;
194
194
  break;
195
195
  }
196
196
 
197
- _url3 = "https://de.tallymans.com/tallyman/v1/?action=he&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", "smart", "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
197
+ _url3 = "https://de.tallymans.com/tallyman/v1/?action=he&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", 'smart', "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
198
198
  _context.next = 30;
199
199
  return fetch(_url3).then(function (x) {
200
200
  return x.json();
@@ -203,13 +203,13 @@ var getRedirectUrl = /*#__PURE__*/function () {
203
203
  case 30:
204
204
  _result = _context.sent;
205
205
 
206
- if (!(false === _result.success)) {
206
+ if (!(_result.success === false)) {
207
207
  _context.next = 37;
208
208
  break;
209
209
  }
210
210
 
211
211
  _identifyError = new Error("Error in getRedirectUrl() identify-user action:\n".concat(_result.message));
212
- _identifyError['type'] = "NotOn3g";
212
+ _identifyError.type = 'NotOn3g';
213
213
  throw _identifyError;
214
214
 
215
215
  case 37:
@@ -223,7 +223,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
223
223
  break;
224
224
 
225
225
  case 41:
226
- if (!(country.toLowerCase() === "za" && slug !== 'evina-test-handle')) {
226
+ if (!(country.toLowerCase() === 'za' && slug !== 'evina-test-handle')) {
227
227
  _context.next = 52;
228
228
  break;
229
229
  }
@@ -235,7 +235,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
235
235
  case 45:
236
236
  mcpShieldResult = _context.sent;
237
237
 
238
- if (false == mcpShieldResult.success) {
238
+ if (mcpShieldResult.success == false) {
239
239
  console.warn(mcpShieldResult.message);
240
240
  } else {
241
241
  (0, _loadScriptInnerHtml.default)(mcpShieldResult.source);
@@ -253,7 +253,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
253
253
  console.warn(_context.t0);
254
254
 
255
255
  case 52:
256
- _url4 = "https://".concat(customDomain, "/tallyman/v1/?action=redirect&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", "smart", "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
256
+ _url4 = "https://".concat(customDomain, "/tallyman/v1/?action=redirect&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", 'smart', "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
257
257
  _context.next = 55;
258
258
  return fetch(_url4).then(function (x) {
259
259
  return x.json();
@@ -262,13 +262,13 @@ var getRedirectUrl = /*#__PURE__*/function () {
262
262
  case 55:
263
263
  _result2 = _context.sent;
264
264
 
265
- if (!(false === _result2.success)) {
265
+ if (!(_result2.success === false)) {
266
266
  _context.next = 62;
267
267
  break;
268
268
  }
269
269
 
270
270
  _identifyError2 = new Error("Error in getRedirectUrl() identify-user action:\n".concat(_result2.message));
271
- _identifyError2['type'] = "NotOn3g";
271
+ _identifyError2.type = 'NotOn3g';
272
272
  throw _identifyError2;
273
273
 
274
274
  case 62:
@@ -298,11 +298,11 @@ var subscribe = /*#__PURE__*/function () {
298
298
  while (1) {
299
299
  switch (_context2.prev = _context2.next) {
300
300
  case 0:
301
- evinaTid = typeof window != "undefined" && window.tid ? window.tid : "";
302
- extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
301
+ evinaTid = typeof window !== 'undefined' && window.tid ? window.tid : '';
302
+ extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
303
303
  return "".concat(k, "=").concat(extraParams[k]);
304
- }).join('&');
305
- isCleanTraffic = typeof window != "undefined" && window.shouldBlock === true ? '&is-clean-traffic=false' : '&is-clean-traffic=true';
304
+ }).join('&'));
305
+ isCleanTraffic = typeof window !== 'undefined' && window.shouldBlock === true ? '&is-clean-traffic=false' : '&is-clean-traffic=true';
306
306
  _context2.next = 5;
307
307
  return fetch("".concat(url, "&sam_evina_tid=").concat(evinaTid).concat(isCleanTraffic).concat(extraParamsQs)).then(function (x) {
308
308
  return x.json();
@@ -311,14 +311,14 @@ var subscribe = /*#__PURE__*/function () {
311
311
  case 5:
312
312
  result = _context2.sent;
313
313
 
314
- if (!(false === result.success)) {
314
+ if (!(result.success === false)) {
315
315
  _context2.next = 13;
316
316
  break;
317
317
  }
318
318
 
319
319
  subscribeError = new Error("Error in subscribe() one-click-subscribe action:\n".concat(result.message));
320
- subscribeError['type'] = result.message == 'ALREADY SUBSCRIBED' ? "AlreadySubscribed" : "SubscriptionError";
321
- subscribeError['productUrl'] = result.product_url ? result.product_url : "";
320
+ subscribeError.type = result.message == 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'SubscriptionError';
321
+ subscribeError.productUrl = result.product_url ? result.product_url : '';
322
322
  throw subscribeError;
323
323
 
324
324
  case 13:
@@ -346,14 +346,14 @@ var getRedirectUrlBupperWay = /*#__PURE__*/function () {
346
346
  while (1) {
347
347
  switch (_context3.prev = _context3.next) {
348
348
  case 0:
349
- if (!(typeof window == "undefined")) {
350
- _context3.next = 4;
349
+ if (!(typeof window === 'undefined')) {
350
+ _context3.next = 2;
351
351
  break;
352
352
  }
353
353
 
354
354
  return _context3.abrupt("return", "javascript: console.error('SSR'); void 6");
355
355
 
356
- case 4:
356
+ case 2:
357
357
  host = maybeConfig.host, country = maybeConfig.country, slug = maybeConfig.slug, queryString = maybeConfig.queryString;
358
358
 
359
359
  bupperizeCountry = function bupperizeCountry(c) {
@@ -369,14 +369,14 @@ var getRedirectUrlBupperWay = /*#__PURE__*/function () {
369
369
 
370
370
  return "".concat(k, "=").concat(v);
371
371
  })).join('&');
372
- extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
372
+ extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
373
373
  return "".concat(k, "=").concat(extraParams[k]);
374
- }).join('&'); // one click flow must use http not https
374
+ }).join('&')); // one click flow must use http not https
375
375
 
376
- xcid = window.location.href.split("/")[3].split('?')[0];
376
+ xcid = window.location.href.split('/')[3].split('?')[0];
377
377
  return _context3.abrupt("return", "http://".concat(host, "/").concat(bupperizeCountry(country), "/").concat(slug, "?offer=").concat(offer, "&atmobirun=1&rockman_id=").concat(window.pac_analytics.visitor.rockmanId, "&redirPixels=").concat(window.location.host, "&x-xcid=").concat(xcid).concat(extraParamsQs).concat(search));
378
378
 
379
- case 12:
379
+ case 10:
380
380
  case "end":
381
381
  return _context3.stop();
382
382
  }
@@ -392,8 +392,8 @@ var getRedirectUrlBupperWay = /*#__PURE__*/function () {
392
392
  exports.getRedirectUrlBupperWay = getRedirectUrlBupperWay;
393
393
  var mockedRedirectUrlSuccessState = {
394
394
  currentState: {
395
- type: "GET_REDIRECT_URL",
396
- //@ts-ignore
395
+ type: 'GET_REDIRECT_URL',
396
+ // @ts-ignore
397
397
  result: RDS.Success({
398
398
  redirectUrl: '/mock-product-url'
399
399
  })
@@ -402,8 +402,8 @@ var mockedRedirectUrlSuccessState = {
402
402
  exports.mockedRedirectUrlSuccessState = mockedRedirectUrlSuccessState;
403
403
  var mockedSubscribeAjaxState = {
404
404
  currentState: {
405
- type: "SUBCRIBE_AJAX",
406
- //@ts-ignore
405
+ type: 'SUBCRIBE_AJAX',
406
+ // @ts-ignore
407
407
  result: RDS.NothingYet()
408
408
  }
409
409
  };
@@ -1,2 +1,2 @@
1
- declare type IPinConstants = "PIN_FLOW_MSISDN_SUBMIT" | "PIN_FLOW_MSISDN_SUBMIT_ERROR" | "PIN_SUBMIT" | "BACK_TO_START" | "PIN_SUBMIT_ERROR" | "MOCK_PIN_FLOW_STATE";
1
+ declare type IPinConstants = 'PIN_FLOW_MSISDN_SUBMIT' | 'PIN_FLOW_MSISDN_SUBMIT_ERROR' | 'PIN_SUBMIT' | 'BACK_TO_START' | 'PIN_SUBMIT_ERROR' | 'MOCK_PIN_FLOW_STATE';
2
2
  export default IPinConstants;