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
|
@@ -20,7 +20,7 @@ export interface ISuccessMatcher<E, D, R> {
|
|
|
20
20
|
otherwise: (rds: RemoteDataState<E, D>) => R;
|
|
21
21
|
}
|
|
22
22
|
export declare function match<E, D, R>({ nothingYet, loading, failure, success }: IMatcher<E, D, R>): (model: RemoteDataState<E, D>) => R;
|
|
23
|
-
export declare const NothingYet: <E, D>(
|
|
23
|
+
export declare const NothingYet: <E, D>() => RemoteDataState<E, D>;
|
|
24
24
|
export declare const Loading: <E, D>() => RemoteDataState<E, D>;
|
|
25
25
|
export declare const Failure: <E, D>(error: E) => RemoteDataState<E, D>;
|
|
26
26
|
export declare const Success: <E, D>(data: D) => RemoteDataState<E, D>;
|
|
@@ -29,8 +29,8 @@ export declare const IsLoading: <E, D>(s: RemoteDataState<E, D>) => boolean;
|
|
|
29
29
|
export declare const IsFailure: <E, D>(s: RemoteDataState<E, D>) => boolean;
|
|
30
30
|
export declare const IsSuccess: <E, D>(s: RemoteDataState<E, D>) => boolean;
|
|
31
31
|
export declare const WhenFailure: <E, D, R>(d: R, r: (err: E) => R) => (s: RemoteDataState<E, D>) => R;
|
|
32
|
-
export declare const WhenLoading: <D, R>(d: R, r: () => R) => (s: RemoteDataState<
|
|
33
|
-
export declare const WhenSuccess: <D, R>(d: R, r: (data: D) => R) => (s: RemoteDataState<
|
|
32
|
+
export declare const WhenLoading: <D, R>(d: R, r: () => R) => (s: RemoteDataState<unknown, D>) => R;
|
|
33
|
+
export declare const WhenSuccess: <D, R>(d: R, r: (data: D) => R) => (s: RemoteDataState<unknown, D>) => R;
|
|
34
34
|
export declare const MatchFailure: <E, D, R>({ failure, otherwise }: {
|
|
35
35
|
otherwise: () => R;
|
|
36
36
|
failure: (err: E) => R;
|
|
@@ -28,11 +28,14 @@ function match(_ref) {
|
|
|
28
28
|
|
|
29
29
|
case 'Success':
|
|
30
30
|
return success(model.data);
|
|
31
|
+
|
|
32
|
+
default:
|
|
33
|
+
return nothingYet();
|
|
31
34
|
}
|
|
32
35
|
};
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
var NothingYet = function NothingYet(
|
|
38
|
+
var NothingYet = function NothingYet() {
|
|
36
39
|
return {
|
|
37
40
|
type: 'NothingYet'
|
|
38
41
|
};
|
|
@@ -67,32 +70,32 @@ var Success = function Success(data) {
|
|
|
67
70
|
exports.Success = Success;
|
|
68
71
|
|
|
69
72
|
var IsNothingYet = function IsNothingYet(s) {
|
|
70
|
-
return s.type
|
|
73
|
+
return s.type === 'NothingYet';
|
|
71
74
|
};
|
|
72
75
|
|
|
73
76
|
exports.IsNothingYet = IsNothingYet;
|
|
74
77
|
|
|
75
78
|
var IsLoading = function IsLoading(s) {
|
|
76
|
-
return s.type
|
|
79
|
+
return s.type === 'Loading';
|
|
77
80
|
};
|
|
78
81
|
|
|
79
82
|
exports.IsLoading = IsLoading;
|
|
80
83
|
|
|
81
84
|
var IsFailure = function IsFailure(s) {
|
|
82
|
-
return s.type
|
|
85
|
+
return s.type === 'Failure';
|
|
83
86
|
};
|
|
84
87
|
|
|
85
88
|
exports.IsFailure = IsFailure;
|
|
86
89
|
|
|
87
90
|
var IsSuccess = function IsSuccess(s) {
|
|
88
|
-
return s.type
|
|
91
|
+
return s.type === 'Success';
|
|
89
92
|
};
|
|
90
93
|
|
|
91
94
|
exports.IsSuccess = IsSuccess;
|
|
92
95
|
|
|
93
96
|
var WhenFailure = function WhenFailure(d, r) {
|
|
94
97
|
return function (s) {
|
|
95
|
-
return s.type
|
|
98
|
+
return s.type === 'Failure' ? r(s.error) : d;
|
|
96
99
|
};
|
|
97
100
|
};
|
|
98
101
|
|
|
@@ -100,7 +103,7 @@ exports.WhenFailure = WhenFailure;
|
|
|
100
103
|
|
|
101
104
|
var WhenLoading = function WhenLoading(d, r) {
|
|
102
105
|
return function (s) {
|
|
103
|
-
return s.type
|
|
106
|
+
return s.type === 'Loading' ? r() : d;
|
|
104
107
|
};
|
|
105
108
|
};
|
|
106
109
|
|
|
@@ -108,7 +111,7 @@ exports.WhenLoading = WhenLoading;
|
|
|
108
111
|
|
|
109
112
|
var WhenSuccess = function WhenSuccess(d, r) {
|
|
110
113
|
return function (s) {
|
|
111
|
-
return s.type
|
|
114
|
+
return s.type === 'Success' ? r(s.data) : d;
|
|
112
115
|
};
|
|
113
116
|
};
|
|
114
117
|
|
|
@@ -118,7 +121,7 @@ var MatchFailure = function MatchFailure(_ref2) {
|
|
|
118
121
|
var failure = _ref2.failure,
|
|
119
122
|
otherwise = _ref2.otherwise;
|
|
120
123
|
return function (s) {
|
|
121
|
-
return s.type
|
|
124
|
+
return s.type === 'Failure' ? failure(s.error) : otherwise();
|
|
122
125
|
};
|
|
123
126
|
};
|
|
124
127
|
|
|
@@ -128,7 +131,7 @@ var MatchSuccess = function MatchSuccess(_ref3) {
|
|
|
128
131
|
var success = _ref3.success,
|
|
129
132
|
otherwise = _ref3.otherwise;
|
|
130
133
|
return function (s) {
|
|
131
|
-
return s.type
|
|
134
|
+
return s.type === 'Success' ? success(s.data) : otherwise(s);
|
|
132
135
|
};
|
|
133
136
|
};
|
|
134
137
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useStrategyConfig = void 0;
|
|
7
|
+
|
|
8
|
+
var useStrategyConfig = function useStrategyConfig(useSelector) {
|
|
9
|
+
var _config$default, _config$default2;
|
|
10
|
+
|
|
11
|
+
var _useSelector = useSelector(function (state) {
|
|
12
|
+
return state.strategy;
|
|
13
|
+
}),
|
|
14
|
+
strategyCurrentState = _useSelector.currentState; // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _strategyCurrentState = strategyCurrentState === null || strategyCurrentState === void 0 ? void 0 : strategyCurrentState.result,
|
|
19
|
+
config = _strategyCurrentState.config;
|
|
20
|
+
|
|
21
|
+
return config !== null && config !== void 0 && (_config$default = config.default) !== null && _config$default !== void 0 && _config$default.flowConfig ? config === null || config === void 0 ? void 0 : (_config$default2 = config.default) === null || _config$default2 === void 0 ? void 0 : _config$default2.flowConfig : config;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.useStrategyConfig = useStrategyConfig;
|
package/dist/flows/moFlow.js
CHANGED
|
@@ -15,6 +15,12 @@ function oneClickFlowMatch(_ref) {
|
|
|
15
15
|
|
|
16
16
|
case 'SUBCRIBE_AJAX':
|
|
17
17
|
return subscribe(state.result);
|
|
18
|
+
|
|
19
|
+
default:
|
|
20
|
+
// TODO - this should be an error or something
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
return getRedirectUrl(state.result);
|
|
18
24
|
}
|
|
19
25
|
};
|
|
20
26
|
}
|
package/dist/flows/strategy.js
CHANGED
|
@@ -5,6 +5,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
+
/* eslint-disable consistent-return */
|
|
9
|
+
|
|
10
|
+
/* eslint-disable default-case */
|
|
8
11
|
function strategy(_ref) {
|
|
9
12
|
var identifyFlowByOperatorSelect = _ref.identifyFlowByOperatorSelect,
|
|
10
13
|
identifyFlowByMsisdn = _ref.identifyFlowByMsisdn,
|
package/dist/flows/ussdFlow.js
CHANGED
|
@@ -11,7 +11,7 @@ export declare type IClick2smsFlowCurrentState = {
|
|
|
11
11
|
export declare type MSISDNEntryErrorTypes = 'AlreadySubscribed' | 'UnknownError' | 'InvalidMSISDN' | 'UnexpectedState';
|
|
12
12
|
export declare type ILOADOC2SMSFailure = {
|
|
13
13
|
errorType: MSISDNEntryErrorTypes;
|
|
14
|
-
error:
|
|
14
|
+
error: unknown;
|
|
15
15
|
productUrl?: string;
|
|
16
16
|
};
|
|
17
17
|
export declare type ILOADOC2SMSSuccess = IKeywordShortcode;
|
|
@@ -106,7 +106,7 @@ function loadOc2sms() {
|
|
|
106
106
|
}
|
|
107
107
|
}); // @ts-ignore
|
|
108
108
|
|
|
109
|
-
if (!!maybeConfig && maybeConfig.tag
|
|
109
|
+
if (!!maybeConfig && maybeConfig.tag === 'keywordAndShortCode') {
|
|
110
110
|
dispatch({
|
|
111
111
|
type: 'LOAD_OC2SMS',
|
|
112
112
|
payload: {
|
|
@@ -116,7 +116,7 @@ function loadOc2sms() {
|
|
|
116
116
|
}, maybeConfig))
|
|
117
117
|
}
|
|
118
118
|
}); // @ts-ignore
|
|
119
|
-
} else if (!!maybeConfig && maybeConfig.tag
|
|
119
|
+
} else if (!!maybeConfig && maybeConfig.tag !== 'keyword' || !maybeConfig) {
|
|
120
120
|
// @ts-ignore
|
|
121
121
|
(0, _utils.default)(window, maybeConfig).then(function (x) {
|
|
122
122
|
return dispatch({
|
|
@@ -158,7 +158,7 @@ function loadOc2sms() {
|
|
|
158
158
|
result: RDS.Failure('Unexpected state')
|
|
159
159
|
}
|
|
160
160
|
});
|
|
161
|
-
throw 'Unexpected state';
|
|
161
|
+
throw new Error('Unexpected state');
|
|
162
162
|
|
|
163
163
|
case 8:
|
|
164
164
|
case "end":
|
|
@@ -78,24 +78,23 @@ function loadOnce(_x, _x2, _x3, _x4, _x5) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
function _loadOnce() {
|
|
81
|
-
_loadOnce = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(window, maybeConfig, operator, keyword,
|
|
82
|
-
var
|
|
83
|
-
|
|
81
|
+
_loadOnce = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(window, maybeConfig, operator, keyword, _shortcode) {
|
|
82
|
+
var keywordFromConfig, shortcodeFromConfig, offer, config, host, country, slug, rockmanId, search, result;
|
|
84
83
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
85
84
|
while (1) {
|
|
86
85
|
switch (_context.prev = _context.next) {
|
|
87
86
|
case 0:
|
|
88
|
-
if (!(!!maybeConfig && maybeConfig.tag
|
|
87
|
+
if (!(!!maybeConfig && maybeConfig.tag === 'keywordAndShortCode')) {
|
|
89
88
|
_context.next = 3;
|
|
90
89
|
break;
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
|
|
92
|
+
keywordFromConfig = maybeConfig.keyword, shortcodeFromConfig = maybeConfig.shortcode;
|
|
94
93
|
return _context.abrupt("return", _objectSpread({
|
|
95
94
|
type: 'SingleSubmissionResult'
|
|
96
95
|
}, {
|
|
97
|
-
keyword:
|
|
98
|
-
shortcode:
|
|
96
|
+
keyword: keywordFromConfig,
|
|
97
|
+
shortcode: shortcodeFromConfig
|
|
99
98
|
}));
|
|
100
99
|
|
|
101
100
|
case 3:
|
|
@@ -151,10 +150,6 @@ function left(l) {
|
|
|
151
150
|
};
|
|
152
151
|
}
|
|
153
152
|
|
|
154
|
-
function foldEither(left, right, either) {
|
|
155
|
-
return either.type == 'left' ? left(either.value) : right(either.value);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
153
|
function loadForMultipleOperators(_x6, _x7, _x8, _x9, _x10) {
|
|
159
154
|
return _loadForMultipleOperators.apply(this, arguments);
|
|
160
155
|
}
|
|
@@ -207,7 +202,7 @@ function _loadForMultipleOperators() {
|
|
|
207
202
|
finalResults = _context3.sent;
|
|
208
203
|
|
|
209
204
|
if (!finalResults.every(function (r) {
|
|
210
|
-
return r.type
|
|
205
|
+
return r.type === 'left';
|
|
211
206
|
})) {
|
|
212
207
|
_context3.next = 8;
|
|
213
208
|
break;
|
|
@@ -218,17 +213,16 @@ function _loadForMultipleOperators() {
|
|
|
218
213
|
case 8:
|
|
219
214
|
arrResult = [];
|
|
220
215
|
finalResults.map(function (obj) {
|
|
221
|
-
if (obj.type
|
|
222
|
-
var
|
|
223
|
-
_keyword2 = _ref2.keyword,
|
|
224
|
-
_shortcode2 = _ref2.shortcode,
|
|
225
|
-
operator = _ref2.operator;
|
|
216
|
+
if (obj.type === 'right') {
|
|
217
|
+
var r = obj.value;
|
|
226
218
|
arrResult.push({
|
|
227
|
-
keyword:
|
|
228
|
-
shortcode:
|
|
229
|
-
operator: operator
|
|
219
|
+
keyword: r === null || r === void 0 ? void 0 : r.keyword,
|
|
220
|
+
shortcode: r === null || r === void 0 ? void 0 : r.shortcode,
|
|
221
|
+
operator: r === null || r === void 0 ? void 0 : r.operator
|
|
230
222
|
});
|
|
231
223
|
}
|
|
224
|
+
|
|
225
|
+
return obj;
|
|
232
226
|
});
|
|
233
227
|
return _context3.abrupt("return", {
|
|
234
228
|
type: 'MultiOperatorSubmissionResult',
|
|
@@ -255,7 +249,7 @@ function _load() {
|
|
|
255
249
|
while (1) {
|
|
256
250
|
switch (_context4.prev = _context4.next) {
|
|
257
251
|
case 0:
|
|
258
|
-
if (!(!!maybeConfig && maybeConfig.tag
|
|
252
|
+
if (!(!!maybeConfig && maybeConfig.tag === 'keywordAndShortCode')) {
|
|
259
253
|
_context4.next = 2;
|
|
260
254
|
break;
|
|
261
255
|
}
|
|
@@ -268,7 +262,7 @@ function _load() {
|
|
|
268
262
|
}));
|
|
269
263
|
|
|
270
264
|
case 2:
|
|
271
|
-
if (!(!!maybeConfig && maybeConfig.tag
|
|
265
|
+
if (!(!!maybeConfig && maybeConfig.tag === 'keyword')) {
|
|
272
266
|
_context4.next = 4;
|
|
273
267
|
break;
|
|
274
268
|
}
|
|
@@ -303,7 +297,7 @@ function _load2() {
|
|
|
303
297
|
offer: window.pac_analytics.visitor.offer
|
|
304
298
|
}, maybeConfig);
|
|
305
299
|
|
|
306
|
-
if (!(config.automaticallySubmitAllOperators
|
|
300
|
+
if (!(config.automaticallySubmitAllOperators === true && !!config.operators && config.operators.length > 0)) {
|
|
307
301
|
_context5.next = 3;
|
|
308
302
|
break;
|
|
309
303
|
}
|
|
@@ -358,6 +352,7 @@ function _checkSubscription() {
|
|
|
358
352
|
break;
|
|
359
353
|
}
|
|
360
354
|
|
|
355
|
+
// eslint-disable-next-line no-param-reassign
|
|
361
356
|
window.location.href = checkResult.product_url;
|
|
362
357
|
return _context6.abrupt("return", checkResult.product_url || null);
|
|
363
358
|
|
|
@@ -89,7 +89,7 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
89
89
|
currentState = store().strategy.currentState;
|
|
90
90
|
|
|
91
91
|
if (!(currentState.type === 'MO')) {
|
|
92
|
-
_context.next =
|
|
92
|
+
_context.next = 22;
|
|
93
93
|
break;
|
|
94
94
|
}
|
|
95
95
|
|
|
@@ -124,7 +124,6 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
124
124
|
result: RDS.Success(_objectSpread({}, keywordAndShortcode))
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
-
_context.prev = 11;
|
|
128
127
|
(0, _utils.checkSubscription)(window, config).then(function (product_url) {
|
|
129
128
|
_strategy.tracker.advancedInFlow('tallyman.v1-mo', 'sale', {
|
|
130
129
|
msisdn: msisdn
|
|
@@ -134,23 +133,15 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
134
133
|
window.location.href = product_url;
|
|
135
134
|
}, 1000);
|
|
136
135
|
});
|
|
137
|
-
_context.next =
|
|
136
|
+
_context.next = 20;
|
|
138
137
|
break;
|
|
139
138
|
|
|
140
|
-
case
|
|
141
|
-
_context.prev =
|
|
142
|
-
_context.t0 = _context["catch"](
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
_context.next = 26;
|
|
147
|
-
break;
|
|
148
|
-
|
|
149
|
-
case 20:
|
|
150
|
-
_context.prev = 20;
|
|
151
|
-
_context.t1 = _context["catch"](3);
|
|
152
|
-
console.warn(_context.t1);
|
|
153
|
-
errorType = _context.t1.type === 'AlreadySubscribed' ? 'AlreadySubscribed' : _context.t1.type == 'InvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
|
|
139
|
+
case 14:
|
|
140
|
+
_context.prev = 14;
|
|
141
|
+
_context.t0 = _context["catch"](3);
|
|
142
|
+
console.warn(_context.t0);
|
|
143
|
+
errorType = // eslint-disable-next-line no-nested-ternary
|
|
144
|
+
_context.t0.type === 'AlreadySubscribed' ? 'AlreadySubscribed' : _context.t0.type === 'InvalidMSISDN' ? 'InvalidMSISDN' : 'UnknownError';
|
|
154
145
|
|
|
155
146
|
_strategy.tracker.recedeInFlow('tallyman.v1-mo', 'msisdn-submission-failure', {
|
|
156
147
|
msisdn: msisdn,
|
|
@@ -163,17 +154,17 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
163
154
|
type: 'MSISDNEntry',
|
|
164
155
|
result: RDS.Failure({
|
|
165
156
|
errorType: errorType,
|
|
166
|
-
error: _context.
|
|
167
|
-
productUrl: _context.
|
|
157
|
+
error: _context.t0,
|
|
158
|
+
productUrl: _context.t0.productUrl
|
|
168
159
|
})
|
|
169
160
|
}
|
|
170
161
|
});
|
|
171
162
|
|
|
172
|
-
case
|
|
173
|
-
_context.next =
|
|
163
|
+
case 20:
|
|
164
|
+
_context.next = 24;
|
|
174
165
|
break;
|
|
175
166
|
|
|
176
|
-
case
|
|
167
|
+
case 22:
|
|
177
168
|
dispatch({
|
|
178
169
|
type: 'MO_MSISDN_SUBMIT_ERROR',
|
|
179
170
|
payload: {
|
|
@@ -184,14 +175,14 @@ function submitMSISDNAction(msisdn, extraParams) {
|
|
|
184
175
|
})
|
|
185
176
|
}
|
|
186
177
|
});
|
|
187
|
-
throw 'Unexpected state';
|
|
178
|
+
throw new Error('Unexpected state');
|
|
188
179
|
|
|
189
|
-
case
|
|
180
|
+
case 24:
|
|
190
181
|
case "end":
|
|
191
182
|
return _context.stop();
|
|
192
183
|
}
|
|
193
184
|
}
|
|
194
|
-
}, _callee, null, [[3,
|
|
185
|
+
}, _callee, null, [[3, 14]]);
|
|
195
186
|
}));
|
|
196
187
|
|
|
197
188
|
return function (_x, _x2) {
|
|
@@ -211,8 +202,10 @@ function backToStart() {
|
|
|
211
202
|
}
|
|
212
203
|
|
|
213
204
|
function mockMoFlow(mockState) {
|
|
205
|
+
// eslint-disable-next-line consistent-return
|
|
214
206
|
return function (dispatch) {
|
|
215
207
|
if (mockState !== undefined) {
|
|
208
|
+
// eslint-disable-next-line default-case
|
|
216
209
|
switch (mockState) {
|
|
217
210
|
case 'msisdn-entry-failure-state':
|
|
218
211
|
return dispatch({
|
|
@@ -225,9 +218,6 @@ function mockMoFlow(mockState) {
|
|
|
225
218
|
type: 'MOCK_MO_FLOW_STATE',
|
|
226
219
|
payload: _utils.mockedMSISDNEntrySuccess.currentState
|
|
227
220
|
});
|
|
228
|
-
|
|
229
|
-
default:
|
|
230
|
-
throw 'Mock Flow not supported';
|
|
231
221
|
}
|
|
232
222
|
}
|
|
233
223
|
};
|
|
@@ -140,16 +140,6 @@ var loop = /*#__PURE__*/function () {
|
|
|
140
140
|
};
|
|
141
141
|
}();
|
|
142
142
|
|
|
143
|
-
var getConfig = function getConfig() {
|
|
144
|
-
try {
|
|
145
|
-
var configs = require('../../../../../config.json');
|
|
146
|
-
|
|
147
|
-
return configs;
|
|
148
|
-
} catch (ex) {
|
|
149
|
-
throw 'config.json not found';
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
|
|
153
143
|
function submitMSISDN(_x5, _x6, _x7, _x8) {
|
|
154
144
|
return _submitMSISDN.apply(this, arguments);
|
|
155
145
|
}
|
|
@@ -246,7 +236,7 @@ function _submitMSISDNWithConfig() {
|
|
|
246
236
|
break;
|
|
247
237
|
}
|
|
248
238
|
|
|
249
|
-
type = result.message
|
|
239
|
+
type = result.message === 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMSISDN';
|
|
250
240
|
error = new Error("".concat(type, ":\n").concat(result.message));
|
|
251
241
|
error.type = type;
|
|
252
242
|
error.productUrl = result.product_url ? result.product_url : '';
|
|
@@ -300,6 +290,7 @@ function _checkSubscription() {
|
|
|
300
290
|
break;
|
|
301
291
|
}
|
|
302
292
|
|
|
293
|
+
// eslint-disable-next-line no-param-reassign
|
|
303
294
|
window.location.href = checkResult.product_url;
|
|
304
295
|
return _context5.abrupt("return", checkResult.product_url || null);
|
|
305
296
|
|
|
@@ -332,7 +323,7 @@ var mockedMSISDNEntrySuccess = {
|
|
|
332
323
|
type: 'MSISDNEntry',
|
|
333
324
|
result: RDS.Success({
|
|
334
325
|
keyword: 'TEST OK',
|
|
335
|
-
shortcode: '
|
|
326
|
+
shortcode: '777'
|
|
336
327
|
})
|
|
337
328
|
}
|
|
338
329
|
};
|
|
@@ -139,7 +139,7 @@ function _submitMSISDNWithConfig() {
|
|
|
139
139
|
visitor = window.pac_analytics.visitor;
|
|
140
140
|
rockmanId = visitor.rockmanId;
|
|
141
141
|
|
|
142
|
-
if (!(country
|
|
142
|
+
if (!(country === 'ci')) {
|
|
143
143
|
_context2.next = 12;
|
|
144
144
|
break;
|
|
145
145
|
}
|
|
@@ -168,7 +168,7 @@ function _submitMSISDNWithConfig() {
|
|
|
168
168
|
break;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
type = result.message
|
|
171
|
+
type = result.message === 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMSISDN';
|
|
172
172
|
error = new Error("".concat(type, ":\n").concat(result.message));
|
|
173
173
|
error.type = type;
|
|
174
174
|
console.error(error);
|
|
@@ -205,6 +205,7 @@ var startEvinaAgency = function startEvinaAgency(config) {
|
|
|
205
205
|
}).then(function (txt) {
|
|
206
206
|
return (0, _loadScriptInnerHtml.default)(txt);
|
|
207
207
|
}).then(function () {
|
|
208
|
+
// eslint-disable-next-line no-console
|
|
208
209
|
console.log('Ev ready');
|
|
209
210
|
var event = new Event('DCBProtectRun');
|
|
210
211
|
|
|
@@ -222,7 +223,7 @@ var mockedMSISDNEntrySuccess = {
|
|
|
222
223
|
currentState: {
|
|
223
224
|
type: 'MSISDNEntry',
|
|
224
225
|
result: RDS.Success({
|
|
225
|
-
href: '
|
|
226
|
+
href: 'https://google.com'
|
|
226
227
|
})
|
|
227
228
|
}
|
|
228
229
|
};
|
|
@@ -138,7 +138,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
138
138
|
customDomain = slug === 'evina-test-handle' ? 'dev.ng.eu.ngrok.io' : 'de-ads.tallymans.com';
|
|
139
139
|
|
|
140
140
|
bupperizeCountry = function bupperizeCountry(c) {
|
|
141
|
-
return c
|
|
141
|
+
return c === 'gb' ? 'uk' : c;
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
offer = window.pac_analytics.visitor.offer;
|
|
@@ -155,7 +155,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
155
155
|
}).join('&'));
|
|
156
156
|
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
157
157
|
|
|
158
|
-
if (!(apiAction
|
|
158
|
+
if (!(apiAction === 'identify-user')) {
|
|
159
159
|
_context.next = 26;
|
|
160
160
|
break;
|
|
161
161
|
}
|
|
@@ -189,7 +189,7 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
189
189
|
break;
|
|
190
190
|
|
|
191
191
|
case 26:
|
|
192
|
-
if (!(apiAction
|
|
192
|
+
if (!(apiAction === 'he')) {
|
|
193
193
|
_context.next = 41;
|
|
194
194
|
break;
|
|
195
195
|
}
|
|
@@ -235,12 +235,12 @@ var getRedirectUrl = /*#__PURE__*/function () {
|
|
|
235
235
|
case 45:
|
|
236
236
|
mcpShieldResult = _context.sent;
|
|
237
237
|
|
|
238
|
-
if (mcpShieldResult.success
|
|
238
|
+
if (mcpShieldResult.success === false) {
|
|
239
239
|
console.warn(mcpShieldResult.message);
|
|
240
240
|
} else {
|
|
241
241
|
(0, _loadScriptInnerHtml.default)(mcpShieldResult.source);
|
|
242
242
|
uniqidResult = mcpShieldResult.uniqid;
|
|
243
|
-
mcpSessionCheckWithBlock = "\n \n document.addEventListener('click', function (event) {\n \n event.preventDefault();\n try{\n if (!event.target.matches('.mcp')) return;\n if (!window.isMcpSessionChecked) {\n \n var url = \"https://de-ads.tallymans.com/tallyman/v1/?action=mcp-session-check&slug=".concat(slug, "&country=").concat(country, "&device=").concat(device, "&rockman_id=").concat(rockmanId, "&mcpUniqid=").concat(uniqidResult, "\";\n \n fetch(url).then(function(res) {\n return res.json()\n }).then(function(resJson) {\n window.isMcpSessionChecked = true;\n console.log('MCP');\n \n if (resJson[\"should-block\"]
|
|
243
|
+
mcpSessionCheckWithBlock = "\n \n document.addEventListener('click', function (event) {\n \n event.preventDefault();\n try{\n if (!event.target.matches('.mcp')) return;\n if (!window.isMcpSessionChecked) {\n \n var url = \"https://de-ads.tallymans.com/tallyman/v1/?action=mcp-session-check&slug=".concat(slug, "&country=").concat(country, "&device=").concat(device, "&rockman_id=").concat(rockmanId, "&mcpUniqid=").concat(uniqidResult, "\";\n \n fetch(url).then(function(res) {\n return res.json()\n }).then(function(resJson) {\n window.isMcpSessionChecked = true;\n console.log('MCP');\n \n if (resJson[\"should-block\"] === true) {\n document.body.innerHTML = \"\"\n \n var div = document.createElement(\"div\");\n div.setAttribute(\"id\", \"page_blocked\")\n div.style.width = \"100%\";\n div.style.height = \"100%\";\n div.style.background = \"#fff\";\n div.style.color = \"#000\";\n div.style.position = \"fixed\";\n div.style.display = \"flex\";\n div.style.justifyContent = \"center\";\n div.style.alignItems = \"center\";\n div.style.fontSize = \"40px\";\n div.style.top = \"0\";\n div.style.bottom = \"0\";\n div.style.left = \"0\";\n div.style.right = \"0\";\n div.innerHTML = \"Offer Expired\";\n document.body.appendChild(div);\n }else{\n const target = event.target || event.srcElement;\n\n while (target) {\n if (target instanceof HTMLAnchorElement) {\n console.log(target.getAttribute('href'));\n window.location.href = target.getAttribute('href')\n break;\n }\n \n target = target.parentNode;\n }\n }\n });\n }\n }catch(err){\n console.error(err);\n }\n },false)\n ");
|
|
244
244
|
(0, _loadScriptInnerHtml.default)(mcpSessionCheckWithBlock);
|
|
245
245
|
}
|
|
246
246
|
|
|
@@ -317,7 +317,7 @@ var subscribe = /*#__PURE__*/function () {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
subscribeError = new Error("Error in subscribe() one-click-subscribe action:\n".concat(result.message));
|
|
320
|
-
subscribeError.type = result.message
|
|
320
|
+
subscribeError.type = result.message === 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'SubscriptionError';
|
|
321
321
|
subscribeError.productUrl = result.product_url ? result.product_url : '';
|
|
322
322
|
throw subscribeError;
|
|
323
323
|
|
|
@@ -357,7 +357,7 @@ var getRedirectUrlBupperWay = /*#__PURE__*/function () {
|
|
|
357
357
|
host = maybeConfig.host, country = maybeConfig.country, slug = maybeConfig.slug, queryString = maybeConfig.queryString;
|
|
358
358
|
|
|
359
359
|
bupperizeCountry = function bupperizeCountry(c) {
|
|
360
|
-
return c
|
|
360
|
+
return c === 'gb' ? 'uk' : c;
|
|
361
361
|
};
|
|
362
362
|
|
|
363
363
|
offer = window.pac_analytics.visitor.offer;
|
|
@@ -395,7 +395,7 @@ var mockedRedirectUrlSuccessState = {
|
|
|
395
395
|
type: 'GET_REDIRECT_URL',
|
|
396
396
|
// @ts-ignore
|
|
397
397
|
result: RDS.Success({
|
|
398
|
-
redirectUrl: '
|
|
398
|
+
redirectUrl: 'https://google.com'
|
|
399
399
|
})
|
|
400
400
|
}
|
|
401
401
|
};
|