ouisys-engine 3.0.8 → 3.0.11
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 +193 -171
- 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 +6 -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 +3 -2
- package/dist/reducers/oneClickFlow/utils.js +7 -7
- package/dist/reducers/pinFlow/index.js +10 -9
- package/dist/reducers/pinFlow/utils.js +18 -23
- package/dist/reducers/strategy/StrategyTypes.d.ts +3 -2
- package/dist/reducers/strategy/utils.d.ts +3 -3
- package/dist/reducers/strategy/utils.js +35 -48
- package/dist/reducers/ussdFlow/utils.js +4 -2
- package/dist/utilities/index.js +1 -1
- package/dist/utilities/storeEmail.d.ts +3 -0
- package/dist/utilities/storeEmail.js +78 -0
- package/mockData/config.json +28 -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',
|
|
@@ -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';
|
|
@@ -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;
|
|
@@ -182,7 +182,7 @@ function left(l) {
|
|
|
182
182
|
|
|
183
183
|
var getConfig = function getConfig() {
|
|
184
184
|
try {
|
|
185
|
-
if (process.env.testing
|
|
185
|
+
if (process.env.testing === 'true') {
|
|
186
186
|
var _configs2 = require('../../../mockData/config.json'); // @ts-ignore
|
|
187
187
|
|
|
188
188
|
|
|
@@ -193,7 +193,7 @@ var getConfig = function getConfig() {
|
|
|
193
193
|
|
|
194
194
|
return _configs;
|
|
195
195
|
} catch (ex) {
|
|
196
|
-
throw 'config.json not found';
|
|
196
|
+
throw new Error('config.json not found');
|
|
197
197
|
}
|
|
198
198
|
};
|
|
199
199
|
|
|
@@ -240,9 +240,7 @@ function _determineFlowByMsidn() {
|
|
|
240
240
|
throw submissionError;
|
|
241
241
|
|
|
242
242
|
case 4:
|
|
243
|
-
msisdn = internationalMSISDN.match(/\d+/gi).join(''); // tallyman API expects international msisdn without
|
|
244
|
-
|
|
245
|
-
_context5.prev = 5;
|
|
243
|
+
msisdn = internationalMSISDN.match(/\d+/gi).join(''); // tallyman API expects international msisdn without unknown special character
|
|
246
244
|
|
|
247
245
|
indentifyFlow = /*#__PURE__*/function () {
|
|
248
246
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
@@ -275,17 +273,17 @@ function _determineFlowByMsidn() {
|
|
|
275
273
|
};
|
|
276
274
|
}();
|
|
277
275
|
|
|
278
|
-
_context5.next =
|
|
276
|
+
_context5.next = 8;
|
|
279
277
|
return indentifyFlow();
|
|
280
278
|
|
|
281
|
-
case
|
|
279
|
+
case 8:
|
|
282
280
|
theResult = _context5.sent;
|
|
283
281
|
flow = operatorsConfig[theResult.operator] ? operatorsConfig[theResult.operator] : null;
|
|
284
282
|
cannotDetect = theResult.success === false && theResult.message === 'Operator could not be found for the given MSISDN';
|
|
285
283
|
hlrError = theResult.success === false && theResult.message.indexOf('HLR did not find the operator for given MSISDN') !== -1;
|
|
286
284
|
|
|
287
285
|
if (!(cannotDetect || hlrError)) {
|
|
288
|
-
_context5.next =
|
|
286
|
+
_context5.next = 19;
|
|
289
287
|
break;
|
|
290
288
|
}
|
|
291
289
|
|
|
@@ -294,9 +292,9 @@ function _determineFlowByMsidn() {
|
|
|
294
292
|
_submissionError.msisdn = msisdn;
|
|
295
293
|
throw _submissionError;
|
|
296
294
|
|
|
297
|
-
case
|
|
295
|
+
case 19:
|
|
298
296
|
if (!(flow !== null)) {
|
|
299
|
-
_context5.next =
|
|
297
|
+
_context5.next = 24;
|
|
300
298
|
break;
|
|
301
299
|
}
|
|
302
300
|
|
|
@@ -306,9 +304,9 @@ function _determineFlowByMsidn() {
|
|
|
306
304
|
}, flow);
|
|
307
305
|
return _context5.abrupt("return", flowObj);
|
|
308
306
|
|
|
309
|
-
case
|
|
307
|
+
case 24:
|
|
310
308
|
if (!(flow === null)) {
|
|
311
|
-
_context5.next =
|
|
309
|
+
_context5.next = 29;
|
|
312
310
|
break;
|
|
313
311
|
}
|
|
314
312
|
|
|
@@ -317,26 +315,17 @@ function _determineFlowByMsidn() {
|
|
|
317
315
|
}, defaultFlowConfig);
|
|
318
316
|
return _context5.abrupt("return", _flowObj);
|
|
319
317
|
|
|
320
|
-
case
|
|
318
|
+
case 29:
|
|
321
319
|
_submissionError2 = new Error("Error in submitMSISDN() trigger-pin action");
|
|
322
320
|
_submissionError2.type = 'SEInvalidMSISDN';
|
|
323
321
|
throw _submissionError2;
|
|
324
322
|
|
|
325
|
-
case
|
|
326
|
-
_context5.next = 38;
|
|
327
|
-
break;
|
|
328
|
-
|
|
329
|
-
case 35:
|
|
330
|
-
_context5.prev = 35;
|
|
331
|
-
_context5.t0 = _context5["catch"](5);
|
|
332
|
-
throw _context5.t0;
|
|
333
|
-
|
|
334
|
-
case 38:
|
|
323
|
+
case 32:
|
|
335
324
|
case "end":
|
|
336
325
|
return _context5.stop();
|
|
337
326
|
}
|
|
338
327
|
}
|
|
339
|
-
}, _callee5
|
|
328
|
+
}, _callee5);
|
|
340
329
|
}));
|
|
341
330
|
return _determineFlowByMsidn.apply(this, arguments);
|
|
342
331
|
}
|
|
@@ -350,14 +339,14 @@ function determineFlowByOperator(operator) {
|
|
|
350
339
|
return flowObj;
|
|
351
340
|
}
|
|
352
341
|
|
|
353
|
-
function determineFlowByOperatorFromIp(
|
|
342
|
+
function determineFlowByOperatorFromIp() {
|
|
354
343
|
return _determineFlowByOperatorFromIp.apply(this, arguments);
|
|
355
344
|
} // if operator from server
|
|
356
345
|
// no need for this
|
|
357
346
|
|
|
358
347
|
|
|
359
348
|
function _determineFlowByOperatorFromIp() {
|
|
360
|
-
_determineFlowByOperatorFromIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(
|
|
349
|
+
_determineFlowByOperatorFromIp = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
361
350
|
var operator, flowObj;
|
|
362
351
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
363
352
|
while (1) {
|
|
@@ -392,6 +381,7 @@ var fetchJsonp = function fetchJsonp(_url) {
|
|
|
392
381
|
return new Promise(function (resolve, reject) {
|
|
393
382
|
// @ts-ignore
|
|
394
383
|
window[ouisys_callback_function] = function (arg) {
|
|
384
|
+
// @ts-ignore
|
|
395
385
|
resolve(arg);
|
|
396
386
|
};
|
|
397
387
|
|
|
@@ -410,7 +400,7 @@ var fetchJsonp = function fetchJsonp(_url) {
|
|
|
410
400
|
|
|
411
401
|
var identifyUser = /*#__PURE__*/function () {
|
|
412
402
|
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, _newUrl,
|
|
403
|
+
var config, host, country, slug, queryString, device, bupperizeCountry, offer, rockmanId, s, search, extraParamsQs, isDMB, newHost, searchObj, isSuccess, identifyError, subscription_url, _newUrl, _newQueryString, _urlParams, _msisdn, _operator, url2, redirect_url, _newUrl2, _newQueryString2, _urlParams2, _msisdn2, _operator2, newUrl, newQueryString, urlParams, msisdn, operator, url, result, _identifyError;
|
|
414
404
|
|
|
415
405
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
416
406
|
while (1) {
|
|
@@ -421,14 +411,14 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
421
411
|
break;
|
|
422
412
|
}
|
|
423
413
|
|
|
424
|
-
throw
|
|
414
|
+
throw new Error('Error');
|
|
425
415
|
|
|
426
416
|
case 4:
|
|
427
417
|
config = defaultFlowConfig.flowConfig;
|
|
428
418
|
host = config.host, country = config.country, slug = config.slug, queryString = config.queryString, device = config.device;
|
|
429
419
|
|
|
430
420
|
bupperizeCountry = function bupperizeCountry(c) {
|
|
431
|
-
return c
|
|
421
|
+
return c === 'gb' ? 'uk' : c;
|
|
432
422
|
};
|
|
433
423
|
|
|
434
424
|
offer = window.pac_analytics.visitor.offer;
|
|
@@ -444,18 +434,18 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
444
434
|
extraParamsQs = !extraParams ? '' : "&".concat(Object.keys(extraParams).map(function (k) {
|
|
445
435
|
return "".concat(k, "=").concat(extraParams[k]);
|
|
446
436
|
}).join('&'));
|
|
447
|
-
isDMB = !!(window.pac_analytics.visitor.xaid
|
|
437
|
+
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
438
|
newHost = isDMB ? 'de.tallymans.com' : host;
|
|
449
439
|
searchObj = searchToObject();
|
|
450
440
|
|
|
451
|
-
if (!(!!searchObj['redirect-back'] && searchObj['redirect-back']
|
|
441
|
+
if (!(!!searchObj['redirect-back'] && searchObj['redirect-back'] === '1' && !!searchObj.success)) {
|
|
452
442
|
_context2.next = 50;
|
|
453
443
|
break;
|
|
454
444
|
}
|
|
455
445
|
|
|
456
|
-
isSuccess = searchObj.success
|
|
446
|
+
isSuccess = searchObj.success === 'true';
|
|
457
447
|
|
|
458
|
-
if (!(isSuccess
|
|
448
|
+
if (!(isSuccess === false)) {
|
|
459
449
|
_context2.next = 23;
|
|
460
450
|
break;
|
|
461
451
|
}
|
|
@@ -475,8 +465,8 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
475
465
|
|
|
476
466
|
subscription_url = window.atob(searchObj.subscription_url);
|
|
477
467
|
_newUrl = new URL(subscription_url);
|
|
478
|
-
|
|
479
|
-
_urlParams = new URLSearchParams(
|
|
468
|
+
_newQueryString = _newUrl.search;
|
|
469
|
+
_urlParams = new URLSearchParams(_newQueryString);
|
|
480
470
|
_msisdn = _urlParams.get('msisdn') || null;
|
|
481
471
|
_operator = _urlParams.get('operator') || null;
|
|
482
472
|
return _context2.abrupt("return", {
|
|
@@ -498,12 +488,12 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
498
488
|
|
|
499
489
|
redirect_url = window.atob(searchObj.redirect_url);
|
|
500
490
|
_newUrl2 = new URL(redirect_url);
|
|
501
|
-
|
|
502
|
-
_urlParams2 = new URLSearchParams(
|
|
491
|
+
_newQueryString2 = _newUrl2.search;
|
|
492
|
+
_urlParams2 = new URLSearchParams(_newQueryString2);
|
|
503
493
|
_msisdn2 = _urlParams2.get('msisdn') || null;
|
|
504
494
|
_operator2 = _urlParams2.get('operator') || null;
|
|
505
495
|
|
|
506
|
-
if (!(_msisdn2
|
|
496
|
+
if (!(_msisdn2 !== null)) {
|
|
507
497
|
_context2.next = 41;
|
|
508
498
|
break;
|
|
509
499
|
}
|
|
@@ -523,8 +513,8 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
523
513
|
|
|
524
514
|
case 42:
|
|
525
515
|
newUrl = new URL(window.location.href);
|
|
526
|
-
|
|
527
|
-
urlParams = new URLSearchParams(
|
|
516
|
+
newQueryString = newUrl.search;
|
|
517
|
+
urlParams = new URLSearchParams(newQueryString);
|
|
528
518
|
msisdn = urlParams.get('msisdn') || null;
|
|
529
519
|
operator = urlParams.get('operator') || null;
|
|
530
520
|
return _context2.abrupt("return", {
|
|
@@ -537,9 +527,9 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
537
527
|
break;
|
|
538
528
|
|
|
539
529
|
case 50:
|
|
540
|
-
|
|
530
|
+
url = "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
531
|
_context2.next = 53;
|
|
542
|
-
return fetchJsonp(
|
|
532
|
+
return fetchJsonp(url);
|
|
543
533
|
|
|
544
534
|
case 53:
|
|
545
535
|
result = _context2.sent;
|
|
@@ -572,7 +562,7 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
572
562
|
}, _callee2);
|
|
573
563
|
}));
|
|
574
564
|
|
|
575
|
-
return function identifyUser(
|
|
565
|
+
return function identifyUser(_x6) {
|
|
576
566
|
return _ref2.apply(this, arguments);
|
|
577
567
|
};
|
|
578
568
|
}();
|
|
@@ -580,7 +570,7 @@ var identifyUser = /*#__PURE__*/function () {
|
|
|
580
570
|
exports.identifyUser = identifyUser;
|
|
581
571
|
|
|
582
572
|
var subscribe = /*#__PURE__*/function () {
|
|
583
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(
|
|
573
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_url) {
|
|
584
574
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
585
575
|
while (1) {
|
|
586
576
|
switch (_context3.prev = _context3.next) {
|
|
@@ -601,7 +591,7 @@ var subscribe = /*#__PURE__*/function () {
|
|
|
601
591
|
}, _callee3);
|
|
602
592
|
}));
|
|
603
593
|
|
|
604
|
-
return function subscribe(
|
|
594
|
+
return function subscribe(_x7) {
|
|
605
595
|
return _ref5.apply(this, arguments);
|
|
606
596
|
};
|
|
607
597
|
}(); // }
|
|
@@ -610,9 +600,6 @@ var subscribe = /*#__PURE__*/function () {
|
|
|
610
600
|
exports.subscribe = subscribe;
|
|
611
601
|
|
|
612
602
|
function mockConfig(flow) {
|
|
613
|
-
var configs = getConfig();
|
|
614
|
-
var defaultFlowConfig = configs.strategyConfigs.default;
|
|
615
|
-
var operatorsConfig = configs.strategyConfigs.operators;
|
|
616
603
|
var opArr = Object.keys(operatorsConfig);
|
|
617
604
|
var r = opArr.filter(function (o) {
|
|
618
605
|
return operatorsConfig[o].flow === flow;
|
|
@@ -143,7 +143,7 @@ function _submitMSISDNWithConfig() {
|
|
|
143
143
|
break;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
type = result.message
|
|
146
|
+
type = result.message === 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMSISDN';
|
|
147
147
|
error = new Error("".concat(type, ":\n").concat(result.message));
|
|
148
148
|
error.type = type;
|
|
149
149
|
console.error(error);
|
|
@@ -196,6 +196,7 @@ function _checkSubscription() {
|
|
|
196
196
|
break;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
// eslint-disable-next-line no-param-reassign
|
|
199
200
|
window.location.href = checkResult.product_url;
|
|
200
201
|
return _context3.abrupt("return", checkResult.product_url || null);
|
|
201
202
|
|
|
@@ -216,6 +217,7 @@ function _checkSubscription() {
|
|
|
216
217
|
|
|
217
218
|
var formatSMSLink = function formatSMSLink(keywordAndShortcode) {
|
|
218
219
|
return (// @ts-ignore
|
|
220
|
+
// eslint-disable-next-line no-nested-ternary
|
|
219
221
|
!!window.pac_analytics.visitor['x-requested-with'] && // @ts-ignore
|
|
220
222
|
window.pac_analytics.visitor['x-requested-with'] !== null && // @ts-ignore
|
|
221
223
|
window.pac_analytics.visitor['x-requested-with'].indexOf('com.facebook') !== -1 ? "sms://".concat(keywordAndShortcode.shortcode, "?body=").concat(keywordAndShortcode.keyword) : typeof navigator !== 'undefined' && (/iPhone/i.test(navigator.userAgent) || /Mac OS/i.test(navigator.userAgent)) ? "sms:".concat(keywordAndShortcode.shortcode, "&body=").concat(keywordAndShortcode.keyword) : "sms:".concat(keywordAndShortcode.shortcode, "?body=").concat(keywordAndShortcode.keyword)
|
|
@@ -228,7 +230,7 @@ var mockedMSISDNEntrySuccess = {
|
|
|
228
230
|
type: 'MSISDNEntry',
|
|
229
231
|
result: RDS.Success({
|
|
230
232
|
keyword: 'TEST OK',
|
|
231
|
-
shortcode: '
|
|
233
|
+
shortcode: '777'
|
|
232
234
|
})
|
|
233
235
|
}
|
|
234
236
|
};
|
package/dist/utilities/index.js
CHANGED
|
@@ -47,7 +47,7 @@ var setOnLoadUtilities = function setOnLoadUtilities(config) {
|
|
|
47
47
|
(0, _utils2.startEvinaAgency)(config);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
if (process.env.country.toLowerCase() === 'sa' || process.env.country.toLowerCase() === 'iq' || process.env.country.toLowerCase() === 'k2'
|
|
50
|
+
if (process.env.country.toLowerCase() === 'sa' || process.env.country.toLowerCase() === 'iq' || process.env.country.toLowerCase() === 'k2') {
|
|
51
51
|
(0, _utils3.loadMcpShield)(window, config);
|
|
52
52
|
}
|
|
53
53
|
}
|