ublo-lib 1.19.31 → 1.19.32

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,6 +1,5 @@
1
1
  import * as React from "react";
2
- import * as ReactDOM from "react-dom";
3
- import Popup from "../../../../common/components/popup";
2
+ import Dialog from "dt-design-system/es/dialog";
4
3
  import Button from "dt-design-system/es/button";
5
4
  import * as DTIcons from "dt-design-system/es/icons";
6
5
  import Field from "./field";
@@ -61,14 +60,17 @@ const CustomerForm = ({
61
60
  setVoucher("");
62
61
  setResponse(RESPONSE.OK);
63
62
  };
64
- if (!open) return null;
65
- return ReactDOM.createPortal(_jsx(Popup, {
63
+ return _jsx(Dialog, {
66
64
  className: styles.popup,
67
65
  close: close,
66
+ isOpened: open,
68
67
  title: Messages.get(lang, "customer-information"),
69
68
  children: _jsxs("div", {
70
69
  className: styles.inner,
71
- children: [_jsx(Stay, {
70
+ children: [_jsx("div", {
71
+ className: styles.title,
72
+ children: Messages.get(lang, "customer-information")
73
+ }), _jsx(Stay, {
72
74
  lang: lang
73
75
  }), _jsx("div", {
74
76
  className: styles.form,
@@ -95,6 +97,6 @@ const CustomerForm = ({
95
97
  })]
96
98
  })]
97
99
  })
98
- }), document.body);
100
+ });
99
101
  };
100
102
  export default CustomerForm;
@@ -1,13 +1,26 @@
1
- .popup > div {
2
- width: max-content;
1
+ .popup {
2
+ --ds-secondary: #cc0900;
3
+ --ds-primary: #bb0b02;
4
+
5
+ padding: 10px 16px;
6
+ }
7
+
8
+ .inner {
9
+ padding: 10px 0;
3
10
  }
4
11
 
5
12
  @media (min-width: 992px) {
6
13
  .inner {
7
- padding: 0 30px 10px 30px;
14
+ padding: 10px 30px 10px 30px;
8
15
  }
9
16
  }
10
17
 
18
+ .title {
19
+ margin-bottom: 20px;
20
+ font-size: 18px;
21
+ font-weight: 700;
22
+ }
23
+
11
24
  .form {
12
25
  display: flex;
13
26
  flex-direction: column;
@@ -1,6 +1,5 @@
1
1
  import * as React from "react";
2
- import * as ReactDOM from "react-dom";
3
- import Popup from "../../../../common/components/popup";
2
+ import Dialog from "dt-design-system/es/dialog";
4
3
  import Field from "./field";
5
4
  import Button from "dt-design-system/es/button";
6
5
  import * as DTIcons from "dt-design-system/es/icons";
@@ -21,7 +20,8 @@ const StudentForm = ({
21
20
  close,
22
21
  studentData,
23
22
  levels,
24
- setRows
23
+ setRows,
24
+ recapFormRef
25
25
  }) => {
26
26
  const fields = Data.studentFormFields(studentData.productCategory ? levels[studentData.productCategory] : levels);
27
27
  const [formData, setFormData] = React.useState(getInitialState(fields));
@@ -37,21 +37,35 @@ const StudentForm = ({
37
37
  formData
38
38
  }]);
39
39
  onClose();
40
+ const recapForm = recapFormRef.current;
41
+ if (recapForm) {
42
+ requestAnimationFrame(() => {
43
+ requestAnimationFrame(() => {
44
+ recapForm.scrollIntoView({
45
+ behavior: "smooth"
46
+ });
47
+ });
48
+ });
49
+ }
40
50
  };
41
- if (!dataKeys.length) return null;
42
51
  const {
43
52
  details,
44
53
  price,
45
54
  selectedOption,
46
55
  title
47
56
  } = studentData;
48
- return ReactDOM.createPortal(_jsx(Popup, {
57
+ return _jsx(Dialog, {
49
58
  className: styles.popup,
50
59
  close: onClose,
60
+ isOpened: Boolean(dataKeys.length),
51
61
  title: Messages.get(lang, "student-information"),
62
+ showCloseButton: true,
52
63
  children: _jsxs("div", {
53
64
  className: styles.inner,
54
- children: [_jsxs("div", {
65
+ children: [_jsx("div", {
66
+ className: styles.title,
67
+ children: Messages.get(lang, "student-information")
68
+ }), _jsxs("div", {
55
69
  className: styles.header,
56
70
  children: [_jsx("div", {
57
71
  className: styles.title,
@@ -96,6 +110,6 @@ const StudentForm = ({
96
110
  })
97
111
  })]
98
112
  })
99
- }), document.body);
113
+ });
100
114
  };
101
115
  export default StudentForm;
@@ -1,13 +1,20 @@
1
- .popup > div {
1
+ .popup {
2
2
  --ds-secondary: #cc0900;
3
3
  --ds-primary: #bb0b02;
4
4
 
5
- width: max-content;
5
+ padding: 10px 16px;
6
6
  }
7
7
 
8
8
  .inner {
9
9
  width: 420px;
10
10
  max-width: 100%;
11
+ padding: 10px 0;
12
+ }
13
+
14
+ .title {
15
+ margin-bottom: 20px;
16
+ font-size: 18px;
17
+ font-weight: 700;
11
18
  }
12
19
 
13
20
  .header {
@@ -6,14 +6,13 @@ import StudentForm from "./components/student-form";
6
6
  import CustomerForm from "./components/customer-form";
7
7
  import * as Messages from "./messages";
8
8
  import * as Content from "./content";
9
- import * as Utils from "./utils";
10
9
  import Button from "dt-design-system/es/button";
11
10
  import * as DTIcons from "dt-design-system/es/icons";
12
11
  import useStoredRows from "./hooks/use-stored-rows";
13
12
  import styles from "./loyal-customers.module.css";
14
13
  import { jsx as _jsx } from "react/jsx-runtime";
15
14
  import { jsxs as _jsxs } from "react/jsx-runtime";
16
- const LoyalCustomers = ({
15
+ export default function LoyalCustomers({
17
16
  lang,
18
17
  cmsMode,
19
18
  selectors,
@@ -27,13 +26,13 @@ const LoyalCustomers = ({
27
26
  resort,
28
27
  disableVoucher,
29
28
  integration
30
- }) => {
29
+ }) {
30
+ const ref = React.useRef(null);
31
31
  const [rows, setRows] = useStoredRows([]);
32
32
  const [openedRow, setOpenedRow] = React.useState();
33
33
  const [voucher, setVoucher] = React.useState("");
34
34
  const [studentData, setStudentData] = React.useState({});
35
35
  const [customerFormOpen, setCustomerFormOpen] = React.useState(false);
36
- Utils.showHelper();
37
36
  const total = rows.reduce((acc, row) => acc + row.price, 0);
38
37
  const closeStudentForm = () => setStudentData({});
39
38
  const closeCustomerForm = () => setCustomerFormOpen(false);
@@ -76,6 +75,7 @@ const LoyalCustomers = ({
76
75
  }, [cleanup, cmsMode, init, selectors]);
77
76
  const classes = classNames(styles.index, className);
78
77
  return _jsxs("div", {
78
+ ref: ref,
79
79
  className: classes,
80
80
  children: [_jsx("div", {
81
81
  className: styles.title,
@@ -109,7 +109,8 @@ const LoyalCustomers = ({
109
109
  close: closeStudentForm,
110
110
  studentData: studentData,
111
111
  levels: levels,
112
- setRows: setRows
112
+ setRows: setRows,
113
+ recapFormRef: ref
113
114
  }), _jsx(CustomerForm, {
114
115
  lang: lang,
115
116
  close: closeCustomerForm,
@@ -126,5 +127,4 @@ const LoyalCustomers = ({
126
127
  integration: integration
127
128
  })]
128
129
  });
129
- };
130
- export default LoyalCustomers;
130
+ }
@@ -12,11 +12,6 @@ export const formatDate = (lang, date) => {
12
12
  year: "numeric"
13
13
  });
14
14
  };
15
- export const showHelper = () => {
16
- if (process.env.NODE_ENV !== "production") {
17
- console.info("LoyalCustomers: See https://github.com/valraiso-esf/documentation-sites-marchands/tree/master/loyal-customers for more information.");
18
- }
19
- };
20
15
  export const buildPayload = (lang, channel, resort, merchant, voucher, customerData, rows, disableVoucher) => {
21
16
  const {
22
17
  comment,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.19.31",
3
+ "version": "1.19.32",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.1.5",
6
6
  "leaflet": "^1.9.1",