ublo-lib 1.39.24 → 1.39.26

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
- {"version":3,"file":"admin-links.d.ts","sourceRoot":"","sources":["../../../../src/common/components/admin-links/admin-links.tsx"],"names":[],"mappings":"AAMA,KAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CACpC,CAAC;AAeF,QAAA,MAAM,UAAU,oBAAqB,KAAK,4CA8EzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"admin-links.d.ts","sourceRoot":"","sources":["../../../../src/common/components/admin-links/admin-links.tsx"],"names":[],"mappings":"AAMA,KAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CACpC,CAAC;AAeF,QAAA,MAAM,UAAU,oBAAqB,KAAK,4CA2GzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { useUbloContext } from "ublo/with-ublo";
4
4
  import { loadFileManager } from "../../utils/file-manager";
@@ -9,6 +9,7 @@ const ToggleIcon = () => {
9
9
  const AdminLinks = ({ customLinks }) => {
10
10
  const { lang, cmsMode, config } = useUbloContext();
11
11
  const [open, setOpen] = React.useState(false);
12
+ const [subsOpen, setSubsOpen] = React.useState(false);
12
13
  const hasLangPrefix = config.langPrefix.links;
13
14
  const { plausibleLink } = config;
14
15
  const links = {
@@ -39,11 +40,20 @@ const AdminLinks = ({ customLinks }) => {
39
40
  },
40
41
  ...customLinks,
41
42
  };
42
- return (_jsx("div", { className: styles.root, children: cmsMode && (_jsxs(_Fragment, { children: [_jsx("div", { className: styles.toggle, onClick: () => setOpen(!open), children: _jsx(ToggleIcon, {}) }), open && (_jsxs("div", { className: styles.links, children: [_jsx("div", { className: styles.linksTitle, children: "Liens utiles" }), Object.keys(links).map((key, i) => {
43
+ const handlePopups = () => {
44
+ if (open) {
45
+ setSubsOpen(false);
46
+ setOpen(false);
47
+ }
48
+ else {
49
+ setOpen(true);
50
+ }
51
+ };
52
+ return (_jsx("div", { className: styles.root, children: cmsMode && (_jsxs(_Fragment, { children: [_jsx("div", { className: styles.toggle, onClick: handlePopups, children: _jsx(ToggleIcon, {}) }), open && (_jsxs("div", { className: styles.links, children: [_jsx("div", { className: styles.linksTitle, children: "Liens utiles" }), Object.keys(links).map((key, i) => {
43
53
  const link = links[key];
44
54
  if (!link)
45
55
  return null;
46
- const { name, onClick, target } = link;
56
+ const { name, onClick, target, subs } = link;
47
57
  const isHrefValid = typeof onClick === "string" && onClick !== "";
48
58
  const isFunction = typeof onClick === "function";
49
59
  if (!isHrefValid && !isFunction) {
@@ -51,9 +61,16 @@ const AdminLinks = ({ customLinks }) => {
51
61
  }
52
62
  const Tag = isHrefValid ? "a" : "button";
53
63
  const anchorProps = { href: onClick, target };
54
- const buttonProps = { onClick };
64
+ const buttonProps = {
65
+ onClick: subs
66
+ ? () => setSubsOpen((prevState) => !prevState)
67
+ : onClick,
68
+ };
55
69
  const props = isFunction ? buttonProps : anchorProps;
56
- return (_jsx(Tag, { className: styles.link, ...props, children: name }, i));
70
+ return (_jsxs(_Fragment, { children: [_jsx(Tag, { className: styles.link, ...props, children: name }, i), subs && (_jsx("div", { className: styles.subsLinks, "data-opened": subsOpen, children: subs.map((sub, j) => {
71
+ const { name, path } = sub;
72
+ return (_jsx("a", { className: styles.link, href: path, children: name }, j));
73
+ }) }))] }));
57
74
  })] }))] })) }));
58
75
  };
59
76
  export default AdminLinks;
@@ -36,6 +36,7 @@
36
36
  position: absolute;
37
37
  bottom: 30px;
38
38
  left: 0;
39
+ width: 175px;
39
40
  max-width: 90vw;
40
41
  display: flex;
41
42
  flex-direction: column;
@@ -56,6 +57,35 @@
56
57
  var(--ublo-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
57
58
  }
58
59
 
60
+ .subsLinks {
61
+ position: absolute;
62
+ top: 20px;
63
+ left: 180px;
64
+ max-width: 90vw;
65
+ max-height: 150px;
66
+ overflow-y: auto;
67
+ display: flex;
68
+ flex-direction: column;
69
+ padding: 16px;
70
+ color: var(--ublo-grey-800, #000);
71
+ background: var(--ublo-grey-000, #fff);
72
+ border-radius: var(--ublo-radius-300, 15px);
73
+ box-shadow: var(--ublo-shadow-300, 0 5px 10px rgba(0, 0, 0, 0.24));
74
+ transform: scaleX(0.95);
75
+ transform-origin: left;
76
+ opacity: 0;
77
+ pointer-events: none;
78
+ transition: transform 240ms
79
+ var(--ublo-transition-easing, cubic-bezier(0.4, 0, 0.2, 1)),
80
+ opacity 240ms var(--ublo-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
81
+ }
82
+
83
+ .subsLinks[data-opened="true"] {
84
+ transform: scaleX(1);
85
+ opacity: 1;
86
+ pointer-events: all;
87
+ }
88
+
59
89
  @keyframes admin-links-appearance {
60
90
  0% {
61
91
  opacity: 0;
@@ -1,7 +1,8 @@
1
1
  type Props = {
2
2
  channel?: string;
3
3
  integration?: boolean;
4
+ cartPath?: string;
4
5
  };
5
- export default function useAccount({ channel, integration, }?: Props): void;
6
+ export default function useAccount({ channel, integration, cartPath, }?: Props): void;
6
7
  export {};
7
8
  //# sourceMappingURL=use-account.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-account.d.ts","sourceRoot":"","sources":["../../../src/common/hooks/use-account.ts"],"names":[],"mappings":"AAKA,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,OAAe,EACf,WAAW,GACZ,GAAE,KAAU,QAmBZ"}
1
+ {"version":3,"file":"use-account.d.ts","sourceRoot":"","sources":["../../../src/common/hooks/use-account.ts"],"names":[],"mappings":"AAMA,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAMF,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,OAAe,EACf,WAAW,EACX,QAAQ,GACT,GAAE,KAAU,QAyBZ"}
@@ -1,10 +1,15 @@
1
1
  import * as React from "react";
2
+ import getConfig from "next/config";
2
3
  import { useUbloContext } from "ublo/with-ublo";
3
4
  import * as Plausible from "../components/plausible";
4
5
  import { loadJS } from "../utils/load-js";
5
- export default function useAccount({ channel = "ESF", integration, } = {}) {
6
+ const { publicRuntimeConfig } = getConfig();
7
+ const { langPrefix, resort } = publicRuntimeConfig;
8
+ const hasLangPrefix = langPrefix.links;
9
+ export default function useAccount({ channel = "ESF", integration, cartPath, } = {}) {
6
10
  const { lang } = useUbloContext();
7
11
  const widgetLang = React.useMemo(() => (lang === "fr" ? "fr" : "en"), [lang]);
12
+ const cartUrl = React.useMemo(() => (hasLangPrefix ? `/${lang.concat(cartPath)}` : cartPath), [cartPath, lang]);
8
13
  React.useEffect(() => {
9
14
  const startAccount = async () => {
10
15
  await loadWidgetMseM(integration);
@@ -14,11 +19,13 @@ export default function useAccount({ channel = "ESF", integration, } = {}) {
14
19
  channel,
15
20
  groundedTo: "#msem-account",
16
21
  analytics: Plausible.callback,
22
+ resort,
23
+ cartUrl,
17
24
  });
18
25
  });
19
26
  };
20
27
  startAccount();
21
- }, [channel, integration, widgetLang]);
28
+ }, [cartUrl, channel, integration, widgetLang]);
22
29
  }
23
30
  async function loadWidgetMseM(integration) {
24
31
  const source = integration
@@ -1,6 +1,7 @@
1
1
  export default CustomerForm;
2
- declare function CustomerForm({ lang, close, open, rows, setRows, voucher, setVoucher, disableVoucher, manualStay, channel, merchant, resort, integration, categoryCode, }: {
2
+ declare function CustomerForm({ lang, formTitle, close, open, rows, setRows, voucher, setVoucher, disableVoucher, manualStay, channel, merchant, resort, integration, categoryCode, }: {
3
3
  lang: any;
4
+ formTitle: any;
4
5
  close: any;
5
6
  open: any;
6
7
  rows: any;
@@ -1 +1 @@
1
- {"version":3,"file":"customer-form.d.ts","sourceRoot":"","sources":["../../../../../src/esf/components/loyal-customers/components/customer-form.js"],"names":[],"mappings":";AA4BA;;;;;;;;;;;;;;;4CAgGC"}
1
+ {"version":3,"file":"customer-form.d.ts","sourceRoot":"","sources":["../../../../../src/esf/components/loyal-customers/components/customer-form.js"],"names":[],"mappings":";AA4BA;;;;;;;;;;;;;;;;4CAkGC"}
@@ -19,7 +19,7 @@ const getInitialState = (fields) => Object.keys(fields).reduce((acc, key) => ({
19
19
  ...acc,
20
20
  [key]: { value: "", validator: !fields[key].required || false },
21
21
  }), {});
22
- const CustomerForm = ({ lang, close, open, rows, setRows, voucher, setVoucher, disableVoucher, manualStay, channel, merchant, resort, integration, categoryCode, }) => {
22
+ const CustomerForm = ({ lang, formTitle, close, open, rows, setRows, voucher, setVoucher, disableVoucher, manualStay, channel, merchant, resort, integration, categoryCode, }) => {
23
23
  const fields = manualStay
24
24
  ? { ...Data.stayFields, ...Data.customerFormFields }
25
25
  : Data.customerFormFields;
@@ -28,7 +28,7 @@ const CustomerForm = ({ lang, close, open, rows, setRows, voucher, setVoucher, d
28
28
  const isFormValid = Object.keys(customerData).every((key) => customerData[key].validator);
29
29
  const onSubmit = async () => {
30
30
  setResponse(RESPONSE.LOADING);
31
- const payload = Utils.buildPayload(lang, channel, resort, merchant, voucher, customerData, rows, disableVoucher, categoryCode);
31
+ const payload = Utils.buildPayload(lang, channel, resort, merchant, voucher, customerData, rows, disableVoucher, categoryCode, formTitle);
32
32
  const { error } = await Api.sendFile(payload, integration);
33
33
  if (error) {
34
34
  setResponse(RESPONSE.ERROR);
@@ -1,4 +1,4 @@
1
- export default function LoyalCustomers({ lang, cmsMode, selectors, levels, className, convertTableToSelect, handleVariants, manualStay, channel, merchant, resort, disableVoucher, integration, categoryCode, }: {
1
+ export default function LoyalCustomers({ lang, cmsMode, selectors, levels, className, convertTableToSelect, handleVariants, manualStay, channel, merchant, resort, disableVoucher, integration, categoryCode, formTitle, }: {
2
2
  lang: any;
3
3
  cmsMode: any;
4
4
  selectors: any;
@@ -13,5 +13,6 @@ export default function LoyalCustomers({ lang, cmsMode, selectors, levels, class
13
13
  disableVoucher: any;
14
14
  integration: any;
15
15
  categoryCode: any;
16
+ formTitle?: string;
16
17
  }): import("react/jsx-runtime").JSX.Element;
17
18
  //# sourceMappingURL=loyal-customers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"loyal-customers.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/loyal-customers/loyal-customers.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;4CAyIC"}
1
+ {"version":3,"file":"loyal-customers.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/loyal-customers/loyal-customers.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;4CA2IC"}
@@ -11,7 +11,7 @@ import Button from "dt-design-system/es/button";
11
11
  import * as DTIcons from "dt-design-system/es/icons";
12
12
  import useStoredRows from "./hooks/use-stored-rows";
13
13
  import styles from "./loyal-customers.module.css";
14
- export default function LoyalCustomers({ lang, cmsMode, selectors, levels, className, convertTableToSelect, handleVariants, manualStay, channel = "ESF", merchant, resort, disableVoucher, integration, categoryCode, }) {
14
+ export default function LoyalCustomers({ lang, cmsMode, selectors, levels, className, convertTableToSelect, handleVariants, manualStay, channel = "ESF", merchant, resort, disableVoucher, integration, categoryCode, formTitle = "Clients fidèles", }) {
15
15
  const ref = React.useRef(null);
16
16
  const [rows, setRows] = useStoredRows([]);
17
17
  const [openedRow, setOpenedRow] = React.useState();
@@ -57,5 +57,5 @@ export default function LoyalCustomers({ lang, cmsMode, selectors, levels, class
57
57
  }
58
58
  }, [cleanup, cmsMode, init, selectors]);
59
59
  const classes = classNames(styles.index, className);
60
- return (_jsxs("div", { ref: ref, className: classes, children: [_jsx("div", { className: styles.title, children: Messages.get(lang, "title") }), _jsx(Rows, { lang: lang, rows: rows, setRows: setRows, openedRow: openedRow, setOpenedRow: setOpenedRow }), !disableVoucher && (_jsx(Voucher, { lang: lang, voucher: voucher, setVoucher: setVoucher })), _jsxs("div", { className: styles.overview, children: [_jsx("div", { className: styles.overviewTitle, children: Messages.get(lang, "total") }), _jsxs("div", { className: styles.overviewTotal, children: [total, " \u20AC"] })] }), _jsxs(Button, { className: styles.orderButton, disabled: !rows.length, onClick: openCustomerForm, children: [Messages.get(lang, "order"), _jsx(DTIcons.Check, {})] }), _jsx(StudentForm, { lang: lang, close: closeStudentForm, studentData: studentData, levels: levels, setRows: setRows, recapFormRef: ref }), _jsx(CustomerForm, { lang: lang, close: closeCustomerForm, open: customerFormOpen, rows: rows, setRows: setRows, voucher: voucher, setVoucher: setVoucher, disableVoucher: disableVoucher, manualStay: manualStay, channel: channel, merchant: merchant, resort: resort, integration: integration, categoryCode: categoryCode })] }));
60
+ return (_jsxs("div", { ref: ref, className: classes, children: [_jsx("div", { className: styles.title, children: Messages.get(lang, "title") }), _jsx(Rows, { lang: lang, rows: rows, setRows: setRows, openedRow: openedRow, setOpenedRow: setOpenedRow }), !disableVoucher && (_jsx(Voucher, { lang: lang, voucher: voucher, setVoucher: setVoucher })), _jsxs("div", { className: styles.overview, children: [_jsx("div", { className: styles.overviewTitle, children: Messages.get(lang, "total") }), _jsxs("div", { className: styles.overviewTotal, children: [total, " \u20AC"] })] }), _jsxs(Button, { className: styles.orderButton, disabled: !rows.length, onClick: openCustomerForm, children: [Messages.get(lang, "order"), _jsx(DTIcons.Check, {})] }), _jsx(StudentForm, { lang: lang, close: closeStudentForm, studentData: studentData, levels: levels, setRows: setRows, recapFormRef: ref }), _jsx(CustomerForm, { lang: lang, formTitle: formTitle, close: closeCustomerForm, open: customerFormOpen, rows: rows, setRows: setRows, voucher: voucher, setVoucher: setVoucher, disableVoucher: disableVoucher, manualStay: manualStay, channel: channel, merchant: merchant, resort: resort, integration: integration, categoryCode: categoryCode })] }));
61
61
  }
@@ -1,6 +1,6 @@
1
1
  export function validateField(type: any, value: any): any;
2
2
  export function formatDate(lang: any, date: any): string;
3
- export function buildPayload(lang: any, channel: any, resort: any, merchant: any, voucher: any, customerData: any, rows: any, disableVoucher: any, categoryCode: any): {
3
+ export function buildPayload(lang: any, channel: any, resort: any, merchant: any, voucher: any, customerData: any, rows: any, disableVoucher: any, categoryCode: any, formTitle: any): {
4
4
  channel: any;
5
5
  resort: any;
6
6
  merchant: any;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/loyal-customers/utils.js"],"names":[],"mappings":"AAEO,0DAGN;AAEM,yDAQN;AAEM;;;;;;;;;;;;;;;;;EA0DN"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/loyal-customers/utils.js"],"names":[],"mappings":"AAEO,0DAGN;AAEM,yDAQN;AAEM;;;;;;;;;;;;;;;;;EA2DN"}
@@ -12,7 +12,7 @@ export const formatDate = (lang, date) => {
12
12
  year: "numeric",
13
13
  });
14
14
  };
15
- export const buildPayload = (lang, channel, resort, merchant, voucher, customerData, rows, disableVoucher, categoryCode) => {
15
+ export const buildPayload = (lang, channel, resort, merchant, voucher, customerData, rows, disableVoucher, categoryCode, formTitle) => {
16
16
  const { comment, email, title, firstname, lastname, phone, stayFrom, stayTo, } = customerData;
17
17
  const storedStay = window.sessionStorage.getItem("stay");
18
18
  if ((!stayFrom || !stayTo) && !storedStay)
@@ -28,7 +28,7 @@ Date de naissance : ${formatDate(lang, birthDate.value)}`;
28
28
  return { label, description, price };
29
29
  }, []);
30
30
  const voucherMessage = disableVoucher ? "" : `Code promo : ${voucher}`;
31
- const message = `Envoyé depuis le formulaire "Clients fidèles".
31
+ const message = `Envoyé depuis le formulaire "${formTitle}".
32
32
  ${voucherMessage}
33
33
  Commentaire : ${comment.value}`;
34
34
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.39.24",
3
+ "version": "1.39.26",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.10.8",
6
6
  "leaflet": "^1.9.1",