ublo-lib 1.43.4 → 1.44.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.
Files changed (49) hide show
  1. package/es/@types/global.d.ts +9 -0
  2. package/es/@types/global.d.ts.map +1 -0
  3. package/es/@types/global.js +1 -0
  4. package/es/common/components/cart-dialog/cross-selling-offers.js +1 -1
  5. package/es/common/components/cookie-consent/cookie-consent.d.ts +2 -1
  6. package/es/common/components/cookie-consent/cookie-consent.d.ts.map +1 -1
  7. package/es/common/components/cross-selling-editor/cross-selling-editor.js +2 -2
  8. package/es/common/components/cross-selling-editor/hooks/use-custom-offers.js +1 -1
  9. package/es/common/components/cross-selling-editor/hooks/use-fetch.js +1 -1
  10. package/es/common/components/custom-contact-form/attachment.js +1 -1
  11. package/es/common/components/date-picker/data.d.ts.map +1 -1
  12. package/es/common/components/editable-calendar/data.d.ts.map +1 -1
  13. package/es/common/components/editable-calendar/index.d.ts +2 -1
  14. package/es/common/components/editable-calendar/index.d.ts.map +1 -1
  15. package/es/common/components/scroll-spy.d.ts.map +1 -1
  16. package/es/common/components/scroll-spy.js +1 -4
  17. package/es/common/components/scrolling-carousel/scrolling-carousel.d.ts.map +1 -1
  18. package/es/common/components/search-bar/hooks/use-constant.js +1 -1
  19. package/es/common/components/search-bar/utils/keyboard-keys.d.ts.map +1 -1
  20. package/es/common/components/week-selector/week-selector.d.ts.map +1 -1
  21. package/es/common/hooks/use-sticky.d.ts +1 -1
  22. package/es/common/hooks/use-sticky.d.ts.map +1 -1
  23. package/es/esf/components/booking-form/booking-form.js +1 -1
  24. package/es/esf/components/booking-form/summary.js +1 -1
  25. package/es/esf/components/instant-search/hooks/use-constant.js +1 -1
  26. package/es/esf/components/period-picker/period-picker.js +1 -1
  27. package/es/esf/components/period-picker/popup.d.ts +2 -1
  28. package/es/esf/components/period-picker/popup.d.ts.map +1 -1
  29. package/es/future/components/faqs/config.d.ts +6 -0
  30. package/es/future/components/faqs/config.d.ts.map +1 -0
  31. package/es/future/components/faqs/config.js +20 -0
  32. package/es/future/components/faqs/config.module.css +3 -0
  33. package/es/future/components/faqs/editor.d.ts +11 -0
  34. package/es/future/components/faqs/editor.d.ts.map +1 -0
  35. package/es/future/components/faqs/editor.js +71 -0
  36. package/es/future/components/faqs/editor.module.css +219 -0
  37. package/es/future/components/faqs/faqs.d.ts +12 -0
  38. package/es/future/components/faqs/faqs.d.ts.map +1 -0
  39. package/es/future/components/faqs/faqs.js +26 -0
  40. package/es/future/components/faqs/faqs.module.css +12 -0
  41. package/es/future/components/faqs/index.d.ts +3 -0
  42. package/es/future/components/faqs/index.d.ts.map +1 -0
  43. package/es/future/components/faqs/index.js +2 -0
  44. package/es/future/components/faqs/services/api.d.ts +2 -0
  45. package/es/future/components/faqs/services/api.d.ts.map +1 -0
  46. package/es/future/components/faqs/services/api.js +4 -0
  47. package/es/lbm/components/instant-search/hooks/use-constant.js +1 -1
  48. package/es/market-place/components/instant-search/hooks/use-constant.js +1 -1
  49. package/package.json +16 -12
@@ -0,0 +1,9 @@
1
+ import type { JSX as Jsx } from "react/jsx-runtime";
2
+ declare global {
3
+ namespace JSX {
4
+ type ElementClass = Jsx.ElementClass;
5
+ type Element = Jsx.Element;
6
+ type IntrinsicElements = Jsx.IntrinsicElements;
7
+ }
8
+ }
9
+ //# sourceMappingURL=global.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"global.d.ts","sourceRoot":"","sources":["../../src/@types/global.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,IAAI,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,GAAG,CAAC;QACZ,KAAK,YAAY,GAAG,GAAG,CAAC,YAAY,CAAC;QACrC,KAAK,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC3B,KAAK,iBAAiB,GAAG,GAAG,CAAC,iBAAiB,CAAC;KAChD;CACF"}
@@ -0,0 +1 @@
1
+ export {};
@@ -7,7 +7,7 @@ import * as Plausible from "../plausible";
7
7
  import { message } from "./message";
