ouisys-engine 5.0.50 → 5.0.51
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{
|
|
1
|
+
import{checkSubscriptionHander as r}from"./checkSubscriptionHander.js";import{t}from"./tracker-DaaILhEr.js";import"tslib";import"./helpers-xPhGBX-B.js";import"./searchToObject.js";import"pacman-client";import"uuid";var i=function(i){var c=i.window,e=i.trackState;if(void 0!==c){var o=c.pac_analytics.visitor.chainRedirectUrl||null;r({window:c}).then((function(r){o?(t.customEvent(e,"redirect","chain-redirect",{redirect_url:o}),c.location.replace(o)):(t.customEvent(e,"redirect","product-redirect",{redirect_url:r}),c.location.replace(r))})).catch((function(r){throw r}))}};export{i 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 {
|
|
1
|
+
{"version":3,"file":"handleClickChainFlow.js","sources":["../src/utilities/handleClickChainFlow.ts"],"sourcesContent":["import { checkSubscriptionHander } from './checkSubscriptionHander';\nimport { tracker } from './tracker';\n\nexport const handleClickChainFlow = ({\n window,\n trackState\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 if (chainRedirectUrl) {\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","chainRedirectUrl_1","pac_analytics","visitor","chainRedirectUrl","checkSubscriptionHander","then","productUrl","tracker","customEvent","redirect_url","location","replace","catch","err"],"mappings":"uNAGO,IAAMA,EAAuB,SAACC,OACnCC,EAAMD,EAAAC,OACNC,EAAUF,EAAAE,WAMV,QAAsB,IAAXD,EAAwB,CACjC,IAAME,EAAmBF,EAAOG,cAAcC,QAAQC,kBAAoB,KAC1EC,EAAwB,CAAEN,OAAMA,IAC7BO,MAAK,SAACC,GACDN,GACFO,EAAQC,YAAYT,EAAY,WAAY,iBAAkB,CAAEU,aAAcT,IAC9EF,EAAOY,SAASC,QAAQX,KAExBO,EAAQC,YAAYT,EAAY,WAAY,mBAAoB,CAAEU,aAAcH,IAChFR,EAAOY,SAASC,QAAQL,GAE5B,IACCM,OAAM,SAACC,GACN,MAAMA,CACR,GACH,CACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ouisys-engine",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.51",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"directories": "dist dev-tools",
|
|
@@ -38,8 +38,7 @@
|
|
|
38
38
|
"./utilities/getConfig": "./dist/getConfig.js",
|
|
39
39
|
"./utilities/handleClickChainFlow": "./dist/handleClickChainFlow.js",
|
|
40
40
|
"./utilities/checkSubscriptionHander": "./dist/checkSubscriptionHander.js",
|
|
41
|
-
"./utilities/unblockUser": "./dist/unblockUser.js"
|
|
42
|
-
"./utilities/isCsSafe": "./dist/isCsSafe.js"
|
|
41
|
+
"./utilities/unblockUser": "./dist/unblockUser.js"
|
|
43
42
|
},
|
|
44
43
|
"typesVersions": {
|
|
45
44
|
"*": {
|
|
@@ -87,9 +86,6 @@
|
|
|
87
86
|
],
|
|
88
87
|
"utilities/unblockUser": [
|
|
89
88
|
"dist/types/unblockUser.d.ts"
|
|
90
|
-
],
|
|
91
|
-
"utilities/isCsSafe": [
|
|
92
|
-
"dist/types/isCsSafe.d.ts"
|
|
93
89
|
]
|
|
94
90
|
}
|
|
95
91
|
},
|
package/dist/isCsSafe.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
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
|
package/dist/isCsSafe.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/dist/types/isCsSafe.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
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 };
|