ouisys-engine 5.1.21 → 5.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkSubscriptionHander.js +5 -2
- package/dist/checkSubscriptionHander.js.map +1 -1
- package/dist/handleResolveRedirect-5Hkm5YXF.js +50 -0
- package/dist/handleResolveRedirect-5Hkm5YXF.js.map +1 -0
- package/dist/moFlow.js +2 -2
- package/dist/moFlow.js.map +1 -1
- package/dist/oneClickFlow.js +11 -7
- package/dist/oneClickFlow.js.map +1 -1
- package/dist/pinFlow.js +2 -2
- package/dist/pinFlow.js.map +1 -1
- package/dist/src/common-types/Strategy.d.ts +1 -1
- package/dist/src/common-types/Strategy.d.ts.map +1 -1
- package/dist/src/flows/oneClickFlow/oneClickFlowSlice.d.ts.map +1 -1
- package/dist/src/utilities/addEmpelloToken.d.ts.map +1 -1
- package/dist/src/utilities/checkSubscriptionHander.d.ts.map +1 -1
- package/dist/src/utilities/handleResolveRedirect.d.ts +2 -0
- package/dist/src/utilities/handleResolveRedirect.d.ts.map +1 -0
- package/dist/types/{Strategy-N2e6pvR0.d.ts → Strategy-Bk7EyVl_.d.ts} +1 -1
- package/dist/types/{StrategyTypes-LKeXDiPK.d.ts → StrategyTypes-C_EkC4O3.d.ts} +1 -1
- package/dist/types/click2smsFlow.d.ts +2 -2
- package/dist/types/getConfig.d.ts +1 -1
- package/dist/types/oneClickFlow.d.ts +3 -3
- package/dist/types/searchToObject.d.ts +2 -2
- package/dist/types/strategy.d.ts +3 -3
- package/dist/ussdFlow.js +1 -0
- package/dist/ussdFlow.js.map +1 -1
- package/package.json +1 -1
- package/dist/handleWaterfallRedirect-h5K2zX3N.js +0 -21
- package/dist/handleWaterfallRedirect-h5K2zX3N.js.map +0 -1
- package/dist/src/utilities/handleWaterfallRedirect.d.ts +0 -2
- package/dist/src/utilities/handleWaterfallRedirect.d.ts.map +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { __awaiter, __generator, __assign } from 'tslib';
|
|
2
|
+
import { h as handleResolveRedirect } from './handleResolveRedirect-5Hkm5YXF.js';
|
|
2
3
|
import { l as loop } from './helpers-BIBpnXln.js';
|
|
3
4
|
import { searchToObject } from './searchToObject.js';
|
|
4
5
|
import { t as tracker } from './tracker-B_zsMRN2.js';
|
|
@@ -111,7 +112,8 @@ function checkSubscriptionHander(_a) {
|
|
|
111
112
|
updatedChainLink = updateUrlWithParams(chainLink, extraParams);
|
|
112
113
|
if (isRedirectToChainAndProduct) {
|
|
113
114
|
tracker.customEvent(flow, 'redirect', 'chain-redirect', { redirect_url: updatedChainLink });
|
|
114
|
-
|
|
115
|
+
handleResolveRedirect(updatedChainLink);
|
|
116
|
+
// window.open(updatedChainLink, '_blank');
|
|
115
117
|
if (productUrl_1 && productUrl_1 !== '') {
|
|
116
118
|
setTimeout(function () {
|
|
117
119
|
tracker.customEvent(flow, 'redirect', 'product-redirect', { redirect_url: productUrl_1 });
|
|
@@ -121,7 +123,8 @@ function checkSubscriptionHander(_a) {
|
|
|
121
123
|
return [2 /*return*/];
|
|
122
124
|
}
|
|
123
125
|
tracker.customEvent(flow, 'redirect', 'chain-redirect', { redirect_url: updatedChainLink });
|
|
124
|
-
redirect(updatedChainLink);
|
|
126
|
+
// redirect(updatedChainLink);
|
|
127
|
+
handleResolveRedirect(updatedChainLink);
|
|
125
128
|
}
|
|
126
129
|
else if (productUrl_1 && productUrl_1 !== '') {
|
|
127
130
|
tracker.customEvent(flow, 'redirect', 'product-redirect', { redirect_url: productUrl_1 });
|
|
@@ -1 +1 @@
|
|
|
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,SAAS,GA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AC;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;;;;"}
|
|
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 { handleResolveRedirect } from './handleResolveRedirect';\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 handleResolveRedirect(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 handleResolveRedirect(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,SAAS,GAAA,EAAA,CAAA,SAAA,CAAA;;;;;;AAKH,oBAAA,IAAI,GAAI,MAAiB,CAAC,YAAY,IAA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AO,CAAC,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC,CAAC;;4BAE5F,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;AACzC,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,50 @@
|
|
|
1
|
+
var isUrl = function (value) {
|
|
2
|
+
try {
|
|
3
|
+
// eslint-disable-next-line no-new
|
|
4
|
+
new URL(value);
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
catch (_a) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
function isSlashFirst(str) {
|
|
12
|
+
return str.startsWith('/');
|
|
13
|
+
}
|
|
14
|
+
function fullyDecode(s) {
|
|
15
|
+
var prev;
|
|
16
|
+
do {
|
|
17
|
+
prev = s;
|
|
18
|
+
try {
|
|
19
|
+
s = decodeURIComponent(s);
|
|
20
|
+
}
|
|
21
|
+
catch (_a) {
|
|
22
|
+
break;
|
|
23
|
+
} // stop if it’s no longer valid UTF-8
|
|
24
|
+
} while (s !== prev);
|
|
25
|
+
return s;
|
|
26
|
+
}
|
|
27
|
+
var handleResolveRedirect = function (url) {
|
|
28
|
+
try {
|
|
29
|
+
if (isSlashFirst(url)) {
|
|
30
|
+
var target = fullyDecode(url);
|
|
31
|
+
if (!/^https?:\/\//i.test(target)) {
|
|
32
|
+
throw new Error("Decoded string is not an absolute URL: ".concat(target));
|
|
33
|
+
}
|
|
34
|
+
window.location.href = target;
|
|
35
|
+
}
|
|
36
|
+
else if (isUrl(url)) {
|
|
37
|
+
window.location.href = url;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
window.location.href = "/api/v1/resolve-wfl?token=".concat(url);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
console.error(e);
|
|
45
|
+
window.location.href = "/api/v1/resolve-wfl?token=".concat(url);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export { handleResolveRedirect as h };
|
|
50
|
+
//# sourceMappingURL=handleResolveRedirect-5Hkm5YXF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleResolveRedirect-5Hkm5YXF.js","sources":["../../src/utilities/handleResolveRedirect.ts"],"sourcesContent":["const isUrl = (value: string): boolean => {\n try {\n // eslint-disable-next-line no-new\n new URL(value);\n return true;\n } catch {\n return false;\n }\n};\n\nfunction isSlashFirst(str: string): boolean {\n return str.startsWith('/');\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}\n\nexport const handleResolveRedirect = (url: string) => {\n try {\n if (isSlashFirst(url)) {\n const target = fullyDecode(url);\n if (!/^https?:\\/\\//i.test(target)) {\n throw new Error(`Decoded string is not an absolute URL: ${target}`);\n }\n window.location.href = target;\n } else if (isUrl(url)) {\n window.location.href = url;\n } else {\n window.location.href = `/api/v1/resolve-wfl?token=${url}`;\n }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A;AAAM,aAAA;YACL,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,4BAA6B,CAAA,MAAA,CAAA,GAAG,CAAE,CAAC;AAC3D,SAAA;AACF,KAAA;AAAC,IAAA,OAAO,CAAC,EAAE;AACV,QAAA,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACjB,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,4BAA6B,CAAA,MAAA,CAAA,GAAG,CAAE,CAAC;AAC3D,KAAA;AACH;;;;"}
|
package/dist/moFlow.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __awaiter, __generator, __read, __assign } from 'tslib';
|
|
2
2
|
import { createAsyncThunk, createSlice } from '@reduxjs/toolkit';
|
|
3
3
|
import { S as Success, L as Loading, F as Failure, N as NothingYet } from './RemoteDataState-CwHLI23e.js';
|
|
4
|
-
import { h as
|
|
4
|
+
import { h as handleResolveRedirect } from './handleResolveRedirect-5Hkm5YXF.js';
|
|
5
5
|
import { n as normaliseErrorCode, r as redirectErrorTypes, g as getErrorCode } from './normaliseErrorCode-CseFd8jz.js';
|
|
6
6
|
import { searchToObject } from './searchToObject.js';
|
|
7
7
|
import { s as storeMsisdn } from './storeMsisdn-ChiBh8mI.js';
|
|
@@ -268,7 +268,7 @@ var submitMSISDNAction = createAsyncThunk('moFlow/submitMSISDNAction', function
|
|
|
268
268
|
errorType: errorType,
|
|
269
269
|
errorCode: getErrorCode(errorType)
|
|
270
270
|
});
|
|
271
|
-
|
|
271
|
+
handleResolveRedirect((_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);
|
|
272
272
|
}
|
|
273
273
|
return [2 /*return*/, rejectWithValue({
|
|
274
274
|
errorType: errorType,
|
package/dist/moFlow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"moFlow.js","sources":["../../src/flows/moFlow/hooks/useMoFlowState.ts","../../src/flows/moFlow/match.ts","../../src/flows/moFlow/api.ts","../../src/flows/moFlow/main.ts","../../src/flows/moFlow/moFlowSlice.ts"],"sourcesContent":["import { useSelector as IuseSelector } from 'react-redux';\nimport { RootState } from '../../../sharedFlowTypes/StrategyTypes';\n\nexport const useMoFlowState = (useSelector: typeof IuseSelector) => {\n const currentState = useSelector((state: RootState) => state.moFlow.currentState);\n return currentState;\n};\n","import * as RDS from '../../common-types/RemoteDataState';\nimport { MoFlowCurrentState, MSISDNEntryFailure, MSISDNEntrySuccess } from '../../sharedFlowTypes/MoTypes';\n\nfunction moFlowMatch<R>({\n msisdnEntry\n}: {\n msisdnEntry: (rds: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>) => R;\n}): (state: MoFlowCurrentState) => R {\n return (state) => {\n switch (state.type) {\n case 'MSISDNEntry':\n return msisdnEntry(state.result);\n default:\n // TODO - this should be an error or something\n return msisdnEntry(state.result);\n }\n };\n}\n\nexport { moFlowMatch };\n","import { IGoogleReCaptcha, IMSISDNSubmissionResult } from '../../sharedFlowTypes/MoTypes';\nimport { cleanSearchParams } from '../../utilities/cleanSearchParams';\n\nconst getGoogleCaptcha = async (\n window: Window,\n country: string,\n slug: string,\n device: string,\n domain: string\n): Promise<IGoogleReCaptcha> => {\n const host = (window as Window).DEV_BASE_URL || '';\n\n return fetch(\n `${host}/tallyman/helper/?action=google-captcha-v3-config&country=${country}&slug=${slug}&device=${device}&domain=${domain}`\n ).then((x) => x.json());\n};\n\nconst triggerMessage = async ({\n window,\n slug,\n country,\n msisdn,\n device,\n offer,\n rockmanId,\n extraParamsQs,\n search\n}: {\n window: Window;\n slug: string;\n country: string;\n msisdn: string;\n device: string;\n offer: string;\n rockmanId: string;\n search: string;\n extraParamsQs: string;\n}): Promise<IMSISDNSubmissionResult> => {\n // introduced https://www.notion.so/sammedia/CH-Agency-Bodkinco-Integration-ea1600ad175f451a9d351b6763ad7992\n const partnerAjaxResopnse: {\n form_action: string;\n } = window.api_ajax_url ? await fetch(window.api_ajax_url).then((x) => x.json()) : null;\n\n // Remove conflicting params from url\n search = cleanSearchParams(search);\n const params = {\n action: 'trigger-message',\n slug,\n country,\n msisdn,\n device,\n offerId: offer,\n rockman_id: rockmanId,\n page: encodeURIComponent(window?.location?.href),\n sam_g_token: window.reCaptchaToken || '',\n language_code: window.languageCode || '',\n partner_form_action: partnerAjaxResopnse?.form_action ? encodeURIComponent(partnerAjaxResopnse?.form_action) : '',\n\n antifraud_id: window.antifraud_id || '',\n // More specific antifraud IDs will eventuallly replace antifraud_id\n // https://www.notion.so/sammedia/KW-Agency-Globocom-KW-ENTERTAINMENT-STORE-GAMESOLUTELY-GLING-Landing-Page-Test-a9841b14218b42709ffb1a2d41428275?d=f2a8d09b1e8c4fd4bdab69ab5dda1f25\n antifraud_id_js_code: window.antifraud_id_js_code || '',\n antifraud_id_js_link: window.antifraud_id_js_link || ''\n };\n\n const queryString = Object.entries(params)\n .filter(([_, value]) => value)\n .map(([key, value]) => `${key}=${value}`)\n .join('&');\n\n const host = (window as Window).DEV_BASE_URL || '';\n const url = `${host}/tallyman/v1/?${queryString}${search ? `&${search}` : ''}&${extraParamsQs}`;\n\n if (window.MOCK_TRIGGER_MESSAGE_RESPONSE) {\n return window.MOCK_TRIGGER_MESSAGE_RESPONSE;\n }\n return fetch(url).then((x) => x.json());\n};\n\nexport { getGoogleCaptcha, triggerMessage };\n","import { ICheckSubscriptionResult } from '../../common-types/ICheckSubscriptionResult';\nimport { IError } from '../../common-types/IError';\nimport { IConfig } from '../../common-types/Strategy';\nimport { checkSubscriptionByRockmanIdOnly } from '../../sharedApi/checkSubscriptionByRockmanIdOnly';\nimport { IGoogleReCaptcha, IKeywordShortcode, IMSISDNSubmissionResult } from '../../sharedFlowTypes/MoTypes';\nimport { loop } from '../../utilities/helpers';\nimport loadScriptSrc from '../../utilities/loadScriptSrc';\nimport { normaliseErrorCode } from '../../utilities/normaliseErrorCode';\nimport { getGoogleCaptcha, triggerMessage } from './api';\n\nexport default async function submitMSISDN(\n window: Window,\n maybeConfig: IConfig,\n internationalMSISDN: string,\n extraParams?: { [key: string]: string }\n): Promise<IKeywordShortcode> {\n const config: any = { ...(maybeConfig || {}), offer: window.pac_analytics?.visitor?.offer };\n return submitMSISDNWithConfig(window, config, internationalMSISDN, extraParams);\n}\n\nexport const getGoogleReCaptchaConfig = async ({\n window,\n slug,\n country,\n device\n}: IConfig & { window: Window }): Promise<IGoogleReCaptcha> => {\n const domain = window.location.hostname;\n const result: IGoogleReCaptcha = await getGoogleCaptcha(window, country, slug, device, domain);\n if (result.success === true) {\n const srcUrl = `https://www.google.com/recaptcha/api.js?render=${result.site_key}`;\n loadScriptSrc({ url: srcUrl, key: result.site_key, isRecaptcha: true });\n }\n return result;\n};\n\nexport async function submitMSISDNWithConfig(\n window: Window,\n config: IConfig,\n internationalMSISDN: string,\n extraParams?: { [key: string]: string }\n): Promise<IKeywordShortcode> {\n const { slug, country, device, offer } = config;\n const search = window.location.search.substr(1) || '';\n const extraParamsQs = !extraParams\n ? ''\n : `&${Object.keys(extraParams)\n .map((k) => `${k}=${extraParams[k]}`)\n .join('&')}`;\n const msisdn = internationalMSISDN.match(/\\d+/gi)?.join('') || '';\n const { rockmanId } = window.pac_analytics.visitor;\n\n const result: IMSISDNSubmissionResult = await triggerMessage({\n window,\n slug,\n country,\n msisdn,\n device,\n offer,\n rockmanId,\n search,\n extraParamsQs\n });\n\n if (result.success === false) {\n // pick a default based on message, then override with error_code if available\n const defaultType = result.message === 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMsisdn';\n\n const type = result.error_code ? normaliseErrorCode(result.error_code) : defaultType;\n\n // build, augment, log and throw\n const error = new Error(`${type}:\\n${result.message}`) as IError & {\n type: string;\n productUrl: string;\n };\n\n Object.assign(error, {\n type,\n productUrl: result.product_url ?? ''\n });\n\n throw error;\n } else {\n return { ...result, keyword: result.displayKeyword }; // based on discussion with Chanaka to avoid confusion in set up on bupper. Click2sms and mo will use display keyword\n }\n}\n\nexport async function moCheckSubscription(window: Window): Promise<string> {\n const { rockmanId } = window.pac_analytics.visitor;\n const check: () => Promise<ICheckSubscriptionResult> = () => checkSubscriptionByRockmanIdOnly({ window, rockmanId });\n\n const checkResult: ICheckSubscriptionResult = await loop(check, 60, (r) => r.success, 0);\n\n if (checkResult.success === true && checkResult.product_url && checkResult.product_url !== '') {\n window.location.href = decodeURIComponent(checkResult.product_url);\n return checkResult.product_url;\n }\n const error = new Error(`${'SubscriptionFailed'}:\\n${checkResult.message}`) as IError & { type: string };\n error.type = 'SubscriptionFailed';\n throw error;\n}\n\n// export const formatSMSLink = (keywordAndShortcode: IKeywordShortcode) =>\n// !!window.pac_analytics.visitor['x-requested-with'] &&\n// window.pac_analytics.visitor['x-requested-with'] !== null &&\n// window.pac_analytics.visitor['x-requested-with'].indexOf('com.facebook') !== -1\n// ? `sms://${keywordAndShortcode.shortcode}?body=${keywordAndShortcode.keyword}`\n// : typeof navigator !== 'undefined' && (/iPhone/i.test(navigator.userAgent) || /Mac OS/i.test(navigator.userAgent))\n// ? `sms:${keywordAndShortcode.shortcode}&body=${keywordAndShortcode.keyword}`\n// : `sms:${keywordAndShortcode.shortcode}?body=${keywordAndShortcode.keyword}`;\n","import { createAsyncThunk, createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport { IHash } from '../../common-types/IHash';\nimport * as RDS from '../../common-types/RemoteDataState';\nimport {\n MSISDNEntryErrorTypes,\n MSISDNEntryFailure,\n MSISDNEntryState,\n MSISDNEntrySuccess\n} from '../../sharedFlowTypes/MoTypes';\nimport { IMockFlowParams, RootState } from '../../sharedFlowTypes/StrategyTypes';\nimport { handleWaterfallRedirect } from '../../utilities/handleWaterfallRedirect';\nimport { getErrorCode, redirectErrorTypes } from '../../utilities/normaliseErrorCode';\nimport { searchToObject } from '../../utilities/searchToObject';\nimport { storeMsisdn } from '../../utilities/storeMsisdn';\nimport { tracker } from '../../utilities/tracker';\nimport { identifyStrategy } from '../strategy';\nimport submitMSISDN from './main';\n\nexport const mockedMSISDNEntrySuccess: MoFlowState = {\n currentState: {\n type: 'MSISDNEntry',\n result: RDS.Success<MSISDNEntryFailure, MSISDNEntrySuccess>({\n keyword: 'TEST OK',\n shortcode: '777'\n })\n }\n};\n\nexport const mockedMSISDNEntryFailure: MoFlowState = {\n currentState: {\n type: 'MSISDNEntry',\n result: RDS.Failure<MSISDNEntryFailure, MSISDNEntrySuccess>({\n errorType: 'InvalidMSISDN',\n error: 'Invalid Mobile Number'\n })\n }\n};\nexport interface MoFlowState {\n currentState: {\n type: 'MSISDNEntry';\n result: RDS.RemoteDataState<any, any>; // Replace any with your specific error and data types\n };\n}\n\nconst defaultInitialState: MoFlowState = {\n currentState: {\n type: 'MSISDNEntry',\n result: RDS.NothingYet()\n }\n};\n\nconst setInitialState = (window: Window) => {\n const search = searchToObject(window) as IMockFlowParams<any>;\n if (search['mock-flow']) {\n switch (search['current-state']) {\n case 'msisdn-entry-failure-state':\n return mockedMSISDNEntryFailure;\n case 'msisdn-entry-success-state':\n return mockedMSISDNEntrySuccess;\n case 'check-subscription-success-state':\n return mockedMSISDNEntrySuccess;\n default:\n console.error('Mock Flow not supported');\n return defaultInitialState;\n }\n } else {\n return defaultInitialState;\n }\n};\n\nconst initialState = setInitialState(window);\n\ninterface SubmitMSISDNArgs {\n window: Window;\n msisdn: string;\n extraParams?: IHash;\n}\n/**\n * submitMSISDNAction\n * @returns {type: ' 'pinFlow/submitMSISDNAction', payload: {type: PossibleTypes, result: MSISDNEntryState}}\n \n * Calls trigger-message api that returns a short code and key word\n * Sets completed stated\n */\nexport const submitMSISDNAction = createAsyncThunk<\n MSISDNEntryState,\n SubmitMSISDNArgs,\n {\n rejectValue: MSISDNEntryFailure;\n }\n>('moFlow/submitMSISDNAction', async ({ window, msisdn, extraParams }, { getState, rejectWithValue }) => {\n const state: RootState = getState();\n if (!state?.strategy?.currentState?.data?.config) {\n return rejectWithValue({\n errorType: 'UnexpectedState'\n });\n }\n const { config } = state.strategy.currentState.data;\n\n try {\n // Start Trigger Message\n tracker.advancedInFlow('tallyman.v1-mo', 'msisdn-submitted', { msisdn });\n const keywordAndShortcode = await submitMSISDN(window, config, msisdn, extraParams);\n tracker.advancedInFlow('tallyman.v1-mo', 'msisdn-submission-success', { msisdn });\n // End Trigger Message\n\n // Start Store Msisdn\n // if storeMsisdn is true, encrypt msisdn and save it in cookie, localStorage, and zürch\n if (extraParams && extraParams.storeMsisdn && extraParams.storeMsisdn === 'true') {\n await storeMsisdn(msisdn)\n .then((data: any) => {\n if (data && data.data && data.data.success) {\n tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-success');\n } else {\n tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-failed');\n }\n })\n .catch((error) => {\n tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-error', error);\n });\n }\n // End Store Msisdn\n\n return {\n type: 'MSISDNEntry',\n result: RDS.Success<MSISDNEntryFailure, MSISDNEntrySuccess>({ ...keywordAndShortcode })\n };\n } catch (ex) {\n console.warn(ex);\n\n const errorType = ex.type as MSISDNEntryErrorTypes;\n\n tracker.recedeInFlow('tallyman.v1-mo', 'msisdn-submission-failure', {\n msisdn,\n errorType\n });\n\n if (redirectErrorTypes.includes(errorType) && window?.pac_analytics?.visitor?.waterfallRedirectUrl) {\n tracker.customEvent('Flow', 'redirect', 'waterfall-redirect', {\n redirect_url: window?.pac_analytics?.visitor?.waterfallRedirectUrl,\n errorType,\n errorCode: getErrorCode(errorType)\n });\n handleWaterfallRedirect(window?.pac_analytics?.visitor?.waterfallRedirectUrl);\n }\n return rejectWithValue({\n errorType,\n productUrl: ex.productUrl\n });\n }\n});\n\nexport const backToStartAction = createAsyncThunk<\n any,\n any,\n {\n rejectValue: any; // Type for rejectWithValue\n }\n>('moFlow/backToStartAction', async (_, { dispatch, rejectWithValue }) => {\n try {\n tracker.recedeInFlow('tallyman.v1-mo', 'mo-state', 'requested to change phone number');\n dispatch(identifyStrategy());\n } catch (ex) {\n console.warn(ex);\n return rejectWithValue({\n errorType: 'UnexpectedState'\n });\n }\n});\n\nconst moFlowSlice = createSlice({\n name: 'moFlow',\n initialState,\n reducers: {},\n extraReducers: (builder) => {\n builder\n .addCase(submitMSISDNAction.pending, (state) => {\n state.currentState = { type: 'MSISDNEntry', result: RDS.Loading() };\n })\n .addCase(submitMSISDNAction.fulfilled, (state, action: PayloadAction<MSISDNEntryState>) => {\n state.currentState = action.payload;\n })\n .addCase(submitMSISDNAction.rejected, (state, action: PayloadAction<MSISDNEntryFailure>) => {\n state.currentState = {\n type: 'MSISDNEntry',\n result: RDS.Failure(action.payload)\n };\n });\n }\n});\n\n// Export reducers and actions\nexport const { reducer: moFlowReducer, actions: moFlowActions } = moFlowSlice;\n\n// If you have selectors or thunks related to this slice, export them as named exports as well\nexport const selectMoFlowState = (state: any) => state.moFlow;\n"],"names":["RDS.Success","RDS.Failure","RDS.NothingYet","RDS.Loading"],"mappings":";;;;;;;;;;;;;;;;AAGO,IAAM,cAAc,GAAG,UAAC,WAAgC,EAAA;AAC7D,IAAA,IAAM,YAAY,GAAG,WAAW,CAAC,UAAC,KAAgB,EAAK,EAAA,OAAA,KAAK,CAAC,MAAM,CAAC,YAAY,CAAzB,EAAyB,CAAC,CAAC;AAClF,IAAA,OAAO,YAAY,CAAC;AACtB;;ACHA,SAAS,WAAW,CAAI,EAIvB,EAAA;AAHC,IAAA,IAAA,WAAW,GAAA,EAAA,CAAA,WAAA,CAAA;AAIX,IAAA,OAAO,UAAC,KAAK,EAAA;QACX,QAAQ,KAAK,CAAC,IAAI;AAChB,YAAA,KAAK,aAAa;AAChB,gBAAA,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACnC,YAAA;;AAEE,gBAAA,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACpC,SAAA;AACH,KAAC,CAAC;AACJ;;ACAA,IAAM,cAAc,GAAG,UAAO,EAoB7B,EAA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,WAAW,CAAC;AAC9B,IAAA,IAAI,EAAE,QAAQ;AACd,IAAA,YAAY,EAAA,YAAA;AACZ,IAAA,QAAQ,EAAE,EAAE;IACZ,aAAa,EAAE,UAAC,OAAO,EAAA;QACrB,OAAO;AACJ,aAAA,OAAO,CAAC,kBAAkB,CAAC,OAAO,EAAE,UAAC,KAAK,EAAA;AACzC,YAAA,KAAK,CAAC,YAAY,GAAG,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAEG,OAAW,EAAE,EAAE,CAAC;AACtE,SAAC,CAAC;aACD,OAAO,CAAC,kBAAkB,CAAC,SAAS,EAAE,UAAC,KAAK,EAAE,MAAuC,EAAA;AACpF,YAAA,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC;AACtC,SAAC,CAAC;aACD,OAAO,CAAC,kBAAkB,CAAC,QAAQ,EAAE,UAAC,KAAK,EAAE,MAAyC,EAAA;YACrF,KAAK,CAAC,YAAY,GAAG;AACnB,gBAAA,IAAI,EAAE,aAAa;gBACnB,MAAM,EAAEF,OAAW,CAAC,MAAM,CAAC,OAAO,CAAC;aACpC,CAAC;AACJ,SAAC,CAAC,CAAC;KACN;AACF,CAAA,CAAC,CAAC;AAEH;AACwB,IAAA,aAAa,GAA6B,WAAW,CAAxC,OAAA,CAAA,CAA6B,WAAW,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"moFlow.js","sources":["../../src/flows/moFlow/hooks/useMoFlowState.ts","../../src/flows/moFlow/match.ts","../../src/flows/moFlow/api.ts","../../src/flows/moFlow/main.ts","../../src/flows/moFlow/moFlowSlice.ts"],"sourcesContent":["import { useSelector as IuseSelector } from 'react-redux';\nimport { RootState } from '../../../sharedFlowTypes/StrategyTypes';\n\nexport const useMoFlowState = (useSelector: typeof IuseSelector) => {\n const currentState = useSelector((state: RootState) => state.moFlow.currentState);\n return currentState;\n};\n","import * as RDS from '../../common-types/RemoteDataState';\nimport { MoFlowCurrentState, MSISDNEntryFailure, MSISDNEntrySuccess } from '../../sharedFlowTypes/MoTypes';\n\nfunction moFlowMatch<R>({\n msisdnEntry\n}: {\n msisdnEntry: (rds: RDS.RemoteDataState<MSISDNEntryFailure, MSISDNEntrySuccess>) => R;\n}): (state: MoFlowCurrentState) => R {\n return (state) => {\n switch (state.type) {\n case 'MSISDNEntry':\n return msisdnEntry(state.result);\n default:\n // TODO - this should be an error or something\n return msisdnEntry(state.result);\n }\n };\n}\n\nexport { moFlowMatch };\n","import { IGoogleReCaptcha, IMSISDNSubmissionResult } from '../../sharedFlowTypes/MoTypes';\nimport { cleanSearchParams } from '../../utilities/cleanSearchParams';\n\nconst getGoogleCaptcha = async (\n window: Window,\n country: string,\n slug: string,\n device: string,\n domain: string\n): Promise<IGoogleReCaptcha> => {\n const host = (window as Window).DEV_BASE_URL || '';\n\n return fetch(\n `${host}/tallyman/helper/?action=google-captcha-v3-config&country=${country}&slug=${slug}&device=${device}&domain=${domain}`\n ).then((x) => x.json());\n};\n\nconst triggerMessage = async ({\n window,\n slug,\n country,\n msisdn,\n device,\n offer,\n rockmanId,\n extraParamsQs,\n search\n}: {\n window: Window;\n slug: string;\n country: string;\n msisdn: string;\n device: string;\n offer: string;\n rockmanId: string;\n search: string;\n extraParamsQs: string;\n}): Promise<IMSISDNSubmissionResult> => {\n // introduced https://www.notion.so/sammedia/CH-Agency-Bodkinco-Integration-ea1600ad175f451a9d351b6763ad7992\n const partnerAjaxResopnse: {\n form_action: string;\n } = window.api_ajax_url ? await fetch(window.api_ajax_url).then((x) => x.json()) : null;\n\n // Remove conflicting params from url\n search = cleanSearchParams(search);\n const params = {\n action: 'trigger-message',\n slug,\n country,\n msisdn,\n device,\n offerId: offer,\n rockman_id: rockmanId,\n page: encodeURIComponent(window?.location?.href),\n sam_g_token: window.reCaptchaToken || '',\n language_code: window.languageCode || '',\n partner_form_action: partnerAjaxResopnse?.form_action ? encodeURIComponent(partnerAjaxResopnse?.form_action) : '',\n\n antifraud_id: window.antifraud_id || '',\n // More specific antifraud IDs will eventuallly replace antifraud_id\n // https://www.notion.so/sammedia/KW-Agency-Globocom-KW-ENTERTAINMENT-STORE-GAMESOLUTELY-GLING-Landing-Page-Test-a9841b14218b42709ffb1a2d41428275?d=f2a8d09b1e8c4fd4bdab69ab5dda1f25\n antifraud_id_js_code: window.antifraud_id_js_code || '',\n antifraud_id_js_link: window.antifraud_id_js_link || ''\n };\n\n const queryString = Object.entries(params)\n .filter(([_, value]) => value)\n .map(([key, value]) => `${key}=${value}`)\n .join('&');\n\n const host = (window as Window).DEV_BASE_URL || '';\n const url = `${host}/tallyman/v1/?${queryString}${search ? `&${search}` : ''}&${extraParamsQs}`;\n\n if (window.MOCK_TRIGGER_MESSAGE_RESPONSE) {\n return window.MOCK_TRIGGER_MESSAGE_RESPONSE;\n }\n return fetch(url).then((x) => x.json());\n};\n\nexport { getGoogleCaptcha, triggerMessage };\n","import { ICheckSubscriptionResult } from '../../common-types/ICheckSubscriptionResult';\nimport { IError } from '../../common-types/IError';\nimport { IConfig } from '../../common-types/Strategy';\nimport { checkSubscriptionByRockmanIdOnly } from '../../sharedApi/checkSubscriptionByRockmanIdOnly';\nimport { IGoogleReCaptcha, IKeywordShortcode, IMSISDNSubmissionResult } from '../../sharedFlowTypes/MoTypes';\nimport { loop } from '../../utilities/helpers';\nimport loadScriptSrc from '../../utilities/loadScriptSrc';\nimport { normaliseErrorCode } from '../../utilities/normaliseErrorCode';\nimport { getGoogleCaptcha, triggerMessage } from './api';\n\nexport default async function submitMSISDN(\n window: Window,\n maybeConfig: IConfig,\n internationalMSISDN: string,\n extraParams?: { [key: string]: string }\n): Promise<IKeywordShortcode> {\n const config: any = { ...(maybeConfig || {}), offer: window.pac_analytics?.visitor?.offer };\n return submitMSISDNWithConfig(window, config, internationalMSISDN, extraParams);\n}\n\nexport const getGoogleReCaptchaConfig = async ({\n window,\n slug,\n country,\n device\n}: IConfig & { window: Window }): Promise<IGoogleReCaptcha> => {\n const domain = window.location.hostname;\n const result: IGoogleReCaptcha = await getGoogleCaptcha(window, country, slug, device, domain);\n if (result.success === true) {\n const srcUrl = `https://www.google.com/recaptcha/api.js?render=${result.site_key}`;\n loadScriptSrc({ url: srcUrl, key: result.site_key, isRecaptcha: true });\n }\n return result;\n};\n\nexport async function submitMSISDNWithConfig(\n window: Window,\n config: IConfig,\n internationalMSISDN: string,\n extraParams?: { [key: string]: string }\n): Promise<IKeywordShortcode> {\n const { slug, country, device, offer } = config;\n const search = window.location.search.substr(1) || '';\n const extraParamsQs = !extraParams\n ? ''\n : `&${Object.keys(extraParams)\n .map((k) => `${k}=${extraParams[k]}`)\n .join('&')}`;\n const msisdn = internationalMSISDN.match(/\\d+/gi)?.join('') || '';\n const { rockmanId } = window.pac_analytics.visitor;\n\n const result: IMSISDNSubmissionResult = await triggerMessage({\n window,\n slug,\n country,\n msisdn,\n device,\n offer,\n rockmanId,\n search,\n extraParamsQs\n });\n\n if (result.success === false) {\n // pick a default based on message, then override with error_code if available\n const defaultType = result.message === 'ALREADY SUBSCRIBED' ? 'AlreadySubscribed' : 'InvalidMsisdn';\n\n const type = result.error_code ? normaliseErrorCode(result.error_code) : defaultType;\n\n // build, augment, log and throw\n const error = new Error(`${type}:\\n${result.message}`) as IError & {\n type: string;\n productUrl: string;\n };\n\n Object.assign(error, {\n type,\n productUrl: result.product_url ?? ''\n });\n\n throw error;\n } else {\n return { ...result, keyword: result.displayKeyword }; // based on discussion with Chanaka to avoid confusion in set up on bupper. Click2sms and mo will use display keyword\n }\n}\n\nexport async function moCheckSubscription(window: Window): Promise<string> {\n const { rockmanId } = window.pac_analytics.visitor;\n const check: () => Promise<ICheckSubscriptionResult> = () => checkSubscriptionByRockmanIdOnly({ window, rockmanId });\n\n const checkResult: ICheckSubscriptionResult = await loop(check, 60, (r) => r.success, 0);\n\n if (checkResult.success === true && checkResult.product_url && checkResult.product_url !== '') {\n window.location.href = decodeURIComponent(checkResult.product_url);\n return checkResult.product_url;\n }\n const error = new Error(`${'SubscriptionFailed'}:\\n${checkResult.message}`) as IError & { type: string };\n error.type = 'SubscriptionFailed';\n throw error;\n}\n\n// export const formatSMSLink = (keywordAndShortcode: IKeywordShortcode) =>\n// !!window.pac_analytics.visitor['x-requested-with'] &&\n// window.pac_analytics.visitor['x-requested-with'] !== null &&\n// window.pac_analytics.visitor['x-requested-with'].indexOf('com.facebook') !== -1\n// ? `sms://${keywordAndShortcode.shortcode}?body=${keywordAndShortcode.keyword}`\n// : typeof navigator !== 'undefined' && (/iPhone/i.test(navigator.userAgent) || /Mac OS/i.test(navigator.userAgent))\n// ? `sms:${keywordAndShortcode.shortcode}&body=${keywordAndShortcode.keyword}`\n// : `sms:${keywordAndShortcode.shortcode}?body=${keywordAndShortcode.keyword}`;\n","import { createAsyncThunk, createSlice, PayloadAction } from '@reduxjs/toolkit';\nimport { IHash } from '../../common-types/IHash';\nimport * as RDS from '../../common-types/RemoteDataState';\nimport {\n MSISDNEntryErrorTypes,\n MSISDNEntryFailure,\n MSISDNEntryState,\n MSISDNEntrySuccess\n} from '../../sharedFlowTypes/MoTypes';\nimport { IMockFlowParams, RootState } from '../../sharedFlowTypes/StrategyTypes';\nimport { handleResolveRedirect } from '../../utilities/handleResolveRedirect';\nimport { getErrorCode, redirectErrorTypes } from '../../utilities/normaliseErrorCode';\nimport { searchToObject } from '../../utilities/searchToObject';\nimport { storeMsisdn } from '../../utilities/storeMsisdn';\nimport { tracker } from '../../utilities/tracker';\nimport { identifyStrategy } from '../strategy';\nimport submitMSISDN from './main';\n\nexport const mockedMSISDNEntrySuccess: MoFlowState = {\n currentState: {\n type: 'MSISDNEntry',\n result: RDS.Success<MSISDNEntryFailure, MSISDNEntrySuccess>({\n keyword: 'TEST OK',\n shortcode: '777'\n })\n }\n};\n\nexport const mockedMSISDNEntryFailure: MoFlowState = {\n currentState: {\n type: 'MSISDNEntry',\n result: RDS.Failure<MSISDNEntryFailure, MSISDNEntrySuccess>({\n errorType: 'InvalidMSISDN',\n error: 'Invalid Mobile Number'\n })\n }\n};\nexport interface MoFlowState {\n currentState: {\n type: 'MSISDNEntry';\n result: RDS.RemoteDataState<any, any>; // Replace any with your specific error and data types\n };\n}\n\nconst defaultInitialState: MoFlowState = {\n currentState: {\n type: 'MSISDNEntry',\n result: RDS.NothingYet()\n }\n};\n\nconst setInitialState = (window: Window) => {\n const search = searchToObject(window) as IMockFlowParams<any>;\n if (search['mock-flow']) {\n switch (search['current-state']) {\n case 'msisdn-entry-failure-state':\n return mockedMSISDNEntryFailure;\n case 'msisdn-entry-success-state':\n return mockedMSISDNEntrySuccess;\n case 'check-subscription-success-state':\n return mockedMSISDNEntrySuccess;\n default:\n console.error('Mock Flow not supported');\n return defaultInitialState;\n }\n } else {\n return defaultInitialState;\n }\n};\n\nconst initialState = setInitialState(window);\n\ninterface SubmitMSISDNArgs {\n window: Window;\n msisdn: string;\n extraParams?: IHash;\n}\n/**\n * submitMSISDNAction\n * @returns {type: ' 'pinFlow/submitMSISDNAction', payload: {type: PossibleTypes, result: MSISDNEntryState}}\n \n * Calls trigger-message api that returns a short code and key word\n * Sets completed stated\n */\nexport const submitMSISDNAction = createAsyncThunk<\n MSISDNEntryState,\n SubmitMSISDNArgs,\n {\n rejectValue: MSISDNEntryFailure;\n }\n>('moFlow/submitMSISDNAction', async ({ window, msisdn, extraParams }, { getState, rejectWithValue }) => {\n const state: RootState = getState();\n if (!state?.strategy?.currentState?.data?.config) {\n return rejectWithValue({\n errorType: 'UnexpectedState'\n });\n }\n const { config } = state.strategy.currentState.data;\n\n try {\n // Start Trigger Message\n tracker.advancedInFlow('tallyman.v1-mo', 'msisdn-submitted', { msisdn });\n const keywordAndShortcode = await submitMSISDN(window, config, msisdn, extraParams);\n tracker.advancedInFlow('tallyman.v1-mo', 'msisdn-submission-success', { msisdn });\n // End Trigger Message\n\n // Start Store Msisdn\n // if storeMsisdn is true, encrypt msisdn and save it in cookie, localStorage, and zürch\n if (extraParams && extraParams.storeMsisdn && extraParams.storeMsisdn === 'true') {\n await storeMsisdn(msisdn)\n .then((data: any) => {\n if (data && data.data && data.data.success) {\n tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-success');\n } else {\n tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-failed');\n }\n })\n .catch((error) => {\n tracker.customEvent('Flow', 'advance-auto', 'msisdn-stored-error', error);\n });\n }\n // End Store Msisdn\n\n return {\n type: 'MSISDNEntry',\n result: RDS.Success<MSISDNEntryFailure, MSISDNEntrySuccess>({ ...keywordAndShortcode })\n };\n } catch (ex) {\n console.warn(ex);\n\n const errorType = ex.type as MSISDNEntryErrorTypes;\n\n tracker.recedeInFlow('tallyman.v1-mo', 'msisdn-submission-failure', {\n msisdn,\n errorType\n });\n\n if (redirectErrorTypes.includes(errorType) && window?.pac_analytics?.visitor?.waterfallRedirectUrl) {\n tracker.customEvent('Flow', 'redirect', 'waterfall-redirect', {\n redirect_url: window?.pac_analytics?.visitor?.waterfallRedirectUrl,\n errorType,\n errorCode: getErrorCode(errorType)\n });\n handleResolveRedirect(window?.pac_analytics?.visitor?.waterfallRedirectUrl);\n }\n return rejectWithValue({\n errorType,\n productUrl: ex.productUrl\n });\n }\n});\n\nexport const backToStartAction = createAsyncThunk<\n any,\n any,\n {\n rejectValue: any; // Type for rejectWithValue\n }\n>('moFlow/backToStartAction', async (_, { dispatch, rejectWithValue }) => {\n try {\n tracker.recedeInFlow('tallyman.v1-mo', 'mo-state', 'requested to change phone number');\n dispatch(identifyStrategy());\n } catch (ex) {\n console.warn(ex);\n return rejectWithValue({\n errorType: 'UnexpectedState'\n });\n }\n});\n\nconst moFlowSlice = createSlice({\n name: 'moFlow',\n initialState,\n reducers: {},\n extraReducers: (builder) => {\n builder\n .addCase(submitMSISDNAction.pending, (state) => {\n state.currentState = { type: 'MSISDNEntry', result: RDS.Loading() };\n })\n .addCase(submitMSISDNAction.fulfilled, (state, action: PayloadAction<MSISDNEntryState>) => {\n state.currentState = action.payload;\n })\n .addCase(submitMSISDNAction.rejected, (state, action: PayloadAction<MSISDNEntryFailure>) => {\n state.currentState = {\n type: 'MSISDNEntry',\n result: RDS.Failure(action.payload)\n };\n });\n }\n});\n\n// Export reducers and actions\nexport const { reducer: moFlowReducer, actions: moFlowActions } = moFlowSlice;\n\n// If you have selectors or thunks related to this slice, export them as named exports as well\nexport const selectMoFlowState = (state: any) => state.moFlow;\n"],"names":["RDS.Success","RDS.Failure","RDS.NothingYet","RDS.Loading"],"mappings":";;;;;;;;;;;;;;;;AAGO,IAAM,cAAc,GAAG,UAAC,WAAgC,EAAA;AAC7D,IAAA,IAAM,YAAY,GAAG,WAAW,CAAC,UAAC,KAAgB,EAAK,EAAA,OAAA,KAAK,CAAC,MAAM,CAAC,YAAY,CAAzB,EAAyB,CAAC,CAAC;AAClF,IAAA,OAAO,YAAY,CAAC;AACtB;;ACHA,SAAS,WAAW,CAAI,EAIvB,EAAA;AAHC,IAAA,IAAA,WAAW,GAAA,EAAA,CAAA,WAAA,CAAA;AAIX,IAAA,OAAO,UAAC,KAAK,EAAA;QACX,QAAQ,KAAK,CAAC,IAAI;AAChB,YAAA,KAAK,aAAa;AAChB,gBAAA,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACnC,YAAA;;AAEE,gBAAA,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACpC,SAAA;AACH,KAAC,CAAC;AACJ;;ACAA,IAAM,cAAc,GAAG,UAAO,EAoB7B,EAAA;QAnBC,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,IAAI,GAAA,EAAA,CAAA,IAAA,EACJ,OAAO,GAAA,EAAA,CAAA,OAAA,EACP,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,MAAM,YAAA,EACN,KAAK,GAAA,EAAA,CAAA,KAAA,EACL,SAAS,GAAA,EAAA,CAAA,SAAA,EACT,aAAa,GAAA,EAAA,CAAA,aAAA,EACb,MAAM,GAAA,EAAA,CAAA,MAAA,CAAA;;;;;;;yBAeF,MAAM,CAAC,YAAY,EAAnB,OAAm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O,CAAC,kBAAkB,CAAC,SAAS,EAAE,UAAC,KAAK,EAAE,MAAuC,EAAA;AACpF,YAAA,KAAK,CAAC,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC;AACtC,SAAC,CAAC;aACD,OAAO,CAAC,kBAAkB,CAAC,QAAQ,EAAE,UAAC,KAAK,EAAE,MAAyC,EAAA;YACrF,KAAK,CAAC,YAAY,GAAG;AACnB,gBAAA,IAAI,EAAE,aAAa;gBACnB,MAAM,EAAEF,OAAW,CAAC,MAAM,CAAC,OAAO,CAAC;aACpC,CAAC;AACJ,SAAC,CAAC,CAAC;KACN;AACF,CAAA,CAAC,CAAC;AAEH;AACwB,IAAA,aAAa,GAA6B,WAAW,CAAxC,OAAA,CAAA,CAA6B,WAAW,CAAA;;;;"}
|
package/dist/oneClickFlow.js
CHANGED
|
@@ -35,26 +35,28 @@ function oneClickFlowMatch(_a) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
function addEmpelloToken(_a) {
|
|
38
|
+
var _b, _c, _d, _e;
|
|
38
39
|
var currentRedirectUrl = _a.currentRedirectUrl, country = _a.country;
|
|
39
40
|
return __awaiter(this, void 0, void 0, function () {
|
|
40
41
|
var token, url;
|
|
41
|
-
return __generator(this, function (
|
|
42
|
-
switch (
|
|
42
|
+
return __generator(this, function (_f) {
|
|
43
|
+
switch (_f.label) {
|
|
43
44
|
case 0:
|
|
44
|
-
if (!(country.toLowerCase() === 'pe')) return [3 /*break*/, 3];
|
|
45
|
+
if (!(country.toLowerCase() === 'pe' && ((_e = (_d = (_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.ip_range_name) === null || _d === void 0 ? void 0 : _d.toLowerCase()) === null || _e === void 0 ? void 0 : _e.includes('pe')))) return [3 /*break*/, 3];
|
|
45
46
|
// Empello script is added on server
|
|
46
47
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
47
48
|
// check if empello script is loaded and available
|
|
48
49
|
var checkEmpelloAvailability = setInterval(function () {
|
|
50
|
+
console.log('checkEmpAvailability');
|
|
49
51
|
if (window.Empello) {
|
|
50
52
|
clearInterval(checkEmpelloAvailability);
|
|
51
53
|
resolve();
|
|
52
54
|
}
|
|
53
|
-
},
|
|
55
|
+
}, 10);
|
|
54
56
|
})];
|
|
55
57
|
case 1:
|
|
56
58
|
// Empello script is added on server
|
|
57
|
-
|
|
59
|
+
_f.sent();
|
|
58
60
|
if (!(typeof window !== 'undefined' && window.Empello)) return [3 /*break*/, 3];
|
|
59
61
|
return [4 /*yield*/, new Promise(function (resolve) {
|
|
60
62
|
var _a;
|
|
@@ -63,7 +65,7 @@ function addEmpelloToken(_a) {
|
|
|
63
65
|
});
|
|
64
66
|
})];
|
|
65
67
|
case 2:
|
|
66
|
-
token =
|
|
68
|
+
token = _f.sent();
|
|
67
69
|
url = updateUrlParameter(currentRedirectUrl, 'empello_token', token);
|
|
68
70
|
return [2 /*return*/, url];
|
|
69
71
|
case 3: return [2 /*return*/, currentRedirectUrl];
|
|
@@ -538,7 +540,9 @@ function (_a, _b) {
|
|
|
538
540
|
})];
|
|
539
541
|
case 5:
|
|
540
542
|
newRedirectUrl = (_o.sent()).redirect_url;
|
|
541
|
-
tracker.customEvent('Flow', 'advance-auto', 'get-redirect-url-success'
|
|
543
|
+
tracker.customEvent('Flow', 'advance-auto', 'get-redirect-url-success', {
|
|
544
|
+
redirect_url: newRedirectUrl
|
|
545
|
+
});
|
|
542
546
|
if (!newRedirectUrl) return [3 /*break*/, 7];
|
|
543
547
|
return [4 /*yield*/, addEmpelloToken({
|
|
544
548
|
currentRedirectUrl: newRedirectUrl,
|