ouisys-engine 5.1.82 → 5.1.83
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/pinFlow.js +102 -17
- package/dist/pinFlow.js.map +1 -1
- package/dist/src/flows/pinFlow/pinFlowSlice.d.ts.map +1 -1
- package/dist/src/sharedFlowTypes/PinTypes.d.ts +5 -0
- package/dist/src/sharedFlowTypes/PinTypes.d.ts.map +1 -1
- package/dist/src/sharedFlowTypes/StrategyTypes.d.ts +2 -0
- package/dist/src/sharedFlowTypes/StrategyTypes.d.ts.map +1 -1
- package/dist/strategySlice-DFQ-MT7F.js.map +1 -1
- package/dist/types/{PinTypes-CUUdOtgS.d.ts → PinTypes-CsuUQ8a3.d.ts} +5 -0
- package/dist/types/{StrategyTypes-DfHEKGVh.d.ts → StrategyTypes-DgOrUfat.d.ts} +3 -1
- package/dist/types/click2smsFlow.d.ts +2 -2
- package/dist/types/oneClickFlow.d.ts +3 -3
- package/dist/types/pinFlow.d.ts +2 -2
- package/dist/types/searchToObject.d.ts +2 -2
- package/dist/types/strategy.d.ts +3 -3
- package/package.json +1 -1
package/dist/pinFlow.js
CHANGED
|
@@ -538,19 +538,35 @@ var defaultInitialState = {
|
|
|
538
538
|
* @return {PinFlowState} The initial state of the pin flow.
|
|
539
539
|
*/
|
|
540
540
|
var setInitialState = function (window) {
|
|
541
|
-
var _a;
|
|
541
|
+
var _a, _b;
|
|
542
542
|
var search = searchToObject(window);
|
|
543
543
|
var pinPageEvent = new Event('onPinPage');
|
|
544
544
|
var isPinEntryStep = (search.ui_show_pin_entry && search.ui_show_pin_entry === '1') ||
|
|
545
545
|
(search['show-pin-entry'] && search['show-pin-entry'] === '1');
|
|
546
546
|
var isShowThankYouStep = search['show-thank-you'] && search['show-thank-you'] === '1';
|
|
547
547
|
var isShowCustomError = (search === null || search === void 0 ? void 0 : search.show_custom_error) === '1';
|
|
548
|
+
// Set by the CA branch of submitPinAction on a blocking error code. Lives in the url so the block
|
|
549
|
+
// survives a refresh instead of handing the form back.
|
|
550
|
+
var isBlocked = (search === null || search === void 0 ? void 0 : search.ui_blocked) === '1';
|
|
548
551
|
var rawParam = (_a = search === null || search === void 0 ? void 0 : search.ui_error_message) !== null && _a !== void 0 ? _a : '';
|
|
549
552
|
var normalizedParam = rawParam.replace(/\+/g, '%20');
|
|
550
553
|
var errorMsg = decodeURIComponent(normalizedParam);
|
|
551
554
|
var mapParamError = {
|
|
552
555
|
'This mobile number is blacklisted': 'BlacklistedNumber'
|
|
553
556
|
};
|
|
557
|
+
/**
|
|
558
|
+
* Error type carried over by a reload (see the CA branch of submitPinAction). Passed through as-is
|
|
559
|
+
* so any error code normaliseErrorCode() knows about survives the round trip, only smoothing over
|
|
560
|
+
* the two spellings the same error can arrive with (error_code 21/22 give InvalidPin/ExpiredPin,
|
|
561
|
+
* the message fallback in main.ts gives InvalidPIN/ExpiredPIN).
|
|
562
|
+
* Defaults to InvalidPIN for reloads that predate the param.
|
|
563
|
+
*/
|
|
564
|
+
var rawErrorType = (_b = search === null || search === void 0 ? void 0 : search.ui_error_type) !== null && _b !== void 0 ? _b : '';
|
|
565
|
+
var mapPinParamErrorType = {
|
|
566
|
+
invalidpin: 'InvalidPIN',
|
|
567
|
+
expiredpin: 'ExpiredPIN'
|
|
568
|
+
};
|
|
569
|
+
var pinErrorType = mapPinParamErrorType[rawErrorType.toLowerCase()] || (rawErrorType || 'InvalidPIN');
|
|
554
570
|
var msisdnError = {
|
|
555
571
|
currentState: {
|
|
556
572
|
type: 'MSISDNEntry',
|
|
@@ -584,6 +600,25 @@ var setInitialState = function (window) {
|
|
|
584
600
|
}
|
|
585
601
|
}
|
|
586
602
|
};
|
|
603
|
+
var blockedState = {
|
|
604
|
+
currentState: {
|
|
605
|
+
type: 'PINEntry',
|
|
606
|
+
result: Failure({
|
|
607
|
+
errorType: pinErrorType,
|
|
608
|
+
error: new Error(errorMsg)
|
|
609
|
+
}),
|
|
610
|
+
// @ts-ignore
|
|
611
|
+
data: {
|
|
612
|
+
isBlocked: true,
|
|
613
|
+
msisdn: (search === null || search === void 0 ? void 0 : search.msisdn) || '',
|
|
614
|
+
operator: (search === null || search === void 0 ? void 0 : search.operator) || ''
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
// Ahead of the step checks: a blocked visitor gets the error page whatever else the url asks for.
|
|
619
|
+
if (isBlocked) {
|
|
620
|
+
return blockedState;
|
|
621
|
+
}
|
|
587
622
|
if (isPinEntryStep) {
|
|
588
623
|
// Needed for shemroo the handler is injected on server
|
|
589
624
|
window === null || window === void 0 ? void 0 : window.dispatchEvent(pinPageEvent);
|
|
@@ -592,7 +627,7 @@ var setInitialState = function (window) {
|
|
|
592
627
|
currentState: {
|
|
593
628
|
type: 'PINEntry',
|
|
594
629
|
result: Failure({
|
|
595
|
-
errorType:
|
|
630
|
+
errorType: pinErrorType,
|
|
596
631
|
error: new Error(errorMsg)
|
|
597
632
|
}),
|
|
598
633
|
data: {
|
|
@@ -851,14 +886,38 @@ var submitMSISDNAction = createAsyncThunk('pinFlow/submitMSISDNAction', function
|
|
|
851
886
|
});
|
|
852
887
|
});
|
|
853
888
|
});
|
|
889
|
+
/**
|
|
890
|
+
* CA only. Backend error codes the operator spec wants a fresh Empello token for: the user stays on
|
|
891
|
+
* PIN entry and retries, so the page is reloaded to re-issue the token. Every other code either
|
|
892
|
+
* blocks the flow or redirects, and keeps the normal error handling.
|
|
893
|
+
* 21 ExpiredPin, 22 InvalidPin, 23 PinLimitExceeded, 32 InvalidMSISDN, 33 InvalidSubscriptionId,
|
|
894
|
+
* 35 ValidationIssue.
|
|
895
|
+
*/
|
|
896
|
+
var caTokenRefreshErrorCodes = ['21', '22', '23', '32', '33', '35'];
|
|
897
|
+
/**
|
|
898
|
+
* CA only. Backend error codes the operator spec wants the subscription flow blocked for: request pin
|
|
899
|
+
* and submit both stay disabled. The page is reloaded with ui_blocked so the block lives in the url and
|
|
900
|
+
* survives a refresh, and setInitialState hands the theme a state to render as a full page error.
|
|
901
|
+
* 11 BlacklistedMsisdn, 30 UnsportedFlow, 31 InactiveOperator, 34 NotEligibleMsisdn,
|
|
902
|
+
* 36 InsufficientBalance, 37 AntiFraudError, 38 VasBlocked, 39 AccountSuspended, 40 SalesCapReached,
|
|
903
|
+
* 50 SubscriptionApiFailure, 75 ReSubscriptionBlocked, 76 ReLeadBlocked, 99 UnspecifiedError.
|
|
904
|
+
*/
|
|
905
|
+
var caBlockedErrorCodes = ['11', '30', '31', '34', '36', '37', '38', '39', '40', '50', '75', '76', '99'];
|
|
906
|
+
/**
|
|
907
|
+
* Matched case-insensitively: the same error arrives as InvalidPin/ExpiredPin when the api returns an
|
|
908
|
+
* error_code and as InvalidPIN/ExpiredPIN when it falls back to the message match in main.ts.
|
|
909
|
+
*/
|
|
910
|
+
var matchesErrorCode = function (codes, errorType) {
|
|
911
|
+
return !!errorType && codes.some(function (code) { return normaliseErrorCode(code).toLowerCase() === errorType.toLowerCase(); });
|
|
912
|
+
};
|
|
854
913
|
var submitPinAction = createAsyncThunk('pinFlow/submitPinAction', function (_a, _b) {
|
|
855
914
|
var window = _a.window, msisdn = _a.msisdn, pin = _a.pin, extraParams = _a.extraParams;
|
|
856
915
|
var getState = _b.getState, rejectWithValue = _b.rejectWithValue;
|
|
857
916
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
858
|
-
var state, config, pinFlowCurrentState, result, ex_2, errorType,
|
|
859
|
-
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
860
|
-
return __generator(this, function (
|
|
861
|
-
switch (
|
|
917
|
+
var state, config, pinFlowCurrentState, result, ex_2, errorType, isCa, u, isCaTokenRefreshError, u;
|
|
918
|
+
var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
919
|
+
return __generator(this, function (_x) {
|
|
920
|
+
switch (_x.label) {
|
|
862
921
|
case 0:
|
|
863
922
|
state = getState();
|
|
864
923
|
if (!((_e = (_d = (_c = state === null || state === void 0 ? void 0 : state.strategy) === null || _c === void 0 ? void 0 : _c.currentState) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.config)) {
|
|
@@ -878,13 +937,13 @@ var submitPinAction = createAsyncThunk('pinFlow/submitPinAction', function (_a,
|
|
|
878
937
|
}
|
|
879
938
|
config = state.strategy.currentState.data.config;
|
|
880
939
|
pinFlowCurrentState = (_r = state.pinFlow) === null || _r === void 0 ? void 0 : _r.currentState;
|
|
881
|
-
|
|
940
|
+
_x.label = 1;
|
|
882
941
|
case 1:
|
|
883
|
-
|
|
942
|
+
_x.trys.push([1, 5, , 6]);
|
|
884
943
|
tracker.advancedInFlow('tallyman.v1-pin', 'pin-submitted', { msisdn: msisdn, pin: pin });
|
|
885
944
|
return [4 /*yield*/, submitPIN(window, pin, config, extraParams)];
|
|
886
945
|
case 2:
|
|
887
|
-
result =
|
|
946
|
+
result = _x.sent();
|
|
888
947
|
tracker.advancedInFlow('tallyman.v1-pin', 'pin-submission-success', {
|
|
889
948
|
msisdn: msisdn,
|
|
890
949
|
pin: pin,
|
|
@@ -919,8 +978,8 @@ var submitPinAction = createAsyncThunk('pinFlow/submitPinAction', function (_a,
|
|
|
919
978
|
tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-error', error);
|
|
920
979
|
})];
|
|
921
980
|
case 3:
|
|
922
|
-
|
|
923
|
-
|
|
981
|
+
_x.sent();
|
|
982
|
+
_x.label = 4;
|
|
924
983
|
case 4:
|
|
925
984
|
// End store msisdn
|
|
926
985
|
return [2 /*return*/, __assign(__assign({}, pinFlowCurrentState), { type: 'PINEntry', result: Success({
|
|
@@ -928,7 +987,7 @@ var submitPinAction = createAsyncThunk('pinFlow/submitPinAction', function (_a,
|
|
|
928
987
|
isAlreadySubscribed: result.isAlreadySubscribed || false
|
|
929
988
|
}) })];
|
|
930
989
|
case 5:
|
|
931
|
-
ex_2 =
|
|
990
|
+
ex_2 = _x.sent();
|
|
932
991
|
console.warn(ex_2);
|
|
933
992
|
errorType = ex_2.type;
|
|
934
993
|
tracker.recedeInFlow('tallyman.v1-pin', 'pin-submission-failure', {
|
|
@@ -939,15 +998,41 @@ var submitPinAction = createAsyncThunk('pinFlow/submitPinAction', function (_a,
|
|
|
939
998
|
message: ex_2.message,
|
|
940
999
|
productUrl: ex_2.productUrl
|
|
941
1000
|
});
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1001
|
+
isCa = ((_s = config === null || config === void 0 ? void 0 : config.country) === null || _s === void 0 ? void 0 : _s.toLowerCase()) === 'ca';
|
|
1002
|
+
// CA: block the subscription flow. Reload with ui_blocked so the block is part of the url and a
|
|
1003
|
+
// refresh cannot hand the form back. No product url check here, blocking wins over any url returned.
|
|
1004
|
+
if (isCa && matchesErrorCode(caBlockedErrorCodes, errorType)) {
|
|
1005
|
+
try {
|
|
1006
|
+
u = new URL(window.location.href);
|
|
1007
|
+
u.searchParams.set('rockman_id', ((_u = (_t = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _t === void 0 ? void 0 : _t.visitor) === null || _u === void 0 ? void 0 : _u.rockmanId) || '');
|
|
1008
|
+
u.searchParams.set('show_custom_error', '1');
|
|
1009
|
+
u.searchParams.set('ui_blocked', '1');
|
|
1010
|
+
u.searchParams.set('ui_error_message', ex_2.message || errorType || 'UnknownError');
|
|
1011
|
+
u.searchParams.set('ui_error_type', errorType || 'UnknownError');
|
|
1012
|
+
window.history.replaceState({}, '', u.toString());
|
|
1013
|
+
setTimeout(function () {
|
|
1014
|
+
window.location.reload();
|
|
1015
|
+
}, 0);
|
|
1016
|
+
return [2 /*return*/, rejectWithValue({
|
|
1017
|
+
errorType: errorType,
|
|
1018
|
+
error: ex_2.toString(),
|
|
1019
|
+
message: ex_2.message,
|
|
1020
|
+
productUrl: ex_2.productUrl
|
|
1021
|
+
})];
|
|
1022
|
+
}
|
|
1023
|
+
catch (e) {
|
|
1024
|
+
console.error('CA blocked error reload failed', e);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
isCaTokenRefreshError = isCa && !ex_2.productUrl && matchesErrorCode(caTokenRefreshErrorCodes, errorType);
|
|
1028
|
+
if (isCaTokenRefreshError) {
|
|
945
1029
|
try {
|
|
946
1030
|
u = new URL(window.location.href);
|
|
947
1031
|
u.searchParams.set('show-pin-entry', '1');
|
|
948
|
-
u.searchParams.set('rockman_id', ((
|
|
1032
|
+
u.searchParams.set('rockman_id', ((_w = (_v = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _v === void 0 ? void 0 : _v.visitor) === null || _w === void 0 ? void 0 : _w.rockmanId) || '');
|
|
949
1033
|
u.searchParams.set('show_custom_error', '1');
|
|
950
|
-
u.searchParams.set('ui_error_message', ex_2.message || '
|
|
1034
|
+
u.searchParams.set('ui_error_message', ex_2.message || errorType || 'UnknownError');
|
|
1035
|
+
u.searchParams.set('ui_error_type', errorType || 'UnknownError');
|
|
951
1036
|
window.history.replaceState({}, '', u.toString());
|
|
952
1037
|
setTimeout(function () {
|
|
953
1038
|
window.location.reload();
|