ouisys-engine 3.0.1 → 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 +70 -69
  53. package/dist/reducers/pinFlow/IPinConstants.d.ts +1 -1
  54. package/dist/reducers/pinFlow/PinTypes.d.ts +24 -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 +3 -2
  64. package/dist/reducers/strategy/strategies/ask_mobile_number.js +132 -74
  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 -217
  174. package/src/reducers/pinFlow/IPinConstants.ts +0 -9
  175. package/src/reducers/pinFlow/PinTypes.ts +0 -189
  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 -375
  180. package/src/reducers/strategy/index.ts +0 -321
  181. package/src/reducers/strategy/strategies/ask_mobile_number.ts +0 -316
  182. package/src/reducers/strategy/strategies/ask_operator.ts +0 -195
  183. package/src/reducers/strategy/strategies/detect_operator_by_ip.ts +0 -414
  184. package/src/reducers/strategy/strategies/header_enrichment.ts +0 -489
  185. package/src/reducers/strategy/utils.ts +0 -357
  186. package/src/reducers/ussdFlow/IUssdConstants.ts +0 -7
  187. package/src/reducers/ussdFlow/UssdTypes.ts +0 -112
  188. package/src/reducers/ussdFlow/index.ts +0 -146
  189. package/src/reducers/ussdFlow/utils.ts +0 -88
  190. package/src/store/index.ts +0 -150
  191. package/src/store/reducers.ts +0 -37
  192. package/src/utilities/handleSubmitNumber.ts +0 -65
  193. package/src/utilities/index.ts +0 -114
  194. package/src/utilities/loadScriptInnerHtml.ts +0 -14
  195. package/src/utilities/loadScriptSrc.ts +0 -26
@@ -1,5 +1,5 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
- import { IMoRedirFlowCurrentState, MSISDNEntryFailure, MSISDNEntrySuccess } from "../reducers/moRedirFlow/MoRedirTypes";
1
+ import * as RDS from '../common-types/RemoteDataState';
2
+ import { IMoRedirFlowCurrentState, MSISDNEntryFailure, MSISDNEntrySuccess } from '../reducers/moRedirFlow/MoRedirTypes';
3
3
  declare function moRedirFlowMatch<R>({ msisdnEntry }: {
4
4
  msisdnEntry: (rds: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>) => R;
5
5
  }): (state: IMoRedirFlowCurrentState) => R;
