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.
- package/.babelrc +4 -8
- package/.eslintrc.js +1 -1
- package/.husky/pre-commit +4 -0
- package/.nvmrc +1 -1
- package/.prettierignore +2 -1
- package/.vscode/settings.json +1 -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 +24 -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/mockData/config.json +1 -1
- package/package.json +23 -15
- package/setupJest.js +1 -1
- package/tsconfig.json +2 -2
- 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/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 -189
- 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
|
@@ -113,7 +113,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
113
113
|
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); }); }; }
|
|
114
114
|
|
|
115
115
|
var wait = function wait(ms) {
|
|
116
|
-
return (
|
|
116
|
+
return (// @ts-ignore
|
|
117
117
|
new Promise(function (resolve) {
|
|
118
118
|
return setTimeout(function () {
|
|
119
119
|
return resolve();
|
|
@@ -138,20 +138,20 @@ var loop = /*#__PURE__*/function () {
|
|
|
138
138
|
r = _context.sent;
|
|
139
139
|
|
|
140
140
|
if (!(stop(r) || i >= max)) {
|
|
141
|
-
_context.next =
|
|
141
|
+
_context.next = 5;
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
return _context.abrupt("return", r);
|
|
146
146
|
|
|
147
|
-
case
|
|
148
|
-
_context.next =
|
|
147
|
+
case 5:
|
|
148
|
+
_context.next = 7;
|
|
149
149
|
return wait(1000);
|
|
150
150
|
|
|
151
|
-
case
|
|
151
|
+
case 7:
|
|
152
152
|
return _context.abrupt("return", loop(f, max, stop, i + 1));
|
|
153
153
|
|
|
154
|
-
case
|
|
154
|
+
case 8:
|
|
155
155
|
case "end":
|
|
156
156
|
return _context.stop();
|
|
157
157
|
}
|
|
@@ -182,18 +182,18 @@ function left(l) {
|
|
|
182
182
|
|
|
183
183
|
var getConfig = function getConfig() {
|
|
184
184
|
try {
|
|
185
|
-
if (process.env.testing ==
|
|
186
|
-
var
|
|
187
|
-
|
|
185
|
+
if (process.env.testing == 'true') {
|
|
186
|
+
var _configs2 = require('../../../mockData/config.json'); // @ts-ignore
|
|
188
187
|
|
|
189
|
-
return _configs;
|
|
190
|
-
} else {
|
|
191
|
-
var _configs2 = require("../../../../../config.json");
|
|
192
188
|
|
|
193
189
|
return _configs2;
|
|
194
190
|
}
|
|
191
|
+
|
|
192
|
+
var _configs = require('../../../../../config.json');
|
|
193
|
+
|
|
194
|
+
return _configs;
|
|
195
195
|
} catch (ex) {
|
|
196
|
-
throw
|
|
196
|
+
throw 'config.json not found';
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
199
|
|
|
@@ -203,17 +203,17 @@ var defaultFlowConfig = configs.strategyConfigs.default;
|
|
|
203
203
|
var operatorsConfig = configs.strategyConfigs.operators;
|
|
204
204
|
|
|
205
205
|
var searchToObject = function searchToObject() {
|
|
206
|
-
if (typeof window !==
|
|
207
|
-
return window.location.search.substring(1).split(
|
|
206
|
+
if (typeof window !== 'undefined') {
|
|
207
|
+
return window.location.search.substring(1).split('&').filter(function (x) {
|
|
208
208
|
return !!x && x.length > 0;
|
|
209
209
|
}).map(function (kv) {
|
|
210
210
|
return kv.split('=');
|
|
211
211
|
}).reduce(function (a, b) {
|
|
212
212
|
return _objectSpread(_objectSpread({}, a), {}, _defineProperty({}, b[0], b[1]));
|
|
213
213
|
}, {});
|
|
214
|
-
} else {
|
|
215
|
-
return {};
|
|
216
214
|
}
|
|
215
|
+
|
|
216
|
+
return {};
|
|
217
217
|
};
|
|
218
218
|
|
|
219
219
|
exports.searchToObject = searchToObject;
|
|
@@ -236,7 +236,7 @@ function _determineFlowByMsidn() {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
submissionError = new Error("Error in submitMSISDN() trigger-pin action");
|
|
239
|
-
submissionError
|
|
239
|
+
submissionError.type = 'SEInvalidMSISDN';
|
|
240
240
|
throw submissionError;
|
|
241
241
|
|
|
242
242
|
case 4:
|
|
@@ -281,8 +281,8 @@ function _determineFlowByMsidn() {
|
|
|
281
281
|
case 9:
|
|
282
282
|
theResult = _context5.sent;
|
|
283
283
|
flow = operatorsConfig[theResult.operator] ? operatorsConfig[theResult.operator] : null;
|
|
284
|
-
cannotDetect = theResult.success === false && theResult.message ===
|
|
285
|
-
hlrError = theResult.success === false && theResult.message.indexOf(
|
|
284
|
+
cannotDetect = theResult.success === false && theResult.message === 'Operator could not be found for the given MSISDN';
|
|
285
|
+
hlrError = theResult.success === false && theResult.message.indexOf('HLR did not find the operator for given MSISDN') !== -1;
|
|
286
286
|
|
|
287
287
|
if (!(cannotDetect || hlrError)) {
|
|
288
288
|
_context5.next = 20;
|
|
@@ -290,8 +290,8 @@ function _determineFlowByMsidn() {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
_submissionError = new Error("Error in submitMSISDN() identify flow");
|
|
293
|
-
_submissionError
|
|
294
|
-
_submissionError
|
|
293
|
+
_submissionError.type = 'FlowDetectFailed';
|
|
294
|
+
_submissionError.msisdn = msisdn;
|
|
295
295
|
throw _submissionError;
|
|
296
296
|
|
|
297
297
|
case 20:
|
|
@@ -319,7 +319,7 @@ function _determineFlowByMsidn() {
|
|
|
319
319
|
|
|
320
320
|
case 30:
|
|
321
321
|
_submissionError2 = new Error("Error in submitMSISDN() trigger-pin action");
|
|
322
|
-
_submissionError2
|
|
322
|
+
_submissionError2.type = 'SEInvalidMSISDN';
|
|
323
323
|
throw _submissionError2;
|
|
324
324
|
|
|
325
325
|
case 33:
|
|
@@ -352,8 +352,8 @@ function determineFlowByOperator(operator) {
|
|
|
352
352
|
|
|
353
353
|
function determineFlowByOperatorFromIp(_x6) {
|
|
354
354
|
return _determineFlowByOperatorFromIp.apply(this, arguments);
|
|
355
|
-
} //if operator from server
|
|
356
|
-
//no need for this
|
|
355
|
+
} // if operator from server
|
|
356
|
+
// no need for this
|
|
357
357
|
|
|
358
358
|
|
|
359
359
|
function _determineFlowByOperatorFromIp() {
|
|
@@ -368,7 +368,7 @@ function _determineFlowByOperatorFromIp() {
|
|
|
368
368
|
|
|
369
369
|
case 2:
|
|
370
370
|
operator = _context6.sent;
|
|
371
|
-
flowObj = determineFlowByOperator(operator ? operator.toUpperCase() :
|
|
371
|
+
flowObj = determineFlowByOperator(operator ? operator.toUpperCase() : '');
|
|
372
372
|
return _context6.abrupt("return", flowObj);
|
|
373
373
|
|
|
374
374
|
case 5:
|
|
@@ -388,16 +388,16 @@ function getOperators() {
|
|
|
388
388
|
|
|
389
389
|
var fetchJsonp = function fetchJsonp(_url) {
|
|
390
390
|
var url = _url;
|
|
391
|
-
var ouisys_callback_function = "ouisys_callback_function"
|
|
391
|
+
var ouisys_callback_function = "ouisys_callback_function".concat(Math.floor(Math.random() * 10000));
|
|
392
392
|
return new Promise(function (resolve, reject) {
|
|
393
|
-
|
|
393
|
+
// @ts-ignore
|
|
394
394
|
window[ouisys_callback_function] = function (arg) {
|
|
395
395
|
resolve(arg);
|
|
396
396
|
};
|
|
397
397
|
|
|
398
398
|
url += url.indexOf('?') === -1 ? '?' : '&';
|
|
399
399
|
url += "jsonp=".concat(ouisys_callback_function);
|
|
400
|
-
var script = document.createElement(
|
|
400
|
+
var script = document.createElement('script');
|
|
401
401
|
script.src = url;
|
|
402
402
|
script.id = ouisys_callback_function;
|
|
403
403
|
document.body.appendChild(script); // Caught if got 404/500
|
|
@@ -410,13 +410,13 @@ var fetchJsonp = function fetchJsonp(_url) {
|
|
|
410
410
|
|
|
411
411
|
var identifyUser = /*#__PURE__*/function () {
|
|
412
412
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(extraParams) {
|
|
413
|
-
var config, host, country, slug, queryString, device, bupperizeCountry, offer, rockmanId, s, search, extraParamsQs, isDMB, newHost, searchObj, isSuccess, identifyError, subscription_url,
|
|
413
|
+
var config, host, country, slug, queryString, device, bupperizeCountry, offer, rockmanId, s, search, extraParamsQs, isDMB, newHost, searchObj, isSuccess, identifyError, subscription_url, _newUrl, _queryString2, _urlParams, _msisdn, _operator, url2, redirect_url, _newUrl2, _queryString3, _urlParams2, _msisdn2, _operator2, newUrl, _queryString, urlParams, msisdn, operator, _url2, result, _identifyError;
|
|
414
414
|
|
|
415
415
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
416
416
|
while (1) {
|
|
417
417
|
switch (_context2.prev = _context2.next) {
|
|
418
418
|
case 0:
|
|
419
|
-
if (!(typeof window
|
|
419
|
+
if (!(typeof window === 'undefined')) {
|
|
420
420
|
_context2.next = 4;
|
|
421
421
|
break;
|
|
422
422
|
}
|
|
@@ -441,123 +441,120 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
441
441
|
|
|
442
442
|
return "".concat(k, "=").concat(v);
|
|
443
443
|
})).join('&');
|
|
444
|
-
extraParamsQs = !extraParams ? '' :
|
|
444
|
+
extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
|
|
445
445
|
return "".concat(k, "=").concat(extraParams[k]);
|
|
446
|
-
}).join('&');
|
|
447
|
-
isDMB = window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf(
|
|
448
|
-
newHost = isDMB ?
|
|
446
|
+
}).join('&'));
|
|
447
|
+
isDMB = !!(window.pac_analytics.visitor.xaid != null && (window.pac_analytics.visitor.xaid.toLowerCase().indexOf('dmb') != -1 || window.pac_analytics.visitor.xaid.toLowerCase().indexOf('amb')) != -1);
|
|
448
|
+
newHost = isDMB ? 'de.tallymans.com' : host;
|
|
449
449
|
searchObj = searchToObject();
|
|
450
450
|
|
|
451
|
-
if (!(!!searchObj[
|
|
452
|
-
_context2.next =
|
|
451
|
+
if (!(!!searchObj['redirect-back'] && searchObj['redirect-back'] == '1' && !!searchObj.success)) {
|
|
452
|
+
_context2.next = 50;
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
455
455
|
|
|
456
|
-
isSuccess = searchObj.success ==
|
|
456
|
+
isSuccess = searchObj.success == 'true';
|
|
457
457
|
|
|
458
|
-
if (!(
|
|
458
|
+
if (!(isSuccess == false)) {
|
|
459
459
|
_context2.next = 23;
|
|
460
460
|
break;
|
|
461
461
|
}
|
|
462
462
|
|
|
463
|
-
|
|
464
|
-
identifyError = new Error(
|
|
465
|
-
|
|
463
|
+
// @ts-ignore
|
|
464
|
+
identifyError = new Error( // @ts-ignore
|
|
465
|
+
"Error in getRedirectUrl() identify-user action:\n".concat(searchObj.message || 'NotOn3g'));
|
|
466
|
+
identifyError.type = 'NotOn3g'; // identifyError['next_action'] = result.next_action;
|
|
466
467
|
|
|
467
468
|
throw identifyError;
|
|
468
469
|
|
|
469
470
|
case 23:
|
|
470
471
|
if (!searchObj.subscription_url) {
|
|
471
|
-
_context2.next =
|
|
472
|
+
_context2.next = 31;
|
|
472
473
|
break;
|
|
473
474
|
}
|
|
474
475
|
|
|
475
476
|
subscription_url = window.atob(searchObj.subscription_url);
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
477
|
+
_newUrl = new URL(subscription_url);
|
|
478
|
+
_queryString2 = _newUrl.search;
|
|
479
|
+
_urlParams = new URLSearchParams(_queryString2);
|
|
480
|
+
_msisdn = _urlParams.get('msisdn') || null;
|
|
481
|
+
_operator = _urlParams.get('operator') || null;
|
|
481
482
|
return _context2.abrupt("return", {
|
|
482
483
|
subscription_url: subscription_url,
|
|
483
484
|
action: function action() {
|
|
484
485
|
return subscribe(subscription_url);
|
|
485
486
|
},
|
|
486
|
-
msisdn:
|
|
487
|
-
operator:
|
|
487
|
+
msisdn: _msisdn,
|
|
488
|
+
operator: _operator
|
|
488
489
|
});
|
|
489
490
|
|
|
490
|
-
case
|
|
491
|
+
case 31:
|
|
491
492
|
if (!searchObj.redirect_url) {
|
|
492
|
-
_context2.next =
|
|
493
|
+
_context2.next = 42;
|
|
493
494
|
break;
|
|
494
495
|
}
|
|
495
496
|
|
|
496
|
-
url2 = "https://de.tallymans.com/tallyman/v1/?action=redirect&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=",
|
|
497
|
+
url2 = "https://de.tallymans.com/tallyman/v1/?action=redirect&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", 'smart', "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId, "&auto-redirect=1&").concat(extraParamsQs); // const result2 = await fetch(url2).then(x => x.json())
|
|
497
498
|
|
|
498
499
|
redirect_url = window.atob(searchObj.redirect_url);
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
500
|
+
_newUrl2 = new URL(redirect_url);
|
|
501
|
+
_queryString3 = _newUrl2.search;
|
|
502
|
+
_urlParams2 = new URLSearchParams(_queryString3);
|
|
503
|
+
_msisdn2 = _urlParams2.get('msisdn') || null;
|
|
504
|
+
_operator2 = _urlParams2.get('operator') || null;
|
|
504
505
|
|
|
505
|
-
if (!(
|
|
506
|
-
_context2.next =
|
|
506
|
+
if (!(_msisdn2 != null)) {
|
|
507
|
+
_context2.next = 41;
|
|
507
508
|
break;
|
|
508
509
|
}
|
|
509
510
|
|
|
510
511
|
return _context2.abrupt("return", {
|
|
511
512
|
subscription_url: url2,
|
|
512
|
-
msisdn:
|
|
513
|
-
operator:
|
|
513
|
+
msisdn: _msisdn2,
|
|
514
|
+
operator: _operator2
|
|
514
515
|
});
|
|
515
516
|
|
|
516
|
-
case
|
|
517
|
+
case 41:
|
|
517
518
|
return _context2.abrupt("return", {
|
|
518
519
|
redirect_url: redirect_url,
|
|
519
|
-
msisdn:
|
|
520
|
-
operator:
|
|
520
|
+
msisdn: _msisdn2,
|
|
521
|
+
operator: _operator2
|
|
521
522
|
});
|
|
522
523
|
|
|
523
|
-
case
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
_queryString3 = _newUrl2.search;
|
|
530
|
-
_urlParams2 = new URLSearchParams(_queryString3);
|
|
531
|
-
_msisdn2 = _urlParams2.get("msisdn") || null;
|
|
532
|
-
_operator2 = _urlParams2.get("operator") || null;
|
|
524
|
+
case 42:
|
|
525
|
+
newUrl = new URL(window.location.href);
|
|
526
|
+
_queryString = newUrl.search;
|
|
527
|
+
urlParams = new URLSearchParams(_queryString);
|
|
528
|
+
msisdn = urlParams.get('msisdn') || null;
|
|
529
|
+
operator = urlParams.get('operator') || null;
|
|
533
530
|
return _context2.abrupt("return", {
|
|
534
|
-
msisdn:
|
|
535
|
-
operator:
|
|
531
|
+
msisdn: msisdn,
|
|
532
|
+
operator: operator
|
|
536
533
|
});
|
|
537
534
|
|
|
538
|
-
case
|
|
539
|
-
_context2.next =
|
|
535
|
+
case 48:
|
|
536
|
+
_context2.next = 61;
|
|
540
537
|
break;
|
|
541
538
|
|
|
542
|
-
case
|
|
543
|
-
_url2 = "https://".concat(newHost, "/tallyman/v1/?action=identify-user&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&page=").concat(window.location.href, "&pixel_url=").concat(encodeURIComponent("http://".concat(window.location.host, "/pixels?xcid=").concat(window.location.pathname.replace(
|
|
544
|
-
_context2.next =
|
|
539
|
+
case 50:
|
|
540
|
+
_url2 = "https://".concat(newHost, "/tallyman/v1/?action=identify-user&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=").concat(device, "&offerId=").concat(offer, "&page=").concat(window.location.href, "&pixel_url=").concat(encodeURIComponent("http://".concat(window.location.host, "/pixels?xcid=").concat(window.location.pathname.replace('/', ''), "&xaid=").concat(window.pac_analytics.visitor.xaid, "&country=").concat(bupperizeCountry(country))), "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
|
|
541
|
+
_context2.next = 53;
|
|
545
542
|
return fetchJsonp(_url2);
|
|
546
543
|
|
|
547
|
-
case
|
|
544
|
+
case 53:
|
|
548
545
|
result = _context2.sent;
|
|
549
546
|
|
|
550
|
-
if (!(
|
|
551
|
-
_context2.next =
|
|
547
|
+
if (!(result.success === false)) {
|
|
548
|
+
_context2.next = 60;
|
|
552
549
|
break;
|
|
553
550
|
}
|
|
554
551
|
|
|
555
552
|
_identifyError = new Error("Error in getRedirectUrl() identify-user action:\n".concat(result.message));
|
|
556
|
-
_identifyError
|
|
553
|
+
_identifyError.type = 'NotOn3g'; // identifyError['next_action'] = result.next_action;
|
|
557
554
|
|
|
558
555
|
throw _identifyError;
|
|
559
556
|
|
|
560
|
-
case
|
|
557
|
+
case 60:
|
|
561
558
|
return _context2.abrupt("return", {
|
|
562
559
|
subscription_url: result.subscription_url || result.redirect_url,
|
|
563
560
|
action: function action() {
|
|
@@ -567,7 +564,7 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
567
564
|
operator: result.operator
|
|
568
565
|
});
|
|
569
566
|
|
|
570
|
-
case
|
|
567
|
+
case 61:
|
|
571
568
|
case "end":
|
|
572
569
|
return _context2.stop();
|
|
573
570
|
}
|
|
@@ -588,7 +585,13 @@ var subscribe = /*#__PURE__*/function () {
|
|
|
588
585
|
while (1) {
|
|
589
586
|
switch (_context3.prev = _context3.next) {
|
|
590
587
|
case 0:
|
|
591
|
-
return _context3.abrupt("return",
|
|
588
|
+
return _context3.abrupt("return", // const result:ISubscribeResult = await fetch(url + "&operator=kw_viva").then((x)=>x.json())
|
|
589
|
+
// if(false === result.success){
|
|
590
|
+
// const subscribeError = new Error(`Error in subscribe() one-click-subscribe action:\n${result.message}`) as IError & {type:string;}
|
|
591
|
+
// subscribeError['type'] = "SubscriptionError";
|
|
592
|
+
// throw subscribeError
|
|
593
|
+
// }else{
|
|
594
|
+
'/mock-product-url');
|
|
592
595
|
|
|
593
596
|
case 1:
|
|
594
597
|
case "end":
|
|
@@ -601,7 +604,8 @@ var subscribe = /*#__PURE__*/function () {
|
|
|
601
604
|
return function subscribe(_x8) {
|
|
602
605
|
return _ref5.apply(this, arguments);
|
|
603
606
|
};
|
|
604
|
-
}();
|
|
607
|
+
}(); // }
|
|
608
|
+
|
|
605
609
|
|
|
606
610
|
exports.subscribe = subscribe;
|
|
607
611
|
|
|
@@ -626,70 +630,70 @@ function mockConfig(flow) {
|
|
|
626
630
|
|
|
627
631
|
var mockedPinFlow = {
|
|
628
632
|
currentState: {
|
|
629
|
-
type:
|
|
633
|
+
type: 'PIN',
|
|
630
634
|
result: {
|
|
631
|
-
nextAction:
|
|
632
|
-
config: mockConfig(
|
|
635
|
+
nextAction: 'submitMSISDNAction',
|
|
636
|
+
config: mockConfig('pin')
|
|
633
637
|
}
|
|
634
638
|
}
|
|
635
639
|
};
|
|
636
640
|
exports.mockedPinFlow = mockedPinFlow;
|
|
637
641
|
var mockedMoFlow = {
|
|
638
642
|
currentState: {
|
|
639
|
-
type:
|
|
643
|
+
type: 'MO',
|
|
640
644
|
result: {
|
|
641
|
-
nextAction:
|
|
642
|
-
config: mockConfig(
|
|
645
|
+
nextAction: 'submitMSISDNAction',
|
|
646
|
+
config: mockConfig('mo')
|
|
643
647
|
}
|
|
644
648
|
}
|
|
645
649
|
};
|
|
646
650
|
exports.mockedMoFlow = mockedMoFlow;
|
|
647
651
|
var mockedUssdFlow = {
|
|
648
652
|
currentState: {
|
|
649
|
-
type:
|
|
653
|
+
type: 'USSD',
|
|
650
654
|
result: {
|
|
651
|
-
nextAction:
|
|
652
|
-
config: mockConfig(
|
|
655
|
+
nextAction: 'submitMSISDNAction',
|
|
656
|
+
config: mockConfig('ussd')
|
|
653
657
|
}
|
|
654
658
|
}
|
|
655
659
|
};
|
|
656
660
|
exports.mockedUssdFlow = mockedUssdFlow;
|
|
657
661
|
var mockedMoRdirFlow = {
|
|
658
662
|
currentState: {
|
|
659
|
-
type:
|
|
663
|
+
type: 'MO_REDIR',
|
|
660
664
|
result: {
|
|
661
|
-
nextAction:
|
|
662
|
-
config: mockConfig(
|
|
665
|
+
nextAction: 'submitMSISDNAction',
|
|
666
|
+
config: mockConfig('moRedir')
|
|
663
667
|
}
|
|
664
668
|
}
|
|
665
669
|
};
|
|
666
670
|
exports.mockedMoRdirFlow = mockedMoRdirFlow;
|
|
667
671
|
var mockedClick2smsFlow = {
|
|
668
672
|
currentState: {
|
|
669
|
-
type:
|
|
673
|
+
type: 'CLICK2SMS',
|
|
670
674
|
result: {
|
|
671
|
-
nextAction:
|
|
672
|
-
config: mockConfig(
|
|
675
|
+
nextAction: 'loadOc2sms',
|
|
676
|
+
config: mockConfig('click2sms')
|
|
673
677
|
}
|
|
674
678
|
}
|
|
675
679
|
};
|
|
676
680
|
exports.mockedClick2smsFlow = mockedClick2smsFlow;
|
|
677
681
|
var mockedOneClickFlow = {
|
|
678
682
|
currentState: {
|
|
679
|
-
type:
|
|
683
|
+
type: 'ONE_CLICK',
|
|
680
684
|
result: {
|
|
681
|
-
nextAction:
|
|
682
|
-
config: mockConfig(
|
|
685
|
+
nextAction: 'getRedirectUrlAction',
|
|
686
|
+
config: mockConfig('oneClick')
|
|
683
687
|
}
|
|
684
688
|
}
|
|
685
689
|
};
|
|
686
690
|
exports.mockedOneClickFlow = mockedOneClickFlow;
|
|
687
691
|
var mockedTPayFlow = {
|
|
688
692
|
currentState: {
|
|
689
|
-
type:
|
|
693
|
+
type: 'TPAY_HE',
|
|
690
694
|
result: {
|
|
691
|
-
nextAction:
|
|
692
|
-
config: mockConfig(
|
|
695
|
+
nextAction: 'loadTpayAction',
|
|
696
|
+
config: mockConfig('tpayHe')
|
|
693
697
|
}
|
|
694
698
|
}
|
|
695
699
|
}; // export const mockedMOFlow : State = { type: "MO", result:moFlow(mockTracker, mockConfig("mo"))}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare type IUssdConstants =
|
|
1
|
+
declare type IUssdConstants = 'USSD_MSISDN_SUBMIT' | 'USSD_MSISDN_SUBMIT_ERROR' | 'USSD_BACK_TO_START' | 'MOCK_USSD_FLOW_STATE';
|
|
2
2
|
export default IUssdConstants;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { AppThunk } from '../../common-types/AppThunk';
|
|
2
|
+
import * as RDS from '../../common-types/RemoteDataState';
|
|
3
3
|
export declare type IUssdFlowCurrentState = {
|
|
4
|
-
type:
|
|
4
|
+
type: 'MSISDNEntry';
|
|
5
5
|
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
6
6
|
};
|
|
7
|
-
export declare type MSISDNEntryErrorTypes =
|
|
7
|
+
export declare type MSISDNEntryErrorTypes = 'AlreadySubscribed' | 'UnknownError' | 'InvalidMSISDN' | 'UnexpectedState';
|
|
8
8
|
export declare type MSISDNEntryFailure = {
|
|
9
9
|
errorType: MSISDNEntryErrorTypes;
|
|
10
10
|
error: any;
|
|
@@ -12,7 +12,7 @@ export declare type MSISDNEntryFailure = {
|
|
|
12
12
|
};
|
|
13
13
|
export declare type MSISDNEntrySuccess = IKeywordShortcode;
|
|
14
14
|
export declare type IMsisnSubmitActionPayload = {
|
|
15
|
-
type:
|
|
15
|
+
type: 'MSISDNEntry';
|
|
16
16
|
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
17
17
|
};
|
|
18
18
|
export interface IUssdFlowReducerState {
|
|
@@ -23,7 +23,7 @@ export declare type IConfig = {
|
|
|
23
23
|
slug?: string;
|
|
24
24
|
country?: string;
|
|
25
25
|
host?: string;
|
|
26
|
-
device?:
|
|
26
|
+
device?: 'smart' | 'feature';
|
|
27
27
|
operators?: string[];
|
|
28
28
|
};
|
|
29
29
|
export declare type IKeywordShortcode = {
|
|
@@ -51,27 +51,27 @@ export declare type ICheckSubscriptionResult = {
|
|
|
51
51
|
rockman_id: string;
|
|
52
52
|
};
|
|
53
53
|
export declare type IBackToStartPayload = {
|
|
54
|
-
type:
|
|
54
|
+
type: 'MSISDNEntry';
|
|
55
55
|
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
56
56
|
};
|
|
57
57
|
export declare type IUssdActions = {
|
|
58
|
-
type:
|
|
58
|
+
type: 'USSD_MSISDN_SUBMIT';
|
|
59
59
|
payload: IMsisnSubmitActionPayload;
|
|
60
60
|
} | {
|
|
61
|
-
type:
|
|
61
|
+
type: 'USSD_MSISDN_SUBMIT_ERROR';
|
|
62
62
|
payload: IMsisdnSubmitErrorPayload;
|
|
63
63
|
} | {
|
|
64
|
-
type:
|
|
64
|
+
type: 'USSD_BACK_TO_START';
|
|
65
65
|
payload: IBackToStartPayload;
|
|
66
66
|
} | {
|
|
67
|
-
type:
|
|
67
|
+
type: 'MOCK_USSD_FLOW_STATE';
|
|
68
68
|
payload: IUssdFlowCurrentState;
|
|
69
69
|
};
|
|
70
70
|
export declare type IMsisdnSubmitErrorPayload = {
|
|
71
|
-
type:
|
|
71
|
+
type: 'MSISDNEntry';
|
|
72
72
|
result: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>;
|
|
73
73
|
};
|
|
74
74
|
export declare type IUssdFlowActionMaps = {
|
|
75
75
|
submitMSISDNAction: (msisdn: string) => AppThunk;
|
|
76
76
|
};
|
|
77
|
-
export declare type IMockUssdFlowStates =
|
|
77
|
+
export declare type IMockUssdFlowStates = 'msisdn-entry-success-state' | 'msisdn-entry-failure-state';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { AppThunk } from '../../common-types/AppThunk';
|
|
2
|
+
import * as RDS from '../../common-types/RemoteDataState';
|
|
3
|
+
import { IMockUssdFlowStates, IUssdActions, IUssdFlowActionMaps, IUssdFlowReducerState, MSISDNEntryFailure } from './UssdTypes';
|
|
4
4
|
export declare function submitMSISDNAction(msisdn: string): AppThunk;
|
|
5
5
|
export declare function mockUssdFlow(mockState: IMockUssdFlowStates): AppThunk;
|
|
6
6
|
export declare function backToStart(): {
|