ublo-lib 1.39.8 → 1.39.10

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.
@@ -15,7 +15,8 @@ type Props = {
15
15
  };
16
16
  hideOptionalStayFields?: boolean;
17
17
  hiddenFields?: Field[];
18
+ forceOptionalStay?: boolean;
18
19
  };
19
- export default function GescoContactForm({ lang, channel, resort, merchant, categories, subject, facet, host, onSubmit, messagesOverrides, hideOptionalStayFields, hiddenFields, }: Props): import("react/jsx-runtime").JSX.Element;
20
+ export default function GescoContactForm({ lang, channel, resort, merchant, categories, subject, facet, host, onSubmit, messagesOverrides, hideOptionalStayFields, hiddenFields, forceOptionalStay, }: Props): import("react/jsx-runtime").JSX.Element;
20
21
  export {};
21
22
  //# sourceMappingURL=gesco-contact-form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gesco-contact-form.d.ts","sourceRoot":"","sources":["../../../../src/common/components/gesco-contact-form/gesco-contact-form.tsx"],"names":[],"mappings":"AAgBA,KAAK,KAAK,GACN,SAAS,GACT,WAAW,GACX,UAAU,GACV,OAAO,GACP,OAAO,GACP,SAAS,GACT,UAAU,GACV,UAAU,GACV,QAAQ,GACR,SAAS,CAAC;AAEd,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,IAAI,CAAC,EACD,0CAA0C,GAC1C,sDAAsD,GACtD,8CAA8C,CAAC;IACnD,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE;QAClB,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC5B,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC7B,CAAC;IACF,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,IAAW,EACX,OAAe,EACf,MAAM,EACN,QAAQ,EACR,UAAU,EACV,OAAO,EACP,KAAgB,EAChB,IAAiD,EACjD,QAAQ,EACR,iBAAsB,EACtB,sBAAsB,EACtB,YAAiB,GAClB,EAAE,KAAK,2CAiSP"}
1
+ {"version":3,"file":"gesco-contact-form.d.ts","sourceRoot":"","sources":["../../../../src/common/components/gesco-contact-form/gesco-contact-form.tsx"],"names":[],"mappings":"AAgBA,KAAK,KAAK,GACN,SAAS,GACT,WAAW,GACX,UAAU,GACV,OAAO,GACP,OAAO,GACP,SAAS,GACT,UAAU,GACV,UAAU,GACV,QAAQ,GACR,SAAS,CAAC;AAEd,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC5B,IAAI,CAAC,EACD,0CAA0C,GAC1C,sDAAsD,GACtD,8CAA8C,CAAC;IACnD,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC;IACvE,iBAAiB,CAAC,EAAE;QAClB,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC5B,EAAE,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC7B,CAAC;IACF,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,YAAY,CAAC,EAAE,KAAK,EAAE,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,IAAW,EACX,OAAe,EACf,MAAM,EACN,QAAQ,EACR,UAAU,EACV,OAAO,EACP,KAAgB,EAChB,IAAiD,EACjD,QAAQ,EACR,iBAAsB,EACtB,sBAAsB,EACtB,YAAiB,EACjB,iBAAiB,GAClB,EAAE,KAAK,2CAiSP"}
@@ -14,7 +14,7 @@ import * as Form from "./services/form";
14
14
  import * as API from "./services/api";
15
15
  import * as Plausible from "./services/plausible";
16
16
  import styles from "./gesco-contact-form.module.css";
