ublo-lib 1.12.12 → 1.12.14

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.
@@ -105,8 +105,9 @@ const SearchBar = ({
105
105
  }
106
106
  };
107
107
  const handleBlur = () => {
108
- if (text?.length > 2 && search?.result?.length === 0) {
109
- Plausible.sendGoal("Search failed", {
108
+ if (text?.length > 2) {
109
+ const event = search?.result?.length === 0 ? "Search failed" : "Search canceled";
110
+ Plausible.sendGoal(event, {
110
111
  Terms: text
111
112
  });
112
113
  }
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import classNames from "classnames";
3
+ import getConfig from "next/config";
3
4
  import { useUbloContext } from "ublo/with-ublo";
4
5
  import * as Icons from "dt-design-system/es/icons";
5
6
  import Title from "./title";
@@ -15,28 +16,34 @@ import css from "./period-picker.module.css";
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
16
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
17
18
  import { Fragment as _Fragment } from "react/jsx-runtime";
19
+ const {
20
+ publicRuntimeConfig
21
+ } = getConfig();
22
+ const {
23
+ start,
24
+ end,
25
+ forceSeasonSwitch = false,
26
+ extend
27
+ } = publicRuntimeConfig.season;
18
28
  const WEEK_STORAGE = "stayWeek";
19
29
  const EXTEND_STAY_PICKER_APPEARANCE_DELAY = 1000;
20
30
  const PeriodPicker = ({
21
31
  setClosed,
22
32
  force,
23
33
  onChange,
24
- isPopup
34
+ isPopup,
35
+ ubloContext = {}
25
36
  }) => {
26
37
  const ref = React.useRef();
27
38
  const {
28
39
  lang,
29
- config,
30
40
  cmsMode,
31
41
  metadata,
32
42
  path
33
- } = useUbloContext();
34
- const {
35
- start,
36
- end,
37
- forceSeasonSwitch = false,
38
- extend
39
- } = config.season;
43
+ } = {
44
+ ...ubloContext,
45
+ ...useUbloContext()
46
+ };
40
47
  const [stay, setStay] = React.useState();
41
48
  const [warn, setWarn] = React.useState(false);
42
49
  const [chosenWeek, setChosenWeek] = React.useState();
@@ -58,7 +65,7 @@ const PeriodPicker = ({
58
65
  clearTimeout(extendedTimeout);
59
66
  setExtendedTimeout(setTimeout(() => setExtendedOpened(true), EXTEND_STAY_PICKER_APPEARANCE_DELAY));
60
67
  }
61
- }, [extend, extendedTimeout]);
68
+ }, [extendedTimeout]);
62
69
  const selectWeek = React.useCallback((week, force = false) => {
63
70
  const hasCart = window.sessionStorage.getItem("cartId");
64
71
  if (force || !hasCart) {
@@ -124,7 +131,7 @@ const PeriodPicker = ({
124
131
  }
125
132
  }
126
133
  }
127
- }, [endWeek, forceSeasonSwitch, onChange, selected]);
134
+ }, [endWeek, onChange, selected]);
128
135
  if (metadata?.disableWeekpicker) return null;
129
136
  const select = week => {
130
137
  selectWeek(week);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ublo-lib",
3
- "version": "1.12.12",
3
+ "version": "1.12.14",
4
4
  "peerDependencies": {
5
5
  "dt-design-system": "^2.1.0",
6
6
  "leaflet": "^1.9.1",