ouisys-engine 3.0.2 → 3.0.6

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 (198) hide show
  1. package/.babelrc +4 -8
  2. package/.eslintrc.js +1 -1
  3. package/.nvmrc +1 -1
  4. package/.prettierignore +2 -1
  5. package/README.md +2 -4
  6. package/dist/api/index.d.ts +5 -5
  7. package/dist/api/index.js +76 -76
  8. package/dist/common-types/AppThunk.d.ts +11 -12
  9. package/dist/common-types/IOptInFlowName.d.ts +1 -1
  10. package/dist/common-types/ITracker.js +1 -2
  11. package/dist/common-types/RemoteDataState.d.ts +4 -4
  12. package/dist/common-types/RemoteDataState.js +17 -17
  13. package/dist/flows/click2smsFlow.d.ts +2 -2
  14. package/dist/flows/moFlow.d.ts +2 -2
  15. package/dist/flows/moRedirFlow.d.ts +2 -2
  16. package/dist/flows/oneClickFlow.d.ts +2 -2
  17. package/dist/flows/pinFlow.d.ts +2 -2
  18. package/dist/flows/pinFlow.js +2 -0
  19. package/dist/flows/strategy.d.ts +8 -8
  20. package/dist/flows/ussdFlow.d.ts +2 -2
  21. package/dist/ips/tryGetIPRangeName.d.ts +1 -1
  22. package/dist/ips/tryGetIPRangeName.js +7 -5
  23. package/dist/jest.config.js +1 -1
  24. package/dist/pacman/index.d.ts +2 -2
  25. package/dist/pacman/index.js +41 -41
  26. package/dist/pacman/queryString.js +11 -9
  27. package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +19 -19
  28. package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +1 -1
  29. package/dist/reducers/click2smsFlow/index.d.ts +2 -2
  30. package/dist/reducers/click2smsFlow/index.js +24 -24
  31. package/dist/reducers/click2smsFlow/utils.d.ts +1 -1
  32. package/dist/reducers/click2smsFlow/utils.js +30 -30
  33. package/dist/reducers/moFlow/IMoConstants.d.ts +1 -1
  34. package/dist/reducers/moFlow/MoTypes.d.ts +13 -13
  35. package/dist/reducers/moFlow/index.d.ts +3 -3
  36. package/dist/reducers/moFlow/index.js +27 -27
  37. package/dist/reducers/moFlow/utils.d.ts +1 -2
  38. package/dist/reducers/moFlow/utils.js +28 -26
  39. package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +1 -1
  40. package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +13 -13
  41. package/dist/reducers/moRedirFlow/index.d.ts +3 -3
  42. package/dist/reducers/moRedirFlow/index.js +27 -27
  43. package/dist/reducers/moRedirFlow/utils.d.ts +1 -1
  44. package/dist/reducers/moRedirFlow/utils.js +17 -17
  45. package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +1 -1
  46. package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +10 -10
  47. package/dist/reducers/oneClickFlow/index.d.ts +3 -3
  48. package/dist/reducers/oneClickFlow/index.js +75 -68
  49. package/dist/reducers/oneClickFlow/utils.d.ts +2 -2
  50. package/dist/reducers/oneClickFlow/utils.js +70 -69
  51. package/dist/reducers/pinFlow/IPinConstants.d.ts +1 -1
  52. package/dist/reducers/pinFlow/PinTypes.d.ts +23 -23
  53. package/dist/reducers/pinFlow/index.d.ts +3 -3
  54. package/dist/reducers/pinFlow/index.js +76 -76
  55. package/dist/reducers/pinFlow/utils.d.ts +1 -1
  56. package/dist/reducers/pinFlow/utils.js +61 -65
  57. package/dist/reducers/strategy/IStategyActionContants.d.ts +1 -1
  58. package/dist/reducers/strategy/StrategyTypes.d.ts +56 -56
  59. package/dist/reducers/strategy/index.d.ts +2 -2
  60. package/dist/reducers/strategy/index.js +99 -99
  61. package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +3 -2
  62. package/dist/reducers/strategy/strategies/ask_mobile_number.js +132 -74
  63. package/dist/reducers/strategy/strategies/ask_operator.d.ts +2 -2
  64. package/dist/reducers/strategy/strategies/ask_operator.js +64 -68
  65. package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +2 -2
  66. package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +97 -97
  67. package/dist/reducers/strategy/strategies/header_enrichment.d.ts +2 -2
  68. package/dist/reducers/strategy/strategies/header_enrichment.js +116 -120
  69. package/dist/reducers/strategy/utils.d.ts +3 -3
  70. package/dist/reducers/strategy/utils.js +115 -111
  71. package/dist/reducers/ussdFlow/IUssdConstants.d.ts +1 -1
  72. package/dist/reducers/ussdFlow/UssdTypes.d.ts +13 -13
  73. package/dist/reducers/ussdFlow/index.d.ts +3 -3
  74. package/dist/reducers/ussdFlow/index.js +27 -27
  75. package/dist/reducers/ussdFlow/utils.d.ts +1 -2
  76. package/dist/reducers/ussdFlow/utils.js +19 -17
  77. package/dist/store/index.d.ts +8 -8
  78. package/dist/store/index.js +87 -83
  79. package/dist/store/reducers.d.ts +7 -7
  80. package/dist/store/reducers.js +4 -4
  81. package/dist/utilities/handleSubmitNumber.d.ts +7 -3
  82. package/dist/utilities/handleSubmitNumber.js +15 -18
  83. package/dist/utilities/index.d.ts +1 -1
  84. package/dist/utilities/index.js +13 -11
  85. package/dist/utilities/loadScriptInnerHtml.js +0 -1
  86. package/index.html +21 -28
  87. package/package.json +23 -15
  88. package/setupJest.js +1 -1
  89. package/tsconfig.json +2 -2
  90. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  91. package/.idea/modules.xml +0 -8
  92. package/.idea/ouisys-engine.iml +0 -12
  93. package/.idea/vcs.xml +0 -6
  94. package/.vscode/settings.json +0 -6
  95. package/dist/api/click2sms.js +0 -357
  96. package/dist/api/mo.js +0 -274
  97. package/dist/api/moRedir.js +0 -186
  98. package/dist/api/oneClick.js +0 -366
  99. package/dist/api/pin.js +0 -493
  100. package/dist/api/strategies.js +0 -704
  101. package/dist/api/ussd.js +0 -1
  102. package/dist/app/store.js +0 -35
  103. package/dist/features/strategies/categories/askMobileNumber.js +0 -395
  104. package/dist/features/strategies/categories/askOperator.js +0 -311
  105. package/dist/features/strategies/categories/detectOperatorByIp.js +0 -606
  106. package/dist/features/strategies/categories/headerEnrichment.js +0 -670
  107. package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +0 -12
  108. package/dist/features/strategies/categories/typings/identifySliceTypes.js +0 -22
  109. package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +0 -22
  110. package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +0 -21
  111. package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +0 -13
  112. package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +0 -13
  113. package/dist/features/strategies/click2smsFlowSlice.js +0 -172
  114. package/dist/features/strategies/identifySlice.js +0 -455
  115. package/dist/features/strategies/moFlowSlice.js +0 -196
  116. package/dist/features/strategies/moRedirFlowSlice.js +0 -190
  117. package/dist/features/strategies/oneClickFlowSlice.js +0 -277
  118. package/dist/features/strategies/pinFlowSlice.js +0 -313
  119. package/dist/features/strategies/ussdFlowSlice.js +0 -1
  120. package/dist/flows/tpayHeFlow.d.ts +0 -7
  121. package/dist/flows/tpayHeFlow.js +0 -23
  122. package/dist/mockServer/browser.js +0 -48
  123. package/dist/mockServer/handlers.js +0 -22
  124. package/dist/mockServer/server.js +0 -48
  125. package/dist/reducers/tpayHeFlow/ITpayHeConstants.d.ts +0 -2
  126. package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
  127. package/dist/reducers/tpayHeFlow/TpayHeTypes.d.ts +0 -114
  128. package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
  129. package/dist/reducers/tpayHeFlow/index.d.ts +0 -7
  130. package/dist/reducers/tpayHeFlow/index.js +0 -331
  131. package/dist/reducers/tpayHeFlow/utils.d.ts +0 -20
  132. package/dist/reducers/tpayHeFlow/utils.js +0 -510
  133. package/dist/test/setup.js +0 -24
  134. package/dist/test/test-utils.js +0 -51
  135. package/mockData/config.json +0 -28
  136. package/prettier.config.js +0 -7
  137. package/src/@types/react-tracker.d.ts +0 -16
  138. package/src/@types/redux-cli-logger.d.ts +0 -1
  139. package/src/@types/tiny-async-pool.d.ts +0 -3
  140. package/src/@types/window.d.ts +0 -74
  141. package/src/api/index.ts +0 -225
  142. package/src/common-types/AppThunk.ts +0 -19
  143. package/src/common-types/Either.ts +0 -3
  144. package/src/common-types/IError.ts +0 -5
  145. package/src/common-types/IOptInFlowName.ts +0 -1
  146. package/src/common-types/ITracker.ts +0 -10
  147. package/src/common-types/IVisitor.ts +0 -16
  148. package/src/common-types/RemoteDataState.ts +0 -88
  149. package/src/flows/click2smsFlow.ts +0 -18
  150. package/src/flows/moFlow.ts +0 -20
  151. package/src/flows/moRedirFlow.ts +0 -20
  152. package/src/flows/oneClickFlow.ts +0 -20
  153. package/src/flows/pinFlow.ts +0 -25
  154. package/src/flows/strategy.ts +0 -51
  155. package/src/flows/ussdFlow.ts +0 -20
  156. package/src/index.ts +0 -3
  157. package/src/ips/tryGetIPRangeName.ts +0 -22
  158. package/src/jest.config.js +0 -194
  159. package/src/pacman/index.ts +0 -71
  160. package/src/pacman/queryString.ts +0 -24
  161. package/src/reducers/click2smsFlow/Click2smsTypes.ts +0 -93
  162. package/src/reducers/click2smsFlow/IClick2smsConstants.ts +0 -4
  163. package/src/reducers/click2smsFlow/index.ts +0 -105
  164. package/src/reducers/click2smsFlow/utils.ts +0 -126
  165. package/src/reducers/moFlow/IMoConstants.ts +0 -7
  166. package/src/reducers/moFlow/MoTypes.ts +0 -125
  167. package/src/reducers/moFlow/index.ts +0 -150
  168. package/src/reducers/moFlow/utils.ts +0 -135
  169. package/src/reducers/moRedirFlow/IMoRedirConstants.ts +0 -7
  170. package/src/reducers/moRedirFlow/MoRedirTypes.ts +0 -99
  171. package/src/reducers/moRedirFlow/index.ts +0 -137
  172. package/src/reducers/moRedirFlow/utils.ts +0 -78
  173. package/src/reducers/oneClickFlow/IOneClickConstants.ts +0 -3
  174. package/src/reducers/oneClickFlow/OneClickTypes.ts +0 -108
  175. package/src/reducers/oneClickFlow/index.ts +0 -268
  176. package/src/reducers/oneClickFlow/utils.ts +0 -217
  177. package/src/reducers/pinFlow/IPinConstants.ts +0 -9
  178. package/src/reducers/pinFlow/PinTypes.ts +0 -190
  179. package/src/reducers/pinFlow/index.ts +0 -331
  180. package/src/reducers/pinFlow/utils.ts +0 -232
  181. package/src/reducers/strategy/IStategyActionContants.ts +0 -17
  182. package/src/reducers/strategy/StrategyTypes.ts +0 -375
  183. package/src/reducers/strategy/index.ts +0 -321
  184. package/src/reducers/strategy/strategies/ask_mobile_number.ts +0 -316
  185. package/src/reducers/strategy/strategies/ask_operator.ts +0 -195
  186. package/src/reducers/strategy/strategies/detect_operator_by_ip.ts +0 -414
  187. package/src/reducers/strategy/strategies/header_enrichment.ts +0 -489
  188. package/src/reducers/strategy/utils.ts +0 -357
  189. package/src/reducers/ussdFlow/IUssdConstants.ts +0 -7
  190. package/src/reducers/ussdFlow/UssdTypes.ts +0 -112
  191. package/src/reducers/ussdFlow/index.ts +0 -146
  192. package/src/reducers/ussdFlow/utils.ts +0 -88
  193. package/src/store/index.ts +0 -150
  194. package/src/store/reducers.ts +0 -37
  195. package/src/utilities/handleSubmitNumber.ts +0 -65
  196. package/src/utilities/index.ts +0 -114
  197. package/src/utilities/loadScriptInnerHtml.ts +0 -14
  198. package/src/utilities/loadScriptSrc.ts +0 -26