17
- export default function GescoContactForm({ lang = "fr", channel = "ESF", resort, merchant, categories, subject, facet = "WINTER", host = "https://admin.mon-sejour-en-montagne.com", onSubmit, messagesOverrides = {}, hideOptionalStayFields, hiddenFields = [], }) {
17
+ export default function GescoContactForm({ lang = "fr", channel = "ESF", resort, merchant, categories, subject, facet = "WINTER", host = "https://admin.mon-sejour-en-montagne.com", onSubmit, messagesOverrides = {}, hideOptionalStayFields, hiddenFields = [], forceOptionalStay, }) {
18
18
  const { params, error } = useParams({
19
19
  lang,
20
20
  channel,
@@ -112,7 +112,7 @@ export default function GescoContactForm({ lang = "fr", channel = "ESF", resort,
112
112
  length: "1",
113
113
  }), disabled: Boolean(error) || loading, required: true })), !isHidden("email") && (_jsx(Input, { name: "email", type: "email", icon: "Mail", label: messages.email, pattern: "[^@\\s]+@[^@\\s]+\\.[^@\\s]+", patternError: messages.emailError, disabled: Boolean(error) || loading, required: true })), !isHidden("phone") && (_jsxs("div", { className: styles.phoneGroup, children: [_jsx(PhoneCodeSelect, { messages: messages, disabled: Boolean(error) || loading }), _jsx(Input, { name: "phone", type: "phone", className: styles.phoneField, label: messages.phone, inputMode: "numeric", pattern: "[0-9 ]{9,15}$", patternError: messages.phoneError, disabled: Boolean(error) || loading, required: true })] })), !isHidden("country") && (_jsx(Select, { name: "country", icon: "Globe", label: messages.country, className: styles.fullWidthField, placeholder: messages.defaultCountry, options: countryOptions, disabled: Boolean(error) || loading, required: true })), !isHidden("category") && needCategory && (_jsx(Select, { name: "category", icon: "Plane", label: messages.category, className: styles.fullWidthField, placeholder: messages.defaultCategory, options: categoryOptions, disabled: Boolean(error) || loading, required: true })), (stayNeeded || (!stayNeeded && !hideOptionalStayFields)) && (_jsxs(_Fragment, { children: [!isHidden("stayFrom") && (_jsx(Input, { name: "stayFrom", className: styles.stayField, type: "date", label: messages.stayFromDate, placeholder: messages.dateFormat, onValueChange: updateStayToMin, hint: stayFromMax, min: stayMin, max: stayFromMax, disabled: Boolean(error) || loading, patternError: Messages.format(messages.mandatoryError, {
114
114
  label: messages.stayFrom,
115
- }), required: stayNeeded, extended: true })), !isHidden("stayTo") && (_jsx(Input, { name: "stayTo", className: styles.stayField, type: "date", label: messages.stayToDate, placeholder: messages.dateFormat, onValueChange: updateStayFromMax, hint: stayToMin, min: stayToMin || stayMin, disabled: Boolean(error) || loading, patternError: Messages.format(messages.mandatoryError, {
115
+ }), required: stayNeeded && !forceOptionalStay, extended: true })), !isHidden("stayTo") && (_jsx(Input, { name: "stayTo", className: styles.stayField, type: "date", label: messages.stayToDate, placeholder: messages.dateFormat, onValueChange: updateStayFromMax, hint: stayToMin, min: stayToMin || stayMin, disabled: Boolean(error) || loading, patternError: Messages.format(messages.mandatoryError, {
116
116
  label: messages.stayTo,
117
- }), required: stayNeeded, extended: true }))] })), !isHidden("message") && (_jsx(Textarea, { name: "message", className: styles.fullWidthField, label: messages.message, disabled: Boolean(error) || loading, required: true, autoSizing: true })), _jsx("div", { className: styles.send, children: _jsxs(Button, { type: "submit", disabled: Boolean(error) || loading || submiting, children: [submiting ? _jsx(Loader, { className: styles.loader }) : _jsx(Icons.Plane, {}), messages.submit] }) }), sendSuccess && (_jsx(Information, { className: styles.response, type: "success", close: hideSuccess, children: messages.sendSucesss })), sendError && (_jsx(Information, { className: styles.response, type: "error", close: hideError, children: messages.sendError })), error && (_jsx(Information, { className: styles.error, type: "warning", children: messages.parametersError }))] }, formKey));
117
+ }), required: stayNeeded && !forceOptionalStay, extended: true }))] })), !isHidden("message") && (_jsx(Textarea, { name: "message", className: styles.fullWidthField, label: messages.message, disabled: Boolean(error) || loading, required: true, autoSizing: true })), _jsx("div", { className: styles.send, children: _jsxs(Button, { type: "submit", disabled: Boolean(error) || loading || submiting, children: [submiting ? _jsx(Loader, { className: styles.loader }) : _jsx(Icons.Plane, {}), messages.submit] }) }), sendSuccess && (_jsx(Information, { className: styles.response, type: "success", close: hideSuccess, children: messages.sendSucesss })), sendError && (_jsx(Information, { className: styles.response, type: "error", close: hideError, children: messages.sendError })), error && (_jsx(Information, { className: styles.error, type: "warning", children: messages.parametersError }))] }, formKey));
118
118
  }
@@ -0,0 +1,3 @@
1
+ export function middleware(site: any, api: any): (request: any) => Promise<NextResponse<unknown>>;
2
+ import { NextResponse } from "next/server";
3
+ //# sourceMappingURL=middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../../../src/esf/components/espace-prive/services/middleware.js"],"names":[],"mappings":"AAEO,kGAwDN;6BA1D4B,aAAa"}
@@ -0,0 +1,50 @@
1
+ import { NextResponse } from "next/server";
2
+ export const middleware = (site, api) => async (request) => {
3
+ const url = request.nextUrl;
4
+ const { pathname } = url;
5
+ const clientID = url.searchParams.get("id") || request.cookies.get("id")?.value;
6
+ const email = url.searchParams.get("email");
7
+ const partnerID = getPartnerID(pathname);
8
+ const connexion = `/espace-prive/${partnerID}/connexion/`;
9
+ const isConnectedToUBLO = request.cookies.get("ublo-editing")?.value === "true";
10
+ if (isConnectedToUBLO) {
11
+ return NextResponse.next();
12
+ }
13
+ if (pathname.startsWith("/espace-prive") &&
14
+ !pathname.endsWith("connexion/")) {
15
+ try {
16
+ const password = request.cookies.get("password")?.value || "no-password";
17
+ const response = await fetch(`${api}/check-auth?site=${site}&password=${password}&partnerID=${partnerID}&id=${clientID}${email ? `&email=${email}` : ""}`);
18
+ const { isLoggedIn, redirect } = await response.json();
19
+ const redirection = redirect || response.status === 401 ? connexion : "/not-found";
20
+ if (isLoggedIn) {
21
+ if (url.searchParams.get("id")) {
22
+ const url = request.nextUrl.clone();
23
+ url.searchParams.delete("id");
24
+ const response = NextResponse.redirect(url);
25
+ response.cookies.set("id", clientID);
26
+ return response;
27
+ }
28
+ else {
29
+ NextResponse.next();
30
+ }
31
+ }
32
+ else {
33
+ return NextResponse.redirect(new URL(redirection, request.url));
34
+ }
35
+ }
36
+ catch (error) {
37
+ console.error(error);
38
+ const notFoundUrl = "/not-found";
39
+ return NextResponse.redirect(new URL(notFoundUrl, request.url));
40
+ }
41
+ }
42
+ };
43
+ function getPartnerID(path) {
44
+ const regex = /^\/espace-prive\/([^/]+)\/[^/]*\/?$/;
45
+ const match = path.match(regex);
46
+ if (match) {
47
+ return match[1];
48
+ }
49
+ return null;
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.39.8",
3
+ "version": "1.39.10",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.10.8",
6
6
  "leaflet": "^1.9.1",