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.
- package/.babelrc +4 -8
- package/.eslintrc.js +1 -1
- package/.nvmrc +1 -1
- package/.prettierignore +2 -1
- package/README.md +2 -4
- package/dist/api/index.d.ts +5 -5
- package/dist/api/index.js +76 -76
- package/dist/common-types/AppThunk.d.ts +11 -12
- package/dist/common-types/IOptInFlowName.d.ts +1 -1
- package/dist/common-types/ITracker.js +1 -2
- package/dist/common-types/RemoteDataState.d.ts +4 -4
- package/dist/common-types/RemoteDataState.js +17 -17
- package/dist/flows/click2smsFlow.d.ts +2 -2
- package/dist/flows/moFlow.d.ts +2 -2
- package/dist/flows/moRedirFlow.d.ts +2 -2
- package/dist/flows/oneClickFlow.d.ts +2 -2
- package/dist/flows/pinFlow.d.ts +2 -2
- package/dist/flows/pinFlow.js +2 -0
- package/dist/flows/strategy.d.ts +8 -8
- package/dist/flows/ussdFlow.d.ts +2 -2
- package/dist/ips/tryGetIPRangeName.d.ts +1 -1
- package/dist/ips/tryGetIPRangeName.js +7 -5
- package/dist/jest.config.js +1 -1
- package/dist/pacman/index.d.ts +2 -2
- package/dist/pacman/index.js +41 -41
- package/dist/pacman/queryString.js +11 -9
- package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +19 -19
- package/dist/reducers/click2smsFlow/IClick2smsConstants.d.ts +1 -1
- package/dist/reducers/click2smsFlow/index.d.ts +2 -2
- package/dist/reducers/click2smsFlow/index.js +24 -24
- package/dist/reducers/click2smsFlow/utils.d.ts +1 -1
- package/dist/reducers/click2smsFlow/utils.js +30 -30
- package/dist/reducers/moFlow/IMoConstants.d.ts +1 -1
- package/dist/reducers/moFlow/MoTypes.d.ts +13 -13
- package/dist/reducers/moFlow/index.d.ts +3 -3
- package/dist/reducers/moFlow/index.js +27 -27
- package/dist/reducers/moFlow/utils.d.ts +1 -2
- package/dist/reducers/moFlow/utils.js +28 -26
- package/dist/reducers/moRedirFlow/IMoRedirConstants.d.ts +1 -1
- package/dist/reducers/moRedirFlow/MoRedirTypes.d.ts +13 -13
- package/dist/reducers/moRedirFlow/index.d.ts +3 -3
- package/dist/reducers/moRedirFlow/index.js +27 -27
- package/dist/reducers/moRedirFlow/utils.d.ts +1 -1
- package/dist/reducers/moRedirFlow/utils.js +17 -17
- package/dist/reducers/oneClickFlow/IOneClickConstants.d.ts +1 -1
- package/dist/reducers/oneClickFlow/OneClickTypes.d.ts +10 -10
- package/dist/reducers/oneClickFlow/index.d.ts +3 -3
- package/dist/reducers/oneClickFlow/index.js +75 -68
- package/dist/reducers/oneClickFlow/utils.d.ts +2 -2
- package/dist/reducers/oneClickFlow/utils.js +70 -69
- package/dist/reducers/pinFlow/IPinConstants.d.ts +1 -1
- package/dist/reducers/pinFlow/PinTypes.d.ts +23 -23
- package/dist/reducers/pinFlow/index.d.ts +3 -3
- package/dist/reducers/pinFlow/index.js +76 -76
- package/dist/reducers/pinFlow/utils.d.ts +1 -1
- package/dist/reducers/pinFlow/utils.js +61 -65
- package/dist/reducers/strategy/IStategyActionContants.d.ts +1 -1
- package/dist/reducers/strategy/StrategyTypes.d.ts +56 -56
- package/dist/reducers/strategy/index.d.ts +2 -2
- package/dist/reducers/strategy/index.js +99 -99
- package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +3 -2
- package/dist/reducers/strategy/strategies/ask_mobile_number.js +132 -74
- package/dist/reducers/strategy/strategies/ask_operator.d.ts +2 -2
- package/dist/reducers/strategy/strategies/ask_operator.js +64 -68
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.d.ts +2 -2
- package/dist/reducers/strategy/strategies/detect_operator_by_ip.js +97 -97
- package/dist/reducers/strategy/strategies/header_enrichment.d.ts +2 -2
- package/dist/reducers/strategy/strategies/header_enrichment.js +116 -120
- package/dist/reducers/strategy/utils.d.ts +3 -3
- package/dist/reducers/strategy/utils.js +115 -111
- package/dist/reducers/ussdFlow/IUssdConstants.d.ts +1 -1
- package/dist/reducers/ussdFlow/UssdTypes.d.ts +13 -13
- package/dist/reducers/ussdFlow/index.d.ts +3 -3
- package/dist/reducers/ussdFlow/index.js +27 -27
- package/dist/reducers/ussdFlow/utils.d.ts +1 -2
- package/dist/reducers/ussdFlow/utils.js +19 -17
- package/dist/store/index.d.ts +8 -8
- package/dist/store/index.js +87 -83
- package/dist/store/reducers.d.ts +7 -7
- package/dist/store/reducers.js +4 -4
- package/dist/utilities/handleSubmitNumber.d.ts +7 -3
- package/dist/utilities/handleSubmitNumber.js +15 -18
- package/dist/utilities/index.d.ts +1 -1
- package/dist/utilities/index.js +13 -11
- package/dist/utilities/loadScriptInnerHtml.js +0 -1
- package/index.html +21 -28
- package/package.json +23 -15
- package/setupJest.js +1 -1
- package/tsconfig.json +2 -2
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/ouisys-engine.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.vscode/settings.json +0 -6
- package/dist/api/click2sms.js +0 -357
- package/dist/api/mo.js +0 -274
- package/dist/api/moRedir.js +0 -186
- package/dist/api/oneClick.js +0 -366
- package/dist/api/pin.js +0 -493
- package/dist/api/strategies.js +0 -704
- package/dist/api/ussd.js +0 -1
- package/dist/app/store.js +0 -35
- package/dist/features/strategies/categories/askMobileNumber.js +0 -395
- package/dist/features/strategies/categories/askOperator.js +0 -311
- package/dist/features/strategies/categories/detectOperatorByIp.js +0 -606
- package/dist/features/strategies/categories/headerEnrichment.js +0 -670
- package/dist/features/strategies/categories/typings/click2smsSliceTypes.js +0 -12
- package/dist/features/strategies/categories/typings/identifySliceTypes.js +0 -22
- package/dist/features/strategies/categories/typings/moFlowSliceTypes.js +0 -22
- package/dist/features/strategies/categories/typings/moRedirFlowSliceTypes.js +0 -21
- package/dist/features/strategies/categories/typings/oneClickSliceTypes.js +0 -13
- package/dist/features/strategies/categories/typings/pinFlowSliceTypes.js +0 -13
- package/dist/features/strategies/click2smsFlowSlice.js +0 -172
- package/dist/features/strategies/identifySlice.js +0 -455
- package/dist/features/strategies/moFlowSlice.js +0 -196
- package/dist/features/strategies/moRedirFlowSlice.js +0 -190
- package/dist/features/strategies/oneClickFlowSlice.js +0 -277
- package/dist/features/strategies/pinFlowSlice.js +0 -313
- package/dist/features/strategies/ussdFlowSlice.js +0 -1
- package/dist/flows/tpayHeFlow.d.ts +0 -7
- package/dist/flows/tpayHeFlow.js +0 -23
- package/dist/mockServer/browser.js +0 -48
- package/dist/mockServer/handlers.js +0 -22
- package/dist/mockServer/server.js +0 -48
- package/dist/reducers/tpayHeFlow/ITpayHeConstants.d.ts +0 -2
- package/dist/reducers/tpayHeFlow/ITpayHeConstants.js +0 -1
- package/dist/reducers/tpayHeFlow/TpayHeTypes.d.ts +0 -114
- package/dist/reducers/tpayHeFlow/TpayHeTypes.js +0 -1
- package/dist/reducers/tpayHeFlow/index.d.ts +0 -7
- package/dist/reducers/tpayHeFlow/index.js +0 -331
- package/dist/reducers/tpayHeFlow/utils.d.ts +0 -20
- package/dist/reducers/tpayHeFlow/utils.js +0 -510
- package/dist/test/setup.js +0 -24
- package/dist/test/test-utils.js +0 -51
- package/mockData/config.json +0 -28
- package/prettier.config.js +0 -7
- package/src/@types/react-tracker.d.ts +0 -16
- package/src/@types/redux-cli-logger.d.ts +0 -1
- package/src/@types/tiny-async-pool.d.ts +0 -3
- package/src/@types/window.d.ts +0 -74
- package/src/api/index.ts +0 -225
- package/src/common-types/AppThunk.ts +0 -19
- package/src/common-types/Either.ts +0 -3
- package/src/common-types/IError.ts +0 -5
- package/src/common-types/IOptInFlowName.ts +0 -1
- package/src/common-types/ITracker.ts +0 -10
- package/src/common-types/IVisitor.ts +0 -16
- package/src/common-types/RemoteDataState.ts +0 -88
- package/src/flows/click2smsFlow.ts +0 -18
- package/src/flows/moFlow.ts +0 -20
- package/src/flows/moRedirFlow.ts +0 -20
- package/src/flows/oneClickFlow.ts +0 -20
- package/src/flows/pinFlow.ts +0 -25
- package/src/flows/strategy.ts +0 -51
- package/src/flows/ussdFlow.ts +0 -20
- package/src/index.ts +0 -3
- package/src/ips/tryGetIPRangeName.ts +0 -22
- package/src/jest.config.js +0 -194
- package/src/pacman/index.ts +0 -71
- package/src/pacman/queryString.ts +0 -24
- package/src/reducers/click2smsFlow/Click2smsTypes.ts +0 -93
- package/src/reducers/click2smsFlow/IClick2smsConstants.ts +0 -4
- package/src/reducers/click2smsFlow/index.ts +0 -105
- package/src/reducers/click2smsFlow/utils.ts +0 -126
- package/src/reducers/moFlow/IMoConstants.ts +0 -7
- package/src/reducers/moFlow/MoTypes.ts +0 -125
- package/src/reducers/moFlow/index.ts +0 -150
- package/src/reducers/moFlow/utils.ts +0 -135
- package/src/reducers/moRedirFlow/IMoRedirConstants.ts +0 -7
- package/src/reducers/moRedirFlow/MoRedirTypes.ts +0 -99
- package/src/reducers/moRedirFlow/index.ts +0 -137
- package/src/reducers/moRedirFlow/utils.ts +0 -78
- package/src/reducers/oneClickFlow/IOneClickConstants.ts +0 -3
- package/src/reducers/oneClickFlow/OneClickTypes.ts +0 -108
- package/src/reducers/oneClickFlow/index.ts +0 -268
- package/src/reducers/oneClickFlow/utils.ts +0 -217
- package/src/reducers/pinFlow/IPinConstants.ts +0 -9
- package/src/reducers/pinFlow/PinTypes.ts +0 -190
- package/src/reducers/pinFlow/index.ts +0 -331
- package/src/reducers/pinFlow/utils.ts +0 -232
- package/src/reducers/strategy/IStategyActionContants.ts +0 -17
- package/src/reducers/strategy/StrategyTypes.ts +0 -375
- package/src/reducers/strategy/index.ts +0 -321
- package/src/reducers/strategy/strategies/ask_mobile_number.ts +0 -316
- package/src/reducers/strategy/strategies/ask_operator.ts +0 -195
- package/src/reducers/strategy/strategies/detect_operator_by_ip.ts +0 -414
- package/src/reducers/strategy/strategies/header_enrichment.ts +0 -489
- package/src/reducers/strategy/utils.ts +0 -357
- package/src/reducers/ussdFlow/IUssdConstants.ts +0 -7
- package/src/reducers/ussdFlow/UssdTypes.ts +0 -112
- package/src/reducers/ussdFlow/index.ts +0 -146
- package/src/reducers/ussdFlow/utils.ts +0 -88
- package/src/store/index.ts +0 -150
- package/src/store/reducers.ts +0 -37
- package/src/utilities/handleSubmitNumber.ts +0 -65
- package/src/utilities/index.ts +0 -114
- package/src/utilities/loadScriptInnerHtml.ts +0 -14
- 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 ===
|
|
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:
|
|
99
|
+
type: 'USSD_MSISDN_SUBMIT',
|
|
100
100
|
payload: {
|
|
101
|
-
type:
|
|
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:
|
|
121
|
+
type: 'USSD_MSISDN_SUBMIT',
|
|
122
122
|
payload: {
|
|
123
|
-
type:
|
|
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 =
|
|
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:
|
|
161
|
+
type: 'USSD_MSISDN_SUBMIT_ERROR',
|
|
162
162
|
payload: {
|
|
163
|
-
type:
|
|
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:
|
|
178
|
+
type: 'USSD_MSISDN_SUBMIT_ERROR',
|
|
179
179
|
payload: {
|
|
180
|
-
type:
|
|
180
|
+
type: 'MSISDNEntry',
|
|
181
181
|
result: RDS.Failure({
|
|
182
|
-
errorType:
|
|
182
|
+
errorType: 'UnexpectedState',
|
|
183
183
|
error: null
|
|
184
184
|
})
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
|
-
throw
|
|
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
|
|
207
|
+
case 'msisdn-entry-failure-state':
|
|
208
208
|
return dispatch({
|
|
209
|
-
type:
|
|
209
|
+
type: 'MOCK_USSD_FLOW_STATE',
|
|
210
210
|
payload: _utils.mockedMSISDNEntryFailure.currentState
|
|
211
211
|
});
|
|
212
212
|
|
|
213
|
-
case
|
|
213
|
+
case 'msisdn-entry-success-state':
|
|
214
214
|
return dispatch({
|
|
215
|
-
type:
|
|
215
|
+
type: 'MOCK_USSD_FLOW_STATE',
|
|
216
216
|
payload: _utils.mockedMSISDNEntrySuccess.currentState
|
|
217
217
|
});
|
|
218
218
|
|
|
219
219
|
default:
|
|
220
|
-
throw
|
|
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:
|
|
228
|
+
type: 'USSD_BACK_TO_START',
|
|
229
229
|
payload: {
|
|
230
|
-
type:
|
|
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:
|
|
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
|
|
252
|
+
case 'USSD_MSISDN_SUBMIT':
|
|
253
253
|
return (0, _strategy.genericHandler)(state, action.payload);
|
|
254
254
|
|
|
255
|
-
case
|
|
255
|
+
case 'USSD_BACK_TO_START':
|
|
256
256
|
return (0, _strategy.genericHandler)(state, action.payload);
|
|
257
257
|
|
|
258
|
-
case
|
|
258
|
+
case 'USSD_MSISDN_SUBMIT_ERROR':
|
|
259
259
|
return (0, _strategy.genericHandler)(state, action.payload);
|
|
260
260
|
|
|
261
|
-
case
|
|
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
|
|
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 ? '' :
|
|
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 (!(
|
|
141
|
+
if (!(result.success === false)) {
|
|
142
142
|
_context2.next = 16;
|
|
143
143
|
break;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
type = result.message == 'ALREADY SUBSCRIBED' ?
|
|
146
|
+
type = result.message == 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMSISDN';
|
|
147
147
|
error = new Error("".concat(type, ":\n").concat(result.message));
|
|
148
|
-
error
|
|
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 (!(
|
|
195
|
-
_context3.next =
|
|
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
|
|
203
|
-
error = new Error(
|
|
204
|
-
error
|
|
202
|
+
case 10:
|
|
203
|
+
error = new Error('SubscriptionFailed'.concat(":\n", checkResult.message));
|
|
204
|
+
error.type = 'SubscriptionFailed';
|
|
205
205
|
throw error;
|
|
206
206
|
|
|
207
|
-
case
|
|
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 (
|
|
219
|
-
!!window.pac_analytics.visitor[
|
|
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:
|
|
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:
|
|
238
|
+
type: 'MSISDNEntry',
|
|
237
239
|
result: RDS.Failure({
|
|
238
|
-
errorType:
|
|
239
|
-
error:
|
|
240
|
+
errorType: 'InvalidMSISDN',
|
|
241
|
+
error: 'Invalid Mobile Number'
|
|
240
242
|
})
|
|
241
243
|
}
|
|
242
244
|
};
|
package/dist/store/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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>;
|
package/dist/store/index.js
CHANGED
|
@@ -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
|
|
34
|
+
var _reduxLogger = require("redux-logger");
|
|
37
35
|
|
|
38
|
-
var
|
|
36
|
+
var _reduxThunk = _interopRequireDefault(require("redux-thunk"));
|
|
39
37
|
|
|
40
|
-
var
|
|
38
|
+
var RDS = _interopRequireWildcard(require("../common-types/RemoteDataState"));
|
|
41
39
|
|
|
42
40
|
var _utils = require("../reducers/strategy/utils");
|
|
43
41
|
|
|
44
|
-
|
|
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(
|
|
66
|
+
if (strategy.includes('ask-operator')) {
|
|
67
67
|
var operators = (0, _utils.getOperators)();
|
|
68
68
|
return {
|
|
69
|
-
type:
|
|
69
|
+
type: 'IDENTIFY_FLOW_BY_OPERATOR_SELECT',
|
|
70
70
|
result: {
|
|
71
71
|
operators: operators,
|
|
72
|
-
nextAction:
|
|
72
|
+
nextAction: 'selectOperator'
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
|
-
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (strategy.includes('ask-mobile-number') || strategy.includes('header-enrichment')) {
|
|
76
78
|
return {
|
|
77
|
-
type:
|
|
79
|
+
type: 'IDENTIFY_FLOW_BY_MSISDN',
|
|
78
80
|
result: RDS.NothingYet(),
|
|
79
81
|
nextData: {
|
|
80
|
-
nextAction:
|
|
82
|
+
nextAction: 'submitMSISDNAction'
|
|
81
83
|
}
|
|
82
84
|
};
|
|
83
|
-
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (strategy.includes('detect-operator-by-ip')) {
|
|
84
88
|
return {
|
|
85
|
-
type:
|
|
89
|
+
type: 'DETECT_OPERATOR_BY_IP',
|
|
86
90
|
result: RDS.Loading()
|
|
87
91
|
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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(
|
|
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:
|
|
164
|
+
type: 'GET_REDIRECT_URL',
|
|
161
165
|
result: {
|
|
162
|
-
type:
|
|
166
|
+
type: 'Success',
|
|
163
167
|
data: {
|
|
164
|
-
redirectUrl:
|
|
165
|
-
nextAction:
|
|
168
|
+
redirectUrl: '',
|
|
169
|
+
nextAction: 'getRedirectUrlAction'
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
172
|
}
|
|
169
173
|
}
|
|
170
|
-
}, (0, _redux.compose)(process.env.NODE_ENV ==
|
|
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;
|
package/dist/store/reducers.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { IUssdFlowReducerState } from
|
|
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;
|
package/dist/store/reducers.js
CHANGED
|
@@ -7,9 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _redux = require("redux");
|
|
9
9
|
|
|
10
|
-
var
|
|
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
|
|
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:
|
|
4
|
-
submitMSISDNAction:
|
|
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,
|
|
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
|
|
28
|
-
var pn = new _awesomePhonenumber.default("+"
|
|
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("+"
|
|
46
|
+
var pn = new _awesomePhonenumber.default("+".concat(internationalNumber), process.env.country.toUpperCase());
|
|
48
47
|
var countryCode = pn.getCountryCode();
|
|
49
|
-
var networkType = isHeaderEnrichmentSuccess ?
|
|
48
|
+
var networkType = isHeaderEnrichmentSuccess ? 'mobile_data' : 'wifi';
|
|
50
49
|
|
|
51
|
-
if (isHeaderEnrichmentSuccess
|
|
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
|
|
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
|
-
|
|
62
|
+
'skip-validation': '1'
|
|
64
63
|
});
|
|
65
64
|
}
|
|
66
|
-
} else {
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
};
|