@wikicasa-dev/utilities 1.1.22 → 1.1.23-alpha.0
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.
- package/dist/utils/CookieUtils.cjs +1 -1
- package/dist/utils/CookieUtils.js +1 -1
- package/dist/utils/DeviceDetectionUtils.cjs +1 -1
- package/dist/utils/DeviceDetectionUtils.js +14 -72
- package/dist/utils/GeolocationUtils.cjs +1 -1
- package/dist/utils/RESB_UrlBuilder.cjs +1 -1
- package/dist/utils/RESB_UrlBuilder.js +13 -75
- package/package.json +5 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("js-cookie");function d(o,e,r=30,i=!0){const t=new Date;t.setTime(t.getTime()+
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("js-cookie");function d(o,e,r=30,i=!0){const t=new Date;t.setTime(t.getTime()+24*60*60*1e3*r);const n=typeof e!="string"?JSON.stringify(e):e,u=i?btoa(encodeURIComponent(n)):n;document.cookie=o+"="+u+";path=/;expires="+t.toUTCString()}function l(o){try{const e=document.cookie.match("(^|;) ?"+o+"=([^;]*)(;|$)");return e?e[2]:null}catch(e){return console.error(e),null}}function k(o){try{const e=document.cookie.match("(^|;) ?"+o+"=([^;]*)(;|$)");return e?JSON.parse(decodeURIComponent(atob(e[2]))):null}catch(e){return console.error(e),c(o),null}}function c(o){s.remove(o)}exports.decodeCookie=k;exports.encodeCookie=d;exports.getCookie=l;exports.removeCookie=c;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import u from "js-cookie";
|
|
2
2
|
function l(e, o, c = 30, r = !0) {
|
|
3
3
|
const t = /* @__PURE__ */ new Date();
|
|
4
|
-
t.setTime(t.getTime() +
|
|
4
|
+
t.setTime(t.getTime() + 24 * 60 * 60 * 1e3 * c);
|
|
5
5
|
const n = typeof o != "string" ? JSON.stringify(o) : o, i = r ? btoa(encodeURIComponent(n)) : n;
|
|
6
6
|
document.cookie = e + "=" + i + ";path=/;expires=" + t.toUTCString();
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@wikicasa-dev/types"),n=()=>/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window?.MSStream,r=()=>/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator?.userAgent),o=()=>/^((?!chrome|android).)*safari/i.test(navigator.userAgent),s=()=>navigator?.userAgent.includes("Windows"),d=(t={sm:i.BREAKPOINT.SMALL.id,md:i.BREAKPOINT.MEDIUM.id,lg:i.BREAKPOINT.LARGE.id,xl:i.BREAKPOINT.EXTRA_LARGE.id})=>{const e=t;return window?.innerWidth<e.sm?"mobile":window?.innerWidth<e.lg?"tablet":"desktop"};exports.getCurrentDeviceSize=d;exports.isMobile=r;exports.isSafari=o;exports.isWindows=s;exports.isiOSDevice=n;
|
|
@@ -1,77 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const e = [];
|
|
4
|
-
for (const t in n) {
|
|
5
|
-
const l = n[t];
|
|
6
|
-
e.push(l.id);
|
|
7
|
-
}
|
|
8
|
-
return e;
|
|
9
|
-
}, s = () => {
|
|
10
|
-
const e = [];
|
|
11
|
-
for (const t in n) {
|
|
12
|
-
const l = n[t];
|
|
13
|
-
e.push(l.label);
|
|
14
|
-
}
|
|
15
|
-
return e;
|
|
16
|
-
}, a = () => {
|
|
17
|
-
const e = [];
|
|
18
|
-
for (const t in n)
|
|
19
|
-
e.push(t);
|
|
20
|
-
return e;
|
|
21
|
-
}, u = () => n, d = (e) => {
|
|
22
|
-
if (e == null) return null;
|
|
23
|
-
for (const t in n)
|
|
24
|
-
if (n[t].id === e)
|
|
25
|
-
return n[t];
|
|
26
|
-
return null;
|
|
27
|
-
}, c = (e) => {
|
|
28
|
-
if (e == null) return null;
|
|
29
|
-
for (const t in n)
|
|
30
|
-
if (n[t].label === e)
|
|
31
|
-
return n[t];
|
|
32
|
-
return null;
|
|
33
|
-
}, i = n;
|
|
34
|
-
for (const e in i)
|
|
35
|
-
i[e] !== void 0 && (i[e].key = e);
|
|
36
|
-
return Object.defineProperty(i, "lookupById", {
|
|
37
|
-
value: d,
|
|
38
|
-
enumerable: !1
|
|
39
|
-
}), Object.defineProperty(i, "lookupByLabel", {
|
|
40
|
-
value: c,
|
|
41
|
-
enumerable: !1
|
|
42
|
-
}), Object.defineProperty(i, "getIds", {
|
|
43
|
-
value: o,
|
|
44
|
-
enumerable: !1
|
|
45
|
-
}), Object.defineProperty(i, "getLabels", {
|
|
46
|
-
value: s,
|
|
47
|
-
enumerable: !1
|
|
48
|
-
}), Object.defineProperty(i, "getKeys", {
|
|
49
|
-
value: a,
|
|
50
|
-
enumerable: !1
|
|
51
|
-
}), Object.defineProperty(i, "getValues", {
|
|
52
|
-
value: u,
|
|
53
|
-
enumerable: !1
|
|
54
|
-
}), i;
|
|
55
|
-
}, r = /* @__PURE__ */ b({
|
|
56
|
-
SMALL: { id: 576, label: "Small" },
|
|
57
|
-
MEDIUM: { id: 768, label: "Medium" },
|
|
58
|
-
LARGE: { id: 992, label: "Large" },
|
|
59
|
-
EXTRA_LARGE: { id: 1200, label: "Extra large" }
|
|
60
|
-
}), f = () => /iPad|iPhone|iPod/.test(navigator.userAgent) && !window?.MSStream, g = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
1
|
+
import { BREAKPOINT as i } from "@wikicasa-dev/types";
|
|
2
|
+
const r = () => /iPad|iPhone|iPod/.test(navigator.userAgent) && !window?.MSStream, o = () => /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
61
3
|
navigator?.userAgent
|
|
62
|
-
),
|
|
63
|
-
sm:
|
|
64
|
-
md:
|
|
65
|
-
lg:
|
|
66
|
-
xl:
|
|
4
|
+
), s = () => /^((?!chrome|android).)*safari/i.test(navigator.userAgent), d = () => navigator?.userAgent.includes("Windows"), a = (n = {
|
|
5
|
+
sm: i.SMALL.id,
|
|
6
|
+
md: i.MEDIUM.id,
|
|
7
|
+
lg: i.LARGE.id,
|
|
8
|
+
xl: i.EXTRA_LARGE.id
|
|
67
9
|
}) => {
|
|
68
|
-
const
|
|
69
|
-
return window?.innerWidth <
|
|
10
|
+
const e = n;
|
|
11
|
+
return window?.innerWidth < e.sm ? "mobile" : window?.innerWidth < e.lg ? "tablet" : "desktop";
|
|
70
12
|
};
|
|
71
13
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
14
|
+
a as getCurrentDeviceSize,
|
|
15
|
+
o as isMobile,
|
|
16
|
+
s as isSafari,
|
|
17
|
+
d as isWindows,
|
|
18
|
+
r as isiOSDevice
|
|
77
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n={maximumAge:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n={maximumAge:6*60*1e3,timeout:10*1e3},o=()=>!!window.navigator.geolocation,r=(t=n)=>{if(o())return new Promise((e,i)=>{navigator.geolocation.getCurrentPosition(e,i,t)})};exports.browserSupportGeolocation=o;exports.getUserPosition=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("@wikicasa-dev/types");function s(i,p,t,o,r,e,a){let n="/";return t&&(n+=t+"-"),n+=`${p}/`,e&&(n+=`${e}/`),i&&(n+=`${i.replace(/^-+|-+$/g,"")}/`),o&&(n+=`${o.replace(/^_+|_+$/g,"")}/`),!o&&a&&(n+=`${a.replace(/^_+|_+$/g,"")}/`),r&&(n+=`${r.replace(/^_+|_+$/g,"")}/`),n}function c(i,p=!1){const t=p?{...f.searchBeanMapAgencyFilter}:{...f.searchBeanMap},o=Object.entries(i).filter(([r,e])=>t[r]&&e!==void 0&&e!==null&&e!==!1&&e!=="").flatMap(([r,e])=>Array.isArray(e)?e.map(a=>`${encodeURIComponent(t[r])}=${encodeURIComponent(a)}`):e!=null?`${encodeURIComponent(t[r])}=${e instanceof Date?encodeURIComponent(e.toISOString()):encodeURIComponent(e)}`:[]).join("&");return o?`?${o}`:""}exports.buildParams=c;exports.buildURL=s;
|
|
@@ -1,79 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
sqMto: "SuperficieMassima",
|
|
6
|
-
roomsFrom: "NumeroMinimoLocali",
|
|
7
|
-
roomsTo: "NumeroMassimoLocali",
|
|
8
|
-
bathroomsFrom: "NumeroMinimoBagni",
|
|
9
|
-
bathroomsTo: "NumeroMassimoBagni",
|
|
10
|
-
conditionType: "StatoImmobile",
|
|
11
|
-
energyClassFilter: "ClasseEnergetica",
|
|
12
|
-
floor: "Piano",
|
|
13
|
-
excludeAuctions: "EscludiAste",
|
|
14
|
-
shortRentOnly: "SoloAffittiBrevi",
|
|
15
|
-
excludeBareOwnership: "EscludiNudaProprieta",
|
|
16
|
-
onlyPublicUser: "DaPrivato",
|
|
17
|
-
balcony: "Balcone",
|
|
18
|
-
terrace: "Terrazzo",
|
|
19
|
-
balconyTerrace: "BalconeTerrazzo",
|
|
20
|
-
boxCarSpot: "BoxPostoAuto",
|
|
21
|
-
carSpot: "PostoAuto",
|
|
22
|
-
box: "Box",
|
|
23
|
-
lift: "Ascensore",
|
|
24
|
-
privateGarden: "GiardinoPrivato",
|
|
25
|
-
publicGarden: "GiardinoPubblico",
|
|
26
|
-
cellar: "Cantina",
|
|
27
|
-
airConditioning: "AriaCondizionata",
|
|
28
|
-
furnished: "Arredato",
|
|
29
|
-
publicTransport: "Trasporti",
|
|
30
|
-
school: "Istruzione",
|
|
31
|
-
market: "Supermercati",
|
|
32
|
-
hospital: "Ospedali",
|
|
33
|
-
pharmacy: "Farmacie",
|
|
34
|
-
charging: "Ricarica",
|
|
35
|
-
post: "UfficioPostale",
|
|
36
|
-
bank: "Banche",
|
|
37
|
-
query: "ParoleChiave",
|
|
38
|
-
swimmingPoolPrivate: "PiscinaPrivata",
|
|
39
|
-
swimmingPoolPublic: "PiscinaCondominiale",
|
|
40
|
-
luxury: "Lusso",
|
|
41
|
-
discounted: "Sconto",
|
|
42
|
-
auctionMinimumOfferFrom: "OffertaMinimaAstaDa",
|
|
43
|
-
auctionMinimumOfferTo: "OffertaMinimaAstaA",
|
|
44
|
-
auctionMinimumBid: "RialzoMinimoAsta",
|
|
45
|
-
auctionCourtTypeID: "TribunaleAsta",
|
|
46
|
-
auctionSaleModeID: "ModalitaVenditaAsta",
|
|
47
|
-
auctionProcedureNumber: "NumeroProceduraAsta",
|
|
48
|
-
auctionProcedureTypologyID: "TipologiaProceduraAsta",
|
|
49
|
-
auctionReferenceYear: "AnnoRiferimentoAsta",
|
|
50
|
-
auctionPublicationDateFrom: "DataPubblicazioneAstaDa",
|
|
51
|
-
auctionPublicationDateTo: "DataPubblicazioneAstaA",
|
|
52
|
-
auctionDateFrom: "DataAstaDa",
|
|
53
|
-
auctionDateTo: "DataAstaA",
|
|
54
|
-
/* Don't consider this prop in the filters counter */
|
|
55
|
-
filterOrderId: "Ordinamento"
|
|
56
|
-
}, u = {
|
|
57
|
-
sale: "Vendita",
|
|
58
|
-
rent: "Affitto",
|
|
59
|
-
auctionType: "Asta",
|
|
60
|
-
bareOwnershipType: "NudaProprieta",
|
|
61
|
-
typologyIdList: "Tipologia",
|
|
62
|
-
filterOrderId: "Ordinamento"
|
|
63
|
-
};
|
|
64
|
-
function l(t, c, e, r, a, o, n) {
|
|
65
|
-
let i = "/";
|
|
66
|
-
return e && (i += e + "-"), i += `${c}/`, o && (i += `${o}/`), t && (i += `${t.replace(/^-+|-+$/g, "")}/`), r && (i += `${r.replace(/^_+|_+$/g, "")}/`), !r && n && (i += `${n.replace(/^_+|_+$/g, "")}/`), a && (i += `${a.replace(/^_+|_+$/g, "")}/`), i;
|
|
1
|
+
import { searchBeanMapAgencyFilter as $, searchBeanMap as a } from "@wikicasa-dev/types";
|
|
2
|
+
function m(i, f, o, t, r, e, p) {
|
|
3
|
+
let n = "/";
|
|
4
|
+
return o && (n += o + "-"), n += `${f}/`, e && (n += `${e}/`), i && (n += `${i.replace(/^-+|-+$/g, "")}/`), t && (n += `${t.replace(/^_+|_+$/g, "")}/`), !t && p && (n += `${p.replace(/^_+|_+$/g, "")}/`), r && (n += `${r.replace(/^_+|_+$/g, "")}/`), n;
|
|
67
5
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
([
|
|
71
|
-
).flatMap(([
|
|
72
|
-
(
|
|
73
|
-
) :
|
|
74
|
-
return
|
|
6
|
+
function s(i, f = !1) {
|
|
7
|
+
const o = f ? { ...$ } : { ...a }, t = Object.entries(i).filter(
|
|
8
|
+
([r, e]) => o[r] && e !== void 0 && e !== null && e !== !1 && e !== ""
|
|
9
|
+
).flatMap(([r, e]) => Array.isArray(e) ? e.map(
|
|
10
|
+
(p) => `${encodeURIComponent(o[r])}=${encodeURIComponent(p)}`
|
|
11
|
+
) : e != null ? `${encodeURIComponent(o[r])}=${e instanceof Date ? encodeURIComponent(e.toISOString()) : encodeURIComponent(e)}` : []).join("&");
|
|
12
|
+
return t ? `?${t}` : "";
|
|
75
13
|
}
|
|
76
14
|
export {
|
|
77
|
-
|
|
78
|
-
|
|
15
|
+
s as buildParams,
|
|
16
|
+
m as buildURL
|
|
79
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wikicasa-dev/utilities",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.23-alpha.0",
|
|
4
4
|
"description": "Wikicasa frontend utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"date-fns": "^4.0.0",
|
|
48
48
|
"google-polyline": "^1.0.0",
|
|
49
|
-
"js-cookie": "^3.0.0"
|
|
49
|
+
"js-cookie": "^3.0.0",
|
|
50
|
+
"@wikicasa-dev/types": "^2.4.0"
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
53
|
"date-fns": "^4.1.0",
|
|
@@ -58,6 +59,7 @@
|
|
|
58
59
|
"build": "tsc && vite build",
|
|
59
60
|
"preview": "vite preview",
|
|
60
61
|
"prepublish": "pnpm build",
|
|
61
|
-
"test": "jest"
|
|
62
|
+
"test": "jest",
|
|
63
|
+
"release:alpha": "pnpm version prerelease --preid=alpha && pnpm publish --tag alpha --no-git-checks"
|
|
62
64
|
}
|
|
63
65
|
}
|