8
8
  import styles from "./cross-selling-offers.module.css";
9
9
  const CrossSellingOffers = ({ kind, cart, closeDialog, zoneId, zonePath }) => {
10
- const ref = React.useRef();
10
+ const ref = React.useRef(null);
11
11
  const { lang, path } = useUbloContext();
12
12
  const currentCart = cart.cart.cart;
13
13
  const offers = useTunnelOffers(zoneId, zonePath, currentCart);
@@ -4,5 +4,6 @@ declare function CookieConsent({ lang, consent, updateConsent }: {
4
4
  lang: any;
5
5
  consent: any;
6
6
  updateConsent: any;
7
- }): import("react-dom/node_modules/@types/react").ReactPortal;
7
+ }): React.ReactPortal;
8
+ import * as React from "react";
8
9
  //# sourceMappingURL=cookie-consent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cookie-consent.d.ts","sourceRoot":"","sources":["../../../../src/common/components/cookie-consent/cookie-consent.js"],"names":[],"mappings":"AAsGO,0CA6BN;;AArHD;;;;8DAsFC"}
1
+ {"version":3,"file":"cookie-consent.d.ts","sourceRoot":"","sources":["../../../../src/common/components/cookie-consent/cookie-consent.js"],"names":[],"mappings":"AAsGO,0CA6BN;;AArHD;;;;sBAsFC;uBApGsB,OAAO"}
@@ -7,8 +7,8 @@ import * as Plausible from "../plausible";
7
7
  import Editor from "./editor";
8
8
  import styles from "./cross-selling-editor.module.css";
