ouisys-engine 5.1.16 → 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,75 @@
|
|
|
1
|
+
function match(_a) {
|
|
2
|
+
var nothingYet = _a.nothingYet, loading = _a.loading, failure = _a.failure, success = _a.success;
|
|
3
|
+
return function (model) {
|
|
4
|
+
switch (model.type) {
|
|
5
|
+
case 'NothingYet':
|
|
6
|
+
return nothingYet();
|
|
7
|
+
case 'Loading':
|
|
8
|
+
return loading();
|
|
9
|
+
case 'Failure':
|
|
10
|
+
return failure(model.error);
|
|
11
|
+
case 'Success':
|
|
12
|
+
return success(model.data);
|
|
13
|
+
default:
|
|
14
|
+
return nothingYet();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
var NothingYet = function () { return ({
|
|
19
|
+
type: 'NothingYet'
|
|
20
|
+
}); };
|
|
21
|
+
var Loading = function () { return ({
|
|
22
|
+
type: 'Loading'
|
|
23
|
+
}); };
|
|
24
|
+
var Failure = function (error) { return ({
|
|
25
|
+
type: 'Failure',
|
|
26
|
+
error: error
|
|
27
|
+
}); };
|
|
28
|
+
var Success = function (data) { return ({
|
|
29
|
+
type: 'Success',
|
|
30
|
+
data: data
|
|
31
|
+
}); };
|
|
32
|
+
var IsNothingYet = function (s) { return s.type === 'NothingYet'; };
|
|
33
|
+
var IsLoading = function (s) { return s.type === 'Loading'; };
|
|
34
|
+
var IsFailure = function (s) { return s.type === 'Failure'; };
|
|
35
|
+
var IsSuccess = function (s) { return s.type === 'Success'; };
|
|
36
|
+
var WhenFailure = function (d, r) { return function (s) {
|
|
37
|
+
return s.type === 'Failure' ? r(s.error) : d;
|
|
38
|
+
}; };
|
|
39
|
+
var WhenLoading = function (d, r) { return function (s) {
|
|
40
|
+
return s.type === 'Loading' ? r() : d;
|
|
41
|
+
}; };
|
|
42
|
+
var WhenSuccess = function (d, r) { return function (s) {
|
|
43
|
+
return s.type === 'Success' ? r(s.data) : d;
|
|
44
|
+
}; };
|
|
45
|
+
var MatchFailure = function (_a) {
|
|
46
|
+
var failure = _a.failure, otherwise = _a.otherwise;
|
|
47
|
+
return function (s) { return (s.type === 'Failure' ? failure(s.error) : otherwise()); };
|
|
48
|
+
};
|
|
49
|
+
var MatchSuccess = function (_a) {
|
|
50
|
+
var success = _a.success, otherwise = _a.otherwise;
|
|
51
|
+
return function (s) {
|
|
52
|
+
return s.type === 'Success' ? success(s.data) : otherwise(s);
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
var RemoteDataState = /*#__PURE__*/Object.freeze({
|
|
57
|
+
__proto__: null,
|
|
58
|
+
Failure: Failure,
|
|
59
|
+
IsFailure: IsFailure,
|
|
60
|
+
IsLoading: IsLoading,
|
|
61
|
+
IsNothingYet: IsNothingYet,
|
|
62
|
+
IsSuccess: IsSuccess,
|
|
63
|
+
Loading: Loading,
|
|
64
|
+
MatchFailure: MatchFailure,
|
|
65
|
+
MatchSuccess: MatchSuccess,
|
|
66
|
+
NothingYet: NothingYet,
|
|
67
|
+
Success: Success,
|
|
68
|
+
WhenFailure: WhenFailure,
|
|
69
|
+
WhenLoading: WhenLoading,
|
|
70
|
+
WhenSuccess: WhenSuccess,
|
|
71
|
+
match: match
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export { Failure as F, Loading as L, NothingYet as N, RemoteDataState as R, Success as S };
|
|
75
|
+
//# sourceMappingURL=RemoteDataState-CwHLI23e.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteDataState-CwHLI23e.js","sources":["../../src/common-types/RemoteDataState.ts"],"sourcesContent":["export type RemoteDataState<E, D> =\n | { type: 'NothingYet' }\n | { type: 'Loading' }\n | { type: 'Failure'; error: E }\n | { type: 'Success'; data: D };\n\nexport interface IMatcher<E, D, R> {\n nothingYet: (data?: D) => R;\n loading: () => R;\n failure: (error: E) => R;\n success: (data: D) => R;\n}\n\nexport interface ISuccessMatcher<E, D, R> {\n success: (data: D) => R;\n otherwise: (rds: RemoteDataState<E, D>) => R;\n}\n\nexport function match<E, D, R>({\n nothingYet,\n loading,\n failure,\n success\n}: IMatcher<E, D, R>): (model: RemoteDataState<E, D>) => R {\n return (model) => {\n switch (model.type) {\n case 'NothingYet':\n return nothingYet();\n case 'Loading':\n return loading();\n case 'Failure':\n return failure(model.error);\n case 'Success':\n return success(model.data);\n default:\n return nothingYet();\n }\n };\n}\n\nexport const NothingYet = <E, D>(): RemoteDataState<E, D> => ({\n type: 'NothingYet'\n});\n\nexport const Loading = <E, D>(): RemoteDataState<E, D> => ({\n type: 'Loading'\n});\n\nexport const Failure = <E, D>(error: E): RemoteDataState<E, D> => ({\n type: 'Failure',\n error\n});\n\nexport const Success = <E, D>(data: D): RemoteDataState<E, D> => ({\n type: 'Success',\n data\n});\n\nexport const IsNothingYet = <E, D>(s: RemoteDataState<E, D>) => s.type === 'NothingYet';\nexport const IsLoading = <E, D>(s: RemoteDataState<E, D>) => s.type === 'Loading';\nexport const IsFailure = <E, D>(s: RemoteDataState<E, D>) => s.type === 'Failure';\nexport const IsSuccess = <E, D>(s: RemoteDataState<E, D>) => s.type === 'Success';\n\nexport const WhenFailure = <E, D, R>(d: R, r: (err: E) => R) => (s: RemoteDataState<E, D>) =>\n s.type === 'Failure' ? r(s.error) : d;\n\nexport const WhenLoading = <D, R>(d: R, r: () => R) => (s: RemoteDataState<unknown, D>) =>\n s.type === 'Loading' ? r() : d;\n\nexport const WhenSuccess = <D, R>(d: R, r: (data: D) => R) => (s: RemoteDataState<unknown, D>) =>\n s.type === 'Success' ? r(s.data) : d;\n\nexport const MatchFailure = <E, D, R>({ failure, otherwise }: { otherwise: () => R; failure: (err: E) => R }) => (\n s: RemoteDataState<E, D>\n) => (s.type === 'Failure' ? failure(s.error) : otherwise());\n\nexport const MatchSuccess = <E, D, R>({ success, otherwise }: ISuccessMatcher<E, D, R>) => (s: RemoteDataState<E, D>) =>\n s.type === 'Success' ? success(s.data) : otherwise(s);\n"],"names":[],"mappings":"AAkBM,SAAU,KAAK,CAAU,EAKX,EAAA;QAJlB,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,OAAO,GAAA,EAAA,CAAA,OAAA,CAAA;AAEP,IAAA,OAAO,UAAC,KAAK,EAAA;QACX,QAAQ,KAAK,CAAC,IAAI;AAChB,YAAA,KAAK,YAAY;gBACf,OAAO,UAAU,EAAE,CAAC;AACtB,YAAA,KAAK,SAAS;gBACZ,OAAO,OAAO,EAAE,CAAC;AACnB,YAAA,KAAK,SAAS;AACZ,gBAAA,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC9B,YAAA,KAAK,SAAS;AACZ,gBAAA,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7B,YAAA;gBACE,OAAO,UAAU,EAAE,CAAC;AACvB,SAAA;AACH,KAAC,CAAC;AACJ,CAAC;AAEY,IAAA,UAAU,GAAG,YAAA,EAAmC,QAAC;AAC5D,IAAA,IAAI,EAAE,YAAY;CACnB,EAAC,GAAC;AAEU,IAAA,OAAO,GAAG,YAAA,EAAmC,QAAC;AACzD,IAAA,IAAI,EAAE,SAAS;CAChB,EAAC,GAAC;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AS,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAApC,CAAoC,CAAA,EAAA,CAAC;AAEhC,IAAM,YAAY,GAAG,UAAU,EAAsE,EAAA;QAApE,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,SAAS,GAAA,EAAA,CAAA,SAAA,CAAA;IAAuD,OAAA,UAC/G,CAAwB,EAAA,EACrB,QAAC,CAAC,CAAC,IAAI,KAAK,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,SAAS,EAAE,EAAC,EAAA,CAAA;AAFqD,CAErD,CAAC;AAEtD,IAAM,YAAY,GAAG,UAAU,EAAgD,EAAA;QAA9C,OAAO,GAAA,EAAA,CAAA,OAAA,EAAE,SAAS,GAAA,EAAA,CAAA,SAAA,CAAA;AAAiC,IAAA,OAAA,UAAC,CAAwB,EAAA;QAClH,OAAA,CAAC,CAAC,IAAI,KAAK,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;KAAA,CAAA;AADoC,CACpC;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { __awaiter, __generator, __assign } from 'tslib';
|
|
2
|
+
|
|
3
|
+
var bupperizeCountry = function (c) { return (c === 'gb' ? 'uk' : c); };
|
|
4
|
+
|
|
5
|
+
var identify = function (_a) {
|
|
6
|
+
var window = _a.window, slug = _a.slug, country = _a.country, msisdn = _a.msisdn, device = _a.device, offer = _a.offer, rockmanId = _a.rockmanId;
|
|
7
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
8
|
+
var languageCode, locationHref, host, params, urlParams, url, response;
|
|
9
|
+
return __generator(this, function (_b) {
|
|
10
|
+
switch (_b.label) {
|
|
11
|
+
case 0:
|
|
12
|
+
languageCode = window.languageCode || '';
|
|
13
|
+
locationHref = encodeURIComponent(window.location.href);
|
|
14
|
+
host = window.DEV_BASE_URL || '';
|
|
15
|
+
params = {
|
|
16
|
+
action: 'identify',
|
|
17
|
+
slug: slug,
|
|
18
|
+
country: country,
|
|
19
|
+
msisdn: msisdn,
|
|
20
|
+
device: device,
|
|
21
|
+
offerId: offer,
|
|
22
|
+
rockman_id: rockmanId,
|
|
23
|
+
page: locationHref,
|
|
24
|
+
language_code: languageCode
|
|
25
|
+
};
|
|
26
|
+
urlParams = new URLSearchParams(params).toString();
|
|
27
|
+
url = "".concat(host, "/tallyman/v1/?").concat(urlParams);
|
|
28
|
+
return [4 /*yield*/, fetch(url)];
|
|
29
|
+
case 1:
|
|
30
|
+
response = _b.sent();
|
|
31
|
+
return [2 /*return*/, response.json()];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
var getRedirectUrl = function (_a) {
|
|
37
|
+
var window = _a.window, country = _a.country, slug = _a.slug, offer = _a.offer, rockmanId = _a.rockmanId, _b = _a.search, search = _b === void 0 ? '' : _b;
|
|
38
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
39
|
+
var evinaTid, params, host, url, result, identifyError;
|
|
40
|
+
var _c, _d, _e, _f, _g, _h;
|
|
41
|
+
return __generator(this, function (_j) {
|
|
42
|
+
switch (_j.label) {
|
|
43
|
+
case 0:
|
|
44
|
+
evinaTid = typeof window !== 'undefined' && window.tid ? window.tid : '';
|
|
45
|
+
params = new URLSearchParams(__assign(__assign({ action: 'redirect', device: 'smart', slug: slug, offerId: offer, country: bupperizeCountry(country), rockman_id: rockmanId, sam_evina_tid: evinaTid }, (((_c = window === null || window === void 0 ? void 0 : window.location) === null || _c === void 0 ? void 0 : _c.href) && { page: encodeURIComponent((_d = window === null || window === void 0 ? void 0 : window.location) === null || _d === void 0 ? void 0 : _d.href) })), (((_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.ip) && { ip_address: (_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.ip })));
|
|
46
|
+
host = window.DEV_BASE_URL || '';
|
|
47
|
+
url = "".concat(host, "/tallyman/v1/?").concat(params.toString()).concat(search ? "&".concat(search) : '');
|
|
48
|
+
return [4 /*yield*/, fetch(url).then(function (x) { return x.json(); })];
|
|
49
|
+
case 1:
|
|
50
|
+
result = _j.sent();
|
|
51
|
+
if (result.success === false) {
|
|
52
|
+
identifyError = new Error("Error in getRedirectUrl() identify-user action:\n".concat(result.message));
|
|
53
|
+
identifyError.type = 'NotOn3g';
|
|
54
|
+
throw identifyError;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return [2 /*return*/, result];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export { bupperizeCountry as b, getRedirectUrl as g, identify as i };
|
|
65
|
+
//# sourceMappingURL=api-oPdBWsMC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-oPdBWsMC.js","sources":["../../src/utilities/bupperizeCountry.ts","../../src/flows/strategy/api.ts"],"sourcesContent":["const bupperizeCountry = (c: string) => (c === 'gb' ? 'uk' : c);\nexport { bupperizeCountry };\n","import { IError } from '../../common-types/IError';\nimport { IIdentifyResult, IStrategyIDentifyUserResult } from '../../sharedFlowTypes/StrategyTypes';\nimport { bupperizeCountry } from '../../utilities/bupperizeCountry';\n\nconst fetchJsonp: <T>({ window, _url }: { window: Window; _url: string }) => Promise<T> = ({\n window,\n _url\n}: {\n window: Window;\n _url: string;\n}) => {\n let url = _url;\n const ouisys_callback_function = `ouisys_callback_function${Math.floor(Math.random() * 10000)}`;\n return new Promise((resolve, reject) => {\n (window as any)[ouisys_callback_function] = (arg: any) => {\n resolve(arg);\n };\n\n url += url.indexOf('?') === -1 ? '?' : '&';\n url += `jsonp=${ouisys_callback_function}`;\n const script = document.createElement('script');\n script.src = url;\n script.id = ouisys_callback_function;\n document.body.appendChild(script);\n\n // Caught if got 404/500\n script.onerror = () => {\n reject(new Error(`JSONP request to ${_url} failed`));\n };\n });\n};\nconst identify = async ({\n window,\n slug,\n country,\n msisdn,\n device,\n offer,\n rockmanId\n}: {\n window: Window;\n slug: string;\n country: string;\n msisdn: string;\n device: string;\n offer: string;\n rockmanId: string;\n}): Promise<IIdentifyResult> => {\n const languageCode = window.languageCode || '';\n const locationHref = encodeURIComponent(window.location.href);\n const host = (window as Window).DEV_BASE_URL || '';\n\n const params = {\n action: 'identify',\n slug,\n country,\n msisdn,\n device,\n offerId: offer,\n rockman_id: rockmanId,\n page: locationHref,\n language_code: languageCode\n };\n\n const urlParams = new URLSearchParams(params).toString();\n const url = `${host}/tallyman/v1/?${urlParams}`;\n\n const response = await fetch(url);\n return response.json();\n};\n\nconst identifyUserGetSubscriptionUrl = async ({\n window,\n country,\n slug,\n device,\n offer,\n rockmanId,\n extraParamsQs = '',\n search = ''\n}: {\n window: Window;\n country: string;\n slug: string;\n device: string;\n offer: string;\n rockmanId: string;\n extraParamsQs?: string;\n search?: string;\n}): Promise<IStrategyIDentifyUserResult> => {\n const xaid = window.pac_analytics.visitor.xaid || '';\n const locationHref = encodeURIComponent(window.location.href);\n const pixelUrl = encodeURIComponent(\n `http://${window.location.host}/pixels?xcid=${window.location.pathname.replace(\n '/',\n ''\n )}&xaid=${xaid}&country=${bupperizeCountry(country)}`\n );\n\n const params = {\n action: 'identify-user',\n country: bupperizeCountry(country),\n slug,\n device,\n offerId: offer,\n page: locationHref,\n pixel_url: pixelUrl,\n rockman_id: rockmanId,\n extraParamsQs,\n search\n };\n\n const urlParams = new URLSearchParams(params).toString();\n const host = window.DEV_BASE_URL || '';\n const url = `${host}/tallyman/v1/?${urlParams}`;\n\n const response = await fetchJsonp<IStrategyIDentifyUserResult>({\n window,\n _url: url\n });\n return response;\n};\n\nconst getRedirectUrl = async ({\n window,\n country,\n slug,\n offer,\n rockmanId,\n search = ''\n}: {\n window: Window;\n country: string;\n slug: string;\n device: string;\n offer: string;\n rockmanId: string;\n extraParamsQs?: string;\n search?: string;\n}): Promise<{\n redirect_url: string;\n operator: string;\n success: boolean;\n payload: {\n network_type: 'wifi' | 'data';\n operator: string;\n };\n}> => {\n const evinaTid = typeof window !== 'undefined' && window.tid ? window.tid : '';\n\n const params = new URLSearchParams({\n action: 'redirect',\n device: 'smart',\n slug,\n offerId: offer,\n country: bupperizeCountry(country),\n rockman_id: rockmanId,\n sam_evina_tid: evinaTid,\n ...(window?.location?.href && { page: encodeURIComponent(window?.location?.href) }),\n ...(window?.pac_analytics?.visitor?.ip && { ip_address: window?.pac_analytics?.visitor?.ip })\n });\n\n const host = window.DEV_BASE_URL || '';\n\n const url = `${host}/tallyman/v1/?${params.toString()}${search ? `&${search}` : ''}`;\n const result = await fetch(url).then((x) => x.json());\n\n if (result.success === false) {\n const identifyError = new Error(`Error in getRedirectUrl() identify-user action:\\n${result.message}`) as IError;\n identifyError.type = 'NotOn3g';\n throw identifyError;\n } else {\n return result;\n }\n};\n\nexport { identify, identifyUserGetSubscriptionUrl, getRedirectUrl };\n"],"names":[],"mappings":";;AAAM,IAAA,gBAAgB,GAAG,UAAC,CAAS,IAAK,QAAC,CAAC,KAAK,IAAI,GAAG,IAAI,GAAG,CAAC,EAAtB;;AC+BlC,IAAA,QAAQ,GAAG,UAAO,EAgBvB,EAAA;AAfC,IAAA,IAAA,MAAM,YAAA,EACN,IAAI,UAAA,EACJ,OAAO,aAAA,EACP,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,SAAS,GAAA,EAAA,CAAA,SAAA,CAAA;;;;;;AAUH,oBAAA,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,EAAE,CAAC;oBACzC,YAAY,GAAG,kBAAkB,CAAC,MAAM,CAAC,QAAQ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,CAAC,QAAQ,EAAE,CAAG,CAAA,MAAA,CAAA,MAAM,GAAG,WAAI,MAAM,CAAE,GAAG,EAAE,CAAE,CAAC;AACtE,oBAAA,OAAA,CAAA,CAAA,YAAM,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,UAAC,CAAC,EAAK,EAAA,OAAA,CAAC,CAAC,IAAI,EAAE,CAAR,EAAQ,CAAC,CAAA,CAAA;;AAA/C,oBAAA,MAAM,GAAG,EAAsC,CAAA,IAAA,EAAA,CAAA;AAErD,oBAAA,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE;wBACtB,aAAa,GAAG,IAAI,KAAK,CAAC,mDAAA,CAAA,MAAA,CAAoD,MAAM,CAAC,OAAO,CAAE,CAAW,CAAC;AAChH,wBAAA,aAAa,CAAC,IAAI,GAAG,SAAS,CAAC;AAC/B,wBAAA,MAAM,aAAa,CAAC;AACrB,qBAAA;AAAM,yBAAA;AACL,wBAAA,OAAA,CAAA,CAAA,aAAO,MAAM,CAAC,CAAA;AACf,qBAAA;;;;;;;;"}
|
|
@@ -1,2 +1,141 @@
|
|
|
1
|
-
import{__awaiter
|
|
1
|
+
import { __awaiter, __generator, __assign } from 'tslib';
|
|
2
|
+
import { l as loop } from './helpers-BIBpnXln.js';
|
|
3
|
+
import { searchToObject } from './searchToObject.js';
|
|
4
|
+
import { t as tracker } from './tracker-B_zsMRN2.js';
|
|
5
|
+
import { u as updateUrlWithParams } from './updateUrlWithParams-ZaZt1BCf.js';
|
|
6
|
+
import 'pacman-client';
|
|
7
|
+
import 'uuid';
|
|
8
|
+
|
|
9
|
+
var checkSubscriptionByRockmanIdOnly = function (_a) {
|
|
10
|
+
var window = _a.window, rockmanId = _a.rockmanId;
|
|
11
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
12
|
+
var host, params, urlParams, url, response;
|
|
13
|
+
return __generator(this, function (_b) {
|
|
14
|
+
switch (_b.label) {
|
|
15
|
+
case 0:
|
|
16
|
+
host = window.DEV_BASE_URL || '';
|
|
17
|
+
params = {
|
|
18
|
+
action: 'check-subscription',
|
|
19
|
+
rockman_id: rockmanId
|
|
20
|
+
};
|
|
21
|
+
urlParams = new URLSearchParams(params).toString();
|
|
22
|
+
url = "".concat(host, "/tallyman/v1/?").concat(urlParams);
|
|
23
|
+
return [4 /*yield*/, fetch(url)];
|
|
24
|
+
case 1:
|
|
25
|
+
response = _b.sent();
|
|
26
|
+
return [2 /*return*/, response.json()];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
function redirect(rawUrl) {
|
|
33
|
+
var target = fullyDecode(rawUrl).replace(/^\/+/, ''); // drop leading /
|
|
34
|
+
if (!/^https?:\/\//i.test(target)) {
|
|
35
|
+
throw new Error("Decoded string is not an absolute URL: ".concat(target));
|
|
36
|
+
}
|
|
37
|
+
window.location.replace(target); // or: window.location.href = target
|
|
38
|
+
}
|
|
39
|
+
function fullyDecode(s) {
|
|
40
|
+
var prev;
|
|
41
|
+
do {
|
|
42
|
+
prev = s;
|
|
43
|
+
try {
|
|
44
|
+
s = decodeURIComponent(s);
|
|
45
|
+
}
|
|
46
|
+
catch (_a) {
|
|
47
|
+
break;
|
|
48
|
+
} // stop if it’s no longer valid UTF-8
|
|
49
|
+
} while (s !== prev);
|
|
50
|
+
return s;
|
|
51
|
+
}
|
|
52
|
+
function checkSubscriptionHander(_a) {
|
|
53
|
+
var _b, _c, _d, _e;
|
|
54
|
+
var window = _a.window, flow = _a.flow, action = _a.action, args = _a.args, _f = _a.extraParams, extraParams = _f === void 0 ? {} : _f, _g = _a.isRedirectToChainAndProduct, isRedirectToChainAndProduct = _g === void 0 ? false : _g, _h = _a.isShowThankYou, isShowThankYou = _h === void 0 ? false : _h;
|
|
55
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
56
|
+
var rockmanId, search, isMock, mockProductUrl, mockChain, check, checkResult, productUrl_1, thankYou_1, chainLink, updatedChainLink, error;
|
|
57
|
+
return __generator(this, function (_j) {
|
|
58
|
+
switch (_j.label) {
|
|
59
|
+
case 0:
|
|
60
|
+
rockmanId = window.pac_analytics.visitor.rockmanId;
|
|
61
|
+
if (flow && action) {
|
|
62
|
+
tracker.advancedInFlow(flow, action, __assign({}, args));
|
|
63
|
+
}
|
|
64
|
+
search = searchToObject(window);
|
|
65
|
+
isMock = search['current-state'] === 'check-subscription-success-state';
|
|
66
|
+
mockProductUrl = search.product_url || '/product';
|
|
67
|
+
if (isMock) {
|
|
68
|
+
// eslint-disable-next-line no-console
|
|
69
|
+
console.log('isMock is true');
|
|
70
|
+
mockChain = search['show-chain-link'];
|
|
71
|
+
if (mockChain && mockChain === '1') {
|
|
72
|
+
window.pac_analytics.visitor.chainRedirectUrl = '/chain-url';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
check = function () {
|
|
76
|
+
return isMock
|
|
77
|
+
? Promise.resolve({
|
|
78
|
+
success: true,
|
|
79
|
+
rockman_id: rockmanId,
|
|
80
|
+
product_url: mockProductUrl,
|
|
81
|
+
msisdn: '000'
|
|
82
|
+
})
|
|
83
|
+
: checkSubscriptionByRockmanIdOnly({ window: window, rockmanId: rockmanId });
|
|
84
|
+
};
|
|
85
|
+
return [4 /*yield*/, loop(check, 60, function (r) { return r.success; }, 0)];
|
|
86
|
+
case 1:
|
|
87
|
+
checkResult = _j.sent();
|
|
88
|
+
if (checkResult.success === true) {
|
|
89
|
+
productUrl_1 = fullyDecode(checkResult.product_url);
|
|
90
|
+
// if (flow && action) {
|
|
91
|
+
// tracker.advancedInFlow(flow, action, {
|
|
92
|
+
// ...args,
|
|
93
|
+
// url: checkResult.product_url
|
|
94
|
+
// });
|
|
95
|
+
// }
|
|
96
|
+
if (isShowThankYou) {
|
|
97
|
+
thankYou_1 = updateUrlWithParams(window.location.href, {
|
|
98
|
+
rockman_id: rockmanId,
|
|
99
|
+
ui_show_tq: '1',
|
|
100
|
+
'show-thank-you': 1,
|
|
101
|
+
product_url: productUrl_1
|
|
102
|
+
});
|
|
103
|
+
setTimeout(function () {
|
|
104
|
+
tracker.customEvent(flow, 'show-thank-you', 'thank-you-page', { thankYou: thankYou_1 });
|
|
105
|
+
redirect(thankYou_1);
|
|
106
|
+
}, 3000);
|
|
107
|
+
return [2 /*return*/, thankYou_1];
|
|
108
|
+
}
|
|
109
|
+
if ((_c = (_b = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _b === void 0 ? void 0 : _b.visitor) === null || _c === void 0 ? void 0 : _c.chainRedirectUrl) {
|
|
110
|
+
chainLink = (_e = (_d = window === null || window === void 0 ? void 0 : window.pac_analytics) === null || _d === void 0 ? void 0 : _d.visitor) === null || _e === void 0 ? void 0 : _e.chainRedirectUrl;
|
|
111
|
+
updatedChainLink = updateUrlWithParams(chainLink, extraParams);
|
|
112
|
+
if (isRedirectToChainAndProduct) {
|
|
113
|
+
tracker.customEvent(flow, 'redirect', 'chain-redirect', { redirect_url: updatedChainLink });
|
|
114
|
+
window.open(updatedChainLink, '_blank');
|
|
115
|
+
if (productUrl_1 && productUrl_1 !== '') {
|
|
116
|
+
setTimeout(function () {
|
|
117
|
+
tracker.customEvent(flow, 'redirect', 'product-redirect', { redirect_url: productUrl_1 });
|
|
118
|
+
redirect(productUrl_1);
|
|
119
|
+
}, 3000);
|
|
120
|
+
}
|
|
121
|
+
return [2 /*return*/];
|
|
122
|
+
}
|
|
123
|
+
tracker.customEvent(flow, 'redirect', 'chain-redirect', { redirect_url: updatedChainLink });
|
|
124
|
+
redirect(updatedChainLink);
|
|
125
|
+
}
|
|
126
|
+
else if (productUrl_1 && productUrl_1 !== '') {
|
|
127
|
+
tracker.customEvent(flow, 'redirect', 'product-redirect', { redirect_url: productUrl_1 });
|
|
128
|
+
redirect(productUrl_1);
|
|
129
|
+
}
|
|
130
|
+
return [2 /*return*/, productUrl_1 || null];
|
|
131
|
+
}
|
|
132
|
+
error = new Error("".concat('SubscriptionFailed', ":\n").concat(checkResult.message));
|
|
133
|
+
error.type = 'SubscriptionFailed';
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export { checkSubscriptionHander };
|
|
2
141
|
//# sourceMappingURL=checkSubscriptionHander.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkSubscriptionHander.js","sources":["../src/utilities/checkSubscriptionHander.ts","../src/sharedApi/checkSubscriptionByRockmanIdOnly.ts"],"sourcesContent":["import { ICheckSubscriptionResult } from '../common-types/ICheckSubscriptionResult';\nimport { IError } from '../common-types/IError';\nimport { checkSubscriptionByRockmanIdOnly } from '../sharedApi/checkSubscriptionByRockmanIdOnly';\nimport { loop } from './helpers';\nimport { searchToObject } from './searchToObject';\nimport { tracker } from './tracker';\nimport { updateUrlWithParams } from './updateUrlWithParams';\n\nfunction redirect(rawUrl: string) {\n const target = fullyDecode(rawUrl).replace(/^\\/+/, ''); // drop leading /\n if (!/^https?:\\/\\//i.test(target)) {\n throw new Error(`Decoded string is not an absolute URL: ${target}`);\n }\n window.location.replace(target); // or: window.location.href = target\n}\n\nfunction fullyDecode(s: string): string {\n let prev;\n do {\n prev = s;\n try {\n s = decodeURIComponent(s);\n } catch {\n break;\n } // stop if it’s no longer valid UTF-8\n } while (s !== prev);\n return s;\n}\nexport async function checkSubscriptionHander({\n window,\n flow,\n action,\n args,\n extraParams = {},\n isRedirectToChainAndProduct = false,\n isShowThankYou = false\n}: {\n window: Window;\n flow?: string;\n action?: string;\n args?: any;\n extraParams?: any;\n isRedirectToChainAndProduct?: boolean;\n isShowThankYou?: boolean;\n}): Promise<string> {\n const { rockmanId } = window.pac_analytics.visitor;\n if (flow && action) {\n tracker.advancedInFlow(flow, action, {\n ...args\n });\n }\n const search = searchToObject(window);\n const isMock = search['current-state'] === 'check-subscription-success-state';\n const mockProductUrl = search.product_url || '/product';\n if (isMock) {\n // eslint-disable-next-line no-console\n console.log('isMock is true');\n const mockChain = search['show-chain-link'];\n if (mockChain && mockChain === '1') {\n window.pac_analytics.visitor.chainRedirectUrl = '/chain-url';\n }\n }\n const check: () => Promise<ICheckSubscriptionResult> = () =>\n isMock\n ? Promise.resolve({\n success: true,\n rockman_id: rockmanId,\n product_url: mockProductUrl,\n msisdn: '000'\n })\n : checkSubscriptionByRockmanIdOnly({ window, rockmanId });\n const checkResult: ICheckSubscriptionResult = await loop(check, 60, (r) => r.success, 0);\n\n if (checkResult.success === true) {\n const productUrl = fullyDecode(checkResult.product_url);\n // if (flow && action) {\n // tracker.advancedInFlow(flow, action, {\n // ...args,\n // url: checkResult.product_url\n // });\n // }\n if (isShowThankYou) {\n const thankYou = updateUrlWithParams(window.location.href, {\n rockman_id: rockmanId,\n ui_show_tq: '1', // New param\n 'show-thank-you': 1, // backward compatibility\n product_url: productUrl\n });\n setTimeout(() => {\n tracker.customEvent(flow, 'show-thank-you', 'thank-you-page', { thankYou });\n\n redirect(thankYou);\n }, 3000);\n\n return thankYou;\n }\n if (window?.pac_analytics?.visitor?.chainRedirectUrl) {\n const chainLink = window?.pac_analytics?.visitor?.chainRedirectUrl;\n const updatedChainLink = updateUrlWithParams(chainLink, extraParams);\n if (isRedirectToChainAndProduct) {\n tracker.customEvent(flow, 'redirect', 'chain-redirect', { redirect_url: updatedChainLink });\n window.open(\n updatedChainLink,\n '_blank' // <- This is what makes it open in a new window.\n );\n if (productUrl && productUrl !== '') {\n setTimeout(() => {\n tracker.customEvent(flow, 'redirect', 'product-redirect', { redirect_url: productUrl });\n redirect(productUrl);\n }, 3000);\n }\n return;\n }\n\n tracker.customEvent(flow, 'redirect', 'chain-redirect', { redirect_url: updatedChainLink });\n redirect(updatedChainLink);\n } else if (productUrl && productUrl !== '') {\n tracker.customEvent(flow, 'redirect', 'product-redirect', { redirect_url: productUrl });\n redirect(productUrl);\n }\n\n return productUrl || null;\n }\n const error = new Error(`${'SubscriptionFailed'}:\\n${checkResult.message}`) as IError & { type: string };\n error.type = 'SubscriptionFailed';\n throw error;\n}\n","import { ICheckSubscriptionResult } from '../common-types/ICheckSubscriptionResult';\n\nconst checkSubscriptionByRockmanIdOnly = async ({\n window,\n rockmanId\n}: {\n window: Window;\n rockmanId: string;\n}): Promise<ICheckSubscriptionResult> => {\n const host = (window as Window).DEV_BASE_URL || '';\n\n const params = {\n action: 'check-subscription',\n rockman_id: rockmanId\n };\n\n const urlParams = new URLSearchParams(params).toString();\n const url = `${host}/tallyman/v1/?${urlParams}`;\n\n const response = await fetch(url);\n return response.json();\n};\n\nexport { checkSubscriptionByRockmanIdOnly };\n"],"names":["redirect","rawUrl","target","fullyDecode","replace","test","Error","window","location","s","prev","decodeURIComponent","_a","checkSubscriptionHander","flow","action","args","_f","extraParams","_g","isRedirectToChainAndProduct","_h","isShowThankYou","rockmanId","pac_analytics","visitor","tracker","advancedInFlow","__assign","search","searchToObject","isMock","mockProductUrl","product_url","console","log","mockChain","chainRedirectUrl","check","Promise","resolve","success","rockman_id","msisdn","host","DEV_BASE_URL","urlParams","URLSearchParams","toString","url","concat","fetch","_b","sent","json","checkSubscriptionByRockmanIdOnly","loop","r","checkResult","_j","productUrl_1","thankYou_1","updateUrlWithParams","href","ui_show_tq","setTimeout","customEvent","thankYou","_c","chainLink","_e","_d","updatedChainLink","redirect_url","open","error","message","type"],"mappings":"mSAQA,SAASA,EAASC,GAChB,IAAMC,EAASC,EAAYF,GAAQG,QAAQ,OAAQ,IACnD,IAAK,gBAAgBC,KAAKH,GACxB,MAAM,IAAII,MAAM,iDAA0CJ,IAE5DK,OAAOC,SAASJ,QAAQF,EAC1B,CAEA,SAASC,EAAYM,GACnB,IAAIC,EACJ,EAAG,CACDA,EAAOD,EACP,IACEA,EAAIE,mBAAmBF,EACxB,CAAC,MAAMG,GACN,KACD,QACMH,IAAMC,GACf,OAAOD,CACT,CACM,SAAgBI,EAAwBD,eAC5CL,EAAMK,EAAAL,OACNO,EAAIF,EAAAE,KACJC,EAAMH,EAAAG,OACNC,EAAIJ,EAAAI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pD,EAAM,iBAAkB,iBAAkB,CAAEqD,SAAQN,IAExE7D,EAAS6D,EACV,GAAE,KAEH,CAAA,EAAOA,GAET,GAAkC,QAA9BO,EAAqB,QAArBhB,EAAA7C,aAAM,EAANA,EAAQiB,qBAAa,IAAA4B,OAAA,EAAAA,EAAE3B,eAAO,IAAA2C,OAAA,EAAAA,EAAE/B,iBAAkB,CAGpD,GAFMgC,EAA0C,QAA9BC,EAAqB,QAArBC,EAAAhE,aAAM,EAANA,EAAQiB,qBAAa,IAAA+C,OAAA,EAAAA,EAAE9C,eAAO,IAAA6C,OAAA,EAAAA,EAAEjC,iBAC5CmC,EAAmBV,EAAoBO,EAAWnD,GACpDE,EAYF,OAXAM,EAAQwC,YAAYpD,EAAM,WAAY,iBAAkB,CAAE2D,aAAcD,IACxEjE,EAAOmE,KACLF,EACA,UAEEZ,GAA6B,KAAfA,GAChBK,YAAW,WACTvC,EAAQwC,YAAYpD,EAAM,WAAY,mBAAoB,CAAE2D,aAAcb,IAC1E5D,EAAS4D,EACV,GAAE,KAEE,CAAA,GAGTlC,EAAQwC,YAAYpD,EAAM,WAAY,iBAAkB,CAAE2D,aAAcD,IACxExE,EAASwE,EACV,MAAUZ,GAA6B,KAAfA,IACvBlC,EAAQwC,YAAYpD,EAAM,WAAY,mBAAoB,CAAE2D,aAAcb,IAC1E5D,EAAS4D,IAGX,MAAO,CAAA,EAAAA,GAAc,KACtB,CAGD,MAFMe,EAAQ,IAAIrE,MAAM,GAAG4C,OAAA,qBAA0B,OAAAA,OAAAQ,EAAYkB,WAC3DC,KAAO,qBACPF,QACP"}
|
|
1
|
+
{"version":3,"file":"checkSubscriptionHander.js","sources":["../../src/sharedApi/checkSubscriptionByRockmanIdOnly.ts","../../src/utilities/checkSubscriptionHander.ts"],"sourcesContent":["import { ICheckSubscriptionResult } from '../common-types/ICheckSubscriptionResult';\n\nconst checkSubscriptionByRockmanIdOnly = async ({\n window,\n rockmanId\n}: {\n window: Window;\n rockmanId: string;\n}): Promise<ICheckSubscriptionResult> => {\n const host = (window as Window).DEV_BASE_URL || '';\n\n const params = {\n action: 'check-subscription',\n rockman_id: rockmanId\n };\n\n const urlParams = new URLSearchParams(params).toString();\n const url = `${host}/tallyman/v1/?${urlParams}`;\n\n const response = await fetch(url);\n return response.json();\n};\n\nexport { checkSubscriptionByRockmanIdOnly };\n","import { ICheckSubscriptionResult } from '../common-types/ICheckSubscriptionResult';\nimport { IError } from '../common-types/IError';\nimport { checkSubscriptionByRockmanIdOnly } from '../sharedApi/checkSubscriptionByRockmanIdOnly';\nimport { loop } from './helpers';\nimport { searchToObject } from './searchToObject';\nimport { tracker } from './tracker';\nimport { updateUrlWithParams } from './updateUrlWithParams';\n\nfunction redirect(rawUrl: string) {\n const target = fullyDecode(rawUrl).replace(/^\\/+/, ''); // drop leading /\n if (!/^https?:\\/\\//i.test(target)) {\n throw new Error(`Decoded string is not an absolute URL: ${target}`);\n }\n window.location.replace(target); // or: window.location.href = target\n}\n\nfunction fullyDecode(s: string): string {\n let prev;\n do {\n prev = s;\n try {\n s = decodeURIComponent(s);\n } catch {\n break;\n } // stop if it’s no longer valid UTF-8\n } while (s !== prev);\n return s;\n}\nexport async function checkSubscriptionHander({\n window,\n flow,\n action,\n args,\n extraParams = {},\n isRedirectToChainAndProduct = false,\n isShowThankYou = false\n}: {\n window: Window;\n flow?: string;\n action?: string;\n args?: any;\n extraParams?: any;\n isRedirectToChainAndProduct?: boolean;\n isShowThankYou?: boolean;\n}): Promise<string> {\n const { rockmanId } = window.pac_analytics.visitor;\n if (flow && action) {\n tracker.advancedInFlow(flow, action, {\n ...args\n });\n }\n const search = searchToObject(window);\n const isMock = search['current-state'] === 'check-subscription-success-state';\n const mockProductUrl = search.product_url || '/product';\n if (isMock) {\n // eslint-disable-next-line no-console\n console.log('isMock is true');\n const mockChain = search['show-chain-link'];\n if (mockChain && mockChain === '1') {\n window.pac_analytics.visitor.chainRedirectUrl = '/chain-url';\n }\n }\n const check: () => Promise<ICheckSubscriptionResult> = () =>\n isMock\n ? Promise.resolve({\n success: true,\n rockman_id: rockmanId,\n product_url: mockProductUrl,\n msisdn: '000'\n })\n : checkSubscriptionByRockmanIdOnly({ window, rockmanId });\n const checkResult: ICheckSubscriptionResult = await loop(check, 60, (r) => r.success, 0);\n\n if (checkResult.success === true) {\n const productUrl = fullyDecode(checkResult.product_url);\n // if (flow && action) {\n // tracker.advancedInFlow(flow, action, {\n // ...args,\n // url: checkResult.product_url\n // });\n // }\n if (isShowThankYou) {\n const thankYou = updateUrlWithParams(window.location.href, {\n rockman_id: rockmanId,\n ui_show_tq: '1', // New param\n 'show-thank-you': 1, // backward compatibility\n product_url: productUrl\n });\n setTimeout(() => {\n tracker.customEvent(flow, 'show-thank-you', 'thank-you-page', { thankYou });\n\n redirect(thankYou);\n }, 3000);\n\n return thankYou;\n }\n if (window?.pac_analytics?.visitor?.chainRedirectUrl) {\n const chainLink = window?.pac_analytics?.visitor?.chainRedirectUrl;\n const updatedChainLink = updateUrlWithParams(chainLink, extraParams);\n if (isRedirectToChainAndProduct) {\n tracker.customEvent(flow, 'redirect', 'chain-redirect', { redirect_url: updatedChainLink });\n window.open(updatedChainLink, '_blank');\n if (productUrl && productUrl !== '') {\n setTimeout(() => {\n tracker.customEvent(flow, 'redirect', 'product-redirect', { redirect_url: productUrl });\n redirect(productUrl);\n }, 3000);\n }\n return;\n }\n\n tracker.customEvent(flow, 'redirect', 'chain-redirect', { redirect_url: updatedChainLink });\n redirect(updatedChainLink);\n } else if (productUrl && productUrl !== '') {\n tracker.customEvent(flow, 'redirect', 'product-redirect', { redirect_url: productUrl });\n redirect(productUrl);\n }\n\n return productUrl || null;\n }\n const error = new Error(`${'SubscriptionFailed'}:\\n${checkResult.message}`) as IError & { type: string };\n error.type = 'SubscriptionFailed';\n throw error;\n}\n"],"names":[],"mappings":";;;;;;;;AAEA,IAAM,gCAAgC,GAAG,UAAO,EAM/C,EAAA;QALC,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,SAA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C,CAAC;qCACtB,EAAE,IAAI,CAAC,CAAC;AACV,iCAAA;gCACD,OAAO,CAAA,CAAA,YAAA,CAAA;AACR,6BAAA;AAED,4BAAA,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC,CAAC;4BAC5F,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAC5B,yBAAA;AAAM,6BAAA,IAAI,YAAU,IAAI,YAAU,KAAK,EAAE,EAAE;AAC1C,4BAAA,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,kBAAkB,EAAE,EAAE,YAAY,EAAE,YAAU,EAAE,CAAC,CAAC;4BACxF,QAAQ,CAAC,YAAU,CAAC,CAAC;AACtB,yBAAA;wBAED,OAAO,CAAA,CAAA,aAAA,YAAU,IAAI,IAAI,CAAC,CAAA;AAC3B,qBAAA;AACK,oBAAA,KAAK,GAAG,IAAI,KAAK,CAAC,EAAG,CAAA,MAAA,CAAA,oBAAoB,EAAM,KAAA,CAAA,CAAA,MAAA,CAAA,WAAW,CAAC,OAAO,CAAE,CAA8B,CAAC;AACzG,oBAAA,KAAK,CAAC,IAAI,GAAG,oBAAoB,CAAC;AAClC,oBAAA,MAAM,KAAK,CAAC;;;;AACb;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var cleanSearchParams = function (search) {
|
|
2
|
+
// Extract msisdn & operator from search parameters if present to avoid conflicting params
|
|
3
|
+
var urlSearchParams = new URLSearchParams(search);
|
|
4
|
+
var searchMsisdn = urlSearchParams === null || urlSearchParams === void 0 ? void 0 : urlSearchParams.get('msisdn');
|
|
5
|
+
var operator = urlSearchParams === null || urlSearchParams === void 0 ? void 0 : urlSearchParams.get('operator');
|
|
6
|
+
if (searchMsisdn) {
|
|
7
|
+
urlSearchParams.delete('msisdn');
|
|
8
|
+
}
|
|
9
|
+
if (operator) {
|
|
10
|
+
urlSearchParams.delete('operator');
|
|
11
|
+
}
|
|
12
|
+
return (urlSearchParams === null || urlSearchParams === void 0 ? void 0 : urlSearchParams.toString()) || undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { cleanSearchParams as c };
|
|
16
|
+
//# sourceMappingURL=cleanSearchParams-B2jK3H1j.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanSearchParams-B2jK3H1j.js","sources":["../../src/utilities/cleanSearchParams.ts"],"sourcesContent":["export const cleanSearchParams = (search: string): string | undefined => {\n // Extract msisdn & operator from search parameters if present to avoid conflicting params\n const urlSearchParams = new URLSearchParams(search);\n const searchMsisdn = urlSearchParams?.get('msisdn');\n const operator = urlSearchParams?.get('operator');\n\n if (searchMsisdn) {\n urlSearchParams.delete('msisdn');\n }\n if (operator) {\n urlSearchParams.delete('operator');\n }\n\n return urlSearchParams?.toString() || undefined;\n};\n"],"names":[],"mappings":"AAAO,IAAM,iBAAiB,GAAG,UAAC,MAAc,EAAA;;AAE9C,IAAA,IAAM,eAAe,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;AACpD,IAAA,IAAM,YAAY,GAAG,eAAe,KAAA,IAAA,IAAf,eAAe,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAf,eAAe,CAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;AACpD,IAAA,IAAM,QAAQ,GAAG,eAAe,KAAA,IAAA,IAAf,eAAe,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAf,eAAe,CAAE,GAAG,CAAC,UAAU,CAAC,CAAC;AAElD,IAAA,IAAI,YAAY,EAAE;AAChB,QAAA,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAClC,KAAA;AACD,IAAA,IAAI,QAAQ,EAAE;AACZ,QAAA,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AACpC,KAAA;IAED,OAAO,CAAA,eAAe,KAAA,IAAA,IAAf,eAAe,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAf,eAAe,CAAE,QAAQ,EAAE,KAAI,SAAS,CAAC;AAClD;;;;"}
|