@@ -57,10 +57,10 @@ require("core-js/modules/es.promise.js");
57
57
 
58
58
  var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
59
59
 
60
- var _utils = _interopRequireWildcard(require("./utils"));
61
-
62
60
  var _strategy = require("../strategy");
63
61
 
62
+ var _utils = _interopRequireWildcard(require("./utils"));
63
+
64
64
  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); }
65
65
 
66
66
  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; }
@@ -77,7 +77,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
77
77
 
78
78
  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); }); }; }
79
79
 
80
- //ACTION CREATORS
80
+ // ACTION CREATORS
81
81
  function submitMSISDNAction(msisdn) {
82
82
  return /*#__PURE__*/function () {
83
83
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch, store) {
@@ -88,7 +88,7 @@ function submitMSISDNAction(msisdn) {
88
88
  case 0:
89
89
  currentState = store().strategy.currentState;
90
90
 
91
- if (!(currentState.type === "USSD")) {
91
+ if (!(currentState.type === 'USSD')) {
92
92
  _context.next = 28;
93
93
  break;
94
94
  }
@@ -96,9 +96,9 @@ function submitMSISDNAction(msisdn) {
96
96
  config = currentState.result.config;
97
97
  _context.prev = 3;
98
98
  dispatch({
99
- type: "USSD_MSISDN_SUBMIT",
99
+ type: 'USSD_MSISDN_SUBMIT',
100
100
  payload: {
101
- type: "MSISDNEntry",
101
+ type: 'MSISDNEntry',
102
102
  result: RDS.Loading()
103
103
  }
104
104
  });
@@ -118,9 +118,9 @@ function submitMSISDNAction(msisdn) {
118
118
  });
119
119
 
120
120
  dispatch({
121
- type: "USSD_MSISDN_SUBMIT",
121
+ type: 'USSD_MSISDN_SUBMIT',
122
122
  payload: {
123
- type: "MSISDNEntry",
123
+ type: 'MSISDNEntry',
124
124
  result: RDS.Success(_objectSpread({}, keywordAndShortcode))
125
125
  }
126
126
  });
@@ -150,7 +150,7 @@ function submitMSISDNAction(msisdn) {
150
150
  _context.prev = 20;
151
151
  _context.t1 = _context["catch"](3);
152
152
  console.warn(_context.t1);
153
- errorType = "SEAlreadySubscribed" === _context.t1.type ? "AlreadySubscribed" : "SEInvalidMSISDN" == _context.t1.type ? "InvalidMSISDN" : "UnknownError";
153
+ errorType = _context.t1.type === 'SEAlreadySubscribed' ? 'AlreadySubscribed' : _context.t1.type == 'SEInvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
154
154
 
155
155
  _strategy.tracker.recedeInFlow('tallyman.v1-ussd', 'msisdn-submission-failure', {
156
156
  msisdn: msisdn,
@@ -158,9 +158,9 @@ function submitMSISDNAction(msisdn) {
158
158
  });
159
159
 
160
160
  dispatch({
161
- type: "USSD_MSISDN_SUBMIT_ERROR",
161
+ type: 'USSD_MSISDN_SUBMIT_ERROR',
162
162
  payload: {
163
- type: "MSISDNEntry",
163
+ type: 'MSISDNEntry',
164
164
  result: RDS.Failure({
165
165
  errorType: errorType,
166
166
  error: _context.t1,
@@ -175,16 +175,16 @@ function submitMSISDNAction(msisdn) {
175
175
 
176
176
  case 28:
177
177
  dispatch({
178
- type: "USSD_MSISDN_SUBMIT_ERROR",
178
+ type: 'USSD_MSISDN_SUBMIT_ERROR',
179
179
  payload: {
180
- type: "MSISDNEntry",
180
+ type: 'MSISDNEntry',
181
181
  result: RDS.Failure({
182
- errorType: "UnexpectedState",
182
+ errorType: 'UnexpectedState',
183
183
  error: null
184
184
  })
185
185
  }
186
186
  });
187
- throw "Unexpected state";
187
+ throw 'Unexpected state';
188
188
 
189
189
  case 30:
190
190
  case "end":
@@ -204,20 +204,20 @@ function mockUssdFlow(mockState) {
204
204
  return function (dispatch) {
205
205
  if (mockState !== undefined) {
206
206
  switch (mockState) {
207
- case "msisdn-entry-failure-state":
207
+ case 'msisdn-entry-failure-state':
208
208
  return dispatch({
209
- type: "MOCK_USSD_FLOW_STATE",
209
+ type: 'MOCK_USSD_FLOW_STATE',
210
210
  payload: _utils.mockedMSISDNEntryFailure.currentState
211
211
  });
212
212
 
213
- case "msisdn-entry-success-state":
213
+ case 'msisdn-entry-success-state':
214
214
  return dispatch({
215
- type: "MOCK_USSD_FLOW_STATE",
215
+ type: 'MOCK_USSD_FLOW_STATE',
216
216
  payload: _utils.mockedMSISDNEntrySuccess.currentState
217
217
  });
218
218
 
219
219
  default:
220
- throw "Mock Flow not supported";
220
+ throw 'Mock Flow not supported';
221
221
  }
222
222
  }
223
223
  };
@@ -225,9 +225,9 @@ function mockUssdFlow(mockState) {
225
225
 
226
226
  function backToStart() {
227
227
  return {
228
- type: "USSD_BACK_TO_START",
228
+ type: 'USSD_BACK_TO_START',
229
229
  payload: {
230
- type: "MSISDNEntry",
230
+ type: 'MSISDNEntry',
231
231
  result: RDS.NothingYet()
232
232
  }
233
233
  };
@@ -235,7 +235,7 @@ function backToStart() {
235
235
 
236
236
  var initialState = {
237
237
  currentState: {
238
- type: "MSISDNEntry",
238
+ type: 'MSISDNEntry',
239
239
  result: RDS.NothingYet()
240
240
  }
241
241
  };
@@ -249,16 +249,16 @@ function UssdFlowReducer() {
249
249
  var action = arguments.length > 1 ? arguments[1] : undefined;
250
250
 
251
251
  switch (action.type) {
252
- case "USSD_MSISDN_SUBMIT":
252
+ case 'USSD_MSISDN_SUBMIT':
253
253
  return (0, _strategy.genericHandler)(state, action.payload);
254
254
 
255
- case "USSD_BACK_TO_START":
255
+ case 'USSD_BACK_TO_START':
256
256
  return (0, _strategy.genericHandler)(state, action.payload);
257
257
 
258
- case "USSD_MSISDN_SUBMIT_ERROR":
258
+ case 'USSD_MSISDN_SUBMIT_ERROR':
259
259
  return (0, _strategy.genericHandler)(state, action.payload);
260
260
 
261
- case "MOCK_USSD_FLOW_STATE":
261
+ case 'MOCK_USSD_FLOW_STATE':
262
262
  return (0, _strategy.genericHandler)(state, action.payload);
263
263
 
264
264
  default:
@@ -1,5 +1,4 @@
1
- import { IConfig, IUssdFlowReducerState } from "./UssdTypes";
2
- import { IKeywordShortcode } from "./UssdTypes";
1
+ import { IConfig, IKeywordShortcode, IUssdFlowReducerState } from './UssdTypes';
3
2
  export default function submitMSISDN(window: Window, maybeConfig: IConfig, internationalMSISDN: string, extraParams?: {
4
3
  [key: string]: string;
5
4
  }): Promise<IKeywordShortcode>;
@@ -127,9 +127,9 @@ function _submitMSISDNWithConfig() {
127
127
  case 0:
128
128
  slug = config.slug, country = config.country, device = config.device, offer = config.offer, host = config.host;
129
129
  search = window.location.search.substr(1) || '';
130
- extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
130
+ extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
131
131
  return "".concat(k, "=").concat(extraParams[k]);
132
- }).join('&');
132
+ }).join('&'));
133
133
  msisdn = internationalMSISDN.match(/\d+/gi).join('');
134
134
  rockmanId = window.pac_analytics.visitor.rockmanId;
135
135
  _context2.next = 7;
@@ -138,14 +138,14 @@ function _submitMSISDNWithConfig() {
138
138
  case 7:
139
139
  result = _context2.sent;
140
140
 
141
- if (!(false === result.success)) {
141
+ if (!(result.success === false)) {
142
142
  _context2.next = 16;
143
143
  break;
144
144
  }
145
145
 
146
- type = result.message == 'ALREADY SUBSCRIBED' ? "AlreadySubscribed" : "InvalidMSISDN";
146
+ type = result.message == 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMSISDN';
147
147
  error = new Error("".concat(type, ":\n").concat(result.message));
148
- error['type'] = type;
148
+ error.type = type;
149
149
  console.error(error);
150
150
  throw error;
151
151
 
@@ -191,20 +191,20 @@ function _checkSubscription() {
191
191
  case 6:
192
192
  checkResult = _context3.sent;
193
193
 
194
- if (!(true === checkResult.success)) {
195
- _context3.next = 12;
194
+ if (!(checkResult.success === true)) {
195
+ _context3.next = 10;
196
196
  break;
197
197
  }
198
198
 
199
199
  window.location.href = checkResult.product_url;
200
200
  return _context3.abrupt("return", checkResult.product_url || null);
201
201
 
202
- case 12:
203
- error = new Error("SubscriptionFailed".concat(":\n", checkResult.message));
204
- error['type'] = "SubscriptionFailed";
202
+ case 10:
203
+ error = new Error('SubscriptionFailed'.concat(":\n", checkResult.message));
204
+ error.type = 'SubscriptionFailed';
205
205
  throw error;
206
206
 
207
- case 15:
207
+ case 13:
208
208
  case "end":
209
209
  return _context3.stop();
210
210
  }
@@ -215,15 +215,17 @@ function _checkSubscription() {
215
215
  }
216
216
 
217
217
  var formatSMSLink = function formatSMSLink(keywordAndShortcode) {
218
- return (//@ts-ignore
219
- !!window.pac_analytics.visitor["x-requested-with"] && window.pac_analytics.visitor["x-requested-with"] !== null && window.pac_analytics.visitor["x-requested-with"].indexOf("com.facebook") !== -1 ? "sms://".concat(keywordAndShortcode.shortcode, "?body=").concat(keywordAndShortcode.keyword) : typeof navigator != "undefined" && (/iPhone/i.test(navigator.userAgent) || /Mac OS/i.test(navigator.userAgent)) ? "sms:".concat(keywordAndShortcode.shortcode, "&body=").concat(keywordAndShortcode.keyword) : "sms:".concat(keywordAndShortcode.shortcode, "?body=").concat(keywordAndShortcode.keyword)
218
+ return (// @ts-ignore
219
+ !!window.pac_analytics.visitor['x-requested-with'] && // @ts-ignore
220
+ window.pac_analytics.visitor['x-requested-with'] !== null && // @ts-ignore
221
+ window.pac_analytics.visitor['x-requested-with'].indexOf('com.facebook') !== -1 ? "sms://".concat(keywordAndShortcode.shortcode, "?body=").concat(keywordAndShortcode.keyword) : typeof navigator !== 'undefined' && (/iPhone/i.test(navigator.userAgent) || /Mac OS/i.test(navigator.userAgent)) ? "sms:".concat(keywordAndShortcode.shortcode, "&body=").concat(keywordAndShortcode.keyword) : "sms:".concat(keywordAndShortcode.shortcode, "?body=").concat(keywordAndShortcode.keyword)
220
222
  );
221
223
  };
222
224
 
223
225
  exports.formatSMSLink = formatSMSLink;
224
226
  var mockedMSISDNEntrySuccess = {
225
227
  currentState: {
226
- type: "MSISDNEntry",
228
+ type: 'MSISDNEntry',
227
229
  result: RDS.Success({
228
230
  keyword: 'TEST OK',
229
231
  shortcode: '666'
@@ -233,10 +235,10 @@ var mockedMSISDNEntrySuccess = {
233
235
  exports.mockedMSISDNEntrySuccess = mockedMSISDNEntrySuccess;
234
236
  var mockedMSISDNEntryFailure = {
235
237
  currentState: {
236
- type: "MSISDNEntry",
238
+ type: 'MSISDNEntry',
237
239
  result: RDS.Failure({
238
- errorType: "InvalidMSISDN",
239
- error: "Invalid Mobile Number"
240
+ errorType: 'InvalidMSISDN',
241
+ error: 'Invalid Mobile Number'
240
242
  })
241
243
  }
242
244
  };
@@ -1,11 +1,11 @@
1
- import { IPinActions } from "../reducers/pinFlow/PinTypes";
2
- import { IStrategyActions } from "../reducers/strategy/StrategyTypes";
3
- import { IApplicationState } from "./reducers";
4
- import { IMoActions } from "../reducers/moFlow/MoTypes";
5
- import { IUssdActions } from "../reducers/ussdFlow/UssdTypes";
6
- import { IMoRedirActions } from "../reducers/moRedirFlow/MoRedirTypes";
7
- import { IOneClickActions } from "../reducers/oneClickFlow/OneClickTypes";
8
- import { IClick2SmsActions } from "../reducers/click2smsFlow/Click2smsTypes";
1
+ import { IClick2SmsActions } from '../reducers/click2smsFlow/Click2smsTypes';
2
+ import { IMoActions } from '../reducers/moFlow/MoTypes';
3
+ import { IMoRedirActions } from '../reducers/moRedirFlow/MoRedirTypes';
4
+ import { IOneClickActions } from '../reducers/oneClickFlow/OneClickTypes';
5
+ import { IPinActions } from '../reducers/pinFlow/PinTypes';
6
+ import { IStrategyActions } from '../reducers/strategy/StrategyTypes';
7
+ import { IUssdActions } from '../reducers/ussdFlow/UssdTypes';
8
+ import { IApplicationState } from './reducers';
9
9
  export declare type IApplicationActions = IStrategyActions | IPinActions | IMoActions | IMoRedirActions | IOneClickActions | IClick2SmsActions | IUssdActions;
10
10
  declare const store: import("redux").Store<import("redux").EmptyObject & IApplicationState, import("redux").AnyAction> & {
11
11
  dispatch: import("redux-thunk").ThunkDispatch<IApplicationState, undefined, IApplicationActions>;
@@ -29,31 +29,31 @@ require("core-js/modules/es.array.includes.js");
29
29
 
30
30
  require("core-js/modules/es.string.includes.js");
31
31
 
32
- var RDS = _interopRequireWildcard(require("../common-types/RemoteDataState"));
33
-
34
32
  var _redux = require("redux");
35
33
 
36
- var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
34
+ var _reduxLogger = require("redux-logger");
37
35
 
38
- var _reducers = _interopRequireDefault(require("./reducers"));
36
+ var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
39
37
 
40
- var _reduxLogger = require("redux-logger");
38
+ var RDS = _interopRequireWildcard(require("../common-types/RemoteDataState"));
41
39
 
42
40
  var _utils = require("../reducers/strategy/utils");
43
41
 
44
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42
+ var _reducers = _interopRequireDefault(require("./reducers"));
45
43
 
46
44
  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); }
47
45
 
48
46
  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; }
49
47
 
48
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
49
+
50
50
  var log = (0, _reduxLogger.createLogger)({
51
51
  diff: true,
52
52
  collapsed: true
53
53
  }); // ======================================================
54
54
  // Store Enhancers
55
55
  // ======================================================
56
- //const enhancers = [];
56
+ // const enhancers = [];
57
57
  // ======================================================
58
58
  // Store Instantiation
59
59
  // ======================================================
@@ -63,111 +63,115 @@ var strategyBasedInitialState = function strategyBasedInitialState() {
63
63
  strategy = _getConfig.strategy,
64
64
  strategyConfigs = _getConfig.strategyConfigs;
65
65
 
66
- if (strategy.includes("ask-operator")) {
66
+ if (strategy.includes('ask-operator')) {
67
67
  var operators = (0, _utils.getOperators)();
68
68
  return {
69
- type: "IDENTIFY_FLOW_BY_OPERATOR_SELECT",
69
+ type: 'IDENTIFY_FLOW_BY_OPERATOR_SELECT',
70
70
  result: {
71
71
  operators: operators,
72
- nextAction: "selectOperator"
72
+ nextAction: 'selectOperator'
73
73
  }
74
74
  };
75
- } else if (strategy.includes("ask-mobile-number") || strategy.includes("header-enrichment")) {
75
+ }
76
+
77
+ if (strategy.includes('ask-mobile-number') || strategy.includes('header-enrichment')) {
76
78
  return {
77
- type: "IDENTIFY_FLOW_BY_MSISDN",
79
+ type: 'IDENTIFY_FLOW_BY_MSISDN',
78
80
  result: RDS.NothingYet(),
79
81
  nextData: {
80
- nextAction: "submitMSISDNAction"
82
+ nextAction: 'submitMSISDNAction'
81
83
  }
82
84
  };
83
- } else if (strategy.includes("detect-operator-by-ip")) {
85
+ }
86
+
87
+ if (strategy.includes('detect-operator-by-ip')) {
84
88
  return {
85
- type: "DETECT_OPERATOR_BY_IP",
89
+ type: 'DETECT_OPERATOR_BY_IP',
86
90
  result: RDS.Loading()
87
91
  };
88
- } else {
89
- switch (strategy) {
90
- case "pin":
91
- return {
92
- type: "PIN",
93
- result: {
94
- nextAction: "submitMSISDNAction",
95
- config: strategyConfigs.default.flowConfig
96
- }
97
- };
98
-
99
- case "mo":
100
- return {
101
- type: "MO",
102
- result: {
103
- nextAction: "submitMSISDNAction",
104
- config: strategyConfigs.default.flowConfig
105
- }
106
- };
107
-
108
- case "mo-redir":
109
- return {
110
- type: "MO_REDIR",
111
- result: {
112
- nextAction: "submitMSISDNAction",
113
- config: strategyConfigs.default.flowConfig
114
- }
115
- };
116
-
117
- case "one-click":
118
- return {
119
- type: "ONE_CLICK",
120
- result: {
121
- nextAction: "getRedirectUrlAction",
122
- config: strategyConfigs.default.flowConfig
123
- }
124
- };
125
-
126
- case "click2sms":
127
- return {
128
- type: "CLICK2SMS",
129
- result: {
130
- nextAction: "loadOc2sms",
131
- config: strategyConfigs.default.flowConfig
132
- }
133
- };
134
-
135
- case "ussd":
136
- return {
137
- type: "USSD",
138
- result: {
139
- nextAction: "submitMSISDNAction",
140
- config: strategyConfigs.default.flowConfig
141
- }
142
- };
143
-
144
- default:
145
- return {
146
- type: "IDENTIFY_STRATEGY",
147
- result: RDS.Loading()
148
- };
149
- }
92
+ }
93
+
94
+ switch (strategy) {
95
+ case 'pin':
96
+ return {
97
+ type: 'PIN',
98
+ result: {
99
+ nextAction: 'submitMSISDNAction',
100
+ config: strategyConfigs.default.flowConfig
101
+ }
102
+ };
103
+
104
+ case 'mo':
105
+ return {
106
+ type: 'MO',
107
+ result: {
108
+ nextAction: 'submitMSISDNAction',
109
+ config: strategyConfigs.default.flowConfig
110
+ }
111
+ };
112
+
113
+ case 'mo-redir':
114
+ return {
115
+ type: 'MO_REDIR',
116
+ result: {
117
+ nextAction: 'submitMSISDNAction',
118
+ config: strategyConfigs.default.flowConfig
119
+ }
120
+ };
121
+
122
+ case 'one-click':
123
+ return {
124
+ type: 'ONE_CLICK',
125
+ result: {
126
+ nextAction: 'getRedirectUrlAction',
127
+ config: strategyConfigs.default.flowConfig
128
+ }
129
+ };
130
+
131
+ case 'click2sms':
132
+ return {
133
+ type: 'CLICK2SMS',
134
+ result: {
135
+ nextAction: 'loadOc2sms',
136
+ config: strategyConfigs.default.flowConfig
137
+ }
138
+ };
139
+
140
+ case 'ussd':
141
+ return {
142
+ type: 'USSD',
143
+ result: {
144
+ nextAction: 'submitMSISDNAction',
145
+ config: strategyConfigs.default.flowConfig
146
+ }
147
+ };
148
+
149
+ default:
150
+ return {
151
+ type: 'IDENTIFY_STRATEGY',
152
+ result: RDS.Loading()
153
+ };
150
154
  }
151
155
  };
152
156
 
153
- console.log("NODE_ENV", process.env.NODE_ENV);
157
+ console.log('NODE_ENV', process.env.NODE_ENV);
154
158
  var store = (0, _redux.createStore)((0, _reducers.default)(), {
155
159
  strategy: {
156
160
  currentState: strategyBasedInitialState()
157
161
  },
158
162
  oneClickFlow: {
159
163
  currentState: {
160
- type: "GET_REDIRECT_URL",
164
+ type: 'GET_REDIRECT_URL',
161
165
  result: {
162
- type: "Success",
166
+ type: 'Success',
163
167
  data: {
164
- redirectUrl: "",
165
- nextAction: "getRedirectUrlAction"
168
+ redirectUrl: '',
169
+ nextAction: 'getRedirectUrlAction'
166
170
  }
167
171
  }
168
172
  }
169
173
  }
170
- }, (0, _redux.compose)(process.env.NODE_ENV == "development" ? (0, _redux.applyMiddleware)(_reduxThunk.default, log) : (0, _redux.applyMiddleware)(_reduxThunk.default) //...enhancers
174
+ }, (0, _redux.compose)(process.env.NODE_ENV == 'development' ? (0, _redux.applyMiddleware)(_reduxThunk.default, log) : (0, _redux.applyMiddleware)(_reduxThunk.default) // ...enhancers
171
175
  ));
172
176
  var _default = store;
173
177
  exports.default = _default;
@@ -1,10 +1,10 @@
1
- import { IStrategyReducerState } from "../reducers/strategy/StrategyTypes";
2
- import { IPinFlowReducerState } from "../reducers/pinFlow/PinTypes";
3
- import { IMoFlowReducerState } from "../reducers/moFlow/MoTypes";
4
- import { IMoRedirFlowReducerState } from "../reducers/moRedirFlow/MoRedirTypes";
5
- import { IOneClickFlowReducerState } from "../reducers/oneClickFlow/OneClickTypes";
6
- import { IClick2smsFlowReducerState } from "../reducers/click2smsFlow/Click2smsTypes";
7
- import { IUssdFlowReducerState } from "../reducers/ussdFlow/UssdTypes";
1
+ import { IClick2smsFlowReducerState } from '../reducers/click2smsFlow/Click2smsTypes';
2
+ import { IMoFlowReducerState } from '../reducers/moFlow/MoTypes';
3
+ import { IMoRedirFlowReducerState } from '../reducers/moRedirFlow/MoRedirTypes';
4
+ import { IOneClickFlowReducerState } from '../reducers/oneClickFlow/OneClickTypes';
5
+ import { IPinFlowReducerState } from '../reducers/pinFlow/PinTypes';
6
+ import { IStrategyReducerState } from '../reducers/strategy/StrategyTypes';
7
+ import { IUssdFlowReducerState } from '../reducers/ussdFlow/UssdTypes';
8
8
  export interface IApplicationState {
9
9
  strategy: IStrategyReducerState;
10
10
  pinFlow: IPinFlowReducerState;
@@ -7,9 +7,7 @@ exports.default = void 0;
7
7
 
8
8
  var _redux = require("redux");
9
9
 
10
- var _strategy = _interopRequireDefault(require("../reducers/strategy"));
11
-
12
- var _pinFlow = _interopRequireDefault(require("../reducers/pinFlow"));
10
+ var _click2smsFlow = _interopRequireDefault(require("../reducers/click2smsFlow"));
13
11
 
14
12
  var _moFlow = _interopRequireDefault(require("../reducers/moFlow"));
15
13
 
@@ -17,7 +15,9 @@ var _moRedirFlow = _interopRequireDefault(require("../reducers/moRedirFlow"));
17
15
 
18
16
  var _oneClickFlow = _interopRequireDefault(require("../reducers/oneClickFlow"));
19
17
 
20
- var _click2smsFlow = _interopRequireDefault(require("../reducers/click2smsFlow"));
18
+ var _pinFlow = _interopRequireDefault(require("../reducers/pinFlow"));
19
+
20
+ var _strategy = _interopRequireDefault(require("../reducers/strategy"));
21
21
 
22
22
  var _ussdFlow = _interopRequireDefault(require("../reducers/ussdFlow"));
23
23
 
@@ -1,11 +1,15 @@
1
+ import { Action } from 'redux';
2
+ import { ThunkDispatch } from 'redux-thunk';
3
+ import { AppThunk, IAllActionConstants } from '../common-types/AppThunk';
4
+ import { IApplicationState } from '../store/reducers';
1
5
  export declare const handleAutoSubmitMsisdn: ({ msisdnValue, dispatch, submitMSISDNAction, isHeaderEnrichmentSuccess, setMsisdnValue }: {
2
6
  msisdnValue: string;
3
- dispatch: (submitMSISDNAction: (msisdnValue: string) => void) => void;
4
- submitMSISDNAction: any;
7
+ dispatch: ThunkDispatch<IApplicationState, unknown, Action<IAllActionConstants>>;
8
+ submitMSISDNAction: (msisdnValue: string) => AppThunk;
5
9
  isHeaderEnrichmentSuccess: boolean;
6
10
  setMsisdnValue: (msisdnValue: string) => void;
7
11
  }) => void;
8
- export declare const handleFormSubmit: ({ isHeaderEnrichmentSuccess, country, setInternationalNumber, onEnd, internationalNumber }: {
12
+ export declare const handleFormSubmit: ({ isHeaderEnrichmentSuccess, setInternationalNumber, onEnd, internationalNumber }: {
9
13
  isHeaderEnrichmentSuccess: boolean;
10
14
  country: string;
11
15
  setInternationalNumber: (msisdn: string) => void;
@@ -24,8 +24,8 @@ var handleAutoSubmitMsisdn = function handleAutoSubmitMsisdn(_ref) {
24
24
  isHeaderEnrichmentSuccess = _ref.isHeaderEnrichmentSuccess,
25
25
  setMsisdnValue = _ref.setMsisdnValue;
26
26
 
27
- if (msisdnValue && msisdnValue.length > 3 && isHeaderEnrichmentSuccess == false) {
28
- var pn = new _awesomePhonenumber.default("+" + msisdnValue, process.env.country.toUpperCase());
27
+ if (msisdnValue && msisdnValue.length > 3 && isHeaderEnrichmentSuccess === false) {
28
+ var pn = new _awesomePhonenumber.default("+".concat(msisdnValue), process.env.country.toUpperCase());
29
29
 
30
30
  if (pn.isValid()) {
31
31
  dispatch(submitMSISDNAction(msisdnValue));
@@ -40,38 +40,35 @@ exports.handleAutoSubmitMsisdn = handleAutoSubmitMsisdn;
40
40
 
41
41
  var handleFormSubmit = function handleFormSubmit(_ref2) {
42
42
  var isHeaderEnrichmentSuccess = _ref2.isHeaderEnrichmentSuccess,
43
- country = _ref2.country,
44
43
  setInternationalNumber = _ref2.setInternationalNumber,
45
44
  onEnd = _ref2.onEnd,
46
45
  internationalNumber = _ref2.internationalNumber;
47
- var pn = new _awesomePhonenumber.default("+" + internationalNumber, process.env.country.toUpperCase());
46
+ var pn = new _awesomePhonenumber.default("+".concat(internationalNumber), process.env.country.toUpperCase());
48
47
  var countryCode = pn.getCountryCode();
49
- var networkType = isHeaderEnrichmentSuccess ? "mobile_data" : "wifi";
48
+ var networkType = isHeaderEnrichmentSuccess ? 'mobile_data' : 'wifi';
50
49
 
51
- if (isHeaderEnrichmentSuccess == true && process.env.country == "kw" && internationalNumber != "" && !pn.isValid()) {
50
+ if (isHeaderEnrichmentSuccess === true && process.env.country === 'kw' && internationalNumber != '' && !pn.isValid()) {
52
51
  setInternationalNumber(countryCode + internationalNumber);
53
52
  var newNumber = countryCode + internationalNumber;
54
53
  onEnd(newNumber.match(/\d+/gi).join(''));
55
- } else if (isHeaderEnrichmentSuccess == true && process.env.country == "ci") {
56
- //Special case Digital Virgo sents encrypted msisdn we dont need to validate is
54
+ } else if (isHeaderEnrichmentSuccess === true && process.env.country === 'ci') {
55
+ // Special case Digital Virgo sents encrypted msisdn we dont need to validate is
57
56
  var searchObj = (0, _utils.searchToObject)();
58
57
 
59
58
  if (searchObj.success && searchObj.msisdn) {
60
59
  var encryptedMsisdn = searchObj.msisdn;
61
60
  onEnd(encryptedMsisdn, {
62
61
  network_type: networkType,
63
- "skip-validation": "1"
62
+ 'skip-validation': '1'
64
63
  });
65
64
  }
66
- } else {
67
- if (!!internationalNumber) {
68
- if (process.env.country == "ci") {
69
- onEnd(internationalNumber.match(/\d+/gi).join(''), {
70
- network_type: networkType
71
- });
72
- } else {
73
- onEnd(internationalNumber.match(/\d+/gi).join(''));
74
- }
65
+ } else if (internationalNumber) {
66
+ if (process.env.country === 'ci') {
67
+ onEnd(internationalNumber.match(/\d+/gi).join(''), {
68
+ network_type: networkType
69
+ });
70
+ } else {
71
+ onEnd(internationalNumber.match(/\d+/gi).join(''));
75
72
  }
76
73
  }
77
74
  };