9
9
  export default function CrossSellingEditor({ titleZoneProps = {}, contentZoneProps = {}, durations, className, tunnelOffersOrder, displayedTunnelOffers, children, }) {
10
- const ref = React.useRef();
11
- const titleRef = React.useRef();
10
+ const ref = React.useRef(null);
11
+ const titleRef = React.useRef(null);
12
12
  const { cmsMode } = useUbloContext();
13
13
  const sendPlausibleEvent = (e) => {
14
14
  const container = e.target.closest("data-custom-offers");
@@ -5,7 +5,7 @@ import * as Utils from "../services/utils";
5
5
  export default function useCustomOffers({ titleSelector, contentSelector, } = {}) {
6
6
  const { lang, path } = useUbloContext();
7
7
  const [offers, setOffers] = React.useState();
8
- const controller = React.useRef();
8
+ const controller = React.useRef(undefined);
9
9
  const getOffers = React.useCallback(async () => {
10
10
  const titleZone = document.querySelector(titleSelector || "[data-title-zone]");
11
11
  const contentZone = document.querySelector(contentSelector || "[data-content-zone]");
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  export default function useFetch({ key, callback, ready = true, }) {
3
3
  const [data, setData] = React.useState();
4
4
  const [loading, setLoading] = React.useState(false);
5
- const controller = React.useRef();
5
+ const controller = React.useRef(undefined);
6
6
  React.useEffect(() => {
7
7
  if (ready && data === undefined) {
8
8
  const runEffect = async () => {
@@ -6,7 +6,7 @@ import * as Icons from "./icons";
6
6
  import { convertToFileList } from "./utils";
7
7
  import css from "./attachment.module.css";
8
8
  export default function Attachment({ lang, name, label, settings, data, setData, }) {
9
- const ref = React.useRef();
9
+ const ref = React.useRef(null);
10
10
  const [dragging, setDragging] = React.useState(false);
11
11
  const [error, setError] = React.useState(false);
12
12
  const items = data?.attachment?.value || [];
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/data.js"],"names":[],"mappings":";;;;;;;;;;;AAaA,+BAAkD;AAElD,gCAAoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2HpD,+BAAgC;AAEzB,kEAyCN"}
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/data.js"],"names":[],"mappings":";;;;;;;;;;;AAaA,+BAAkD;AAElD,gCAAoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2HpD,6BAA8B,CAAC,CAAC;AAEzB,kEAyCN"}
@@ -1 +1 @@
1
- {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-calendar/data.js"],"names":[],"mappings":"AA2FA,iEAmCC;AA5HD,+BAAkD;AAElD,gCAAoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFpD,+BAAgC"}
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-calendar/data.js"],"names":[],"mappings":"AA2FA,iEAmCC;AA5HD,+BAAkD;AAElD,gCAAoD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqFpD,6BAA8B,CAAC,CAAC"}
@@ -1,2 +1,3 @@
1
- export default function EditableCalendar(): import("react-dom/node_modules/@types/react").ReactPortal[];
1
+ export default function EditableCalendar(): React.ReactPortal[];
2
+ import * as React from "react";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-calendar/index.js"],"names":[],"mappings":"AAOA,wGAiDC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/common/components/editable-calendar/index.js"],"names":[],"mappings":"AAOA,gEAiDC;uBAxDsB,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"scroll-spy.d.ts","sourceRoot":"","sources":["../../../src/common/components/scroll-spy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,SAAS,EACT,KAAK,EACL,GAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,UAAuB,EACvB,SAAS,EACT,QAAQ,GACT,EAAE,KAAK,2CAmDP"}
1
+ {"version":3,"file":"scroll-spy.d.ts","sourceRoot":"","sources":["../../../src/common/components/scroll-spy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,SAAS,EACT,KAAK,EACL,GAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,UAAuB,EACvB,SAAS,EACT,QAAQ,GACT,EAAE,KAAK,2CAqDP"}
@@ -38,9 +38,6 @@ export default function ScrollSpy({ className, items, Tag = "div", currentClassN
38
38
  [props.className]: props.className,
39
39
  [currentClassName]: current === i,
40
40
  });
41
- return React.cloneElement(child, {
42
- ...props,
43
- className,
44
- });
41
+ return React.cloneElement(child, { ...props, className });
45
42
  }) }));
46
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scrolling-carousel.d.ts","sourceRoot":"","sources":["../../../../src/common/components/scrolling-carousel/scrolling-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAKF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,2CA0HvE"}
1
+ {"version":3,"file":"scrolling-carousel.d.ts","sourceRoot":"","sources":["../../../../src/common/components/scrolling-carousel/scrolling-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAKF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,2CA6HvE"}
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  export default function useConstant(fn) {
3
- const ref = React.useRef();
3
+ const ref = React.useRef(null);
4
4
  if (!ref.current) {
5
5
  ref.current = { v: fn() };
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard-keys.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/search-bar/utils/keyboard-keys.js"],"names":[],"mappings":"AAAA,mBAAoB;AACpB,yBAA0B;AAC1B,2BAA4B;AAC5B,uBAAwB;AACxB,wBAAyB"}
1
+ {"version":3,"file":"keyboard-keys.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/search-bar/utils/keyboard-keys.js"],"names":[],"mappings":"AAAA,gBAAiB,EAAE,CAAC;AACpB,sBAAuB,EAAE,CAAC;AAC1B,wBAAyB,EAAE,CAAC;AAC5B,oBAAqB,EAAE,CAAC;AACxB,qBAAsB,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"week-selector.d.ts","sourceRoot":"","sources":["../../../../src/common/components/week-selector/week-selector.tsx"],"names":[],"mappings":"AAWA,KAAK,KAAK,GAAG;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;CAC3C,CAAC;AAOF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,EACX,cAAc,EACd,OAAO,GACR,EAAE,KAAK,2CAoPP"}
1
+ {"version":3,"file":"week-selector.d.ts","sourceRoot":"","sources":["../../../../src/common/components/week-selector/week-selector.tsx"],"names":[],"mappings":"AAWA,KAAK,KAAK,GAAG;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;CAC3C,CAAC;AAOF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,WAAW,EACX,cAAc,EACd,OAAO,GACR,EAAE,KAAK,2CAqPP"}
@@ -1,4 +1,4 @@
1
1
  import * as React from "react";
2
- declare const useSticky: () => (boolean | React.MutableRefObject<any>)[];
2
+ declare const useSticky: () => (boolean | React.RefObject<any>)[];
3
3
  export default useSticky;
4
4
  //# sourceMappingURL=use-sticky.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-sticky.d.ts","sourceRoot":"","sources":["../../../src/common/hooks/use-sticky.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,QAAA,MAAM,SAAS,iDAsCd,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"use-sticky.d.ts","sourceRoot":"","sources":["../../../src/common/hooks/use-sticky.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,QAAA,MAAM,SAAS,0CAsCd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -10,7 +10,7 @@ const BookingFormWithSnackbar = (props) => {
10
10
  return (_jsx(SnackbarProvider, { children: _jsx(BookingForm, { ...props }) }));
11
11
  };
12
12
  const BookingForm = ({ lang, resort, channel = "ESF", merchant, integration = false, uat = false, noInitialScroll, }) => {
13
- const ref = React.useRef();
13
+ const ref = React.useRef(null);
14
14
  const [fields, setFields] = React.useState(FIELDS);
15
15
  const [step, setStep] = React.useState(STEPS.LESSONS);
16
16
  const [lessons, setLessons] = React.useState([]);
@@ -18,7 +18,7 @@ const getChildren = (lang, key, type, label, value, isName, age) => {
18
18
  return (_jsxs(_Fragment, { children: [_jsxs("span", { children: [label, " :"] }), " ", value] }));
19
19
  };
20
20
  const Summary = ({ lang, fields, lessons, personalData, setStep, config, clearForm, }) => {
21
- const ref = React.useRef();
21
+ const ref = React.useRef(null);
22
22
  const { groupLessons, data } = fields;
23
23
  const { channel, resort, merchant, integration, uat } = config;
24
24
  const previousStep = () => setStep(STEPS.PERSONAL_DATA);
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  export default function useConstant(fn) {
3
- const ref = React.useRef();
3
+ const ref = React.useRef(null);
4
4
  if (!ref.current) {
5
5
  ref.current = { v: fn() };
6
6
  }
@@ -19,7 +19,7 @@ const { start, end, forceSeasonSwitch = false, extend, } = publicRuntimeConfig.s
19
19
  const WEEK_STORAGE = "stayWeek";
20
20
  const EXTEND_STAY_PICKER_APPEARANCE_DELAY = 1000;
21
21
  export default function PeriodPicker({ setClosed = undefined, force = false, onChange = undefined, ubloContext = {}, }) {
22
- const ref = React.useRef();
22
+ const ref = React.useRef(null);
23
23
  const { lang, cmsMode, metadata, path } = {
24
24
  ...ubloContext,
25
25
  ...useUbloContext(),
@@ -4,5 +4,6 @@ export default function Popup({ mustFilterSections, showDialog, opened, onChange
4
4
  opened: any;
5
5
  onChange: any;
6
6
  selectAndClose: any;
7
- }): import("react-dom/node_modules/@types/react").ReactPortal;
7
+ }): React.ReactPortal;
8
+ import * as React from "react";
8
9
  //# sourceMappingURL=popup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/period-picker/popup.js"],"names":[],"mappings":"AAKA;;;;;;8DA2BC"}
1
+ {"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/period-picker/popup.js"],"names":[],"mappings":"AAKA;;;;;;sBA2BC;uBAhCsB,OAAO"}
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ config: string[];
3
+ };
4
+ export default function Config({ config }: Props): import("react/jsx-runtime").JSX.Element;
5
+ export {};
6
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/future/components/faqs/config.tsx"],"names":[],"mappings":"AAIA,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,KAAK,2CAkB/C"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import Zone from "ublo/zone";
4
+ import styles from "./config.module.css";
5
+ export default function Config({ config }) {
6
+ const ref = React.useRef(null);
7
+ const [initialized, setInitialized] = React.useState(false);
8
+ React.useEffect(() => {
9
+ const container = ref.current;
10
+ if (initialized) {
11
+ if (container) {
12
+ container.innerHTML = JSON.stringify(config);
13
+ }
14
+ }
15
+ else {
16
+ setInitialized(true);
17
+ }
18
+ }, [config, initialized]);
19
+ return _jsx(Zone, { ref: ref, id: "faqs-config", className: styles.config, readOnly: true });
20
+ }
@@ -0,0 +1,3 @@
1
+ .config {
2
+ display: none;
3
+ }
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ type Props = {
3
+ currentFaqs: string;
4
+ faqUrl: string;
5
+ faqZoneId: string;
6
+ config: string[];
7
+ setConfig: React.Dispatch<React.SetStateAction<string[]>>;
8
+ };
9
+ export default function Editor({ currentFaqs, faqUrl, faqZoneId, config, setConfig, }: Props): import("react/jsx-runtime").JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../../src/future/components/faqs/editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,KAAK,KAAK,GAAG;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;CAC3D,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,WAAW,EACX,MAAM,EACN,SAAS,EACT,MAAM,EACN,SAAS,GACV,EAAE,KAAK,2CAmJP"}
@@ -0,0 +1,71 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { useUbloContext } from "ublo/with-ublo";
4
+ import { fetchZone } from "ublo/fetcher";
5
+ import Button from "dt-design-system/es/button";
6
+ import * as Icons from "dt-design-system/es/icons";
7
+ import Dialog from "dt-design-system/es/dialog";
8
+ import styles from "./editor.module.css";
9
+ export default function Editor({ currentFaqs, faqUrl, faqZoneId, config, setConfig, }) {
10
+ const previousConfig = React.useRef(config);
11
+ const { ubloApi, site, lang } = useUbloContext();
12
+ const [opened, setOpened] = React.useState(false);
13
+ const [faqs, setFaqs] = React.useState();
14
+ const [selectedFaqs, setSelectedFaqs] = React.useState([]);
15
+ const [othersFaqs, setOthersFaqs] = React.useState([]);
16
+ const openEditor = async () => {
17
+ const content = await fetchZone(ubloApi, site, lang, faqUrl, faqZoneId);
18
+ setFaqs(content);
19
+ setOpened(true);
20
+ };
21
+ React.useEffect(() => {
22
+ if (faqs) {
23
+ const dom = new DOMParser().parseFromString(faqs, "text/html");
24
+ const sections = Array.from(dom.querySelectorAll("section[data-class]"));
25
+ const { selected, others } = sections.reduce((acc, element) => {
26
+ const uuid = element.getAttribute("data-uuid");
27
+ const html = element.outerHTML;
28
+ if (config.includes(uuid)) {
29
+ return { ...acc, selected: [...acc.selected, html] };
30
+ }
31
+ return { ...acc, others: [...acc.others, html] };
32
+ }, { selected: [], others: [] });
33
+ setSelectedFaqs(selected);
34
+ setOthersFaqs(others);
35
+ }
36
+ }, [config, faqs]);
37
+ const closeEditor = () => {
38
+ setOpened(false);
39
+ setSelectedFaqs([]);
40
+ setOthersFaqs([]);
41
+ setFaqs(undefined);
42
+ };
43
+ const cancelAndClose = () => {
44
+ setConfig(previousConfig.current);
45
+ closeEditor();
46
+ };
47
+ const addAll = () => {
48
+ const dom = new DOMParser().parseFromString(faqs, "text/html");
49
+ const uuids = Array.from(dom.querySelectorAll("section[data-uuid]")).map((element) => element.getAttribute("data-uuid"));
50
+ setConfig(uuids);
51
+ };
52
+ const removeAll = () => {
53
+ setConfig([]);
54
+ };
55
+ const updateSelected = (action) => (e) => {
56
+ e.preventDefault();
57
+ const target = e.target;
58
+ const section = target.closest("section");
59
+ if (!section)
60
+ return;
61
+ const uuid = section.getAttribute("data-uuid");
62
+ setConfig((current) => {
63
+ if (action === "add") {
64
+ return [...current, uuid];
65
+ }
66
+ return current.filter((id) => id !== uuid);
67
+ });
68
+ };
69
+ const editorButtonLabel = config.length > 0 ? `Modifier la sélection de F.A.Q` : "Ajouter une F.A.Q";
70
+ return (_jsxs("div", { className: styles.editor, children: [_jsxs("div", { className: styles.count, children: [_jsx("b", { children: config.length }), " \u00E9l\u00E9ment", config.length > 1 ? "s" : "", " s\u00E9lectionn\u00E9", config.length > 1 ? "s" : ""] }), currentFaqs ? (_jsx("div", { className: styles.currentFaqs, dangerouslySetInnerHTML: { __html: currentFaqs } })) : (_jsxs(_Fragment, { children: [_jsx("div", { className: styles.placeholder }), _jsx("div", { className: styles.placeholder })] })), _jsx("div", { className: styles.actions, children: _jsxs("div", { className: styles.actionsInner, children: ["Ajouter, modifier ou supprimer des F.A.Q", _jsx(Button, { onClick: openEditor, children: editorButtonLabel })] }) }), _jsxs(Dialog, { className: styles.dialog, isOpened: opened, close: closeEditor, children: [_jsxs("div", { className: styles.inner, children: [_jsxs("div", { className: styles.others, children: [_jsxs("div", { className: styles.columnTitle, children: ["Toutes les F.A.Q", " ", _jsxs(Button, { variant: "secondary", onClick: addAll, compact: true, children: [_jsx(Icons.Plus, {}), "Tout ajouter"] })] }), _jsx("div", { onClick: updateSelected("add"), className: styles.columnInner, dangerouslySetInnerHTML: { __html: othersFaqs.join("") } })] }), _jsxs("div", { className: styles.controls, children: [_jsx(Icons.ArrowRight, { className: styles.control }), _jsx(Icons.ArrowLeft, { className: styles.control })] }), _jsxs("div", { className: styles.selected, children: [_jsxs("div", { className: styles.columnTitle, children: ["F.A.Q s\u00E9lectionn\u00E9e(s)", " ", _jsxs(Button, { variant: "secondary", onClick: removeAll, compact: true, children: [_jsx(Icons.Bin, {}), "Tout supprimer"] })] }), _jsx("div", { onClick: updateSelected("remove"), className: styles.columnInner, dangerouslySetInnerHTML: { __html: selectedFaqs.join("") } })] })] }), _jsxs("div", { className: styles.dialogButtons, children: [_jsx(Button, { variant: "transparent", onClick: cancelAndClose, children: "Annuler" }), _jsx(Button, { variant: "success", onClick: closeEditor, children: "Confirmer" })] })] })] }));
71
+ }
@@ -0,0 +1,219 @@
1
+ /* stylelint-disable selector-class-pattern */
2
+ .editor {
3
+ position: relative;
4
+ display: flex;
5
+ flex-direction: column;
6
+ gap: 16px;
7
+ padding: 10px;
8
+ }
9
+
10
+ .count {
11
+ text-align: center;
12
+ }
13
+
14
+ .placeholder {
15
+ position: relative;
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: space-between;
19
+ padding: 16px;
20
+ flex: 0 0 100px;
21
+ border: 1px solid var(--ds-grey-200, #ededed);
22
+ border-radius: var(--ds-radius-200, 8px);
23
+ }
24
+
25
+ .placeholder::before {
26
+ content: "";
27
+ display: block;
28
+ width: 180px;
29
+ height: 20px;
30
+ background-color: var(--ds-grey-800, #000);
31
+ border-radius: var(--ds-radius-100, 4px);
32
+ opacity: 15%;
33
+ }
34
+
35
+ .placeholder:nth-child(3)::before {
36
+ width: 280px;
37
+ }
38
+
39
+ .placeholder::after {
40
+ content: "";
41
+ display: block;
42
+ width: 30px;
43
+ height: 30px;
44
+ background-color: var(--ds-secondary, var(--ds-blue-400, #0038ff));
45
+ border-radius: var(--ds-radius-100, 4px);
46
+ opacity: 25%;
47
+ }
48
+
49
+ .actions {
50
+ position: absolute;
51
+ top: 0;
52
+ left: 0;
53
+ width: 100%;
54
+ height: 100%;
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ border-radius: var(--ds-radius-200, 8px);
59
+ opacity: 0;
60
+ transition: opacity 160ms var(--transition-easing);
61
+ }
62
+
63
+ .actions:is(:hover, :focus-within) {
64
+ opacity: 1;
65
+ }
66
+
67
+ .actions::before {
68
+ content: "";
69
+ position: absolute;
70
+ top: 0;
71
+ left: 0;
72
+ width: 100%;
73
+ height: 100%;
74
+ background: var(
75
+ --ds-grey-gradient,
76
+ linear-gradient(
77
+ 100deg,
78
+ var(--ds-grey-200, #ededed) 0%,
79
+ var(--ds-grey-300, #d7d7d7) 100%
80
+ )
81
+ );
82
+ border-radius: inherit;
83
+ opacity: 45%;
84
+ }
85
+
86
+ .actionsInner {
87
+ position: relative;
88
+ display: flex;
89
+ flex-direction: column;
90
+ align-items: center;
91
+ justify-content: center;
92
+ gap: 8px;
93
+ padding: 16px;
94
+ font-size: 15px;
95
+ background-color: hsl(var(--background));
96
+ border-radius: var(--ds-radius-200, 8px);
97
+ box-shadow: var(--shadow-300);
98
+ transform: scale(0.98);
99
+ transition: transform 160ms 70ms var(--transition-easing);
100
+ }
101
+
102
+ .actions:is(:hover, :focus-within) .actionsInner {
103
+ transform: none;
104
+ }
105
+
106
+ .dialog {
107
+ width: 1200px;
108
+ height: 100%;
109
+ display: flex;
110
+ flex-direction: column;
111
+ }
112
+
113
+ .inner {
114
+ flex: 1 1 100%;
115
+ display: flex;
116
+ gap: 14px;
117
+ padding: 16px;
118
+ }
119
+
120
+ .controls {
121
+ display: flex;
122
+ flex-direction: column;
123
+ justify-content: center;
124
+ gap: 6px;
125
+ }
126
+
127
+ .control {
128
+ flex: 0 0 26px;
129
+ width: 26px;
130
+ fill: var(--ds-grey-300, #d7d7d7);
131
+ }
132
+
133
+ :is(.selected, .others) {
134
+ flex: 1 1 100%;
135
+ display: flex;
136
+ flex-direction: column;
137
+ }
138
+
139
+ .columnTitle {
140
+ margin-bottom: 10px;
141
+ display: flex;
142
+ align-items: center;
143
+ gap: 10px;
144
+ font-style: 18px;
145
+ font-weight: 700;
146
+ }
147
+
148
+ .columnInner {
149
+ flex: 1 1 100%;
150
+ display: flex;
151
+ flex-direction: column;
152
+ padding: 10px;
153
+ background-color: var(--ds-grey-100, #f8f8f8);
154
+ border-radius: var(--ds-radius-200, 8px);
155
+ }
156
+
157
+ .selected .columnInner:empty {
158
+ align-items: center;
159
+ justify-content: center;
160
+ padding: 26px;
161
+ }
162
+
163
+ .selected .columnInner:empty::after {
164
+ content: "Aucune FAQ sélectionnée, cliquez sur n'importe quelle question fréquente en colonne de gauche pour l'ajouter à cette page.";
165
+ color: var(--ds-grey-500, #7c7b7b);
166
+ font-size: 15px;
167
+ text-align: center;
168
+ }
169
+
170
+ .columnInner section {
171
+ position: relative;
172
+ width: 100%;
173
+ cursor: pointer;
174
+ }
175
+
176
+ .columnInner section::after {
177
+ content: "";
178
+ position: absolute;
179
+ top: 0;
180
+ left: 0;
181
+ width: 100%;
182
+ height: 100%;
183
+ background-color: var(--ds-grey-800, #000);
184
+ opacity: 0;
185
+ border-radius: var(--ds-radius-200, 8px);
186
+ transition: opacity 160ms
187
+ var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
188
+ }
189
+
190
+ .columnInner section:hover::after {
191
+ opacity: 0.1;
192
+ }
193
+
194
+ .selected section {
195
+ animation: section-appearance 160ms
196
+ var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
197
+ }
198
+
199
+ .others section {
200
+ animation: section-appearance 160ms
201
+ var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
202
+ }
203
+
204
+ @keyframes section-appearance {
205
+ from {
206
+ opacity: 0;
207
+ }
208
+ }
209
+
210
+ .dialogButtons {
211
+ position: sticky;
212
+ bottom: 0;
213
+ display: flex;
214
+ justify-content: flex-end;
215
+ gap: 10px;
216
+ padding: 10px;
217
+ background-color: var(--ds-grey-000, #fff);
218
+ border-top: 1px solid var(--ds-grey-200, #ededed);
219
+ }
@@ -0,0 +1,12 @@
1
+ type Props = {
2
+ className?: string;
3
+ faqs: string;
4
+ faqUrl: string;
5
+ faqZoneId: string;
6
+ };
7
+ declare function Faqs({ className, faqs, faqUrl, faqZoneId }: Props): import("react/jsx-runtime").JSX.Element;
8
+ declare namespace Faqs {
9
+ var get: (api: string, site: string, lang: string, path: string, zone: string) => Promise<string>;
10
+ }
11
+ export default Faqs;
12
+ //# sourceMappingURL=faqs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faqs.d.ts","sourceRoot":"","sources":["../../../../src/future/components/faqs/faqs.tsx"],"names":[],"mappings":"AAUA,KAAK,KAAK,GAAG;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,iBAAwB,IAAI,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,KAAK,2CAyCzE;kBAzCuB,IAAI;mBA4CrB,MAAM,QACL,MAAM,QACN,MAAM,QACN,MAAM,QACN,MAAM;;eAhDU,IAAI"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import classNames from "classnames";
4
+ import Zone from "ublo/zone";
5
+ import { useUbloContext } from "ublo/with-ublo";
6
+ import { parse } from "node-html-parser";
7
+ import Config from "./config";
8
+ import Editor from "./editor";
9
+ import styles from "./faqs.module.css";
10
+ import * as API from "./services/api";
11
+ export default function Faqs({ className, faqs, faqUrl, faqZoneId }) {
12
+ const { cmsMode, zones } = useUbloContext();
13
+ const defaultConfig = JSON.parse(zones["faqs-config"] || "[]");
14
+ const [config, setConfig] = React.useState(defaultConfig);
15
+ const classes = classNames(styles.faqs, className);
16
+ const parsedFaqs = parse(faqs);
17
+ const selector = config.map((uuid) => `[data-uuid="${uuid}"]`).join(",");
18
+ const currentFaqs = parsedFaqs
19
+ .querySelectorAll(selector)
20
+ .map((faq) => faq.outerHTML)
21
+ .join("");
22
+ return (_jsxs("div", { className: classes, children: [_jsx(Config, { config: config }), _jsxs("div", { className: styles.inner, children: [_jsx(Zone, { id: "faqs-title", className: styles.title, tooltip: "Zone d'\u00E9dition : Titre des faqs", section: "title-2,title-3,title-4,rich-text" }), cmsMode === "editing" ? (_jsx(Editor, { currentFaqs: currentFaqs, faqUrl: faqUrl, faqZoneId: faqZoneId, config: config, setConfig: setConfig })) : (_jsx("div", { className: styles.content, dangerouslySetInnerHTML: { __html: currentFaqs } }))] })] }));
23
+ }
24
+ Faqs.get = (api, site, lang, path, zone) => {
25
+ return API.get(api, site, lang, path, zone);
26
+ };
@@ -0,0 +1,12 @@
1
+ .faqs {
2
+ padding: 46px 0 66px;
3
+ background-color: var(--ds-grey-100, #f8f8f8);
4
+ }
5
+
6
+ .inner {
7
+ width: min(calc(100% - 20px), 800px);
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: 16px;
11
+ margin: 0 auto;
12
+ }
@@ -0,0 +1,3 @@
1
+ import Faqs from "./faqs";
2
+ export default Faqs;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/future/components/faqs/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAE1B,eAAe,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ import Faqs from "./faqs";
2
+ export default Faqs;
@@ -0,0 +1,2 @@
1
+ export declare function get(api: string, site: string, lang: string, path: string, zone: string): Promise<string>;
2
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/future/components/faqs/services/api.ts"],"names":[],"mappings":"AAEA,wBAAsB,GAAG,CACvB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,mBAGb"}
@@ -0,0 +1,4 @@
1
+ import { fetchZone } from "ublo/fetcher";
2
+ export async function get(api, site, lang, path, zone) {
3
+ return fetchZone(api, site, lang, path, zone);
4
+ }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  export default function useConstant(fn) {
3
- const ref = React.useRef();
3
+ const ref = React.useRef(null);
4
4
  if (!ref.current) {
5
5
  ref.current = { v: fn() };
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  export default function useConstant(fn) {
3
- const ref = React.useRef();
3
+ const ref = React.useRef(null);
4
4
  if (!ref.current) {
5
5
  ref.current = { v: fn() };
6
6
  }
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.43.4",
3
+ "version": "1.44.0",
4
4
  "peerDependencies": {
5
5
  "classnames": "^2.5.1",
6
- "dt-design-system": "^3.11.8",
6
+ "dt-design-system": "^3.12.0",
7
7
  "framer-motion": "^11.11.9",
8
8
  "next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
9
+ "node-html-parser": "",
9
10
  "react": "^18.2.0 || ^19.0.0",
10
11
  "react-dom": "^18.2.0 || ^19.0.0",
11
12
  "ublo": "^2.0.0 || ^3.0.0"
@@ -13,6 +14,9 @@
13
14
  "peerDependenciesMeta": {
14
15
  "framer-motion": {
15
16
  "optional": true
17
+ },
18
+ "node-html-parser": {
19
+ "optional": true
16
20
  }
17
21
  },
18
22
  "dependencies": {
@@ -22,23 +26,24 @@
22
26
  },
23
27
  "devDependencies": {
24
28
  "@types/css-modules": "^1.0.5",
25
- "@types/react": "^18.3.12",
26
- "@types/react-dom": "^18.3.1",
29
+ "@types/react": "^19.0.1",
30
+ "@types/react-dom": "^19.0.1",
27
31
  "@typescript-eslint/eslint-plugin": "^7.18.0",
28
32
  "@typescript-eslint/parser": "^7.18.0",
29
33
  "classnames": "^2.5.1",
30
34
  "cpx2": "^7.0.2",
31
- "dt-design-system": "^3.11.8",
35
+ "dt-design-system": "^3.12.0",
32
36
  "eslint": "^8.57.1",
33
37
  "eslint-plugin-react": "^7.37.2",
34
38
  "eslint-plugin-react-hooks": "^4.6.2",
35
- "framer-motion": "^11.11.9",
39
+ "framer-motion": "^11.13.1",
36
40
  "mv": "^2.1.1",
37
- "next": "^14.2.18",
38
- "react": "^18.3.1",
39
- "react-dom": "^18.3.1",
40
- "typescript": "^5.6.3",
41
- "ublo": "^3.20.18"
41
+ "node-html-parser": "^6.1.13",
42
+ "next": "^14.2.20",
43
+ "react": "^19.0.0",
44
+ "react-dom": "^19.0.0",
45
+ "typescript": "^5.7.2",
46
+ "ublo": "^3.21.0"
42
47
  },
43
48
  "scripts": {
44
49
  "clean": "rm -rf es",
@@ -48,7 +53,6 @@
48
53
  "watch": "bun run clean && tsc --watch & cpx './src/**/*.{json,css,svg}' es -w",
49
54
  "lint": "eslint --ext .ts,.tsx src/"
50
55
  },
51
- "packageManager": "yarn@1.22.18",
52
56
  "files": [
53
57
  "es"
54
58
  ],