ouisys-engine 3.0.0 → 3.0.3
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/dist/reducers/oneClickFlow/utils.js +35 -34
- package/dist/reducers/pinFlow/PinTypes.d.ts +1 -0
- package/dist/reducers/pinFlow/index.js +28 -16
- package/dist/reducers/strategy/StrategyTypes.d.ts +5 -3
- package/dist/reducers/strategy/index.js +23 -21
- package/dist/reducers/strategy/strategies/ask_mobile_number.d.ts +1 -0
- package/dist/reducers/strategy/strategies/ask_mobile_number.js +68 -10
- package/dist/utilities/index.d.ts +2 -0
- package/dist/utilities/index.js +24 -2
- package/package.json +1 -1
- package/src/reducers/oneClickFlow/utils.ts +4 -2
- package/src/reducers/pinFlow/PinTypes.ts +2 -1
- package/src/reducers/pinFlow/index.ts +12 -1
- package/src/reducers/strategy/StrategyTypes.ts +6 -3
- package/src/reducers/strategy/index.ts +4 -1
- package/src/reducers/strategy/strategies/ask_mobile_number.ts +50 -0
- package/src/utilities/index.ts +87 -0
|
@@ -120,7 +120,7 @@ var uniqidResult;
|
|
|
120
120
|
|
|
121
121
|
var getRedirectUrl = /*#__PURE__*/function () {
|
|
122
122
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(window, maybeConfig, extraParams) {
|
|
123
|
-
var host, country, slug, queryString, device, apiAction, bupperizeCountry, offer, s, search, extraParamsQs, rockmanId, _url2, result, identifyError, _url3, _result, _identifyError, mcpShieldResult, mcpSessionCheckWithBlock, _url4, _result2, _identifyError2;
|
|
123
|
+
var host, country, slug, queryString, device, apiAction, customDomain, bupperizeCountry, offer, s, search, extraParamsQs, rockmanId, _url2, result, identifyError, _url3, _result, _identifyError, mcpShieldResult, mcpSessionCheckWithBlock, _url4, _result2, _identifyError2;
|
|
124
124
|
|
|
125
125
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
126
126
|
while (1) {
|
|
@@ -135,6 +135,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
135
135
|
|
|
136
136
|
case 4:
|
|
137
137
|
host = maybeConfig.host, country = maybeConfig.country, slug = maybeConfig.slug, queryString = maybeConfig.queryString, device = maybeConfig.device, apiAction = maybeConfig.apiAction;
|
|
138
|
+
customDomain = slug === "evina-test-handle" ? "dev.ng.eu.ngrok.io" : "de-ads.tallymans.com";
|
|
138
139
|
|
|
139
140
|
bupperizeCountry = function bupperizeCountry(c) {
|
|
140
141
|
return c == 'gb' ? 'uk' : c;
|
|
@@ -155,19 +156,19 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
155
156
|
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
156
157
|
|
|
157
158
|
if (!(apiAction == "identify-user")) {
|
|
158
|
-
_context.next =
|
|
159
|
+
_context.next = 26;
|
|
159
160
|
break;
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
_url2 = "https://de.tallymans.com/tallyman/v1/?action=identify-user&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", "smart", "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
|
|
163
|
-
_context.next =
|
|
164
|
+
_context.next = 16;
|
|
164
165
|
return fetchJsonp(_url2);
|
|
165
166
|
|
|
166
|
-
case
|
|
167
|
+
case 16:
|
|
167
168
|
result = _context.sent;
|
|
168
169
|
|
|
169
170
|
if (!(false === result.success)) {
|
|
170
|
-
_context.next =
|
|
171
|
+
_context.next = 23;
|
|
171
172
|
break;
|
|
172
173
|
}
|
|
173
174
|
|
|
@@ -175,7 +176,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
175
176
|
identifyError['type'] = "NotOn3g";
|
|
176
177
|
throw identifyError;
|
|
177
178
|
|
|
178
|
-
case
|
|
179
|
+
case 23:
|
|
179
180
|
return _context.abrupt("return", {
|
|
180
181
|
subscription_url: result.subscription_url || result.redirect_url,
|
|
181
182
|
action: function action() {
|
|
@@ -183,27 +184,27 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
183
184
|
}
|
|
184
185
|
});
|
|
185
186
|
|
|
186
|
-
case
|
|
187
|
-
_context.next =
|
|
187
|
+
case 24:
|
|
188
|
+
_context.next = 63;
|
|
188
189
|
break;
|
|
189
190
|
|
|
190
|
-
case
|
|
191
|
+
case 26:
|
|
191
192
|
if (!(apiAction == "he")) {
|
|
192
|
-
_context.next =
|
|
193
|
+
_context.next = 41;
|
|
193
194
|
break;
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
_url3 = "https://de.tallymans.com/tallyman/v1/?action=he&country=".concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", "smart", "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
|
|
197
|
-
_context.next =
|
|
198
|
+
_context.next = 30;
|
|
198
199
|
return fetch(_url3).then(function (x) {
|
|
199
200
|
return x.json();
|
|
200
201
|
});
|
|
201
202
|
|
|
202
|
-
case
|
|
203
|
+
case 30:
|
|
203
204
|
_result = _context.sent;
|
|
204
205
|
|
|
205
206
|
if (!(false === _result.success)) {
|
|
206
|
-
_context.next =
|
|
207
|
+
_context.next = 37;
|
|
207
208
|
break;
|
|
208
209
|
}
|
|
209
210
|
|
|
@@ -211,27 +212,27 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
211
212
|
_identifyError['type'] = "NotOn3g";
|
|
212
213
|
throw _identifyError;
|
|
213
214
|
|
|
214
|
-
case
|
|
215
|
+
case 37:
|
|
215
216
|
(0, _loadScriptInnerHtml.default)(_result.source);
|
|
216
217
|
return _context.abrupt("return", {
|
|
217
218
|
redirect_url: _result.redirectUrlWithReplacedUniqid
|
|
218
219
|
});
|
|
219
220
|
|
|
220
|
-
case
|
|
221
|
-
_context.next =
|
|
221
|
+
case 39:
|
|
222
|
+
_context.next = 63;
|
|
222
223
|
break;
|
|
223
224
|
|
|
224
|
-
case
|
|
225
|
-
if (!(country.toLowerCase() === "za")) {
|
|
226
|
-
_context.next =
|
|
225
|
+
case 41:
|
|
226
|
+
if (!(country.toLowerCase() === "za" && slug !== 'evina-test-handle')) {
|
|
227
|
+
_context.next = 52;
|
|
227
228
|
break;
|
|
228
229
|
}
|
|
229
230
|
|
|
230
|
-
_context.prev =
|
|
231
|
-
_context.next =
|
|
231
|
+
_context.prev = 42;
|
|
232
|
+
_context.next = 45;
|
|
232
233
|
return window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId);
|
|
233
234
|
|
|
234
|
-
case
|
|
235
|
+
case 45:
|
|
235
236
|
mcpShieldResult = _context.sent;
|
|
236
237
|
|
|
237
238
|
if (false == mcpShieldResult.success) {
|
|
@@ -243,26 +244,26 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
243
244
|
(0, _loadScriptInnerHtml.default)(mcpSessionCheckWithBlock);
|
|
244
245
|
}
|
|
245
246
|
|
|
246
|
-
_context.next =
|
|
247
|
+
_context.next = 52;
|
|
247
248
|
break;
|
|
248
249
|
|
|
249
|
-
case
|
|
250
|
-
_context.prev =
|
|
251
|
-
_context.t0 = _context["catch"](
|
|
250
|
+
case 49:
|
|
251
|
+
_context.prev = 49;
|
|
252
|
+
_context.t0 = _context["catch"](42);
|
|
252
253
|
console.warn(_context.t0);
|
|
253
254
|
|
|
254
|
-
case
|
|
255
|
-
_url4 = "https://
|
|
256
|
-
_context.next =
|
|
255
|
+
case 52:
|
|
256
|
+
_url4 = "https://".concat(customDomain, "/tallyman/v1/?action=redirect&country=").concat(bupperizeCountry(country), "&slug=").concat(slug, "&device=", "smart", "&offerId=").concat(offer, "&rockman_id=").concat(rockmanId).concat(extraParamsQs, "&").concat(search);
|
|
257
|
+
_context.next = 55;
|
|
257
258
|
return fetch(_url4).then(function (x) {
|
|
258
259
|
return x.json();
|
|
259
260
|
});
|
|
260
261
|
|
|
261
|
-
case
|
|
262
|
+
case 55:
|
|
262
263
|
_result2 = _context.sent;
|
|
263
264
|
|
|
264
265
|
if (!(false === _result2.success)) {
|
|
265
|
-
_context.next =
|
|
266
|
+
_context.next = 62;
|
|
266
267
|
break;
|
|
267
268
|
}
|
|
268
269
|
|
|
@@ -270,17 +271,17 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
270
271
|
_identifyError2['type'] = "NotOn3g";
|
|
271
272
|
throw _identifyError2;
|
|
272
273
|
|
|
273
|
-
case
|
|
274
|
+
case 62:
|
|
274
275
|
return _context.abrupt("return", {
|
|
275
276
|
redirect_url: _result2.redirect_url
|
|
276
277
|
});
|
|
277
278
|
|
|
278
|
-
case
|
|
279
|
+
case 63:
|
|
279
280
|
case "end":
|
|
280
281
|
return _context.stop();
|
|
281
282
|
}
|
|
282
283
|
}
|
|
283
|
-
}, _callee, null, [[
|
|
284
|
+
}, _callee, null, [[42, 49]]);
|
|
284
285
|
}));
|
|
285
286
|
|
|
286
287
|
return function getRedirectUrl(_x, _x2, _x3) {
|
|
@@ -63,6 +63,10 @@ var _utils = _interopRequireWildcard(require("./utils"));
|
|
|
63
63
|
|
|
64
64
|
var _strategy = require("../strategy");
|
|
65
65
|
|
|
66
|
+
var _utilities = require("../../utilities");
|
|
67
|
+
|
|
68
|
+
var _utils2 = require("../strategy/utils");
|
|
69
|
+
|
|
66
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); }
|
|
67
71
|
|
|
68
72
|
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; }
|
|
@@ -79,11 +83,18 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
79
83
|
|
|
80
84
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
81
85
|
|
|
82
|
-
|
|
86
|
+
var getConfigByMsisdnPrefix = function getConfigByMsisdnPrefix(msisdn) {
|
|
87
|
+
var operatorByPrefix = (0, _utilities.getSAOperatorByMsisdnPrefix)(msisdn);
|
|
88
|
+
var flowObj = (0, _utils2.determineFlowByOperator)(operatorByPrefix);
|
|
89
|
+
return flowObj.flowConfig;
|
|
90
|
+
}; //ACTION CREATORS
|
|
91
|
+
|
|
92
|
+
|
|
83
93
|
function submitMSISDNAction(msisdn, extraParams) {
|
|
84
94
|
return /*#__PURE__*/function () {
|
|
85
95
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch, store) {
|
|
86
|
-
var currentState, pinFlowCurrentState, config, pinMaxLengthByOp, msisdnSubmissionResult, operator, errorType;
|
|
96
|
+
var currentState, pinFlowCurrentState, _currentState$result, configByStrategy, isUseMsisdnPrefix, config, pinMaxLengthByOp, msisdnSubmissionResult, operator, errorType;
|
|
97
|
+
|
|
87
98
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
88
99
|
while (1) {
|
|
89
100
|
switch (_context.prev = _context.next) {
|
|
@@ -92,17 +103,18 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
92
103
|
pinFlowCurrentState = store().pinFlow.currentState;
|
|
93
104
|
|
|
94
105
|
if (!(currentState.type === "PIN")) {
|
|
95
|
-
_context.next =
|
|
106
|
+
_context.next = 26;
|
|
96
107
|
break;
|
|
97
108
|
}
|
|
98
109
|
|
|
99
|
-
|
|
110
|
+
_currentState$result = currentState.result, configByStrategy = _currentState$result.config, isUseMsisdnPrefix = _currentState$result.isUseMsisdnPrefix;
|
|
111
|
+
config = isUseMsisdnPrefix ? getConfigByMsisdnPrefix(msisdn) : configByStrategy;
|
|
100
112
|
pinMaxLengthByOp = {
|
|
101
113
|
"SA_MOBILY": 6,
|
|
102
114
|
"SA_STC": 4,
|
|
103
115
|
"SA_ZAIN": 6
|
|
104
116
|
};
|
|
105
|
-
_context.prev =
|
|
117
|
+
_context.prev = 6;
|
|
106
118
|
dispatch({
|
|
107
119
|
type: "PIN_FLOW_MSISDN_SUBMIT",
|
|
108
120
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
@@ -115,10 +127,10 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
115
127
|
msisdn: msisdn
|
|
116
128
|
});
|
|
117
129
|
|
|
118
|
-
_context.next =
|
|
130
|
+
_context.next = 11;
|
|
119
131
|
return (0, _utils.default)(window, config, msisdn, extraParams);
|
|
120
132
|
|
|
121
|
-
case
|
|
133
|
+
case 11:
|
|
122
134
|
msisdnSubmissionResult = _context.sent;
|
|
123
135
|
operator = msisdnSubmissionResult.type == "SingleMSISDNSubmissionResult" ? msisdnSubmissionResult.operator : "";
|
|
124
136
|
dispatch({
|
|
@@ -147,12 +159,12 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
147
159
|
}
|
|
148
160
|
})
|
|
149
161
|
});
|
|
150
|
-
_context.next =
|
|
162
|
+
_context.next = 24;
|
|
151
163
|
break;
|
|
152
164
|
|
|
153
|
-
case
|
|
154
|
-
_context.prev =
|
|
155
|
-
_context.t0 = _context["catch"](
|
|
165
|
+
case 18:
|
|
166
|
+
_context.prev = 18;
|
|
167
|
+
_context.t0 = _context["catch"](6);
|
|
156
168
|
console.warn(_context.t0);
|
|
157
169
|
errorType = "AlreadySubscribed" === _context.t0.type ? "AlreadySubscribed" : "InvalidMSISDN" === _context.t0.type ? "InvalidMSISDN" : "UnknownError";
|
|
158
170
|
|
|
@@ -173,11 +185,11 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
173
185
|
})
|
|
174
186
|
});
|
|
175
187
|
|
|
176
|
-
case
|
|
177
|
-
_context.next =
|
|
188
|
+
case 24:
|
|
189
|
+
_context.next = 29;
|
|
178
190
|
break;
|
|
179
191
|
|
|
180
|
-
case
|
|
192
|
+
case 26:
|
|
181
193
|
dispatch({
|
|
182
194
|
type: "PIN_FLOW_MSISDN_SUBMIT_ERROR",
|
|
183
195
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
@@ -196,12 +208,12 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
196
208
|
|
|
197
209
|
throw "Unexpected state";
|
|
198
210
|
|
|
199
|
-
case
|
|
211
|
+
case 29:
|
|
200
212
|
case "end":
|
|
201
213
|
return _context.stop();
|
|
202
214
|
}
|
|
203
215
|
}
|
|
204
|
-
}, _callee, null, [[
|
|
216
|
+
}, _callee, null, [[6, 18]]);
|
|
205
217
|
}));
|
|
206
218
|
|
|
207
219
|
return function (_x, _x2) {
|
|
@@ -2,9 +2,9 @@ import * as RDS from "../../common-types/RemoteDataState";
|
|
|
2
2
|
import { AppThunk } from "../../common-types/AppThunk";
|
|
3
3
|
export declare type IIdentifyResult = {
|
|
4
4
|
operator: string;
|
|
5
|
-
flow
|
|
5
|
+
flow?: string;
|
|
6
6
|
success: boolean;
|
|
7
|
-
rockman_id
|
|
7
|
+
rockman_id?: string;
|
|
8
8
|
message?: string;
|
|
9
9
|
};
|
|
10
10
|
export declare type ConfigDetails = {
|
|
@@ -40,13 +40,14 @@ export declare type StrategyConfig = {
|
|
|
40
40
|
[key: string]: IFlow;
|
|
41
41
|
};
|
|
42
42
|
default: IFlow;
|
|
43
|
+
isUseMsisdnPrefix?: boolean;
|
|
43
44
|
};
|
|
44
45
|
export declare type IStrategy = {
|
|
45
46
|
strategy: IStrategyNames;
|
|
46
47
|
country: string;
|
|
47
48
|
strategyConfigs: StrategyConfig;
|
|
48
49
|
};
|
|
49
|
-
export declare type IStrategyNames = "pin" | "mo" | "mo-redir" | "click2sms" | "one-click" | "ussd" | "tpay-he" | "tallyman-one-click" | "pin-mo-ask-operator" | "pin-mo-ask-mobile-number" | "pin-one-click-ask-operator" | "pin-one-click-detect-operator-by-ip" | "one-click-mo-pin-detect-operator-by-ip-or-msisdn" | "pin-click2sms-ask-operator" | "mo-redir-one-click-detect-operator-by-ip" | "pin-mo-redir-ask-mobile-number" | "pin-click2sms-ask-mobile-number" | "mo-one-click-detect-operator-by-ip" | "click2sms-one-click-detect-operator-by-ip" | "pin-header-enrichment" | "pin-msisdn-fowarding-pin-header-enrichment" | "he-pin-mo-redir-header-enrichment" | "he-pin-one-click-header-enrichment" | "he-pin-one-click-ask-operator" | "click2sms-one-click-ask-operator" | "pin-mo-detect-operator-by-ip" | "he-mo-redir-one-click-header-enrichment";
|
|
50
|
+
export declare type IStrategyNames = "pin" | "mo" | "mo-redir" | "click2sms" | "one-click" | "ussd" | "tpay-he" | "tallyman-one-click" | "pin-mo-ask-operator" | "pin-mo-ask-mobile-number" | "pin-one-click-ask-operator" | "pin-one-click-detect-operator-by-ip" | "one-click-mo-pin-detect-operator-by-ip-or-msisdn" | "pin-click2sms-ask-operator" | "mo-redir-one-click-detect-operator-by-ip" | "pin-mo-redir-ask-mobile-number" | "pin-click2sms-ask-mobile-number" | "mo-one-click-detect-operator-by-ip" | "click2sms-one-click-detect-operator-by-ip" | "pin-header-enrichment" | "pin-msisdn-fowarding-pin-header-enrichment" | "he-pin-mo-redir-header-enrichment" | "he-pin-one-click-header-enrichment" | "he-pin-one-click-ask-operator" | "click2sms-one-click-ask-operator" | "pin-mo-detect-operator-by-ip" | "he-mo-redir-one-click-header-enrichment" | "pin-combo-ask-mobile-number";
|
|
50
51
|
export interface IHash {
|
|
51
52
|
[key: string]: string;
|
|
52
53
|
}
|
|
@@ -65,6 +66,7 @@ export declare type IdentifyFlowOptionsResult<F> = {
|
|
|
65
66
|
rockman_id?: string;
|
|
66
67
|
isHeaderEnrichmentSuccess?: boolean;
|
|
67
68
|
autoRedirect?: boolean;
|
|
69
|
+
isUseMsisdnPrefix?: boolean;
|
|
68
70
|
};
|
|
69
71
|
export declare type IDENTIFYMSISDNEntrySuccess = {};
|
|
70
72
|
export declare type OPERATORSelectFailure = {};
|
|
@@ -161,45 +161,46 @@ function mockStrategyStateByUrlParam() {
|
|
|
161
161
|
function identifyStrategy() {
|
|
162
162
|
return /*#__PURE__*/function () {
|
|
163
163
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch) {
|
|
164
|
-
var _getConfig, strategy, strategyConfigs, search;
|
|
164
|
+
var _getConfig, strategy, strategyConfigs, isUseMsisdnPrefix, search;
|
|
165
165
|
|
|
166
166
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
167
167
|
while (1) {
|
|
168
168
|
switch (_context.prev = _context.next) {
|
|
169
169
|
case 0:
|
|
170
170
|
_getConfig = (0, _utils.getConfig)(), strategy = _getConfig.strategy, strategyConfigs = _getConfig.strategyConfigs;
|
|
171
|
+
isUseMsisdnPrefix = strategyConfigs.isUseMsisdnPrefix;
|
|
171
172
|
search = (0, _utils.searchToObject)();
|
|
172
173
|
|
|
173
174
|
if (!(search["mock-flow"] !== undefined)) {
|
|
174
|
-
_context.next =
|
|
175
|
+
_context.next = 7;
|
|
175
176
|
break;
|
|
176
177
|
}
|
|
177
178
|
|
|
178
179
|
dispatch(mockStrategyStateByUrlParam());
|
|
179
|
-
_context.next =
|
|
180
|
+
_context.next = 32;
|
|
180
181
|
break;
|
|
181
182
|
|
|
182
|
-
case
|
|
183
|
+
case 7:
|
|
183
184
|
_context.t0 = strategy;
|
|
184
|
-
_context.next = _context.t0 === "pin-mo-ask-operator" ?
|
|
185
|
+
_context.next = _context.t0 === "pin-mo-ask-operator" ? 10 : _context.t0 === "pin-mo-redir-ask-mobile-number" ? 11 : _context.t0 === "pin-mo-ask-mobile-number" ? 11 : _context.t0 === "pin-combo-ask-mobile-number" ? 11 : _context.t0 === "pin-one-click-detect-operator-by-ip" ? 12 : _context.t0 === "one-click-mo-pin-detect-operator-by-ip-or-msisdn" ? 12 : _context.t0 === "mo-redir-one-click-detect-operator-by-ip" ? 12 : _context.t0 === "mo-one-click-detect-operator-by-ip" ? 12 : _context.t0 === "click2sms-one-click-detect-operator-by-ip" ? 12 : _context.t0 === "pin-mo-detect-operator-by-ip" ? 12 : _context.t0 === "pin-click2sms-ask-operator" ? 13 : _context.t0 === "he-pin-one-click-ask-operator" ? 13 : _context.t0 === "click2sms-one-click-ask-operator" ? 13 : _context.t0 === "pin-one-click-ask-operator" ? 13 : _context.t0 === "pin-header-enrichment" ? 14 : _context.t0 === "he-pin-mo-redir-header-enrichment" ? 14 : _context.t0 === "he-pin-one-click-header-enrichment" ? 14 : _context.t0 === "he-mo-redir-one-click-header-enrichment" ? 14 : _context.t0 === "pin" ? 15 : _context.t0 === "mo" ? 17 : _context.t0 === "mo-redir" ? 19 : _context.t0 === "one-click" ? 21 : _context.t0 === "tallyman-one-click" ? 23 : _context.t0 === "click2sms" ? 25 : _context.t0 === "ussd" ? 27 : _context.t0 === "tpay-he" ? 29 : 31;
|
|
185
186
|
break;
|
|
186
187
|
|
|
187
|
-
case
|
|
188
|
+
case 10:
|
|
188
189
|
return _context.abrupt("return", dispatch((0, _ask_operator.default)()));
|
|
189
190
|
|
|
190
|
-
case
|
|
191
|
+
case 11:
|
|
191
192
|
return _context.abrupt("return", dispatch((0, _ask_mobile_number.default)()));
|
|
192
193
|
|
|
193
|
-
case
|
|
194
|
+
case 12:
|
|
194
195
|
return _context.abrupt("return", dispatch((0, _detect_operator_by_ip.default)()));
|
|
195
196
|
|
|
196
|
-
case
|
|
197
|
+
case 13:
|
|
197
198
|
return _context.abrupt("return", dispatch((0, _ask_operator.default)()));
|
|
198
199
|
|
|
199
|
-
case
|
|
200
|
+
case 14:
|
|
200
201
|
return _context.abrupt("return", dispatch((0, _header_enrichment.default)()));
|
|
201
202
|
|
|
202
|
-
case
|
|
203
|
+
case 15:
|
|
203
204
|
tracker.sendOptInFlowEvent("Pin");
|
|
204
205
|
return _context.abrupt("return", dispatch({
|
|
205
206
|
type: "IDENTIFY_STRATEGY",
|
|
@@ -207,12 +208,13 @@ function identifyStrategy() {
|
|
|
207
208
|
type: "PIN",
|
|
208
209
|
result: {
|
|
209
210
|
nextAction: "submitMSISDNAction",
|
|
210
|
-
config: strategyConfigs.default.flowConfig
|
|
211
|
+
config: strategyConfigs.default.flowConfig,
|
|
212
|
+
isUseMsisdnPrefix: isUseMsisdnPrefix
|
|
211
213
|
}
|
|
212
214
|
}
|
|
213
215
|
}));
|
|
214
216
|
|
|
215
|
-
case
|
|
217
|
+
case 17:
|
|
216
218
|
tracker.sendOptInFlowEvent("Msisdn to sms");
|
|
217
219
|
return _context.abrupt("return", dispatch({
|
|
218
220
|
type: "IDENTIFY_STRATEGY",
|
|
@@ -225,7 +227,7 @@ function identifyStrategy() {
|
|
|
225
227
|
}
|
|
226
228
|
}));
|
|
227
229
|
|
|
228
|
-
case
|
|
230
|
+
case 19:
|
|
229
231
|
tracker.sendOptInFlowEvent("Redirect");
|
|
230
232
|
return _context.abrupt("return", dispatch({
|
|
231
233
|
type: "IDENTIFY_STRATEGY",
|
|
@@ -238,7 +240,7 @@ function identifyStrategy() {
|
|
|
238
240
|
}
|
|
239
241
|
}));
|
|
240
242
|
|
|
241
|
-
case
|
|
243
|
+
case 21:
|
|
242
244
|
tracker.sendOptInFlowEvent("3G click");
|
|
243
245
|
return _context.abrupt("return", dispatch({
|
|
244
246
|
type: "IDENTIFY_STRATEGY",
|
|
@@ -251,7 +253,7 @@ function identifyStrategy() {
|
|
|
251
253
|
}
|
|
252
254
|
}));
|
|
253
255
|
|
|
254
|
-
case
|
|
256
|
+
case 23:
|
|
255
257
|
tracker.sendOptInFlowEvent("3G click");
|
|
256
258
|
return _context.abrupt("return", dispatch({
|
|
257
259
|
type: "IDENTIFY_STRATEGY",
|
|
@@ -264,7 +266,7 @@ function identifyStrategy() {
|
|
|
264
266
|
}
|
|
265
267
|
}));
|
|
266
268
|
|
|
267
|
-
case
|
|
269
|
+
case 25:
|
|
268
270
|
tracker.sendOptInFlowEvent("Click to sms");
|
|
269
271
|
return _context.abrupt("return", dispatch({
|
|
270
272
|
type: "IDENTIFY_STRATEGY",
|
|
@@ -277,7 +279,7 @@ function identifyStrategy() {
|
|
|
277
279
|
}
|
|
278
280
|
}));
|
|
279
281
|
|
|
280
|
-
case
|
|
282
|
+
case 27:
|
|
281
283
|
tracker.sendOptInFlowEvent("Msisdn to sms");
|
|
282
284
|
return _context.abrupt("return", dispatch({
|
|
283
285
|
type: "IDENTIFY_STRATEGY",
|
|
@@ -290,7 +292,7 @@ function identifyStrategy() {
|
|
|
290
292
|
}
|
|
291
293
|
}));
|
|
292
294
|
|
|
293
|
-
case
|
|
295
|
+
case 29:
|
|
294
296
|
tracker.sendOptInFlowEvent("Hybrid Pin");
|
|
295
297
|
return _context.abrupt("return", dispatch({
|
|
296
298
|
type: "IDENTIFY_STRATEGY",
|
|
@@ -303,10 +305,10 @@ function identifyStrategy() {
|
|
|
303
305
|
}
|
|
304
306
|
}));
|
|
305
307
|
|
|
306
|
-
case
|
|
308
|
+
case 31:
|
|
307
309
|
throw "Strategy not supported";
|
|
308
310
|
|
|
309
|
-
case
|
|
311
|
+
case 32:
|
|
310
312
|
case "end":
|
|
311
313
|
return _context.stop();
|
|
312
314
|
}
|
|
@@ -3,5 +3,6 @@ import { IFlow } from "../StrategyTypes";
|
|
|
3
3
|
export default function ask_mobile_number(): AppThunk;
|
|
4
4
|
export declare function submitMSISDNAction(internationalMSISDN: string): AppThunk;
|
|
5
5
|
export declare const pin_mo_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
|
|
6
|
+
export declare const pin_combo_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
|
|
6
7
|
export declare const pin_mo_redir_ask_mobile_number: (flowObj: IFlow, msisdn: string) => AppThunk;
|
|
7
8
|
export declare const one_click_mo_pin_detect_operator_by_ip_or_msisdn: (flowObj: IFlow, msisdn: string) => AppThunk;
|
|
@@ -46,7 +46,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
46
46
|
value: true
|
|
47
47
|
});
|
|
48
48
|
exports.default = ask_mobile_number;
|
|
49
|
-
exports.pin_mo_redir_ask_mobile_number = exports.pin_mo_ask_mobile_number = exports.one_click_mo_pin_detect_operator_by_ip_or_msisdn = void 0;
|
|
49
|
+
exports.pin_mo_redir_ask_mobile_number = exports.pin_mo_ask_mobile_number = exports.pin_combo_ask_mobile_number = exports.one_click_mo_pin_detect_operator_by_ip_or_msisdn = void 0;
|
|
50
50
|
exports.submitMSISDNAction = submitMSISDNAction;
|
|
51
51
|
|
|
52
52
|
require("core-js/modules/es.object.to-string.js");
|
|
@@ -126,6 +126,7 @@ function submitMSISDNAction(internationalMSISDN) {
|
|
|
126
126
|
|
|
127
127
|
case 5:
|
|
128
128
|
flowObj = _context.sent;
|
|
129
|
+
console.log("flowObj", flowObj);
|
|
129
130
|
dispatch({
|
|
130
131
|
type: "IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
131
132
|
payload: {
|
|
@@ -139,21 +140,24 @@ function submitMSISDNAction(internationalMSISDN) {
|
|
|
139
140
|
}
|
|
140
141
|
});
|
|
141
142
|
_context.t0 = strategy;
|
|
142
|
-
_context.next = _context.t0 === "pin-mo-redir-ask-mobile-number" ?
|
|
143
|
+
_context.next = _context.t0 === "pin-mo-redir-ask-mobile-number" ? 11 : _context.t0 === "pin-mo-ask-mobile-number" ? 12 : _context.t0 === "pin-combo-ask-mobile-number" ? 13 : 14;
|
|
143
144
|
break;
|
|
144
145
|
|
|
145
|
-
case
|
|
146
|
+
case 11:
|
|
146
147
|
return _context.abrupt("return", dispatch(pin_mo_redir_ask_mobile_number(flowObj, internationalMSISDN)));
|
|
147
148
|
|
|
148
|
-
case
|
|
149
|
+
case 12:
|
|
149
150
|
return _context.abrupt("return", dispatch(pin_mo_ask_mobile_number(flowObj, internationalMSISDN)));
|
|
150
151
|
|
|
151
|
-
case
|
|
152
|
-
_context.
|
|
153
|
-
break;
|
|
152
|
+
case 13:
|
|
153
|
+
return _context.abrupt("return", dispatch(pin_combo_ask_mobile_number(flowObj, internationalMSISDN)));
|
|
154
154
|
|
|
155
155
|
case 14:
|
|
156
|
-
_context.
|
|
156
|
+
_context.next = 21;
|
|
157
|
+
break;
|
|
158
|
+
|
|
159
|
+
case 16:
|
|
160
|
+
_context.prev = 16;
|
|
157
161
|
_context.t1 = _context["catch"](0);
|
|
158
162
|
console.warn(_context.t1);
|
|
159
163
|
errorType = "SEAlreadySubscribed" === _context.t1.type ? "AlreadySubscribed" : "SEInvalidMSISDN" == _context.t1.type ? "InvalidMSISDN" : "UnknownError";
|
|
@@ -168,12 +172,12 @@ function submitMSISDNAction(internationalMSISDN) {
|
|
|
168
172
|
}
|
|
169
173
|
});
|
|
170
174
|
|
|
171
|
-
case
|
|
175
|
+
case 21:
|
|
172
176
|
case "end":
|
|
173
177
|
return _context.stop();
|
|
174
178
|
}
|
|
175
179
|
}
|
|
176
|
-
}, _callee, null, [[0,
|
|
180
|
+
}, _callee, null, [[0, 16]]);
|
|
177
181
|
}));
|
|
178
182
|
|
|
179
183
|
return function (_x) {
|
|
@@ -254,6 +258,60 @@ var pin_mo_ask_mobile_number = function pin_mo_ask_mobile_number(flowObj, msisdn
|
|
|
254
258
|
|
|
255
259
|
exports.pin_mo_ask_mobile_number = pin_mo_ask_mobile_number;
|
|
256
260
|
|
|
261
|
+
var pin_combo_ask_mobile_number = function pin_combo_ask_mobile_number(flowObj, msisdn) {
|
|
262
|
+
return function (dispatch) {
|
|
263
|
+
switch (flowObj.flow) {
|
|
264
|
+
case "pin":
|
|
265
|
+
_.tracker.sendOptInFlowEvent("Pin");
|
|
266
|
+
|
|
267
|
+
dispatch({
|
|
268
|
+
type: "IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
269
|
+
payload: {
|
|
270
|
+
type: "IDENTIFY_FLOW_BY_MSISDN",
|
|
271
|
+
result: RDS.Loading(),
|
|
272
|
+
nextData: _objectSpread({
|
|
273
|
+
nextAction: "submitMSISDNAction"
|
|
274
|
+
}, flowObj.operator && {
|
|
275
|
+
operator: flowObj.operator
|
|
276
|
+
})
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
return dispatch({
|
|
280
|
+
type: "IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
281
|
+
payload: {
|
|
282
|
+
type: "PIN",
|
|
283
|
+
result: _objectSpread({
|
|
284
|
+
nextAction: "submitMSISDNAction",
|
|
285
|
+
config: flowObj.flowConfig,
|
|
286
|
+
msisdn: msisdn
|
|
287
|
+
}, flowObj.operator && {
|
|
288
|
+
operator: flowObj.operator
|
|
289
|
+
})
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
default:
|
|
294
|
+
_.tracker.sendOptInFlowEvent("Pin");
|
|
295
|
+
|
|
296
|
+
return dispatch({
|
|
297
|
+
type: "IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
298
|
+
payload: {
|
|
299
|
+
type: "PIN",
|
|
300
|
+
result: _objectSpread({
|
|
301
|
+
nextAction: "submitMSISDNAction",
|
|
302
|
+
config: flowObj.flowConfig,
|
|
303
|
+
rockman_id: flowObj.rockman_id
|
|
304
|
+
}, flowObj.operator && {
|
|
305
|
+
operator: flowObj.operator
|
|
306
|
+
})
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
|
|
313
|
+
exports.pin_combo_ask_mobile_number = pin_combo_ask_mobile_number;
|
|
314
|
+
|
|
257
315
|
var pin_mo_redir_ask_mobile_number = function pin_mo_redir_ask_mobile_number(flowObj, msisdn) {
|
|
258
316
|
return function (dispatch) {
|
|
259
317
|
switch (flowObj.flow) {
|
|
@@ -4,3 +4,5 @@ export declare const getHost: ({ host }: {
|
|
|
4
4
|
host: string;
|
|
5
5
|
}) => string;
|
|
6
6
|
export declare const setOnLoadUtilities: (config: IConfig) => void;
|
|
7
|
+
export declare type SAOperators = 'SA_VIRGIN' | 'SA_MOBILY' | 'SA_STC' | 'SA_ZAIN';
|
|
8
|
+
export declare function getSAOperatorByMsisdnPrefix(msisdn: string): SAOperators | undefined;
|
package/dist/utilities/index.js
CHANGED
|
@@ -3,7 +3,19 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getHost = void 0;
|
|
7
|
+
exports.getSAOperatorByMsisdnPrefix = getSAOperatorByMsisdnPrefix;
|
|
8
|
+
exports.setOnLoadUtilities = exports.isDMBCheck = void 0;
|
|
9
|
+
|
|
10
|
+
require("core-js/modules/es.array.iterator.js");
|
|
11
|
+
|
|
12
|
+
require("core-js/modules/es.map.js");
|
|
13
|
+
|
|
14
|
+
require("core-js/modules/es.object.to-string.js");
|
|
15
|
+
|
|
16
|
+
require("core-js/modules/es.string.iterator.js");
|
|
17
|
+
|
|
18
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
7
19
|
|
|
8
20
|
var _utils = require("../reducers/moFlow/utils");
|
|
9
21
|
|
|
@@ -41,4 +53,14 @@ var setOnLoadUtilities = function setOnLoadUtilities(config) {
|
|
|
41
53
|
}
|
|
42
54
|
};
|
|
43
55
|
|
|
44
|
-
exports.setOnLoadUtilities = setOnLoadUtilities;
|
|
56
|
+
exports.setOnLoadUtilities = setOnLoadUtilities;
|
|
57
|
+
var sa_prefix_operator_map = new Map([['966571', 'SA_VIRGIN'], ['966500', 'SA_STC'], ['966501', 'SA_STC'], ['966502', 'SA_STC'], ['966503', 'SA_STC'], ['966504', 'SA_STC'], ['966505', 'SA_STC'], ['966506', 'SA_STC'], ['966507', 'SA_STC'], ['966508', 'SA_STC'], ['966509', 'SA_STC'], ['966512', 'SA_STC'], ['966514', 'SA_STC'], ['966515', 'SA_STC'], ['966517', 'SA_STC'], ['966530', 'SA_STC'], ['966531', 'SA_STC'], ['966532', 'SA_STC'], ['966533', 'SA_STC'], ['966534', 'SA_STC'], ['966535', 'SA_STC'], ['966536', 'SA_STC'], ['966537', 'SA_STC'], ['966538', 'SA_STC'], ['966539', 'SA_STC'], ['966540', 'SA_MOBILY'], ['966541', 'SA_MOBILY'], ['966542', 'SA_MOBILY'], ['966543', 'SA_MOBILY'], ['966544', 'SA_MOBILY'], ['966545', 'SA_MOBILY'], ['966546', 'SA_MOBILY'], ['966547', 'SA_MOBILY'], ['966548', 'SA_MOBILY'], ['966549', 'SA_MOBILY'], ['966550', 'SA_STC'], ['966551', 'SA_STC'], ['966552', 'SA_STC'], ['966553', 'SA_STC'], ['966554', 'SA_STC'], ['966555', 'SA_STC'], ['966556', 'SA_STC'], ['966557', 'SA_STC'], ['966558', 'SA_STC'], ['966559', 'SA_STC'], ['966560', 'SA_MOBILY'], ['966561', 'SA_MOBILY'], ['966562', 'SA_MOBILY'], ['966563', 'SA_MOBILY'], ['966564', 'SA_MOBILY'], ['966565', 'SA_MOBILY'], ['966566', 'SA_MOBILY'], ['966567', 'SA_MOBILY'], ['966568', 'SA_MOBILY'], ['966569', 'SA_MOBILY'], ['966570', 'SA_VIRGIN'], ['966572', 'SA_VIRGIN'], ['966573', 'SA_VIRGIN'], ['966580', 'SA_ZAIN'], ['966581', 'SA_ZAIN'], ['966582', 'SA_ZAIN'], ['966583', 'SA_ZAIN'], ['966586', 'SA_ZAIN'], ['966588', 'SA_ZAIN'], ['966589', 'SA_ZAIN'], ['966590', 'SA_ZAIN'], ['966591', 'SA_ZAIN'], ['966592', 'SA_ZAIN'], ['966593', 'SA_ZAIN'], ['966594', 'SA_ZAIN'], ['966595', 'SA_ZAIN'], ['966596', 'SA_ZAIN'], ['966597', 'SA_ZAIN'], ['966598', 'SA_ZAIN'], ['966599', 'SA_ZAIN']]);
|
|
58
|
+
|
|
59
|
+
function getSAOperatorByMsisdnPrefix(msisdn) {
|
|
60
|
+
if (msisdn[0] === "0") {
|
|
61
|
+
msisdn = "966" + msisdn.substring(1);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var prefix = msisdn.substring(0, 6);
|
|
65
|
+
return sa_prefix_operator_map.get(prefix);
|
|
66
|
+
}
|
package/package.json
CHANGED
|
@@ -42,6 +42,8 @@ export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraPa
|
|
|
42
42
|
throw "javascript: console.error('SSR'); void 6"
|
|
43
43
|
} else {
|
|
44
44
|
const { host, country, slug, queryString, device, apiAction} = maybeConfig
|
|
45
|
+
const customDomain = slug === "evina-test-handle" ? "dev.ng.eu.ngrok.io" : "de-ads.tallymans.com";
|
|
46
|
+
|
|
45
47
|
const bupperizeCountry = (c:string) => c == 'gb' ? 'uk' : c;
|
|
46
48
|
const offer = window.pac_analytics.visitor.offer
|
|
47
49
|
const s = window.location.search.substr(1)
|
|
@@ -73,7 +75,7 @@ export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraPa
|
|
|
73
75
|
return {redirect_url:result.redirectUrlWithReplacedUniqid}
|
|
74
76
|
}
|
|
75
77
|
}else{
|
|
76
|
-
if(country.toLowerCase() === "za"){
|
|
78
|
+
if(country.toLowerCase() === "za" && slug !== 'evina-test-handle'){
|
|
77
79
|
try{
|
|
78
80
|
const mcpShieldResult: IMcpShieldResult = await window.tallymanApi.mcpShield(host, country, slug, device, offer, rockmanId)
|
|
79
81
|
if(false == mcpShieldResult.success){
|
|
@@ -144,7 +146,7 @@ export const getRedirectUrl = async(window:Window, maybeConfig: IConfig, extraPa
|
|
|
144
146
|
console.warn(err)
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
|
-
const url = `https
|
|
149
|
+
const url = `https://${customDomain}/tallyman/v1/?action=redirect&country=${bupperizeCountry(country)}&slug=${slug}&device=${"smart"}&offerId=${offer}&rockman_id=${rockmanId}${extraParamsQs}&${search}`
|
|
148
150
|
const result = await fetch(url).then(x => x.json())
|
|
149
151
|
|
|
150
152
|
if(false === result.success){
|
|
@@ -29,7 +29,7 @@ export type PINEntryFailure = {
|
|
|
29
29
|
errorType: PINEntryErrorTypes;
|
|
30
30
|
error?: Error;
|
|
31
31
|
};
|
|
32
|
-
export type PINEntrySuccess = { finalUrl: string
|
|
32
|
+
export type PINEntrySuccess = { finalUrl: string; msisdn?:string; isAlreadySubscribed?:boolean; };
|
|
33
33
|
export type PINEntryErrorTypes = "UnknownError" | "TooEarly" | "InvalidPIN" | "UnexpectedState" | "SessionBlocked";
|
|
34
34
|
|
|
35
35
|
export type IMsisdnSumbitNextData = {
|
|
@@ -37,6 +37,7 @@ export type IMsisdnSumbitNextData = {
|
|
|
37
37
|
nextAction:"submitPinAction";
|
|
38
38
|
msisdn:string;
|
|
39
39
|
pinMaxLength?:number | null;
|
|
40
|
+
operator?: string;
|
|
40
41
|
}
|
|
41
42
|
export type IMsisnSubmitActionPayload = {
|
|
42
43
|
type:"MSISDNEntry";
|
|
@@ -5,15 +5,26 @@ import { MSISDNEntryFailure, MSISDNEntryErrorTypes, PINEntryFailure, PINEntrySuc
|
|
|
5
5
|
import { AppThunk } from "../../common-types/AppThunk";
|
|
6
6
|
import submitMSISDN, { mockedCompletedState, mockedMSISDNEntryFailure, mockedPINState, submitPIN } from "./utils";
|
|
7
7
|
import { genericHandler, tracker } from "../strategy";
|
|
8
|
+
import { getSAOperatorByMsisdnPrefix } from "../../utilities";
|
|
9
|
+
import { determineFlowByOperator } from "../strategy/utils";
|
|
8
10
|
|
|
9
11
|
|
|
12
|
+
const getConfigByMsisdnPrefix = (msisdn:string)=>{
|
|
13
|
+
const operatorByPrefix = getSAOperatorByMsisdnPrefix(msisdn);
|
|
14
|
+
const flowObj = determineFlowByOperator(operatorByPrefix);
|
|
15
|
+
return flowObj.flowConfig;
|
|
16
|
+
}
|
|
17
|
+
|
|
10
18
|
//ACTION CREATORS
|
|
11
19
|
export function submitMSISDNAction(msisdn:string, extraParams?:IHash):AppThunk{
|
|
12
20
|
return async (dispatch, store)=>{
|
|
13
21
|
const {currentState} = store().strategy;
|
|
14
22
|
const pinFlowCurrentState = store().pinFlow.currentState;
|
|
15
23
|
if(currentState.type === "PIN"){
|
|
16
|
-
const config = currentState.result
|
|
24
|
+
const { config: configByStrategy, isUseMsisdnPrefix } = currentState.result;
|
|
25
|
+
|
|
26
|
+
const config = isUseMsisdnPrefix ? getConfigByMsisdnPrefix(msisdn) : configByStrategy;
|
|
27
|
+
|
|
17
28
|
const pinMaxLengthByOp:{[key:string]:number} = {
|
|
18
29
|
"SA_MOBILY":6,
|
|
19
30
|
"SA_STC":4,
|
|
@@ -4,9 +4,9 @@ import { AppThunk } from "../../common-types/AppThunk";
|
|
|
4
4
|
|
|
5
5
|
export type IIdentifyResult = {
|
|
6
6
|
operator: string;
|
|
7
|
-
flow
|
|
7
|
+
flow?: string;
|
|
8
8
|
success: boolean;
|
|
9
|
-
rockman_id
|
|
9
|
+
rockman_id?: string;
|
|
10
10
|
message?:string;
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -46,6 +46,7 @@ export type StrategyConfig = {
|
|
|
46
46
|
[key:string]:IFlow;
|
|
47
47
|
};
|
|
48
48
|
default:IFlow;
|
|
49
|
+
isUseMsisdnPrefix?:boolean;
|
|
49
50
|
}
|
|
50
51
|
// export type IStrategy = IPinStrategy | IMoStrategy;
|
|
51
52
|
|
|
@@ -84,7 +85,8 @@ export type IStrategyNames =
|
|
|
84
85
|
| "he-pin-one-click-ask-operator"
|
|
85
86
|
| "click2sms-one-click-ask-operator"
|
|
86
87
|
| "pin-mo-detect-operator-by-ip"
|
|
87
|
-
| "he-mo-redir-one-click-header-enrichment"
|
|
88
|
+
| "he-mo-redir-one-click-header-enrichment"
|
|
89
|
+
| "pin-combo-ask-mobile-number";
|
|
88
90
|
|
|
89
91
|
export interface IHash {
|
|
90
92
|
[key: string]: string
|
|
@@ -111,6 +113,7 @@ export type IdentifyFlowOptionsResult<F> = {
|
|
|
111
113
|
rockman_id?:string;
|
|
112
114
|
isHeaderEnrichmentSuccess?:boolean;
|
|
113
115
|
autoRedirect?:boolean;
|
|
116
|
+
isUseMsisdnPrefix?: boolean;
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
|
|
@@ -100,6 +100,7 @@ export function mockStrategyStateByUrlParam():AppThunk {
|
|
|
100
100
|
export function identifyStrategy():AppThunk {
|
|
101
101
|
return async (dispatch)=>{
|
|
102
102
|
const { strategy, strategyConfigs } = getConfig();
|
|
103
|
+
const { isUseMsisdnPrefix } = strategyConfigs;
|
|
103
104
|
const search = searchToObject() as IMockFlowParams<IMockPinFlowStates>;
|
|
104
105
|
|
|
105
106
|
if(search["mock-flow"] !== undefined){
|
|
@@ -110,6 +111,7 @@ export function identifyStrategy():AppThunk {
|
|
|
110
111
|
return dispatch(ask_operator());
|
|
111
112
|
case "pin-mo-redir-ask-mobile-number":
|
|
112
113
|
case "pin-mo-ask-mobile-number":
|
|
114
|
+
case "pin-combo-ask-mobile-number":
|
|
113
115
|
return dispatch(ask_mobile_number());
|
|
114
116
|
case "pin-one-click-detect-operator-by-ip":
|
|
115
117
|
case "one-click-mo-pin-detect-operator-by-ip-or-msisdn":
|
|
@@ -138,7 +140,8 @@ export function identifyStrategy():AppThunk {
|
|
|
138
140
|
type:"PIN",
|
|
139
141
|
result: {
|
|
140
142
|
nextAction:"submitMSISDNAction",
|
|
141
|
-
config:strategyConfigs.default.flowConfig
|
|
143
|
+
config:strategyConfigs.default.flowConfig,
|
|
144
|
+
isUseMsisdnPrefix
|
|
142
145
|
}
|
|
143
146
|
}
|
|
144
147
|
});
|
|
@@ -50,6 +50,8 @@ export function submitMSISDNAction(internationalMSISDN:string):AppThunk{
|
|
|
50
50
|
})
|
|
51
51
|
const { strategy } = getConfig();
|
|
52
52
|
const flowObj = await determineFlowByMsidn(internationalMSISDN);
|
|
53
|
+
|
|
54
|
+
console.log("flowObj", flowObj)
|
|
53
55
|
dispatch({
|
|
54
56
|
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
55
57
|
payload:{
|
|
@@ -66,6 +68,8 @@ export function submitMSISDNAction(internationalMSISDN:string):AppThunk{
|
|
|
66
68
|
return dispatch(pin_mo_redir_ask_mobile_number(flowObj, internationalMSISDN))
|
|
67
69
|
case "pin-mo-ask-mobile-number":
|
|
68
70
|
return dispatch(pin_mo_ask_mobile_number(flowObj, internationalMSISDN))
|
|
71
|
+
case "pin-combo-ask-mobile-number":
|
|
72
|
+
return dispatch(pin_combo_ask_mobile_number(flowObj, internationalMSISDN))
|
|
69
73
|
}
|
|
70
74
|
} catch (ex) {
|
|
71
75
|
console.warn(ex)
|
|
@@ -153,6 +157,52 @@ export const pin_mo_ask_mobile_number = (flowObj:IFlow, msisdn:string):AppThunk=
|
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
159
|
|
|
160
|
+
export const pin_combo_ask_mobile_number = (flowObj:IFlow, msisdn:string):AppThunk=>{
|
|
161
|
+
return(dispatch)=>{
|
|
162
|
+
switch (flowObj.flow) {
|
|
163
|
+
case "pin":
|
|
164
|
+
tracker.sendOptInFlowEvent("Pin")
|
|
165
|
+
dispatch({
|
|
166
|
+
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
167
|
+
payload:{
|
|
168
|
+
type: "IDENTIFY_FLOW_BY_MSISDN",
|
|
169
|
+
result: RDS.Loading(),
|
|
170
|
+
nextData:{
|
|
171
|
+
nextAction:"submitMSISDNAction",
|
|
172
|
+
...(flowObj.operator && {operator:flowObj.operator})
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
return dispatch({
|
|
177
|
+
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
178
|
+
payload:{
|
|
179
|
+
type:"PIN",
|
|
180
|
+
result: {
|
|
181
|
+
nextAction:"submitMSISDNAction",
|
|
182
|
+
config:flowObj.flowConfig,
|
|
183
|
+
msisdn,
|
|
184
|
+
...(flowObj.operator && {operator:flowObj.operator})
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
default:
|
|
189
|
+
tracker.sendOptInFlowEvent("Pin")
|
|
190
|
+
return dispatch({
|
|
191
|
+
type:"IDENTIFY_FLOW_BY_MSISDN_SUBMIT",
|
|
192
|
+
payload:{
|
|
193
|
+
type:"PIN",
|
|
194
|
+
result: {
|
|
195
|
+
nextAction:"submitMSISDNAction",
|
|
196
|
+
config:flowObj.flowConfig,
|
|
197
|
+
rockman_id:flowObj.rockman_id,
|
|
198
|
+
...(flowObj.operator && {operator:flowObj.operator})
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
156
206
|
|
|
157
207
|
export const pin_mo_redir_ask_mobile_number = (flowObj:IFlow, msisdn:string):AppThunk=>{
|
|
158
208
|
return(dispatch)=>{
|
package/src/utilities/index.ts
CHANGED
|
@@ -24,4 +24,91 @@ export const setOnLoadUtilities = (config:IConfig)=>{
|
|
|
24
24
|
loadMcpShield(window, config);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type SAOperators = 'SA_VIRGIN' | 'SA_MOBILY' | 'SA_STC' | 'SA_ZAIN';
|
|
30
|
+
const sa_prefix_operator_map = new Map<string, SAOperators>([
|
|
31
|
+
['966571', 'SA_VIRGIN']
|
|
32
|
+
, ['966500', 'SA_STC']
|
|
33
|
+
, ['966501', 'SA_STC']
|
|
34
|
+
, ['966502', 'SA_STC']
|
|
35
|
+
, ['966503', 'SA_STC']
|
|
36
|
+
, ['966504', 'SA_STC']
|
|
37
|
+
, ['966505', 'SA_STC']
|
|
38
|
+
, ['966506', 'SA_STC']
|
|
39
|
+
, ['966507', 'SA_STC']
|
|
40
|
+
, ['966508', 'SA_STC']
|
|
41
|
+
, ['966509', 'SA_STC']
|
|
42
|
+
, ['966512', 'SA_STC']
|
|
43
|
+
, ['966514', 'SA_STC']
|
|
44
|
+
, ['966515', 'SA_STC']
|
|
45
|
+
, ['966517', 'SA_STC']
|
|
46
|
+
, ['966530', 'SA_STC']
|
|
47
|
+
, ['966531', 'SA_STC']
|
|
48
|
+
, ['966532', 'SA_STC']
|
|
49
|
+
, ['966533', 'SA_STC']
|
|
50
|
+
, ['966534', 'SA_STC']
|
|
51
|
+
, ['966535', 'SA_STC']
|
|
52
|
+
, ['966536', 'SA_STC']
|
|
53
|
+
, ['966537', 'SA_STC']
|
|
54
|
+
, ['966538', 'SA_STC']
|
|
55
|
+
, ['966539', 'SA_STC']
|
|
56
|
+
, ['966540', 'SA_MOBILY']
|
|
57
|
+
, ['966541', 'SA_MOBILY']
|
|
58
|
+
, ['966542', 'SA_MOBILY']
|
|
59
|
+
, ['966543', 'SA_MOBILY']
|
|
60
|
+
, ['966544', 'SA_MOBILY']
|
|
61
|
+
, ['966545', 'SA_MOBILY']
|
|
62
|
+
, ['966546', 'SA_MOBILY']
|
|
63
|
+
, ['966547', 'SA_MOBILY']
|
|
64
|
+
, ['966548', 'SA_MOBILY']
|
|
65
|
+
, ['966549', 'SA_MOBILY']
|
|
66
|
+
, ['966550', 'SA_STC']
|
|
67
|
+
, ['966551', 'SA_STC']
|
|
68
|
+
, ['966552', 'SA_STC']
|
|
69
|
+
, ['966553', 'SA_STC']
|
|
70
|
+
, ['966554', 'SA_STC']
|
|
71
|
+
, ['966555', 'SA_STC']
|
|
72
|
+
, ['966556', 'SA_STC']
|
|
73
|
+
, ['966557', 'SA_STC']
|
|
74
|
+
, ['966558', 'SA_STC']
|
|
75
|
+
, ['966559', 'SA_STC']
|
|
76
|
+
, ['966560', 'SA_MOBILY']
|
|
77
|
+
, ['966561', 'SA_MOBILY']
|
|
78
|
+
, ['966562', 'SA_MOBILY']
|
|
79
|
+
, ['966563', 'SA_MOBILY']
|
|
80
|
+
, ['966564', 'SA_MOBILY']
|
|
81
|
+
, ['966565', 'SA_MOBILY']
|
|
82
|
+
, ['966566', 'SA_MOBILY']
|
|
83
|
+
, ['966567', 'SA_MOBILY']
|
|
84
|
+
, ['966568', 'SA_MOBILY']
|
|
85
|
+
, ['966569', 'SA_MOBILY']
|
|
86
|
+
, ['966570', 'SA_VIRGIN']
|
|
87
|
+
, ['966572', 'SA_VIRGIN']
|
|
88
|
+
, ['966573', 'SA_VIRGIN']
|
|
89
|
+
, ['966580', 'SA_ZAIN']
|
|
90
|
+
, ['966581', 'SA_ZAIN']
|
|
91
|
+
, ['966582', 'SA_ZAIN']
|
|
92
|
+
, ['966583', 'SA_ZAIN']
|
|
93
|
+
, ['966586', 'SA_ZAIN']
|
|
94
|
+
, ['966588', 'SA_ZAIN']
|
|
95
|
+
, ['966589', 'SA_ZAIN']
|
|
96
|
+
, ['966590', 'SA_ZAIN']
|
|
97
|
+
, ['966591', 'SA_ZAIN']
|
|
98
|
+
, ['966592', 'SA_ZAIN']
|
|
99
|
+
, ['966593', 'SA_ZAIN']
|
|
100
|
+
, ['966594', 'SA_ZAIN']
|
|
101
|
+
, ['966595', 'SA_ZAIN']
|
|
102
|
+
, ['966596', 'SA_ZAIN']
|
|
103
|
+
, ['966597', 'SA_ZAIN']
|
|
104
|
+
, ['966598', 'SA_ZAIN']
|
|
105
|
+
, ['966599', 'SA_ZAIN']
|
|
106
|
+
]);
|
|
107
|
+
|
|
108
|
+
export function getSAOperatorByMsisdnPrefix(msisdn: string) : SAOperators | undefined {
|
|
109
|
+
if(msisdn[0] === "0") {
|
|
110
|
+
msisdn = "966" + msisdn.substring(1);
|
|
111
|
+
}
|
|
112
|
+
const prefix = msisdn.substring(0, 6)
|
|
113
|
+
return sa_prefix_operator_map.get(prefix);
|
|
27
114
|
}
|