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
package/dist/pinFlow.js
CHANGED
|
@@ -1,2 +1,543 @@
|
|
|
1
|
-
import{__awaiter as e,__generator as t,__assign as r}from"tslib";import{createAsyncThunk as n,createSlice as i}from"@reduxjs/toolkit";import{N as o,L as a,S as s,F as l}from"./RemoteDataState-lcf8PfJd.js";import{i as d,c as u,P as c}from"./strategySlice-BMNt18ck.js";import{h as v}from"./handleWaterfallRedirect-DztqrthA.js";import{r as p}from"./normaliseErrorCode-CVpyJZ6_.js";import{searchToObject as m}from"./searchToObject.js";import{s as y}from"./storeMsisdn-Cjq8_qYH.js";import{t as w}from"./tracker-DaaILhEr.js";import{s as f,a as S}from"./main-CDmeQMF-.js";import"./getConfig.js";import"./formatNumberToE164-DaAFvpKD.js";import"./api-geirVksI.js";import"pacman-client";import"uuid";import"./helpers-CBmogWIZ.js";import"./loadScriptInnerHtml-B6v2-IGn.js";import"./cleanSearchParams-Dl7ZDlew.js";var g=function(e){return e((function(e){return e.pinFlow.currentState}))};function h(e){var t=e.msisdnEntry,r=e.pinEntry;return function(e){switch(e.type){case"MSISDNEntry":return t(e.result);case"PINEntry":return r(e.result,e.data);default:throw new Error("Invalid State")}}}var I={currentState:{type:"PINEntry",result:o(),data:{actualPIN:"",msisdn:"",operator:"",pinMaxLength:4}}},b={currentState:{type:"PINEntry",result:s({finalUrl:"/product"}),data:{actualPIN:"",msisdn:"",operator:"",pinMaxLength:4}}},E={currentState:{type:"MSISDNEntry",result:l({errorType:"InvalidMSISDN",error:"Invalid Mobile Number"})}},N={currentState:{type:"MSISDNEntry",result:o()}},U=function(e){var t,r=m(e),n=new Event("onPinPage"),i=r.ui_show_pin_entry&&"1"===r.ui_show_pin_entry||r["show-pin-entry"]&&"1"===r["show-pin-entry"],a=r["show-thank-you"]&&"1"===r["show-thank-you"],d="1"===(null==r?void 0:r.show_custom_error),u=(null!==(t=null==r?void 0:r.ui_error_message)&&void 0!==t?t:"").replace(/\+/g,"%20"),c=decodeURIComponent(u),v={currentState:{type:"MSISDNEntry",result:l({errorType:{"This mobile number is blacklisted":"BlacklistedNumber"}[c]||"SomethingWentWrong",error:c})}},p={currentState:{type:"PINEntry",result:s({finalUrl:(null==r?void 0:r.product_url)||""}),data:{msisdn:(null==r?void 0:r.msisdn)||"",operator:(null==r?void 0:r.operator)||""}}},y={currentState:{type:"PINEntry",result:o(),data:{msisdn:(null==r?void 0:r.msisdn)||"",operator:(null==r?void 0:r.operator)||""}}};if(i)return null==e||e.dispatchEvent(n),y;if(a)return p;if(d)return v;if(!r["mock-flow"])return N;switch(r["current-state"]){case"msisdn-failure-state":return E;case"pin-state":return null==e||e.dispatchEvent(n),I;case"completed-state":return b;default:return console.error("Mock Flow not supported"),N}}(window),P=n("pinFlow/submitMSISDNAction",(function(n,i){var s=n.window,l=n.msisdn,d=n.extraParams,S=i.getState,g=i.dispatch,h=i.rejectWithValue;return e(void 0,void 0,void 0,(function(){var e,n,i,I,b,E,N,U,P,_,F,T,C,j,k,R,D,x,A,L,B,W,H,q,J,V,O;return t(this,(function(t){switch(t.label){case 0:if(e=S(),!(null===(x=null===(D=null===(R=null==e?void 0:e.strategy)||void 0===R?void 0:R.currentState)||void 0===D?void 0:D.data)||void 0===x?void 0:x.config))return[2,h({errorType:"UnexpectedState"})];n=e.strategy.currentState.data,i=n.config,I=n.isHeaderEnrichmentSuccess,b=null===(A=e.pinFlow)||void 0===A?void 0:A.currentState,E=m(s),t.label=1;case 1:return t.trys.push([1,7,,8]),"ps"===(null==i?void 0:i.country.toLowerCase())&&(null==i?void 0:i.slug.includes("shemaroo"))&&"+970"===M(null==i?void 0:i.country,l)&&(l=l.replace("970","972")),"tpay"!==(null==(N=null===(B=null===(L=null==s?void 0:s.pac_analytics)||void 0===L?void 0:L.visitor)||void 0===B?void 0:B.genericJsLinkResult)?void 0:N.gateway)||(null==E?void 0:E.ui_show_pin_entry)?[3,3]:(w.advancedInFlow("tallyman.v1-pin","msisdn-submitted",{msisdn:l}),[4,f(s,i,l)]);case 2:if(t.sent(),s.msisdn=l,s.callConfirm)try{return s.callConfirm(),[2,r(r({},b),{type:"MSISDNEntry",result:a()})]}catch(e){return U="Confirm function failed",w.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:l,errorType:"TPayConfirmError",error:(null==e?void 0:e.toString())||"Error calling window.callConfirm function",message:e.message}),[2,h({errorType:"TPayConfirmError",error:U,message:U})]}return P="Confirm function not found",w.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:l,errorType:"TPayConfirmError",error:P,message:P}),[2,h({errorType:"TPayConfirmError",error:P,message:P})];case 3:return w.advancedInFlow("tallyman.v1-pin","msisdn-submitted",{msisdn:l}),[4,f(s,i,l)];case 4:return _=t.sent(),w.advancedInFlow("tallyman.v1-pin","msisdn-submission-success",{msisdn:l}),"SingleMSISDNSubmissionResult"===_.type&&_.redirectUrl?(w.advancedInFlow("tallyman.v1-pin","msisdn-submission-success",{msisdn:l}),w.customEvent("Flow","advance-auto","msisdn-redirect",{redirectUrl:_.redirectUrl}),s.location.href=_.redirectUrl,[2]):d&&d.storeMsisdn&&"true"===d.storeMsisdn?[4,y(l).then((function(e){e&&e.data&&e.data.success?w.customEvent("Flow","advance-auto","msisdn-stored-success"):w.customEvent("Flow","advance-auto","msisdn-stored-failed")})).catch((function(e){w.customEvent("Flow","advance-auto","msisdn-stored-error",e)}))]:[3,6];case 5:t.sent(),t.label=6;case 6:return F="SingleMSISDNSubmissionResult"===(null==_?void 0:_.type)?null==_?void 0:_.operator:"",T={SA_MOBILY:6,SA_STC:4,SA_ZAIN:4},C=new Event("onPinPage"),null==s||s.dispatchEvent(C),[2,r(r({},b),{type:"PINEntry",result:o(),data:r({actualPIN:"SingleMSISDNSubmissionResult"===_.type?_.pin:null,msisdn:l,operator:F,pinMaxLength:""!==F&&T[F]?T[F]:null,isHeaderEnrichmentSuccess:I},"SingleMSISDNSubmissionResult"===_.type&&(null==_?void 0:_.userType)?{userType:_.userType}:{})})];case 7:return j=t.sent(),console.warn(j),k=j.type,w.recedeInFlow("tallyman.v1-pin","msisdn-submission-failure",{msisdn:l,errorType:k,error:j.toString(),message:j.message,productUrl:j.productUrl}),I&&g(u({type:c.PIN,data:{isHeaderEnrichmentSuccess:!1,config:i}})),p.includes(k)&&(null===(H=null===(W=null==s?void 0:s.pac_analytics)||void 0===W?void 0:W.visitor)||void 0===H?void 0:H.waterfallRedirectUrl)&&(w.customEvent("tallyman.v1-pin","redirect","waterfall-redirect",{redirect_url:null===(J=null===(q=null==s?void 0:s.pac_analytics)||void 0===q?void 0:q.visitor)||void 0===J?void 0:J.waterfallRedirectUrl,errorType:k}),v(null===(O=null===(V=null==s?void 0:s.pac_analytics)||void 0===V?void 0:V.visitor)||void 0===O?void 0:O.waterfallRedirectUrl)),[2,h({errorType:k,error:j.toString(),message:j.message,productUrl:j.productUrl})];case 8:return[2]}}))}))})),_=n("pinFlow/submitPinAction",(function(n,i){var o=n.window,a=n.msisdn,l=n.pin,d=n.extraParams,u=i.getState,c=i.rejectWithValue;return e(void 0,void 0,void 0,(function(){var e,n,i,v,p,m,f,g,h,I;return t(this,(function(t){switch(t.label){case 0:if(e=u(),!(null===(h=null===(g=null===(f=null==e?void 0:e.strategy)||void 0===f?void 0:f.currentState)||void 0===g?void 0:g.data)||void 0===h?void 0:h.config))return[2,c({errorType:"UnexpectedState"})];n=e.strategy.currentState.data.config,i=null===(I=e.pinFlow)||void 0===I?void 0:I.currentState,t.label=1;case 1:return t.trys.push([1,5,,6]),w.advancedInFlow("tallyman.v1-pin","pin-submitted",{msisdn:a,pin:l}),[4,S(o,l,n,d)];case 2:return v=t.sent(),w.advancedInFlow("tallyman.v1-pin","pin-submission-success",{msisdn:a,pin:l,finalUrl:v.productUrl}),v.gatewayRedirectUrl&&""!==v.gatewayRedirectUrl&&(w.advancedInFlow("tallyman.v1-pin","gateway-redirect",{msisdn:a,pin:l,gatewayRedirectUrl:v.gatewayRedirectUrl}),o.location.href=v.gatewayRedirectUrl),d&&d.storeMsisdn&&"true"===d.storeMsisdn?[4,y(a).then((function(e){e&&e.data&&e.data.success?w.customEvent("Flow","advance-auto","msisdn-stored-success"):w.customEvent("Flow","advance-auto","msisdn-stored-failed")})).catch((function(e){w.customEvent("Flow","advance-auto","msisdn-stored-error",e)}))]:[3,4];case 3:t.sent(),t.label=4;case 4:return[2,r(r({},i),{type:"PINEntry",result:s({finalUrl:v.productUrl,isAlreadySubscribed:v.isAlreadySubscribed||!1})})];case 5:switch(p=t.sent(),console.warn(p),m=void 0,p.type){case"AlreadySubscribed":m="AlreadySubscribed";break;case"InvalidPIN":m="InvalidPIN";break;case"SessionBlocked":m="SessionBlocked";break;case"ExpiredPIN":m="ExpiredPIN";break;case"InsufficientBalance":m="InsufficientBalance";break;case"DuplicatedRequest":m="DuplicatedRequest";break;default:m="UnknownError"}return w.recedeInFlow("tallyman.v1-pin","pin-submission-failure",{msisdn:a,pin:l,errorType:m,error:p.toString(),message:p.message,productUrl:p.productUrl}),setTimeout((function(){p.productUrl&&(o.location.href=p.productUrl)}),0),[2,c({errorType:m,error:p.toString(),message:p.message,productUrl:p.productUrl})];case 6:return[2]}}))}))})),F=n("pinFlow/backToStartAction",(function(r,n){var i=n.getState,a=n.dispatch,s=n.rejectWithValue;return e(void 0,void 0,void 0,(function(){var e,r,n,l;return t(this,(function(t){try{if(w.recedeInFlow("tallyman.v1-pin","pin-state","requested to change phone number"),e=i(),!(null===(l=null===(n=null===(r=null==e?void 0:e.strategy)||void 0===r?void 0:r.currentState)||void 0===n?void 0:n.data)||void 0===l?void 0:l.config))return[2,s({errorType:"UnexpectedState"})];if("pin"===e.strategy.currentState.data.strategy)return[2,{type:"MSISDNEntry",result:o()}];a(d())}catch(e){return console.warn(e),[2,s({errorType:"UnexpectedState"})]}return[2]}))}))})),T={PS:"970"},M=function(e,t){if(!e||!t)return"";var r=e.toUpperCase(),n=T[r];return n?"+".concat(n):(console.error("Country code not found for",e),"")},C=i({name:"pinFlow",initialState:U,reducers:{},extraReducers:function(e){e.addCase(P.pending,(function(e){var t,r,n,i,o,s,l;e.currentState={type:(null===(r=null===(t=null===window||void 0===window?void 0:window.location)||void 0===t?void 0:t.search)||void 0===r?void 0:r.includes("ui_show_pin_entry"))||(null===(i=null===(n=null===window||void 0===window?void 0:window.location)||void 0===n?void 0:n.search)||void 0===i?void 0:i.includes("show-pin-entry"))&&"tpay"===(null===(l=null===(s=null===(o=null===window||void 0===window?void 0:window.pac_analytics)||void 0===o?void 0:o.visitor)||void 0===s?void 0:s.genericJsLinkResult)||void 0===l?void 0:l.gateway)?"PINEntry":"MSISDNEntry",result:a(),data:e.currentState.data}})).addCase(P.fulfilled,(function(e,t){e.currentState=t.payload})).addCase(P.rejected,(function(e,t){var r,n,i,o,a,s,d;e.currentState={type:(null===(n=null===(r=null===window||void 0===window?void 0:window.location)||void 0===r?void 0:r.search)||void 0===n?void 0:n.includes("ui_show_pin_entry"))||(null===(o=null===(i=null===window||void 0===window?void 0:window.location)||void 0===i?void 0:i.search)||void 0===o?void 0:o.includes("show-pin-entry"))&&"tpay"===(null===(d=null===(s=null===(a=null===window||void 0===window?void 0:window.pac_analytics)||void 0===a?void 0:a.visitor)||void 0===s?void 0:s.genericJsLinkResult)||void 0===d?void 0:d.gateway)?"PINEntry":"MSISDNEntry",result:l(t.payload),data:e.currentState.data}})).addCase(_.pending,(function(e){e.currentState={type:"PINEntry",result:a(),data:e.currentState.data}})).addCase(_.fulfilled,(function(e,t){e.currentState=t.payload})).addCase(_.rejected,(function(e,t){e.currentState={type:"PINEntry",result:l(t.payload),data:e.currentState.data}})).addCase(F.fulfilled,(function(e,t){e.currentState=t.payload}))}}),j=C.reducer;C.actions;export{F as backToStartAction,h as pinFlowMatch,j as pinFlowReducer,P as submitMSISDNAction,_ as submitPinAction,g as usePinFlowState};
|
|
1
|
+
import { __awaiter, __generator, __assign } from 'tslib';
|
|
2
|
+
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
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-DEsw1xc-.js';
|
|
5
|
+
import { h as handleWaterfallRedirect } from './handleWaterfallRedirect-h5K2zX3N.js';
|
|
6
|
+
import { r as redirectErrorTypes } from './normaliseErrorCode-CBLYxW-a.js';
|
|
7
|
+
import { searchToObject } from './searchToObject.js';
|
|
8
|
+
import { s as storeMsisdn } from './storeMsisdn-ChiBh8mI.js';
|
|
9
|
+
import { t as tracker } from './tracker-B_zsMRN2.js';
|
|
10
|
+
import { s as submitMSISDN, a as submitPIN } from './main-8gjJCdrT.js';
|
|
11
|
+
import './getConfig.js';
|
|
12
|
+
import './formatNumberToE164-oPCiETQk.js';
|
|
13
|
+
import './api-oPdBWsMC.js';
|
|
14
|
+
import 'pacman-client';
|
|
15
|
+
import 'uuid';
|
|
16
|
+
import './helpers-BIBpnXln.js';
|
|
17
|
+
import './loadScriptInnerHtml-CstJVRED.js';
|
|
18
|
+
import './cleanSearchParams-B2jK3H1j.js';
|
|
19
|
+
|
|
20
|
+
var usePinFlowState = function (useSelector) {
|
|
21
|
+
var currentState = useSelector(function (state) { return state.pinFlow.currentState; });
|
|
22
|
+
return currentState;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function pinFlowMatch(_a) {
|
|
26
|
+
var msisdnEntry = _a.msisdnEntry, pinEntry = _a.pinEntry;
|
|
27
|
+
return function (state) {
|
|
28
|
+
switch (state.type) {
|
|
29
|
+
case 'MSISDNEntry':
|
|
30
|
+
return msisdnEntry(state.result);
|
|
31
|
+
case 'PINEntry':
|
|
32
|
+
return pinEntry(state.result, state.data);
|
|
33
|
+
default:
|
|
34
|
+
throw new Error('Invalid State');
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var mockedPINState = {
|
|
40
|
+
currentState: {
|
|
41
|
+
type: 'PINEntry',
|
|
42
|
+
result: NothingYet(),
|
|
43
|
+
data: {
|
|
44
|
+
actualPIN: '',
|
|
45
|
+
msisdn: '',
|
|
46
|
+
operator: '',
|
|
47
|
+
pinMaxLength: 4
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var mockedCompletedState = {
|
|
52
|
+
currentState: {
|
|
53
|
+
type: 'PINEntry',
|
|
54
|
+
result: Success({ finalUrl: '/product' }),
|
|
55
|
+
data: {
|
|
56
|
+
actualPIN: '',
|
|
57
|
+
msisdn: '',
|
|
58
|
+
operator: '',
|
|
59
|
+
pinMaxLength: 4
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var mockedMSISDNEntryFailure = {
|
|
64
|
+
currentState: {
|
|
65
|
+
type: 'MSISDNEntry',
|
|
66
|
+
result: Failure({
|
|
67
|
+
errorType: 'InvalidMSISDN',
|
|
68
|
+
error: 'Invalid Mobile Number'
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
// Define the initial state
|
|
73
|
+
var defaultInitialState = {
|
|
74
|
+
currentState: {
|
|
75
|
+
type: 'MSISDNEntry',
|
|
76
|
+
result: NothingYet()
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Sets the initial state of the pin flow based on the search parameters in the URL or the default state.
|
|
81
|
+
*
|
|
82
|
+
* @param {Window} window - The window object.
|
|
83
|
+
* @return {PinFlowState} The initial state of the pin flow.
|
|
84
|
+
*/
|
|
85
|
+
var setInitialState = function (window) {
|
|
86
|
+
var _a;
|
|
87
|
+
var search = searchToObject(window);
|
|
88
|
+
var pinPageEvent = new Event('onPinPage');
|
|
89
|
+
var isPinEntryStep = (search.ui_show_pin_entry && search.ui_show_pin_entry === '1') ||
|
|
90
|
+
(search['show-pin-entry'] && search['show-pin-entry'] === '1');
|
|
91
|
+
var isShowThankYouStep = search['show-thank-you'] && search['show-thank-you'] === '1';
|
|
92
|
+
var isShowCustomError = (search === null || search === void 0 ? void 0 : search.show_custom_error) === '1';
|
|
93
|
+
var rawParam = (_a = search === null || search === void 0 ? void 0 : search.ui_error_message) !== null && _a !== void 0 ? _a : '';
|
|
94
|
+
var normalizedParam = rawParam.replace(/\+/g, '%20');
|
|
95
|
+
var errorMsg = decodeURIComponent(normalizedParam);
|
|
96
|
+
var mapParamError = {
|
|
97
|
+
'This mobile number is blacklisted': 'BlacklistedNumber'
|
|
98
|
+
};
|
|
99
|
+
var msisdnError = {
|
|
100
|
+
currentState: {
|
|
101
|
+
type: 'MSISDNEntry',
|
|
102
|
+
result: Failure({
|
|
103
|
+
errorType: mapParamError[errorMsg] || 'SomethingWentWrong',
|
|
104
|
+
error: errorMsg
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
var thankYouState = {
|
|
109
|
+
currentState: {
|
|
110
|
+
type: 'PINEntry',
|
|
111
|
+
result: Success({
|
|
112
|
+
finalUrl: (search === null || search === void 0 ? void 0 : search.product_url) || ''
|
|
113
|
+
}),
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
data: {
|
|
116
|
+
msisdn: (search === null || search === void 0 ? void 0 : search.msisdn) || '',
|
|
117
|
+
operator: (search === null || search === void 0 ? void 0 : search.operator) || ''
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
var initalPinEntryState = {
|
|
122
|
+
currentState: {
|
|
123
|
+
type: 'PINEntry',
|
|
124
|
+
result: NothingYet(),
|
|
125
|
+
// @ts-ignore
|
|
126
|
+
data: {
|
|
127
|
+
msisdn: (search === null || search === void 0 ? void 0 : search.msisdn) || '',
|
|
128
|
+
operator: (search === null || search === void 0 ? void 0 : search.operator) || ''
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
if (isPinEntryStep) {
|
|
133
|
+
// Needed for shemroo the handler is injected on server
|
|
134
|
+
window === null || window === void 0 ? void 0 : window.dispatchEvent(pinPageEvent);
|
|
135
|
+
return initalPinEntryState;
|
|
136
|
+
}
|
|
137
|
+
if (isShowThankYouStep) {
|
|
138
|
+
return thankYouState;
|
|
139
|
+
}
|
|
140
|
+
if (isShowCustomError) {
|
|
141
|
+
return msisdnError;
|
|
142
|
+
}
|
|
143
|
+
if (search['mock-flow']) {
|
|
144
|
+
switch (search['current-state']) {
|
|
145
|
+
case 'msisdn-failure-state':
|
|
146
|
+
return mockedMSISDNEntryFailure;
|
|
147
|
+
case 'pin-state':
|
|
148
|
+
// Needed for shemroo the handler is injected on server
|
|
149
|
+
window === null || window === void 0 ? void 0 : window.dispatchEvent(pinPageEvent);
|
|
150
|
+
return mockedPINState;
|
|
151
|
+
case 'completed-state':
|
|
152
|
+
return mockedCompletedState;
|
|
153
|
+
default:
|
|
154
|
+
console.error('Mock Flow not supported');
|
|
155
|
+
return defaultInitialState;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
return defaultInitialState;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
var initialState = setInitialState(window);
|
|
163
|
+
var submitMSISDNAction = createAsyncThunk('pinFlow/submitMSISDNAction', function (_a, _b) {
|
|
164
|
+
var window = _a.window, msisdn = _a.msisdn, extraParams = _a.extraParams;
|
|
165
|
+
var getState = _b.getState, dispatch = _b.dispatch, rejectWithValue = _b.rejectWithValue;
|
|
166
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
167
|
+
var state, _c, config, isHeaderEnrichmentSuccess, pinFlowCurrentState, searchObj, prefix, jsLinkResult, errorMsg_1, errorMsg, msisdnSubmissionResult, operator, pinMaxLengthByOp, pinPageEvent, ex_1, errorType;
|
|
168
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
169
|
+
return __generator(this, function (_r) {
|
|
170
|
+
switch (_r.label) {
|
|
171
|
+
case 0:
|
|
172
|
+
state = getState();
|
|
173
|
+
if (!((_f = (_e = (_d = state === null || state === void 0 ? void 0 : state.strategy) === null || _d === void 0 ? void 0 : _d.currentState) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.config)) {
|
|
174
|
+
return [2 /*return*/, rejectWithValue({
|
|
175
|
+
errorType: 'UnexpectedState'
|
|
176
|
+
})];
|
|
177
|
+
}
|
|
178
|
+
_c = state.strategy.currentState.data, config = _c.config, isHeaderEnrichmentSuccess = _c.isHeaderEnrichmentSuccess;
|
|
179
|
+
pinFlowCurrentState = (_g = state.pinFlow) === null || _g === void 0 ? void 0 : _g.currentState;
|
|
180
|
+
searchObj = searchToObject(window);
|
|
181
|
+
_r.label = 1;
|
|
182
|
+
case 1:
|
|
183
|
+
_r.trys.push([1, 7, , 8]);
|
|
184
|
+
/**
|
|
185
|
+
* Palestine calling code is +970
|
|
186
|
+
* But there was a request to have it as +972 only for gateway shemaroo
|
|
187
|
+
*/
|
|
188
|
+
// Start PS Calling code temp fix
|
|
189
|
+
if ((config === null || config === void 0 ? void 0 : config.country.toLowerCase()) === 'ps' && (config === null || config === void 0 ? void 0 : config.slug.includes('shemaroo'))) {
|
|
190
|
+
prefix = getInputValuePrefix(config === null || config === void 0 ? void 0 : config.country, msisdn);
|
|
191
|
+
if (prefix === '+970') {
|
|
192
|
+
msisdn = msisdn.replace('970', '972');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
jsLinkResult = (_j = (_h = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _h === void 0 ? void 0 : _h.visitor) === null || _j === void 0 ? void 0 : _j.genericJsLinkResult;
|
|
196
|
+
if (!((jsLinkResult === null || jsLinkResult === void 0 ? void 0 : jsLinkResult.gateway) === 'tpay' && !(searchObj === null || searchObj === void 0 ? void 0 : searchObj.ui_show_pin_entry))) return [3 /*break*/, 3];
|
|
197
|
+
tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submitted', { msisdn: msisdn });
|
|
198
|
+
return [4 /*yield*/, submitMSISDN(window, config, msisdn)];
|
|
199
|
+
case 2:
|
|
200
|
+
_r.sent(); // trigger pin call requested here by Adrian for BE tracking
|
|
201
|
+
window.msisdn = msisdn;
|
|
202
|
+
if (window.callConfirm) {
|
|
203
|
+
try {
|
|
204
|
+
window.callConfirm();
|
|
205
|
+
return [2 /*return*/, __assign(__assign({}, pinFlowCurrentState), { type: 'MSISDNEntry', result: Loading() })];
|
|
206
|
+
}
|
|
207
|
+
catch (ex) {
|
|
208
|
+
errorMsg_1 = 'Confirm function failed';
|
|
209
|
+
tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
|
|
210
|
+
msisdn: msisdn,
|
|
211
|
+
errorType: 'TPayConfirmError',
|
|
212
|
+
error: (ex === null || ex === void 0 ? void 0 : ex.toString()) || 'Error calling window.callConfirm function',
|
|
213
|
+
message: ex.message
|
|
214
|
+
});
|
|
215
|
+
return [2 /*return*/, rejectWithValue({
|
|
216
|
+
errorType: 'TPayConfirmError',
|
|
217
|
+
error: errorMsg_1,
|
|
218
|
+
message: errorMsg_1
|
|
219
|
+
})];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
errorMsg = 'Confirm function not found';
|
|
223
|
+
tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
|
|
224
|
+
msisdn: msisdn,
|
|
225
|
+
errorType: 'TPayConfirmError',
|
|
226
|
+
error: errorMsg,
|
|
227
|
+
message: errorMsg
|
|
228
|
+
});
|
|
229
|
+
return [2 /*return*/, rejectWithValue({
|
|
230
|
+
errorType: 'TPayConfirmError',
|
|
231
|
+
error: errorMsg,
|
|
232
|
+
message: errorMsg
|
|
233
|
+
})];
|
|
234
|
+
case 3:
|
|
235
|
+
// Start Trigger Pin
|
|
236
|
+
tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submitted', { msisdn: msisdn });
|
|
237
|
+
return [4 /*yield*/, submitMSISDN(window, config, msisdn)];
|
|
238
|
+
case 4:
|
|
239
|
+
msisdnSubmissionResult = _r.sent();
|
|
240
|
+
tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submission-success', { msisdn: msisdn });
|
|
241
|
+
// End Trigger Pin
|
|
242
|
+
/**
|
|
243
|
+
* Some flows require us to redirect to a url after trigger pin to check for fraud
|
|
244
|
+
* The url will then do some processing and return back to ouisys with
|
|
245
|
+
* extra param in the url that will tell us to show pin entry step or error
|
|
246
|
+
*/
|
|
247
|
+
// Start Pin Redirect
|
|
248
|
+
if (msisdnSubmissionResult.type === 'SingleMSISDNSubmissionResult' && msisdnSubmissionResult.redirectUrl) {
|
|
249
|
+
tracker.advancedInFlow('tallyman.v1-pin', 'msisdn-submission-success', { msisdn: msisdn });
|
|
250
|
+
tracker.customEvent('Flow', 'advance-auto', 'msisdn-redirect', {
|
|
251
|
+
redirectUrl: msisdnSubmissionResult.redirectUrl
|
|
252
|
+
});
|
|
253
|
+
window.location.href = msisdnSubmissionResult.redirectUrl;
|
|
254
|
+
return [2 /*return*/];
|
|
255
|
+
}
|
|
256
|
+
if (!(extraParams && extraParams.storeMsisdn && extraParams.storeMsisdn === 'true')) return [3 /*break*/, 6];
|
|
257
|
+
return [4 /*yield*/, storeMsisdn(msisdn)
|
|
258
|
+
.then(function (data) {
|
|
259
|
+
if (data && data.data && data.data.success) {
|
|
260
|
+
tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-success');
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-failed');
|
|
264
|
+
}
|
|
265
|
+
})
|
|
266
|
+
.catch(function (error) {
|
|
267
|
+
tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-error', error);
|
|
268
|
+
})];
|
|
269
|
+
case 5:
|
|
270
|
+
_r.sent();
|
|
271
|
+
_r.label = 6;
|
|
272
|
+
case 6:
|
|
273
|
+
operator = (msisdnSubmissionResult === null || msisdnSubmissionResult === void 0 ? void 0 : msisdnSubmissionResult.type) === 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult === null || msisdnSubmissionResult === void 0 ? void 0 : msisdnSubmissionResult.operator : '';
|
|
274
|
+
pinMaxLengthByOp = {
|
|
275
|
+
SA_MOBILY: 6,
|
|
276
|
+
SA_STC: 4,
|
|
277
|
+
SA_ZAIN: 4
|
|
278
|
+
};
|
|
279
|
+
pinPageEvent = new Event('onPinPage');
|
|
280
|
+
window === null || window === void 0 ? void 0 : window.dispatchEvent(pinPageEvent);
|
|
281
|
+
return [2 /*return*/, __assign(__assign({}, pinFlowCurrentState), { type: 'PINEntry', result: NothingYet(), data: __assign({ actualPIN: msisdnSubmissionResult.type === 'SingleMSISDNSubmissionResult' ? msisdnSubmissionResult.pin : null, msisdn: msisdn, operator: operator, pinMaxLength: operator !== '' && pinMaxLengthByOp[operator] ? pinMaxLengthByOp[operator] : null, isHeaderEnrichmentSuccess: isHeaderEnrichmentSuccess }, (msisdnSubmissionResult.type === 'SingleMSISDNSubmissionResult' && (msisdnSubmissionResult === null || msisdnSubmissionResult === void 0 ? void 0 : msisdnSubmissionResult.userType)
|
|
282
|
+
? { userType: msisdnSubmissionResult.userType }
|
|
283
|
+
: {})) })];
|
|
284
|
+
case 7:
|
|
285
|
+
ex_1 = _r.sent();
|
|
286
|
+
console.warn(ex_1);
|
|
287
|
+
errorType = ex_1.type;
|
|
288
|
+
tracker.recedeInFlow('tallyman.v1-pin', 'msisdn-submission-failure', {
|
|
289
|
+
msisdn: msisdn,
|
|
290
|
+
errorType: errorType,
|
|
291
|
+
error: ex_1.toString(),
|
|
292
|
+
message: ex_1.message,
|
|
293
|
+
productUrl: ex_1.productUrl
|
|
294
|
+
});
|
|
295
|
+
if (isHeaderEnrichmentSuccess) {
|
|
296
|
+
dispatch(setStrategyExtraData({
|
|
297
|
+
type: PossibleTypes.PIN,
|
|
298
|
+
data: {
|
|
299
|
+
isHeaderEnrichmentSuccess: false,
|
|
300
|
+
config: config
|
|
301
|
+
}
|
|
302
|
+
}));
|
|
303
|
+
}
|
|
304
|
+
if (redirectErrorTypes.includes(errorType) && ((_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.waterfallRedirectUrl)) {
|
|
305
|
+
tracker.customEvent('Flow', 'redirect', 'waterfall-redirect', {
|
|
306
|
+
redirect_url: (_o = (_m = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _m === void 0 ? void 0 : _m.visitor) === null || _o === void 0 ? void 0 : _o.waterfallRedirectUrl,
|
|
307
|
+
errorType: errorType
|
|
308
|
+
});
|
|
309
|
+
handleWaterfallRedirect((_q = (_p = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _p === void 0 ? void 0 : _p.visitor) === null || _q === void 0 ? void 0 : _q.waterfallRedirectUrl);
|
|
310
|
+
}
|
|
311
|
+
return [2 /*return*/, rejectWithValue({
|
|
312
|
+
errorType: errorType,
|
|
313
|
+
error: ex_1.toString(),
|
|
314
|
+
message: ex_1.message,
|
|
315
|
+
productUrl: ex_1.productUrl
|
|
316
|
+
})];
|
|
317
|
+
case 8: return [2 /*return*/];
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
var submitPinAction = createAsyncThunk('pinFlow/submitPinAction', function (_a, _b) {
|
|
323
|
+
var window = _a.window, msisdn = _a.msisdn, pin = _a.pin, extraParams = _a.extraParams;
|
|
324
|
+
var getState = _b.getState, rejectWithValue = _b.rejectWithValue;
|
|
325
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
326
|
+
var state, config, pinFlowCurrentState, result, ex_2, errorType;
|
|
327
|
+
var _c, _d, _e, _f;
|
|
328
|
+
return __generator(this, function (_g) {
|
|
329
|
+
switch (_g.label) {
|
|
330
|
+
case 0:
|
|
331
|
+
state = getState();
|
|
332
|
+
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)) {
|
|
333
|
+
return [2 /*return*/, rejectWithValue({
|
|
334
|
+
errorType: 'UnexpectedState'
|
|
335
|
+
})];
|
|
336
|
+
}
|
|
337
|
+
config = state.strategy.currentState.data.config;
|
|
338
|
+
pinFlowCurrentState = (_f = state.pinFlow) === null || _f === void 0 ? void 0 : _f.currentState;
|
|
339
|
+
_g.label = 1;
|
|
340
|
+
case 1:
|
|
341
|
+
_g.trys.push([1, 5, , 6]);
|
|
342
|
+
tracker.advancedInFlow('tallyman.v1-pin', 'pin-submitted', { msisdn: msisdn, pin: pin });
|
|
343
|
+
return [4 /*yield*/, submitPIN(window, pin, config, extraParams)];
|
|
344
|
+
case 2:
|
|
345
|
+
result = _g.sent();
|
|
346
|
+
tracker.advancedInFlow('tallyman.v1-pin', 'pin-submission-success', {
|
|
347
|
+
msisdn: msisdn,
|
|
348
|
+
pin: pin,
|
|
349
|
+
finalUrl: result.productUrl
|
|
350
|
+
});
|
|
351
|
+
/**
|
|
352
|
+
* Gateway redirect
|
|
353
|
+
* Value returned in this case is actually the gateway url instead of the product url
|
|
354
|
+
* More details on this ticket:
|
|
355
|
+
* https://www.notion.so/sammedia/ES-OnMobile-Movistar-Direct-Ouisys-Integration-XR-Academy-ca60b176b0ea40a7b170e5d9e7deb491
|
|
356
|
+
*/
|
|
357
|
+
// Start Gateway redirect
|
|
358
|
+
if (result.gatewayRedirectUrl && result.gatewayRedirectUrl !== '') {
|
|
359
|
+
tracker.advancedInFlow('tallyman.v1-pin', 'gateway-redirect', {
|
|
360
|
+
msisdn: msisdn,
|
|
361
|
+
pin: pin,
|
|
362
|
+
gatewayRedirectUrl: result.gatewayRedirectUrl
|
|
363
|
+
});
|
|
364
|
+
window.location.href = result.gatewayRedirectUrl;
|
|
365
|
+
}
|
|
366
|
+
if (!(extraParams && extraParams.storeMsisdn && extraParams.storeMsisdn === 'true')) return [3 /*break*/, 4];
|
|
367
|
+
return [4 /*yield*/, storeMsisdn(msisdn)
|
|
368
|
+
.then(function (data) {
|
|
369
|
+
if (data && data.data && data.data.success) {
|
|
370
|
+
tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-success');
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-failed');
|
|
374
|
+
}
|
|
375
|
+
})
|
|
376
|
+
.catch(function (error) {
|
|
377
|
+
tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-error', error);
|
|
378
|
+
})];
|
|
379
|
+
case 3:
|
|
380
|
+
_g.sent();
|
|
381
|
+
_g.label = 4;
|
|
382
|
+
case 4:
|
|
383
|
+
// End store msisdn
|
|
384
|
+
return [2 /*return*/, __assign(__assign({}, pinFlowCurrentState), { type: 'PINEntry', result: Success({
|
|
385
|
+
finalUrl: result.productUrl,
|
|
386
|
+
isAlreadySubscribed: result.isAlreadySubscribed || false
|
|
387
|
+
}) })];
|
|
388
|
+
case 5:
|
|
389
|
+
ex_2 = _g.sent();
|
|
390
|
+
console.warn(ex_2);
|
|
391
|
+
errorType = void 0;
|
|
392
|
+
switch (ex_2.type) {
|
|
393
|
+
case 'AlreadySubscribed':
|
|
394
|
+
errorType = 'AlreadySubscribed';
|
|
395
|
+
break;
|
|
396
|
+
case 'InvalidPIN':
|
|
397
|
+
errorType = 'InvalidPIN';
|
|
398
|
+
break;
|
|
399
|
+
case 'SessionBlocked':
|
|
400
|
+
errorType = 'SessionBlocked';
|
|
401
|
+
break;
|
|
402
|
+
case 'ExpiredPIN':
|
|
403
|
+
errorType = 'ExpiredPIN';
|
|
404
|
+
break;
|
|
405
|
+
case 'InsufficientBalance':
|
|
406
|
+
errorType = 'InsufficientBalance';
|
|
407
|
+
break;
|
|
408
|
+
case 'DuplicatedRequest':
|
|
409
|
+
errorType = 'DuplicatedRequest';
|
|
410
|
+
break;
|
|
411
|
+
default:
|
|
412
|
+
errorType = 'UnknownError';
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
tracker.recedeInFlow('tallyman.v1-pin', 'pin-submission-failure', {
|
|
416
|
+
msisdn: msisdn,
|
|
417
|
+
pin: pin,
|
|
418
|
+
errorType: errorType,
|
|
419
|
+
error: ex_2.toString(),
|
|
420
|
+
message: ex_2.message,
|
|
421
|
+
productUrl: ex_2.productUrl
|
|
422
|
+
});
|
|
423
|
+
// Redirect to the product url if returned in the exception
|
|
424
|
+
setTimeout(function () {
|
|
425
|
+
if (ex_2.productUrl) {
|
|
426
|
+
window.location.href = ex_2.productUrl;
|
|
427
|
+
}
|
|
428
|
+
}, 0);
|
|
429
|
+
return [2 /*return*/, rejectWithValue({
|
|
430
|
+
errorType: errorType,
|
|
431
|
+
error: ex_2.toString(),
|
|
432
|
+
message: ex_2.message,
|
|
433
|
+
productUrl: ex_2.productUrl
|
|
434
|
+
})];
|
|
435
|
+
case 6: return [2 /*return*/];
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
var backToStartAction = createAsyncThunk('pinFlow/backToStartAction', function (_, _a) {
|
|
441
|
+
var getState = _a.getState, dispatch = _a.dispatch, rejectWithValue = _a.rejectWithValue;
|
|
442
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
443
|
+
var state, strategy;
|
|
444
|
+
var _b, _c, _d;
|
|
445
|
+
return __generator(this, function (_e) {
|
|
446
|
+
try {
|
|
447
|
+
tracker.recedeInFlow('tallyman.v1-pin', 'pin-state', 'requested to change phone number');
|
|
448
|
+
state = getState();
|
|
449
|
+
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)) {
|
|
450
|
+
return [2 /*return*/, rejectWithValue({
|
|
451
|
+
errorType: 'UnexpectedState'
|
|
452
|
+
})];
|
|
453
|
+
}
|
|
454
|
+
strategy = state.strategy.currentState.data.strategy;
|
|
455
|
+
if (strategy === 'pin') {
|
|
456
|
+
return [2 /*return*/, {
|
|
457
|
+
type: 'MSISDNEntry',
|
|
458
|
+
result: NothingYet()
|
|
459
|
+
}];
|
|
460
|
+
}
|
|
461
|
+
dispatch(identifyStrategy());
|
|
462
|
+
}
|
|
463
|
+
catch (ex) {
|
|
464
|
+
console.warn(ex);
|
|
465
|
+
return [2 /*return*/, rejectWithValue({
|
|
466
|
+
errorType: 'UnexpectedState'
|
|
467
|
+
})];
|
|
468
|
+
}
|
|
469
|
+
return [2 /*return*/];
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
});
|
|
473
|
+
var countryCodes = {
|
|
474
|
+
PS: '970'
|
|
475
|
+
// Add other countries and codes here
|
|
476
|
+
};
|
|
477
|
+
var getInputValuePrefix = function (country, international) {
|
|
478
|
+
if (!country || !international)
|
|
479
|
+
return '';
|
|
480
|
+
// Convert the country to uppercase and retrieve the country code
|
|
481
|
+
var normalizedCountry = country.toUpperCase();
|
|
482
|
+
var countryCode = countryCodes[normalizedCountry];
|
|
483
|
+
// Check if the country code exists in the mapping
|
|
484
|
+
if (!countryCode) {
|
|
485
|
+
console.error('Country code not found for', country);
|
|
486
|
+
return '';
|
|
487
|
+
}
|
|
488
|
+
return "+".concat(countryCode);
|
|
489
|
+
};
|
|
490
|
+
// Define your slice
|
|
491
|
+
var pinFlowSlice = createSlice({
|
|
492
|
+
name: 'pinFlow',
|
|
493
|
+
initialState: initialState,
|
|
494
|
+
reducers: {},
|
|
495
|
+
extraReducers: function (builder) {
|
|
496
|
+
builder
|
|
497
|
+
.addCase(submitMSISDNAction.pending, function (state) {
|
|
498
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
499
|
+
// @ts-ignore
|
|
500
|
+
state.currentState = {
|
|
501
|
+
type: ((_b = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.search) === null || _b === void 0 ? void 0 : _b.includes('ui_show_pin_entry')) ||
|
|
502
|
+
(((_d = (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.search) === null || _d === void 0 ? void 0 : _d.includes('show-pin-entry')) &&
|
|
503
|
+
((_g = (_f = (_e = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _e === void 0 ? void 0 : _e.visitor) === null || _f === void 0 ? void 0 : _f.genericJsLinkResult) === null || _g === void 0 ? void 0 : _g.gateway) === 'tpay')
|
|
504
|
+
? 'PINEntry'
|
|
505
|
+
: 'MSISDNEntry',
|
|
506
|
+
result: Loading(),
|
|
507
|
+
data: state.currentState.data
|
|
508
|
+
};
|
|
509
|
+
})
|
|
510
|
+
.addCase(submitMSISDNAction.fulfilled, function (state, action) {
|
|
511
|
+
state.currentState = action.payload;
|
|
512
|
+
})
|
|
513
|
+
.addCase(submitMSISDNAction.rejected, function (state, action) {
|
|
514
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
515
|
+
// @ts-ignore
|
|
516
|
+
state.currentState = {
|
|
517
|
+
type: ((_b = (_a = window === null || window === void 0 ? void 0 : window.location) === null || _a === void 0 ? void 0 : _a.search) === null || _b === void 0 ? void 0 : _b.includes('ui_show_pin_entry')) ||
|
|
518
|
+
(((_d = (_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.search) === null || _d === void 0 ? void 0 : _d.includes('show-pin-entry')) &&
|
|
519
|
+
((_g = (_f = (_e = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _e === void 0 ? void 0 : _e.visitor) === null || _f === void 0 ? void 0 : _f.genericJsLinkResult) === null || _g === void 0 ? void 0 : _g.gateway) === 'tpay')
|
|
520
|
+
? 'PINEntry'
|
|
521
|
+
: 'MSISDNEntry',
|
|
522
|
+
result: Failure(action.payload),
|
|
523
|
+
data: state.currentState.data
|
|
524
|
+
};
|
|
525
|
+
})
|
|
526
|
+
.addCase(submitPinAction.pending, function (state) {
|
|
527
|
+
state.currentState = { type: 'PINEntry', result: Loading(), data: state.currentState.data };
|
|
528
|
+
})
|
|
529
|
+
.addCase(submitPinAction.fulfilled, function (state, action) {
|
|
530
|
+
state.currentState = action.payload;
|
|
531
|
+
})
|
|
532
|
+
.addCase(submitPinAction.rejected, function (state, action) {
|
|
533
|
+
state.currentState = { type: 'PINEntry', result: Failure(action.payload), data: state.currentState.data };
|
|
534
|
+
})
|
|
535
|
+
.addCase(backToStartAction.fulfilled, function (state, action) {
|
|
536
|
+
state.currentState = action.payload;
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
var pinFlowReducer = pinFlowSlice.reducer; pinFlowSlice.actions;
|
|
541
|
+
|
|
542
|
+
export { backToStartAction, pinFlowMatch, pinFlowReducer, submitMSISDNAction, submitPinAction, usePinFlowState };
|
|
2
543
|
//# sourceMappingURL=pinFlow.js.map
|