ublo-lib 1.19.5 → 1.19.7

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.
@@ -129,24 +129,27 @@ function setPurchaseAttempts(cartId, attempts) {
129
129
  }));
130
130
  }
131
131
  function formatPeekPerformancesItem(items, propertiesToRetrieve) {
132
- return items.map(item => {
132
+ if (!items || !items.length) return;
133
+ return items.map(({
134
+ gtmData
135
+ }) => {
133
136
  let properties = {};
134
137
  if (propertiesToRetrieve.includes("kind")) {
135
138
  properties = {
136
139
  ...properties,
137
- kind: item.item_category
140
+ kind: gtmData.item_category
138
141
  };
139
142
  }
140
143
  if (propertiesToRetrieve.includes("quantity")) {
141
144
  properties = {
142
145
  ...properties,
143
- quantity: item.quantity
146
+ quantity: gtmData.quantity
144
147
  };
145
148
  }
146
149
  if (propertiesToRetrieve.includes("price")) {
147
150
  properties = {
148
151
  ...properties,
149
- price: item.price
152
+ price: gtmData.price
150
153
  };
151
154
  }
152
155
  return properties;
@@ -22,13 +22,14 @@ const Filter = ({
22
22
  };
23
23
  setValues(newValues);
24
24
  };
25
- const options = [""].concat(filter.map(({
25
+ const formatedValues = filter.map(({
26
26
  libelle,
27
27
  value
28
28
  }) => ({
29
29
  label: libelle,
30
30
  value
31
- })));
31
+ }));
32
+ const options = values.length === 1 ? formatedValues : [""].concat(formatedValues);
32
33
  const classes = classNames(css.filter, css[code]);
33
34
  return _jsxs("div", {
34
35
  className: classes,
@@ -1 +1 @@
1
- {"version":3,"file":"magic-box.d.ts","sourceRoot":"","sources":["../../../../src/esf/components/magic-box/magic-box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,KAAK,IAAI,GAAG;IACV,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,OAAO,EAAE,MAA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IF,wBAAoC;AAEpC,iBAAS,QAAQ,CAAC,EAChB,IAAI,EACJ,OAAO,EACP,OAAe,EACf,SAAS,EACT,YAAY,EACZ,aAAa,EACb,OAAW,EACX,OAAkB,EAClB,iBAAiB,EACjB,QAAQ,GACT,EAAE,KAAK,2CAuHP"}
@@ -69,7 +69,7 @@ function MagicBox({ stay, cartUrl, channel = "ESF", className, alignContent, max
69
69
  return { ...acc, [key]: filter };
70
70
  }, {});
71
71
  setFilters(newFilters);
72
- const defaultValues = Object.keys(newFilters).reduce((acc, key) => ({ ...acc, [key]: "" }), {});
72
+ const defaultValues = getDefaultValues(newFilters);
73
73
  setValues(defaultValues);
74
74
  }
75
75
  }, [lang, maxDays, minDays, resort, stay]);
@@ -81,3 +81,11 @@ function MagicBox({ stay, cartUrl, channel = "ESF", className, alignContent, max
81
81
  const classes = classNames(css.root, className);
82
82
  return (_jsx("div", { className: classes, "data-align": alignContent, children: _jsxs("div", { className: css.top, children: [children, currentStep === 0 && (_jsxs(_Fragment, { children: [!filters && _jsx("div", { className: css.loader }), showFilter && (_jsx(Filters, { filters: filters, values: values, setValues: setValues })), _jsxs(Button, { className: css.confirm, onClick: () => setCurrentStep(1), disabled: !isValid, children: [message(lang, "confirm"), _jsx(Icons.Search, {})] })] })), currentStep === 1 && (_jsx(Booking, { stay: stay, cartUrl: cartUrl, channel: channel, values: values, maxCPDuration: maxCPDuration, setCurrentStep: setCurrentStep }))] }) }));
83
83
  }
84
+ function getDefaultValues(filters) {
85
+ return Object.keys(filters || {}).reduce((acc, key) => {
86
+ if (key === "activities" && filters && filters.activities.length === 1) {
87
+ return { ...acc, [key]: filters.activities[0].value };
88
+ }
89
+ return { ...acc, [key]: "" };
90
+ }, {});
91
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.19.5",
3
+ "version": "1.19.7",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^3.1.5",
6
6
  "leaflet": "^1.9.1",