ouisys-engine 5.1.15 → 5.1.17
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/RemoteDataState-CwHLI23e.js +75 -0
- package/dist/RemoteDataState-CwHLI23e.js.map +1 -0
- package/dist/api-oPdBWsMC.js +65 -0
- package/dist/api-oPdBWsMC.js.map +1 -0
- package/dist/checkSubscriptionHander.js +140 -1
- package/dist/checkSubscriptionHander.js.map +1 -1
- package/dist/cleanSearchParams-B2jK3H1j.js +16 -0
- package/dist/cleanSearchParams-B2jK3H1j.js.map +1 -0
- package/dist/click2smsFlow.js +252 -1
- package/dist/click2smsFlow.js.map +1 -1
- package/dist/creditCardFlow.js +331 -1
- package/dist/creditCardFlow.js.map +1 -1
- package/dist/formatNumberToE164-oPCiETQk.js +476 -0
- package/dist/formatNumberToE164-oPCiETQk.js.map +1 -0
- package/dist/getConfig.js +13 -1
- package/dist/getConfig.js.map +1 -1
- package/dist/handleSubmitNumber.js +50 -1
- package/dist/handleSubmitNumber.js.map +1 -1
- package/dist/handleWaterfallRedirect-h5K2zX3N.js +21 -0
- package/dist/handleWaterfallRedirect-h5K2zX3N.js.map +1 -0
- package/dist/helpers-BIBpnXln.js +29 -0
- package/dist/helpers-BIBpnXln.js.map +1 -0
- package/dist/initTPay.js +98 -1
- package/dist/initTPay.js.map +1 -1
- package/dist/loadScriptInnerHtml-CstJVRED.js +30 -0
- package/dist/loadScriptInnerHtml-CstJVRED.js.map +1 -0
- package/dist/main-8gjJCdrT.js +448 -0
- package/dist/main-8gjJCdrT.js.map +1 -0
- package/dist/moFlow.js +322 -1
- package/dist/moFlow.js.map +1 -1
- package/dist/moRedirFlow.js +329 -1
- package/dist/moRedirFlow.js.map +1 -1
- package/dist/normaliseErrorCode-CBLYxW-a.js +44 -0
- package/dist/normaliseErrorCode-CBLYxW-a.js.map +1 -0
- package/dist/oneClickFlow.js +710 -1
- package/dist/oneClickFlow.js.map +1 -1
- package/dist/pinFlow.js +542 -1
- package/dist/pinFlow.js.map +1 -1
- package/dist/searchToObject.js +9 -1
- package/dist/searchToObject.js.map +1 -1
- package/dist/src/common-types/Either.d.ts +9 -0
- package/dist/src/common-types/Either.d.ts.map +1 -0
- package/dist/src/common-types/ICheckSubscriptionResult.d.ts +12 -0
- package/dist/src/common-types/ICheckSubscriptionResult.d.ts.map +1 -0
- package/dist/src/common-types/IError.d.ts +5 -0
- package/dist/src/common-types/IError.d.ts.map +1 -0
- package/dist/src/common-types/IHash.d.ts +4 -0
- package/dist/src/common-types/IHash.d.ts.map +1 -0
- package/dist/src/common-types/IOptInFlowName.d.ts +2 -0
- package/dist/src/common-types/IOptInFlowName.d.ts.map +1 -0
- package/dist/src/common-types/ITracker.d.ts +10 -0
- package/dist/src/common-types/ITracker.d.ts.map +1 -0
- package/dist/src/common-types/IVisitor.d.ts +51 -0
- package/dist/src/common-types/IVisitor.d.ts.map +1 -0
- package/dist/src/common-types/RemoteDataState.d.ts +39 -0
- package/dist/src/common-types/RemoteDataState.d.ts.map +1 -0
- package/dist/src/common-types/Strategy.d.ts +49 -0
- package/dist/src/common-types/Strategy.d.ts.map +1 -0
- package/dist/src/flows/click2smsFlow/api.d.ts +13 -0
- package/dist/src/flows/click2smsFlow/api.d.ts.map +1 -0
- package/dist/src/flows/click2smsFlow/click2smsFlowSlice.d.ts +18 -0
- package/dist/src/flows/click2smsFlow/click2smsFlowSlice.d.ts.map +1 -0
- package/dist/src/flows/click2smsFlow/hooks/useClick2smsFlowState.d.ts +3 -0
- package/dist/src/flows/click2smsFlow/hooks/useClick2smsFlowState.d.ts.map +1 -0
- package/dist/src/flows/click2smsFlow/hooks/useKeyWordShortCode.d.ts +4 -0
- package/dist/src/flows/click2smsFlow/hooks/useKeyWordShortCode.d.ts.map +1 -0
- package/dist/src/flows/click2smsFlow/index.d.ts +6 -0
- package/dist/src/flows/click2smsFlow/index.d.ts.map +1 -0
- package/dist/src/flows/click2smsFlow/main.d.ts +4 -0
- package/dist/src/flows/click2smsFlow/main.d.ts.map +1 -0
- package/dist/src/flows/click2smsFlow/match.d.ts +7 -0
- package/dist/src/flows/click2smsFlow/match.d.ts.map +1 -0
- package/dist/src/flows/creditCardFlow/api.d.ts +26 -0
- package/dist/src/flows/creditCardFlow/api.d.ts.map +1 -0
- package/dist/src/flows/creditCardFlow/creditCardFlowSlice.d.ts +26 -0
- package/dist/src/flows/creditCardFlow/creditCardFlowSlice.d.ts.map +1 -0
- package/dist/src/flows/creditCardFlow/hooks/useCreditCardFlowState.d.ts +3 -0
- package/dist/src/flows/creditCardFlow/hooks/useCreditCardFlowState.d.ts.map +1 -0
- package/dist/src/flows/creditCardFlow/index.d.ts +5 -0
- package/dist/src/flows/creditCardFlow/index.d.ts.map +1 -0
- package/dist/src/flows/creditCardFlow/main.d.ts +8 -0
- package/dist/src/flows/creditCardFlow/main.d.ts.map +1 -0
- package/dist/src/flows/creditCardFlow/match.d.ts +7 -0
- package/dist/src/flows/creditCardFlow/match.d.ts.map +1 -0
- package/dist/src/flows/moFlow/api.d.ts +15 -0
- package/dist/src/flows/moFlow/api.d.ts.map +1 -0
- package/dist/src/flows/moFlow/hooks/useMoFlowState.d.ts +3 -0
- package/dist/src/flows/moFlow/hooks/useMoFlowState.d.ts.map +1 -0
- package/dist/src/flows/moFlow/index.d.ts +5 -0
- package/dist/src/flows/moFlow/index.d.ts.map +1 -0
- package/dist/src/flows/moFlow/main.d.ts +13 -0
- package/dist/src/flows/moFlow/main.d.ts.map +1 -0
- package/dist/src/flows/moFlow/match.d.ts +7 -0
- package/dist/src/flows/moFlow/match.d.ts.map +1 -0
- package/dist/src/flows/moFlow/moFlowSlice.d.ts +47 -0
- package/dist/src/flows/moFlow/moFlowSlice.d.ts.map +1 -0
- package/dist/src/flows/moRedirFlow/api.d.ts +18 -0
- package/dist/src/flows/moRedirFlow/api.d.ts.map +1 -0
- package/dist/src/flows/moRedirFlow/hooks/useMoRedirFlowState.d.ts +3 -0
- package/dist/src/flows/moRedirFlow/hooks/useMoRedirFlowState.d.ts.map +1 -0
- package/dist/src/flows/moRedirFlow/index.d.ts +5 -0
- package/dist/src/flows/moRedirFlow/index.d.ts.map +1 -0
- package/dist/src/flows/moRedirFlow/main.d.ts +8 -0
- package/dist/src/flows/moRedirFlow/main.d.ts.map +1 -0
- package/dist/src/flows/moRedirFlow/match.d.ts +7 -0
- package/dist/src/flows/moRedirFlow/match.d.ts.map +1 -0
- package/dist/src/flows/moRedirFlow/moRedirFlowSlice.d.ts +38 -0
- package/dist/src/flows/moRedirFlow/moRedirFlowSlice.d.ts.map +1 -0
- package/dist/src/flows/oneClickFlow/api.d.ts +22 -0
- package/dist/src/flows/oneClickFlow/api.d.ts.map +1 -0
- package/dist/src/flows/oneClickFlow/hooks/useOneClickFlowState.d.ts +3 -0
- package/dist/src/flows/oneClickFlow/hooks/useOneClickFlowState.d.ts.map +1 -0
- package/dist/src/flows/oneClickFlow/index.d.ts +5 -0
- package/dist/src/flows/oneClickFlow/index.d.ts.map +1 -0
- package/dist/src/flows/oneClickFlow/main.d.ts +15 -0
- package/dist/src/flows/oneClickFlow/main.d.ts.map +1 -0
- package/dist/src/flows/oneClickFlow/match.d.ts +8 -0
- package/dist/src/flows/oneClickFlow/match.d.ts.map +1 -0
- package/dist/src/flows/oneClickFlow/oneClickFlowSlice.d.ts +45 -0
- package/dist/src/flows/oneClickFlow/oneClickFlowSlice.d.ts.map +1 -0
- package/dist/src/flows/pinFlow/IPinConstants.d.ts +3 -0
- package/dist/src/flows/pinFlow/IPinConstants.d.ts.map +1 -0
- package/dist/src/flows/pinFlow/api.d.ts +39 -0
- package/dist/src/flows/pinFlow/api.d.ts.map +1 -0
- package/dist/src/flows/pinFlow/hooks/usePinFlowState.d.ts +3 -0
- package/dist/src/flows/pinFlow/hooks/usePinFlowState.d.ts.map +1 -0
- package/dist/src/flows/pinFlow/index.d.ts +5 -0
- package/dist/src/flows/pinFlow/index.d.ts.map +1 -0
- package/dist/src/flows/pinFlow/main.d.ts +10 -0
- package/dist/src/flows/pinFlow/main.d.ts.map +1 -0
- package/dist/src/flows/pinFlow/match.d.ts +8 -0
- package/dist/src/flows/pinFlow/match.d.ts.map +1 -0
- package/dist/src/flows/pinFlow/pinFlowSlice.d.ts +60 -0
- package/dist/src/flows/pinFlow/pinFlowSlice.d.ts.map +1 -0
- package/dist/src/flows/strategy/api.d.ts +40 -0
- package/dist/src/flows/strategy/api.d.ts.map +1 -0
- package/dist/src/flows/strategy/hooks/useStrategyState.d.ts +3 -0
- package/dist/src/flows/strategy/hooks/useStrategyState.d.ts.map +1 -0
- package/dist/src/flows/strategy/index.d.ts +8 -0
- package/dist/src/flows/strategy/index.d.ts.map +1 -0
- package/dist/src/flows/strategy/main.d.ts +29 -0
- package/dist/src/flows/strategy/main.d.ts.map +1 -0
- package/dist/src/flows/strategy/match.d.ts +16 -0
- package/dist/src/flows/strategy/match.d.ts.map +1 -0
- package/dist/src/flows/strategy/mocks/index.d.ts +7 -0
- package/dist/src/flows/strategy/mocks/index.d.ts.map +1 -0
- package/dist/src/flows/strategy/strategies/askMobileNumber.d.ts +25 -0
- package/dist/src/flows/strategy/strategies/askMobileNumber.d.ts.map +1 -0
- package/dist/src/flows/strategy/strategies/askOperator.d.ts +14 -0
- package/dist/src/flows/strategy/strategies/askOperator.d.ts.map +1 -0
- package/dist/src/flows/strategy/strategies/callRedirectApi.d.ts +28 -0
- package/dist/src/flows/strategy/strategies/callRedirectApi.d.ts.map +1 -0
- package/dist/src/flows/strategy/strategies/detectOperatorByIp.d.ts +15 -0
- package/dist/src/flows/strategy/strategies/detectOperatorByIp.d.ts.map +1 -0
- package/dist/src/flows/strategy/strategies/headerEnrichment.d.ts +52 -0
- package/dist/src/flows/strategy/strategies/headerEnrichment.d.ts.map +1 -0
- package/dist/src/flows/strategy/strategies/injectHeaderEnrichmentScript.d.ts +11 -0
- package/dist/src/flows/strategy/strategies/injectHeaderEnrichmentScript.d.ts.map +1 -0
- package/dist/src/flows/strategy/strategySlice.d.ts +26 -0
- package/dist/src/flows/strategy/strategySlice.d.ts.map +1 -0
- package/dist/src/flows/ussdFlow/api.d.ts +4 -0
- package/dist/src/flows/ussdFlow/api.d.ts.map +1 -0
- package/dist/src/flows/ussdFlow/hooks/useUssdFlowState.d.ts +3 -0
- package/dist/src/flows/ussdFlow/hooks/useUssdFlowState.d.ts.map +1 -0
- package/dist/src/flows/ussdFlow/index.d.ts +5 -0
- package/dist/src/flows/ussdFlow/index.d.ts.map +1 -0
- package/dist/src/flows/ussdFlow/main.d.ts +10 -0
- package/dist/src/flows/ussdFlow/main.d.ts.map +1 -0
- package/dist/src/flows/ussdFlow/match.d.ts +7 -0
- package/dist/src/flows/ussdFlow/match.d.ts.map +1 -0
- package/dist/src/flows/ussdFlow/ussdFlowSlice.d.ts +38 -0
- package/dist/src/flows/ussdFlow/ussdFlowSlice.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/ips/tryGetIPRangeName.d.ts +3 -0
- package/dist/src/ips/tryGetIPRangeName.d.ts.map +1 -0
- package/dist/src/pacman/index.d.ts +7 -0
- package/dist/src/pacman/index.d.ts.map +1 -0
- package/dist/src/pacman/queryString.d.ts +4 -0
- package/dist/src/pacman/queryString.d.ts.map +1 -0
- package/dist/src/sharedApi/checkSubscription.d.ts +13 -0
- package/dist/src/sharedApi/checkSubscription.d.ts.map +1 -0
- package/dist/src/sharedApi/checkSubscriptionByRockmanIdOnly.d.ts +7 -0
- package/dist/src/sharedApi/checkSubscriptionByRockmanIdOnly.d.ts.map +1 -0
- package/dist/src/sharedApi/unblockUser.d.ts +13 -0
- package/dist/src/sharedApi/unblockUser.d.ts.map +1 -0
- package/dist/src/sharedFlowTypes/Click2smsTypes.d.ts +79 -0
- package/dist/src/sharedFlowTypes/Click2smsTypes.d.ts.map +1 -0
- package/dist/src/sharedFlowTypes/CreditCardTypes.d.ts +74 -0
- package/dist/src/sharedFlowTypes/CreditCardTypes.d.ts.map +1 -0
- package/dist/src/sharedFlowTypes/MoRedirTypes.d.ts +29 -0
- package/dist/src/sharedFlowTypes/MoRedirTypes.d.ts.map +1 -0
- package/dist/src/sharedFlowTypes/MoTypes.d.ts +45 -0
- package/dist/src/sharedFlowTypes/MoTypes.d.ts.map +1 -0
- package/dist/src/sharedFlowTypes/OneClickTypes.d.ts +78 -0
- package/dist/src/sharedFlowTypes/OneClickTypes.d.ts.map +1 -0
- package/dist/src/sharedFlowTypes/PinTypes.d.ts +135 -0
- package/dist/src/sharedFlowTypes/PinTypes.d.ts.map +1 -0
- package/dist/src/sharedFlowTypes/StrategyTypes.d.ts +285 -0
- package/dist/src/sharedFlowTypes/StrategyTypes.d.ts.map +1 -0
- package/dist/src/sharedFlowTypes/UssdTypes.d.ts +32 -0
- package/dist/src/sharedFlowTypes/UssdTypes.d.ts.map +1 -0
- package/dist/src/utilities/addEmpelloToken.d.ts +5 -0
- package/dist/src/utilities/addEmpelloToken.d.ts.map +1 -0
- package/dist/src/utilities/addUrlParamAndReload.d.ts +4 -0
- package/dist/src/utilities/addUrlParamAndReload.d.ts.map +1 -0
- package/dist/src/utilities/bupperizeCountry.d.ts +3 -0
- package/dist/src/utilities/bupperizeCountry.d.ts.map +1 -0
- package/dist/src/utilities/checkSubscriptionHander.d.ts +10 -0
- package/dist/src/utilities/checkSubscriptionHander.d.ts.map +1 -0
- package/dist/src/utilities/cleanSearchParams.d.ts +2 -0
- package/dist/src/utilities/cleanSearchParams.d.ts.map +1 -0
- package/dist/src/utilities/countryToPhoneCode.d.ts +2 -0
- package/dist/src/utilities/countryToPhoneCode.d.ts.map +1 -0
- package/dist/src/utilities/formatNumberToE164.d.ts +9 -0
- package/dist/src/utilities/formatNumberToE164.d.ts.map +1 -0
- package/dist/src/utilities/getConfig.d.ts +4 -0
- package/dist/src/utilities/getConfig.d.ts.map +1 -0
- package/dist/src/utilities/handleSubmitNumber.d.ts +24 -0
- package/dist/src/utilities/handleSubmitNumber.d.ts.map +1 -0
- package/dist/src/utilities/handleWaterfallRedirect.d.ts +2 -0
- package/dist/src/utilities/handleWaterfallRedirect.d.ts.map +1 -0
- package/dist/src/utilities/hasNumber.d.ts +2 -0
- package/dist/src/utilities/hasNumber.d.ts.map +1 -0
- package/dist/src/utilities/helpers.d.ts +6 -0
- package/dist/src/utilities/helpers.d.ts.map +1 -0
- package/dist/src/utilities/initTpay.d.ts +2 -0
- package/dist/src/utilities/initTpay.d.ts.map +1 -0
- package/dist/src/utilities/isCookieExists.d.ts +2 -0
- package/dist/src/utilities/isCookieExists.d.ts.map +1 -0
- package/dist/src/utilities/loadScriptInnerHtml.d.ts +3 -0
- package/dist/src/utilities/loadScriptInnerHtml.d.ts.map +1 -0
- package/dist/src/utilities/loadScriptSrc.d.ts +20 -0
- package/dist/src/utilities/loadScriptSrc.d.ts.map +1 -0
- package/dist/src/utilities/normaliseErrorCode.d.ts +8 -0
- package/dist/src/utilities/normaliseErrorCode.d.ts.map +1 -0
- package/dist/src/utilities/normalizePhoneNumber.d.ts +12 -0
- package/dist/src/utilities/normalizePhoneNumber.d.ts.map +1 -0
- package/dist/src/utilities/replaceUrlParam.d.ts +2 -0
- package/dist/src/utilities/replaceUrlParam.d.ts.map +1 -0
- package/dist/src/utilities/searchToObject.d.ts +3 -0
- package/dist/src/utilities/searchToObject.d.ts.map +1 -0
- package/dist/src/utilities/storeMsisdn.d.ts +4 -0
- package/dist/src/utilities/storeMsisdn.d.ts.map +1 -0
- package/dist/src/utilities/tracker.d.ts +2 -0
- package/dist/src/utilities/tracker.d.ts.map +1 -0
- package/dist/src/utilities/unblockUser.d.ts +7 -0
- package/dist/src/utilities/unblockUser.d.ts.map +1 -0
- package/dist/src/utilities/updateUrlWithParams.d.ts +2 -0
- package/dist/src/utilities/updateUrlWithParams.d.ts.map +1 -0
- package/dist/src/utilities/verifyAntifraudOnClick2Sms.d.ts +6 -0
- package/dist/src/utilities/verifyAntifraudOnClick2Sms.d.ts.map +1 -0
- package/dist/storeMsisdn-ChiBh8mI.js +58 -0
- package/dist/storeMsisdn-ChiBh8mI.js.map +1 -0
- package/dist/strategy.js +49 -1
- package/dist/strategy.js.map +1 -1
- package/dist/strategySlice-DEsw1xc-.js +1159 -0
- package/dist/strategySlice-DEsw1xc-.js.map +1 -0
- package/dist/tracker-B_zsMRN2.js +79 -0
- package/dist/tracker-B_zsMRN2.js.map +1 -0
- package/dist/tracker.js +4 -1
- package/dist/tracker.js.map +1 -1
- package/dist/types/{StrategyTypes-BlqY9peI.d.ts → StrategyTypes-LKeXDiPK.d.ts} +78 -2
- package/dist/types/click2smsFlow.d.ts +2 -2
- package/dist/types/oneClickFlow.d.ts +10 -2
- package/dist/types/searchToObject.d.ts +2 -2
- package/dist/types/strategy.d.ts +3 -3
- package/dist/unblockUser.js +107 -1
- package/dist/unblockUser.js.map +1 -1
- package/dist/updateUrlWithParams-ZaZt1BCf.js +15 -0
- package/dist/updateUrlWithParams-ZaZt1BCf.js.map +1 -0
- package/dist/ussdFlow.js +261 -1
- package/dist/ussdFlow.js.map +1 -1
- package/dist/verifyAntifraudOnClick2Sms.js +50 -1
- package/dist/verifyAntifraudOnClick2Sms.js.map +1 -1
- package/package.json +1 -1
- package/dist/RemoteDataState-lcf8PfJd.js +0 -2
- package/dist/RemoteDataState-lcf8PfJd.js.map +0 -1
- package/dist/api-geirVksI.js +0 -2
- package/dist/api-geirVksI.js.map +0 -1
- package/dist/cleanSearchParams-Dl7ZDlew.js +0 -2
- package/dist/cleanSearchParams-Dl7ZDlew.js.map +0 -1
- package/dist/formatNumberToE164-DaAFvpKD.js +0 -2
- package/dist/formatNumberToE164-DaAFvpKD.js.map +0 -1
- package/dist/handleWaterfallRedirect-DztqrthA.js +0 -2
- package/dist/handleWaterfallRedirect-DztqrthA.js.map +0 -1
- package/dist/helpers-CBmogWIZ.js +0 -2
- package/dist/helpers-CBmogWIZ.js.map +0 -1
- package/dist/loadScriptInnerHtml-B6v2-IGn.js +0 -2
- package/dist/loadScriptInnerHtml-B6v2-IGn.js.map +0 -1
- package/dist/main-CDmeQMF-.js +0 -2
- package/dist/main-CDmeQMF-.js.map +0 -1
- package/dist/normaliseErrorCode-CVpyJZ6_.js +0 -2
- package/dist/normaliseErrorCode-CVpyJZ6_.js.map +0 -1
- package/dist/storeMsisdn-Cjq8_qYH.js +0 -2
- package/dist/storeMsisdn-Cjq8_qYH.js.map +0 -1
- package/dist/strategySlice-BMNt18ck.js +0 -2
- package/dist/strategySlice-BMNt18ck.js.map +0 -1
- package/dist/tracker-DaaILhEr.js +0 -2
- package/dist/tracker-DaaILhEr.js.map +0 -1
- package/dist/types/OneClickTypes-BNg9Ru0u.d.ts +0 -71
- package/dist/updateUrlWithParams-C6-BX4TY.js +0 -2
- package/dist/updateUrlWithParams-C6-BX4TY.js.map +0 -1
|
@@ -0,0 +1,1159 @@
|
|
|
1
|
+
import { __awaiter, __generator, __assign } from 'tslib';
|
|
2
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
|
+
import { N as NothingYet, S as Success, L as Loading, F as Failure } from './RemoteDataState-CwHLI23e.js';
|
|
4
|
+
import { searchToObject } from './searchToObject.js';
|
|
5
|
+
import { getConfig } from './getConfig.js';
|
|
6
|
+
import { q as queryString, t as tracker } from './tracker-B_zsMRN2.js';
|
|
7
|
+
import { f as formatNumberToE164 } from './formatNumberToE164-oPCiETQk.js';
|
|
8
|
+
import { i as identify, g as getRedirectUrl } from './api-oPdBWsMC.js';
|
|
9
|
+
|
|
10
|
+
var PossibleTypes;
|
|
11
|
+
(function (PossibleTypes) {
|
|
12
|
+
PossibleTypes["IDENTIFY_STRATEGY"] = "IDENTIFY_STRATEGY";
|
|
13
|
+
PossibleTypes["IDENTIFY_FLOW_BY_MSISDN"] = "IDENTIFY_FLOW_BY_MSISDN";
|
|
14
|
+
PossibleTypes["IDENTIFY_FLOW_BY_OPERATOR_SELECT"] = "IDENTIFY_FLOW_BY_OPERATOR_SELECT";
|
|
15
|
+
PossibleTypes["PIN"] = "PIN";
|
|
16
|
+
PossibleTypes["MO"] = "MO";
|
|
17
|
+
PossibleTypes["MO_REDIR"] = "MO_REDIR";
|
|
18
|
+
PossibleTypes["ONE_CLICK"] = "ONE_CLICK";
|
|
19
|
+
PossibleTypes["CLICK2SMS"] = "CLICK2SMS";
|
|
20
|
+
PossibleTypes["USSD"] = "USSD";
|
|
21
|
+
PossibleTypes["TPAY_HE"] = "TPAY_HE";
|
|
22
|
+
PossibleTypes["CREDIT_CARD"] = "CREDIT_CARD";
|
|
23
|
+
})(PossibleTypes || (PossibleTypes = {}));
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line consistent-return
|
|
26
|
+
function tryGetIPRangeName(visitor) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
28
|
+
var mockip, host, newHost, res, ex_1;
|
|
29
|
+
return __generator(this, function (_a) {
|
|
30
|
+
switch (_a.label) {
|
|
31
|
+
case 0:
|
|
32
|
+
mockip = queryString(window.location.href, 'mock-ip') || process.env.mock_ip;
|
|
33
|
+
// eslint-disable-next-line no-console
|
|
34
|
+
console.log('mockip', mockip);
|
|
35
|
+
if (!(!visitor.ip && typeof window !== 'undefined')) return [3 /*break*/, 5];
|
|
36
|
+
_a.label = 1;
|
|
37
|
+
case 1:
|
|
38
|
+
_a.trys.push([1, 3, , 4]);
|
|
39
|
+
host = window.location.host;
|
|
40
|
+
newHost = window.DEV_BASE_URL_IP || host;
|
|
41
|
+
return [4 /*yield*/, fetch("https://".concat(newHost, "/api/v1/ip").concat(mockip ? "?mock-ip=".concat(mockip) : '')).then(function (x) {
|
|
42
|
+
return x.json();
|
|
43
|
+
})];
|
|
44
|
+
case 2:
|
|
45
|
+
res = _a.sent();
|
|
46
|
+
// return isIPInRange('37.200.146.28')
|
|
47
|
+
visitor.ip = res.ip;
|
|
48
|
+
visitor.ip_range_name = res.ip_range_name;
|
|
49
|
+
return [2 /*return*/, res.ip_range_name];
|
|
50
|
+
case 3:
|
|
51
|
+
ex_1 = _a.sent();
|
|
52
|
+
console.warn('IP Lookup failed', ex_1);
|
|
53
|
+
return [2 /*return*/, ''];
|
|
54
|
+
case 4: return [3 /*break*/, 6];
|
|
55
|
+
case 5: return [2 /*return*/, visitor.ip_range_name || ''];
|
|
56
|
+
case 6: return [2 /*return*/];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var flowMapping = {
|
|
63
|
+
mo: PossibleTypes.MO,
|
|
64
|
+
pin: PossibleTypes.PIN,
|
|
65
|
+
oneClick: PossibleTypes.ONE_CLICK,
|
|
66
|
+
moRedir: PossibleTypes.MO_REDIR,
|
|
67
|
+
click2sms: PossibleTypes.CLICK2SMS,
|
|
68
|
+
ussd: PossibleTypes.USSD,
|
|
69
|
+
tpayHe: PossibleTypes.TPAY_HE,
|
|
70
|
+
creditCard: PossibleTypes.CREDIT_CARD
|
|
71
|
+
};
|
|
72
|
+
// @ts-ignore
|
|
73
|
+
var trackerEventMapping = {
|
|
74
|
+
mo: 'Msisdn to sms',
|
|
75
|
+
pin: 'Pin',
|
|
76
|
+
oneClick: '3G click',
|
|
77
|
+
moRedir: 'Redirect',
|
|
78
|
+
click2sms: 'Click to sms',
|
|
79
|
+
tpayHe: 'Pin',
|
|
80
|
+
ussd: 'Msisdn to sms'
|
|
81
|
+
};
|
|
82
|
+
var getTrackerEventName = function (flowType) { return trackerEventMapping[flowType]; };
|
|
83
|
+
function determineFlowByMsidn(_a) {
|
|
84
|
+
var _b, _c, _d, _e;
|
|
85
|
+
var window = _a.window, internationalMSISDN = _a.internationalMSISDN, configs = _a.configs;
|
|
86
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
87
|
+
var submissionError, msisdn, defaultFlowConfig, config, operatorsConfig, indentifyFlow, theResult, flow, cannotDetect, hlrError, submissionError, flowObj, flowObj, submissionError;
|
|
88
|
+
var _this = this;
|
|
89
|
+
return __generator(this, function (_f) {
|
|
90
|
+
switch (_f.label) {
|
|
91
|
+
case 0:
|
|
92
|
+
if (!internationalMSISDN) {
|
|
93
|
+
submissionError = new Error("Error in determineFlowByMsidn() identify action");
|
|
94
|
+
submissionError.type = 'SEInvalidMSISDN';
|
|
95
|
+
throw submissionError;
|
|
96
|
+
}
|
|
97
|
+
msisdn = ((_b = internationalMSISDN.match(/\d+/gi)) === null || _b === void 0 ? void 0 : _b.join('')) || '';
|
|
98
|
+
defaultFlowConfig = (_c = configs === null || configs === void 0 ? void 0 : configs.strategyConfigs) === null || _c === void 0 ? void 0 : _c.default;
|
|
99
|
+
config = defaultFlowConfig.flowConfig;
|
|
100
|
+
operatorsConfig = (_d = configs === null || configs === void 0 ? void 0 : configs.strategyConfigs) === null || _d === void 0 ? void 0 : _d.operators;
|
|
101
|
+
indentifyFlow = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
102
|
+
var slug, country, device, rockmanId, offer, flowOperatorResult;
|
|
103
|
+
return __generator(this, function (_a) {
|
|
104
|
+
switch (_a.label) {
|
|
105
|
+
case 0:
|
|
106
|
+
slug = config.slug, country = config.country, device = config.device;
|
|
107
|
+
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
108
|
+
offer = window.pac_analytics.visitor.offer;
|
|
109
|
+
return [4 /*yield*/, identify({
|
|
110
|
+
window: window,
|
|
111
|
+
slug: slug,
|
|
112
|
+
country: country,
|
|
113
|
+
msisdn: msisdn,
|
|
114
|
+
device: device,
|
|
115
|
+
offer: offer,
|
|
116
|
+
rockmanId: rockmanId
|
|
117
|
+
})];
|
|
118
|
+
case 1:
|
|
119
|
+
flowOperatorResult = _a.sent();
|
|
120
|
+
return [2 /*return*/, flowOperatorResult];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}); };
|
|
124
|
+
return [4 /*yield*/, indentifyFlow()];
|
|
125
|
+
case 1:
|
|
126
|
+
theResult = _f.sent();
|
|
127
|
+
flow = operatorsConfig[theResult.operator] ? operatorsConfig[theResult.operator] : null;
|
|
128
|
+
cannotDetect = theResult.success === false && theResult.message === 'Operator could not be found for the given MSISDN';
|
|
129
|
+
hlrError = theResult.success === false && ((_e = theResult.message) === null || _e === void 0 ? void 0 : _e.indexOf('HLR did not find the operator for given MSISDN')) !== -1;
|
|
130
|
+
if (cannotDetect || hlrError) {
|
|
131
|
+
submissionError = new Error("Error in determineFlowByMsidn() identify action");
|
|
132
|
+
submissionError.type = 'FlowDetectFailed';
|
|
133
|
+
submissionError.msisdn = msisdn;
|
|
134
|
+
throw submissionError;
|
|
135
|
+
}
|
|
136
|
+
else if (flow !== null) {
|
|
137
|
+
flowObj = __assign({ operator: theResult.operator, default: defaultFlowConfig }, flow);
|
|
138
|
+
// @ts-ignore
|
|
139
|
+
return [2 /*return*/, flowObj];
|
|
140
|
+
}
|
|
141
|
+
else if (flow === null) {
|
|
142
|
+
flowObj = __assign({ operator: theResult.operator }, defaultFlowConfig);
|
|
143
|
+
// @ts-ignore
|
|
144
|
+
return [2 /*return*/, flowObj];
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
submissionError = new Error("Error in determineFlowByMsidn() identify action");
|
|
148
|
+
submissionError.type = 'SEInvalidMSISDN';
|
|
149
|
+
throw submissionError;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function determineFlowByOperator(_a) {
|
|
156
|
+
var _b, _c;
|
|
157
|
+
var configs = _a.configs, operator = _a.operator;
|
|
158
|
+
var defaultFlowConfig = (_b = configs === null || configs === void 0 ? void 0 : configs.strategyConfigs) === null || _b === void 0 ? void 0 : _b.default;
|
|
159
|
+
var operatorsConfig = (_c = configs === null || configs === void 0 ? void 0 : configs.strategyConfigs) === null || _c === void 0 ? void 0 : _c.operators;
|
|
160
|
+
var flowObj = __assign({ operator: operator === null || operator === void 0 ? void 0 : operator.toUpperCase(), default: defaultFlowConfig }, operatorsConfig[operator === null || operator === void 0 ? void 0 : operator.toUpperCase()]);
|
|
161
|
+
// @ts-ignore
|
|
162
|
+
return flowObj;
|
|
163
|
+
}
|
|
164
|
+
function determineFlowByOperatorFromIp(_a) {
|
|
165
|
+
var window = _a.window, configs = _a.configs;
|
|
166
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
167
|
+
var operator, flowObj;
|
|
168
|
+
return __generator(this, function (_b) {
|
|
169
|
+
switch (_b.label) {
|
|
170
|
+
case 0: return [4 /*yield*/, tryGetIPRangeName(window.pac_analytics.visitor)];
|
|
171
|
+
case 1:
|
|
172
|
+
operator = _b.sent();
|
|
173
|
+
flowObj = determineFlowByOperator({
|
|
174
|
+
configs: configs,
|
|
175
|
+
operator: operator && operator.includes('_') ? operator.toUpperCase() : ''
|
|
176
|
+
});
|
|
177
|
+
return [2 /*return*/, flowObj];
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function getOperators(_a) {
|
|
183
|
+
var _b;
|
|
184
|
+
var configs = _a.configs;
|
|
185
|
+
var operatorsConfig = (_b = configs === null || configs === void 0 ? void 0 : configs.strategyConfigs) === null || _b === void 0 ? void 0 : _b.operators;
|
|
186
|
+
var operators = Object.keys(operatorsConfig);
|
|
187
|
+
return operators;
|
|
188
|
+
}
|
|
189
|
+
var getHeaderEnrichmentResult = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
190
|
+
var searchObj, responseUrl, decodedUrl, newUrl_1, urlParams_1, msisdn_1, operator_1, newUrl, urlParams, msisdn, operator;
|
|
191
|
+
var _a, _b, _c, _d;
|
|
192
|
+
return __generator(this, function (_e) {
|
|
193
|
+
if (typeof window === 'undefined') {
|
|
194
|
+
throw new Error('This function can only be run in a browser environment.');
|
|
195
|
+
}
|
|
196
|
+
searchObj = searchToObject(window);
|
|
197
|
+
if (searchObj.success === 'false') {
|
|
198
|
+
throw new Error("Error in getRedirectUrl() identify-user action:\n".concat(searchObj.message || 'NotOn3g'));
|
|
199
|
+
}
|
|
200
|
+
responseUrl = searchObj.subscription_url || searchObj.redirect_url;
|
|
201
|
+
if (responseUrl) {
|
|
202
|
+
decodedUrl = window.atob(responseUrl);
|
|
203
|
+
newUrl_1 = new URL(decodedUrl);
|
|
204
|
+
urlParams_1 = new URLSearchParams(newUrl_1.search);
|
|
205
|
+
msisdn_1 = urlParams_1.get('msisdn') || searchObj.msisdn;
|
|
206
|
+
operator_1 = urlParams_1.get('operator') || searchObj.operator;
|
|
207
|
+
if (msisdn_1) {
|
|
208
|
+
msisdn_1 = formatNumberToE164(msisdn_1, (_b = (_a = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _a === void 0 ? void 0 : _a.visitor) === null || _b === void 0 ? void 0 : _b.country);
|
|
209
|
+
}
|
|
210
|
+
return [2 /*return*/, {
|
|
211
|
+
msisdn: msisdn_1 || '',
|
|
212
|
+
operator: operator_1 || '',
|
|
213
|
+
subscription_url: searchObj.subscription_url ? decodedUrl : undefined,
|
|
214
|
+
redirect_url: searchObj.redirect_url ? decodedUrl : undefined
|
|
215
|
+
}];
|
|
216
|
+
}
|
|
217
|
+
console.error('No URL provided for redirection in the url params');
|
|
218
|
+
newUrl = new URL(window.location.href);
|
|
219
|
+
urlParams = new URLSearchParams(newUrl.search);
|
|
220
|
+
msisdn = urlParams.get('msisdn') || searchObj.msisdn;
|
|
221
|
+
operator = urlParams.get('operator') || searchObj.operator;
|
|
222
|
+
if (msisdn) {
|
|
223
|
+
msisdn = formatNumberToE164(msisdn, (_d = (_c = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _c === void 0 ? void 0 : _c.visitor) === null || _d === void 0 ? void 0 : _d.country);
|
|
224
|
+
}
|
|
225
|
+
return [2 /*return*/, {
|
|
226
|
+
msisdn: msisdn || '',
|
|
227
|
+
operator: operator || ''
|
|
228
|
+
}];
|
|
229
|
+
});
|
|
230
|
+
}); };
|
|
231
|
+
// export const mockedPinFlow: StrategyState = {
|
|
232
|
+
// currentState: {
|
|
233
|
+
// type: PossibleTypes.PIN,
|
|
234
|
+
// result: RDS.NothingYet(),
|
|
235
|
+
// data: {
|
|
236
|
+
// config: mockConfig('pin')
|
|
237
|
+
// }
|
|
238
|
+
// }
|
|
239
|
+
// };
|
|
240
|
+
// export const mockedMoFlow: StrategyState = {
|
|
241
|
+
// currentState: {
|
|
242
|
+
// type: PossibleTypes.MO,
|
|
243
|
+
// result: RDS.NothingYet(),
|
|
244
|
+
// data: {
|
|
245
|
+
// config: mockConfig('mo')
|
|
246
|
+
// }
|
|
247
|
+
// }
|
|
248
|
+
// };
|
|
249
|
+
// export const mockedUssdFlow: StrategyState = {
|
|
250
|
+
// currentState: {
|
|
251
|
+
// type: PossibleTypes.USSD,
|
|
252
|
+
// result: RDS.NothingYet(),
|
|
253
|
+
// data: {
|
|
254
|
+
// config: mockConfig('ussd')
|
|
255
|
+
// }
|
|
256
|
+
// }
|
|
257
|
+
// };
|
|
258
|
+
// export const mockedMoRdirFlow: StrategyState = {
|
|
259
|
+
// currentState: {
|
|
260
|
+
// type: PossibleTypes.MO_REDIR,
|
|
261
|
+
// result: RDS.NothingYet(),
|
|
262
|
+
// data: {
|
|
263
|
+
// config: mockConfig('moRedir')
|
|
264
|
+
// }
|
|
265
|
+
// }
|
|
266
|
+
// };
|
|
267
|
+
// export const mockedClick2smsFlow: StrategyState = {
|
|
268
|
+
// currentState: {
|
|
269
|
+
// type: PossibleTypes.CLICK2SMS,
|
|
270
|
+
// result: RDS.NothingYet(),
|
|
271
|
+
// data: {
|
|
272
|
+
// config: mockConfig('click2sms')
|
|
273
|
+
// }
|
|
274
|
+
// }
|
|
275
|
+
// };
|
|
276
|
+
// export const mockedOneClickFlow: StrategyState = {
|
|
277
|
+
// currentState: {
|
|
278
|
+
// type: PossibleTypes.ONE_CLICK,
|
|
279
|
+
// result: RDS.NothingYet(),
|
|
280
|
+
// data: {
|
|
281
|
+
// config: mockConfig('oneClick')
|
|
282
|
+
// }
|
|
283
|
+
// }
|
|
284
|
+
// };
|
|
285
|
+
// export const mockedCreditCardFlow: StrategyState = {
|
|
286
|
+
// currentState: {
|
|
287
|
+
// type: PossibleTypes.CREDIT_CARD,
|
|
288
|
+
// result: RDS.NothingYet(),
|
|
289
|
+
// data: {
|
|
290
|
+
// config: mockConfig('creditCard')
|
|
291
|
+
// }
|
|
292
|
+
// }
|
|
293
|
+
// };
|
|
294
|
+
// export const mockedMOFlow : State = { type: "MO", result:moFlow(mockTracker, mockConfig("mo"))}
|
|
295
|
+
// export const mockedOneClickFlow : State = { type: "ONECLICK", result:oneClickFlow(mockTracker, mockConfig("oneClick"), {"testextraparams":"1"})}
|
|
296
|
+
// export const mockedClick2smsFlow : State = { type: "CLICK2SMS", result:click2smsFlow(mockTracker, mockConfig("click2sms"))}
|
|
297
|
+
// export const mockedMORedirFlow : State = { type: "MOREDIR", result:moRedirFlow(mockTracker, mockConfig("moRedir"))}
|
|
298
|
+
|
|
299
|
+
var askMobileNumber = function () { return ({
|
|
300
|
+
type: PossibleTypes.IDENTIFY_FLOW_BY_MSISDN,
|
|
301
|
+
result: NothingYet()
|
|
302
|
+
}); };
|
|
303
|
+
var submitMSISDNAction = createAsyncThunk('strategy/submitMSISDNAction', function (_a, _b) {
|
|
304
|
+
var window = _a.window, msisdn = _a.msisdn;
|
|
305
|
+
var rejectWithValue = _b.rejectWithValue;
|
|
306
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
307
|
+
var configs, flowObj, flowType, event_1, defaultConfig, defaultFlowType, ex_1, errorType;
|
|
308
|
+
var _c;
|
|
309
|
+
return __generator(this, function (_d) {
|
|
310
|
+
switch (_d.label) {
|
|
311
|
+
case 0:
|
|
312
|
+
_d.trys.push([0, 2, , 3]);
|
|
313
|
+
configs = getConfig();
|
|
314
|
+
return [4 /*yield*/, determineFlowByMsidn({ window: window, internationalMSISDN: msisdn, configs: configs })];
|
|
315
|
+
case 1:
|
|
316
|
+
flowObj = _d.sent();
|
|
317
|
+
flowType = flowObj === null || flowObj === void 0 ? void 0 : flowObj.flow;
|
|
318
|
+
event_1 = getTrackerEventName(flowType);
|
|
319
|
+
defaultConfig = (_c = configs === null || configs === void 0 ? void 0 : configs.strategyConfigs) === null || _c === void 0 ? void 0 : _c.default;
|
|
320
|
+
defaultFlowType = defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flow;
|
|
321
|
+
if (!flowMapping[flowType]) {
|
|
322
|
+
return [2 /*return*/, {
|
|
323
|
+
type: flowMapping[defaultFlowType],
|
|
324
|
+
result: NothingYet(),
|
|
325
|
+
data: {
|
|
326
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig
|
|
327
|
+
}
|
|
328
|
+
}];
|
|
329
|
+
}
|
|
330
|
+
tracker.sendOptInFlowEvent(event_1);
|
|
331
|
+
return [2 /*return*/, {
|
|
332
|
+
type: flowMapping[flowType],
|
|
333
|
+
result: NothingYet(),
|
|
334
|
+
data: {
|
|
335
|
+
config: flowObj.flowConfig,
|
|
336
|
+
operator: flowObj.operator,
|
|
337
|
+
msisdn: msisdn
|
|
338
|
+
}
|
|
339
|
+
}];
|
|
340
|
+
case 2:
|
|
341
|
+
ex_1 = _d.sent();
|
|
342
|
+
errorType = void 0;
|
|
343
|
+
switch (ex_1.type) {
|
|
344
|
+
case 'SEAlreadySubscribed':
|
|
345
|
+
errorType = 'AlreadySubscribed';
|
|
346
|
+
break;
|
|
347
|
+
case 'SEInvalidMSISDN':
|
|
348
|
+
errorType = 'InvalidMSISDN';
|
|
349
|
+
break;
|
|
350
|
+
default:
|
|
351
|
+
errorType = 'UnknownError';
|
|
352
|
+
}
|
|
353
|
+
return [2 /*return*/, rejectWithValue({
|
|
354
|
+
errorType: errorType,
|
|
355
|
+
error: ex_1,
|
|
356
|
+
productUrl: ex_1.productUrl
|
|
357
|
+
})];
|
|
358
|
+
case 3: return [2 /*return*/];
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
var askOperator = function () {
|
|
365
|
+
var configs = getConfig();
|
|
366
|
+
var operators = getOperators({ configs: configs });
|
|
367
|
+
return {
|
|
368
|
+
type: PossibleTypes.IDENTIFY_FLOW_BY_OPERATOR_SELECT,
|
|
369
|
+
result: NothingYet(),
|
|
370
|
+
data: {
|
|
371
|
+
operators: operators
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
};
|
|
375
|
+
var selectOperatorAction = createAsyncThunk('strategy/selectOperatorAction', function (_a, _b) {
|
|
376
|
+
var operator = _a.operator;
|
|
377
|
+
var rejectWithValue = _b.rejectWithValue;
|
|
378
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
379
|
+
var configs, flowObj, flowType, event_1, errorType;
|
|
380
|
+
return __generator(this, function (_c) {
|
|
381
|
+
try {
|
|
382
|
+
configs = getConfig();
|
|
383
|
+
flowObj = determineFlowByOperator({
|
|
384
|
+
configs: configs,
|
|
385
|
+
operator: operator
|
|
386
|
+
});
|
|
387
|
+
flowType = flowObj.flow;
|
|
388
|
+
event_1 = getTrackerEventName(flowType);
|
|
389
|
+
tracker.sendOptInFlowEvent(event_1);
|
|
390
|
+
return [2 /*return*/, {
|
|
391
|
+
type: flowMapping[flowType],
|
|
392
|
+
result: NothingYet(),
|
|
393
|
+
data: {
|
|
394
|
+
config: flowObj.flowConfig,
|
|
395
|
+
operator: flowObj.operator
|
|
396
|
+
}
|
|
397
|
+
}];
|
|
398
|
+
}
|
|
399
|
+
catch (ex) {
|
|
400
|
+
errorType = 'UnkownError';
|
|
401
|
+
return [2 /*return*/, rejectWithValue({
|
|
402
|
+
errorType: errorType,
|
|
403
|
+
error: ex.toString()
|
|
404
|
+
})];
|
|
405
|
+
}
|
|
406
|
+
return [2 /*return*/];
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
var callRedirectApi = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
412
|
+
var configs, defaultConfig, defaultFlowType, _a, slug, country, device, rockmanId, offer, result, event_1, event_2, ex_1;
|
|
413
|
+
var _b, _c;
|
|
414
|
+
return __generator(this, function (_d) {
|
|
415
|
+
switch (_d.label) {
|
|
416
|
+
case 0:
|
|
417
|
+
configs = getConfig();
|
|
418
|
+
defaultConfig = configs === null || configs === void 0 ? void 0 : configs.strategyConfigs.default;
|
|
419
|
+
defaultFlowType = defaultConfig.flow;
|
|
420
|
+
_a = defaultConfig.flowConfig, slug = _a.slug, country = _a.country, device = _a.device;
|
|
421
|
+
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
422
|
+
offer = window.pac_analytics.visitor.offer;
|
|
423
|
+
_d.label = 1;
|
|
424
|
+
case 1:
|
|
425
|
+
_d.trys.push([1, 3, , 4]);
|
|
426
|
+
return [4 /*yield*/, getRedirectUrl({
|
|
427
|
+
window: window,
|
|
428
|
+
country: country,
|
|
429
|
+
slug: slug,
|
|
430
|
+
device: device,
|
|
431
|
+
offer: offer,
|
|
432
|
+
rockmanId: rockmanId
|
|
433
|
+
})];
|
|
434
|
+
case 2:
|
|
435
|
+
result = _d.sent();
|
|
436
|
+
if (result.success === false) {
|
|
437
|
+
return [2 /*return*/, {
|
|
438
|
+
type: flowMapping[defaultFlowType],
|
|
439
|
+
result: NothingYet(),
|
|
440
|
+
data: {
|
|
441
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig
|
|
442
|
+
}
|
|
443
|
+
}];
|
|
444
|
+
}
|
|
445
|
+
// OPERATOR NOT KNOWN
|
|
446
|
+
// const operator = result?.operator && result?.operator !== 'unknown' ? result?.operator : null;
|
|
447
|
+
if (((_b = result === null || result === void 0 ? void 0 : result.payload) === null || _b === void 0 ? void 0 : _b.network_type) === 'data') {
|
|
448
|
+
event_1 = getTrackerEventName('oneClick');
|
|
449
|
+
tracker.sendOptInFlowEvent(event_1);
|
|
450
|
+
return [2 /*return*/, {
|
|
451
|
+
type: flowMapping.oneClick,
|
|
452
|
+
result: NothingYet(),
|
|
453
|
+
data: {
|
|
454
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig,
|
|
455
|
+
redirect_url: result.redirect_url || null
|
|
456
|
+
}
|
|
457
|
+
}];
|
|
458
|
+
}
|
|
459
|
+
if (((_c = result === null || result === void 0 ? void 0 : result.payload) === null || _c === void 0 ? void 0 : _c.network_type) === 'wifi') {
|
|
460
|
+
event_2 = getTrackerEventName('moRedir');
|
|
461
|
+
tracker.sendOptInFlowEvent(event_2);
|
|
462
|
+
return [2 /*return*/, {
|
|
463
|
+
type: flowMapping[defaultFlowType],
|
|
464
|
+
result: NothingYet(),
|
|
465
|
+
data: {
|
|
466
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig,
|
|
467
|
+
redirect_url: result.redirect_url || null,
|
|
468
|
+
skipRedirectCall: true
|
|
469
|
+
}
|
|
470
|
+
}];
|
|
471
|
+
}
|
|
472
|
+
return [2 /*return*/, {
|
|
473
|
+
type: flowMapping[defaultFlowType],
|
|
474
|
+
result: NothingYet(),
|
|
475
|
+
data: {
|
|
476
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig,
|
|
477
|
+
redirect_url: result.redirect_url || null,
|
|
478
|
+
skipRedirectCall: true
|
|
479
|
+
}
|
|
480
|
+
}];
|
|
481
|
+
case 3:
|
|
482
|
+
ex_1 = _d.sent();
|
|
483
|
+
console.error('error', ex_1);
|
|
484
|
+
return [2 /*return*/, {
|
|
485
|
+
type: flowMapping[defaultFlowType],
|
|
486
|
+
result: NothingYet(),
|
|
487
|
+
data: {
|
|
488
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig
|
|
489
|
+
}
|
|
490
|
+
}];
|
|
491
|
+
case 4: return [2 /*return*/];
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
}); };
|
|
495
|
+
|
|
496
|
+
var detectOperatorByIp = function (strategy) { return __awaiter(void 0, void 0, void 0, function () {
|
|
497
|
+
var configs, flowObj, defaultConfig, defaultFlowType, flowType, event_1, ex_1;
|
|
498
|
+
var _a;
|
|
499
|
+
return __generator(this, function (_b) {
|
|
500
|
+
switch (_b.label) {
|
|
501
|
+
case 0:
|
|
502
|
+
_b.trys.push([0, 2, , 3]);
|
|
503
|
+
configs = getConfig();
|
|
504
|
+
return [4 /*yield*/, determineFlowByOperatorFromIp({
|
|
505
|
+
window: window,
|
|
506
|
+
configs: configs
|
|
507
|
+
})];
|
|
508
|
+
case 1:
|
|
509
|
+
flowObj = _b.sent();
|
|
510
|
+
defaultConfig = (_a = configs === null || configs === void 0 ? void 0 : configs.strategyConfigs) === null || _a === void 0 ? void 0 : _a.default;
|
|
511
|
+
defaultFlowType = defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flow;
|
|
512
|
+
if (!flowObj.flow &&
|
|
513
|
+
(strategy === 'all-flows-detect-operator-by-ip-or-ask-mobile-number' ||
|
|
514
|
+
strategy === 'all-flows-ask-mobile-number')) {
|
|
515
|
+
return [2 /*return*/, askMobileNumber()];
|
|
516
|
+
}
|
|
517
|
+
if (!flowObj.flow && strategy === 'all-flows-detect-operator-by-ip-or-ask-operator') {
|
|
518
|
+
return [2 /*return*/, askOperator()];
|
|
519
|
+
}
|
|
520
|
+
flowType = flowObj.flow;
|
|
521
|
+
if (!flowMapping[flowType]) {
|
|
522
|
+
return [2 /*return*/, {
|
|
523
|
+
type: flowMapping[defaultFlowType],
|
|
524
|
+
result: NothingYet(),
|
|
525
|
+
data: {
|
|
526
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig,
|
|
527
|
+
strategy: strategy
|
|
528
|
+
}
|
|
529
|
+
}];
|
|
530
|
+
}
|
|
531
|
+
event_1 = getTrackerEventName(flowType);
|
|
532
|
+
tracker.sendOptInFlowEvent(event_1);
|
|
533
|
+
return [2 /*return*/, {
|
|
534
|
+
type: flowMapping[flowType],
|
|
535
|
+
result: NothingYet(),
|
|
536
|
+
data: {
|
|
537
|
+
config: flowObj.flowConfig,
|
|
538
|
+
operator: flowObj.operator,
|
|
539
|
+
strategy: strategy,
|
|
540
|
+
defaultConfig: defaultConfig,
|
|
541
|
+
defaultFlowType: defaultFlowType
|
|
542
|
+
}
|
|
543
|
+
}];
|
|
544
|
+
case 2:
|
|
545
|
+
ex_1 = _b.sent();
|
|
546
|
+
console.error('error', ex_1);
|
|
547
|
+
return [3 /*break*/, 3];
|
|
548
|
+
case 3: return [2 /*return*/];
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
}); };
|
|
552
|
+
|
|
553
|
+
var resolveOperator = function (visitor, search, configs, msisdn) { return __awaiter(void 0, void 0, void 0, function () {
|
|
554
|
+
var firstSync, flow;
|
|
555
|
+
var _a, _b, _c;
|
|
556
|
+
return __generator(this, function (_d) {
|
|
557
|
+
switch (_d.label) {
|
|
558
|
+
case 0:
|
|
559
|
+
firstSync = (_a = search === null || search === void 0 ? void 0 : search.operator) !== null && _a !== void 0 ? _a : (_b = visitor === null || visitor === void 0 ? void 0 : visitor.heMsisdnDecryptedByApiResult) === null || _b === void 0 ? void 0 : _b.operator;
|
|
560
|
+
if (firstSync)
|
|
561
|
+
return [2 /*return*/, firstSync];
|
|
562
|
+
return [4 /*yield*/, determineFlowByMsidn({
|
|
563
|
+
window: window,
|
|
564
|
+
configs: configs,
|
|
565
|
+
internationalMSISDN: msisdn
|
|
566
|
+
})];
|
|
567
|
+
case 1:
|
|
568
|
+
flow = _d.sent();
|
|
569
|
+
return [2 /*return*/, (_c = flow === null || flow === void 0 ? void 0 : flow.operator) !== null && _c !== void 0 ? _c : null];
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
}); };
|
|
573
|
+
var handleHeaderEnrichment = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
574
|
+
var configs, defaultConfig, defaultFlowType, visitor, search, candidates, msisdn, isHeaderEnrichmentSuccess, operator, _a, subscription_url, redirect_url, flowObj, flowType, event_1, heResult, ex_1;
|
|
575
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
576
|
+
return __generator(this, function (_o) {
|
|
577
|
+
switch (_o.label) {
|
|
578
|
+
case 0:
|
|
579
|
+
configs = getConfig();
|
|
580
|
+
defaultConfig = configs === null || configs === void 0 ? void 0 : configs.strategyConfigs.default;
|
|
581
|
+
defaultFlowType = defaultConfig.flow;
|
|
582
|
+
_o.label = 1;
|
|
583
|
+
case 1:
|
|
584
|
+
_o.trys.push([1, 8, , 9]);
|
|
585
|
+
visitor = ((_c = (_b = window.pac_analytics) === null || _b === void 0 ? void 0 : _b.visitor) !== null && _c !== void 0 ? _c : {});
|
|
586
|
+
search = searchToObject(window);
|
|
587
|
+
candidates = [
|
|
588
|
+
search === null || search === void 0 ? void 0 : search.msisdn,
|
|
589
|
+
(_d = visitor.heMsisdnDecryptedByApiResult) === null || _d === void 0 ? void 0 : _d.msisdn,
|
|
590
|
+
(_e = visitor.heMsisdnResult) === null || _e === void 0 ? void 0 : _e.msisdn
|
|
591
|
+
];
|
|
592
|
+
msisdn = (_f = candidates.find(function (s) { return !!s; })) !== null && _f !== void 0 ? _f : null;
|
|
593
|
+
isHeaderEnrichmentSuccess = msisdn !== null;
|
|
594
|
+
if (!msisdn) return [3 /*break*/, 3];
|
|
595
|
+
return [4 /*yield*/, resolveOperator(visitor, search, configs, msisdn)];
|
|
596
|
+
case 2:
|
|
597
|
+
_a = _o.sent();
|
|
598
|
+
return [3 /*break*/, 4];
|
|
599
|
+
case 3:
|
|
600
|
+
_a = null;
|
|
601
|
+
_o.label = 4;
|
|
602
|
+
case 4:
|
|
603
|
+
operator = _a;
|
|
604
|
+
if (isHeaderEnrichmentSuccess) {
|
|
605
|
+
tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
|
|
606
|
+
msisdn: msisdn,
|
|
607
|
+
operator: operator
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
tracker.customEvent('Flow', 'recede-auto', 'msisdn-detection-failure');
|
|
612
|
+
}
|
|
613
|
+
if (operator === null) {
|
|
614
|
+
return [2 /*return*/, {
|
|
615
|
+
type: flowMapping[defaultFlowType],
|
|
616
|
+
result: NothingYet(),
|
|
617
|
+
data: {
|
|
618
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig
|
|
619
|
+
}
|
|
620
|
+
}];
|
|
621
|
+
}
|
|
622
|
+
if (configs.strategy === 'pin-header-enrichment' && isHeaderEnrichmentSuccess) {
|
|
623
|
+
return [2 /*return*/, {
|
|
624
|
+
type: flowMapping[defaultFlowType],
|
|
625
|
+
result: NothingYet(),
|
|
626
|
+
data: {
|
|
627
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig,
|
|
628
|
+
operator: operator,
|
|
629
|
+
msisdn: msisdn,
|
|
630
|
+
isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
|
|
631
|
+
}
|
|
632
|
+
}];
|
|
633
|
+
}
|
|
634
|
+
if ((_j = (_h = (_g = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _g === void 0 ? void 0 : _g.visitor) === null || _h === void 0 ? void 0 : _h.heMsisdnDecryptedByApiResult) === null || _j === void 0 ? void 0 : _j.isContentBlocked) {
|
|
635
|
+
window.isContentBlocked = true;
|
|
636
|
+
tracker.customEvent('Flow', 'recede-auto', 'content-blocked', __assign({ errorType: 'ContentBlocked', error: 'ContentBlocked', message: 'ContentBlocked' }, (_l = (_k = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _k === void 0 ? void 0 : _k.visitor) === null || _l === void 0 ? void 0 : _l.heMsisdnDecryptedByApiResult));
|
|
637
|
+
return [2 /*return*/, {
|
|
638
|
+
type: flowMapping[defaultFlowType],
|
|
639
|
+
result: NothingYet(),
|
|
640
|
+
data: {
|
|
641
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig,
|
|
642
|
+
operator: operator
|
|
643
|
+
}
|
|
644
|
+
}];
|
|
645
|
+
}
|
|
646
|
+
subscription_url = null;
|
|
647
|
+
redirect_url = null;
|
|
648
|
+
return [4 /*yield*/, determineFlowByOperator({
|
|
649
|
+
operator: operator,
|
|
650
|
+
configs: configs
|
|
651
|
+
})];
|
|
652
|
+
case 5:
|
|
653
|
+
flowObj = _o.sent();
|
|
654
|
+
flowType = flowObj.flow || defaultFlowType;
|
|
655
|
+
event_1 = getTrackerEventName(flowType);
|
|
656
|
+
tracker.sendOptInFlowEvent(event_1);
|
|
657
|
+
if (!(flowType === 'oneClick')) return [3 /*break*/, 7];
|
|
658
|
+
return [4 /*yield*/, getHeaderEnrichmentResult()];
|
|
659
|
+
case 6:
|
|
660
|
+
heResult = _o.sent();
|
|
661
|
+
subscription_url = (heResult === null || heResult === void 0 ? void 0 : heResult.subscription_url) || null;
|
|
662
|
+
redirect_url = (heResult === null || heResult === void 0 ? void 0 : heResult.redirect_url) || null;
|
|
663
|
+
_o.label = 7;
|
|
664
|
+
case 7: return [2 /*return*/, {
|
|
665
|
+
type: flowMapping[flowType],
|
|
666
|
+
result: NothingYet(),
|
|
667
|
+
data: {
|
|
668
|
+
config: flowObj.flowConfig,
|
|
669
|
+
operator: flowObj.operator,
|
|
670
|
+
subscription_url: subscription_url || null,
|
|
671
|
+
redirect_url: redirect_url || null,
|
|
672
|
+
isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess,
|
|
673
|
+
msisdn: msisdn,
|
|
674
|
+
apn: (_m = visitor === null || visitor === void 0 ? void 0 : visitor.heMsisdnResult) === null || _m === void 0 ? void 0 : _m.apn
|
|
675
|
+
}
|
|
676
|
+
}];
|
|
677
|
+
case 8:
|
|
678
|
+
ex_1 = _o.sent();
|
|
679
|
+
console.error('error', ex_1);
|
|
680
|
+
return [2 /*return*/, {
|
|
681
|
+
type: flowMapping[defaultFlowType],
|
|
682
|
+
result: NothingYet(),
|
|
683
|
+
data: {
|
|
684
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig
|
|
685
|
+
}
|
|
686
|
+
}];
|
|
687
|
+
case 9: return [2 /*return*/];
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
}); };
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* Creates a response object with the given parameters.
|
|
694
|
+
*
|
|
695
|
+
* @param {string} msisdn - The MSISDN (Mobile Station International Subscriber Directory Number).
|
|
696
|
+
* @param {IConfig} config - The configuration object.
|
|
697
|
+
* @param {string | null} operator - The operator (default: null).
|
|
698
|
+
* @return {object} The response that sets the state.
|
|
699
|
+
*/
|
|
700
|
+
var createResponseObject = function (config, flow) { return ({
|
|
701
|
+
type: flowMapping[flow] || PossibleTypes.PIN,
|
|
702
|
+
result: NothingYet(),
|
|
703
|
+
data: {
|
|
704
|
+
config: config
|
|
705
|
+
}
|
|
706
|
+
}); };
|
|
707
|
+
/**
|
|
708
|
+
* Injects header enrichment script based on the provided window object.
|
|
709
|
+
*
|
|
710
|
+
* @param {Window} window - The window object containing analytics visitor details.
|
|
711
|
+
* @return {Promise} A promise that resolves based on specific events or timeouts.
|
|
712
|
+
*/
|
|
713
|
+
var injectHeaderEnrichmentScript = function (_a) {
|
|
714
|
+
var window = _a.window;
|
|
715
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
716
|
+
var configs, enableScriptTimer, strategyConfigs, config;
|
|
717
|
+
var _b;
|
|
718
|
+
return __generator(this, function (_c) {
|
|
719
|
+
configs = getConfig();
|
|
720
|
+
enableScriptTimer = configs === null || configs === void 0 ? void 0 : configs.enableScriptTimer;
|
|
721
|
+
strategyConfigs = configs.strategyConfigs;
|
|
722
|
+
config = (_b = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default) === null || _b === void 0 ? void 0 : _b.flowConfig;
|
|
723
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
724
|
+
var _a, _b, _c, _d;
|
|
725
|
+
try {
|
|
726
|
+
var heMsisdn_1 = (_b = (_a = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _a === void 0 ? void 0 : _a.visitor) === null || _b === void 0 ? void 0 : _b.heMsisdn;
|
|
727
|
+
var country_1 = (_d = (_c = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _c === void 0 ? void 0 : _c.visitor) === null || _d === void 0 ? void 0 : _d.country;
|
|
728
|
+
if (heMsisdn_1 && country_1) {
|
|
729
|
+
heMsisdn_1 = formatNumberToE164(heMsisdn_1, country_1);
|
|
730
|
+
}
|
|
731
|
+
var msisdnDetected_1 = false;
|
|
732
|
+
var timerExpired_1 = false;
|
|
733
|
+
var timerId_1;
|
|
734
|
+
if (enableScriptTimer) {
|
|
735
|
+
timerId_1 = setTimeout(function () {
|
|
736
|
+
var _a;
|
|
737
|
+
if (!msisdnDetected_1) {
|
|
738
|
+
timerExpired_1 = true;
|
|
739
|
+
tracker.customEvent('Flow', 'recede-auto', 'msisdn-detection-failure', {
|
|
740
|
+
errorType: '3 second timer expired'
|
|
741
|
+
});
|
|
742
|
+
window.isPrelanderClicked = true;
|
|
743
|
+
resolve({
|
|
744
|
+
type: PossibleTypes.PIN,
|
|
745
|
+
result: Success({}),
|
|
746
|
+
data: {
|
|
747
|
+
config: (_a = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default) === null || _a === void 0 ? void 0 : _a.flowConfig
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
}, 3000);
|
|
752
|
+
}
|
|
753
|
+
var onSuccess_1 = function (event) {
|
|
754
|
+
var detail = event.detail;
|
|
755
|
+
heMsisdn_1 = detail === null || detail === void 0 ? void 0 : detail.msisdn;
|
|
756
|
+
if ((detail === null || detail === void 0 ? void 0 : detail.msisdn) && !(detail === null || detail === void 0 ? void 0 : detail.encrypted_msisdn)) {
|
|
757
|
+
heMsisdn_1 = formatNumberToE164(detail.msisdn, country_1);
|
|
758
|
+
window.msisdn = heMsisdn_1;
|
|
759
|
+
}
|
|
760
|
+
else {
|
|
761
|
+
window.msisdn = detail === null || detail === void 0 ? void 0 : detail.msisdn;
|
|
762
|
+
window.is_encrypted_msisdn = detail === null || detail === void 0 ? void 0 : detail.encrypted_msisdn;
|
|
763
|
+
}
|
|
764
|
+
if (enableScriptTimer) {
|
|
765
|
+
if (!timerExpired_1) {
|
|
766
|
+
msisdnDetected_1 = true;
|
|
767
|
+
clearTimeout(timerId_1);
|
|
768
|
+
tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
|
|
769
|
+
msisdn: heMsisdn_1
|
|
770
|
+
});
|
|
771
|
+
var flowObj = determineFlowByOperator({
|
|
772
|
+
configs: getConfig(),
|
|
773
|
+
operator: detail === null || detail === void 0 ? void 0 : detail.operator_code
|
|
774
|
+
});
|
|
775
|
+
window.removeEventListener('he-success', onSuccess_1);
|
|
776
|
+
window.removeEventListener('he-fail', onFail_1);
|
|
777
|
+
resolve(headerEnrichmentScript(flowObj, heMsisdn_1, detail === null || detail === void 0 ? void 0 : detail.operator_code, true));
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
tracker.customEvent('Flow', 'advance-auto', 'msisdn-detected', {
|
|
782
|
+
msisdn: heMsisdn_1,
|
|
783
|
+
operator: detail === null || detail === void 0 ? void 0 : detail.operator_code
|
|
784
|
+
});
|
|
785
|
+
var flowObj = determineFlowByOperator({
|
|
786
|
+
configs: getConfig(),
|
|
787
|
+
operator: detail === null || detail === void 0 ? void 0 : detail.operator_code
|
|
788
|
+
});
|
|
789
|
+
window.removeEventListener('he-success', onSuccess_1);
|
|
790
|
+
window.removeEventListener('he-fail', onFail_1);
|
|
791
|
+
resolve(headerEnrichmentScript(flowObj, heMsisdn_1, detail === null || detail === void 0 ? void 0 : detail.operator_code, true));
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
var onFail_1 = function (event) {
|
|
795
|
+
var detail = event.detail;
|
|
796
|
+
tracker.customEvent('Flow', 'recede-auto', 'msisdn-detection-failure', detail === null || detail === void 0 ? void 0 : detail.error_details);
|
|
797
|
+
window.removeEventListener('he-success', onSuccess_1);
|
|
798
|
+
window.removeEventListener('he-fail', onFail_1);
|
|
799
|
+
resolve(createResponseObject(config, strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default.flow));
|
|
800
|
+
};
|
|
801
|
+
window.addEventListener('he-success', onSuccess_1);
|
|
802
|
+
window.addEventListener('he-fail', onFail_1);
|
|
803
|
+
if (!(window === null || window === void 0 ? void 0 : window.heScriptUrl)) {
|
|
804
|
+
tracker.customEvent('Flow', 'recede-auto', 'msisdn-detection-failure', {
|
|
805
|
+
errorType: 'Error he script url not set'
|
|
806
|
+
});
|
|
807
|
+
window.dispatchEvent(new Event('he-fail'));
|
|
808
|
+
return;
|
|
809
|
+
}
|
|
810
|
+
window.addEventListener('error', function (event) {
|
|
811
|
+
var _a, _b;
|
|
812
|
+
console.error('Global error:', event === null || event === void 0 ? void 0 : event.error);
|
|
813
|
+
tracker.customEvent('Flow', 'recede-auto', 'global-error', {
|
|
814
|
+
errorMessage: (_a = event === null || event === void 0 ? void 0 : event.error) === null || _a === void 0 ? void 0 : _a.message,
|
|
815
|
+
errorStack: (_b = event === null || event === void 0 ? void 0 : event.error) === null || _b === void 0 ? void 0 : _b.stack
|
|
816
|
+
});
|
|
817
|
+
});
|
|
818
|
+
var script = document.createElement('script');
|
|
819
|
+
script.type = 'text/javascript';
|
|
820
|
+
script.id = 'he-js-link';
|
|
821
|
+
script.src = "".concat(window.heScriptUrl); // URL Comes from server
|
|
822
|
+
script.referrerPolicy = 'origin';
|
|
823
|
+
document.head.appendChild(script);
|
|
824
|
+
script.onerror = function (error) {
|
|
825
|
+
console.error('Error loading Header Enrichment script.');
|
|
826
|
+
tracker.customEvent('Flow', 'recede-auto', 'msisdn-detection-failure', {
|
|
827
|
+
errorType: 'Error loading Header Enrichment script',
|
|
828
|
+
errorMessage: error.message
|
|
829
|
+
});
|
|
830
|
+
window.dispatchEvent(new Event('he-fail'));
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
catch (err) {
|
|
834
|
+
console.error('Error in header enrichment:', err);
|
|
835
|
+
resolve(createResponseObject(config, strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default.flow));
|
|
836
|
+
}
|
|
837
|
+
})];
|
|
838
|
+
});
|
|
839
|
+
});
|
|
840
|
+
};
|
|
841
|
+
var headerEnrichmentScript = function (flowObj, msisdn, operator, isHeaderEnrichmentSuccess) {
|
|
842
|
+
var _a, _b;
|
|
843
|
+
if (msisdn === void 0) { msisdn = null; }
|
|
844
|
+
if (operator === void 0) { operator = null; }
|
|
845
|
+
var defaultConfig = (_a = getConfig().strategyConfigs) === null || _a === void 0 ? void 0 : _a.default;
|
|
846
|
+
var defaultFlowType = defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flow;
|
|
847
|
+
var flowType = flowObj.flow || ((_b = flowObj.default) === null || _b === void 0 ? void 0 : _b.flow);
|
|
848
|
+
var event = getTrackerEventName(flowType);
|
|
849
|
+
tracker.sendOptInFlowEvent(event);
|
|
850
|
+
if (!flowObj.flow) {
|
|
851
|
+
return {
|
|
852
|
+
type: flowMapping[defaultFlowType],
|
|
853
|
+
result: NothingYet(),
|
|
854
|
+
data: {
|
|
855
|
+
config: defaultConfig === null || defaultConfig === void 0 ? void 0 : defaultConfig.flowConfig,
|
|
856
|
+
operator: operator,
|
|
857
|
+
msisdn: msisdn,
|
|
858
|
+
isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
return {
|
|
863
|
+
type: flowMapping[flowType],
|
|
864
|
+
result: NothingYet(),
|
|
865
|
+
data: {
|
|
866
|
+
config: flowObj.flowConfig,
|
|
867
|
+
operator: flowObj.operator,
|
|
868
|
+
isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess
|
|
869
|
+
}
|
|
870
|
+
};
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
window.tracker = tracker;
|
|
874
|
+
var initialState = {
|
|
875
|
+
currentState: {
|
|
876
|
+
type: PossibleTypes.IDENTIFY_STRATEGY,
|
|
877
|
+
result: NothingYet(),
|
|
878
|
+
data: undefined
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
var mockStrategyStateByUrlParam = function () {
|
|
882
|
+
var search = searchToObject(window);
|
|
883
|
+
if (search['mock-flow'] !== undefined) {
|
|
884
|
+
if (search.operator !== undefined) {
|
|
885
|
+
window.operator = search.operator;
|
|
886
|
+
}
|
|
887
|
+
switch (search['mock-flow']) {
|
|
888
|
+
case 'pin':
|
|
889
|
+
return {
|
|
890
|
+
type: PossibleTypes.PIN,
|
|
891
|
+
result: Success({})
|
|
892
|
+
};
|
|
893
|
+
case 'mo':
|
|
894
|
+
return {
|
|
895
|
+
type: PossibleTypes.MO,
|
|
896
|
+
result: Success({})
|
|
897
|
+
};
|
|
898
|
+
case 'moredir':
|
|
899
|
+
return {
|
|
900
|
+
type: PossibleTypes.MO_REDIR,
|
|
901
|
+
result: Success({})
|
|
902
|
+
};
|
|
903
|
+
case 'oneclick':
|
|
904
|
+
return {
|
|
905
|
+
type: PossibleTypes.ONE_CLICK,
|
|
906
|
+
result: Success({}),
|
|
907
|
+
data: {
|
|
908
|
+
subscription_url: search['subscription-url']
|
|
909
|
+
}
|
|
910
|
+
};
|
|
911
|
+
case 'click2sms':
|
|
912
|
+
return {
|
|
913
|
+
type: PossibleTypes.CLICK2SMS,
|
|
914
|
+
result: Success({})
|
|
915
|
+
};
|
|
916
|
+
case 'ussd':
|
|
917
|
+
return {
|
|
918
|
+
type: PossibleTypes.USSD,
|
|
919
|
+
result: Success({})
|
|
920
|
+
};
|
|
921
|
+
case 'creditcard':
|
|
922
|
+
return {
|
|
923
|
+
type: PossibleTypes.CREDIT_CARD,
|
|
924
|
+
result: Success({})
|
|
925
|
+
};
|
|
926
|
+
default:
|
|
927
|
+
throw new Error('(mockStrategyStateByUrlParam) Strategy Mock Flow not supported');
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
};
|
|
931
|
+
/**
|
|
932
|
+
* Identify Strategy
|
|
933
|
+
* @returns {type: 'strategy/identifyStrategy', payload: {type: PossibleTypes.MO, result: IdentifyFlowOptionsResult}}
|
|
934
|
+
* - Add type
|
|
935
|
+
* - Makes a decision on which strategy to use in order to identify the flow
|
|
936
|
+
* - Strategy could be asking user's phone number, selecting an operator etc
|
|
937
|
+
* - all with the intension of getting the flow and its configuration
|
|
938
|
+
* - Flows are usually tied to an operator in the pages config.json
|
|
939
|
+
* - But they could also be single flows
|
|
940
|
+
*
|
|
941
|
+
*/
|
|
942
|
+
var identifyStrategy = createAsyncThunk('strategy/identifyStrategy', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
943
|
+
var configs, strategy, strategyConfigs, search, flow, config, flowObj, strategyResult, n;
|
|
944
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
945
|
+
return __generator(this, function (_k) {
|
|
946
|
+
switch (_k.label) {
|
|
947
|
+
case 0:
|
|
948
|
+
configs = getConfig();
|
|
949
|
+
strategy = configs.strategy, strategyConfigs = configs.strategyConfigs;
|
|
950
|
+
search = searchToObject(window);
|
|
951
|
+
if (search['mock-flow'] !== undefined) {
|
|
952
|
+
return [2 /*return*/, mockStrategyStateByUrlParam()];
|
|
953
|
+
}
|
|
954
|
+
if (search.ui_show_default_flow === '1') {
|
|
955
|
+
flow = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default.flow;
|
|
956
|
+
config = (_a = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default) === null || _a === void 0 ? void 0 : _a.flowConfig;
|
|
957
|
+
return [2 /*return*/, {
|
|
958
|
+
type: flowMapping[flow],
|
|
959
|
+
result: NothingYet(),
|
|
960
|
+
data: {
|
|
961
|
+
config: config
|
|
962
|
+
}
|
|
963
|
+
}];
|
|
964
|
+
}
|
|
965
|
+
if ((search['show-pin-entry'] && search['show-pin-entry'] === '1') ||
|
|
966
|
+
(search['show-thank-you'] && search['show-thank-you'] === '1') ||
|
|
967
|
+
(search.show_custom_error && search.show_custom_error === '1')) {
|
|
968
|
+
flowObj = determineFlowByOperator({
|
|
969
|
+
configs: configs,
|
|
970
|
+
operator: search.operator
|
|
971
|
+
});
|
|
972
|
+
strategyResult = {
|
|
973
|
+
type: PossibleTypes.PIN,
|
|
974
|
+
result: Success({}),
|
|
975
|
+
data: {
|
|
976
|
+
config: (flowObj === null || flowObj === void 0 ? void 0 : flowObj.flowConfig) || ((_b = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default) === null || _b === void 0 ? void 0 : _b.flowConfig)
|
|
977
|
+
}
|
|
978
|
+
};
|
|
979
|
+
return [2 /*return*/, strategyResult];
|
|
980
|
+
}
|
|
981
|
+
if (strategy.includes('ask-operator')) {
|
|
982
|
+
return [2 /*return*/, askOperator()];
|
|
983
|
+
}
|
|
984
|
+
if (strategy.includes('detect-operator-by-ip')) {
|
|
985
|
+
return [2 /*return*/, detectOperatorByIp(strategy)];
|
|
986
|
+
}
|
|
987
|
+
if (strategy === null || strategy === void 0 ? void 0 : strategy.includes('ask-mobile-number')) {
|
|
988
|
+
return [2 /*return*/, askMobileNumber()];
|
|
989
|
+
}
|
|
990
|
+
if (strategy === null || strategy === void 0 ? void 0 : strategy.includes('detect-operator-by-redirect-api')) {
|
|
991
|
+
return [2 /*return*/, callRedirectApi()];
|
|
992
|
+
}
|
|
993
|
+
if (!((strategy === null || strategy === void 0 ? void 0 : strategy.includes('header-enrichment')) && strategy !== 'header-enrichment-script')) return [3 /*break*/, 2];
|
|
994
|
+
return [4 /*yield*/, handleHeaderEnrichment()];
|
|
995
|
+
case 1:
|
|
996
|
+
n = _k.sent();
|
|
997
|
+
// @ts-ignore
|
|
998
|
+
return [2 /*return*/, n];
|
|
999
|
+
case 2:
|
|
1000
|
+
switch (strategy) {
|
|
1001
|
+
// REOVING THIS AS IT INJECTS UNUSED CODE
|
|
1002
|
+
case 'header-enrichment-script':
|
|
1003
|
+
// eslint-disable-next-line no-return-await
|
|
1004
|
+
return [2 /*return*/, injectHeaderEnrichmentScript({
|
|
1005
|
+
window: window
|
|
1006
|
+
})];
|
|
1007
|
+
case 'pin': {
|
|
1008
|
+
tracker.sendOptInFlowEvent('Pin');
|
|
1009
|
+
return [2 /*return*/, {
|
|
1010
|
+
type: PossibleTypes.PIN,
|
|
1011
|
+
result: Success({}),
|
|
1012
|
+
data: {
|
|
1013
|
+
config: (_c = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default) === null || _c === void 0 ? void 0 : _c.flowConfig,
|
|
1014
|
+
strategy: strategy
|
|
1015
|
+
}
|
|
1016
|
+
}];
|
|
1017
|
+
}
|
|
1018
|
+
case 'mo':
|
|
1019
|
+
tracker.sendOptInFlowEvent('Msisdn to sms');
|
|
1020
|
+
return [2 /*return*/, {
|
|
1021
|
+
type: PossibleTypes.MO,
|
|
1022
|
+
result: Success({}),
|
|
1023
|
+
data: {
|
|
1024
|
+
config: (_d = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default) === null || _d === void 0 ? void 0 : _d.flowConfig,
|
|
1025
|
+
strategy: strategy
|
|
1026
|
+
}
|
|
1027
|
+
}];
|
|
1028
|
+
case 'mo-redir':
|
|
1029
|
+
return [2 /*return*/, {
|
|
1030
|
+
type: PossibleTypes.MO_REDIR,
|
|
1031
|
+
result: Success({}),
|
|
1032
|
+
data: {
|
|
1033
|
+
config: (_e = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default) === null || _e === void 0 ? void 0 : _e.flowConfig,
|
|
1034
|
+
strategy: strategy
|
|
1035
|
+
}
|
|
1036
|
+
}];
|
|
1037
|
+
case 'one-click':
|
|
1038
|
+
tracker.sendOptInFlowEvent('Redirect');
|
|
1039
|
+
return [2 /*return*/, {
|
|
1040
|
+
type: PossibleTypes.ONE_CLICK,
|
|
1041
|
+
result: Success({}),
|
|
1042
|
+
data: {
|
|
1043
|
+
config: (_f = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default) === null || _f === void 0 ? void 0 : _f.flowConfig,
|
|
1044
|
+
strategy: strategy
|
|
1045
|
+
}
|
|
1046
|
+
}];
|
|
1047
|
+
case 'click2sms':
|
|
1048
|
+
tracker.sendOptInFlowEvent('Click to sms');
|
|
1049
|
+
return [2 /*return*/, {
|
|
1050
|
+
type: PossibleTypes.CLICK2SMS,
|
|
1051
|
+
result: Success({}),
|
|
1052
|
+
data: {
|
|
1053
|
+
config: (_g = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default) === null || _g === void 0 ? void 0 : _g.flowConfig,
|
|
1054
|
+
strategy: strategy
|
|
1055
|
+
}
|
|
1056
|
+
}];
|
|
1057
|
+
case 'ussd':
|
|
1058
|
+
tracker.sendOptInFlowEvent('USSD');
|
|
1059
|
+
return [2 /*return*/, {
|
|
1060
|
+
type: PossibleTypes.USSD,
|
|
1061
|
+
result: Success({}),
|
|
1062
|
+
data: {
|
|
1063
|
+
config: (_h = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default) === null || _h === void 0 ? void 0 : _h.flowConfig,
|
|
1064
|
+
strategy: strategy
|
|
1065
|
+
}
|
|
1066
|
+
}];
|
|
1067
|
+
case 'credit-card':
|
|
1068
|
+
// @ts-ignore
|
|
1069
|
+
tracker.sendOptInFlowEvent('Credit card');
|
|
1070
|
+
return [2 /*return*/, {
|
|
1071
|
+
type: PossibleTypes.CREDIT_CARD,
|
|
1072
|
+
result: Success({}),
|
|
1073
|
+
data: {
|
|
1074
|
+
config: (_j = strategyConfigs === null || strategyConfigs === void 0 ? void 0 : strategyConfigs.default) === null || _j === void 0 ? void 0 : _j.flowConfig,
|
|
1075
|
+
strategy: strategy
|
|
1076
|
+
}
|
|
1077
|
+
}];
|
|
1078
|
+
default:
|
|
1079
|
+
throw new Error('Strategy not supported');
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
});
|
|
1083
|
+
}); });
|
|
1084
|
+
var setStrategyExtraData = createAsyncThunk('strategy/setStrategyExtraData', function (_a) {
|
|
1085
|
+
var type = _a.type, data = _a.data;
|
|
1086
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
1087
|
+
return __generator(this, function (_b) {
|
|
1088
|
+
return [2 /*return*/, ({
|
|
1089
|
+
type: type,
|
|
1090
|
+
result: NothingYet(),
|
|
1091
|
+
data: data
|
|
1092
|
+
})];
|
|
1093
|
+
});
|
|
1094
|
+
});
|
|
1095
|
+
});
|
|
1096
|
+
var strategySlice = createSlice({
|
|
1097
|
+
name: 'strategy',
|
|
1098
|
+
initialState: initialState,
|
|
1099
|
+
reducers: {
|
|
1100
|
+
// Define synchronous reducers as needed
|
|
1101
|
+
},
|
|
1102
|
+
extraReducers: function (builder) {
|
|
1103
|
+
// @ts-ignore
|
|
1104
|
+
builder
|
|
1105
|
+
.addCase(identifyStrategy.pending, function (state) {
|
|
1106
|
+
state.currentState = {
|
|
1107
|
+
type: PossibleTypes.IDENTIFY_STRATEGY,
|
|
1108
|
+
result: Loading()
|
|
1109
|
+
};
|
|
1110
|
+
})
|
|
1111
|
+
// @ts-ignore
|
|
1112
|
+
.addCase(identifyStrategy.fulfilled, function (state, action) {
|
|
1113
|
+
state.currentState = action.payload;
|
|
1114
|
+
})
|
|
1115
|
+
.addCase(identifyStrategy.rejected, function (state, action) {
|
|
1116
|
+
state.currentState = {
|
|
1117
|
+
type: PossibleTypes.IDENTIFY_STRATEGY,
|
|
1118
|
+
result: Failure(action.error.message)
|
|
1119
|
+
};
|
|
1120
|
+
})
|
|
1121
|
+
.addCase(submitMSISDNAction.pending, function (state) {
|
|
1122
|
+
state.currentState = {
|
|
1123
|
+
type: PossibleTypes.IDENTIFY_FLOW_BY_MSISDN,
|
|
1124
|
+
result: Loading()
|
|
1125
|
+
};
|
|
1126
|
+
})
|
|
1127
|
+
.addCase(submitMSISDNAction.fulfilled, function (state, action) {
|
|
1128
|
+
state.currentState = action.payload;
|
|
1129
|
+
})
|
|
1130
|
+
.addCase(submitMSISDNAction.rejected, function (state, action) {
|
|
1131
|
+
state.currentState = {
|
|
1132
|
+
type: PossibleTypes.IDENTIFY_FLOW_BY_MSISDN,
|
|
1133
|
+
result: Failure(action.payload)
|
|
1134
|
+
};
|
|
1135
|
+
})
|
|
1136
|
+
.addCase(setStrategyExtraData.fulfilled, function (state, action) {
|
|
1137
|
+
state.currentState = action.payload;
|
|
1138
|
+
})
|
|
1139
|
+
.addCase(selectOperatorAction.pending, function (state) {
|
|
1140
|
+
state.currentState = {
|
|
1141
|
+
type: PossibleTypes.IDENTIFY_FLOW_BY_OPERATOR_SELECT,
|
|
1142
|
+
result: Loading()
|
|
1143
|
+
};
|
|
1144
|
+
})
|
|
1145
|
+
.addCase(selectOperatorAction.fulfilled, function (state, action) {
|
|
1146
|
+
state.currentState = action.payload;
|
|
1147
|
+
})
|
|
1148
|
+
.addCase(selectOperatorAction.rejected, function (state, action) {
|
|
1149
|
+
state.currentState = {
|
|
1150
|
+
type: PossibleTypes.IDENTIFY_FLOW_BY_OPERATOR_SELECT,
|
|
1151
|
+
result: Failure(action.payload)
|
|
1152
|
+
};
|
|
1153
|
+
});
|
|
1154
|
+
}
|
|
1155
|
+
});
|
|
1156
|
+
var strategyReducer = strategySlice.reducer;
|
|
1157
|
+
|
|
1158
|
+
export { PossibleTypes as P, selectOperatorAction as a, strategyReducer as b, setStrategyExtraData as c, flowMapping as f, identifyStrategy as i, submitMSISDNAction as s, tryGetIPRangeName as t };
|
|
1159
|
+
//# sourceMappingURL=strategySlice-DEsw1xc-.js.map
|