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
@@ -85,20 +85,20 @@ function _loadOnce() {
85
85
  while (1) {
86
86
  switch (_context.prev = _context.next) {
87
87
  case 0:
88
- if (!(!!maybeConfig && maybeConfig.tag == "keywordAndShortCode")) {
89
- _context.next = 5;
88
+ if (!(!!maybeConfig && maybeConfig.tag == 'keywordAndShortCode')) {
89
+ _context.next = 3;
90
90
  break;
91
91
  }
92
92
 
93
93
  _keyword = maybeConfig.keyword, _shortcode = maybeConfig.shortcode;
94
94
  return _context.abrupt("return", _objectSpread({
95
- type: "SingleSubmissionResult"
95
+ type: 'SingleSubmissionResult'
96
96
  }, {
97
97
  keyword: _keyword,
98
98
  shortcode: _shortcode
99
99
  }));
100
100
 
101
- case 5:
101
+ case 3:
102
102
  offer = window.pac_analytics.visitor.offer;
103
103
  config = _objectSpread({
104
104
  offer: window.pac_analytics.visitor.offer
@@ -106,28 +106,28 @@ function _loadOnce() {
106
106
  host = config.host, country = config.country, slug = config.slug;
107
107
  rockmanId = window.pac_analytics.visitor.rockmanId;
108
108
  search = window.location.search.substr(1) || '';
109
- _context.next = 12;
109
+ _context.next = 10;
110
110
  return window.tallymanApi.oc2sms(host, country, slug, offer, rockmanId, keyword, operator, search);
111
111
 
112
- case 12:
112
+ case 10:
113
113
  result = _context.sent;
114
114
 
115
115
  if (result.success) {
116
- _context.next = 17;
116
+ _context.next = 15;
117
117
  break;
118
118
  }
119
119
 
120
120
  throw result.message;
121
121
 
122
- case 17:
122
+ case 15:
123
123
  return _context.abrupt("return", _objectSpread({
124
- type: "SingleSubmissionResult"
124
+ type: 'SingleSubmissionResult'
125
125
  }, {
126
- keyword: "".concat(keyword || result.displayKeyword).concat(!!result.uid ? ' ' + result.uid : ''),
126
+ keyword: "".concat(keyword || result.displayKeyword).concat(result.uid ? " ".concat(result.uid) : ''),
127
127
  shortcode: result.shortcode
128
128
  }));
129
129
 
130
- case 18:
130
+ case 16:
131
131
  case "end":
132
132
  return _context.stop();
133
133
  }
@@ -231,7 +231,7 @@ function _loadForMultipleOperators() {
231
231
  }
232
232
  });
233
233
  return _context3.abrupt("return", {
234
- type: "MultiOperatorSubmissionResult",
234
+ type: 'MultiOperatorSubmissionResult',
235
235
  data: arrResult
236
236
  });
237
237
 
@@ -255,30 +255,30 @@ function _load() {
255
255
  while (1) {
256
256
  switch (_context4.prev = _context4.next) {
257
257
  case 0:
258
- if (!(!!maybeConfig && maybeConfig.tag == "keywordAndShortCode")) {
259
- _context4.next = 4;
258
+ if (!(!!maybeConfig && maybeConfig.tag == 'keywordAndShortCode')) {
259
+ _context4.next = 2;
260
260
  break;
261
261
  }
262
262
 
263
263
  return _context4.abrupt("return", _objectSpread({
264
- type: "SingleSubmissionResult"
264
+ type: 'SingleSubmissionResult'
265
265
  }, {
266
266
  keyword: maybeConfig.keyword,
267
267
  shortcode: maybeConfig.shortcode
268
268
  }));
269
269
 
270
- case 4:
271
- if (!(!!maybeConfig && maybeConfig.tag == "keyword")) {
272
- _context4.next = 8;
270
+ case 2:
271
+ if (!(!!maybeConfig && maybeConfig.tag == 'keyword')) {
272
+ _context4.next = 4;
273
273
  break;
274
274
  }
275
275
 
276
276
  return _context4.abrupt("return", load1(window, maybeConfig, keyword, shortcode));
277
277
 
278
- case 8:
278
+ case 4:
279
279
  return _context4.abrupt("return", load1(window, maybeConfig, null, null));
280
280
 
281
- case 9:
281
+ case 5:
282
282
  case "end":
283
283
  return _context4.stop();
284
284
  }
@@ -303,18 +303,18 @@ function _load2() {
303
303
  offer: window.pac_analytics.visitor.offer
304
304
  }, maybeConfig);
305
305
 
306
- if (!(true == config.automaticallySubmitAllOperators && !!config.operators && config.operators.length > 0)) {
307
- _context5.next = 5;
306
+ if (!(config.automaticallySubmitAllOperators == true && !!config.operators && config.operators.length > 0)) {
307
+ _context5.next = 3;
308
308
  break;
309
309
  }
310
310
 
311
311
  return _context5.abrupt("return", loadForMultipleOperators(window, maybeConfig, config.operators, keyword, shortcode));
312
312
 
313
- case 5:
313
+ case 3:
314
314
  singleOperator = maybeConfig.operators && maybeConfig.operators.length > 0 ? maybeConfig.operators[0] : null;
315
315
  return _context5.abrupt("return", loadOnce(window, maybeConfig, singleOperator, keyword, shortcode));
316
316
 
317
- case 7:
317
+ case 5:
318
318
  case "end":
319
319
  return _context5.stop();
320
320
  }
@@ -353,20 +353,20 @@ function _checkSubscription() {
353
353
  case 6:
354
354
  checkResult = _context6.sent;
355
355
 
356
- if (!(true === checkResult.success)) {
357
- _context6.next = 12;
356
+ if (!(checkResult.success === true)) {
357
+ _context6.next = 10;
358
358
  break;
359
359
  }
360
360
 
361
361
  window.location.href = checkResult.product_url;
362
362
  return _context6.abrupt("return", checkResult.product_url || null);
363
363
 
364
- case 12:
365
- error = new Error("SubscriptionFailed".concat(":\n", checkResult.message));
366
- error['type'] = "SubscriptionFailed";
364
+ case 10:
365
+ error = new Error('SubscriptionFailed'.concat(":\n", checkResult.message));
366
+ error.type = 'SubscriptionFailed';
367
367
  throw error;
368
368
 
369
- case 15:
369
+ case 13:
370
370
  case "end":
371
371
  return _context6.stop();
372
372
  }
@@ -1,2 +1,2 @@
1
- declare type IMoConstants = "MO_MSISDN_SUBMIT" | "MO_MSISDN_SUBMIT_ERROR" | "MO_BACK_TO_START" | "MOCK_MO_FLOW_STATE";
1
+ declare type IMoConstants = 'MO_MSISDN_SUBMIT' | 'MO_MSISDN_SUBMIT_ERROR' | 'MO_BACK_TO_START' | 'MOCK_MO_FLOW_STATE';
2
2
  export default IMoConstants;
@@ -1,10 +1,10 @@
1
- import * as RDS from "../../common-types/RemoteDataState";
2
- import { AppThunk } from "../../common-types/AppThunk";
1
+ import { AppThunk } from '../../common-types/AppThunk';
2
+ import * as RDS from '../../common-types/RemoteDataState';
3
3
  export declare type IMoFlowCurrentState = {
4
- type: "MSISDNEntry";
4
+ type: 'MSISDNEntry';
5
5
  result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
6
6
  };
7
- export declare type MSISDNEntryErrorTypes = "AlreadySubscribed" | "UnknownError" | "InvalidMSISDN" | "UnexpectedState";
7
+ export declare type MSISDNEntryErrorTypes = 'AlreadySubscribed' | 'UnknownError' | 'InvalidMSISDN' | 'UnexpectedState';
8
8
  export declare type MSISDNEntryFailure = {
9
9
  errorType: MSISDNEntryErrorTypes;
10
10
  error: any;
@@ -12,7 +12,7 @@ export declare type MSISDNEntryFailure = {
12
12
  };
13
13
  export declare type MSISDNEntrySuccess = IKeywordShortcode;
14
14
  export declare type IMsisnSubmitActionPayload = {
15
- type: "MSISDNEntry";
15
+ type: 'MSISDNEntry';
16
16
  result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
17
17
  };
18
18
  export interface IMoFlowReducerState {
@@ -23,7 +23,7 @@ export declare type IConfig = {
23
23
  slug?: string;
24
24
  country?: string;
25
25
  host?: string;
26
- device?: "smart" | "feature";
26
+ device?: 'smart' | 'feature';
27
27
  operators?: string[];
28
28
  };
29
29
  export declare type IKeywordShortcode = {
@@ -52,30 +52,30 @@ export declare type ICheckSubscriptionResult = {
52
52
  rockman_id: string;
53
53
  };
54
54
  export declare type IBackToStartPayload = {
55
- type: "MSISDNEntry";
55
+ type: 'MSISDNEntry';
56
56
  result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
57
57
  };
58
58
  export declare type IMoActions = {
59
- type: "MO_MSISDN_SUBMIT";
59
+ type: 'MO_MSISDN_SUBMIT';
60
60
  payload: IMsisnSubmitActionPayload;
61
61
  } | {
62
- type: "MO_MSISDN_SUBMIT_ERROR";
62
+ type: 'MO_MSISDN_SUBMIT_ERROR';
63
63
  payload: IMsisdnSubmitErrorPayload;
64
64
  } | {
65
- type: "MO_BACK_TO_START";
65
+ type: 'MO_BACK_TO_START';
66
66
  payload: IBackToStartPayload;
67
67
  } | {
68
- type: "MOCK_MO_FLOW_STATE";
68
+ type: 'MOCK_MO_FLOW_STATE';
69
69
  payload: IMoFlowCurrentState;
70
70
  };
71
71
  export declare type IMsisdnSubmitErrorPayload = {
72
- type: "MSISDNEntry";
72
+ type: 'MSISDNEntry';
73
73
  result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
74
74
  };
75
75
  export declare type IMoFlowActionMaps = {
76
76
  submitMSISDNAction: (msisdn: string) => AppThunk;
77
77
  };
78
- export declare type IMockMoFlowStates = "msisdn-entry-success-state" | "msisdn-entry-failure-state";
78
+ export declare type IMockMoFlowStates = 'msisdn-entry-success-state' | 'msisdn-entry-failure-state';
79
79
  export declare type IGoogleReCaptcha = {
80
80
  site_key: string;
81
81
  secret_key: string;
@@ -1,6 +1,6 @@
1
- import * as RDS from "../../common-types/RemoteDataState";
2
- import { MSISDNEntryFailure, IMoFlowReducerState, IMoActions, IMoFlowActionMaps, IMockMoFlowStates } from "./MoTypes";
3
- import { AppThunk } from "../../common-types/AppThunk";
1
+ import { AppThunk } from '../../common-types/AppThunk';
2
+ import * as RDS from '../../common-types/RemoteDataState';
3
+ import { IMoActions, IMockMoFlowStates, IMoFlowActionMaps, IMoFlowReducerState, MSISDNEntryFailure } from './MoTypes';
4
4
  export declare function submitMSISDNAction(msisdn: string, extraParams?: {
5
5
  [key: string]: string;
6
6
  }): AppThunk;
@@ -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, extraParams) {
82
82
  return /*#__PURE__*/function () {
83
83
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch, store) {
@@ -88,7 +88,7 @@ function submitMSISDNAction(msisdn, extraParams) {
88
88
  case 0:
89
89
  currentState = store().strategy.currentState;
90
90
 
91
- if (!(currentState.type === "MO")) {
91
+ if (!(currentState.type === 'MO')) {
92
92
  _context.next = 28;
93
93
  break;
94
94
  }
@@ -96,9 +96,9 @@ function submitMSISDNAction(msisdn, extraParams) {
96
96
  config = currentState.result.config;
97
97
  _context.prev = 3;
98
98
  dispatch({
99
- type: "MO_MSISDN_SUBMIT",
99
+ type: 'MO_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, extraParams) {
118
118
  });
119
119
 
120
120
  dispatch({
121
- type: "MO_MSISDN_SUBMIT",
121
+ type: 'MO_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, extraParams) {
150
150
  _context.prev = 20;
151
151
  _context.t1 = _context["catch"](3);
152
152
  console.warn(_context.t1);
153
- errorType = "AlreadySubscribed" === _context.t1.type ? "AlreadySubscribed" : "InvalidMSISDN" == _context.t1.type ? "InvalidMSISDN" : "UnknownError";
153
+ errorType = _context.t1.type === 'AlreadySubscribed' ? 'AlreadySubscribed' : _context.t1.type == 'InvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
154
154
 
155
155
  _strategy.tracker.recedeInFlow('tallyman.v1-mo', 'msisdn-submission-failure', {
156
156
  msisdn: msisdn,
@@ -158,9 +158,9 @@ function submitMSISDNAction(msisdn, extraParams) {
158
158
  });
159
159
 
160
160
  dispatch({
161
- type: "MO_MSISDN_SUBMIT_ERROR",
161
+ type: 'MO_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, extraParams) {
175
175
 
176
176
  case 28:
177
177
  dispatch({
178
- type: "MO_MSISDN_SUBMIT_ERROR",
178
+ type: 'MO_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":
@@ -202,9 +202,9 @@ function submitMSISDNAction(msisdn, extraParams) {
202
202
 
203
203
  function backToStart() {
204
204
  return {
205
- type: "MO_BACK_TO_START",
205
+ type: 'MO_BACK_TO_START',
206
206
  payload: {
207
- type: "MSISDNEntry",
207
+ type: 'MSISDNEntry',
208
208
  result: RDS.NothingYet()
209
209
  }
210
210
  };
@@ -214,20 +214,20 @@ function mockMoFlow(mockState) {
214
214
  return function (dispatch) {
215
215
  if (mockState !== undefined) {
216
216
  switch (mockState) {
217
- case "msisdn-entry-failure-state":
217
+ case 'msisdn-entry-failure-state':
218
218
  return dispatch({
219
- type: "MOCK_MO_FLOW_STATE",
219
+ type: 'MOCK_MO_FLOW_STATE',
220
220
  payload: _utils.mockedMSISDNEntryFailure.currentState
221
221
  });
222
222
 
223
- case "msisdn-entry-success-state":
223
+ case 'msisdn-entry-success-state':
224
224
  return dispatch({
225
- type: "MOCK_MO_FLOW_STATE",
225
+ type: 'MOCK_MO_FLOW_STATE',
226
226
  payload: _utils.mockedMSISDNEntrySuccess.currentState
227
227
  });
228
228
 
229
229
  default:
230
- throw "Mock Flow not supported";
230
+ throw 'Mock Flow not supported';
231
231
  }
232
232
  }
233
233
  };
@@ -235,7 +235,7 @@ function mockMoFlow(mockState) {
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 MoFlowReducer() {
249
249
  var action = arguments.length > 1 ? arguments[1] : undefined;
250
250
 
251
251
  switch (action.type) {
252
- case "MO_MSISDN_SUBMIT":
252
+ case 'MO_MSISDN_SUBMIT':
253
253
  return (0, _strategy.genericHandler)(state, action.payload);
254
254
 
255
- case "MO_BACK_TO_START":
255
+ case 'MO_BACK_TO_START':
256
256
  return (0, _strategy.genericHandler)(state, action.payload);
257
257
 
258
- case "MO_MSISDN_SUBMIT_ERROR":
258
+ case 'MO_MSISDN_SUBMIT_ERROR':
259
259
  return (0, _strategy.genericHandler)(state, action.payload);
260
260
 
261
- case "MOCK_MO_FLOW_STATE":
261
+ case 'MOCK_MO_FLOW_STATE':
262
262
  return (0, _strategy.genericHandler)(state, action.payload);
263
263
 
264
264
  default:
@@ -1,5 +1,4 @@
1
- import { IConfig, IMoFlowReducerState, IGoogleReCaptcha } from "./MoTypes";
2
- import { IKeywordShortcode } from "./MoTypes";
1
+ import { IConfig, IGoogleReCaptcha, IKeywordShortcode, IMoFlowReducerState } from './MoTypes';
3
2
  export default function submitMSISDN(window: Window, maybeConfig: IConfig, internationalMSISDN: string, extraParams?: {
4
3
  [key: string]: string;
5
4
  }): Promise<IKeywordShortcode>;
@@ -91,7 +91,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
91
91
  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); }); }; }
92
92
 
93
93
  var wait = function wait(ms) {
94
- return (//@ts-ignore
94
+ return (// @ts-ignore
95
95
  new Promise(function (resolve) {
96
96
  return setTimeout(function () {
97
97
  return resolve();
@@ -114,20 +114,20 @@ var loop = /*#__PURE__*/function () {
114
114
  r = _context.sent;
115
115
 
116
116
  if (!(stop(r) || i >= max)) {
117
- _context.next = 7;
117
+ _context.next = 5;
118
118
  break;
119
119
  }
120
120
 
121
121
  return _context.abrupt("return", r);
122
122
 
123
- case 7:
124
- _context.next = 9;
123
+ case 5:
124
+ _context.next = 7;
125
125
  return wait(1000);
126
126
 
127
- case 9:
127
+ case 7:
128
128
  return _context.abrupt("return", loop(f, max, stop, i + 1));
129
129
 
130
- case 10:
130
+ case 8:
131
131
  case "end":
132
132
  return _context.stop();
133
133
  }
@@ -142,11 +142,11 @@ var loop = /*#__PURE__*/function () {
142
142
 
143
143
  var getConfig = function getConfig() {
144
144
  try {
145
- var configs = require("../../../../../config.json");
145
+ var configs = require('../../../../../config.json');
146
146
 
147
147
  return configs;
148
148
  } catch (ex) {
149
- throw "config.json not found";
149
+ throw 'config.json not found';
150
150
  }
151
151
  };
152
152
 
@@ -230,9 +230,9 @@ function _submitMSISDNWithConfig() {
230
230
  case 0:
231
231
  slug = config.slug, country = config.country, device = config.device, offer = config.offer, host = config.host;
232
232
  search = window.location.search.substr(1) || '';
233
- extraParamsQs = !extraParams ? '' : '&' + Object.keys(extraParams).map(function (k) {
233
+ extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
234
234
  return "".concat(k, "=").concat(extraParams[k]);
235
- }).join('&');
235
+ }).join('&'));
236
236
  msisdn = internationalMSISDN.match(/\d+/gi).join('');
237
237
  rockmanId = window.pac_analytics.visitor.rockmanId;
238
238
  _context4.next = 7;
@@ -241,15 +241,15 @@ function _submitMSISDNWithConfig() {
241
241
  case 7:
242
242
  result = _context4.sent;
243
243
 
244
- if (!(false === result.success)) {
244
+ if (!(result.success === false)) {
245
245
  _context4.next = 17;
246
246
  break;
247
247
  }
248
248
 
249
- type = result.message == 'ALREADY SUBSCRIBED' ? "AlreadySubscribed" : "InvalidMSISDN";
249
+ type = result.message == 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMSISDN';
250
250
  error = new Error("".concat(type, ":\n").concat(result.message));
251
- error['type'] = type;
252
- error['productUrl'] = result.product_url ? result.product_url : "";
251
+ error.type = type;
252
+ error.productUrl = result.product_url ? result.product_url : '';
253
253
  console.error(error);
254
254
  throw error;
255
255
 
@@ -295,20 +295,20 @@ function _checkSubscription() {
295
295
  case 6:
296
296
  checkResult = _context5.sent;
297
297
 
298
- if (!(true === checkResult.success)) {
299
- _context5.next = 12;
298
+ if (!(checkResult.success === true)) {
299
+ _context5.next = 10;
300
300
  break;
301
301
  }
302
302
 
303
303
  window.location.href = checkResult.product_url;
304
304
  return _context5.abrupt("return", checkResult.product_url || null);
305
305
 
306
- case 12:
307
- error = new Error("SubscriptionFailed".concat(":\n", checkResult.message));
308
- error['type'] = "SubscriptionFailed";
306
+ case 10:
307
+ error = new Error('SubscriptionFailed'.concat(":\n", checkResult.message));
308
+ error.type = 'SubscriptionFailed';
309
309
  throw error;
310
310
 
311
- case 15:
311
+ case 13:
312
312
  case "end":
313
313
  return _context5.stop();
314
314
  }
@@ -319,15 +319,17 @@ function _checkSubscription() {
319
319
  }
320
320
 
321
321
  var formatSMSLink = function formatSMSLink(keywordAndShortcode) {
322
- return (//@ts-ignore
323
- !!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)
322
+ return (// @ts-ignore
323
+ !!window.pac_analytics.visitor['x-requested-with'] && // @ts-ignore
324
+ window.pac_analytics.visitor['x-requested-with'] !== null && // @ts-ignore
325
+ 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)
324
326
  );
325
327
  };
326
328
 
327
329
  exports.formatSMSLink = formatSMSLink;
328
330
  var mockedMSISDNEntrySuccess = {
329
331
  currentState: {
330
- type: "MSISDNEntry",
332
+ type: 'MSISDNEntry',
331
333
  result: RDS.Success({
332
334
  keyword: 'TEST OK',
333
335
  shortcode: '666'
@@ -337,10 +339,10 @@ var mockedMSISDNEntrySuccess = {
337
339
  exports.mockedMSISDNEntrySuccess = mockedMSISDNEntrySuccess;
338
340
  var mockedMSISDNEntryFailure = {
339
341
  currentState: {
340
- type: "MSISDNEntry",
342
+ type: 'MSISDNEntry',
341
343
  result: RDS.Failure({
342
- errorType: "InvalidMSISDN",
343
- error: "Invalid Mobile Number"
344
+ errorType: 'InvalidMSISDN',
345
+ error: 'Invalid Mobile Number'
344
346
  })
345
347
  }
346
348
  };
@@ -1,2 +1,2 @@
1
- declare type IMoRedirConstants = "MO_REDIR_MSISDN_SUBMIT" | "MO_REDIR_MSISDN_SUBMIT_ERROR" | "MO_REDIR_BACK_TO_START" | "MOCK_MO_REDIR_FLOW_STATE";
1
+ declare type IMoRedirConstants = 'MO_REDIR_MSISDN_SUBMIT' | 'MO_REDIR_MSISDN_SUBMIT_ERROR' | 'MO_REDIR_BACK_TO_START' | 'MOCK_MO_REDIR_FLOW_STATE';
2
2
  export default IMoRedirConstants;
@@ -1,10 +1,10 @@
1
- import * as RDS from "../../common-types/RemoteDataState";
2
- import { AppThunk } from "../../common-types/AppThunk";
1
+ import { AppThunk } from '../../common-types/AppThunk';
2
+ import * as RDS from '../../common-types/RemoteDataState';
3
3
  export declare type IMoRedirFlowCurrentState = {
4
- type: "MSISDNEntry";
4
+ type: 'MSISDNEntry';
5
5
  result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
6
6
  };
7
- export declare type MSISDNEntryErrorTypes = "AlreadySubscribed" | "UnknownError" | "InvalidMSISDN" | "UnexpectedState";
7
+ export declare type MSISDNEntryErrorTypes = 'AlreadySubscribed' | 'UnknownError' | 'InvalidMSISDN' | 'UnexpectedState';
8
8
  export declare type MSISDNEntryFailure = {
9
9
  errorType: MSISDNEntryErrorTypes;
10
10
  error: any;
@@ -14,7 +14,7 @@ export declare type MSISDNEntrySuccess = {
14
14
  href: string;
15
15
  };
16
16
  export declare type IMsisnSubmitActionPayload = {
17
- type: "MSISDNEntry";
17
+ type: 'MSISDNEntry';
18
18
  result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
19
19
  };
20
20
  export interface IMoRedirFlowReducerState {
@@ -25,7 +25,7 @@ export declare type IConfig = {
25
25
  slug?: string;
26
26
  country?: string;
27
27
  host?: string;
28
- device?: "smart" | "feature";
28
+ device?: 'smart' | 'feature';
29
29
  operators?: string[];
30
30
  };
31
31
  export declare type IMSISDNSubmissionResult = {
@@ -38,27 +38,27 @@ export declare type IMSISDNSubmissionResult = {
38
38
  message: string;
39
39
  };
40
40
  export declare type IBackToStartPayload = {
41
- type: "MSISDNEntry";
41
+ type: 'MSISDNEntry';
42
42
  result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
43
43
  };
44
44
  export declare type IMoRedirActions = {
45
- type: "MO_REDIR_MSISDN_SUBMIT";
45
+ type: 'MO_REDIR_MSISDN_SUBMIT';
46
46
  payload: IMsisnSubmitActionPayload;
47
47
  } | {
48
- type: "MO_REDIR_MSISDN_SUBMIT_ERROR";
48
+ type: 'MO_REDIR_MSISDN_SUBMIT_ERROR';
49
49
  payload: IMsisdnSubmitErrorPayload;
50
50
  } | {
51
- type: "MO_REDIR_BACK_TO_START";
51
+ type: 'MO_REDIR_BACK_TO_START';
52
52
  payload: IBackToStartPayload;
53
53
  } | {
54
- type: "MOCK_MO_REDIR_FLOW_STATE";
54
+ type: 'MOCK_MO_REDIR_FLOW_STATE';
55
55
  payload: IMoRedirFlowCurrentState;
56
56
  };
57
57
  export declare type IMsisdnSubmitErrorPayload = {
58
- type: "MSISDNEntry";
58
+ type: 'MSISDNEntry';
59
59
  result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
60
60
  };
61
61
  export declare type IMoRedirFlowActionMaps = {
62
62
  submitMSISDNAction: (internationalMSISDN: string, bupperMSISDN?: string, rockman_id?: string) => AppThunk;
63
63
  };
64
- export declare type IMockMoRedirFlowStates = "msisdn-entry-success-state" | "msisdn-entry-failure-state";
64
+ export declare type IMockMoRedirFlowStates = 'msisdn-entry-success-state' | 'msisdn-entry-failure-state';
@@ -1,6 +1,6 @@
1
- import * as RDS from "../../common-types/RemoteDataState";
2
- import { MSISDNEntryFailure, IMoRedirFlowReducerState, MSISDNEntrySuccess, IMoRedirActions, IMoRedirFlowActionMaps, IMockMoRedirFlowStates } from "./MoRedirTypes";
3
- import { AppThunk } from "../../common-types/AppThunk";
1
+ import { AppThunk } from '../../common-types/AppThunk';
2
+ import * as RDS from '../../common-types/RemoteDataState';
3
+ import { IMockMoRedirFlowStates, IMoRedirActions, IMoRedirFlowActionMaps, IMoRedirFlowReducerState, MSISDNEntryFailure, MSISDNEntrySuccess } from './MoRedirTypes';
4
4
  export declare function submitMSISDNAction(msisdn: string): AppThunk;
5
5
  export declare function backToStart(): {
6
6
  type: string;