ouisys-engine 3.0.10 → 3.0.13
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/api/index.d.ts +5 -0
- package/dist/api/index.js +197 -175
- package/dist/common-types/IError.d.ts +1 -2
- package/dist/common-types/RemoteDataState.d.ts +3 -3
- package/dist/common-types/RemoteDataState.js +13 -10
- package/dist/custom-hooks/useStrategyConfig.d.ts +4 -0
- package/dist/custom-hooks/useStrategyConfig.js +24 -0
- package/dist/flows/click2smsFlow.js +4 -0
- package/dist/flows/moFlow.js +4 -0
- package/dist/flows/moRedirFlow.js +4 -0
- package/dist/flows/oneClickFlow.js +6 -0
- package/dist/flows/strategy.js +3 -0
- package/dist/flows/ussdFlow.js +3 -0
- package/dist/reducers/click2smsFlow/Click2smsTypes.d.ts +1 -1
- package/dist/reducers/click2smsFlow/index.js +3 -3
- package/dist/reducers/click2smsFlow/utils.js +18 -23
- package/dist/reducers/moFlow/index.js +18 -28
- package/dist/reducers/moFlow/utils.js +3 -12
- package/dist/reducers/moRedirFlow/utils.js +4 -3
- package/dist/reducers/oneClickFlow/utils.js +8 -8
- package/dist/reducers/pinFlow/index.js +10 -9
- package/dist/reducers/pinFlow/utils.js +19 -24
- package/dist/reducers/strategy/StrategyTypes.d.ts +3 -2
- package/dist/reducers/strategy/index.js +2 -2
- package/dist/reducers/strategy/strategies/header_enrichment.js +50 -53
- package/dist/reducers/strategy/utils.d.ts +3 -3
- package/dist/reducers/strategy/utils.js +36 -49
- package/dist/reducers/ussdFlow/utils.js +4 -2
- package/dist/utilities/storeEmail.d.ts +3 -0
- package/dist/utilities/storeEmail.js +78 -0
- package/package.json +3 -2
|
@@ -132,7 +132,7 @@ function submitMSISDNAction(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
137
|
type: 'PIN_FLOW_MSISDN_SUBMIT',
|
|
138
138
|
payload: _objectSpread(_objectSpread({}, pinFlowCurrentState), {}, {
|
|
@@ -151,11 +151,11 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
151
151
|
type: 'PINEntry',
|
|
152
152
|
result: RDS.NothingYet(),
|
|
153
153
|
data: {
|
|
154
|
-
actualPIN: msisdnSubmissionResult.type
|
|
154
|
+
actualPIN: msisdnSubmissionResult.type === 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult.pin : null,
|
|
155
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,8 @@ 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 = // eslint-disable-next-line no-nested-ternary
|
|
170
|
+
_context.t0.type === 'AlreadySubscribed' ? 'AlreadySubscribed' : _context.t0.type === 'InvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
|
|
170
171
|
|
|
171
172
|
_strategy.tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
|
|
172
173
|
msisdn: msisdn,
|
|
@@ -206,7 +207,7 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
206
207
|
errorType: 'UnexpectedState'
|
|
207
208
|
});
|
|
208
209
|
|
|
209
|
-
throw 'Unexpected state';
|
|
210
|
+
throw new Error('Unexpected state');
|
|
210
211
|
|
|
211
212
|
case 29:
|
|
212
213
|
case "end":
|
|
@@ -279,7 +280,7 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
279
280
|
type: 'PINEntry',
|
|
280
281
|
result: RDS.NothingYet(),
|
|
281
282
|
data: {
|
|
282
|
-
actualPIN: msisdnSubmissionResult.type
|
|
283
|
+
actualPIN: msisdnSubmissionResult.type === 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult.pin : null,
|
|
283
284
|
nextAction: 'submitPinAction',
|
|
284
285
|
msisdn: msisdn
|
|
285
286
|
}
|
|
@@ -332,7 +333,7 @@ function reSubmitMSISDNAction(msisdn, extraParams) {
|
|
|
332
333
|
errorType: 'UnexpectedState'
|
|
333
334
|
});
|
|
334
335
|
|
|
335
|
-
throw 'Unexpected state';
|
|
336
|
+
throw new Error('Unexpected state');
|
|
336
337
|
|
|
337
338
|
case 26:
|
|
338
339
|
case "end":
|
|
@@ -418,7 +419,7 @@ function submitPinAction(msisdn, pin, extraParams) {
|
|
|
418
419
|
})
|
|
419
420
|
})
|
|
420
421
|
});
|
|
421
|
-
throw 'Unexpected state';
|
|
422
|
+
throw new Error('Unexpected state');
|
|
422
423
|
|
|
423
424
|
case 17:
|
|
424
425
|
_context3.next = 25;
|
|
@@ -482,7 +483,7 @@ function mockPinFlow(mockState) {
|
|
|
482
483
|
});
|
|
483
484
|
|
|
484
485
|
default:
|
|
485
|
-
throw 'Mock Flow not supported';
|
|
486
|
+
throw new Error('Mock Flow not supported');
|
|
486
487
|
}
|
|
487
488
|
}
|
|
488
489
|
};
|
|
@@ -94,7 +94,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
94
94
|
|
|
95
95
|
function submitMSISDN(_x, _x2, _x3, _x4) {
|
|
96
96
|
return _submitMSISDN.apply(this, arguments);
|
|
97
|
-
}
|
|
97
|
+
} // const bupperizeCountry = (c: string) => (c === 'gb' ? 'uk' : c);
|
|
98
|
+
|
|
98
99
|
|
|
99
100
|
function _submitMSISDN() {
|
|
100
101
|
_submitMSISDN = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(window, maybeConfig, internationalMSISDN, extraParams) {
|
|
@@ -107,7 +108,7 @@ function _submitMSISDN() {
|
|
|
107
108
|
offer: window.pac_analytics.visitor.offer
|
|
108
109
|
}, maybeConfig || {});
|
|
109
110
|
|
|
110
|
-
if (!(config.automaticallySubmitAllOperators
|
|
111
|
+
if (!(config.automaticallySubmitAllOperators === true && !!config.operators && config.operators.length > 0)) {
|
|
111
112
|
_context.next = 3;
|
|
112
113
|
break;
|
|
113
114
|
}
|
|
@@ -127,11 +128,7 @@ function _submitMSISDN() {
|
|
|
127
128
|
return _submitMSISDN.apply(this, arguments);
|
|
128
129
|
}
|
|
129
130
|
|
|
130
|
-
var
|
|
131
|
-
return c == 'gb' ? 'uk' : c;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
var uniqidResult = '';
|
|
131
|
+
var uniqidResult = ''; // eslint-disable-next-line consistent-return
|
|
135
132
|
|
|
136
133
|
function loadMcpShield(_x5, _x6) {
|
|
137
134
|
return _loadMcpShield.apply(this, arguments);
|
|
@@ -154,7 +151,7 @@ function _loadMcpShield() {
|
|
|
154
151
|
case 6:
|
|
155
152
|
mcpShieldResult = _context2.sent;
|
|
156
153
|
|
|
157
|
-
if (!(mcpShieldResult.success
|
|
154
|
+
if (!(mcpShieldResult.success === false)) {
|
|
158
155
|
_context2.next = 11;
|
|
159
156
|
break;
|
|
160
157
|
}
|
|
@@ -218,7 +215,7 @@ function _submitMSISDNOnce() {
|
|
|
218
215
|
'kuwait-agency-mix-yourspot-riddles': 'kuwait-agency-mix-yourspot-riddles'
|
|
219
216
|
};
|
|
220
217
|
|
|
221
|
-
if (!(config.country.toLowerCase()
|
|
218
|
+
if (!(config.country.toLowerCase() === 'k2' && supportedSlugs[config.slug])) {
|
|
222
219
|
_context3.next = 12;
|
|
223
220
|
break;
|
|
224
221
|
}
|
|
@@ -229,7 +226,7 @@ function _submitMSISDNOnce() {
|
|
|
229
226
|
case 10:
|
|
230
227
|
identifiedUser = _context3.sent;
|
|
231
228
|
|
|
232
|
-
if (identifiedUser.operator && identifiedUser.operator
|
|
229
|
+
if (identifiedUser.operator && identifiedUser.operator === 'K2_ZAIN') {
|
|
233
230
|
window.hostCountry = 'KW';
|
|
234
231
|
window.hostSlug = 'kw-mt2-hosted-flow-mobfun';
|
|
235
232
|
config.country = window.hostCountry;
|
|
@@ -238,11 +235,11 @@ function _submitMSISDNOnce() {
|
|
|
238
235
|
|
|
239
236
|
case 12:
|
|
240
237
|
slug = config.slug, country = config.country, device = config.device, offer = config.offer, host = config.host;
|
|
241
|
-
search = window.location.search.indexOf('redirect-back=1')
|
|
238
|
+
search = window.location.search.indexOf('redirect-back=1') === -1 ? window.location.search.substr(1) || '' : '';
|
|
242
239
|
extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
|
|
243
240
|
return "".concat(k, "=").concat(extraParams[k]);
|
|
244
241
|
}).join('&'));
|
|
245
|
-
uniqid = !!uniqidResult && uniqidResult
|
|
242
|
+
uniqid = !!uniqidResult && uniqidResult !== '' ? "&mcpUniqid=".concat(uniqidResult) : '';
|
|
246
243
|
_context3.next = 18;
|
|
247
244
|
return window.tallymanApi.triggerPin(host, country, slug, device, offer, msisdn, rockmanId, extraParamsQs, search, uniqid);
|
|
248
245
|
|
|
@@ -255,7 +252,7 @@ function _submitMSISDNOnce() {
|
|
|
255
252
|
}
|
|
256
253
|
|
|
257
254
|
error = new Error("Error in submitMSISDN() trigger-pin action:\n".concat(result.message));
|
|
258
|
-
error.type = result.message
|
|
255
|
+
error.type = result.message === 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMSISDN';
|
|
259
256
|
error.productUrl = result.product_url ? result.product_url : '';
|
|
260
257
|
console.error(error);
|
|
261
258
|
throw error;
|
|
@@ -270,7 +267,7 @@ function _submitMSISDNOnce() {
|
|
|
270
267
|
}
|
|
271
268
|
};
|
|
272
269
|
|
|
273
|
-
if (!(country && result.operator && (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()] || country.toLowerCase()
|
|
270
|
+
if (!(country && result.operator && (kwCodesWithMcpShied[country.toLowerCase()] && kwCodesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()] || country.toLowerCase() === 'iq'))) {
|
|
274
271
|
_context3.next = 39;
|
|
275
272
|
break;
|
|
276
273
|
}
|
|
@@ -282,7 +279,7 @@ function _submitMSISDNOnce() {
|
|
|
282
279
|
case 32:
|
|
283
280
|
mcpShieldResult = _context3.sent;
|
|
284
281
|
|
|
285
|
-
if (mcpShieldResult.success
|
|
282
|
+
if (mcpShieldResult.success === false) {
|
|
286
283
|
console.warn(mcpShieldResult.message);
|
|
287
284
|
} else {
|
|
288
285
|
(0, _loadScriptInnerHtml.default)(mcpShieldResult.source);
|
|
@@ -368,11 +365,11 @@ function _submitMSISDNForMultipleOperators() {
|
|
|
368
365
|
results = _context5.sent;
|
|
369
366
|
// @ts-ignore
|
|
370
367
|
alreadySubscribed = results.find(function (r) {
|
|
371
|
-
return r.type
|
|
368
|
+
return r.type === 'left' && r.value.type === 'AlreadySubscribed';
|
|
372
369
|
});
|
|
373
370
|
|
|
374
371
|
if (!results.every(function (r) {
|
|
375
|
-
return r.type
|
|
372
|
+
return r.type === 'left';
|
|
376
373
|
})) {
|
|
377
374
|
_context5.next = 8;
|
|
378
375
|
break;
|
|
@@ -437,7 +434,7 @@ function _submitPIN() {
|
|
|
437
434
|
throw emptyPinError;
|
|
438
435
|
|
|
439
436
|
case 9:
|
|
440
|
-
uniqid = uniqidResult
|
|
437
|
+
uniqid = uniqidResult !== '' ? "&mcpUniqid=".concat(uniqidResult) : '';
|
|
441
438
|
evinaTid = typeof window !== 'undefined' && window.tid ? window.tid : '';
|
|
442
439
|
_context6.next = 13;
|
|
443
440
|
return window.tallymanApi.verifyPin(host, country, slug, device, offer, rockmanId, pin, extraParamsQs, uniqid, evinaTid);
|
|
@@ -482,7 +479,7 @@ function _submitPIN() {
|
|
|
482
479
|
break;
|
|
483
480
|
}
|
|
484
481
|
|
|
485
|
-
isAlreadySubscribed = pinResult.message
|
|
482
|
+
isAlreadySubscribed = pinResult.message === 'ALREADY SUBSCRIBED';
|
|
486
483
|
return _context6.abrupt("return", {
|
|
487
484
|
productUrl: checkResult.product_url || null,
|
|
488
485
|
isAlreadySubscribed: isAlreadySubscribed
|
|
@@ -494,7 +491,7 @@ function _submitPIN() {
|
|
|
494
491
|
throw _pinError;
|
|
495
492
|
|
|
496
493
|
case 35:
|
|
497
|
-
_isAlreadySubscribed = pinResult.message
|
|
494
|
+
_isAlreadySubscribed = pinResult.message === 'ALREADY SUBSCRIBED';
|
|
498
495
|
return _context6.abrupt("return", {
|
|
499
496
|
productUrl: pinResult.product_url || null,
|
|
500
497
|
isAlreadySubscribed: _isAlreadySubscribed
|
|
@@ -513,9 +510,7 @@ function _submitPIN() {
|
|
|
513
510
|
var mockedPINState = {
|
|
514
511
|
currentState: {
|
|
515
512
|
type: 'PINEntry',
|
|
516
|
-
result: RDS.NothingYet(
|
|
517
|
-
finalUrl: ''
|
|
518
|
-
}),
|
|
513
|
+
result: RDS.NothingYet(),
|
|
519
514
|
data: {
|
|
520
515
|
actualPIN: '',
|
|
521
516
|
nextAction: 'submitPinAction',
|
|
@@ -528,7 +523,7 @@ var mockedCompletedState = {
|
|
|
528
523
|
currentState: {
|
|
529
524
|
type: 'PINEntry',
|
|
530
525
|
result: RDS.Success({
|
|
531
|
-
finalUrl: '
|
|
526
|
+
finalUrl: 'https://google.com'
|
|
532
527
|
}),
|
|
533
528
|
data: {
|
|
534
529
|
actualPIN: '',
|
|
@@ -26,6 +26,7 @@ export declare type IConfig = {
|
|
|
26
26
|
device?: 'smart' | 'feature';
|
|
27
27
|
automaticallySubmitAllOperators?: boolean;
|
|
28
28
|
operators?: string[];
|
|
29
|
+
service?: string;
|
|
29
30
|
};
|
|
30
31
|
export declare type ISupportedFlows = 'pin' | 'mo' | 'oneClick' | 'click2sms' | 'moRedir' | 'ussd' | 'tpayHe';
|
|
31
32
|
export declare type IFlow = {
|
|
@@ -54,7 +55,7 @@ export interface IHash {
|
|
|
54
55
|
export declare type IDENTIFYMSISDNEntryErrorTypes = 'AlreadySubscribed' | 'UnknownError' | 'InvalidMSISDN';
|
|
55
56
|
export declare type IDENTIFYMSISDNEntryFailure = {
|
|
56
57
|
errorType: IDENTIFYMSISDNEntryErrorTypes;
|
|
57
|
-
error:
|
|
58
|
+
error: unknown;
|
|
58
59
|
};
|
|
59
60
|
export declare type IdentifyFlowOptionsResult<F> = {
|
|
60
61
|
config: IConfig;
|
|
@@ -156,7 +157,7 @@ export declare type IStrategyActions = {
|
|
|
156
157
|
payload: IIdentifyFlowByHePayload;
|
|
157
158
|
} | {
|
|
158
159
|
type: 'MOCK_STRATEGY_STATE';
|
|
159
|
-
payload:
|
|
160
|
+
payload: unknown;
|
|
160
161
|
};
|
|
161
162
|
export declare type IStrategyCurrentState = {
|
|
162
163
|
type: 'IDENTIFY_STRATEGY';
|
|
@@ -152,7 +152,7 @@ function mockStrategyStateByUrlParam() {
|
|
|
152
152
|
break;
|
|
153
153
|
|
|
154
154
|
default:
|
|
155
|
-
throw 'Mock Flow not supported';
|
|
155
|
+
throw new Error('Mock Flow not supported');
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
};
|
|
@@ -306,7 +306,7 @@ function identifyStrategy() {
|
|
|
306
306
|
}));
|
|
307
307
|
|
|
308
308
|
case 31:
|
|
309
|
-
throw 'Strategy not supported';
|
|
309
|
+
throw new Error('Strategy not supported');
|
|
310
310
|
|
|
311
311
|
case 32:
|
|
312
312
|
case "end":
|
|
@@ -113,7 +113,7 @@ function identify_user() {
|
|
|
113
113
|
var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
|
|
114
114
|
return /*#__PURE__*/function () {
|
|
115
115
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(dispatch) {
|
|
116
|
-
var ipRangeName, heResult, flowObj, msisdn
|
|
116
|
+
var ipRangeName, heResult, flowObj, msisdn;
|
|
117
117
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
118
118
|
while (1) {
|
|
119
119
|
switch (_context.prev = _context.next) {
|
|
@@ -124,10 +124,9 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
|
|
|
124
124
|
|
|
125
125
|
case 3:
|
|
126
126
|
ipRangeName = _context.sent;
|
|
127
|
-
console.log('ipRangeName', ipRangeName);
|
|
128
127
|
|
|
129
|
-
if (!(ipRangeName
|
|
130
|
-
_context.next =
|
|
128
|
+
if (!(ipRangeName === null)) {
|
|
129
|
+
_context.next = 7;
|
|
131
130
|
break;
|
|
132
131
|
}
|
|
133
132
|
|
|
@@ -144,21 +143,20 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
|
|
|
144
143
|
}
|
|
145
144
|
}));
|
|
146
145
|
|
|
147
|
-
case
|
|
148
|
-
_context.next =
|
|
146
|
+
case 7:
|
|
147
|
+
_context.next = 9;
|
|
149
148
|
return (0, _utils.identifyUser)();
|
|
150
149
|
|
|
151
|
-
case
|
|
150
|
+
case 9:
|
|
152
151
|
heResult = _context.sent;
|
|
153
152
|
flowObj = defaultFlow;
|
|
154
153
|
|
|
155
154
|
if (!(heResult.msisdn !== undefined && heResult.msisdn !== '')) {
|
|
156
|
-
_context.next =
|
|
155
|
+
_context.next = 16;
|
|
157
156
|
break;
|
|
158
157
|
}
|
|
159
158
|
|
|
160
|
-
msisdn = heResult.msisdn;
|
|
161
|
-
operator = heResult.operator;
|
|
159
|
+
msisdn = heResult.msisdn; // const { operator } = heResult;
|
|
162
160
|
|
|
163
161
|
_.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
|
|
164
162
|
msisdn: msisdn
|
|
@@ -180,7 +178,7 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
|
|
|
180
178
|
}
|
|
181
179
|
}));
|
|
182
180
|
|
|
183
|
-
case
|
|
181
|
+
case 16:
|
|
184
182
|
_.tracker.sendOptInFlowEvent('Pin');
|
|
185
183
|
|
|
186
184
|
return _context.abrupt("return", dispatch({
|
|
@@ -194,8 +192,8 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
|
|
|
194
192
|
}
|
|
195
193
|
}));
|
|
196
194
|
|
|
197
|
-
case
|
|
198
|
-
_context.prev =
|
|
195
|
+
case 20:
|
|
196
|
+
_context.prev = 20;
|
|
199
197
|
_context.t0 = _context["catch"](0);
|
|
200
198
|
console.warn(_context.t0);
|
|
201
199
|
|
|
@@ -216,12 +214,12 @@ var pin_header_enrichment = function pin_header_enrichment(defaultFlow) {
|
|
|
216
214
|
}
|
|
217
215
|
});
|
|
218
216
|
|
|
219
|
-
case
|
|
217
|
+
case 26:
|
|
220
218
|
case "end":
|
|
221
219
|
return _context.stop();
|
|
222
220
|
}
|
|
223
221
|
}
|
|
224
|
-
}, _callee, null, [[0,
|
|
222
|
+
}, _callee, null, [[0, 20]]);
|
|
225
223
|
}));
|
|
226
224
|
|
|
227
225
|
return function (_x) {
|
|
@@ -235,8 +233,7 @@ exports.pin_header_enrichment = pin_header_enrichment;
|
|
|
235
233
|
var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrichment(defaultFlow) {
|
|
236
234
|
return /*#__PURE__*/function () {
|
|
237
235
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dispatch) {
|
|
238
|
-
var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator
|
|
239
|
-
|
|
236
|
+
var switchState, ipRangeName, mapIpRangeToAgency, flowObj, heResult, msisdn, subscription_url, redirect_url, operator;
|
|
240
237
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
241
238
|
while (1) {
|
|
242
239
|
switch (_context2.prev = _context2.next) {
|
|
@@ -268,7 +265,7 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
|
|
|
268
265
|
});
|
|
269
266
|
|
|
270
267
|
case 'pin':
|
|
271
|
-
if (isHeaderEnrichmentSuccess
|
|
268
|
+
if (isHeaderEnrichmentSuccess === true) {
|
|
272
269
|
_.tracker.sendOptInFlowEvent('Hybrid Pin');
|
|
273
270
|
} else {
|
|
274
271
|
_.tracker.sendOptInFlowEvent('Pin');
|
|
@@ -312,7 +309,7 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
|
|
|
312
309
|
case 3:
|
|
313
310
|
ipRangeName = _context2.sent;
|
|
314
311
|
|
|
315
|
-
if (!(ipRangeName
|
|
312
|
+
if (!(ipRangeName === null)) {
|
|
316
313
|
_context2.next = 7;
|
|
317
314
|
break;
|
|
318
315
|
}
|
|
@@ -333,19 +330,22 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
|
|
|
333
330
|
|
|
334
331
|
case 7:
|
|
335
332
|
_context2.prev = 7;
|
|
336
|
-
|
|
333
|
+
mapIpRangeToAgency = {
|
|
334
|
+
om_ooredoo: 'o2_ooredoo'
|
|
335
|
+
};
|
|
336
|
+
flowObj = (0, _utils.determineFlowByOperator)(mapIpRangeToAgency[ipRangeName.toUpperCase()]);
|
|
337
337
|
|
|
338
|
-
if (!(flowObj.flow
|
|
339
|
-
_context2.next =
|
|
338
|
+
if (!(flowObj.flow === 'oneClick')) {
|
|
339
|
+
_context2.next = 19;
|
|
340
340
|
break;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
_context2.next =
|
|
343
|
+
_context2.next = 13;
|
|
344
344
|
return (0, _utils.identifyUser)({
|
|
345
345
|
operator: ipRangeName
|
|
346
346
|
});
|
|
347
347
|
|
|
348
|
-
case
|
|
348
|
+
case 13:
|
|
349
349
|
heResult = _context2.sent;
|
|
350
350
|
msisdn = heResult.msisdn, subscription_url = heResult.subscription_url, redirect_url = heResult.redirect_url;
|
|
351
351
|
operator = heResult.operator ? heResult.operator.toUpperCase() : ipRangeName.toUpperCase();
|
|
@@ -355,28 +355,26 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
|
|
|
355
355
|
msisdn: msisdn
|
|
356
356
|
});
|
|
357
357
|
|
|
358
|
-
_flowObj = (0, _utils.determineFlowByOperator)(operator);
|
|
359
358
|
switchState({
|
|
360
|
-
flowObj:
|
|
359
|
+
flowObj: flowObj,
|
|
361
360
|
msisdn: msisdn,
|
|
362
361
|
operator: operator,
|
|
363
362
|
subscription_url: subscription_url,
|
|
364
363
|
redirect_url: redirect_url
|
|
365
364
|
});
|
|
366
365
|
} else {
|
|
367
|
-
_flowObj2 = (0, _utils.determineFlowByOperator)(operator);
|
|
368
366
|
switchState({
|
|
369
|
-
flowObj:
|
|
367
|
+
flowObj: flowObj,
|
|
370
368
|
redirect_url: redirect_url,
|
|
371
369
|
subscription_url: subscription_url,
|
|
372
370
|
operator: operator
|
|
373
371
|
});
|
|
374
372
|
}
|
|
375
373
|
|
|
376
|
-
_context2.next =
|
|
374
|
+
_context2.next = 21;
|
|
377
375
|
break;
|
|
378
376
|
|
|
379
|
-
case
|
|
377
|
+
case 19:
|
|
380
378
|
_.tracker.sendOptInFlowEvent('Pin');
|
|
381
379
|
|
|
382
380
|
return _context2.abrupt("return", dispatch({
|
|
@@ -391,12 +389,12 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
|
|
|
391
389
|
}
|
|
392
390
|
}));
|
|
393
391
|
|
|
394
|
-
case
|
|
395
|
-
_context2.next =
|
|
392
|
+
case 21:
|
|
393
|
+
_context2.next = 29;
|
|
396
394
|
break;
|
|
397
395
|
|
|
398
|
-
case
|
|
399
|
-
_context2.prev =
|
|
396
|
+
case 23:
|
|
397
|
+
_context2.prev = 23;
|
|
400
398
|
_context2.t0 = _context2["catch"](7);
|
|
401
399
|
console.warn(_context2.t0);
|
|
402
400
|
|
|
@@ -417,12 +415,12 @@ var he_pin_one_click_header_enrichment = function he_pin_one_click_header_enrich
|
|
|
417
415
|
}
|
|
418
416
|
});
|
|
419
417
|
|
|
420
|
-
case
|
|
418
|
+
case 29:
|
|
421
419
|
case "end":
|
|
422
420
|
return _context2.stop();
|
|
423
421
|
}
|
|
424
422
|
}
|
|
425
|
-
}, _callee2, null, [[7,
|
|
423
|
+
}, _callee2, null, [[7, 23]]);
|
|
426
424
|
}));
|
|
427
425
|
|
|
428
426
|
return function (_x2) {
|
|
@@ -436,8 +434,7 @@ exports.he_pin_one_click_header_enrichment = he_pin_one_click_header_enrichment;
|
|
|
436
434
|
var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_header_enrichment(defaultFlow) {
|
|
437
435
|
return /*#__PURE__*/function () {
|
|
438
436
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(dispatch) {
|
|
439
|
-
var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator
|
|
440
|
-
|
|
437
|
+
var switchState, ipRangeName, flowObj, heResult, msisdn, subscription_url, redirect_url, operator;
|
|
441
438
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
442
439
|
while (1) {
|
|
443
440
|
switch (_context3.prev = _context3.next) {
|
|
@@ -509,7 +506,7 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
|
|
|
509
506
|
case 3:
|
|
510
507
|
ipRangeName = _context3.sent;
|
|
511
508
|
|
|
512
|
-
if (!(ipRangeName
|
|
509
|
+
if (!(ipRangeName === null)) {
|
|
513
510
|
_context3.next = 7;
|
|
514
511
|
break;
|
|
515
512
|
}
|
|
@@ -532,7 +529,7 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
|
|
|
532
529
|
_context3.prev = 7;
|
|
533
530
|
flowObj = (0, _utils.determineFlowByOperator)(ipRangeName.toUpperCase());
|
|
534
531
|
|
|
535
|
-
if (!(flowObj.flow
|
|
532
|
+
if (!(flowObj.flow === 'oneClick')) {
|
|
536
533
|
_context3.next = 18;
|
|
537
534
|
break;
|
|
538
535
|
}
|
|
@@ -550,20 +547,20 @@ var he_mo_redir_one_click_header_enrichment = function he_mo_redir_one_click_hea
|
|
|
550
547
|
if (msisdn && msisdn !== '') {
|
|
551
548
|
_.tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
|
|
552
549
|
msisdn: msisdn
|
|
553
|
-
});
|
|
550
|
+
}); // const flowObj = determineFlowByOperator(operator);
|
|
551
|
+
|
|
554
552
|
|
|
555
|
-
_flowObj3 = (0, _utils.determineFlowByOperator)(operator);
|
|
556
553
|
switchState({
|
|
557
|
-
flowObj:
|
|
554
|
+
flowObj: flowObj,
|
|
558
555
|
msisdn: msisdn,
|
|
559
556
|
operator: operator,
|
|
560
557
|
subscription_url: subscription_url,
|
|
561
558
|
redirect_url: redirect_url
|
|
562
559
|
});
|
|
563
560
|
} else {
|
|
564
|
-
|
|
561
|
+
// const flowObj = determineFlowByOperator(operator);
|
|
565
562
|
switchState({
|
|
566
|
-
flowObj:
|
|
563
|
+
flowObj: flowObj,
|
|
567
564
|
redirect_url: redirect_url,
|
|
568
565
|
subscription_url: subscription_url,
|
|
569
566
|
operator: operator
|
|
@@ -633,7 +630,7 @@ exports.he_mo_redir_one_click_header_enrichment = he_mo_redir_one_click_header_e
|
|
|
633
630
|
var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichment(defaultFlow) {
|
|
634
631
|
return /*#__PURE__*/function () {
|
|
635
632
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(dispatch) {
|
|
636
|
-
var switchState, heResult, msisdn, operator, flowObj,
|
|
633
|
+
var switchState, heResult, msisdn, operator, flowObj, _flowObj, _flowObj2, _flowObj3;
|
|
637
634
|
|
|
638
635
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
639
636
|
while (1) {
|
|
@@ -662,7 +659,7 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
|
|
|
662
659
|
});
|
|
663
660
|
|
|
664
661
|
case 'pin':
|
|
665
|
-
if (isHeaderEnrichmentSuccess
|
|
662
|
+
if (isHeaderEnrichmentSuccess === true) {
|
|
666
663
|
_.tracker.sendOptInFlowEvent('Hybrid Pin');
|
|
667
664
|
} else {
|
|
668
665
|
_.tracker.sendOptInFlowEvent('Pin');
|
|
@@ -734,8 +731,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
|
|
|
734
731
|
return (0, _utils.determineFlowByOperatorFromIp)();
|
|
735
732
|
|
|
736
733
|
case 16:
|
|
737
|
-
|
|
738
|
-
switchState(
|
|
734
|
+
_flowObj = _context4.sent;
|
|
735
|
+
switchState(_flowObj, msisdn);
|
|
739
736
|
|
|
740
737
|
case 18:
|
|
741
738
|
_context4.next = 24;
|
|
@@ -746,8 +743,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
|
|
|
746
743
|
return (0, _utils.determineFlowByOperatorFromIp)();
|
|
747
744
|
|
|
748
745
|
case 22:
|
|
749
|
-
|
|
750
|
-
switchState(
|
|
746
|
+
_flowObj2 = _context4.sent;
|
|
747
|
+
switchState(_flowObj2);
|
|
751
748
|
|
|
752
749
|
case 24:
|
|
753
750
|
_context4.next = 42;
|
|
@@ -767,8 +764,8 @@ var he_pin_mo_redir_header_enrichment = function he_pin_mo_redir_header_enrichme
|
|
|
767
764
|
return (0, _utils.determineFlowByOperatorFromIp)();
|
|
768
765
|
|
|
769
766
|
case 33:
|
|
770
|
-
|
|
771
|
-
switchState(
|
|
767
|
+
_flowObj3 = _context4.sent;
|
|
768
|
+
switchState(_flowObj3);
|
|
772
769
|
_context4.next = 42;
|
|
773
770
|
break;
|
|
774
771
|
|
|
@@ -2,14 +2,14 @@ import Either from '../../common-types/Either';
|
|
|
2
2
|
import { ILinkExtraParams } from '../oneClickFlow/OneClickTypes';
|
|
3
3
|
import { IConfig, IFlow, IStrategy, IStrategyReducerState } from './StrategyTypes';
|
|
4
4
|
export declare const wait: (ms: number) => Promise<unknown>;
|
|
5
|
-
export declare const loop: <
|
|
5
|
+
export declare const loop: <_I extends {}, R extends {}>(f: () => Promise<R>, max: number, stop: (r: R) => boolean, i: number) => Promise<R>;
|
|
6
6
|
export declare function right<L, R>(r: R): Either<L, R>;
|
|
7
7
|
export declare function left<L, R>(l: L): Either<L, R>;
|
|
8
8
|
export declare const getConfig: () => IStrategy;
|
|
9
9
|
export declare const searchToObject: () => {};
|
|
10
10
|
export declare function determineFlowByMsidn(internationalMSISDN: string): Promise<IFlow>;
|
|
11
11
|
export declare function determineFlowByOperator(operator: string): IFlow;
|
|
12
|
-
export declare function determineFlowByOperatorFromIp(
|
|
12
|
+
export declare function determineFlowByOperatorFromIp(): Promise<IFlow>;
|
|
13
13
|
export declare function getOperators(): Array<string>;
|
|
14
14
|
export declare const identifyUser: (extraParams?: ILinkExtraParams) => Promise<{
|
|
15
15
|
msisdn: string;
|
|
@@ -18,7 +18,7 @@ export declare const identifyUser: (extraParams?: ILinkExtraParams) => Promise<{
|
|
|
18
18
|
redirect_url?: string;
|
|
19
19
|
action?: () => Promise<string>;
|
|
20
20
|
}>;
|
|
21
|
-
export declare const subscribe: (
|
|
21
|
+
export declare const subscribe: (_url: string) => Promise<string>;
|
|
22
22
|
export declare function mockConfig(flow: string): IConfig;
|
|
23
23
|
export declare const mockedPinFlow: IStrategyReducerState;
|
|
24
24
|
export declare const mockedMoFlow: IStrategyReducerState;
|