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
|
@@ -59,13 +59,13 @@ require("core-js/modules/es.promise.js");
|
|
|
59
59
|
|
|
60
60
|
var RDS = _interopRequireWildcard(require("../../common-types/RemoteDataState"));
|
|
61
61
|
|
|
62
|
-
var
|
|
62
|
+
var _utilities = require("../../utilities");
|
|
63
63
|
|
|
64
64
|
var _strategy = require("../strategy");
|
|
65
65
|
|
|
66
|
-
var
|
|
66
|
+
var _utils = require("../strategy/utils");
|
|
67
67
|
|
|
68
|
-
var _utils2 = require("
|
|
68
|
+
var _utils2 = _interopRequireWildcard(require("./utils"));
|
|
69
69
|
|
|
70
70
|
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); }
|
|
71
71
|
|
|
@@ -85,9 +85,9 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
85
85
|
|
|
86
86
|
var getConfigByMsisdnPrefix = function getConfigByMsisdnPrefix(msisdn) {
|
|
87
87
|
var operatorByPrefix = (0, _utilities.getSAOperatorByMsisdnPrefix)(msisdn);
|
|
88
|
-
var flowObj = (0,
|
|
88
|
+
var flowObj = (0, _utils.determineFlowByOperator)(operatorByPrefix);
|
|
89
89
|
return flowObj.flowConfig;
|
|
90
|
-
}; //ACTION CREATORS
|
|
90
|
+
}; // ACTION CREATORS
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
function submitMSISDNAction(msisdn, extraParams) {
|
|
@@ -102,7 +102,7 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
102
102
|
currentState = store().strategy.currentState;
|
|
103
103
|
pinFlowCurrentState = store().pinFlow.currentState;
|
|
104
104
|
|
|
105
|
-
if (!(currentState.type ===
|
|
105
|
+
if (!(currentState.type === 'PIN')) {
|
|
106
106
|
_context.next = 26;
|
|
107
107
|
break;
|
|
108
108
|
}
|
|
@@ -110,15 +110,15 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
110
110
|
_currentState$result = currentState.result, configByStrategy = _currentState$result.config, isUseMsisdnPrefix = _currentState$result.isUseMsisdnPrefix;
|
|
111
111
|
config = isUseMsisdnPrefix ? getConfigByMsisdnPrefix(msisdn) : configByStrategy;
|
|
112
112
|
pinMaxLengthByOp = {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
SA_MOBILY: 6,
|
|
114
|
+
SA_STC: 4,
|
|
115
|
+
SA_ZAIN: 6
|
|
116
116
|
};
|
|
117
117
|
_context.prev = 6;
|
|
118
118
|
dispatch({
|
|
119
|
-
type:
|
|
119
|
+
type: 'PIN_FLOW_MSISDN_SUBMIT',
|
|
120
120
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
121
|
-
type:
|
|
121
|
+
type: 'MSISDNEntry',
|
|
122
122
|
result: RDS.Loading()
|
|
123
123
|
})
|
|
124
124
|
});
|
|
@@ -128,15 +128,15 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
_context.next = 11;
|
|
131
|
-
return (0,
|
|
131
|
+
return (0, _utils2.default)(window, config, msisdn, extraParams);
|
|
132
132
|
|
|
133
133
|
case 11:
|
|
134
134
|
msisdnSubmissionResult = _context.sent;
|
|
135
|
-
operator = msisdnSubmissionResult.type ==
|
|
135
|
+
operator = msisdnSubmissionResult.type == 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult.operator : '';
|
|
136
136
|
dispatch({
|
|
137
|
-
type:
|
|
137
|
+
type: 'PIN_FLOW_MSISDN_SUBMIT',
|
|
138
138
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
139
|
-
type:
|
|
139
|
+
type: 'MSISDNEntry',
|
|
140
140
|
result: RDS.Success({})
|
|
141
141
|
})
|
|
142
142
|
});
|
|
@@ -146,16 +146,16 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
146
146
|
});
|
|
147
147
|
|
|
148
148
|
dispatch({
|
|
149
|
-
type:
|
|
149
|
+
type: 'PIN_FLOW_MSISDN_SUBMIT',
|
|
150
150
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
151
|
-
type:
|
|
151
|
+
type: 'PINEntry',
|
|
152
152
|
result: RDS.NothingYet(),
|
|
153
153
|
data: {
|
|
154
|
-
actualPIN: msisdnSubmissionResult.type ==
|
|
155
|
-
nextAction:
|
|
154
|
+
actualPIN: msisdnSubmissionResult.type == 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult.pin : null,
|
|
155
|
+
nextAction: 'submitPinAction',
|
|
156
156
|
msisdn: msisdn,
|
|
157
157
|
operator: operator,
|
|
158
|
-
pinMaxLength: operator !=
|
|
158
|
+
pinMaxLength: operator != '' && pinMaxLengthByOp[operator] ? pinMaxLengthByOp[operator] : null
|
|
159
159
|
}
|
|
160
160
|
})
|
|
161
161
|
});
|
|
@@ -166,7 +166,7 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
166
166
|
_context.prev = 18;
|
|
167
167
|
_context.t0 = _context["catch"](6);
|
|
168
168
|
console.warn(_context.t0);
|
|
169
|
-
errorType =
|
|
169
|
+
errorType = _context.t0.type === 'AlreadySubscribed' ? 'AlreadySubscribed' : _context.t0.type === 'InvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
|
|
170
170
|
|
|
171
171
|
_strategy.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
|
|
172
172
|
msisdn: msisdn,
|
|
@@ -174,9 +174,9 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
174
174
|
});
|
|
175
175
|
|
|
176
176
|
dispatch({
|
|
177
|
-
type:
|
|
177
|
+
type: 'PIN_FLOW_MSISDN_SUBMIT_ERROR',
|
|
178
178
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
179
|
-
type:
|
|
179
|
+
type: 'MSISDNEntry',
|
|
180
180
|
result: RDS.Failure({
|
|
181
181
|
errorType: errorType,
|
|
182
182
|
error: _context.t0,
|
|
@@ -191,11 +191,11 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
191
191
|
|
|
192
192
|
case 26:
|
|
193
193
|
dispatch({
|
|
194
|
-
type:
|
|
194
|
+
type: 'PIN_FLOW_MSISDN_SUBMIT_ERROR',
|
|
195
195
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
196
|
-
type:
|
|
196
|
+
type: 'MSISDNEntry',
|
|
197
197
|
result: RDS.Failure({
|
|
198
|
-
errorType:
|
|
198
|
+
errorType: 'UnknownError',
|
|
199
199
|
error: null
|
|
200
200
|
})
|
|
201
201
|
})
|
|
@@ -206,7 +206,7 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
206
206
|
errorType: 'UnexpectedState'
|
|
207
207
|
});
|
|
208
208
|
|
|
209
|
-
throw
|
|
209
|
+
throw 'Unexpected state';
|
|
210
210
|
|
|
211
211
|
case 29:
|
|
212
212
|
case "end":
|
|
@@ -233,7 +233,7 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
233
233
|
currentState = store().strategy.currentState;
|
|
234
234
|
pinFlowCurrentState = store().pinFlow.currentState;
|
|
235
235
|
|
|
236
|
-
if (!(currentState.type ===
|
|
236
|
+
if (!(currentState.type === 'PIN')) {
|
|
237
237
|
_context2.next = 23;
|
|
238
238
|
break;
|
|
239
239
|
}
|
|
@@ -257,14 +257,14 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
257
257
|
});
|
|
258
258
|
|
|
259
259
|
_context2.next = 9;
|
|
260
|
-
return (0,
|
|
260
|
+
return (0, _utils2.default)(window, config, msisdn, extraParams);
|
|
261
261
|
|
|
262
262
|
case 9:
|
|
263
263
|
msisdnSubmissionResult = _context2.sent;
|
|
264
264
|
dispatch({
|
|
265
|
-
type:
|
|
265
|
+
type: 'PIN_FLOW_MSISDN_SUBMIT',
|
|
266
266
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
267
|
-
type:
|
|
267
|
+
type: 'MSISDNEntry',
|
|
268
268
|
result: RDS.Success({})
|
|
269
269
|
})
|
|
270
270
|
});
|
|
@@ -274,13 +274,13 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
274
274
|
});
|
|
275
275
|
|
|
276
276
|
dispatch({
|
|
277
|
-
type:
|
|
277
|
+
type: 'PIN_FLOW_MSISDN_SUBMIT',
|
|
278
278
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
279
|
-
type:
|
|
279
|
+
type: 'PINEntry',
|
|
280
280
|
result: RDS.NothingYet(),
|
|
281
281
|
data: {
|
|
282
|
-
actualPIN: msisdnSubmissionResult.type ==
|
|
283
|
-
nextAction:
|
|
282
|
+
actualPIN: msisdnSubmissionResult.type == 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult.pin : null,
|
|
283
|
+
nextAction: 'submitPinAction',
|
|
284
284
|
msisdn: msisdn
|
|
285
285
|
}
|
|
286
286
|
})
|
|
@@ -292,7 +292,7 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
292
292
|
_context2.prev = 15;
|
|
293
293
|
_context2.t0 = _context2["catch"](4);
|
|
294
294
|
console.warn(_context2.t0);
|
|
295
|
-
errorType =
|
|
295
|
+
errorType = _context2.t0.type === 'AlreadySubscribed' ? 'AlreadySubscribed' : _context2.t0.type === 'InvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
|
|
296
296
|
|
|
297
297
|
_strategy.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
|
|
298
298
|
msisdn: msisdn,
|
|
@@ -300,9 +300,9 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
300
300
|
});
|
|
301
301
|
|
|
302
302
|
dispatch({
|
|
303
|
-
type:
|
|
303
|
+
type: 'PIN_FLOW_MSISDN_SUBMIT_ERROR',
|
|
304
304
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
305
|
-
type:
|
|
305
|
+
type: 'MSISDNEntry',
|
|
306
306
|
result: RDS.Failure({
|
|
307
307
|
errorType: errorType,
|
|
308
308
|
error: _context2.t0,
|
|
@@ -317,11 +317,11 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
317
317
|
|
|
318
318
|
case 23:
|
|
319
319
|
dispatch({
|
|
320
|
-
type:
|
|
320
|
+
type: 'PIN_FLOW_MSISDN_SUBMIT_ERROR',
|
|
321
321
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
322
|
-
type:
|
|
322
|
+
type: 'MSISDNEntry',
|
|
323
323
|
result: RDS.Failure({
|
|
324
|
-
errorType:
|
|
324
|
+
errorType: 'UnknownError',
|
|
325
325
|
error: null
|
|
326
326
|
})
|
|
327
327
|
})
|
|
@@ -332,7 +332,7 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
332
332
|
errorType: 'UnexpectedState'
|
|
333
333
|
});
|
|
334
334
|
|
|
335
|
-
throw
|
|
335
|
+
throw 'Unexpected state';
|
|
336
336
|
|
|
337
337
|
case 26:
|
|
338
338
|
case "end":
|
|
@@ -360,9 +360,9 @@ function submitPinAction(msisdn, pin, extraParams) {
|
|
|
360
360
|
pinFlowCurrentState = store().pinFlow.currentState;
|
|
361
361
|
_context3.prev = 2;
|
|
362
362
|
dispatch({
|
|
363
|
-
type:
|
|
363
|
+
type: 'PIN_SUBMIT',
|
|
364
364
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
365
|
-
type:
|
|
365
|
+
type: 'PINEntry',
|
|
366
366
|
result: RDS.Loading()
|
|
367
367
|
})
|
|
368
368
|
});
|
|
@@ -372,14 +372,14 @@ function submitPinAction(msisdn, pin, extraParams) {
|
|
|
372
372
|
pin: pin
|
|
373
373
|
});
|
|
374
374
|
|
|
375
|
-
if (!(currentState.type ===
|
|
375
|
+
if (!(currentState.type === 'PIN')) {
|
|
376
376
|
_context3.next = 14;
|
|
377
377
|
break;
|
|
378
378
|
}
|
|
379
379
|
|
|
380
380
|
config = currentState.result.config;
|
|
381
381
|
_context3.next = 9;
|
|
382
|
-
return (0,
|
|
382
|
+
return (0, _utils2.submitPIN)(window, pin, config, extraParams);
|
|
383
383
|
|
|
384
384
|
case 9:
|
|
385
385
|
result = _context3.sent;
|
|
@@ -391,9 +391,9 @@ function submitPinAction(msisdn, pin, extraParams) {
|
|
|
391
391
|
});
|
|
392
392
|
|
|
393
393
|
dispatch({
|
|
394
|
-
type:
|
|
394
|
+
type: 'PIN_SUBMIT',
|
|
395
395
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
396
|
-
type:
|
|
396
|
+
type: 'PINEntry',
|
|
397
397
|
result: RDS.Success({
|
|
398
398
|
finalUrl: result.productUrl,
|
|
399
399
|
isAlreadySubscribed: result.isAlreadySubscribed || false
|
|
@@ -410,15 +410,15 @@ function submitPinAction(msisdn, pin, extraParams) {
|
|
|
410
410
|
});
|
|
411
411
|
|
|
412
412
|
dispatch({
|
|
413
|
-
type:
|
|
413
|
+
type: 'PIN_SUBMIT_ERROR',
|
|
414
414
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
415
|
-
type:
|
|
415
|
+
type: 'PINEntry',
|
|
416
416
|
result: RDS.Failure({
|
|
417
|
-
errorType:
|
|
417
|
+
errorType: 'UnexpectedState'
|
|
418
418
|
})
|
|
419
419
|
})
|
|
420
420
|
});
|
|
421
|
-
throw
|
|
421
|
+
throw 'Unexpected state';
|
|
422
422
|
|
|
423
423
|
case 17:
|
|
424
424
|
_context3.next = 25;
|
|
@@ -428,7 +428,7 @@ function submitPinAction(msisdn, pin, extraParams) {
|
|
|
428
428
|
_context3.prev = 19;
|
|
429
429
|
_context3.t0 = _context3["catch"](2);
|
|
430
430
|
console.error(_context3.t0);
|
|
431
|
-
errorType = _context3.t0.type ||
|
|
431
|
+
errorType = _context3.t0.type || 'UnknownError';
|
|
432
432
|
|
|
433
433
|
_strategy.tracker.recedeInFlow('tallyman.v1-pin', 'pin-submission-failure', {
|
|
434
434
|
msisdn: msisdn,
|
|
@@ -436,9 +436,9 @@ function submitPinAction(msisdn, pin, extraParams) {
|
|
|
436
436
|
});
|
|
437
437
|
|
|
438
438
|
dispatch({
|
|
439
|
-
type:
|
|
439
|
+
type: 'PIN_SUBMIT_ERROR',
|
|
440
440
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
441
|
-
type:
|
|
441
|
+
type: 'PINEntry',
|
|
442
442
|
result: RDS.Failure({
|
|
443
443
|
errorType: errorType
|
|
444
444
|
})
|
|
@@ -463,38 +463,38 @@ function mockPinFlow(mockState) {
|
|
|
463
463
|
return function (dispatch) {
|
|
464
464
|
if (mockState !== undefined) {
|
|
465
465
|
switch (mockState) {
|
|
466
|
-
case
|
|
466
|
+
case 'msisdn-failure-state':
|
|
467
467
|
return dispatch({
|
|
468
|
-
type:
|
|
469
|
-
payload:
|
|
468
|
+
type: 'MOCK_PIN_FLOW_STATE',
|
|
469
|
+
payload: _utils2.mockedMSISDNEntryFailure.currentState
|
|
470
470
|
});
|
|
471
471
|
|
|
472
|
-
case
|
|
472
|
+
case 'pin-state':
|
|
473
473
|
return dispatch({
|
|
474
|
-
type:
|
|
475
|
-
payload:
|
|
474
|
+
type: 'MOCK_PIN_FLOW_STATE',
|
|
475
|
+
payload: _utils2.mockedPINState.currentState
|
|
476
476
|
});
|
|
477
477
|
|
|
478
|
-
case
|
|
478
|
+
case 'completed-state':
|
|
479
479
|
return dispatch({
|
|
480
|
-
type:
|
|
481
|
-
payload:
|
|
480
|
+
type: 'MOCK_PIN_FLOW_STATE',
|
|
481
|
+
payload: _utils2.mockedCompletedState.currentState
|
|
482
482
|
});
|
|
483
483
|
|
|
484
484
|
default:
|
|
485
|
-
throw
|
|
485
|
+
throw 'Mock Flow not supported';
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
};
|
|
489
489
|
}
|
|
490
490
|
|
|
491
491
|
function backToStart() {
|
|
492
|
-
_strategy.tracker.recedeInFlow(
|
|
492
|
+
_strategy.tracker.recedeInFlow('tallyman.v1-pin', 'pin-submission-backtostart', 'requested to change phone number');
|
|
493
493
|
|
|
494
494
|
return {
|
|
495
|
-
type:
|
|
495
|
+
type: 'BACK_TO_START',
|
|
496
496
|
payload: {
|
|
497
|
-
type:
|
|
497
|
+
type: 'MSISDNEntry',
|
|
498
498
|
result: RDS.NothingYet()
|
|
499
499
|
}
|
|
500
500
|
};
|
|
@@ -502,7 +502,7 @@ function backToStart() {
|
|
|
502
502
|
|
|
503
503
|
var initialState = {
|
|
504
504
|
currentState: {
|
|
505
|
-
type:
|
|
505
|
+
type: 'MSISDNEntry',
|
|
506
506
|
result: RDS.NothingYet()
|
|
507
507
|
}
|
|
508
508
|
};
|
|
@@ -517,23 +517,23 @@ function PinFlowReducer() {
|
|
|
517
517
|
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
518
518
|
|
|
519
519
|
switch (action.type) {
|
|
520
|
-
case
|
|
520
|
+
case 'PIN_FLOW_MSISDN_SUBMIT':
|
|
521
521
|
return (0, _strategy.genericHandler)(state, action.payload);
|
|
522
522
|
|
|
523
|
-
case
|
|
523
|
+
case 'PIN_FLOW_MSISDN_SUBMIT_ERROR':
|
|
524
524
|
return (0, _strategy.genericHandler)(state, action.payload);
|
|
525
525
|
|
|
526
|
-
case
|
|
526
|
+
case 'PIN_SUBMIT':
|
|
527
527
|
return (0, _strategy.genericHandler)(state, action.payload);
|
|
528
528
|
|
|
529
|
-
case
|
|
529
|
+
case 'BACK_TO_START':
|
|
530
530
|
return (0, _strategy.genericHandler)(state, action.payload);
|
|
531
531
|
|
|
532
|
-
case
|
|
532
|
+
case 'PIN_SUBMIT_ERROR':
|
|
533
533
|
return (0, _strategy.genericHandler)(state, action.payload);
|
|
534
534
|
|
|
535
|
-
case
|
|
536
|
-
|
|
535
|
+
case 'MOCK_PIN_FLOW_STATE':
|
|
536
|
+
// @ts-ignore
|
|
537
537
|
return (0, _strategy.genericHandler)(state, action.payload);
|
|
538
538
|
|
|
539
539
|
default:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IConfig, IHash,
|
|
1
|
+
import { IConfig, IHash, IMcpShieldResult, IPinFlowReducerState, MultiOperatorMSISDNSubmissionResult, SingleMSISDNSubmissionResult } from './PinTypes';
|
|
2
2
|
export default function submitMSISDN(window: Window, maybeConfig: IConfig, internationalMSISDN: string, extraParams?: IHash): Promise<SingleMSISDNSubmissionResult | MultiOperatorMSISDNSubmissionResult>;
|
|
3
3
|
export declare function loadMcpShield(window: Window, config: IConfig): Promise<IMcpShieldResult>;
|
|
4
4
|
export declare function submitPIN(window: Window, pin: string, config: IConfig, extraParams: IHash): Promise<{
|