ouisys-engine 4.7.0-alpha.4 → 4.7.0-alpha.5
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
|
|
1
|
+
import e from"awesome-phonenumber";import{searchToObject as n}from"./searchToObject.js";import"tslib";var o=function(n){var o,i=n.msisdnValue,s=n.dispatch,t=n.submitMSISDNAction,c=n.isHeaderEnrichmentSuccess,r=n.setMsisdnValue,a=n.isHeaderEnrichmentAutoSubmit;if(console.log("msisdnValue",i),console.log("process.env.country",process.env.country),i&&i.length>3&&(!c||!0===c&&!0===a)){var d=new e("".concat(i),process.env.country.toUpperCase()),u=null===(o=d.getNumber())||void 0===o?void 0:o.match(/\d+/gi).join("");console.log("pn",d),console.log("pn",d.getNumber()),d.isValid()||r(u),s(t({window:window,msisdn:u}))}},i=function(o){var i=o.window,s=o.isHeaderEnrichmentSuccess,t=o.setInternationalNumber,c=o.onEnd,r=o.internationalNumber,a=new e("+".concat(r),process.env.country.toUpperCase()),d=a.getCountryCode(),u=s?"mobile_data":"wifi",l=n(i);if(!0!==s||"kw"!==process.env.country||""===r||a.isValid())if(!0===s&&"true"===(null==l?void 0:l.success)&&"1"===l["msisdn-alias"]){if(null==l?void 0:l.msisdn)c(l.msisdn,{network_type:u,"skip-validation":"1"})}else void 0!==i&&function(e,n){return void 0!==e&&null!==document.cookie.match(new RegExp("^(.*;)?\\s*".concat(n,"\\s*=\\s*[^;]+(.*)?$")))}(i,"OMEU")&&"es"===process.env.country?c("1",{network_type:u,"skip-validation":"1"}):r&&("ci"===process.env.country?c(r.match(/\d+/gi).join(""),{network_type:u}):c(r.match(/\d+/gi).join("")));else t(d+r),c((d+r).match(/\d+/gi).join(""))};export{o as handleAutoSubmitMsisdn,i as handleFormSubmit};
|
|
2
2
|
//# sourceMappingURL=handleSubmitNumber.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleSubmitNumber.js","sources":["../src/utilities/isCookieExists.ts","../src/utilities/handleSubmitNumber.ts"],"sourcesContent":["export const isCookieExists = (window: Window, cookieName: string) =>\n typeof window !== 'undefined' &&\n document.cookie.match(new RegExp(`^(.*;)?\\\\s*${cookieName}\\\\s*=\\\\s*[^;]+(.*)?$`)) !== null;\n","import { Dispatch } from '@reduxjs/toolkit';\nimport PhoneNumber from 'awesome-phonenumber';\nimport { isCookieExists } from './isCookieExists';\nimport { searchToObject } from './searchToObject';\n\nexport const handleAutoSubmitMsisdn = ({\n msisdnValue,\n dispatch,\n submitMSISDNAction,\n isHeaderEnrichmentSuccess,\n setMsisdnValue,\n isHeaderEnrichmentAutoSubmit\n}: {\n window: Window;\n msisdnValue: string;\n dispatch: Dispatch;\n submitMSISDNAction: ({ window, msisdn }: { window: Window; msisdn: string }) => any;\n isHeaderEnrichmentSuccess: boolean;\n setMsisdnValue: (msisdnValue: string) => void;\n isHeaderEnrichmentAutoSubmit?: boolean;\n}) => {\n //\n // eslint-disable-next-line no-console\n console.log('
|
|
1
|
+
{"version":3,"file":"handleSubmitNumber.js","sources":["../src/utilities/isCookieExists.ts","../src/utilities/handleSubmitNumber.ts"],"sourcesContent":["export const isCookieExists = (window: Window, cookieName: string) =>\n typeof window !== 'undefined' &&\n document.cookie.match(new RegExp(`^(.*;)?\\\\s*${cookieName}\\\\s*=\\\\s*[^;]+(.*)?$`)) !== null;\n","import { Dispatch } from '@reduxjs/toolkit';\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport PhoneNumber from 'awesome-phonenumber';\nimport { isCookieExists } from './isCookieExists';\nimport { searchToObject } from './searchToObject';\n\nexport const handleAutoSubmitMsisdn = ({\n msisdnValue,\n dispatch,\n submitMSISDNAction,\n isHeaderEnrichmentSuccess,\n setMsisdnValue,\n isHeaderEnrichmentAutoSubmit\n}: {\n window: Window;\n msisdnValue: string;\n dispatch: Dispatch;\n submitMSISDNAction: ({ window, msisdn }: { window: Window; msisdn: string }) => any;\n isHeaderEnrichmentSuccess: boolean;\n setMsisdnValue: (msisdnValue: string) => void;\n isHeaderEnrichmentAutoSubmit?: boolean;\n}) => {\n //\n // eslint-disable-next-line no-console\n console.log('msisdnValue', msisdnValue);\n // eslint-disable-next-line no-console\n console.log('process.env.country', process.env.country);\n if (\n msisdnValue &&\n msisdnValue.length > 3 &&\n (!isHeaderEnrichmentSuccess || (isHeaderEnrichmentSuccess === true && isHeaderEnrichmentAutoSubmit === true))\n ) {\n const pn = new PhoneNumber(`${msisdnValue}`, process.env.country.toUpperCase());\n const intlMsisdn = pn.getNumber()?.match(/\\d+/gi).join('');\n // eslint-disable-next-line no-console\n console.log('pn', pn);\n // eslint-disable-next-line no-console\n console.log('pn', pn.getNumber());\n\n if (pn.isValid()) {\n dispatch(submitMSISDNAction({ window, msisdn: intlMsisdn }));\n } else {\n setMsisdnValue(intlMsisdn);\n dispatch(submitMSISDNAction({ window, msisdn: intlMsisdn }));\n }\n }\n};\n\nexport const handleFormSubmit = ({\n window,\n isHeaderEnrichmentSuccess,\n setInternationalNumber,\n onEnd,\n internationalNumber\n}: {\n window: Window;\n isHeaderEnrichmentSuccess: boolean;\n country: string;\n setInternationalNumber: (msisdn: string) => void;\n onEnd: (msisdn: string, extraParams?: { [key: string]: string }) => void;\n internationalNumber: string;\n}) => {\n const pn = new PhoneNumber(`+${internationalNumber}`, process.env.country.toUpperCase());\n\n const countryCode = pn.getCountryCode();\n const networkType = isHeaderEnrichmentSuccess ? 'mobile_data' : 'wifi';\n const searchObj = searchToObject(window) as any;\n\n if (\n isHeaderEnrichmentSuccess === true &&\n process.env.country === 'kw' &&\n internationalNumber !== '' &&\n !pn.isValid()\n ) {\n setInternationalNumber(countryCode + internationalNumber);\n const newNumber = countryCode + internationalNumber;\n\n onEnd(newNumber.match(/\\d+/gi).join(''));\n } else if (isHeaderEnrichmentSuccess === true && searchObj?.success === 'true' && searchObj['msisdn-alias'] === '1') {\n // Special case Digital Virgo sents encrypted msisdn we dont need to validate is\n if (searchObj?.msisdn) {\n const encryptedMsisdn = searchObj.msisdn;\n onEnd(encryptedMsisdn, { network_type: networkType, 'skip-validation': '1' });\n }\n } else if (typeof window !== 'undefined' && isCookieExists(window, 'OMEU') && process.env.country === 'es') {\n onEnd('1', { network_type: networkType, 'skip-validation': '1' });\n } else if (internationalNumber) {\n if (process.env.country === 'ci') {\n onEnd(internationalNumber.match(/\\d+/gi).join(''), { network_type: networkType });\n } else {\n onEnd(internationalNumber.match(/\\d+/gi).join(''));\n }\n }\n};\n"],"names":["handleAutoSubmitMsisdn","_a","msisdnValue","dispatch","submitMSISDNAction","isHeaderEnrichmentSuccess","setMsisdnValue","isHeaderEnrichmentAutoSubmit","console","log","process","env","country","length","pn","PhoneNumber","concat","toUpperCase","intlMsisdn","_b","getNumber","match","join","isValid","window","msisdn","handleFormSubmit","setInternationalNumber","onEnd","internationalNumber","countryCode","getCountryCode","networkType","searchObj","searchToObject","success","network_type","cookieName","document","cookie","RegExp","isCookieExists"],"mappings":"sGAAO,ICMMA,EAAyB,SAACC,SACrCC,EAAWD,EAAAC,YACXC,EAAQF,EAAAE,SACRC,EAAkBH,EAAAG,mBAClBC,8BACAC,EAAcL,EAAAK,eACdC,EAA4BN,EAAAM,6BAe5B,GAHAC,QAAQC,IAAI,cAAeP,GAE3BM,QAAQC,IAAI,sBAAuBC,QAAQC,IAAIC,SAE7CV,GACAA,EAAYW,OAAS,KACnBR,IAA4D,IAA9BA,IAAuE,IAAjCE,GACtE,CACA,IAAMO,EAAK,IAAIC,EAAY,GAAAC,OAAGd,GAAeQ,QAAQC,IAAIC,QAAQK,eAC3DC,EAA2B,QAAdC,EAAAL,EAAGM,mBAAW,IAAAD,OAAA,EAAAA,EAAEE,MAAM,SAASC,KAAK,IAEvDd,QAAQC,IAAI,KAAMK,GAElBN,QAAQC,IAAI,KAAMK,EAAGM,aAEjBN,EAAGS,WAGLjB,EAAeY,GAFff,EAASC,EAAmB,CAAEoB,OAAMA,OAAEC,OAAQP,IAKjD,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