@wikicasa-dev/utilities 1.0.2 → 1.0.4

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=()=>/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,e=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent);exports.isMobile=e;exports.isSafari=t;exports.isiOSDevice=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./types-BwcfOdWy.cjs"),r=()=>/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,n=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),o=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent),s=(t={sm:e.u.SMALL,md:e.u.MEDIUM,lg:e.u.LARGE,xl:e.u.EXTRA_LARGE})=>{const i=t;return window.innerWidth<i.sm?"mobile":window.innerWidth<i.lg?"tablet":"desktop"};exports.getCurrentDeviceSize=s;exports.isMobile=n;exports.isSafari=o;exports.isiOSDevice=r;
@@ -1,8 +1,18 @@
1
- const i = () => /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, e = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
1
+ import { u as i } from "./types-CTdZJ5hY.js";
2
+ const n = () => /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, o = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
2
3
  navigator.userAgent
3
- ), r = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
4
+ ), s = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent), a = (t = {
5
+ sm: i.SMALL,
6
+ md: i.MEDIUM,
7
+ lg: i.LARGE,
8
+ xl: i.EXTRA_LARGE
9
+ }) => {
10
+ const e = t;
11
+ return window.innerWidth < e.sm ? "mobile" : window.innerWidth < e.lg ? "tablet" : "desktop";
12
+ };
4
13
  export {
5
- e as isMobile,
6
- r as isSafari,
7
- i as isiOSDevice
14
+ a as getCurrentDeviceSize,
15
+ o as isMobile,
16
+ s as isSafari,
17
+ n as isiOSDevice
8
18
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=e=>e.includes("@gmail");async function i(e){const r=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(n)).map(a=>a.toString(16).padStart(2,"0")).join("")}const h=e=>{const r=e.split("@");if(r.length<2)throw new Error("The email has nothing before the '@' symbol");const n=r[0];let s="";for(const t of n)if(t!=="."){if(t==="+")break;s+=t}return`${s}@${r[1]}`},c=e=>{if(!e||!e.trim())throw new Error("The email in null or empty");let r=e;return o(r)&&(r=h(e)),i(r)};exports.hashEmail=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=e=>e.includes("@gmail"),a=async e=>{const r=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",r);return Array.from(new Uint8Array(n)).map(o=>o.toString(16).padStart(2,"0")).join("")},i=e=>{const r=e.split("@");if(r.length<2)throw new Error("The email has nothing before the '@' symbol");const n=r[0];let s="";for(const t of n)if(t!=="."){if(t==="+")break;s+=t}return`${s}@${r[1]}`},c=e=>{if(!e||!e.trim())throw new Error("The email in null or empty");let r=e;return h(r)&&(r=i(e)),a(r)};exports.hash256=a;exports.hashEmail=c;
@@ -1,9 +1,7 @@
1
- const a = (r) => r.includes("@gmail");
2
- async function h(r) {
1
+ const a = (r) => r.includes("@gmail"), h = async (r) => {
3
2
  const e = new TextEncoder().encode(r), t = await crypto.subtle.digest("SHA-256", e);
4
3
  return Array.from(new Uint8Array(t)).map((o) => o.toString(16).padStart(2, "0")).join("");
5
- }
6
- const i = (r) => {
4
+ }, i = (r) => {
7
5
  const e = r.split("@");
8
6
  if (e.length < 2)
9
7
  throw new Error("The email has nothing before the '@' symbol");
@@ -23,5 +21,6 @@ const i = (r) => {
23
21
  return a(e) && (e = i(r)), h(e);
24
22
  };
25
23
  export {
24
+ h as hash256,
26
25
  c as hashEmail
27
26
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var c=(o=>(o[o.SELLING=0]="SELLING",o[o.SALE=1]="SALE",o[o.RENT=2]="RENT",o[o.AUCTION=3]="AUCTION",o))(c||{});const u={priceFrom:"PrezzoMinimo",priceTo:"PrezzoMassimo",sqMfrom:"SuperficieMinima",sqMto:"SuperficieMassima",roomsFrom:"NumeroMinimoLocali",roomsTo:"NumeroMassimoLocali",bathroomsFrom:"NumeroMinimoBagni",bathroomsTo:"NumeroMassimoBagni",conditionType:"StatoImmobile",energyClassFilter:"ClasseEnergetica",floor:"Piano",excludeAuctions:"EscludiAste",shortRentOnly:"SoloAffittiBrevi",excludeBareOwnership:"EscludiNudaProprieta",onlyPublicUser:"DaPrivato",balcony:"Balcone",terrace:"Terrazzo",balconyTerrace:"BalconeTerrazzo",boxCarSpot:"BoxPostoAuto",carSpot:"PostoAuto",box:"Box",lift:"Ascensore",privateGarden:"GiardinoPrivato",publicGarden:"GiardinoPubblico",cellar:"Cantina",airConditioning:"AriaCondizionata",furnished:"Arredato",publicTransport:"Trasporti",school:"Istruzione",market:"Supermercati",hospital:"Ospedali",pharmacy:"Farmacie",charging:"Ricarica",post:"UfficioPostale",bank:"Banche",swimmingPoolPrivate:"PiscinaPrivata",swimmingPoolPublic:"PiscinaCondominiale",luxury:"Lusso",discounted:"Sconto",filterOrderId:"Ordinamento"},s={sale:"Vendita",rent:"Affitto",auctionType:"Asta",bareOwnershipType:"NudaProprieta",typologyIdList:"Tipologia",filterOrderId:"Ordinamento"};function m(o,r,i,n,l,t,a){let e="/";return i&&(e+=(i==c.AUCTION?window._auctionLabel:i==c.RENT?window._rentLabel:window._saleLabel)+"-"),e+=`${r}/`,t&&(e+=`${t}/`),o&&(e+=`${o.replace(/^-+|-+$/g,"")}/`),n&&(e+=`${n.replace(/^_+|_+$/g,"")}/`),!n&&a&&(e+=`${a.replace(/^_+|_+$/g,"")}/`),l&&(e+=`${l.replace(/^_+|_+$/g,"")}/`),e}function d(o){const r=Object.keys(u).map(i=>o[i]?encodeURIComponent(u[i])+"="+encodeURIComponent(o[i]):null).filter(i=>i!==null);return r.length?`?${r.join("&")}`:""}function p(o){const r=Object.keys(s).map(i=>{if(o[i])if(Array.isArray(o[i])){const n=o[i],l=s[i];let t="";for(let a=0;a<n.length;a++)t+=encodeURIComponent(l)+"="+encodeURIComponent(n[a]),t+=a<n.length-1?"&":"";return t}else return encodeURIComponent(s[i])+"="+encodeURIComponent(o[i]);else return null}).filter(i=>i!==null);return r.length?`?${r.join("&")}`:""}exports.buildParams=d;exports.buildParamsForAgency=p;exports.buildURL=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./types-BwcfOdWy.cjs");function d(n,l,e,t,a,u,o){let r="/";return e&&(r+=(e==i.r.AUCTION?window._auctionLabel:e==i.r.RENT?window._rentLabel:window._saleLabel)+"-"),r+=`${l}/`,u&&(r+=`${u}/`),n&&(r+=`${n.replace(/^-+|-+$/g,"")}/`),t&&(r+=`${t.replace(/^_+|_+$/g,"")}/`),!t&&o&&(r+=`${o.replace(/^_+|_+$/g,"")}/`),a&&(r+=`${a.replace(/^_+|_+$/g,"")}/`),r}function f(n){const l=Object.keys(i.X).map(e=>n[e]?encodeURIComponent(i.X[e])+"="+encodeURIComponent(n[e]):null).filter(e=>e!==null);return l.length?`?${l.join("&")}`:""}function m(n){const l=Object.keys(i.J).map(e=>{if(n[e])if(Array.isArray(n[e])){const t=n[e],a=i.J[e];let u="";for(let o=0;o<t.length;o++)u+=encodeURIComponent(a)+"="+encodeURIComponent(t[o]),u+=o<t.length-1?"&":"";return u}else return encodeURIComponent(i.J[e])+"="+encodeURIComponent(n[e]);else return null}).filter(e=>e!==null);return l.length?`?${l.join("&")}`:""}exports.buildParams=f;exports.buildParamsForAgency=m;exports.buildURL=d;
@@ -1,80 +1,30 @@
1
- var c = /* @__PURE__ */ ((o) => (o[o.SELLING = 0] = "SELLING", o[o.SALE = 1] = "SALE", o[o.RENT = 2] = "RENT", o[o.AUCTION = 3] = "AUCTION", o))(c || {});
2
- const u = {
3
- priceFrom: "PrezzoMinimo",
4
- priceTo: "PrezzoMassimo",
5
- sqMfrom: "SuperficieMinima",
6
- sqMto: "SuperficieMassima",
7
- roomsFrom: "NumeroMinimoLocali",
8
- roomsTo: "NumeroMassimoLocali",
9
- bathroomsFrom: "NumeroMinimoBagni",
10
- bathroomsTo: "NumeroMassimoBagni",
11
- conditionType: "StatoImmobile",
12
- energyClassFilter: "ClasseEnergetica",
13
- floor: "Piano",
14
- excludeAuctions: "EscludiAste",
15
- shortRentOnly: "SoloAffittiBrevi",
16
- excludeBareOwnership: "EscludiNudaProprieta",
17
- onlyPublicUser: "DaPrivato",
18
- balcony: "Balcone",
19
- terrace: "Terrazzo",
20
- balconyTerrace: "BalconeTerrazzo",
21
- boxCarSpot: "BoxPostoAuto",
22
- carSpot: "PostoAuto",
23
- box: "Box",
24
- lift: "Ascensore",
25
- privateGarden: "GiardinoPrivato",
26
- publicGarden: "GiardinoPubblico",
27
- cellar: "Cantina",
28
- airConditioning: "AriaCondizionata",
29
- furnished: "Arredato",
30
- publicTransport: "Trasporti",
31
- school: "Istruzione",
32
- market: "Supermercati",
33
- hospital: "Ospedali",
34
- pharmacy: "Farmacie",
35
- charging: "Ricarica",
36
- post: "UfficioPostale",
37
- bank: "Banche",
38
- swimmingPoolPrivate: "PiscinaPrivata",
39
- swimmingPoolPublic: "PiscinaCondominiale",
40
- luxury: "Lusso",
41
- discounted: "Sconto",
42
- /* Don't consider this prop in the filters counter */
43
- filterOrderId: "Ordinamento"
44
- }, s = {
45
- sale: "Vendita",
46
- rent: "Affitto",
47
- auctionType: "Asta",
48
- bareOwnershipType: "NudaProprieta",
49
- typologyIdList: "Tipologia",
50
- filterOrderId: "Ordinamento"
51
- };
52
- function m(o, e, i, n, l, t, a) {
1
+ import { r as m, X as p, J as f } from "./types-CTdZJ5hY.js";
2
+ function a(e, o, n, l, u, i, t) {
53
3
  let r = "/";
54
- return i && (r += (i == c.AUCTION ? window._auctionLabel : i == c.RENT ? window._rentLabel : window._saleLabel) + "-"), r += `${e}/`, t && (r += `${t}/`), o && (r += `${o.replace(/^-+|-+$/g, "")}/`), n && (r += `${n.replace(/^_+|_+$/g, "")}/`), !n && a && (r += `${a.replace(/^_+|_+$/g, "")}/`), l && (r += `${l.replace(/^_+|_+$/g, "")}/`), r;
4
+ return n && (r += (n == m.AUCTION ? window._auctionLabel : n == m.RENT ? window._rentLabel : window._saleLabel) + "-"), r += `${o}/`, i && (r += `${i}/`), e && (r += `${e.replace(/^-+|-+$/g, "")}/`), l && (r += `${l.replace(/^_+|_+$/g, "")}/`), !l && t && (r += `${t.replace(/^_+|_+$/g, "")}/`), u && (r += `${u.replace(/^_+|_+$/g, "")}/`), r;
55
5
  }
56
- function d(o) {
57
- const e = Object.keys(u).map((i) => o[i] ? encodeURIComponent(u[i]) + "=" + encodeURIComponent(o[i]) : null).filter((i) => i !== null);
58
- return e.length ? `?${e.join("&")}` : "";
6
+ function d(e) {
7
+ const o = Object.keys(p).map((n) => e[n] ? encodeURIComponent(p[n]) + "=" + encodeURIComponent(e[n]) : null).filter((n) => n !== null);
8
+ return o.length ? `?${o.join("&")}` : "";
59
9
  }
60
- function p(o) {
61
- const e = Object.keys(s).map((i) => {
62
- if (o[i])
63
- if (Array.isArray(o[i])) {
64
- const n = o[i], l = s[i];
65
- let t = "";
66
- for (let a = 0; a < n.length; a++)
67
- t += encodeURIComponent(l) + "=" + encodeURIComponent(n[a]), t += a < n.length - 1 ? "&" : "";
68
- return t;
10
+ function s(e) {
11
+ const o = Object.keys(f).map((n) => {
12
+ if (e[n])
13
+ if (Array.isArray(e[n])) {
14
+ const l = e[n], u = f[n];
15
+ let i = "";
16
+ for (let t = 0; t < l.length; t++)
17
+ i += encodeURIComponent(u) + "=" + encodeURIComponent(l[t]), i += t < l.length - 1 ? "&" : "";
18
+ return i;
69
19
  } else
70
- return encodeURIComponent(s[i]) + "=" + encodeURIComponent(o[i]);
20
+ return encodeURIComponent(f[n]) + "=" + encodeURIComponent(e[n]);
71
21
  else
72
22
  return null;
73
- }).filter((i) => i !== null);
74
- return e.length ? `?${e.join("&")}` : "";
23
+ }).filter((n) => n !== null);
24
+ return o.length ? `?${o.join("&")}` : "";
75
25
  }
76
26
  export {
77
27
  d as buildParams,
78
- p as buildParamsForAgency,
79
- m as buildURL
28
+ s as buildParamsForAgency,
29
+ a as buildURL
80
30
  };
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("./ArrayUtils.cjs"),u=require("./ColorUtils.cjs"),i=require("./CookieUtils.cjs"),d=require("./CurrencyUtils.cjs"),b=require("./DateUtils.cjs"),s=require("./DeviceDetectionUtils.cjs"),o=require("./DOMUtils.cjs"),O=require("./EmailUtils.cjs"),l=require("./FunctionUtils.cjs"),n=require("./GenericUtils.cjs"),t=require("./NumberUtils.cjs"),a=require("./ObjectUtils.cjs"),R=require("./ObserverUtils.cjs"),c=require("./PermissionUtils.cjs"),E=require("./RESB_UrlBuilder.cjs"),r=require("./StringUtils.cjs"),p=require("./URLBuilderUtils.cjs"),e=require("./RegexUtils.cjs");exports.isArrNullOrEmpty=m.isArrNullOrEmpty;exports.rgba=u.rgba;exports.decodeCookie=i.decodeCookie;exports.encodeCookie=i.encodeCookie;exports.getCookie=i.getCookie;exports.removeCookie=i.removeCookie;exports.formatCurrency=d.formatCurrency;exports.formatDate=b.formatDate;exports.isMobile=s.isMobile;exports.isSafari=s.isSafari;exports.isiOSDevice=s.isiOSDevice;exports.emptyElem=o.emptyElem;exports.getSingleElement=o.getSingleElement;exports.hideElem=o.hideElem;exports.showElem=o.showElem;exports.hashEmail=O.hashEmail;exports.debounce=l.debounce;exports.isPromise=l.isPromise;exports.awaitableSetTimeout=n.awaitableSetTimeout;exports.createCustomEvent=n.createCustomEvent;exports.formatFloat=t.formatFloat;exports.formatInteger=t.formatInteger;exports.formatLocaleNumber=t.formatLocaleNumber;exports.formatNumber=t.formatNumber;exports.formatterNumberObj=t.formatterNumberObj;exports.parseLocaleNumber=t.parseLocaleNumber;exports.deepCopy=a.deepCopy;exports.isEmptyObject=a.isEmptyObject;exports.shallowCopyObjectTo=a.shallowCopyObjectTo;exports.observeOnce=R.observeOnce;exports.addPermissionStateListener=c.addPermissionStateListener;exports.onNotificationsPermissionChange=c.onNotificationsPermissionChange;exports.buildParams=E.buildParams;exports.buildParamsForAgency=E.buildParamsForAgency;exports.buildURL=E.buildURL;exports.capitalizeFirstLetter=r.capitalizeFirstLetter;exports.cleanASCII=r.cleanASCII;exports.decodeTextWithEntities=r.decodeTextWithEntities;exports.formatAddress=r.formatAddress;exports.replaceAll=r.replaceAll;exports.replaceAllTokens=r.replaceAllTokens;exports.stringToHyphened=r.stringToHyphened;exports.appendQueryString=p.appendQueryString;exports.COMPETITOR_REGEX=e.COMPETITOR_REGEX;exports.DATE_REGEX=e.DATE_REGEX;exports.EMAIL_REGEX=e.EMAIL_REGEX;exports.EMAIL_REGEX_INTO_TEXT=e.EMAIL_REGEX_INTO_TEXT;exports.EXCLUDED_REGEX=e.EXCLUDED_REGEX;exports.GLOBAL_PHONE_REGEX=e.GLOBAL_PHONE_REGEX;exports.PASSWORD_REGEX=e.PASSWORD_REGEX;exports.PHONE_REGEX=e.PHONE_REGEX;exports.ROOMS_REGEX=e.ROOMS_REGEX;exports.SQM_REGEX=e.SQM_REGEX;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./ArrayUtils.cjs"),d=require("./ColorUtils.cjs"),i=require("./CookieUtils.cjs"),b=require("./CurrencyUtils.cjs"),O=require("./DateUtils.cjs"),o=require("./DeviceDetectionUtils.cjs"),s=require("./DOMUtils.cjs"),l=require("./EmailUtils.cjs"),n=require("./FunctionUtils.cjs"),c=require("./GenericUtils.cjs"),t=require("./NumberUtils.cjs"),a=require("./ObjectUtils.cjs"),R=require("./ObserverUtils.cjs"),m=require("./PermissionUtils.cjs"),E=require("./RESB_UrlBuilder.cjs"),r=require("./StringUtils.cjs"),C=require("./URLBuilderUtils.cjs"),e=require("./RegexUtils.cjs");exports.isArrNullOrEmpty=u.isArrNullOrEmpty;exports.rgba=d.rgba;exports.decodeCookie=i.decodeCookie;exports.encodeCookie=i.encodeCookie;exports.getCookie=i.getCookie;exports.removeCookie=i.removeCookie;exports.formatCurrency=b.formatCurrency;exports.formatDate=O.formatDate;exports.getCurrentDeviceSize=o.getCurrentDeviceSize;exports.isMobile=o.isMobile;exports.isSafari=o.isSafari;exports.isiOSDevice=o.isiOSDevice;exports.emptyElem=s.emptyElem;exports.getSingleElement=s.getSingleElement;exports.hideElem=s.hideElem;exports.showElem=s.showElem;exports.hash256=l.hash256;exports.hashEmail=l.hashEmail;exports.debounce=n.debounce;exports.isPromise=n.isPromise;exports.awaitableSetTimeout=c.awaitableSetTimeout;exports.createCustomEvent=c.createCustomEvent;exports.formatFloat=t.formatFloat;exports.formatInteger=t.formatInteger;exports.formatLocaleNumber=t.formatLocaleNumber;exports.formatNumber=t.formatNumber;exports.formatterNumberObj=t.formatterNumberObj;exports.parseLocaleNumber=t.parseLocaleNumber;exports.deepCopy=a.deepCopy;exports.isEmptyObject=a.isEmptyObject;exports.shallowCopyObjectTo=a.shallowCopyObjectTo;exports.observeOnce=R.observeOnce;exports.addPermissionStateListener=m.addPermissionStateListener;exports.onNotificationsPermissionChange=m.onNotificationsPermissionChange;exports.buildParams=E.buildParams;exports.buildParamsForAgency=E.buildParamsForAgency;exports.buildURL=E.buildURL;exports.capitalizeFirstLetter=r.capitalizeFirstLetter;exports.cleanASCII=r.cleanASCII;exports.decodeTextWithEntities=r.decodeTextWithEntities;exports.formatAddress=r.formatAddress;exports.replaceAll=r.replaceAll;exports.replaceAllTokens=r.replaceAllTokens;exports.stringToHyphened=r.stringToHyphened;exports.appendQueryString=C.appendQueryString;exports.COMPETITOR_REGEX=e.COMPETITOR_REGEX;exports.DATE_REGEX=e.DATE_REGEX;exports.EMAIL_REGEX=e.EMAIL_REGEX;exports.EMAIL_REGEX_INTO_TEXT=e.EMAIL_REGEX_INTO_TEXT;exports.EXCLUDED_REGEX=e.EXCLUDED_REGEX;exports.GLOBAL_PHONE_REGEX=e.GLOBAL_PHONE_REGEX;exports.PASSWORD_REGEX=e.PASSWORD_REGEX;exports.PHONE_REGEX=e.PHONE_REGEX;exports.ROOMS_REGEX=e.ROOMS_REGEX;exports.SQM_REGEX=e.SQM_REGEX;
package/dist/index.js CHANGED
@@ -1,73 +1,75 @@
1
1
  import { isArrNullOrEmpty as r } from "./ArrayUtils.js";
2
2
  import { rgba as m } from "./ColorUtils.js";
3
- import { decodeCookie as E, encodeCookie as a, getCookie as p, removeCookie as f } from "./CookieUtils.js";
3
+ import { decodeCookie as a, encodeCookie as E, getCookie as p, removeCookie as f } from "./CookieUtils.js";
4
4
  import { formatCurrency as l } from "./CurrencyUtils.js";
5
- import { formatDate as x } from "./DateUtils.js";
6
- import { isMobile as d, isSafari as b, isiOSDevice as O } from "./DeviceDetectionUtils.js";
7
- import { emptyElem as u, getSingleElement as _, hideElem as C, showElem as X } from "./DOMUtils.js";
8
- import { hashEmail as G } from "./EmailUtils.js";
9
- import { debounce as T, isPromise as L } from "./FunctionUtils.js";
10
- import { awaitableSetTimeout as y, createCustomEvent as N } from "./GenericUtils.js";
11
- import { formatFloat as h, formatInteger as I, formatLocaleNumber as D, formatNumber as M, formatterNumberObj as k, parseLocaleNumber as v } from "./NumberUtils.js";
12
- import { deepCopy as w, isEmptyObject as F, shallowCopyObjectTo as H } from "./ObjectUtils.js";
13
- import { observeOnce as U } from "./ObserverUtils.js";
14
- import { addPermissionStateListener as z, onNotificationsPermissionChange as B } from "./PermissionUtils.js";
15
- import { buildParams as J, buildParamsForAgency as K, buildURL as V } from "./RESB_UrlBuilder.js";
16
- import { capitalizeFirstLetter as Z, cleanASCII as $, decodeTextWithEntities as ee, formatAddress as oe, replaceAll as re, replaceAllTokens as te, stringToHyphened as me } from "./StringUtils.js";
17
- import { appendQueryString as Ee } from "./URLBuilderUtils.js";
18
- import { COMPETITOR_REGEX as pe, DATE_REGEX as fe, EMAIL_REGEX as se, EMAIL_REGEX_INTO_TEXT as le, EXCLUDED_REGEX as ne, GLOBAL_PHONE_REGEX as xe, PASSWORD_REGEX as ce, PHONE_REGEX as de, ROOMS_REGEX as be, SQM_REGEX as Oe } from "./RegexUtils.js";
5
+ import { formatDate as c } from "./DateUtils.js";
6
+ import { getCurrentDeviceSize as d, isMobile as b, isSafari as O, isiOSDevice as u } from "./DeviceDetectionUtils.js";
7
+ import { emptyElem as C, getSingleElement as _, hideElem as S, showElem as X } from "./DOMUtils.js";
8
+ import { hash256 as G, hashEmail as T } from "./EmailUtils.js";
9
+ import { debounce as h, isPromise as L } from "./FunctionUtils.js";
10
+ import { awaitableSetTimeout as N, createCustomEvent as P } from "./GenericUtils.js";
11
+ import { formatFloat as I, formatInteger as M, formatLocaleNumber as k, formatNumber as v, formatterNumberObj as j, parseLocaleNumber as w } from "./NumberUtils.js";
12
+ import { deepCopy as H, isEmptyObject as z, shallowCopyObjectTo as Q } from "./ObjectUtils.js";
13
+ import { observeOnce as W } from "./ObserverUtils.js";
14
+ import { addPermissionStateListener as q, onNotificationsPermissionChange as J } from "./PermissionUtils.js";
15
+ import { buildParams as V, buildParamsForAgency as Y, buildURL as Z } from "./RESB_UrlBuilder.js";
16
+ import { capitalizeFirstLetter as ee, cleanASCII as oe, decodeTextWithEntities as re, formatAddress as te, replaceAll as me, replaceAllTokens as ie, stringToHyphened as ae } from "./StringUtils.js";
17
+ import { appendQueryString as pe } from "./URLBuilderUtils.js";
18
+ import { COMPETITOR_REGEX as se, DATE_REGEX as le, EMAIL_REGEX as ne, EMAIL_REGEX_INTO_TEXT as ce, EXCLUDED_REGEX as xe, GLOBAL_PHONE_REGEX as de, PASSWORD_REGEX as be, PHONE_REGEX as Oe, ROOMS_REGEX as ue, SQM_REGEX as Re } from "./RegexUtils.js";
19
19
  export {
20
- pe as COMPETITOR_REGEX,
21
- fe as DATE_REGEX,
22
- se as EMAIL_REGEX,
23
- le as EMAIL_REGEX_INTO_TEXT,
24
- ne as EXCLUDED_REGEX,
25
- xe as GLOBAL_PHONE_REGEX,
26
- ce as PASSWORD_REGEX,
27
- de as PHONE_REGEX,
28
- be as ROOMS_REGEX,
29
- Oe as SQM_REGEX,
30
- z as addPermissionStateListener,
31
- Ee as appendQueryString,
32
- y as awaitableSetTimeout,
33
- J as buildParams,
34
- K as buildParamsForAgency,
35
- V as buildURL,
36
- Z as capitalizeFirstLetter,
37
- $ as cleanASCII,
38
- N as createCustomEvent,
39
- T as debounce,
40
- E as decodeCookie,
41
- ee as decodeTextWithEntities,
42
- w as deepCopy,
43
- u as emptyElem,
44
- a as encodeCookie,
45
- oe as formatAddress,
20
+ se as COMPETITOR_REGEX,
21
+ le as DATE_REGEX,
22
+ ne as EMAIL_REGEX,
23
+ ce as EMAIL_REGEX_INTO_TEXT,
24
+ xe as EXCLUDED_REGEX,
25
+ de as GLOBAL_PHONE_REGEX,
26
+ be as PASSWORD_REGEX,
27
+ Oe as PHONE_REGEX,
28
+ ue as ROOMS_REGEX,
29
+ Re as SQM_REGEX,
30
+ q as addPermissionStateListener,
31
+ pe as appendQueryString,
32
+ N as awaitableSetTimeout,
33
+ V as buildParams,
34
+ Y as buildParamsForAgency,
35
+ Z as buildURL,
36
+ ee as capitalizeFirstLetter,
37
+ oe as cleanASCII,
38
+ P as createCustomEvent,
39
+ h as debounce,
40
+ a as decodeCookie,
41
+ re as decodeTextWithEntities,
42
+ H as deepCopy,
43
+ C as emptyElem,
44
+ E as encodeCookie,
45
+ te as formatAddress,
46
46
  l as formatCurrency,
47
- x as formatDate,
48
- h as formatFloat,
49
- I as formatInteger,
50
- D as formatLocaleNumber,
51
- M as formatNumber,
52
- k as formatterNumberObj,
47
+ c as formatDate,
48
+ I as formatFloat,
49
+ M as formatInteger,
50
+ k as formatLocaleNumber,
51
+ v as formatNumber,
52
+ j as formatterNumberObj,
53
53
  p as getCookie,
54
+ d as getCurrentDeviceSize,
54
55
  _ as getSingleElement,
55
- G as hashEmail,
56
- C as hideElem,
56
+ G as hash256,
57
+ T as hashEmail,
58
+ S as hideElem,
57
59
  r as isArrNullOrEmpty,
58
- F as isEmptyObject,
59
- d as isMobile,
60
+ z as isEmptyObject,
61
+ b as isMobile,
60
62
  L as isPromise,
61
- b as isSafari,
62
- O as isiOSDevice,
63
- U as observeOnce,
64
- B as onNotificationsPermissionChange,
65
- v as parseLocaleNumber,
63
+ O as isSafari,
64
+ u as isiOSDevice,
65
+ W as observeOnce,
66
+ J as onNotificationsPermissionChange,
67
+ w as parseLocaleNumber,
66
68
  f as removeCookie,
67
- re as replaceAll,
68
- te as replaceAllTokens,
69
+ me as replaceAll,
70
+ ie as replaceAllTokens,
69
71
  m as rgba,
70
- H as shallowCopyObjectTo,
72
+ Q as shallowCopyObjectTo,
71
73
  X as showElem,
72
- me as stringToHyphened
74
+ ae as stringToHyphened
73
75
  };
@@ -0,0 +1 @@
1
+ "use strict";var i=(o=>(o[o.SMALL=576]="SMALL",o[o.MEDIUM=768]="MEDIUM",o[o.LARGE=992]="LARGE",o[o.EXTRA_LARGE=1200]="EXTRA_LARGE",o))(i||{}),r=(o=>(o[o.SELLING=0]="SELLING",o[o.SALE=1]="SALE",o[o.RENT=2]="RENT",o[o.AUCTION=3]="AUCTION",o))(r||{});const a={priceFrom:"PrezzoMinimo",priceTo:"PrezzoMassimo",sqMfrom:"SuperficieMinima",sqMto:"SuperficieMassima",roomsFrom:"NumeroMinimoLocali",roomsTo:"NumeroMassimoLocali",bathroomsFrom:"NumeroMinimoBagni",bathroomsTo:"NumeroMassimoBagni",conditionType:"StatoImmobile",energyClassFilter:"ClasseEnergetica",floor:"Piano",excludeAuctions:"EscludiAste",shortRentOnly:"SoloAffittiBrevi",excludeBareOwnership:"EscludiNudaProprieta",onlyPublicUser:"DaPrivato",balcony:"Balcone",terrace:"Terrazzo",balconyTerrace:"BalconeTerrazzo",boxCarSpot:"BoxPostoAuto",carSpot:"PostoAuto",box:"Box",lift:"Ascensore",privateGarden:"GiardinoPrivato",publicGarden:"GiardinoPubblico",cellar:"Cantina",airConditioning:"AriaCondizionata",furnished:"Arredato",publicTransport:"Trasporti",school:"Istruzione",market:"Supermercati",hospital:"Ospedali",pharmacy:"Farmacie",charging:"Ricarica",post:"UfficioPostale",bank:"Banche",swimmingPoolPrivate:"PiscinaPrivata",swimmingPoolPublic:"PiscinaCondominiale",luxury:"Lusso",discounted:"Sconto",filterOrderId:"Ordinamento"},e={sale:"Vendita",rent:"Affitto",auctionType:"Asta",bareOwnershipType:"NudaProprieta",typologyIdList:"Tipologia",filterOrderId:"Ordinamento"};exports.J=e;exports.X=a;exports.r=r;exports.u=i;
@@ -0,0 +1,57 @@
1
+ var i = /* @__PURE__ */ ((o) => (o[o.SMALL = 576] = "SMALL", o[o.MEDIUM = 768] = "MEDIUM", o[o.LARGE = 992] = "LARGE", o[o.EXTRA_LARGE = 1200] = "EXTRA_LARGE", o))(i || {}), r = /* @__PURE__ */ ((o) => (o[o.SELLING = 0] = "SELLING", o[o.SALE = 1] = "SALE", o[o.RENT = 2] = "RENT", o[o.AUCTION = 3] = "AUCTION", o))(r || {});
2
+ const a = {
3
+ priceFrom: "PrezzoMinimo",
4
+ priceTo: "PrezzoMassimo",
5
+ sqMfrom: "SuperficieMinima",
6
+ sqMto: "SuperficieMassima",
7
+ roomsFrom: "NumeroMinimoLocali",
8
+ roomsTo: "NumeroMassimoLocali",
9
+ bathroomsFrom: "NumeroMinimoBagni",
10
+ bathroomsTo: "NumeroMassimoBagni",
11
+ conditionType: "StatoImmobile",
12
+ energyClassFilter: "ClasseEnergetica",
13
+ floor: "Piano",
14
+ excludeAuctions: "EscludiAste",
15
+ shortRentOnly: "SoloAffittiBrevi",
16
+ excludeBareOwnership: "EscludiNudaProprieta",
17
+ onlyPublicUser: "DaPrivato",
18
+ balcony: "Balcone",
19
+ terrace: "Terrazzo",
20
+ balconyTerrace: "BalconeTerrazzo",
21
+ boxCarSpot: "BoxPostoAuto",
22
+ carSpot: "PostoAuto",
23
+ box: "Box",
24
+ lift: "Ascensore",
25
+ privateGarden: "GiardinoPrivato",
26
+ publicGarden: "GiardinoPubblico",
27
+ cellar: "Cantina",
28
+ airConditioning: "AriaCondizionata",
29
+ furnished: "Arredato",
30
+ publicTransport: "Trasporti",
31
+ school: "Istruzione",
32
+ market: "Supermercati",
33
+ hospital: "Ospedali",
34
+ pharmacy: "Farmacie",
35
+ charging: "Ricarica",
36
+ post: "UfficioPostale",
37
+ bank: "Banche",
38
+ swimmingPoolPrivate: "PiscinaPrivata",
39
+ swimmingPoolPublic: "PiscinaCondominiale",
40
+ luxury: "Lusso",
41
+ discounted: "Sconto",
42
+ /* Don't consider this prop in the filters counter */
43
+ filterOrderId: "Ordinamento"
44
+ }, e = {
45
+ sale: "Vendita",
46
+ rent: "Affitto",
47
+ auctionType: "Asta",
48
+ bareOwnershipType: "NudaProprieta",
49
+ typologyIdList: "Tipologia",
50
+ filterOrderId: "Ordinamento"
51
+ };
52
+ export {
53
+ e as J,
54
+ a as X,
55
+ r,
56
+ i as u
57
+ };
@@ -1,8 +1,31 @@
1
- declare global {
2
- interface Window {
3
- MSStream: any;
4
- }
5
- }
1
+ /**
2
+ * Check if the current device is an iOS device based on the user agent string.
3
+ *
4
+ * @returns {boolean} Returns true if the device is an iOS device, false otherwise.
5
+ */
6
6
  export declare const isiOSDevice: () => boolean;
7
+ /**
8
+ * Check if the current device is a mobile device based on the user agent string.
9
+ *
10
+ * @returns {boolean} Returns true if the device is a mobile device, false otherwise.
11
+ */
7
12
  export declare const isMobile: () => boolean;
13
+ /**
14
+ * Check if the current browser is Safari based on the user agent string.
15
+ *
16
+ * @returns {boolean} Returns true if the browser is Safari, false otherwise.
17
+ */
8
18
  export declare const isSafari: () => boolean;
19
+ type BreakpointType = {
20
+ sm: number;
21
+ md: number;
22
+ lg: number;
23
+ xl: number;
24
+ };
25
+ /**
26
+ * Returns the current device size based on the window.innerWidth and provided breakpoints.
27
+ * @param breakpoints - An object containing breakpoints for different device sizes. Defaults to { sm: 576, md: 768, lg: 992, xl: 1200 }.
28
+ * @returns A string indicating the current device size: "desktop", "mobile", or "tablet".
29
+ */
30
+ export declare const getCurrentDeviceSize: (breakpoints?: BreakpointType) => "desktop" | "mobile" | "tablet";
31
+ export {};
@@ -1,2 +1,17 @@
1
1
  import type { Nullable } from "@wikicasa-dev/types";
2
+ /**
3
+ * Calculates the SHA-256 hash of the input string.
4
+ *
5
+ * @param string - The string to be hashed using the SHA-256 algorithm.
6
+ * @returns A Promise that resolves to the hexadecimal representation of the SHA-256 hash.
7
+ */
8
+ export declare const hash256: (string: string) => Promise<string>;
9
+ /**
10
+ * Takes a nullable email address, normalizes it if it is a Gmail address by removing dots and ignoring characters after '+',
11
+ * and then hashes it using SHA-256 algorithm.
12
+ *
13
+ * @param emailToNormalize - The email address to be normalized and hashed.
14
+ * @returns A Promise that resolves to the hashed email address.
15
+ * @throws Error if the email is null, empty, or if normalization fails.
16
+ */
2
17
  export declare const hashEmail: (emailToNormalize: Nullable<string>) => Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/utilities",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Wikicasa frontend utilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "typescript": "^5.4.3",
39
39
  "vite": "^5.2.3",
40
40
  "vite-plugin-dts": "^3.7.3",
41
- "@wikicasa-dev/types": "^1.0.8"
41
+ "@wikicasa-dev/types": "^1.2.1"
42
42
  },
43
43
  "dependencies": {
44
44
  "axios": "^1.4.0",