@@ -1,5 +1,5 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
- import { IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess, IOneClickCurrentState, SubscribeFailure, SubscribeSuccess } from "../reducers/oneClickFlow/OneClickTypes";
1
+ import * as RDS from '../common-types/RemoteDataState';
2
+ import { IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess, IOneClickCurrentState, SubscribeFailure, SubscribeSuccess } from '../reducers/oneClickFlow/OneClickTypes';
3
3
  declare function oneClickFlowMatch<R>({ getRedirectUrl, subscribe }: {
4
4
  getRedirectUrl: (rds: RDS.RemoteDataState<IGETREDIRECTURLFailure, IGETREDIRECTURLSuccess>) => R;
5
5
  subscribe?: (rds: RDS.RemoteDataState<SubscribeFailure, SubscribeSuccess>) => R;
@@ -1,5 +1,5 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
- import { MSISDNEntryFailure, MSISDNEntrySuccess, PINEntryFailure, PINEntrySuccess, IPinFlowCurrentState, IMsisdnSumbitNextData } from "../reducers/pinFlow/PinTypes";
1
+ import * as RDS from '../common-types/RemoteDataState';
2
+ import { IMsisdnSumbitNextData, IPinFlowCurrentState, MSISDNEntryFailure, MSISDNEntrySuccess, PINEntryFailure, PINEntrySuccess } from '../reducers/pinFlow/PinTypes';
3
3
  declare function pinFlowMatch<R>({ msisdnEntry, pinEntry }: {
4
4
  msisdnEntry: (rds: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>) => R;
5
5
  pinEntry: (rds: RDS.RemoteDataState<PINEntryFailure, PINEntrySuccess>, nextData: IMsisdnSumbitNextData) => R;
@@ -8,7 +8,9 @@ exports.default = void 0;
8
8
  function pinFlowMatch(_ref) {
9
9
  var msisdnEntry = _ref.msisdnEntry,
10
10
  pinEntry = _ref.pinEntry;
11
+ // eslint-disable-next-line consistent-return
11
12
  return function (state) {
13
+ // eslint-disable-next-line default-case
12
14
  switch (state.type) {
13
15
  case 'MSISDNEntry':
14
16
  return msisdnEntry(state.result);
@@ -1,13 +1,13 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
- import { OPERATORSelectFlowIdentifySuccess, IStrategyCurrentState, IIdenyifyFlowByMsisdnSumbitNextData, IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess, IdentifyFlowOptionsResult } from '../reducers/strategy/StrategyTypes';
1
+ import * as RDS from '../common-types/RemoteDataState';
2
+ import { IdentifyFlowOptionsResult, IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess, IIdenyifyFlowByMsisdnSumbitNextData, IStrategyCurrentState, OPERATORSelectFlowIdentifySuccess } from '../reducers/strategy/StrategyTypes';
3
3
  declare function strategy<R>({ identifyFlowByOperatorSelect, identifyFlowByMsisdn, pinFlow, moFlow, moRedirFlow, oneClickFlow, click2smsFlow, ussdFlow }: {
4
4
  identifyFlowByOperatorSelect: (data: OPERATORSelectFlowIdentifySuccess) => R;
5
5
  identifyFlowByMsisdn: (rds: RDS.RemoteDataState<IDENTIFYMSISDNEntryFailure, IDENTIFYMSISDNEntrySuccess>, nextData: IIdenyifyFlowByMsisdnSumbitNextData) => R;
6
- pinFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R;
7
- moFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R;
8
- moRedirFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R;
9
- oneClickFlow: (data: IdentifyFlowOptionsResult<"getRedirectUrlAction">) => R;
10
- click2smsFlow: (data: IdentifyFlowOptionsResult<"loadOc2sms">) => R;
11
- ussdFlow: (data: IdentifyFlowOptionsResult<"submitMSISDNAction">) => R;
6
+ pinFlow: (data: IdentifyFlowOptionsResult<'submitMSISDNAction'>) => R;
7
+ moFlow: (data: IdentifyFlowOptionsResult<'submitMSISDNAction'>) => R;
8
+ moRedirFlow: (data: IdentifyFlowOptionsResult<'submitMSISDNAction'>) => R;
9
+ oneClickFlow: (data: IdentifyFlowOptionsResult<'getRedirectUrlAction'>) => R;
10
+ click2smsFlow: (data: IdentifyFlowOptionsResult<'loadOc2sms'>) => R;
11
+ ussdFlow: (data: IdentifyFlowOptionsResult<'submitMSISDNAction'>) => R;
12
12
  }): (state: IStrategyCurrentState) => R;
13
13
  export default strategy;
@@ -1,5 +1,5 @@
1
- import * as RDS from "../common-types/RemoteDataState";
2
- import { IUssdFlowCurrentState, MSISDNEntryFailure, MSISDNEntrySuccess } from "../reducers/ussdFlow/UssdTypes";
1
+ import * as RDS from '../common-types/RemoteDataState';
2
+ import { IUssdFlowCurrentState, MSISDNEntryFailure, MSISDNEntrySuccess } from '../reducers/ussdFlow/UssdTypes';
3
3
  declare function ussdFlowMatch<R>({ msisdnEntry }: {
4
4
  msisdnEntry: (rds: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>) => R;
5
5
  }): (state: IUssdFlowCurrentState) => R;
@@ -1,2 +1,2 @@
1
- import IVisitor from "../common-types/IVisitor";
1
+ import IVisitor from '../common-types/IVisitor';
2
2
  export default function tryGetIPRangeName(visitor: IVisitor): Promise<string>;
@@ -41,6 +41,8 @@ require("core-js/modules/es.object.to-string.js");
41
41
 
42
42
  require("core-js/modules/es.promise.js");
43
43
 
44
+ require("core-js/modules/es.array.concat.js");
45
+
44
46
  var _queryString = _interopRequireDefault(require("../pacman/queryString"));
45
47
 
46
48
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -62,10 +64,10 @@ function _tryGetIPRangeName() {
62
64
  while (1) {
63
65
  switch (_context.prev = _context.next) {
64
66
  case 0:
65
- mockip = (0, _queryString.default)(window.location.href, "mock-ip") || process.env.mock_ip;
66
- console.log("mockip", mockip);
67
+ mockip = (0, _queryString.default)(window.location.href, 'mock-ip') || process.env.mock_ip;
68
+ console.log('mockip', mockip);
67
69
 
68
- if (!(!visitor.ip && typeof window != "undefined")) {
70
+ if (!(!visitor.ip && typeof window !== 'undefined')) {
69
71
  _context.next = 18;
70
72
  break;
71
73
  }
@@ -73,7 +75,7 @@ function _tryGetIPRangeName() {
73
75
  _context.prev = 3;
74
76
  host = window.location.host;
75
77
  _context.next = 7;
76
- return fetch("https://".concat(host, "/api/v1/ip") + (!!mockip ? "?mock-ip=".concat(mockip) : "")).then(function (x) {
78
+ return fetch("https://".concat(host, "/api/v1/ip").concat(mockip ? "?mock-ip=".concat(mockip) : '')).then(function (x) {
77
79
  return x.json();
78
80
  });
79
81
 
@@ -87,7 +89,7 @@ function _tryGetIPRangeName() {
87
89
  case 13:
88
90
  _context.prev = 13;
89
91
  _context.t0 = _context["catch"](3);
90
- console.warn("IP Lookup failed", _context.t0);
92
+ console.warn('IP Lookup failed', _context.t0);
91
93
 
92
94
  case 16:
93
95
  _context.next = 19;
@@ -12,7 +12,7 @@ module.exports = {
12
12
  // cacheDirectory: "/private/var/folders/wr/8ghl3gfx0cldjmd7jhzs8gt80000gn/T/jest_dx",
13
13
 
14
14
  // Automatically clear mock calls and instances between every test
15
- clearMocks: true
15
+ clearMocks: true,
16
16
 
17
17
  // Indicates whether the coverage information should be collected while executing the test
18
18
  // collectCoverage: false,
@@ -1,5 +1,5 @@
1
- import queryString from "./queryString";
2
- import { ITrackerFlowEvents } from "pacman-client/.build-lib/Pacman/types";
1
+ import { ITrackerFlowEvents } from 'pacman-client/.build-lib/Pacman/types';
2
+ import queryString from './queryString';
3
3
  export { queryString };
4
4
  export type { ITrackerFlowEvents as ITracker };
5
5
  declare const _default: (window: Window, country?: string, page?: string) => ITrackerFlowEvents;
@@ -31,11 +31,11 @@ require("core-js/modules/es.string.search.js");
31
31
 
32
32
  require("core-js/modules/es.string.replace.js");
33
33
 
34
- var _queryString2 = _interopRequireDefault(require("./queryString"));
34
+ var _pacmanClient = _interopRequireDefault(require("pacman-client"));
35
35
 
36
36
  var _v = _interopRequireDefault(require("uuid/v1"));
37
37
 
38
- var _pacmanClient = _interopRequireDefault(require("pacman-client"));
38
+ var _queryString2 = _interopRequireDefault(require("./queryString"));
39
39
 
40
40
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
41
 
@@ -64,46 +64,46 @@ var _default = function _default(window, country, page) {
64
64
  return void 6;
65
65
  }
66
66
  };
67
- } else {
68
- var url = !!window.pac_analytics ? window.pac_analytics.url : (0, _queryString2.default)(window.location.search, "pacman-server") || "/analytics";
69
-
70
- if (!window.pac_analytics) {
71
- var rockmanId = (0, _v.default)().replace(/-/g, "");
72
- var campaignId = parseInt((0, _queryString2.default)(window.location.search, "cid")) || 2;
73
- window.pac_analytics = {
74
- visitor: {
75
- rockmanId: rockmanId,
76
- impressionNumber: 1,
77
- //TODO: get impressionNumber from localStorage
78
- country: country,
79
- page: page,
80
- xaid: (0, _queryString2.default)(window.location.search, "xaid"),
81
- cid: campaignId,
82
- offer: parseInt((0, _queryString2.default)(window.location.search, "offer")) || 1 // default to 1 offer id
83
-
84
- },
85
- startTime: new Date().valueOf(),
86
- queryString: function queryString(key) {
87
- return (0, _queryString2.default)(window.location.search, key);
88
- },
89
- url: url,
90
- userId: rockmanId,
91
- encCampaignId: (0, _queryString2.default)(window.location.search, "xcid"),
92
- originalUrl: document.location.href
93
- };
94
- }
95
-
96
- var pacmanClient = (0, _pacmanClient.default)({
97
- rockmanId: window.pac_analytics.visitor.rockmanId,
98
- serverUrl: process.env.pacman_server,
99
- impressionNumber: 1,
100
- signalInterval: 1000 // in milliseconds
101
-
102
- });
103
- return _objectSpread({
104
- sendOptInFlowEvent: pacmanClient.sendOptInFlowEvent
105
- }, pacmanClient.trackerFlowEvents);
106
67
  }
68
+
69
+ var url = window.pac_analytics ? window.pac_analytics.url : (0, _queryString2.default)(window.location.search, 'pacman-server') || '/analytics';
70
+
71
+ if (!window.pac_analytics) {
72
+ var rockmanId = (0, _v.default)().replace(/-/g, '');
73
+ var campaignId = parseInt((0, _queryString2.default)(window.location.search, 'cid')) || 2;
74
+ window.pac_analytics = {
75
+ visitor: {
76
+ rockmanId: rockmanId,
77
+ impressionNumber: 1,
78
+ // TODO: get impressionNumber from localStorage
79
+ country: country,
80
+ page: page,
81
+ xaid: (0, _queryString2.default)(window.location.search, 'xaid'),
82
+ cid: campaignId,
83
+ offer: parseInt((0, _queryString2.default)(window.location.search, 'offer')) || 1 // default to 1 offer id
84
+
85
+ },
86
+ startTime: new Date().valueOf(),
87
+ queryString: function queryString(key) {
88
+ return (0, _queryString2.default)(window.location.search, key);
89
+ },
90
+ url: url,
91
+ userId: rockmanId,
92
+ encCampaignId: (0, _queryString2.default)(window.location.search, 'xcid'),
93
+ originalUrl: document.location.href
94
+ };
95
+ }
96
+
97
+ var pacmanClient = (0, _pacmanClient.default)({
98
+ rockmanId: window.pac_analytics.visitor.rockmanId,
99
+ serverUrl: process.env.pacman_server,
100
+ impressionNumber: 1,
101
+ signalInterval: 1000 // in milliseconds
102
+
103
+ });
104
+ return _objectSpread({
105
+ sendOptInFlowEvent: pacmanClient.sendOptInFlowEvent
106
+ }, pacmanClient.trackerFlowEvents);
107
107
  };
108
108
 
109
109
  exports.default = _default;
@@ -18,13 +18,15 @@ require("core-js/modules/es.regexp.to-string.js");
18
18
 
19
19
  require("core-js/modules/es.string.match.js");
20
20
 
21
+ require("core-js/modules/es.array.concat.js");
22
+
21
23
  var _default = function _default(url, paramName) {
22
- var name = paramName.replace(/[\[\]]/g, "\\$&");
23
- var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)", "i"),
24
- results = regex.exec(url);
24
+ var name = paramName.replace(/[\[\]]/g, '\\$&');
25
+ var regex = new RegExp("[?&]".concat(name, "(=([^&#]*)|&|#|$)"), 'i');
26
+ var results = regex.exec(url);
25
27
  if (!results) return null;
26
- if (!results[2]) return "";
27
- return decodeURIComponent(results[2].replace(/\+/g, " "));
28
+ if (!results[2]) return '';
29
+ return decodeURIComponent(results[2].replace(/\+/g, ' '));
28
30
  };
29
31
 
30
32
  exports.default = _default;
@@ -34,13 +36,13 @@ function updateUrlParameter(uri, key, value) {
34
36
  var i = uri.indexOf('#');
35
37
  var hash = i === -1 ? '' : uri.substr(i);
36
38
  uri = i === -1 ? uri : uri.substr(0, i);
37
- var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
38
- var separator = uri.indexOf('?') !== -1 ? "&" : "?";
39
+ var re = new RegExp("([?&])".concat(key, "=.*?(&|$)"), 'i');
40
+ var separator = uri.indexOf('?') !== -1 ? '&' : '?';
39
41
 
40
42
  if (uri.match(re)) {
41
- uri = uri.replace(re, '$1' + key + "=" + value + '$2');
43
+ uri = uri.replace(re, "$1".concat(key, "=").concat(value, "$2"));
42
44
  } else {
43
- uri = uri + separator + key + "=" + value;
45
+ uri = "".concat(uri + separator + key, "=").concat(value);
44
46
  }
45
47
 
46
48
  return uri + hash; // finally append the hash as well
@@ -1,14 +1,14 @@
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 IWithMultiKeywordShortcode = IKeywordShortcode & {
4
4
  type?: string;
5
5
  data?: Array<IKeywordShortcode>;
6
6
  };
7
7
  export declare type IClick2smsFlowCurrentState = {
8
- type: "LOAD_OC2SMS";
8
+ type: 'LOAD_OC2SMS';
9
9
  result: RDS.RemoteDataState<string, IWithMultiKeywordShortcode>;
10
10
  };
11
- export declare type MSISDNEntryErrorTypes = "AlreadySubscribed" | "UnknownError" | "InvalidMSISDN" | "UnexpectedState";
11
+ export declare type MSISDNEntryErrorTypes = 'AlreadySubscribed' | 'UnknownError' | 'InvalidMSISDN' | 'UnexpectedState';
12
12
  export declare type ILOADOC2SMSFailure = {
13
13
  errorType: MSISDNEntryErrorTypes;
14
14
  error: any;
@@ -16,7 +16,7 @@ export declare type ILOADOC2SMSFailure = {
16
16
  };
17
17
  export declare type ILOADOC2SMSSuccess = IKeywordShortcode;
18
18
  export declare type ILoadOc2click2smsPayload = {
19
- type: "LOAD_OC2SMS";
19
+ type: 'LOAD_OC2SMS';
20
20
  payload: RDS.RemoteDataState<string, IWithMultiKeywordShortcode>;
21
21
  };
22
22
  export interface IClick2smsFlowReducerState {
@@ -34,18 +34,18 @@ declare type Config = {
34
34
  automaticallySubmitAllOperators?: boolean;
35
35
  operators?: string[];
36
36
  };
37
- export declare type IConfig = {
38
- tag: "tallyman";
39
- } & Config | {
40
- tag: "keywordAndShortCode";
41
- } & IKeywordShortcode & Config | {
42
- tag: "keyword";
43
- } & Config;
37
+ export declare type IConfig = ({
38
+ tag: 'tallyman';
39
+ } & Config) | ({
40
+ tag: 'keywordAndShortCode';
41
+ } & IKeywordShortcode & Config) | ({
42
+ tag: 'keyword';
43
+ } & Config);
44
44
  export declare type SingleSubmissionResult = IKeywordShortcode & {
45
- type: "SingleSubmissionResult";
45
+ type: 'SingleSubmissionResult';
46
46
  };
47
47
  export declare type MultiOperatorSubmissionResult = {
48
- type: "MultiOperatorSubmissionResult";
48
+ type: 'MultiOperatorSubmissionResult';
49
49
  data: Array<IKeywordShortcode>;
50
50
  };
51
51
  export declare type ICheckSubscriptionResult = {
@@ -59,14 +59,14 @@ export declare type ICheckSubscriptionResult = {
59
59
  rockman_id: string;
60
60
  };
61
61
  export declare type IClick2SmsActions = {
62
- type: "LOAD_OC2SMS";
62
+ type: 'LOAD_OC2SMS';
63
63
  payload: ILoadOc2click2smsPayload;
64
64
  };
65
65
  export declare type IFetchResult = {
66
- "success": boolean;
67
- "uid": string;
68
- "shortcode": string;
69
- "keyword": string;
66
+ success: boolean;
67
+ uid: string;
68
+ shortcode: string;
69
+ keyword: string;
70
70
  displayKeyword: string;
71
71
  message?: string;
72
72
  };
@@ -1,2 +1,2 @@
1
- declare type IClick2smsConstants = "LOAD_OC2SMS";
1
+ declare type IClick2smsConstants = 'LOAD_OC2SMS';
2
2
  export default IClick2smsConstants;
@@ -1,5 +1,5 @@
1
- import { IClick2smsFlowReducerState, IClick2SmsFlowActionMaps, IClick2SmsActions } from "./Click2smsTypes";
2
- import { AppThunk } from "../../common-types/AppThunk";
1
+ import { AppThunk } from '../../common-types/AppThunk';
2
+ import { IClick2SmsActions, IClick2SmsFlowActionMaps, IClick2smsFlowReducerState } from './Click2smsTypes';
3
3
  export declare function loadOc2sms(): AppThunk;
4
4
  export declare const Click2smsFlowActionMaps: IClick2SmsFlowActionMaps;
5
5
  export default function Click2smsFlowReducer(state: IClick2smsFlowReducerState, action: IClick2SmsActions): IClick2smsFlowReducerState;
@@ -79,7 +79,7 @@ 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 loadOc2sms() {
84
84
  return /*#__PURE__*/function () {
85
85
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch, store) {
@@ -90,7 +90,7 @@ function loadOc2sms() {
90
90
  case 0:
91
91
  currentState = store().strategy.currentState;
92
92
 
93
- if (!(currentState.type === "CLICK2SMS")) {
93
+ if (!(currentState.type === 'CLICK2SMS')) {
94
94
  _context.next = 6;
95
95
  break;
96
96
  }
@@ -99,38 +99,38 @@ function loadOc2sms() {
99
99
 
100
100
  try {
101
101
  dispatch({
102
- type: "LOAD_OC2SMS",
102
+ type: 'LOAD_OC2SMS',
103
103
  payload: {
104
- type: "LOAD_OC2SMS",
104
+ type: 'LOAD_OC2SMS',
105
105
  result: RDS.Loading()
106
106
  }
107
- }); //@ts-ignore
107
+ }); // @ts-ignore
108
108
 
109
- if (!!maybeConfig && maybeConfig.tag == "keywordAndShortCode") {
109
+ if (!!maybeConfig && maybeConfig.tag == 'keywordAndShortCode') {
110
110
  dispatch({
111
- type: "LOAD_OC2SMS",
111
+ type: 'LOAD_OC2SMS',
112
112
  payload: {
113
- type: "LOAD_OC2SMS",
113
+ type: 'LOAD_OC2SMS',
114
114
  result: RDS.Success(_objectSpread({
115
- type: "SingleSubmissionResult"
115
+ type: 'SingleSubmissionResult'
116
116
  }, maybeConfig))
117
117
  }
118
- }); //@ts-ignore
119
- } else if (!!maybeConfig && maybeConfig.tag != "keyword" || !maybeConfig) {
120
- //@ts-ignore
118
+ }); // @ts-ignore
119
+ } else if (!!maybeConfig && maybeConfig.tag != 'keyword' || !maybeConfig) {
120
+ // @ts-ignore
121
121
  (0, _utils.default)(window, maybeConfig).then(function (x) {
122
122
  return dispatch({
123
- type: "LOAD_OC2SMS",
123
+ type: 'LOAD_OC2SMS',
124
124
  payload: {
125
- type: "LOAD_OC2SMS",
125
+ type: 'LOAD_OC2SMS',
126
126
  result: RDS.Success(x)
127
127
  }
128
128
  });
129
129
  }).catch(function (e) {
130
130
  return dispatch({
131
- type: "LOAD_OC2SMS",
131
+ type: 'LOAD_OC2SMS',
132
132
  payload: {
133
- type: "LOAD_OC2SMS",
133
+ type: 'LOAD_OC2SMS',
134
134
  result: RDS.Failure(e.toString())
135
135
  }
136
136
  });
@@ -139,9 +139,9 @@ function loadOc2sms() {
139
139
  } catch (ex) {
140
140
  console.warn(ex);
141
141
  dispatch({
142
- type: "LOAD_OC2SMS",
142
+ type: 'LOAD_OC2SMS',
143
143
  payload: {
144
- type: "LOAD_OC2SMS",
144
+ type: 'LOAD_OC2SMS',
145
145
  result: RDS.Failure(ex.toString())
146
146
  }
147
147
  });
@@ -152,13 +152,13 @@ function loadOc2sms() {
152
152
 
153
153
  case 6:
154
154
  dispatch({
155
- type: "LOAD_OC2SMS",
155
+ type: 'LOAD_OC2SMS',
156
156
  payload: {
157
- type: "LOAD_OC2SMS",
158
- result: RDS.Failure("Unexpected state")
157
+ type: 'LOAD_OC2SMS',
158
+ result: RDS.Failure('Unexpected state')
159
159
  }
160
160
  });
161
- throw "Unexpected state";
161
+ throw 'Unexpected state';
162
162
 
163
163
  case 8:
164
164
  case "end":
@@ -176,7 +176,7 @@ function loadOc2sms() {
176
176
 
177
177
  var initialState = {
178
178
  currentState: {
179
- type: "LOAD_OC2SMS",
179
+ type: 'LOAD_OC2SMS',
180
180
  result: RDS.NothingYet()
181
181
  }
182
182
  };
@@ -190,7 +190,7 @@ function Click2smsFlowReducer() {
190
190
  var action = arguments.length > 1 ? arguments[1] : undefined;
191
191
 
192
192
  switch (action.type) {
193
- case "LOAD_OC2SMS":
193
+ case 'LOAD_OC2SMS':
194
194
  return (0, _strategy.genericHandler)(state, action.payload);
195
195
 
196
196
  default:
@@ -1,4 +1,4 @@
1
- import { IConfig, SingleSubmissionResult, MultiOperatorSubmissionResult } from "./Click2smsTypes";
1
+ import { IConfig, MultiOperatorSubmissionResult, SingleSubmissionResult } from './Click2smsTypes';
2
2
  export default function load(window: Window, maybeConfig: IConfig, keyword?: string, shortcode?: string): Promise<SingleSubmissionResult | MultiOperatorSubmissionResult>;
3
3
  export declare function load1(window: Window, maybeConfig: IConfig, keyword?: string, shortcode?: string): Promise<SingleSubmissionResult | MultiOperatorSubmissionResult>;
4
4
  export declare function checkSubscription(window: Window, maybeConfig: IConfig): Promise<string>;