ouisys-engine 5.1.34 → 5.1.36
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/checkSubscriptionHander.js +1 -1
- package/dist/handleSubmitNumber.js +3 -0
- package/dist/handleSubmitNumber.js.map +1 -1
- package/dist/{helpers-J_h-ZgxH.js → helpers-BIBpnXln.js} +2 -2
- package/dist/{helpers-J_h-ZgxH.js.map → helpers-BIBpnXln.js.map} +1 -1
- package/dist/initTPay.js +75 -178
- package/dist/initTPay.js.map +1 -1
- package/dist/main-DucVMPM9.js +448 -0
- package/dist/main-DucVMPM9.js.map +1 -0
- package/dist/moFlow.js +6 -2
- package/dist/moFlow.js.map +1 -1
- package/dist/moRedirFlow.js +2 -1
- package/dist/moRedirFlow.js.map +1 -1
- package/dist/oneClickFlow.js +1 -1
- package/dist/pinFlow.js +10 -445
- package/dist/pinFlow.js.map +1 -1
- package/dist/src/flows/moFlow/moFlowSlice.d.ts.map +1 -1
- package/dist/src/flows/moRedirFlow/moRedirFlowSlice.d.ts.map +1 -1
- package/dist/src/flows/pinFlow/pinFlowSlice.d.ts.map +1 -1
- package/dist/src/flows/strategy/strategies/askMobileNumber.d.ts.map +1 -1
- package/dist/src/flows/ussdFlow/ussdFlowSlice.d.ts.map +1 -1
- package/dist/src/utilities/handleSubmitNumber.d.ts.map +1 -1
- package/dist/src/utilities/initTpay.d.ts.map +1 -1
- package/dist/strategy.js +2 -2
- package/dist/{strategySlice-Bki4ZBKm.js → strategySlice-B4PsZE03.js} +2 -1
- package/dist/strategySlice-B4PsZE03.js.map +1 -0
- package/dist/ussdFlow.js +9 -2
- package/dist/ussdFlow.js.map +1 -1
- package/package.json +1 -1
- package/dist/strategySlice-Bki4ZBKm.js.map +0 -1
package/dist/pinFlow.js
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { __awaiter, __generator,
|
|
1
|
+
import { __awaiter, __generator, __assign } from 'tslib';
|
|
2
2
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
3
|
import { N as NothingYet, L as Loading, S as Success, F as Failure } from './RemoteDataState-CwHLI23e.js';
|
|
4
|
-
import { i as identifyStrategy, c as setStrategyExtraData, P as PossibleTypes } from './strategySlice-
|
|
4
|
+
import { i as identifyStrategy, c as setStrategyExtraData, P as PossibleTypes } from './strategySlice-B4PsZE03.js';
|
|
5
5
|
import { h as handleResolveRedirect } from './handleResolveRedirect-5Hkm5YXF.js';
|
|
6
|
-
import {
|
|
6
|
+
import { r as redirectErrorTypes, g as getErrorCode } from './normaliseErrorCode-CseFd8jz.js';
|
|
7
7
|
import { searchToObject } from './searchToObject.js';
|
|
8
8
|
import { s as storeMsisdn } from './storeMsisdn-ChiBh8mI.js';
|
|
9
9
|
import { t as tracker } from './tracker-B_zsMRN2.js';
|
|
10
|
-
import {
|
|
11
|
-
import { l as left, r as right, a as loop } from './helpers-J_h-ZgxH.js';
|
|
12
|
-
import { l as loadScriptInnerHtml } from './loadScriptInnerHtml-CstJVRED.js';
|
|
13
|
-
import { c as cleanSearchParams } from './cleanSearchParams-B2jK3H1j.js';
|
|
10
|
+
import { s as submitMSISDN, a as submitPIN } from './main-DucVMPM9.js';
|
|
14
11
|
import './getConfig.js';
|
|
15
12
|
import './formatNumberToE164-oPCiETQk.js';
|
|
13
|
+
import './api-oPdBWsMC.js';
|
|
16
14
|
import 'pacman-client';
|
|
17
15
|
import 'uuid';
|
|
16
|
+
import './helpers-BIBpnXln.js';
|
|
17
|
+
import './loadScriptInnerHtml-CstJVRED.js';
|
|
18
|
+
import './cleanSearchParams-B2jK3H1j.js';
|
|
18
19
|
|
|
19
20
|
var usePinFlowState = function (useSelector) {
|
|
20
21
|
var currentState = useSelector(function (state) { return state.pinFlow.currentState; });
|
|
@@ -35,444 +36,6 @@ function pinFlowMatch(_a) {
|
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
var checkSubscription = function (_a) {
|
|
39
|
-
var window = _a.window, country = _a.country, slug = _a.slug, device = _a.device, offer = _a.offer, rockmanId = _a.rockmanId;
|
|
40
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
41
|
-
var params, queryString, host, url;
|
|
42
|
-
return __generator(this, function (_b) {
|
|
43
|
-
params = {
|
|
44
|
-
action: 'check-subscription',
|
|
45
|
-
country: bupperizeCountry(country),
|
|
46
|
-
slug: slug,
|
|
47
|
-
device: device,
|
|
48
|
-
offerId: offer,
|
|
49
|
-
rockman_id: rockmanId
|
|
50
|
-
};
|
|
51
|
-
queryString = Object.entries(params)
|
|
52
|
-
.filter(function (_a) {
|
|
53
|
-
var _b = __read(_a, 2); _b[0]; var value = _b[1];
|
|
54
|
-
return value !== undefined && value !== null;
|
|
55
|
-
})
|
|
56
|
-
.map(function (_a) {
|
|
57
|
-
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
58
|
-
return "".concat(key, "=").concat(encodeURIComponent(value));
|
|
59
|
-
})
|
|
60
|
-
.join('&');
|
|
61
|
-
host = window.DEV_BASE_URL || '';
|
|
62
|
-
url = "".concat(host, "/tallyman/v1/?").concat(queryString);
|
|
63
|
-
return [2 /*return*/, fetch(url).then(function (response) { return response.json(); })];
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
var checkIsCleanTraffic = function (country) {
|
|
69
|
-
if (country === 'be') {
|
|
70
|
-
if (typeof window !== 'undefined' && window.shouldBlock === true) {
|
|
71
|
-
return '&is-clean-traffic=false';
|
|
72
|
-
}
|
|
73
|
-
return '&is-clean-traffic=true';
|
|
74
|
-
}
|
|
75
|
-
return '';
|
|
76
|
-
};
|
|
77
|
-
var triggerPin = function (_a) {
|
|
78
|
-
var window = _a.window, country = _a.country, slug = _a.slug, device = _a.device, offer = _a.offer, msisdn = _a.msisdn, rockmanId = _a.rockmanId, extraParams = _a.extraParams, search = _a.search, uniqid = _a.uniqid, evinaTid = _a.evinaTid;
|
|
79
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
-
var cleanTrafficString, extraParamsQs, params, queryString, host, url;
|
|
81
|
-
var _b;
|
|
82
|
-
return __generator(this, function (_c) {
|
|
83
|
-
cleanTrafficString = checkIsCleanTraffic(country);
|
|
84
|
-
extraParamsQs = "&".concat(Object.keys(extraParams)
|
|
85
|
-
.map(function (k) { return (extraParams[k] ? "".concat(k, "=").concat(extraParams[k]) : ''); })
|
|
86
|
-
.filter(Boolean)
|
|
87
|
-
.join('&'));
|
|
88
|
-
// Remove conflicting params from url
|
|
89
|
-
search = cleanSearchParams(search);
|
|
90
|
-
params = {
|
|
91
|
-
action: 'trigger-pin',
|
|
92
|
-
country: country,
|
|
93
|
-
slug: slug,
|
|
94
|
-
device: device,
|
|
95
|
-
offerId: offer,
|
|
96
|
-
msisdn: msisdn,
|
|
97
|
-
rockman_id: rockmanId,
|
|
98
|
-
sam_evina_tid: evinaTid,
|
|
99
|
-
page: encodeURIComponent((_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href),
|
|
100
|
-
language_code: window.languageCode || '',
|
|
101
|
-
partner_transaction_id: window.partner_transaction_id || '',
|
|
102
|
-
partner_timestamp: window.partner_timestamp || '',
|
|
103
|
-
partner_cid: window.partner_cid || '',
|
|
104
|
-
uniqid: uniqid || '',
|
|
105
|
-
antifraud_id: window.antifraud_id || '',
|
|
106
|
-
// More specific antifraud IDs will eventuallly replace antifraud_id
|
|
107
|
-
// https://www.notion.so/sammedia/KW-Agency-Globocom-KW-ENTERTAINMENT-STORE-GAMESOLUTELY-GLING-Landing-Page-Test-a9841b14218b42709ffb1a2d41428275?d=f2a8d09b1e8c4fd4bdab69ab5dda1f25
|
|
108
|
-
antifraud_id_js_code: window.antifraud_id_js_code || '',
|
|
109
|
-
antifraud_id_js_link: window.antifraud_id_js_link || '',
|
|
110
|
-
zain_antifraud_id: window.zain_antifraud_id || '',
|
|
111
|
-
korek_antifraud_id: window.korek_antifraud_id || '',
|
|
112
|
-
ip_address: window.pac_analytics.visitor.ip || '',
|
|
113
|
-
ip_range_operator: window.pac_analytics.visitor.ipRangeOperator || ''
|
|
114
|
-
};
|
|
115
|
-
queryString = Object.entries(params)
|
|
116
|
-
.filter(function (_a) {
|
|
117
|
-
var _b = __read(_a, 2); _b[0]; var value = _b[1];
|
|
118
|
-
return value;
|
|
119
|
-
})
|
|
120
|
-
.map(function (_a) {
|
|
121
|
-
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
122
|
-
return "".concat(key, "=").concat(value);
|
|
123
|
-
})
|
|
124
|
-
.join('&');
|
|
125
|
-
host = window.DEV_BASE_URL || '';
|
|
126
|
-
url = "".concat(host, "/tallyman/v1/?").concat(queryString).concat(cleanTrafficString).concat(extraParamsQs).concat(search ? "&".concat(search) : '');
|
|
127
|
-
if (window.MOCK_TIGGER_PIN_RESPONSE) {
|
|
128
|
-
return [2 /*return*/, window.MOCK_TIGGER_PIN_RESPONSE];
|
|
129
|
-
}
|
|
130
|
-
return [2 /*return*/, fetch(url).then(function (x) { return x.json(); })];
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
var verifyPin = function (_a) {
|
|
135
|
-
var window = _a.window, country = _a.country, slug = _a.slug, device = _a.device, offer = _a.offer, rockmanId = _a.rockmanId, pin = _a.pin, extraParams = _a.extraParams, uniqid = _a.uniqid, evinaTid = _a.evinaTid, search = _a.search;
|
|
136
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
137
|
-
var cleanTrafficString, extraParamsQs, params, queryString, host, url;
|
|
138
|
-
var _b;
|
|
139
|
-
return __generator(this, function (_c) {
|
|
140
|
-
cleanTrafficString = checkIsCleanTraffic(country);
|
|
141
|
-
extraParamsQs = "&".concat(Object.keys(extraParams)
|
|
142
|
-
.map(function (k) { return "".concat(k, "=").concat(extraParams[k]); })
|
|
143
|
-
.join('&'));
|
|
144
|
-
// Remove conflicting params from url
|
|
145
|
-
search = cleanSearchParams(search);
|
|
146
|
-
params = {
|
|
147
|
-
action: 'verify-pin',
|
|
148
|
-
country: bupperizeCountry(country),
|
|
149
|
-
slug: slug,
|
|
150
|
-
device: device,
|
|
151
|
-
offerId: offer,
|
|
152
|
-
rockman_id: rockmanId,
|
|
153
|
-
pin: pin,
|
|
154
|
-
page: encodeURIComponent((_b = window === null || window === void 0 ? void 0 : window.location) === null || _b === void 0 ? void 0 : _b.href),
|
|
155
|
-
language_code: window.languageCode || '',
|
|
156
|
-
ClickID: window.antifraud_click_id || '',
|
|
157
|
-
partner_cid: window.partner_cid || '',
|
|
158
|
-
sam_evina_tid: evinaTid,
|
|
159
|
-
uniqid: uniqid,
|
|
160
|
-
// More specific antifraud IDs will eventuallly replace antifraud_id
|
|
161
|
-
// https://www.notion.so/sammedia/KW-Agency-Globocom-KW-ENTERTAINMENT-STORE-GAMESOLUTELY-GLING-Landing-Page-Test-a9841b14218b42709ffb1a2d41428275?d=f2a8d09b1e8c4fd4bdab69ab5dda1f25
|
|
162
|
-
antifraud_id: window.antifraud_id || '',
|
|
163
|
-
antifraud_id_js_code: window.antifraud_id_js_code || '',
|
|
164
|
-
antifraud_id_js_link: window.antifraud_id_js_link || '',
|
|
165
|
-
zain_antifraud_id: window.zain_antifraud_id || '',
|
|
166
|
-
korek_antifraud_id: window.korek_antifraud_id || ''
|
|
167
|
-
};
|
|
168
|
-
queryString = Object.entries(params)
|
|
169
|
-
.filter(function (_a) {
|
|
170
|
-
var _b = __read(_a, 2); _b[0]; var value = _b[1];
|
|
171
|
-
return value;
|
|
172
|
-
})
|
|
173
|
-
.map(function (_a) {
|
|
174
|
-
var _b = __read(_a, 2), key = _b[0], value = _b[1];
|
|
175
|
-
return "".concat(key, "=").concat(value);
|
|
176
|
-
})
|
|
177
|
-
.join('&');
|
|
178
|
-
host = window.DEV_BASE_URL || '';
|
|
179
|
-
url = "".concat(host, "/tallyman/v1/?").concat(queryString).concat(cleanTrafficString).concat(extraParamsQs).concat(search ? "&".concat(search) : '');
|
|
180
|
-
return [2 /*return*/, fetch(url).then(function (x) { return x.json(); })];
|
|
181
|
-
});
|
|
182
|
-
});
|
|
183
|
-
};
|
|
184
|
-
var mcpShield = function (_a) {
|
|
185
|
-
var window = _a.window, country = _a.country, slug = _a.slug, device = _a.device, offer = _a.offer, rockmanId = _a.rockmanId, operator = _a.operator, uniqid = _a.uniqid;
|
|
186
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
187
|
-
var pageUrl, ipAdd, params, host, url;
|
|
188
|
-
return __generator(this, function (_b) {
|
|
189
|
-
pageUrl = window.location.href;
|
|
190
|
-
ipAdd = window.pac_analytics.visitor.ip;
|
|
191
|
-
params = new URLSearchParams(__assign(__assign({ action: 'mcp-shield', country: country, slug: slug, device: device, offerId: offer.toString(), rockman_id: rockmanId, client_lpu: pageUrl }, (operator && { operator: operator })), (uniqid && { uniqid: uniqid })));
|
|
192
|
-
// Conditionally add client_ip if it exists
|
|
193
|
-
if (ipAdd) {
|
|
194
|
-
params.append('client_ip', ipAdd);
|
|
195
|
-
}
|
|
196
|
-
host = window.DEV_BASE_URL || '';
|
|
197
|
-
url = "".concat(host, "/tallyman/v1/?").concat(params.toString());
|
|
198
|
-
return [2 /*return*/, fetch(url).then(function (x) { return x.json(); })];
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
function submitMSISDN(window, maybeConfig, internationalMSISDN, extraParams) {
|
|
204
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
205
|
-
var config;
|
|
206
|
-
return __generator(this, function (_a) {
|
|
207
|
-
config = __assign({ offer: window.pac_analytics.visitor.offer }, (maybeConfig || {}));
|
|
208
|
-
if (config.automaticallySubmitAllOperators === true && !!config.operators && config.operators.length > 0) {
|
|
209
|
-
return [2 /*return*/, submitMSISDNForMultipleOperators(window, config, internationalMSISDN, config.operators, extraParams)];
|
|
210
|
-
}
|
|
211
|
-
return [2 /*return*/, submitMSISDNOnce(window, config, internationalMSISDN, extraParams)];
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
var uniqidResult = '';
|
|
216
|
-
function submitMSISDNOnce(window, config, internationalMSISDN, extraParams) {
|
|
217
|
-
var _a;
|
|
218
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
219
|
-
var submissionError, newExtraParams, isSkipValidation, searchObj, msisdn, rockmanId, slug, country, device, offer, search, uniqid, evinaTid, result, defaultType, type, error, codesWithMcpShied, mcpShieldResult, err_2;
|
|
220
|
-
return __generator(this, function (_b) {
|
|
221
|
-
switch (_b.label) {
|
|
222
|
-
case 0:
|
|
223
|
-
if (!internationalMSISDN) {
|
|
224
|
-
submissionError = new Error("Error in submitMSISDN() trigger-pin action");
|
|
225
|
-
submissionError.type = 'InvalidMSISDN';
|
|
226
|
-
throw submissionError;
|
|
227
|
-
}
|
|
228
|
-
newExtraParams = extraParams || {};
|
|
229
|
-
isSkipValidation = false;
|
|
230
|
-
searchObj = searchToObject(window);
|
|
231
|
-
// @ts-ignore
|
|
232
|
-
if (((searchObj === null || searchObj === void 0 ? void 0 : searchObj.success) === 'true' && searchObj['msisdn-alias'] === '1') || window.skip_validation === true) {
|
|
233
|
-
// Search param is set to 1 for header enrichment when the msisdn is masked
|
|
234
|
-
newExtraParams['skip-validation'] = '1';
|
|
235
|
-
}
|
|
236
|
-
if (newExtraParams['skip-validation'] === '1') {
|
|
237
|
-
isSkipValidation = true;
|
|
238
|
-
}
|
|
239
|
-
msisdn = isSkipValidation ? internationalMSISDN || window.msisdn : internationalMSISDN.match(/\d+/gi).join('');
|
|
240
|
-
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
241
|
-
slug = config.slug, country = config.country, device = config.device, offer = config.offer;
|
|
242
|
-
search = window.location.search.substr(1) || '';
|
|
243
|
-
uniqid = !!uniqidResult && uniqidResult !== '' ? "&mcpUniqid=".concat(uniqidResult) : '';
|
|
244
|
-
evinaTid = typeof window !== 'undefined' && window.tid ? window.tid : '';
|
|
245
|
-
return [4 /*yield*/, triggerPin({
|
|
246
|
-
window: window,
|
|
247
|
-
country: country,
|
|
248
|
-
slug: slug,
|
|
249
|
-
device: device,
|
|
250
|
-
offer: offer,
|
|
251
|
-
msisdn: msisdn,
|
|
252
|
-
rockmanId: rockmanId,
|
|
253
|
-
extraParams: newExtraParams,
|
|
254
|
-
search: search,
|
|
255
|
-
uniqid: uniqid,
|
|
256
|
-
evinaTid: evinaTid
|
|
257
|
-
})];
|
|
258
|
-
case 1:
|
|
259
|
-
result = _b.sent();
|
|
260
|
-
if (result.isContentBlocked === true) {
|
|
261
|
-
window.isContentBlocked = true;
|
|
262
|
-
}
|
|
263
|
-
if (!(result.success === false)) return [3 /*break*/, 2];
|
|
264
|
-
defaultType = result.message.includes('ALREADY SUBSCRIBED')
|
|
265
|
-
? 'AlreadySubscribed'
|
|
266
|
-
: /invalid/i.test(result.message)
|
|
267
|
-
? 'InvalidMsisdn'
|
|
268
|
-
: result.message.includes('duplicated_request')
|
|
269
|
-
? 'DuplicatedRequest'
|
|
270
|
-
: 'UnknownError';
|
|
271
|
-
type = result.error_code ? normaliseErrorCode(result.error_code) : defaultType;
|
|
272
|
-
error = new Error("Error in submitMSISDN() trigger-pin action:\n".concat(result.message));
|
|
273
|
-
Object.assign(error, {
|
|
274
|
-
type: type,
|
|
275
|
-
message: result.message,
|
|
276
|
-
productUrl: (_a = result.product_url) !== null && _a !== void 0 ? _a : ''
|
|
277
|
-
});
|
|
278
|
-
throw error;
|
|
279
|
-
case 2:
|
|
280
|
-
window.operator = result.operator; // currently used on server for KW_STC if present dont call empello for Shemaroo
|
|
281
|
-
codesWithMcpShied = {
|
|
282
|
-
kw: {
|
|
283
|
-
kw_viva: 'kw_viva'
|
|
284
|
-
},
|
|
285
|
-
k2: {
|
|
286
|
-
k2_viva: 'k2_viva'
|
|
287
|
-
},
|
|
288
|
-
bh: {
|
|
289
|
-
bh_viva: 'bh_viva'
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
if (!(country &&
|
|
293
|
-
result.operator &&
|
|
294
|
-
((codesWithMcpShied[country.toLowerCase()] &&
|
|
295
|
-
codesWithMcpShied[country.toLowerCase()][result.operator.toLowerCase()]) ||
|
|
296
|
-
country.toLowerCase() === 'iq') &&
|
|
297
|
-
!window.isCallBlockApi &&
|
|
298
|
-
!window.Empello) // set on server https://www.notion.so/sammedia/KW-Agency-Shemaroo-STC-integration-1a114991683d4af79eb01a4d96789f30
|
|
299
|
-
) return [3 /*break*/, 6]; // set on server https://www.notion.so/sammedia/KW-Agency-Shemaroo-STC-integration-1a114991683d4af79eb01a4d96789f30
|
|
300
|
-
_b.label = 3;
|
|
301
|
-
case 3:
|
|
302
|
-
_b.trys.push([3, 5, , 6]);
|
|
303
|
-
return [4 /*yield*/, mcpShield({
|
|
304
|
-
window: window,
|
|
305
|
-
country: country,
|
|
306
|
-
slug: slug,
|
|
307
|
-
device: device,
|
|
308
|
-
offer: offer,
|
|
309
|
-
rockmanId: rockmanId,
|
|
310
|
-
operator: result.operator,
|
|
311
|
-
uniqid: uniqid
|
|
312
|
-
})];
|
|
313
|
-
case 4:
|
|
314
|
-
mcpShieldResult = _b.sent();
|
|
315
|
-
if (mcpShieldResult.success === false) {
|
|
316
|
-
console.warn(mcpShieldResult.message);
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
loadScriptInnerHtml(mcpShieldResult.source);
|
|
320
|
-
uniqidResult = mcpShieldResult.uniqid;
|
|
321
|
-
}
|
|
322
|
-
return [3 /*break*/, 6];
|
|
323
|
-
case 5:
|
|
324
|
-
err_2 = _b.sent();
|
|
325
|
-
console.warn(err_2);
|
|
326
|
-
return [3 /*break*/, 6];
|
|
327
|
-
case 6:
|
|
328
|
-
if (result.javascript) {
|
|
329
|
-
loadScriptInnerHtml(result.javascript);
|
|
330
|
-
}
|
|
331
|
-
return [2 /*return*/, __assign({ type: 'SingleMSISDNSubmissionResult', pin: result.pin, uniqidResult: uniqidResult, operator: result.operator, redirectUrl: result === null || result === void 0 ? void 0 : result.redirect_to_url }, ((result === null || result === void 0 ? void 0 : result.userType) ? { userType: result === null || result === void 0 ? void 0 : result.userType } : {}) // For Peru user plan if prepaid or postpaid
|
|
332
|
-
)];
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
function submitMSISDNForMultipleOperators(window, config, internationalMSISDN, operators, extraParams) {
|
|
338
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
339
|
-
var results, alreadySubscribed;
|
|
340
|
-
var _this = this;
|
|
341
|
-
return __generator(this, function (_a) {
|
|
342
|
-
switch (_a.label) {
|
|
343
|
-
case 0: return [4 /*yield*/, Promise.all(operators.map(function (o) { return __awaiter(_this, void 0, void 0, function () {
|
|
344
|
-
var singleResult, error_1;
|
|
345
|
-
return __generator(this, function (_a) {
|
|
346
|
-
switch (_a.label) {
|
|
347
|
-
case 0:
|
|
348
|
-
_a.trys.push([0, 2, , 3]);
|
|
349
|
-
return [4 /*yield*/, submitMSISDNOnce(window, config, internationalMSISDN, __assign(__assign({}, extraParams), { operator: o }))];
|
|
350
|
-
case 1:
|
|
351
|
-
singleResult = _a.sent();
|
|
352
|
-
return [2 /*return*/, right(__assign(__assign({}, singleResult), { operator: o }))];
|
|
353
|
-
case 2:
|
|
354
|
-
error_1 = _a.sent();
|
|
355
|
-
return [2 /*return*/, left(error_1)];
|
|
356
|
-
case 3: return [2 /*return*/];
|
|
357
|
-
}
|
|
358
|
-
});
|
|
359
|
-
}); }))];
|
|
360
|
-
case 1:
|
|
361
|
-
results = _a.sent();
|
|
362
|
-
alreadySubscribed = results.find(function (r) { var _a; return r.type === 'left' && ((_a = r.value) === null || _a === void 0 ? void 0 : _a.type) === 'AlreadySubscribed'; });
|
|
363
|
-
if (results.every(function (r) { return r.type === 'left'; })) {
|
|
364
|
-
// no submission worked
|
|
365
|
-
throw results[0].value;
|
|
366
|
-
}
|
|
367
|
-
else if (alreadySubscribed) {
|
|
368
|
-
throw alreadySubscribed.value;
|
|
369
|
-
}
|
|
370
|
-
else {
|
|
371
|
-
return [2 /*return*/, {
|
|
372
|
-
type: 'MultiOperatorMSISDNSubmissionResult'
|
|
373
|
-
}];
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
});
|
|
377
|
-
});
|
|
378
|
-
}
|
|
379
|
-
function submitPIN(window, pin, config, extraParams) {
|
|
380
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
381
|
-
var slug, country, device, offer, newExtraParams, searchObj, rockmanId, emptyPinError, uniqid, evinaTid, search, pinResult, errorType, pinError, check, checkResult, isAlreadySubscribed, pinError, isAlreadySubscribed;
|
|
382
|
-
return __generator(this, function (_a) {
|
|
383
|
-
switch (_a.label) {
|
|
384
|
-
case 0:
|
|
385
|
-
if (window.hostCountry && window.hostSlug) {
|
|
386
|
-
config.country = window.hostCountry;
|
|
387
|
-
config.slug = window.hostSlug;
|
|
388
|
-
}
|
|
389
|
-
slug = config.slug, country = config.country, device = config.device;
|
|
390
|
-
offer = window.pac_analytics.visitor.offer;
|
|
391
|
-
newExtraParams = extraParams || {};
|
|
392
|
-
searchObj = searchToObject(window);
|
|
393
|
-
if ((searchObj === null || searchObj === void 0 ? void 0 : searchObj.success) === 'true' && searchObj['msisdn-alias'] === '1') {
|
|
394
|
-
newExtraParams['skip-validation'] = '1';
|
|
395
|
-
}
|
|
396
|
-
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
397
|
-
if (!pin) {
|
|
398
|
-
emptyPinError = new Error("Error in submitMSISDN() verify-pin action:\n Pin Cannot Be Empty");
|
|
399
|
-
emptyPinError.type = 'InvalidPIN';
|
|
400
|
-
throw emptyPinError;
|
|
401
|
-
}
|
|
402
|
-
uniqid = uniqidResult !== '' ? "&mcpUniqid=".concat(uniqidResult) : '';
|
|
403
|
-
evinaTid = typeof window !== 'undefined' && window.tid ? window.tid : '';
|
|
404
|
-
search = window.location.search.substr(1) || '';
|
|
405
|
-
return [4 /*yield*/, verifyPin({
|
|
406
|
-
window: window,
|
|
407
|
-
country: country,
|
|
408
|
-
slug: slug,
|
|
409
|
-
device: device,
|
|
410
|
-
offer: offer,
|
|
411
|
-
rockmanId: rockmanId,
|
|
412
|
-
pin: pin,
|
|
413
|
-
extraParams: newExtraParams,
|
|
414
|
-
uniqid: uniqid,
|
|
415
|
-
evinaTid: evinaTid,
|
|
416
|
-
search: search
|
|
417
|
-
})];
|
|
418
|
-
case 1:
|
|
419
|
-
pinResult = _a.sent();
|
|
420
|
-
if (!(pinResult.success === false)) return [3 /*break*/, 2];
|
|
421
|
-
errorType = void 0;
|
|
422
|
-
switch (true) {
|
|
423
|
-
case pinResult.message.includes('pin does not match'):
|
|
424
|
-
errorType = 'InvalidPIN';
|
|
425
|
-
break;
|
|
426
|
-
case pinResult.message.includes('mcp blocked'):
|
|
427
|
-
errorType = 'SessionBlocked';
|
|
428
|
-
break;
|
|
429
|
-
case pinResult.message.includes('expired_pin'):
|
|
430
|
-
errorType = 'ExpiredPIN';
|
|
431
|
-
break;
|
|
432
|
-
case pinResult.message.includes('insufficient_balance'):
|
|
433
|
-
errorType = 'InsufficientBalance';
|
|
434
|
-
break;
|
|
435
|
-
case pinResult.message.includes('duplicated_request'):
|
|
436
|
-
errorType = 'DuplicatedRequest';
|
|
437
|
-
break;
|
|
438
|
-
case pinResult.message.includes('ALREADY SUBSCRIBED'):
|
|
439
|
-
errorType = 'AlreadySubscribed';
|
|
440
|
-
break;
|
|
441
|
-
default:
|
|
442
|
-
errorType = 'UnknownError';
|
|
443
|
-
}
|
|
444
|
-
pinError = new Error("Error in submitMSISDN() verify-pin action:\n".concat(pinResult.message));
|
|
445
|
-
pinError.type = errorType;
|
|
446
|
-
console.error(pinError);
|
|
447
|
-
throw pinError;
|
|
448
|
-
case 2:
|
|
449
|
-
if (!(pinResult.async === true)) return [3 /*break*/, 4];
|
|
450
|
-
// Needed for ES https://www.notion.so/sammedia/ES-OnMobile-Movistar-Direct-Ouisys-Integration-XR-Academy-ca60b176b0ea40a7b170e5d9e7deb491
|
|
451
|
-
if (pinResult.product_url && pinResult.product_url !== '' && (country === null || country === void 0 ? void 0 : country.toLowerCase()) === 'es') {
|
|
452
|
-
return [2 /*return*/, { gatewayRedirectUrl: pinResult.product_url }];
|
|
453
|
-
}
|
|
454
|
-
check = function () {
|
|
455
|
-
return checkSubscription({ window: window, country: country, slug: slug, device: device, offer: offer, rockmanId: rockmanId, extraParams: extraParams });
|
|
456
|
-
};
|
|
457
|
-
return [4 /*yield*/, loop(check, 100, function (r) { return r.success || r.message === 'invalid_pin'; }, 0)];
|
|
458
|
-
case 3:
|
|
459
|
-
checkResult = _a.sent();
|
|
460
|
-
if (checkResult.success === true) {
|
|
461
|
-
isAlreadySubscribed = pinResult.message === 'ALREADY SUBSCRIBED';
|
|
462
|
-
return [2 /*return*/, { productUrl: checkResult.product_url || null, isAlreadySubscribed: isAlreadySubscribed }];
|
|
463
|
-
}
|
|
464
|
-
pinError = new Error("Error in submitMSISDN() verify-pin action:\n".concat(checkResult.message));
|
|
465
|
-
pinError.type = 'InvalidPIN';
|
|
466
|
-
pinError.message = checkResult.message;
|
|
467
|
-
throw pinError;
|
|
468
|
-
case 4:
|
|
469
|
-
isAlreadySubscribed = pinResult.message === 'ALREADY SUBSCRIBED';
|
|
470
|
-
return [2 /*return*/, { productUrl: pinResult.product_url || null, isAlreadySubscribed: isAlreadySubscribed }];
|
|
471
|
-
}
|
|
472
|
-
});
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
|
|
476
39
|
var mockedPINState = {
|
|
477
40
|
currentState: {
|
|
478
41
|
type: 'PINEntry',
|
|
@@ -618,6 +181,7 @@ var submitMSISDNAction = createAsyncThunk('pinFlow/submitMSISDNAction', function
|
|
|
618
181
|
_r.label = 1;
|
|
619
182
|
case 1:
|
|
620
183
|
_r.trys.push([1, 7, , 8]);
|
|
184
|
+
window.isBackToStart = false;
|
|
621
185
|
/**
|
|
622
186
|
* Palestine calling code is +970
|
|
623
187
|
* But there was a request to have it as +972 only for gateway shemaroo
|
|
@@ -882,6 +446,7 @@ var backToStartAction = createAsyncThunk('pinFlow/backToStartAction', function (
|
|
|
882
446
|
var _b, _c, _d;
|
|
883
447
|
return __generator(this, function (_e) {
|
|
884
448
|
try {
|
|
449
|
+
window.isBackToStart = true;
|
|
885
450
|
tracker.recedeInFlow('tallyman.v1-pin', 'pin-state', 'requested to change phone number');
|
|
886
451
|
state = getState();
|
|
887
452
|
if (!((_d = (_c = (_b = state === null || state === void 0 ? void 0 : state.strategy) === null || _b === void 0 ? void 0 : _b.currentState) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.config)) {
|