ouisys-engine 5.0.18 → 5.0.19
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{checkSubscriptionHander as r}from"./checkSubscriptionHander.js";import{t}from"./tracker-DaaILhEr.js";import"tslib";import"./checkSubscriptionByRockmanIdOnly-BwR1un1L.js";import"./helpers-xPhGBX-B.js";import"./searchToObject.js";import"pacman-client";import"uuid";var c=function(c){var
|
|
1
|
+
import{checkSubscriptionHander as r}from"./checkSubscriptionHander.js";import{isCsSafe as t}from"./isCsSafe.js";import{t as i}from"./tracker-DaaILhEr.js";import"tslib";import"./checkSubscriptionByRockmanIdOnly-BwR1un1L.js";import"./helpers-xPhGBX-B.js";import"./searchToObject.js";import"./bupperizeCountry-CEtt0MKz.js";import"pacman-client";import"uuid";var c=function(c){var o=c.window,e=c.trackState,n=c.msisdn;if(void 0!==o){var a=o.pac_analytics.visitor.chainRedirectUrl||null;r({window:o}).then((function(r){var c=!n||t({window:o,command:"cs",msisdn:n});a&&c?(i.customEvent(e,"redirect","chain-redirect",{redirect_url:a}),o.location.replace(a)):(i.customEvent(e,"redirect","product-redirect",{redirect_url:r}),o.location.replace(r))})).catch((function(r){throw r}))}};export{c as handleClickChainFlow};
|
|
2
2
|
//# sourceMappingURL=handleClickChainFlow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleClickChainFlow.js","sources":["../src/utilities/handleClickChainFlow.ts"],"sourcesContent":["import { checkSubscriptionHander } from './checkSubscriptionHander';\nimport { tracker } from './tracker';\n\nexport const handleClickChainFlow = ({
|
|
1
|
+
{"version":3,"file":"handleClickChainFlow.js","sources":["../src/utilities/handleClickChainFlow.ts"],"sourcesContent":["import { checkSubscriptionHander } from './checkSubscriptionHander';\nimport { isCsSafe } from './isCsSafe';\nimport { tracker } from './tracker';\n\nexport const handleClickChainFlow = ({\n window,\n trackState,\n msisdn\n}: {\n window: Window;\n trackState: string;\n msisdn?: string;\n}) => {\n if (typeof window !== 'undefined') {\n const chainRedirectUrl = window.pac_analytics.visitor.chainRedirectUrl || null;\n checkSubscriptionHander({ window })\n .then((productUrl) => {\n const isSafe = msisdn\n ? isCsSafe({\n window,\n command: 'cs',\n msisdn\n })\n : true;\n if (chainRedirectUrl && isSafe) {\n tracker.customEvent(trackState, 'redirect', 'chain-redirect', { redirect_url: chainRedirectUrl });\n window.location.replace(chainRedirectUrl);\n } else {\n tracker.customEvent(trackState, 'redirect', 'product-redirect', { redirect_url: productUrl });\n window.location.replace(productUrl);\n }\n })\n .catch((err) => {\n throw err;\n });\n }\n};\n"],"names":["handleClickChainFlow","_a","window","trackState","msisdn","chainRedirectUrl_1","pac_analytics","visitor","chainRedirectUrl","checkSubscriptionHander","then","productUrl","isSafe","isCsSafe","command","tracker","customEvent","redirect_url","location","replace","catch","err"],"mappings":"mWAIO,IAAMA,EAAuB,SAACC,GACnC,IAAAC,WACAC,EAAUF,EAAAE,WACVC,EAAMH,EAAAG,OAMN,QAAsB,IAAXF,EAAwB,CACjC,IAAMG,EAAmBH,EAAOI,cAAcC,QAAQC,kBAAoB,KAC1EC,EAAwB,CAAEP,OAAMA,IAC7BQ,MAAK,SAACC,GACL,IAAMC,GAASR,GACXS,EAAS,CACPX,OAAMA,EACNY,QAAS,KACTV,OAAMA,IAGRC,GAAoBO,GACtBG,EAAQC,YAAYb,EAAY,WAAY,iBAAkB,CAAEc,aAAcZ,IAC9EH,EAAOgB,SAASC,QAAQd,KAExBU,EAAQC,YAAYb,EAAY,WAAY,mBAAoB,CAAEc,aAAcN,IAChFT,EAAOgB,SAASC,QAAQR,GAE5B,IACCS,OAAM,SAACC,GACN,MAAMA,CACR,GACH,CACH"}
|
package/dist/isCsSafe.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__awaiter as n,__generator as o,__read as r}from"tslib";import{b as t}from"./bupperizeCountry-CEtt0MKz.js";var c=function(c){var i=c.window,e=c.country,s=c.msisdn,a=c.command,u=c.rockmanId;return n(void 0,void 0,void 0,(function(){var n,c,d,m;return o(this,(function(o){return n={action:"post-subscription-response",command:a,country:t(e),msisdn:s,rockman_id:u},c=Object.entries(n).filter((function(n){var o=r(n,2);o[0];var t=o[1];return null!=t})).map((function(n){var o=r(n,2),t=o[0],c=o[1];return"".concat(t,"=").concat(encodeURIComponent(c))})).join("&"),d=i.DEV_BASE_URL||"",m="".concat(d,"/tallyman/v1/?").concat(c),[2,fetch(m).then((function(n){return n.json()}))]}))}))},i=function(r){var t=r.window,i=r.command,e=r.msisdn;return n(void 0,void 0,void 0,(function(){var n,r,s,a,u,d;return o(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),n=(null===(d=null==t?void 0:t.pac_analytics)||void 0===d?void 0:d.visitor)||{},r=n.rockmanId,s=n.country,[4,c({window:t,command:i,msisdn:e,country:s,rockmanId:r})];case 1:return!1===(a=o.sent()).success?(console.error(a),[2,!0]):[2,a.cs];case 2:return u=o.sent(),console.error(u),[2,!0];case 3:return[2]}}))}))};export{i as isCsSafe};
|
|
2
|
+
//# sourceMappingURL=isCsSafe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isCsSafe.js","sources":["../src/sharedApi/postSubscription.ts","../src/utilities/isCsSafe.ts"],"sourcesContent":["import { bupperizeCountry } from '../utilities/bupperizeCountry';\n\nexport type PostSubscriptionResponse =\n | {\n success: true;\n cs: boolean;\n rockman_id: string;\n }\n | {\n success: false;\n cs: boolean;\n rockman_id: string;\n };\n\nconst postSubscription = async ({\n window,\n country,\n msisdn,\n command,\n rockmanId\n}: {\n window: Window;\n country: string;\n msisdn: string;\n command: 'cs';\n rockmanId: string;\n}): Promise<PostSubscriptionResponse> => {\n const params = {\n action: 'post-subscription-response',\n command,\n country: bupperizeCountry(country),\n msisdn,\n rockman_id: rockmanId\n };\n\n const queryString = Object.entries(params)\n .filter(([_, value]) => value !== undefined && value !== null)\n .map(([key, value]) => `${key}=${encodeURIComponent(value)}`)\n .join('&');\n\n const host = window.DEV_BASE_URL || '';\n const url = `${host}/tallyman/v1/?${queryString}`;\n return fetch(url).then((response) => response.json());\n};\n\nexport { postSubscription };\n","import { postSubscription } from '../sharedApi/postSubscription';\n\n/**\n * Checks if the given payload is safe for chain sale.\n *\n * @param {Object} payload - The payload containing the following properties:\n * - window: The window object.\n * - country: The country code.\n * - msisdn: The MSISDN (Mobile Station International Subscriber Directory Number).\n * - command: The command.\n * - rockmanId: The rockman ID.\n * @return {Promise<boolean>} A promise that resolves to true if the payload is safe for chain sale, false otherwise.\n */\nexport const isCsSafe = async ({ window, command, msisdn }: { window: Window; msisdn: string; command: 'cs' }) => {\n try {\n const { rockmanId, country } = window?.pac_analytics?.visitor || {};\n const result = await postSubscription({\n window,\n command,\n msisdn,\n country,\n rockmanId\n });\n if (result.success === false) {\n console.error(result);\n return true; // continue chain sale on error according to https://www.notion.so/sammedia/Disabling-Chain-On-Specific-MSISDNs-3d61f2a82e5c4daea464114185f2371c\n }\n return result.cs;\n } catch (err) {\n console.error(err);\n return true; // continue chain sale on error according to https://www.notion.so/sammedia/Disabling-Chain-On-Specific-MSISDNs-3d61f2a82e5c4daea464114185f2371c\n }\n};\n"],"names":["postSubscription","_a","window","country","msisdn","command","rockmanId","params","action","bupperizeCountry","rockman_id","queryString","Object","entries","filter","_b","__read","value","map","key","concat","encodeURIComponent","join","host","DEV_BASE_URL","url","fetch","then","response","json","isCsSafe","_c","pac_analytics","visitor","result","_d","sent","success","console","error","cs","err_1"],"mappings":"kHAcA,IAAMA,EAAmB,SAAOC,GAC9B,IAAAC,EAAMD,EAAAC,OACNC,EAAOF,EAAAE,QACPC,EAAMH,EAAAG,OACNC,EAAOJ,EAAAI,QACPC,EAASL,EAAAK,2FAuBT,OAfMC,EAAS,CACbC,OAAQ,6BACRH,QAAOA,EACPF,QAASM,EAAiBN,GAC1BC,OAAMA,EACNM,WAAYJ,GAGRK,EAAcC,OAAOC,QAAQN,GAChCO,QAAO,SAACb,GAAA,IAAAc,EAAAC,OAAED,EAAA,GAAA,IAAEE,EAAKF,EAAA,GAAM,OAAAE,OAAA,IACvBC,KAAI,SAACjB,GAAA,IAAAc,EAAAC,OAACG,EAAGJ,EAAA,GAAEE,EAAKF,EAAA,GAAM,MAAA,UAAGI,EAAG,KAAAC,OAAIC,mBAAmBJ,GAA7B,IACtBK,KAAK,KAEFC,EAAOrB,EAAOsB,cAAgB,GAC9BC,EAAM,GAAGL,OAAAG,EAAqB,kBAAAH,OAAAT,GACpC,CAAA,EAAOe,MAAMD,GAAKE,MAAK,SAACC,GAAa,OAAAA,EAASC,MAAT,YC7B1BC,EAAW,SAAO7B,GAAE,IAAAC,WAAQG,EAAOJ,EAAAI,QAAED,EAAMH,EAAAG,mHAGrC,6BADTW,WAAyBgB,EAAA7B,aAAM,EAANA,EAAQ8B,oCAAeC,UAAW,CAAA,EAAzD3B,cAAWH,YACJ,CAAA,EAAMH,EAAiB,CACpCE,OAAMA,EACNG,QAAOA,EACPD,OAAMA,EACND,QAAOA,EACPG,UAASA,YAEX,OAAuB,KAPjB4B,EAASC,EAMbC,QACSC,SACTC,QAAQC,MAAML,GACP,CAAA,GAAA,IAEF,CAAA,EAAAA,EAAOM,WAGd,kBADAF,QAAQC,MAAME,GACP,CAAA,GAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if the given payload is safe for chain sale.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} payload - The payload containing the following properties:
|
|
5
|
+
* - window: The window object.
|
|
6
|
+
* - country: The country code.
|
|
7
|
+
* - msisdn: The MSISDN (Mobile Station International Subscriber Directory Number).
|
|
8
|
+
* - command: The command.
|
|
9
|
+
* - rockmanId: The rockman ID.
|
|
10
|
+
* @return {Promise<boolean>} A promise that resolves to true if the payload is safe for chain sale, false otherwise.
|
|
11
|
+
*/
|
|
12
|
+
declare const isCsSafe: ({ window, command, msisdn }: {
|
|
13
|
+
window: Window;
|
|
14
|
+
msisdn: string;
|
|
15
|
+
command: 'cs';
|
|
16
|
+
}) => Promise<boolean>;
|
|
17
|
+
|
|
18
|
+
export { isCsSafe };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ouisys-engine",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"directories": "dist dev-tools",
|
|
@@ -86,6 +86,9 @@
|
|
|
86
86
|
],
|
|
87
87
|
"utilities/unblockUser": [
|
|
88
88
|
"dist/types/unblockUser.d.ts"
|
|
89
|
+
],
|
|
90
|
+
"utilities/isCsSafe": [
|
|
91
|
+
"dist/types/isCsSafe.d.ts"
|
|
89
92
|
]
|
|
90
93
|
}
|
|
91
94
|
},
|