ublo-lib 1.0.15 → 1.0.19

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.
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ declare type ItemProps = {
3
+ title: string;
4
+ shortTitle?: string;
5
+ name: string;
6
+ path: string;
7
+ page: string;
8
+ subs?: ItemProps[];
9
+ };
10
+ declare type BreadcrumbProps = {
11
+ breadcrumb: ItemProps;
12
+ exclusions: string[];
13
+ };
14
+ declare const Breadcrumb: ({ breadcrumb, exclusions }: BreadcrumbProps) => JSX.Element;
15
+ export default Breadcrumb;
16
+ //# sourceMappingURL=breadcrumb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../../src/common/components/breadcrumb.tsx"],"names":[],"mappings":";AAGA,aAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,EAAE,CAAC;CACpB,CAAC;AAEF,aAAK,eAAe,GAAG;IACrB,UAAU,EAAE,SAAS,CAAC;IACtB,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AA0CF,QAAA,MAAM,UAAU,+BAAqC,eAAe,gBAInE,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,69 +1,23 @@
1
- import * as React from "react";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Link from "ublo/link";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- import { Fragment as _Fragment } from "react/jsx-runtime";
5
- import { jsxs as _jsxs } from "react/jsx-runtime";
6
-
7
- const Item = ({
8
- page,
9
- path,
10
- itemTitle,
11
- nextItem,
12
- isCurrent
13
- }) => {
14
- const hasTemplate = page !== undefined;
15
- const isExternalUrl = /^((http|https):\/\/)/.test(path);
16
- const noHref = isCurrent || !hasTemplate;
17
- const Tag = isExternalUrl ? "a" : noHref ? "span" : Link;
18
- const linkProps = {
19
- title: itemTitle,
20
- page,
21
- as: path
22
- };
23
- const spanProps = {
24
- dangerouslySetInnerHTML: {
25
- __html: itemTitle
26
- }
27
- };
28
- const anchorProps = { ...spanProps,
29
- href: path
30
- };
31
- const props = isExternalUrl ? anchorProps : noHref ? spanProps : linkProps;
32
- return _jsxs(_Fragment, {
33
- children: [_jsx(Tag, {
34
- className: "breadcrumb__item",
35
- ...props
36
- }), nextItem]
37
- });
3
+ const Item = ({ page, path, itemTitle, nextItem, isCurrent }) => {
4
+ const hasTemplate = page !== undefined;
5
+ const isExternalUrl = /^((http|https):\/\/)/.test(path);
6
+ const noHref = isCurrent || !hasTemplate;
7
+ const Tag = isExternalUrl ? "a" : noHref ? "span" : Link;
8
+ const linkProps = { title: itemTitle, page, as: path };
9
+ const spanProps = { dangerouslySetInnerHTML: { __html: itemTitle } };
10
+ const anchorProps = { ...spanProps, href: path };
11
+ const props = isExternalUrl ? anchorProps : noHref ? spanProps : linkProps;
12
+ return (_jsxs(_Fragment, { children: [_jsx(Tag, { className: "breadcrumb__item", ...props }), nextItem] }));
38
13
  };
39
-
40
- const renderBreadcrumbItems = (rawItem, exclusions) => {
41
- const {
42
- next,
43
- title,
44
- path,
45
- page,
46
- shortTitle
47
- } = rawItem;
48
- const isCurrent = next === undefined;
49
- const isNextExcluded = !isCurrent && exclusions.includes(next.name);
50
- const itemToRender = isNextExcluded ? next.next : next;
51
- const nextItem = !isCurrent && renderBreadcrumbItems(itemToRender, exclusions);
52
- return _jsx(Item, {
53
- page: page,
54
- path: path,
55
- itemTitle: shortTitle || title,
56
- nextItem: nextItem,
57
- isCurrent: isCurrent
58
- });
14
+ const Items = ({ rawItem, exclusions }) => {
15
+ const { next, title, path, page, shortTitle } = rawItem;
16
+ const isCurrent = next === undefined;
17
+ const isNextExcluded = !isCurrent && exclusions.includes(next.name);
18
+ const itemToRender = isNextExcluded ? next.next : next;
19
+ const nextItem = !isCurrent ? (_jsx(Items, { rawItem: itemToRender, exclusions: exclusions })) : null;
20
+ return (_jsx(Item, { page: page, path: path, itemTitle: shortTitle || title, nextItem: nextItem, isCurrent: isCurrent }));
59
21
  };
60
-
61
- const Breadcrumb = ({
62
- breadcrumb,
63
- exclusions = []
64
- }) => _jsx("div", {
65
- className: "breadcrumb",
66
- children: renderBreadcrumbItems(breadcrumb, exclusions)
67
- });
68
-
69
- export default Breadcrumb;
22
+ const Breadcrumb = ({ breadcrumb, exclusions = [] }) => (_jsx("div", { className: "breadcrumb", children: _jsx(Items, { rawItem: breadcrumb, exclusions: exclusions }) }));
23
+ export default Breadcrumb;
@@ -14,6 +14,11 @@ const Faq = ({
14
14
  } = useUbloContext();
15
15
  const [count, setCount] = useState(0);
16
16
  const [current, setCurrent] = useState();
17
+ useEffect(() => {
18
+ if (location.hostname === "localhost") {
19
+ console.warn("Faq is deprecated, prefer useFaq (ublo-lib/es/common/hooks/use-faq)");
20
+ }
21
+ }, []);
17
22
  useEffect(() => {
18
23
  const faq = faqRef.current;
19
24
  const sections = faq.querySelectorAll(`section[data-class="${target}"]`);
@@ -79,6 +79,11 @@ const InfoButtons = ({
79
79
  setClosed(true);
80
80
  };
81
81
 
82
+ useEffect(() => {
83
+ if (location.hostname === "localhost") {
84
+ console.warn("InfoButtons is deprecated, prefer useInfoButtons");
85
+ }
86
+ }, []);
82
87
  useEffect(() => {
83
88
  const infos = ref.current;
84
89
  const sections = infos.querySelectorAll(`section${selector}`);
@@ -1,6 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { useEffect } from "react";
3
- import { loadJS } from "./utils/load-js";
3
+ import { loadJS } from "../../common/utils/load-js";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
 
6
6
  const Reviews = ({
@@ -3,7 +3,7 @@ import { useUbloContext } from "ublo/with-ublo";
3
3
  import { loadJS } from "../../common/utils/load-js";
4
4
  import * as Plausible from "../../common/components/plausible";
5
5
 
6
- const setupConfig = (lang, breadcrumb, cart = [], multipleVillages, hasLangPrefix) => {
6
+ const setupConfig = (lang, breadcrumb, cart = [], multipleVillages, hasLangPrefix, channel) => {
7
7
  const pageEsf = multipleVillages ? breadcrumb?.next?.path : breadcrumb?.path;
8
8
  const langPrefix = hasLangPrefix ? `/${lang}` : "";
9
9
  const pagePanier = langPrefix.concat(cart[0] ? cart[0].path : "/panier");
@@ -12,9 +12,10 @@ const setupConfig = (lang, breadcrumb, cart = [], multipleVillages, hasLangPrefi
12
12
  window.currentLang = lang;
13
13
  window.useAnalytics = true;
14
14
  window.analytics = Plausible.callback;
15
+ window.channel = channel;
15
16
  };
16
17
 
17
- const useBookingLinks = (cart, multipleVillages, setupCallback) => {
18
+ const useBookingLinks = (cart, multipleVillages, setupCallback, channel) => {
18
19
  const {
19
20
  breadcrumb,
20
21
  config,
@@ -25,7 +26,7 @@ const useBookingLinks = (cart, multipleVillages, setupCallback) => {
25
26
  React.useEffect(() => {
26
27
  const run = async () => {
27
28
  await loadJS("https://widget.vente-en-ligne-esf.com/boutique/boutique.js", "boutique-js");
28
- setupConfig(bookingLang, breadcrumb, cart, multipleVillages, hasLangPrefix);
29
+ setupConfig(bookingLang, breadcrumb, cart, multipleVillages, hasLangPrefix, channel);
29
30
  setupCallback?.();
30
31
  };
31
32
 
@@ -327,13 +327,13 @@ const SkiPass = ({
327
327
  label: messages.domains,
328
328
  options: filters.domains,
329
329
  values: selectedDomains,
330
- onValueChange: updateFilter("domains")
330
+ onChange: updateFilter("domains")
331
331
  }), data.domains?.length > 0 && filteredDurations?.length > 1 && _jsx(MutlipleSelect, {
332
332
  placeholder: "Selectionnez une ou plusieurs options",
333
333
  label: messages.durations,
334
334
  options: filteredDurations,
335
335
  values: selectedDurations,
336
- onValueChange: updateFilter("durations")
336
+ onChange: updateFilter("durations")
337
337
  })]
338
338
  }), widgetUrl && _jsxs(_Fragment, {
339
339
  children: [_jsx("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.0.15",
3
+ "version": "1.0.19",
4
4
  "peerDependencies": {
5
5
  "react": "^18.2.0",
6
6
  "react-dom": "^18.2.0",
@@ -21,18 +21,19 @@
21
21
  "@types/react": "^18.0.17",
22
22
  "@types/react-dom": "^18.0.6",
23
23
  "classnames": "^2.3.1",
24
- "eslint": "^8.11.0",
24
+ "eslint": "^8.23.0",
25
25
  "eslint-config-prettier": "^8.5.0",
26
- "eslint-config-standard": "^16.0.3",
27
- "eslint-plugin-jsx-a11y": "^6.5.1",
26
+ "eslint-config-standard": "^17.0.0",
27
+ "eslint-plugin-jsx-a11y": "^6.6.1",
28
28
  "eslint-plugin-node": "^11.1.0",
29
- "eslint-plugin-promise": "^6.0.0",
30
- "eslint-plugin-react": "^7.29.4",
31
- "eslint-plugin-react-hooks": "^4.3.0",
29
+ "eslint-plugin-promise": "^6.0.1",
30
+ "eslint-plugin-react": "^7.31.7",
31
+ "eslint-plugin-react-hooks": "^4.6.0",
32
32
  "react": "^18.2.0",
33
33
  "react-dom": "^18.2.0",
34
34
  "react-scripts": "5.0.1",
35
- "typescript": "^4.7.2"
35
+ "typescript": "^4.8.2",
36
+ "ublo": "^2.0.0"
36
37
  },
37
38
  "scripts": {
38
39
  "clean": "rm -rf es",
package/es/empty.d.ts DELETED
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- declare const Empty: () => JSX.Element;
3
- export default Empty;
4
- //# sourceMappingURL=empty.d.ts.map
package/es/empty.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../src/empty.tsx"],"names":[],"mappings":";AAIA,QAAA,MAAM,KAAK,mBAMV,CAAC;AAEF,eAAe,KAAK,CAAC"}
package/es/empty.js DELETED
@@ -1,6 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- // TO REMOVE WHEN THE FIRST REAL TS COMPONENT IS CREATED
3
- const Empty = () => {
4
- return (_jsx("div", { className: "empty", children: _jsx(_Fragment, {}) }));
5
- };
6
- export default Empty;