From 656f950460d457430f07f427553534781e65a129 Mon Sep 17 00:00:00 2001 From: Vince Linise Date: Thu, 29 Aug 2024 19:01:49 +0200 Subject: [PATCH] build: Updated build with streamlined Izly constructor --- dist/index.d.mts | 1 + dist/index.d.ts | 1 + dist/index.js | 2 +- dist/index.js.map | 2 +- dist/index.mjs | 2 +- dist/index.mjs.map | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/index.d.mts b/dist/index.d.mts index cdc4c88..7cb1f93 100644 --- a/dist/index.d.mts +++ b/dist/index.d.mts @@ -36,6 +36,7 @@ declare class Izly { private loggedIn; constructor(); login(username: string, password: string): Promise; + private checkLogin; getProfile(): Promise; getNotifications(): Promise; getBalance(): Promise; diff --git a/dist/index.d.ts b/dist/index.d.ts index cdc4c88..7cb1f93 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -36,6 +36,7 @@ declare class Izly { private loggedIn; constructor(); login(username: string, password: string): Promise; + private checkLogin; getProfile(): Promise; getNotifications(): Promise; getBalance(): Promise; diff --git a/dist/index.js b/dist/index.js index f4ff0e5..80f48f2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1 +1 @@ -"use strict";var e=require("cheerio"),t=require("axios");function r(e){return e&&e.__esModule?e:{default:e}}function o(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=o(e),n=r(t);function a(e){return parseFloat(e.replace(",",".").replace("€","").trim())}function s(e,t=" à "){const[r,o]=e.split(t),[i,n,a]=r.split("/"),[s,c]=o.split(":");return new Date(parseInt(a),parseInt(n)-1,parseInt(i),parseInt(s),parseInt(c))}var c=class{axiosInstance;cookies;constructor(){this.axiosInstance=n.default.create({withCredentials:!0,maxRedirects:0,validateStatus:()=>!0,headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","Accept-Language":"fr-FR,fr;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6,es;q=0.5"}}),this.cookies=[]}updateCookies(e){if(e["set-cookie"]){const t=Array.isArray(e["set-cookie"])?e["set-cookie"]:[e["set-cookie"]];this.cookies=[...this.cookies,...t],this.axiosInstance.defaults.headers.Cookie=this.cookies.join("; ")}}async makeRequest(e,t,r=null,o={}){const i={method:e,url:t,headers:{...this.axiosInstance.defaults.headers,...o},data:r};this.cookies.length>0&&(i.headers=i.headers||{},i.headers.Cookie=this.cookies.join("; "));const n=await this.axiosInstance(i);return this.updateCookies(n.headers),n}async login(e,t){try{let r=await this.makeRequest("GET","https://mon-espace.izly.fr/Home/Logon",null,{Referer:"https://mon-espace.izly.fr/"});const o=i.load(r.data)('input[name="__RequestVerificationToken"]').val();if(r=await this.makeRequest("POST","https://mon-espace.izly.fr/Home/Logon",`__RequestVerificationToken=${encodeURIComponent(o)}&ReturnUrl=&Username=${encodeURIComponent(e)}&Password=${encodeURIComponent(t)}`,{"Content-Type":"application/x-www-form-urlencoded",Origin:"https://mon-espace.izly.fr",Referer:"https://mon-espace.izly.fr/Home/Logon"}),302===r.status){const e=r.headers.location;r=await this.makeRequest("GET",`https://mon-espace.izly.fr${e}`,null,{Referer:"https://mon-espace.izly.fr/Home/Logon"})}if(r=await this.makeRequest("GET","https://mon-espace.izly.fr/",null,{Referer:"https://mon-espace.izly.fr/Home/Logon"}),200!==r.status)throw new Error("Failed to login");return!0}catch(e){return console.error("Login error:",e.message),!1}}getAxiosInstance(){return this.axiosInstance}},l=class{loginService;axiosInstance;loggedIn;constructor(){this.loginService=new c,this.axiosInstance=this.loginService.getAxiosInstance(),this.loggedIn=!1}async login(e,t){try{return this.loggedIn=await this.loginService.login(e,t),this.loggedIn}catch(e){return console.error("Login error:",e.message),!1}}async getProfile(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.");return async function(e){try{const t=await e.get("https://mon-espace.izly.fr/Profile",{headers:{Referer:"https://mon-espace.izly.fr/"}});if(200===t.status){const e=i.load(t.data);return{name:e("h1").first().text().trim(),identifier:e(".heading-label-value").eq(0).text().trim(),pseudo:e(".heading-label-value").eq(1).text().trim(),birthDate:e(".heading-label-value").eq(2).text().trim(),address:e(".addWay").text().trim()+", "+e(".addZipCode").text().trim()+" "+e(".addCity").text().trim(),primaryEmail:e(".rectangle").eq(1).text().trim(),secondaryEmail:e("#emailPersonnel").text().trim(),phoneNumber:e("#currentPhoneNumber").text().trim(),companyCode:e(".rectangle").eq(4).text().trim(),tariffCode:e(".rectangle").eq(5).text().trim(),crousRightsEndDate:e(".rectangle").eq(6).text().trim()}}throw new Error("Failed to retrieve profile information")}catch(e){throw console.error("Error retrieving profile information:",e.message),e}}(this.axiosInstance)}async getNotifications(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.");return async function(e){try{const t=await e.get("https://mon-espace.izly.fr/Profile?page=1",{headers:{Accept:"text/html, */*; q=0.01","X-Requested-With":"XMLHttpRequest",Referer:"https://mon-espace.izly.fr/Profile"}});if(200===t.status){const e=i.load(t.data),r=[];return e(".table-responsive .table tr").each(((t,o)=>{const i=e(o),n=s(i.find("td:nth-child(2)").text().trim()," à "),a=i.find("td:nth-child(3)").text().trim();r.push({date:n,description:a})})),r}throw new Error("Failed to retrieve notifications")}catch(e){throw console.error("Error retrieving notifications:",e.message),e}}(this.axiosInstance)}async getBalance(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.");return async function(e){const t=await e.get("https://mon-espace.izly.fr/",{headers:{Referer:"https://mon-espace.izly.fr/Home/Logon"}}),r=i.load(t.data),o=a(r("#balance").text().trim()),n=s(r(".balance-heading-date").text().trim()," à ");if(isNaN(o))throw new Error("Failed to extract balance. Possible page structure change.");return{date:n,amount:o}}(this.axiosInstance)}async getDeposits(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.");return async function(e){const t=await e.get("https://mon-espace.izly.fr/Home/GetTopups",{headers:{Referer:"https://mon-espace.izly.fr/","X-Requested-With":"XMLHttpRequest"}}),r=[],o=i.load(t.data);return o(".list-group-item").each(((e,t)=>{const i=o(t),n=i.find(".operation-type").text().split(" - ")[0]?.trim(),c=i.find(".operation-type").text().split(" - ")[1]?.trim(),l=s(i.find(".oeration-date").text().trim()," "),h=a(i.find(".operation-amount").text().trim()),d=i.find(".badge").text().trim();r.push({type:n,method:c,date:l,amount:h,status:d})})),r}(this.axiosInstance)}async generateQRCode(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.");return async function(e,t=1){try{const r=await e.post("https://mon-espace.izly.fr/Home/CreateQrCodeImg",`numberOfQrCodes=${t}`,{headers:{Accept:"text/html, */*; q=0.01","X-Requested-With":"XMLHttpRequest","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Origin:"https://mon-espace.izly.fr",Referer:"https://mon-espace.izly.fr/Home/GenerateQRCode"}});if(200===r.status)return r.data;throw new Error("Failed to generate QR Code(s)")}catch(e){throw console.error("Error generating QR Code(s):",e.message),e}}(this.axiosInstance)}};module.exports=l;//# sourceMappingURL=index.js.map \ No newline at end of file +"use strict";var e=require("cheerio"),t=require("axios");function r(e){return e&&e.__esModule?e:{default:e}}function i(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var n=i(e),a=r(t);function o(e){return parseFloat(e.replace(",",".").replace("€","").trim())}function s(e,t=" à "){const[r,i]=e.split(t),[n,a,o]=r.split("/"),[s,c]=i.split(":");return new Date(parseInt(o),parseInt(a)-1,parseInt(n),parseInt(s),parseInt(c))}var c=class{axiosInstance;cookies;constructor(){this.axiosInstance=a.default.create({withCredentials:!0,maxRedirects:0,validateStatus:()=>!0,headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","Accept-Language":"fr-FR,fr;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6,es;q=0.5"}}),this.cookies=[]}updateCookies(e){if(e["set-cookie"]){const t=Array.isArray(e["set-cookie"])?e["set-cookie"]:[e["set-cookie"]];this.cookies=[...this.cookies,...t],this.axiosInstance.defaults.headers.Cookie=this.cookies.join("; ")}}async makeRequest(e,t,r=null,i={}){const n={method:e,url:t,headers:{...this.axiosInstance.defaults.headers,...i},data:r};this.cookies.length>0&&(n.headers=n.headers||{},n.headers.Cookie=this.cookies.join("; "));const a=await this.axiosInstance(n);return this.updateCookies(a.headers),a}async login(e,t){try{let r=await this.makeRequest("GET","https://mon-espace.izly.fr/Home/Logon",null,{Referer:"https://mon-espace.izly.fr/"});const i=n.load(r.data)('input[name="__RequestVerificationToken"]').val();if(r=await this.makeRequest("POST","https://mon-espace.izly.fr/Home/Logon",`__RequestVerificationToken=${encodeURIComponent(i)}&ReturnUrl=&Username=${encodeURIComponent(e)}&Password=${encodeURIComponent(t)}`,{"Content-Type":"application/x-www-form-urlencoded",Origin:"https://mon-espace.izly.fr",Referer:"https://mon-espace.izly.fr/Home/Logon"}),302===r.status){const e=r.headers.location;r=await this.makeRequest("GET",`https://mon-espace.izly.fr${e}`,null,{Referer:"https://mon-espace.izly.fr/Home/Logon"})}if(r=await this.makeRequest("GET","https://mon-espace.izly.fr/",null,{Referer:"https://mon-espace.izly.fr/Home/Logon"}),200!==r.status)throw new Error("Failed to login");return!0}catch(e){return console.error("Login error:",e.message),!1}}getAxiosInstance(){return this.axiosInstance}},l=class{loginService;axiosInstance;loggedIn=!1;constructor(){this.loginService=new c,this.axiosInstance=this.loginService.getAxiosInstance()}async login(e,t){try{return this.loggedIn=await this.loginService.login(e,t),this.loggedIn}catch(e){return console.error("Login error:",e.message),!1}}checkLogin(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.")}async getProfile(){return this.checkLogin(),async function(e){try{const t=await e.get("https://mon-espace.izly.fr/Profile",{headers:{Referer:"https://mon-espace.izly.fr/"}});if(200===t.status){const e=n.load(t.data);return{name:e("h1").first().text().trim(),identifier:e(".heading-label-value").eq(0).text().trim(),pseudo:e(".heading-label-value").eq(1).text().trim(),birthDate:e(".heading-label-value").eq(2).text().trim(),address:e(".addWay").text().trim()+", "+e(".addZipCode").text().trim()+" "+e(".addCity").text().trim(),primaryEmail:e(".rectangle").eq(1).text().trim(),secondaryEmail:e("#emailPersonnel").text().trim(),phoneNumber:e("#currentPhoneNumber").text().trim(),companyCode:e(".rectangle").eq(4).text().trim(),tariffCode:e(".rectangle").eq(5).text().trim(),crousRightsEndDate:e(".rectangle").eq(6).text().trim()}}throw new Error("Failed to retrieve profile information")}catch(e){throw console.error("Error retrieving profile information:",e.message),e}}(this.axiosInstance)}async getNotifications(){return this.checkLogin(),async function(e){try{const t=await e.get("https://mon-espace.izly.fr/Profile?page=1",{headers:{Accept:"text/html, */*; q=0.01","X-Requested-With":"XMLHttpRequest",Referer:"https://mon-espace.izly.fr/Profile"}});if(200===t.status){const e=n.load(t.data),r=[];return e(".table-responsive .table tr").each(((t,i)=>{const n=e(i),a=s(n.find("td:nth-child(2)").text().trim()," à "),o=n.find("td:nth-child(3)").text().trim();r.push({date:a,description:o})})),r}throw new Error("Failed to retrieve notifications")}catch(e){throw console.error("Error retrieving notifications:",e.message),e}}(this.axiosInstance)}async getBalance(){return this.checkLogin(),async function(e){const t=await e.get("https://mon-espace.izly.fr/",{headers:{Referer:"https://mon-espace.izly.fr/Home/Logon"}}),r=n.load(t.data),i=o(r("#balance").text().trim()),a=s(r(".balance-heading-date").text().trim()," à ");if(isNaN(i))throw new Error("Failed to extract balance. Possible page structure change.");return{date:a,amount:i}}(this.axiosInstance)}async getDeposits(){return this.checkLogin(),async function(e){const t=await e.get("https://mon-espace.izly.fr/Home/GetTopups",{headers:{Referer:"https://mon-espace.izly.fr/","X-Requested-With":"XMLHttpRequest"}}),r=[],i=n.load(t.data);return i(".list-group-item").each(((e,t)=>{const n=i(t),a=n.find(".operation-type").text().split(" - ")[0]?.trim(),c=n.find(".operation-type").text().split(" - ")[1]?.trim(),l=s(n.find(".oeration-date").text().trim()," "),h=o(n.find(".operation-amount").text().trim()),p=n.find(".badge").text().trim();r.push({type:a,method:c,date:l,amount:h,status:p})})),r}(this.axiosInstance)}async generateQRCode(){return this.checkLogin(),async function(e,t=1){try{const r=await e.post("https://mon-espace.izly.fr/Home/CreateQrCodeImg",`numberOfQrCodes=${t}`,{headers:{Accept:"text/html, */*; q=0.01","X-Requested-With":"XMLHttpRequest","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Origin:"https://mon-espace.izly.fr",Referer:"https://mon-espace.izly.fr/Home/GenerateQRCode"}});if(200===r.status)return r.data;throw new Error("Failed to generate QR Code(s)")}catch(e){throw console.error("Error generating QR Code(s):",e.message),e}}(this.axiosInstance)}};module.exports=l;//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map index 2a2b1a1..1791ee1 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/utils/IzlyAmount.ts","../src/utils/IzlyDate.ts","../src/services/Balance.ts","../src/services/Deposits.ts","../src/services/Notifications.ts","../src/services/Profile.ts","../src/account/QRCodes.ts","../src/api/Authentification.ts","../src/index.ts"],"names":["cheerio","cheerio2","cheerio3","cheerio4","axios","cheerio5"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAAS,cAAc,MAAwB,EAAA;AACpD,EAAO,OAAA,UAAA,CAAW,MAAO,CAAA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,QAAU,EAAA;AAClB,MAAM,MAAA,IAAI,MAAM,oCAAoC,CAAA,CAAA;AAAA,KACtD;AAEA,IAAO,OAAA,cAAA,CAAe,KAAK,aAAa,CAAA,CAAA;AAAA,GAC1C;AAAA,EAEA,MAAM,WAAkC,GAAA;AACtC,IAAI,IAAA,CAAC,KAAK,QAAU,EAAA;AAClB,MAAM,MAAA,IAAI,MAAM,oCAAoC,CAAA,CAAA;AAAA,KACtD;AAEA,IAAO,OAAA,eAAA,CAAgB,KAAK,aAAa,CAAA,CAAA;AAAA,GAC3C;AAAA,EAEA,MAAM,cAAoC,GAAA;AACxC,IAAI,IAAA,CAAC,KAAK,QAAU,EAAA;AAClB,MAAM,MAAA,IAAI,MAAM,oCAAoC,CAAA,CAAA;AAAA,KACtD;AAEA,IAAO,OAAA,aAAA,CAAc,KAAK,aAAa,CAAA,CAAA;AAAA,GACzC;AACF,CAAA,CAAA;AAEA,IAAO,WAAQ,GAAA","file":"index.js","sourcesContent":["export function extractAmount(amount: string): number {\n return parseFloat(amount.replace(',', '.').replace('€', '').trim());\n}","export function extractDate(dateString: string, split: string = ' à '): Date {\n const [datePart, timePart] = dateString.split(split);\n const [day, month, year] = datePart.split('/');\n const [hour, minute] = timePart.split(':');\n\n const date = new Date(parseInt(year), parseInt(month) - 1, parseInt(day), parseInt(hour), parseInt(minute));\n\n return date;\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Balance } from '~/types/Balance';\nimport { extractAmount } from '~/utils/IzlyAmount';\nimport { extractDate } from '~/utils/IzlyDate';\n\nexport async function ServiceBalance(axiosInstance: AxiosInstance): Promise < Balance > {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/',{\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n }\n });\n\n const $ = cheerio.load(response.data);\n const balanceText = $('#balance').text().trim();\n const balance = extractAmount(balanceText);\n \n const balanceDate = $('.balance-heading-date').text().trim();\n const date = extractDate(balanceDate, ' à ');\n\n if (isNaN(balance)) {\n throw new Error('Failed to extract balance. Possible page structure change.');\n }\n\n return {\n date: date,\n amount: balance,\n };\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Deposit } from '../types/Deposit';\nimport { extractDate } from '~/utils/IzlyDate';\nimport { extractAmount } from '~/utils/IzlyAmount';\n\nexport async function ServiceDeposits(axiosInstance: AxiosInstance): Promise < Deposit[] > {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Home/GetTopups', {\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/',\n 'X-Requested-With': 'XMLHttpRequest',\n }\n });\n\n const deposits: Deposit[] = [];\n const $ = cheerio.load(response.data);\n $('.list-group-item').each((index, element) => {\n const $element = $(element);\n const type = $element.find('.operation-type').text().split(' - ')[0]?.trim();\n const method = $element.find('.operation-type').text().split(' - ')[1]?.trim();\n const date = extractDate($element.find('.oeration-date').text().trim(), ' ');\n const amount = extractAmount($element.find('.operation-amount').text().trim());\n const status = $element.find('.badge').text().trim();\n deposits.push({ type, method, date, amount, status });\n });\n\n return deposits;\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Notification } from '../types/Notification';\nimport { extractDate } from '~/utils/IzlyDate';\n\nexport async function ServiceNotifications(axiosInstance: AxiosInstance): Promise < Notification[] > {\n try {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Profile?page=1', {\n headers: {\n 'Accept': 'text/html, */*; q=0.01',\n 'X-Requested-With': 'XMLHttpRequest',\n 'Referer': 'https://mon-espace.izly.fr/Profile',\n },\n });\n\n if (response.status === 200) {\n const $ = cheerio.load(response.data);\n const notifications: Notification[] = [];\n\n $('.table-responsive .table tr').each((index, element) => {\n const $element = $(element);\n const date = extractDate($element.find('td:nth-child(2)').text().trim(), ' à ');\n const description = $element.find('td:nth-child(3)').text().trim();\n notifications.push({ date, description });\n });\n\n return notifications;\n } else {\n throw new Error('Failed to retrieve notifications');\n }\n } catch (error) {\n console.error('Error retrieving notifications:', (error as Error).message);\n throw error;\n }\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Profile } from '../types/Profile';\n\nexport async function ServiceProfile(axiosInstance: AxiosInstance): Promise {\n try {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Profile', {\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/',\n },\n });\n\n if (response.status === 200) {\n const $ = cheerio.load(response.data);\n\n const profile: Profile = {\n name: $('h1').first().text().trim(),\n identifier: $('.heading-label-value').eq(0).text().trim(),\n pseudo: $('.heading-label-value').eq(1).text().trim(),\n birthDate: $('.heading-label-value').eq(2).text().trim(),\n address: $('.addWay').text().trim() + ', ' + $('.addZipCode').text().trim() + ' ' + $('.addCity').text().trim(),\n primaryEmail: $('.rectangle').eq(1).text().trim(),\n secondaryEmail: $('#emailPersonnel').text().trim(),\n phoneNumber: $('#currentPhoneNumber').text().trim(),\n companyCode: $('.rectangle').eq(4).text().trim(),\n tariffCode: $('.rectangle').eq(5).text().trim(),\n crousRightsEndDate: $('.rectangle').eq(6).text().trim()\n };\n\n return profile;\n } else {\n throw new Error('Failed to retrieve profile information');\n }\n } catch (error) {\n console.error('Error retrieving profile information:', (error as Error).message);\n throw error;\n }\n}","import { AxiosInstance } from 'axios';\n\nexport async function RequestQRCode(axiosInstance: AxiosInstance, numberOfQRCodes: number = 1): Promise < string[] > {\n try {\n const response = await axiosInstance.post('https://mon-espace.izly.fr/Home/CreateQrCodeImg',\n `numberOfQrCodes=${numberOfQRCodes}`,\n {\n headers: {\n 'Accept': 'text/html, */*; q=0.01',\n 'X-Requested-With': 'XMLHttpRequest',\n 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n 'Origin': 'https://mon-espace.izly.fr',\n 'Referer': 'https://mon-espace.izly.fr/Home/GenerateQRCode',\n }\n }\n );\n\n if (response.status === 200) {\n return response.data as string[]; // This should be an array of base64-encoded QR code images\n } else {\n throw new Error('Failed to generate QR Code(s)');\n }\n } catch (error) {\n console.error('Error generating QR Code(s):', (error as Error).message);\n throw error;\n }\n}","import axios, { AxiosInstance, AxiosResponse, AxiosRequestConfig } from 'axios';\nimport * as cheerio from 'cheerio';\n\nclass LoginService {\n private axiosInstance: AxiosInstance;\n private cookies: string[];\n\n constructor() {\n this.axiosInstance = axios.create({\n withCredentials: true,\n maxRedirects: 0,\n validateStatus: () => true,\n headers: {\n 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',\n 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',\n 'Accept-Language': 'fr-FR,fr;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6,es;q=0.5',\n },\n });\n this.cookies = [];\n }\n\n private updateCookies(headers: Record): void {\n if (headers['set-cookie']) {\n const newCookies = Array.isArray(headers['set-cookie']) ? headers['set-cookie'] : [headers['set-cookie']];\n this.cookies = [...this.cookies, ...newCookies];\n this.axiosInstance.defaults.headers.Cookie = this.cookies.join('; ');\n }\n }\n\n private async makeRequest(method: string, url: string, data: string | null = null, additionalHeaders: Record = {}): Promise {\n const config: AxiosRequestConfig = {\n method,\n url,\n headers: {\n ...this.axiosInstance.defaults.headers,\n ...additionalHeaders,\n },\n data,\n };\n\n if (this.cookies.length > 0) {\n config.headers = config.headers || {};\n config.headers.Cookie = this.cookies.join('; ');\n }\n\n const response = await this.axiosInstance(config);\n this.updateCookies(response.headers);\n return response;\n }\n\n async login(username: string, password: string): Promise {\n try {\n // Step 1: Initial GET request to /Home/Logon\n let response = await this.makeRequest('GET', 'https://mon-espace.izly.fr/Home/Logon', null, {\n 'Referer': 'https://mon-espace.izly.fr/',\n });\n\n const $ = cheerio.load(response.data);\n const requestVerificationToken = $('input[name=\"__RequestVerificationToken\"]').val() as string;\n\n // Step 2: POST login request\n response = await this.makeRequest('POST', 'https://mon-espace.izly.fr/Home/Logon',\n `__RequestVerificationToken=${encodeURIComponent(requestVerificationToken)}&ReturnUrl=&Username=${encodeURIComponent(username)}&Password=${encodeURIComponent(password)}`,\n {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Origin': 'https://mon-espace.izly.fr',\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n }\n );\n\n // Check for redirect and follow it\n if (response.status === 302) {\n const redirectUrl = response.headers.location as string;\n response = await this.makeRequest('GET', `https://mon-espace.izly.fr${redirectUrl}`, null, {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n });\n }\n\n // Step 3: Check if we are logged in\n response = await this.makeRequest('GET', 'https://mon-espace.izly.fr/', null, {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n });\n\n if (response.status !== 200) {\n throw new Error('Failed to login');\n }\n\n return true;\n } catch (error) {\n console.error('Login error:', (error as Error).message);\n return false;\n }\n }\n\n getAxiosInstance(): AxiosInstance {\n return this.axiosInstance;\n }\n}\n\nexport default LoginService;","import { AxiosInstance } from 'axios';\n\nimport type { Deposit } from './types/Deposit';\nimport type { Notification } from './types/Notification';\nimport type { Profile } from './types/Profile';\n\nimport { ServiceBalance } from './services/Balance';\nimport { ServiceDeposits } from './services/Deposits';\nimport { ServiceNotifications } from './services/Notifications';\nimport { ServiceProfile } from './services/Profile';\n\nimport { RequestQRCode } from './account/QRCodes';\nimport LoginService from './api/Authentification';\nimport { Balance } from './types/Balance';\n\nclass Izly {\n private loginService: LoginService;\n private axiosInstance: AxiosInstance;\n private loggedIn: boolean;\n\n constructor() {\n this.loginService = new LoginService();\n this.axiosInstance = this.loginService.getAxiosInstance();\n this.loggedIn = false;\n }\n\n async login(username: string, password: string): Promise {\n try {\n this.loggedIn = await this.loginService.login(username, password);\n return this.loggedIn;\n } catch (error) {\n console.error('Login error:', (error as Error).message);\n return false;\n }\n }\n\n async getProfile(): Promise {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n\n return ServiceProfile(this.axiosInstance);\n }\n\n async getNotifications(): Promise {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n\n return ServiceNotifications(this.axiosInstance);\n }\n\n async getBalance(): Promise {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n\n return ServiceBalance(this.axiosInstance);\n }\n\n async getDeposits(): Promise {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n\n return ServiceDeposits(this.axiosInstance);\n }\n\n async generateQRCode(): Promise {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n\n return RequestQRCode(this.axiosInstance);\n }\n}\n\nexport default Izly;"]} \ No newline at end of file +{"version":3,"sources":["../src/utils/IzlyAmount.ts","../src/utils/IzlyDate.ts","../src/services/Balance.ts","../src/services/Deposits.ts","../src/services/Notifications.ts","../src/services/Profile.ts","../src/account/QRCodes.ts","../src/api/Authentification.ts","../src/index.ts"],"names":["cheerio","cheerio2","cheerio3","cheerio4","axios","cheerio5"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAAS,cAAc,MAAwB,EAAA;AACpD,EAAO,OAAA,UAAA,CAAW,MAAO,CAAA,OAAA,CAAQ,GAAK,EAAA,GAAG,CAAE,CAAA,OAAA,CAAQ,QAAK,EAAA,EAAE,CAAE,CAAA,IAAA,EAAM,CAAA,CAAA;AACpE,CAAA;;;ACFO,SAAS,WAAA,CAAY,UAAoB,EAAA,KAAA,GAAgB,QAAa,EAAA;AAC3E,EAAA,MAAM,CAAC,QAAU,EAAA,QAAQ,CAAI,GAAA,UAAA,CAAW,MAAM,KAAK,CAAA,CAAA;AACnD,EAAA,MAAM,CAAC,GAAK,EAAA,KAAA,EAAO,IAAI,CAAI,GAAA,QAAA,CAAS,MAAM,GAAG,CAAA,CAAA;AAC7C,EAAA,MAAM,CAAC,IAAM,EAAA,MAAM,CAAI,GAAA,QAAA,CAAS,MAAM,GAAG,CAAA,CAAA;A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A,CAAK,YAAa,CAAA,KAAA,CAAM,UAAU,QAAQ,CAAA,CAAA;AAChE,MAAA,OAAO,IAAK,CAAA,QAAA,CAAA;AAAA,aACL,KAAO,EAAA;AACd,MAAQ,OAAA,CAAA,KAAA,CAAM,cAAiB,EAAA,KAAA,CAAgB,OAAO,CAAA,CAAA;AACtD,MAAO,OAAA,KAAA,CAAA;AAAA,KACT;AAAA,GACF;AAAA,EAEQ,UAAa,GAAA;AACnB,IAAI,IAAA,CAAC,KAAK,QAAU,EAAA;AAClB,MAAM,MAAA,IAAI,MAAM,oCAAoC,CAAA,CAAA;AAAA,KACtD;AAAA,GACF;AAAA,EAEA,MAAM,UAA+B,GAAA;AACnC,IAAA,IAAA,CAAK,UAAW,EAAA,CAAA;AAChB,IAAO,OAAA,cAAA,CAAe,KAAK,aAAa,CAAA,CAAA;AAAA,GAC1C;AAAA,EAEA,MAAM,gBAA4C,GAAA;AAChD,IAAA,IAAA,CAAK,UAAW,EAAA,CAAA;AAChB,IAAO,OAAA,oBAAA,CAAqB,KAAK,aAAa,CAAA,CAAA;AAAA,GAChD;AAAA,EAEA,MAAM,UAA+B,GAAA;AACnC,IAAA,IAAA,CAAK,UAAW,EAAA,CAAA;AAChB,IAAO,OAAA,cAAA,CAAe,KAAK,aAAa,CAAA,CAAA;AAAA,GAC1C;AAAA,EAEA,MAAM,WAAkC,GAAA;AACtC,IAAA,IAAA,CAAK,UAAW,EAAA,CAAA;AAChB,IAAO,OAAA,eAAA,CAAgB,KAAK,aAAa,CAAA,CAAA;AAAA,GAC3C;AAAA,EAEA,MAAM,cAAoC,GAAA;AACxC,IAAA,IAAA,CAAK,UAAW,EAAA,CAAA;AAChB,IAAO,OAAA,aAAA,CAAc,KAAK,aAAa,CAAA,CAAA;AAAA,GACzC;AACF,CAAA,CAAA;AAEA,IAAO,WAAQ,GAAA","file":"index.js","sourcesContent":["export function extractAmount(amount: string): number {\n return parseFloat(amount.replace(',', '.').replace('€', '').trim());\n}","export function extractDate(dateString: string, split: string = ' à '): Date {\n const [datePart, timePart] = dateString.split(split);\n const [day, month, year] = datePart.split('/');\n const [hour, minute] = timePart.split(':');\n\n const date = new Date(parseInt(year), parseInt(month) - 1, parseInt(day), parseInt(hour), parseInt(minute));\n\n return date;\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Balance } from '~/types/Balance';\nimport { extractAmount } from '~/utils/IzlyAmount';\nimport { extractDate } from '~/utils/IzlyDate';\n\nexport async function ServiceBalance(axiosInstance: AxiosInstance): Promise < Balance > {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/',{\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n }\n });\n\n const $ = cheerio.load(response.data);\n const balanceText = $('#balance').text().trim();\n const balance = extractAmount(balanceText);\n \n const balanceDate = $('.balance-heading-date').text().trim();\n const date = extractDate(balanceDate, ' à ');\n\n if (isNaN(balance)) {\n throw new Error('Failed to extract balance. Possible page structure change.');\n }\n\n return {\n date: date,\n amount: balance,\n };\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Deposit } from '../types/Deposit';\nimport { extractDate } from '~/utils/IzlyDate';\nimport { extractAmount } from '~/utils/IzlyAmount';\n\nexport async function ServiceDeposits(axiosInstance: AxiosInstance): Promise < Deposit[] > {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Home/GetTopups', {\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/',\n 'X-Requested-With': 'XMLHttpRequest',\n }\n });\n\n const deposits: Deposit[] = [];\n const $ = cheerio.load(response.data);\n $('.list-group-item').each((index, element) => {\n const $element = $(element);\n const type = $element.find('.operation-type').text().split(' - ')[0]?.trim();\n const method = $element.find('.operation-type').text().split(' - ')[1]?.trim();\n const date = extractDate($element.find('.oeration-date').text().trim(), ' ');\n const amount = extractAmount($element.find('.operation-amount').text().trim());\n const status = $element.find('.badge').text().trim();\n deposits.push({ type, method, date, amount, status });\n });\n\n return deposits;\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Notification } from '../types/Notification';\nimport { extractDate } from '~/utils/IzlyDate';\n\nexport async function ServiceNotifications(axiosInstance: AxiosInstance): Promise < Notification[] > {\n try {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Profile?page=1', {\n headers: {\n 'Accept': 'text/html, */*; q=0.01',\n 'X-Requested-With': 'XMLHttpRequest',\n 'Referer': 'https://mon-espace.izly.fr/Profile',\n },\n });\n\n if (response.status === 200) {\n const $ = cheerio.load(response.data);\n const notifications: Notification[] = [];\n\n $('.table-responsive .table tr').each((index, element) => {\n const $element = $(element);\n const date = extractDate($element.find('td:nth-child(2)').text().trim(), ' à ');\n const description = $element.find('td:nth-child(3)').text().trim();\n notifications.push({ date, description });\n });\n\n return notifications;\n } else {\n throw new Error('Failed to retrieve notifications');\n }\n } catch (error) {\n console.error('Error retrieving notifications:', (error as Error).message);\n throw error;\n }\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Profile } from '../types/Profile';\n\nexport async function ServiceProfile(axiosInstance: AxiosInstance): Promise {\n try {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Profile', {\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/',\n },\n });\n\n if (response.status === 200) {\n const $ = cheerio.load(response.data);\n\n const profile: Profile = {\n name: $('h1').first().text().trim(),\n identifier: $('.heading-label-value').eq(0).text().trim(),\n pseudo: $('.heading-label-value').eq(1).text().trim(),\n birthDate: $('.heading-label-value').eq(2).text().trim(),\n address: $('.addWay').text().trim() + ', ' + $('.addZipCode').text().trim() + ' ' + $('.addCity').text().trim(),\n primaryEmail: $('.rectangle').eq(1).text().trim(),\n secondaryEmail: $('#emailPersonnel').text().trim(),\n phoneNumber: $('#currentPhoneNumber').text().trim(),\n companyCode: $('.rectangle').eq(4).text().trim(),\n tariffCode: $('.rectangle').eq(5).text().trim(),\n crousRightsEndDate: $('.rectangle').eq(6).text().trim()\n };\n\n return profile;\n } else {\n throw new Error('Failed to retrieve profile information');\n }\n } catch (error) {\n console.error('Error retrieving profile information:', (error as Error).message);\n throw error;\n }\n}","import { AxiosInstance } from 'axios';\n\nexport async function RequestQRCode(axiosInstance: AxiosInstance, numberOfQRCodes: number = 1): Promise < string[] > {\n try {\n const response = await axiosInstance.post('https://mon-espace.izly.fr/Home/CreateQrCodeImg',\n `numberOfQrCodes=${numberOfQRCodes}`,\n {\n headers: {\n 'Accept': 'text/html, */*; q=0.01',\n 'X-Requested-With': 'XMLHttpRequest',\n 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n 'Origin': 'https://mon-espace.izly.fr',\n 'Referer': 'https://mon-espace.izly.fr/Home/GenerateQRCode',\n }\n }\n );\n\n if (response.status === 200) {\n return response.data as string[]; // This should be an array of base64-encoded QR code images\n } else {\n throw new Error('Failed to generate QR Code(s)');\n }\n } catch (error) {\n console.error('Error generating QR Code(s):', (error as Error).message);\n throw error;\n }\n}","import axios, { AxiosInstance, AxiosResponse, AxiosRequestConfig } from 'axios';\nimport * as cheerio from 'cheerio';\n\nclass LoginService {\n private axiosInstance: AxiosInstance;\n private cookies: string[];\n\n constructor() {\n this.axiosInstance = axios.create({\n withCredentials: true,\n maxRedirects: 0,\n validateStatus: () => true,\n headers: {\n 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',\n 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',\n 'Accept-Language': 'fr-FR,fr;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6,es;q=0.5',\n },\n });\n this.cookies = [];\n }\n\n private updateCookies(headers: Record): void {\n if (headers['set-cookie']) {\n const newCookies = Array.isArray(headers['set-cookie']) ? headers['set-cookie'] : [headers['set-cookie']];\n this.cookies = [...this.cookies, ...newCookies];\n this.axiosInstance.defaults.headers.Cookie = this.cookies.join('; ');\n }\n }\n\n private async makeRequest(method: string, url: string, data: string | null = null, additionalHeaders: Record = {}): Promise {\n const config: AxiosRequestConfig = {\n method,\n url,\n headers: {\n ...this.axiosInstance.defaults.headers,\n ...additionalHeaders,\n },\n data,\n };\n\n if (this.cookies.length > 0) {\n config.headers = config.headers || {};\n config.headers.Cookie = this.cookies.join('; ');\n }\n\n const response = await this.axiosInstance(config);\n this.updateCookies(response.headers);\n return response;\n }\n\n async login(username: string, password: string): Promise {\n try {\n // Step 1: Initial GET request to /Home/Logon\n let response = await this.makeRequest('GET', 'https://mon-espace.izly.fr/Home/Logon', null, {\n 'Referer': 'https://mon-espace.izly.fr/',\n });\n\n const $ = cheerio.load(response.data);\n const requestVerificationToken = $('input[name=\"__RequestVerificationToken\"]').val() as string;\n\n // Step 2: POST login request\n response = await this.makeRequest('POST', 'https://mon-espace.izly.fr/Home/Logon',\n `__RequestVerificationToken=${encodeURIComponent(requestVerificationToken)}&ReturnUrl=&Username=${encodeURIComponent(username)}&Password=${encodeURIComponent(password)}`,\n {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Origin': 'https://mon-espace.izly.fr',\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n }\n );\n\n // Check for redirect and follow it\n if (response.status === 302) {\n const redirectUrl = response.headers.location as string;\n response = await this.makeRequest('GET', `https://mon-espace.izly.fr${redirectUrl}`, null, {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n });\n }\n\n // Step 3: Check if we are logged in\n response = await this.makeRequest('GET', 'https://mon-espace.izly.fr/', null, {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n });\n\n if (response.status !== 200) {\n throw new Error('Failed to login');\n }\n\n return true;\n } catch (error) {\n console.error('Login error:', (error as Error).message);\n return false;\n }\n }\n\n getAxiosInstance(): AxiosInstance {\n return this.axiosInstance;\n }\n}\n\nexport default LoginService;","import { AxiosInstance } from 'axios';\n\nimport type { Deposit } from './types/Deposit';\nimport type { Notification } from './types/Notification';\nimport type { Profile } from './types/Profile';\n\nimport { ServiceBalance } from './services/Balance';\nimport { ServiceDeposits } from './services/Deposits';\nimport { ServiceNotifications } from './services/Notifications';\nimport { ServiceProfile } from './services/Profile';\n\nimport { RequestQRCode } from './account/QRCodes';\nimport LoginService from './api/Authentification';\nimport { Balance } from './types/Balance';\nclass Izly {\n private loginService: LoginService;\n private axiosInstance: AxiosInstance;\n private loggedIn: boolean = false;\n\n constructor() {\n this.loginService = new LoginService();\n this.axiosInstance = this.loginService.getAxiosInstance();\n }\n\n async login(username: string, password: string): Promise {\n try {\n this.loggedIn = await this.loginService.login(username, password);\n return this.loggedIn;\n } catch (error) {\n console.error('Login error:', (error as Error).message);\n return false;\n }\n }\n\n private checkLogin() {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n }\n\n async getProfile(): Promise {\n this.checkLogin();\n return ServiceProfile(this.axiosInstance);\n }\n\n async getNotifications(): Promise {\n this.checkLogin();\n return ServiceNotifications(this.axiosInstance);\n }\n\n async getBalance(): Promise {\n this.checkLogin();\n return ServiceBalance(this.axiosInstance);\n }\n\n async getDeposits(): Promise {\n this.checkLogin();\n return ServiceDeposits(this.axiosInstance);\n }\n\n async generateQRCode(): Promise {\n this.checkLogin();\n return RequestQRCode(this.axiosInstance);\n }\n}\n\nexport default Izly;"]} \ No newline at end of file diff --git a/dist/index.mjs b/dist/index.mjs index 9c7d05d..6d02686 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -1 +1 @@ -import*as e from"cheerio";import t from"axios";function r(e){return parseFloat(e.replace(",",".").replace("€","").trim())}function o(e,t=" à "){const[r,o]=e.split(t),[i,a,n]=r.split("/"),[s,c]=o.split(":");return new Date(parseInt(n),parseInt(a)-1,parseInt(i),parseInt(s),parseInt(c))}var i=class{axiosInstance;cookies;constructor(){this.axiosInstance=t.create({withCredentials:!0,maxRedirects:0,validateStatus:()=>!0,headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","Accept-Language":"fr-FR,fr;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6,es;q=0.5"}}),this.cookies=[]}updateCookies(e){if(e["set-cookie"]){const t=Array.isArray(e["set-cookie"])?e["set-cookie"]:[e["set-cookie"]];this.cookies=[...this.cookies,...t],this.axiosInstance.defaults.headers.Cookie=this.cookies.join("; ")}}async makeRequest(e,t,r=null,o={}){const i={method:e,url:t,headers:{...this.axiosInstance.defaults.headers,...o},data:r};this.cookies.length>0&&(i.headers=i.headers||{},i.headers.Cookie=this.cookies.join("; "));const a=await this.axiosInstance(i);return this.updateCookies(a.headers),a}async login(t,r){try{let o=await this.makeRequest("GET","https://mon-espace.izly.fr/Home/Logon",null,{Referer:"https://mon-espace.izly.fr/"});const i=e.load(o.data)('input[name="__RequestVerificationToken"]').val();if(o=await this.makeRequest("POST","https://mon-espace.izly.fr/Home/Logon",`__RequestVerificationToken=${encodeURIComponent(i)}&ReturnUrl=&Username=${encodeURIComponent(t)}&Password=${encodeURIComponent(r)}`,{"Content-Type":"application/x-www-form-urlencoded",Origin:"https://mon-espace.izly.fr",Referer:"https://mon-espace.izly.fr/Home/Logon"}),302===o.status){const e=o.headers.location;o=await this.makeRequest("GET",`https://mon-espace.izly.fr${e}`,null,{Referer:"https://mon-espace.izly.fr/Home/Logon"})}if(o=await this.makeRequest("GET","https://mon-espace.izly.fr/",null,{Referer:"https://mon-espace.izly.fr/Home/Logon"}),200!==o.status)throw new Error("Failed to login");return!0}catch(e){return console.error("Login error:",e.message),!1}}getAxiosInstance(){return this.axiosInstance}},a=class{loginService;axiosInstance;loggedIn;constructor(){this.loginService=new i,this.axiosInstance=this.loginService.getAxiosInstance(),this.loggedIn=!1}async login(e,t){try{return this.loggedIn=await this.loginService.login(e,t),this.loggedIn}catch(e){return console.error("Login error:",e.message),!1}}async getProfile(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.");return async function(t){try{const r=await t.get("https://mon-espace.izly.fr/Profile",{headers:{Referer:"https://mon-espace.izly.fr/"}});if(200===r.status){const t=e.load(r.data);return{name:t("h1").first().text().trim(),identifier:t(".heading-label-value").eq(0).text().trim(),pseudo:t(".heading-label-value").eq(1).text().trim(),birthDate:t(".heading-label-value").eq(2).text().trim(),address:t(".addWay").text().trim()+", "+t(".addZipCode").text().trim()+" "+t(".addCity").text().trim(),primaryEmail:t(".rectangle").eq(1).text().trim(),secondaryEmail:t("#emailPersonnel").text().trim(),phoneNumber:t("#currentPhoneNumber").text().trim(),companyCode:t(".rectangle").eq(4).text().trim(),tariffCode:t(".rectangle").eq(5).text().trim(),crousRightsEndDate:t(".rectangle").eq(6).text().trim()}}throw new Error("Failed to retrieve profile information")}catch(e){throw console.error("Error retrieving profile information:",e.message),e}}(this.axiosInstance)}async getNotifications(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.");return async function(t){try{const r=await t.get("https://mon-espace.izly.fr/Profile?page=1",{headers:{Accept:"text/html, */*; q=0.01","X-Requested-With":"XMLHttpRequest",Referer:"https://mon-espace.izly.fr/Profile"}});if(200===r.status){const t=e.load(r.data),i=[];return t(".table-responsive .table tr").each(((e,r)=>{const a=t(r),n=o(a.find("td:nth-child(2)").text().trim()," à "),s=a.find("td:nth-child(3)").text().trim();i.push({date:n,description:s})})),i}throw new Error("Failed to retrieve notifications")}catch(e){throw console.error("Error retrieving notifications:",e.message),e}}(this.axiosInstance)}async getBalance(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.");return async function(t){const i=await t.get("https://mon-espace.izly.fr/",{headers:{Referer:"https://mon-espace.izly.fr/Home/Logon"}}),a=e.load(i.data),n=r(a("#balance").text().trim()),s=o(a(".balance-heading-date").text().trim()," à ");if(isNaN(n))throw new Error("Failed to extract balance. Possible page structure change.");return{date:s,amount:n}}(this.axiosInstance)}async getDeposits(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.");return async function(t){const i=await t.get("https://mon-espace.izly.fr/Home/GetTopups",{headers:{Referer:"https://mon-espace.izly.fr/","X-Requested-With":"XMLHttpRequest"}}),a=[],n=e.load(i.data);return n(".list-group-item").each(((e,t)=>{const i=n(t),s=i.find(".operation-type").text().split(" - ")[0]?.trim(),c=i.find(".operation-type").text().split(" - ")[1]?.trim(),l=o(i.find(".oeration-date").text().trim()," "),h=r(i.find(".operation-amount").text().trim()),d=i.find(".badge").text().trim();a.push({type:s,method:c,date:l,amount:h,status:d})})),a}(this.axiosInstance)}async generateQRCode(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.");return async function(e,t=1){try{const r=await e.post("https://mon-espace.izly.fr/Home/CreateQrCodeImg",`numberOfQrCodes=${t}`,{headers:{Accept:"text/html, */*; q=0.01","X-Requested-With":"XMLHttpRequest","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Origin:"https://mon-espace.izly.fr",Referer:"https://mon-espace.izly.fr/Home/GenerateQRCode"}});if(200===r.status)return r.data;throw new Error("Failed to generate QR Code(s)")}catch(e){throw console.error("Error generating QR Code(s):",e.message),e}}(this.axiosInstance)}};export{a as default};//# sourceMappingURL=index.mjs.map \ No newline at end of file +import*as e from"cheerio";import t from"axios";function r(e){return parseFloat(e.replace(",",".").replace("€","").trim())}function i(e,t=" à "){const[r,i]=e.split(t),[o,a,n]=r.split("/"),[s,c]=i.split(":");return new Date(parseInt(n),parseInt(a)-1,parseInt(o),parseInt(s),parseInt(c))}var o=class{axiosInstance;cookies;constructor(){this.axiosInstance=t.create({withCredentials:!0,maxRedirects:0,validateStatus:()=>!0,headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",Accept:"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7","Accept-Language":"fr-FR,fr;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6,es;q=0.5"}}),this.cookies=[]}updateCookies(e){if(e["set-cookie"]){const t=Array.isArray(e["set-cookie"])?e["set-cookie"]:[e["set-cookie"]];this.cookies=[...this.cookies,...t],this.axiosInstance.defaults.headers.Cookie=this.cookies.join("; ")}}async makeRequest(e,t,r=null,i={}){const o={method:e,url:t,headers:{...this.axiosInstance.defaults.headers,...i},data:r};this.cookies.length>0&&(o.headers=o.headers||{},o.headers.Cookie=this.cookies.join("; "));const a=await this.axiosInstance(o);return this.updateCookies(a.headers),a}async login(t,r){try{let i=await this.makeRequest("GET","https://mon-espace.izly.fr/Home/Logon",null,{Referer:"https://mon-espace.izly.fr/"});const o=e.load(i.data)('input[name="__RequestVerificationToken"]').val();if(i=await this.makeRequest("POST","https://mon-espace.izly.fr/Home/Logon",`__RequestVerificationToken=${encodeURIComponent(o)}&ReturnUrl=&Username=${encodeURIComponent(t)}&Password=${encodeURIComponent(r)}`,{"Content-Type":"application/x-www-form-urlencoded",Origin:"https://mon-espace.izly.fr",Referer:"https://mon-espace.izly.fr/Home/Logon"}),302===i.status){const e=i.headers.location;i=await this.makeRequest("GET",`https://mon-espace.izly.fr${e}`,null,{Referer:"https://mon-espace.izly.fr/Home/Logon"})}if(i=await this.makeRequest("GET","https://mon-espace.izly.fr/",null,{Referer:"https://mon-espace.izly.fr/Home/Logon"}),200!==i.status)throw new Error("Failed to login");return!0}catch(e){return console.error("Login error:",e.message),!1}}getAxiosInstance(){return this.axiosInstance}},a=class{loginService;axiosInstance;loggedIn=!1;constructor(){this.loginService=new o,this.axiosInstance=this.loginService.getAxiosInstance()}async login(e,t){try{return this.loggedIn=await this.loginService.login(e,t),this.loggedIn}catch(e){return console.error("Login error:",e.message),!1}}checkLogin(){if(!this.loggedIn)throw new Error("Not logged in. Please login first.")}async getProfile(){return this.checkLogin(),async function(t){try{const r=await t.get("https://mon-espace.izly.fr/Profile",{headers:{Referer:"https://mon-espace.izly.fr/"}});if(200===r.status){const t=e.load(r.data);return{name:t("h1").first().text().trim(),identifier:t(".heading-label-value").eq(0).text().trim(),pseudo:t(".heading-label-value").eq(1).text().trim(),birthDate:t(".heading-label-value").eq(2).text().trim(),address:t(".addWay").text().trim()+", "+t(".addZipCode").text().trim()+" "+t(".addCity").text().trim(),primaryEmail:t(".rectangle").eq(1).text().trim(),secondaryEmail:t("#emailPersonnel").text().trim(),phoneNumber:t("#currentPhoneNumber").text().trim(),companyCode:t(".rectangle").eq(4).text().trim(),tariffCode:t(".rectangle").eq(5).text().trim(),crousRightsEndDate:t(".rectangle").eq(6).text().trim()}}throw new Error("Failed to retrieve profile information")}catch(e){throw console.error("Error retrieving profile information:",e.message),e}}(this.axiosInstance)}async getNotifications(){return this.checkLogin(),async function(t){try{const r=await t.get("https://mon-espace.izly.fr/Profile?page=1",{headers:{Accept:"text/html, */*; q=0.01","X-Requested-With":"XMLHttpRequest",Referer:"https://mon-espace.izly.fr/Profile"}});if(200===r.status){const t=e.load(r.data),o=[];return t(".table-responsive .table tr").each(((e,r)=>{const a=t(r),n=i(a.find("td:nth-child(2)").text().trim()," à "),s=a.find("td:nth-child(3)").text().trim();o.push({date:n,description:s})})),o}throw new Error("Failed to retrieve notifications")}catch(e){throw console.error("Error retrieving notifications:",e.message),e}}(this.axiosInstance)}async getBalance(){return this.checkLogin(),async function(t){const o=await t.get("https://mon-espace.izly.fr/",{headers:{Referer:"https://mon-espace.izly.fr/Home/Logon"}}),a=e.load(o.data),n=r(a("#balance").text().trim()),s=i(a(".balance-heading-date").text().trim()," à ");if(isNaN(n))throw new Error("Failed to extract balance. Possible page structure change.");return{date:s,amount:n}}(this.axiosInstance)}async getDeposits(){return this.checkLogin(),async function(t){const o=await t.get("https://mon-espace.izly.fr/Home/GetTopups",{headers:{Referer:"https://mon-espace.izly.fr/","X-Requested-With":"XMLHttpRequest"}}),a=[],n=e.load(o.data);return n(".list-group-item").each(((e,t)=>{const o=n(t),s=o.find(".operation-type").text().split(" - ")[0]?.trim(),c=o.find(".operation-type").text().split(" - ")[1]?.trim(),l=i(o.find(".oeration-date").text().trim()," "),h=r(o.find(".operation-amount").text().trim()),p=o.find(".badge").text().trim();a.push({type:s,method:c,date:l,amount:h,status:p})})),a}(this.axiosInstance)}async generateQRCode(){return this.checkLogin(),async function(e,t=1){try{const r=await e.post("https://mon-espace.izly.fr/Home/CreateQrCodeImg",`numberOfQrCodes=${t}`,{headers:{Accept:"text/html, */*; q=0.01","X-Requested-With":"XMLHttpRequest","Content-Type":"application/x-www-form-urlencoded; charset=UTF-8",Origin:"https://mon-espace.izly.fr",Referer:"https://mon-espace.izly.fr/Home/GenerateQRCode"}});if(200===r.status)return r.data;throw new Error("Failed to generate QR Code(s)")}catch(e){throw console.error("Error generating QR Code(s):",e.message),e}}(this.axiosInstance)}};export{a as default};//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/dist/index.mjs.map b/dist/index.mjs.map index afb6f08..22bd401 100644 --- a/dist/index.mjs.map +++ b/dist/index.mjs.map @@ -1 +1 @@ -{"version":3,"sources":["../src/utils/IzlyAmount.ts","../src/utils/IzlyDate.ts","../src/services/Balance.ts","../src/services/Deposits.ts","../src/services/Notifications.ts","../src/services/Profile.ts","../src/account/QRCodes.ts","../src/api/Authentification.ts","../src/index.ts"],"names":["cheerio2","cheerio3","cheerio4","cheerio5"],"mappings":";;;;;;AAAO,SAAS,cAAc,MAAwB,EAAA;AACpD,EAAO,OAAA,UAAA,CAAW,MAAO,CAAA,OAAA,CAAQ,GAAK,EAAA,GAAG,CAAE,CAAA,OAAA,CAAQ,QAAK,EAAA,EAAE,CAAE,CAAA,IAAA,EAAM,CAAA,CAAA;AACpE,CAAA;;;ACFO,SAAS,WAAA,CAAY,UAAoB,EAAA,KAAA,GAAgB,QAAa,EAAA;AAC3E,EAAA,MAAM,CAAC,QAAU,EAAA,QAAQ,CAAI,GAA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C,CAAA,CAAA;AAAA,KACtD;AAEA,IAAO,OAAA,eAAA,CAAgB,KAAK,aAAa,CAAA,CAAA;AAAA,GAC3C;AAAA,EAEA,MAAM,cAAoC,GAAA;AACxC,IAAI,IAAA,CAAC,KAAK,QAAU,EAAA;AAClB,MAAM,MAAA,IAAI,MAAM,oCAAoC,CAAA,CAAA;AAAA,KACtD;AAEA,IAAO,OAAA,aAAA,CAAc,KAAK,aAAa,CAAA,CAAA;AAAA,GACzC;AACF,CAAA,CAAA;AAEA,IAAO,WAAQ,GAAA","file":"index.mjs","sourcesContent":["export function extractAmount(amount: string): number {\n return parseFloat(amount.replace(',', '.').replace('€', '').trim());\n}","export function extractDate(dateString: string, split: string = ' à '): Date {\n const [datePart, timePart] = dateString.split(split);\n const [day, month, year] = datePart.split('/');\n const [hour, minute] = timePart.split(':');\n\n const date = new Date(parseInt(year), parseInt(month) - 1, parseInt(day), parseInt(hour), parseInt(minute));\n\n return date;\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Balance } from '~/types/Balance';\nimport { extractAmount } from '~/utils/IzlyAmount';\nimport { extractDate } from '~/utils/IzlyDate';\n\nexport async function ServiceBalance(axiosInstance: AxiosInstance): Promise < Balance > {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/',{\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n }\n });\n\n const $ = cheerio.load(response.data);\n const balanceText = $('#balance').text().trim();\n const balance = extractAmount(balanceText);\n \n const balanceDate = $('.balance-heading-date').text().trim();\n const date = extractDate(balanceDate, ' à ');\n\n if (isNaN(balance)) {\n throw new Error('Failed to extract balance. Possible page structure change.');\n }\n\n return {\n date: date,\n amount: balance,\n };\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Deposit } from '../types/Deposit';\nimport { extractDate } from '~/utils/IzlyDate';\nimport { extractAmount } from '~/utils/IzlyAmount';\n\nexport async function ServiceDeposits(axiosInstance: AxiosInstance): Promise < Deposit[] > {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Home/GetTopups', {\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/',\n 'X-Requested-With': 'XMLHttpRequest',\n }\n });\n\n const deposits: Deposit[] = [];\n const $ = cheerio.load(response.data);\n $('.list-group-item').each((index, element) => {\n const $element = $(element);\n const type = $element.find('.operation-type').text().split(' - ')[0]?.trim();\n const method = $element.find('.operation-type').text().split(' - ')[1]?.trim();\n const date = extractDate($element.find('.oeration-date').text().trim(), ' ');\n const amount = extractAmount($element.find('.operation-amount').text().trim());\n const status = $element.find('.badge').text().trim();\n deposits.push({ type, method, date, amount, status });\n });\n\n return deposits;\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Notification } from '../types/Notification';\nimport { extractDate } from '~/utils/IzlyDate';\n\nexport async function ServiceNotifications(axiosInstance: AxiosInstance): Promise < Notification[] > {\n try {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Profile?page=1', {\n headers: {\n 'Accept': 'text/html, */*; q=0.01',\n 'X-Requested-With': 'XMLHttpRequest',\n 'Referer': 'https://mon-espace.izly.fr/Profile',\n },\n });\n\n if (response.status === 200) {\n const $ = cheerio.load(response.data);\n const notifications: Notification[] = [];\n\n $('.table-responsive .table tr').each((index, element) => {\n const $element = $(element);\n const date = extractDate($element.find('td:nth-child(2)').text().trim(), ' à ');\n const description = $element.find('td:nth-child(3)').text().trim();\n notifications.push({ date, description });\n });\n\n return notifications;\n } else {\n throw new Error('Failed to retrieve notifications');\n }\n } catch (error) {\n console.error('Error retrieving notifications:', (error as Error).message);\n throw error;\n }\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Profile } from '../types/Profile';\n\nexport async function ServiceProfile(axiosInstance: AxiosInstance): Promise {\n try {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Profile', {\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/',\n },\n });\n\n if (response.status === 200) {\n const $ = cheerio.load(response.data);\n\n const profile: Profile = {\n name: $('h1').first().text().trim(),\n identifier: $('.heading-label-value').eq(0).text().trim(),\n pseudo: $('.heading-label-value').eq(1).text().trim(),\n birthDate: $('.heading-label-value').eq(2).text().trim(),\n address: $('.addWay').text().trim() + ', ' + $('.addZipCode').text().trim() + ' ' + $('.addCity').text().trim(),\n primaryEmail: $('.rectangle').eq(1).text().trim(),\n secondaryEmail: $('#emailPersonnel').text().trim(),\n phoneNumber: $('#currentPhoneNumber').text().trim(),\n companyCode: $('.rectangle').eq(4).text().trim(),\n tariffCode: $('.rectangle').eq(5).text().trim(),\n crousRightsEndDate: $('.rectangle').eq(6).text().trim()\n };\n\n return profile;\n } else {\n throw new Error('Failed to retrieve profile information');\n }\n } catch (error) {\n console.error('Error retrieving profile information:', (error as Error).message);\n throw error;\n }\n}","import { AxiosInstance } from 'axios';\n\nexport async function RequestQRCode(axiosInstance: AxiosInstance, numberOfQRCodes: number = 1): Promise < string[] > {\n try {\n const response = await axiosInstance.post('https://mon-espace.izly.fr/Home/CreateQrCodeImg',\n `numberOfQrCodes=${numberOfQRCodes}`,\n {\n headers: {\n 'Accept': 'text/html, */*; q=0.01',\n 'X-Requested-With': 'XMLHttpRequest',\n 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n 'Origin': 'https://mon-espace.izly.fr',\n 'Referer': 'https://mon-espace.izly.fr/Home/GenerateQRCode',\n }\n }\n );\n\n if (response.status === 200) {\n return response.data as string[]; // This should be an array of base64-encoded QR code images\n } else {\n throw new Error('Failed to generate QR Code(s)');\n }\n } catch (error) {\n console.error('Error generating QR Code(s):', (error as Error).message);\n throw error;\n }\n}","import axios, { AxiosInstance, AxiosResponse, AxiosRequestConfig } from 'axios';\nimport * as cheerio from 'cheerio';\n\nclass LoginService {\n private axiosInstance: AxiosInstance;\n private cookies: string[];\n\n constructor() {\n this.axiosInstance = axios.create({\n withCredentials: true,\n maxRedirects: 0,\n validateStatus: () => true,\n headers: {\n 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',\n 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',\n 'Accept-Language': 'fr-FR,fr;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6,es;q=0.5',\n },\n });\n this.cookies = [];\n }\n\n private updateCookies(headers: Record): void {\n if (headers['set-cookie']) {\n const newCookies = Array.isArray(headers['set-cookie']) ? headers['set-cookie'] : [headers['set-cookie']];\n this.cookies = [...this.cookies, ...newCookies];\n this.axiosInstance.defaults.headers.Cookie = this.cookies.join('; ');\n }\n }\n\n private async makeRequest(method: string, url: string, data: string | null = null, additionalHeaders: Record = {}): Promise {\n const config: AxiosRequestConfig = {\n method,\n url,\n headers: {\n ...this.axiosInstance.defaults.headers,\n ...additionalHeaders,\n },\n data,\n };\n\n if (this.cookies.length > 0) {\n config.headers = config.headers || {};\n config.headers.Cookie = this.cookies.join('; ');\n }\n\n const response = await this.axiosInstance(config);\n this.updateCookies(response.headers);\n return response;\n }\n\n async login(username: string, password: string): Promise {\n try {\n // Step 1: Initial GET request to /Home/Logon\n let response = await this.makeRequest('GET', 'https://mon-espace.izly.fr/Home/Logon', null, {\n 'Referer': 'https://mon-espace.izly.fr/',\n });\n\n const $ = cheerio.load(response.data);\n const requestVerificationToken = $('input[name=\"__RequestVerificationToken\"]').val() as string;\n\n // Step 2: POST login request\n response = await this.makeRequest('POST', 'https://mon-espace.izly.fr/Home/Logon',\n `__RequestVerificationToken=${encodeURIComponent(requestVerificationToken)}&ReturnUrl=&Username=${encodeURIComponent(username)}&Password=${encodeURIComponent(password)}`,\n {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Origin': 'https://mon-espace.izly.fr',\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n }\n );\n\n // Check for redirect and follow it\n if (response.status === 302) {\n const redirectUrl = response.headers.location as string;\n response = await this.makeRequest('GET', `https://mon-espace.izly.fr${redirectUrl}`, null, {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n });\n }\n\n // Step 3: Check if we are logged in\n response = await this.makeRequest('GET', 'https://mon-espace.izly.fr/', null, {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n });\n\n if (response.status !== 200) {\n throw new Error('Failed to login');\n }\n\n return true;\n } catch (error) {\n console.error('Login error:', (error as Error).message);\n return false;\n }\n }\n\n getAxiosInstance(): AxiosInstance {\n return this.axiosInstance;\n }\n}\n\nexport default LoginService;","import { AxiosInstance } from 'axios';\n\nimport type { Deposit } from './types/Deposit';\nimport type { Notification } from './types/Notification';\nimport type { Profile } from './types/Profile';\n\nimport { ServiceBalance } from './services/Balance';\nimport { ServiceDeposits } from './services/Deposits';\nimport { ServiceNotifications } from './services/Notifications';\nimport { ServiceProfile } from './services/Profile';\n\nimport { RequestQRCode } from './account/QRCodes';\nimport LoginService from './api/Authentification';\nimport { Balance } from './types/Balance';\n\nclass Izly {\n private loginService: LoginService;\n private axiosInstance: AxiosInstance;\n private loggedIn: boolean;\n\n constructor() {\n this.loginService = new LoginService();\n this.axiosInstance = this.loginService.getAxiosInstance();\n this.loggedIn = false;\n }\n\n async login(username: string, password: string): Promise {\n try {\n this.loggedIn = await this.loginService.login(username, password);\n return this.loggedIn;\n } catch (error) {\n console.error('Login error:', (error as Error).message);\n return false;\n }\n }\n\n async getProfile(): Promise {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n\n return ServiceProfile(this.axiosInstance);\n }\n\n async getNotifications(): Promise {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n\n return ServiceNotifications(this.axiosInstance);\n }\n\n async getBalance(): Promise {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n\n return ServiceBalance(this.axiosInstance);\n }\n\n async getDeposits(): Promise {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n\n return ServiceDeposits(this.axiosInstance);\n }\n\n async generateQRCode(): Promise {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n\n return RequestQRCode(this.axiosInstance);\n }\n}\n\nexport default Izly;"]} \ No newline at end of file +{"version":3,"sources":["../src/utils/IzlyAmount.ts","../src/utils/IzlyDate.ts","../src/services/Balance.ts","../src/services/Deposits.ts","../src/services/Notifications.ts","../src/services/Profile.ts","../src/account/QRCodes.ts","../src/api/Authentification.ts","../src/index.ts"],"names":["cheerio2","cheerio3","cheerio4","cheerio5"],"mappings":";;;;;;AAAO,SAAS,cAAc,MAAwB,EAAA;AACpD,EAAO,OAAA,UAAA,CAAW,MAAO,CAAA,OAAA,CAAQ,GAAK,EAAA,GAAG,CAAE,CAAA,OAAA,CAAQ,QAAK,EAAA,EAAE,CAAE,CAAA,IAAA,EAAM,CAAA,CAAA;AACpE,CAAA;;;ACFO,SAAS,WAAA,CAAY,UAAoB,EAAA,KAAA,GAAgB,QAAa,EAAA;AAC3E,EAAA,MAAM,CAAC,QAAU,EAAA,QAAQ,CAAI,GAAA,UAAA,CAAW,MAAM,KAAK,CAAA,CAAA;AACnD,EAAA,MAAM,CAAC,GAAK,EAAA,KAAA,EAAO,IAAI,CAAI,GAAA,QAAA,CAAS,MAAM,GAAG,CAAA,CAAA;AAC7C,EAAA,MAAM,CAAC,IAAM,EAAA,MAAM,CAAI,GAAA,QAAA,CAAS,MAAM,GAAG,CAAA,CAAA;AAEzC,EAAA,MAAM,OAAO,IAAI,IAAA,CAAK,SAAS,IAAI,CAAA,EAAG,SAAS,KAAK,CAAA,GAAI,CAAG,EAAA,QAAA,CAAS,GAAG,CAAG,EAAA,QAAA,CAAS,IAAI,CAAG,EAAA,QAAA,CAAS,MAAM,CAAC,CAAA,CAAA;AAE1G,EAAO,OAAA,IAAA,CAAA;AACT,CAAA;;;ACFA,eAAsB,eAAe,aAAmD,EAAA;AACtF,EAAA,MA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AAC,KAAK,QAAU,EAAA;AAClB,MAAM,MAAA,IAAI,MAAM,oCAAoC,CAAA,CAAA;AAAA,KACtD;AAAA,GACF;AAAA,EAEA,MAAM,UAA+B,GAAA;AACnC,IAAA,IAAA,CAAK,UAAW,EAAA,CAAA;AAChB,IAAO,OAAA,cAAA,CAAe,KAAK,aAAa,CAAA,CAAA;AAAA,GAC1C;AAAA,EAEA,MAAM,gBAA4C,GAAA;AAChD,IAAA,IAAA,CAAK,UAAW,EAAA,CAAA;AAChB,IAAO,OAAA,oBAAA,CAAqB,KAAK,aAAa,CAAA,CAAA;AAAA,GAChD;AAAA,EAEA,MAAM,UAA+B,GAAA;AACnC,IAAA,IAAA,CAAK,UAAW,EAAA,CAAA;AAChB,IAAO,OAAA,cAAA,CAAe,KAAK,aAAa,CAAA,CAAA;AAAA,GAC1C;AAAA,EAEA,MAAM,WAAkC,GAAA;AACtC,IAAA,IAAA,CAAK,UAAW,EAAA,CAAA;AAChB,IAAO,OAAA,eAAA,CAAgB,KAAK,aAAa,CAAA,CAAA;AAAA,GAC3C;AAAA,EAEA,MAAM,cAAoC,GAAA;AACxC,IAAA,IAAA,CAAK,UAAW,EAAA,CAAA;AAChB,IAAO,OAAA,aAAA,CAAc,KAAK,aAAa,CAAA,CAAA;AAAA,GACzC;AACF,CAAA,CAAA;AAEA,IAAO,WAAQ,GAAA","file":"index.mjs","sourcesContent":["export function extractAmount(amount: string): number {\n return parseFloat(amount.replace(',', '.').replace('€', '').trim());\n}","export function extractDate(dateString: string, split: string = ' à '): Date {\n const [datePart, timePart] = dateString.split(split);\n const [day, month, year] = datePart.split('/');\n const [hour, minute] = timePart.split(':');\n\n const date = new Date(parseInt(year), parseInt(month) - 1, parseInt(day), parseInt(hour), parseInt(minute));\n\n return date;\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Balance } from '~/types/Balance';\nimport { extractAmount } from '~/utils/IzlyAmount';\nimport { extractDate } from '~/utils/IzlyDate';\n\nexport async function ServiceBalance(axiosInstance: AxiosInstance): Promise < Balance > {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/',{\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n }\n });\n\n const $ = cheerio.load(response.data);\n const balanceText = $('#balance').text().trim();\n const balance = extractAmount(balanceText);\n \n const balanceDate = $('.balance-heading-date').text().trim();\n const date = extractDate(balanceDate, ' à ');\n\n if (isNaN(balance)) {\n throw new Error('Failed to extract balance. Possible page structure change.');\n }\n\n return {\n date: date,\n amount: balance,\n };\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Deposit } from '../types/Deposit';\nimport { extractDate } from '~/utils/IzlyDate';\nimport { extractAmount } from '~/utils/IzlyAmount';\n\nexport async function ServiceDeposits(axiosInstance: AxiosInstance): Promise < Deposit[] > {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Home/GetTopups', {\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/',\n 'X-Requested-With': 'XMLHttpRequest',\n }\n });\n\n const deposits: Deposit[] = [];\n const $ = cheerio.load(response.data);\n $('.list-group-item').each((index, element) => {\n const $element = $(element);\n const type = $element.find('.operation-type').text().split(' - ')[0]?.trim();\n const method = $element.find('.operation-type').text().split(' - ')[1]?.trim();\n const date = extractDate($element.find('.oeration-date').text().trim(), ' ');\n const amount = extractAmount($element.find('.operation-amount').text().trim());\n const status = $element.find('.badge').text().trim();\n deposits.push({ type, method, date, amount, status });\n });\n\n return deposits;\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Notification } from '../types/Notification';\nimport { extractDate } from '~/utils/IzlyDate';\n\nexport async function ServiceNotifications(axiosInstance: AxiosInstance): Promise < Notification[] > {\n try {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Profile?page=1', {\n headers: {\n 'Accept': 'text/html, */*; q=0.01',\n 'X-Requested-With': 'XMLHttpRequest',\n 'Referer': 'https://mon-espace.izly.fr/Profile',\n },\n });\n\n if (response.status === 200) {\n const $ = cheerio.load(response.data);\n const notifications: Notification[] = [];\n\n $('.table-responsive .table tr').each((index, element) => {\n const $element = $(element);\n const date = extractDate($element.find('td:nth-child(2)').text().trim(), ' à ');\n const description = $element.find('td:nth-child(3)').text().trim();\n notifications.push({ date, description });\n });\n\n return notifications;\n } else {\n throw new Error('Failed to retrieve notifications');\n }\n } catch (error) {\n console.error('Error retrieving notifications:', (error as Error).message);\n throw error;\n }\n}","import { AxiosInstance } from 'axios';\nimport * as cheerio from 'cheerio';\nimport { Profile } from '../types/Profile';\n\nexport async function ServiceProfile(axiosInstance: AxiosInstance): Promise {\n try {\n const response = await axiosInstance.get('https://mon-espace.izly.fr/Profile', {\n headers: {\n 'Referer': 'https://mon-espace.izly.fr/',\n },\n });\n\n if (response.status === 200) {\n const $ = cheerio.load(response.data);\n\n const profile: Profile = {\n name: $('h1').first().text().trim(),\n identifier: $('.heading-label-value').eq(0).text().trim(),\n pseudo: $('.heading-label-value').eq(1).text().trim(),\n birthDate: $('.heading-label-value').eq(2).text().trim(),\n address: $('.addWay').text().trim() + ', ' + $('.addZipCode').text().trim() + ' ' + $('.addCity').text().trim(),\n primaryEmail: $('.rectangle').eq(1).text().trim(),\n secondaryEmail: $('#emailPersonnel').text().trim(),\n phoneNumber: $('#currentPhoneNumber').text().trim(),\n companyCode: $('.rectangle').eq(4).text().trim(),\n tariffCode: $('.rectangle').eq(5).text().trim(),\n crousRightsEndDate: $('.rectangle').eq(6).text().trim()\n };\n\n return profile;\n } else {\n throw new Error('Failed to retrieve profile information');\n }\n } catch (error) {\n console.error('Error retrieving profile information:', (error as Error).message);\n throw error;\n }\n}","import { AxiosInstance } from 'axios';\n\nexport async function RequestQRCode(axiosInstance: AxiosInstance, numberOfQRCodes: number = 1): Promise < string[] > {\n try {\n const response = await axiosInstance.post('https://mon-espace.izly.fr/Home/CreateQrCodeImg',\n `numberOfQrCodes=${numberOfQRCodes}`,\n {\n headers: {\n 'Accept': 'text/html, */*; q=0.01',\n 'X-Requested-With': 'XMLHttpRequest',\n 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n 'Origin': 'https://mon-espace.izly.fr',\n 'Referer': 'https://mon-espace.izly.fr/Home/GenerateQRCode',\n }\n }\n );\n\n if (response.status === 200) {\n return response.data as string[]; // This should be an array of base64-encoded QR code images\n } else {\n throw new Error('Failed to generate QR Code(s)');\n }\n } catch (error) {\n console.error('Error generating QR Code(s):', (error as Error).message);\n throw error;\n }\n}","import axios, { AxiosInstance, AxiosResponse, AxiosRequestConfig } from 'axios';\nimport * as cheerio from 'cheerio';\n\nclass LoginService {\n private axiosInstance: AxiosInstance;\n private cookies: string[];\n\n constructor() {\n this.axiosInstance = axios.create({\n withCredentials: true,\n maxRedirects: 0,\n validateStatus: () => true,\n headers: {\n 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',\n 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',\n 'Accept-Language': 'fr-FR,fr;q=0.9,en-GB;q=0.8,en;q=0.7,en-US;q=0.6,es;q=0.5',\n },\n });\n this.cookies = [];\n }\n\n private updateCookies(headers: Record): void {\n if (headers['set-cookie']) {\n const newCookies = Array.isArray(headers['set-cookie']) ? headers['set-cookie'] : [headers['set-cookie']];\n this.cookies = [...this.cookies, ...newCookies];\n this.axiosInstance.defaults.headers.Cookie = this.cookies.join('; ');\n }\n }\n\n private async makeRequest(method: string, url: string, data: string | null = null, additionalHeaders: Record = {}): Promise {\n const config: AxiosRequestConfig = {\n method,\n url,\n headers: {\n ...this.axiosInstance.defaults.headers,\n ...additionalHeaders,\n },\n data,\n };\n\n if (this.cookies.length > 0) {\n config.headers = config.headers || {};\n config.headers.Cookie = this.cookies.join('; ');\n }\n\n const response = await this.axiosInstance(config);\n this.updateCookies(response.headers);\n return response;\n }\n\n async login(username: string, password: string): Promise {\n try {\n // Step 1: Initial GET request to /Home/Logon\n let response = await this.makeRequest('GET', 'https://mon-espace.izly.fr/Home/Logon', null, {\n 'Referer': 'https://mon-espace.izly.fr/',\n });\n\n const $ = cheerio.load(response.data);\n const requestVerificationToken = $('input[name=\"__RequestVerificationToken\"]').val() as string;\n\n // Step 2: POST login request\n response = await this.makeRequest('POST', 'https://mon-espace.izly.fr/Home/Logon',\n `__RequestVerificationToken=${encodeURIComponent(requestVerificationToken)}&ReturnUrl=&Username=${encodeURIComponent(username)}&Password=${encodeURIComponent(password)}`,\n {\n 'Content-Type': 'application/x-www-form-urlencoded',\n 'Origin': 'https://mon-espace.izly.fr',\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n }\n );\n\n // Check for redirect and follow it\n if (response.status === 302) {\n const redirectUrl = response.headers.location as string;\n response = await this.makeRequest('GET', `https://mon-espace.izly.fr${redirectUrl}`, null, {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n });\n }\n\n // Step 3: Check if we are logged in\n response = await this.makeRequest('GET', 'https://mon-espace.izly.fr/', null, {\n 'Referer': 'https://mon-espace.izly.fr/Home/Logon',\n });\n\n if (response.status !== 200) {\n throw new Error('Failed to login');\n }\n\n return true;\n } catch (error) {\n console.error('Login error:', (error as Error).message);\n return false;\n }\n }\n\n getAxiosInstance(): AxiosInstance {\n return this.axiosInstance;\n }\n}\n\nexport default LoginService;","import { AxiosInstance } from 'axios';\n\nimport type { Deposit } from './types/Deposit';\nimport type { Notification } from './types/Notification';\nimport type { Profile } from './types/Profile';\n\nimport { ServiceBalance } from './services/Balance';\nimport { ServiceDeposits } from './services/Deposits';\nimport { ServiceNotifications } from './services/Notifications';\nimport { ServiceProfile } from './services/Profile';\n\nimport { RequestQRCode } from './account/QRCodes';\nimport LoginService from './api/Authentification';\nimport { Balance } from './types/Balance';\nclass Izly {\n private loginService: LoginService;\n private axiosInstance: AxiosInstance;\n private loggedIn: boolean = false;\n\n constructor() {\n this.loginService = new LoginService();\n this.axiosInstance = this.loginService.getAxiosInstance();\n }\n\n async login(username: string, password: string): Promise {\n try {\n this.loggedIn = await this.loginService.login(username, password);\n return this.loggedIn;\n } catch (error) {\n console.error('Login error:', (error as Error).message);\n return false;\n }\n }\n\n private checkLogin() {\n if (!this.loggedIn) {\n throw new Error('Not logged in. Please login first.');\n }\n }\n\n async getProfile(): Promise {\n this.checkLogin();\n return ServiceProfile(this.axiosInstance);\n }\n\n async getNotifications(): Promise {\n this.checkLogin();\n return ServiceNotifications(this.axiosInstance);\n }\n\n async getBalance(): Promise {\n this.checkLogin();\n return ServiceBalance(this.axiosInstance);\n }\n\n async getDeposits(): Promise {\n this.checkLogin();\n return ServiceDeposits(this.axiosInstance);\n }\n\n async generateQRCode(): Promise {\n this.checkLogin();\n return RequestQRCode(this.axiosInstance);\n }\n}\n\nexport default Izly;"]} \ No newline at end of file