ublo-lib 1.26.2 → 1.26.4

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,54 +1,34 @@
1
1
  .month {
2
- flex: 0 0 50%;
3
- padding: 0 10px;
2
+ flex: 1 1 100%;
4
3
  }
5
4
 
6
5
  .title {
7
- margin-bottom: 10px;
6
+ margin-bottom: 8px;
8
7
  color: var(--ds-grey-600, #383838);
9
- font-size: 15px;
8
+ font-size: 17px;
10
9
  font-weight: 700;
11
- text-transform: uppercase;
12
10
  text-align: center;
13
11
  }
14
12
 
15
13
  .dates,
16
14
  .days {
17
15
  display: grid;
18
- grid-template-columns: repeat(7, minmax(40px, 1fr));
19
- gap: 3px;
16
+ grid-template-columns: repeat(7, minmax(39px, 1fr));
17
+ gap: 3px 0;
20
18
  }
21
19
 
22
20
  .days {
23
21
  height: 34px;
24
22
  align-items: center;
25
- margin-bottom: 3px;
26
- background-color: var(--ds-grey-100, #f5f5f5);
27
- border-radius: var(--ds-radius-100, 3px);
23
+ margin-bottom: 10px;
24
+ background-color: var(--ds-grey-100, #f8f8f8);
25
+ border-radius: var(--ds-radius-200, 8px);
28
26
  }
29
27
 
30
28
  .day {
31
- color: var(--ds-grey-400, #bbbbbb);
32
- font-size: 11px;
29
+ color: var(--ds-grey-500, #7c7b7b);
30
+ font-size: 12px;
33
31
  text-align: center;
34
- font-weight: 700;
35
- text-transform: uppercase;
36
32
  transition: color 160ms
37
- var(--ds-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
38
- }
39
-
40
- @media (min-width: 480px) {
41
- .day {
42
- font-size: 13px;
43
- }
44
- }
45
-
46
- @media (min-width: 1001px) {
47
- .day {
48
- font-size: 15px;
49
- }
50
- }
51
-
52
- .dayActive {
53
- color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
33
+ var(--ds-transition-easing, cubic-bezier(0.4, 0.1, 0.2, 0.9));
54
34
  }
@@ -43,14 +43,6 @@ export const isSameDay = (date, basedate = new Date()) => {
43
43
  const dateYear = date.getFullYear();
44
44
  return basedateDate === dateDate && basedateMonth === dateMonth && basedateYear === dateYear;
45
45
  };
46
- export const isSaturday = date => {
47
- const d = Array.isArray(date) ? date.join("-") : date;
48
- return new Date(d).getDay() === 6;
49
- };
50
- export const isSunday = date => {
51
- const d = Array.isArray(date) ? date.join("-") : date;
52
- return new Date(d).getDay() === 0;
53
- };
54
46
  export const isPast = date => {
55
47
  const d = Array.isArray(date) ? date.join("-") : date;
56
48
  const _date = new Date(d);
@@ -116,4 +108,11 @@ export const getNextMonth = (month, year) => {
116
108
  month: nextMonth,
117
109
  year: nextMonthYear
118
110
  };
119
- };
111
+ };
112
+ export function getMatchingStays(stays, selectedDates) {
113
+ if (!stays?.length || !selectedDates.length) return;
114
+ const matchingStays = stays?.filter(s => {
115
+ return formatDate(s.start) === formatDate(selectedDates[0]);
116
+ });
117
+ return matchingStays;
118
+ }
@@ -171,7 +171,7 @@ export default function Lodgings({
171
171
  const children = parseInt(data.children);
172
172
  const accomodation = lodging || undefined;
173
173
  const openPage = lodging ? data.openPage : undefined;
174
- const agesChildren = [...new Array(children)].map(_ => 12);
174
+ const agesChildren = [...new Array(children)].map(() => 12);
175
175
  const paxPlan = adults ? {
176
176
  adults,
177
177
  children,
@@ -25,6 +25,7 @@ export default function Vakario({
25
25
  const [levelCodes, setLevelCodes] = React.useState([]);
26
26
  const [data, setData] = React.useState(getDefaultData(preset));
27
27
  const {
28
+ channel,
28
29
  merchant
29
30
  } = preset?.options;
30
31
  const cancelPreset = () => {
@@ -68,7 +69,7 @@ export default function Vakario({
68
69
  const runEffect = async () => {
69
70
  try {
70
71
  setLoading(true);
71
- const kinds = await API.getVakarioKinds(merchant);
72
+ const kinds = await API.getVakarioKinds(channel, merchant);
72
73
  const formatedKinds = kinds.map(({
73
74
  code,
74
75
  name
@@ -90,13 +91,13 @@ export default function Vakario({
90
91
  }
91
92
  };
92
93
  runEffect();
93
- }, [merchant]);
94
+ }, [channel, merchant]);
94
95
  React.useEffect(() => {
95
96
  if (data.kindCodes) {
96
97
  const runEffect = async () => {
97
98
  try {
98
99
  setLoading(true);
99
- const ages = await API.getVakarioAges(merchant, data.kindCodes);
100
+ const ages = await API.getVakarioAges(channel, merchant, data.kindCodes);
100
101
  const formatedAges = ages.map(({
101
102
  code,
102
103
  name
@@ -118,13 +119,13 @@ export default function Vakario({
118
119
  };
119
120
  runEffect();
120
121
  }
121
- }, [merchant, data.kindCodes]);
122
+ }, [merchant, data.kindCodes, channel]);
122
123
  React.useEffect(() => {
123
124
  if (data.kindCodes && data.ageCodes) {
124
125
  const runEffect = async () => {
125
126
  try {
126
127
  setLoading(true);
127
- const categories = await API.getVakarioCategories(merchant, data.kindCodes, data.ageCodes);
128
+ const categories = await API.getVakarioCategories(channel, merchant, data.kindCodes, data.ageCodes);
128
129
  const formatedCategories = categories.map(({
129
130
  code,
130
131
  name
@@ -145,13 +146,13 @@ export default function Vakario({
145
146
  };
146
147
  runEffect();
147
148
  }
148
- }, [merchant, data.kindCodes, data.ageCodes]);
149
+ }, [merchant, data.kindCodes, data.ageCodes, channel]);
149
150
  React.useEffect(() => {
150
151
  if (data.kindCodes && data.ageCodes && data.categoryCodes) {
151
152
  const runEffect = async () => {
152
153
  try {
153
154
  setLoading(true);
154
- const levels = await API.getVakarioLevels(merchant, data.kindCodes, data.ageCodes, data.categoryCodes);
155
+ const levels = await API.getVakarioLevels(channel, merchant, data.kindCodes, data.ageCodes, data.categoryCodes);
155
156
  const formatedLevels = levels.map(({
156
157
  code,
157
158
  name
@@ -168,7 +169,7 @@ export default function Vakario({
168
169
  };
169
170
  runEffect();
170
171
  }
171
- }, [merchant, data.kindCodes, data.ageCodes, data.categoryCodes]);
172
+ }, [merchant, data.kindCodes, data.ageCodes, data.categoryCodes, channel]);
172
173
  React.useEffect(() => {
173
174
  setPreset((current = {}) => {
174
175
  const {
@@ -77,20 +77,20 @@ export async function getEllohaGroups(merchant, stayFrom, language = "fr") {
77
77
  date: stayFrom
78
78
  });
79
79
  }
80
- export async function getVakarioKinds(merchant, language = "fr") {
81
- const endpoint = `${msemServicesUrl}/api/vakario/${merchant}/${language}/kinds`;
80
+ export async function getVakarioKinds(channel, merchant, language = "fr") {
81
+ const endpoint = `${msemServicesUrl}/api/vakario/${channel}/${merchant}/${language}/kinds`;
82
82
  return Fetcher.get(endpoint);
83
83
  }
84
- export async function getVakarioAges(merchant, kind, language = "fr") {
85
- const endpoint = `${msemServicesUrl}/api/vakario/${merchant}/${language}/${kind}/ages`;
84
+ export async function getVakarioAges(channel, merchant, kind, language = "fr") {
85
+ const endpoint = `${msemServicesUrl}/api/vakario/${channel}/${merchant}/${language}/${kind}/ages`;
86
86
  return Fetcher.get(endpoint);
87
87
  }
88
- export async function getVakarioCategories(merchant, kind, age, language = "fr") {
89
- const endpoint = `${msemServicesUrl}/api/vakario/${merchant}/${language}/${kind}/${age}/categories`;
88
+ export async function getVakarioCategories(channel, merchant, kind, age, language = "fr") {
89
+ const endpoint = `${msemServicesUrl}/api/vakario/${channel}/${merchant}/${language}/${kind}/${age}/categories`;
90
90
  return Fetcher.get(endpoint);
91
91
  }
92
- export async function getVakarioLevels(merchant, kind, age, category, language = "fr") {
93
- const endpoint = `${msemServicesUrl}/api/vakario/${merchant}/${language}/${kind}/${age}/${category}/levels`;
92
+ export async function getVakarioLevels(channel, merchant, kind, age, category, language = "fr") {
93
+ const endpoint = `${msemServicesUrl}/api/vakario/${channel}/${merchant}/${language}/${kind}/${age}/${category}/levels`;
94
94
  return Fetcher.get(endpoint);
95
95
  }
96
96
  export async function getOtherProductsCategories(facet, merchant, lang = "fr") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.26.2",
3
+ "version": "1.26.4",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.8.3",
6
6
  "leaflet": "^1.9.1",
@@ -1,38 +0,0 @@
1
- import * as React from "react";
2
- import classNames from "classnames";
3
- import { useUbloContext } from "ublo/with-ublo";
4
- import * as Messages from "./messages";
5
- import * as Icons from "dt-design-system/es/icons";
6
- import styles from "./modes.module.css";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- import { jsxs as _jsxs } from "react/jsx-runtime";
9
- const modes = ["saturday", "sunday", "custom"];
10
- const Modes = ({
11
- currentMode,
12
- setCurrentMode
13
- }) => {
14
- const {
15
- lang
16
- } = useUbloContext();
17
- return _jsx("div", {
18
- className: styles.modes,
19
- children: modes.map(mode => {
20
- const index = modes.indexOf(mode);
21
- const classes = classNames(styles.mode, {
22
- [styles.modeSelected]: currentMode === index
23
- });
24
- const clicked = () => setCurrentMode(index);
25
- return _jsxs("button", {
26
- className: classes,
27
- onClick: clicked,
28
- children: [_jsx(Icons.ChevronRight, {}), _jsxs("div", {
29
- className: styles.inner,
30
- children: [Messages.get(lang, "mode-book"), _jsx("span", {
31
- children: Messages.get(lang, `mode-book-${mode}`)
32
- })]
33
- })]
34
- }, mode);
35
- })
36
- });
37
- };
38
- export default Modes;
@@ -1,90 +0,0 @@
1
- .modes {
2
- display: none;
3
- }
4
-
5
- @media (min-width: 650px) {
6
- .modes {
7
- position: relative;
8
- grid-column: 1;
9
- display: flex;
10
- flex-direction: column;
11
- gap: 8px;
12
- padding: 8px;
13
- border-radius: var(--ds-radius-100, 3px) 0 0 var(--ds-radius-100, 3px);
14
- z-index: 1;
15
- }
16
- }
17
-
18
- .mode {
19
- position: relative;
20
- flex: 1 1 100%;
21
- display: flex;
22
- align-items: center;
23
- text-align: left;
24
- padding: 20px 35px 20px 25px;
25
- color: var(--ds-grey-600, #383838);
26
- font-size: 16px;
27
- background-color: var(--ds-grey-100, #f5f5f5);
28
- border-radius: var(--ds-radius-100, 3px);
29
- cursor: pointer;
30
- user-select: none;
31
- transition: background-color 160ms
32
- var(--ds-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
33
- }
34
-
35
- @media (min-width: 810px) {
36
- .mode:nth-child(3) {
37
- border-bottom: 0;
38
- }
39
- }
40
-
41
- .mode:not(.modeSelected):hover {
42
- background-color: var(--ds-grey-300, #efefef);
43
- }
44
-
45
- .modeSelected {
46
- color: var(--ds-grey-000, #fff);
47
- background-color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
48
- }
49
-
50
- .mode > svg {
51
- position: absolute;
52
- top: 50%;
53
- left: 20px;
54
- width: 20px;
55
- height: 20px;
56
- fill: var(--ds-grey-000, #fff);
57
- transform: translate3d(-15px, -50%, 0) scale3d(0, 0, 0);
58
- opacity: 0;
59
- transition: transform 160ms
60
- var(--ds-transition-easing, cubic-bezier(0.4, 0, 0.2, 1)),
61
- opacity 160ms var(--ds-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
62
- }
63
-
64
- .modeSelected > svg {
65
- opacity: 1;
66
- transform: translate3d(0, -50%, 0) scale3d(1, 1, 1);
67
- }
68
-
69
- .inner {
70
- display: flex;
71
- flex-direction: column;
72
- justify-content: center;
73
- transition: transform 160ms
74
- var(--ds-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
75
- }
76
-
77
- .modeSelected .inner {
78
- transform: translate3d(20px, 0, 0);
79
- }
80
-
81
- .inner > span {
82
- color: var(--ds-grey-600, #383838);
83
- font-size: 19px;
84
- white-space: nowrap;
85
- font-weight: 700;
86
- }
87
-
88
- .modeSelected .inner > span {
89
- color: var(--ds-grey-000, #fff);
90
- }