ublo-lib 1.35.18 → 1.36.0

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.
Files changed (124) hide show
  1. package/es/common/components/date-picker/calendar.d.ts.map +1 -1
  2. package/es/common/components/date-picker/calendar.js +8 -12
  3. package/es/common/components/date-picker/calendar.module.css +8 -0
  4. package/es/common/components/date-picker/date-picker.module.css +0 -44
  5. package/es/common/components/scrolling-carousel/scrolling-carousel.module.css +4 -0
  6. package/es/lbm/components/instant-search/facet-switch.d.ts +8 -0
  7. package/es/lbm/components/instant-search/facet-switch.d.ts.map +1 -0
  8. package/es/lbm/components/instant-search/facet-switch.js +15 -0
  9. package/es/lbm/components/instant-search/facet-switch.module.css +19 -0
  10. package/es/lbm/components/instant-search/faqs.d.ts +12 -0
  11. package/es/lbm/components/instant-search/faqs.d.ts.map +1 -0
  12. package/es/lbm/components/instant-search/faqs.js +44 -0
  13. package/es/lbm/components/instant-search/faqs.module.css +102 -0
  14. package/es/lbm/components/instant-search/hooks/use-constant.d.ts +2 -0
  15. package/es/lbm/components/instant-search/hooks/use-constant.d.ts.map +1 -0
  16. package/es/lbm/components/instant-search/hooks/use-constant.js +8 -0
  17. package/es/lbm/components/instant-search/hooks/use-debounced-search.d.ts +11 -0
  18. package/es/lbm/components/instant-search/hooks/use-debounced-search.d.ts.map +1 -0
  19. package/es/lbm/components/instant-search/hooks/use-debounced-search.js +12 -0
  20. package/es/lbm/components/instant-search/hooks/use-search.d.ts +17 -0
  21. package/es/lbm/components/instant-search/hooks/use-search.d.ts.map +1 -0
  22. package/es/lbm/components/instant-search/hooks/use-search.js +10 -0
  23. package/es/lbm/components/instant-search/i18n.json +32 -0
  24. package/es/lbm/components/instant-search/index.d.ts +3 -0
  25. package/es/lbm/components/instant-search/index.d.ts.map +1 -0
  26. package/es/lbm/components/instant-search/index.js +2 -0
  27. package/es/lbm/components/instant-search/instant-search.d.ts +19 -0
  28. package/es/lbm/components/instant-search/instant-search.d.ts.map +1 -0
  29. package/es/lbm/components/instant-search/instant-search.js +64 -0
  30. package/es/lbm/components/instant-search/instant-search.module.css +8 -0
  31. package/es/lbm/components/instant-search/links.d.ts +12 -0
  32. package/es/lbm/components/instant-search/links.d.ts.map +1 -0
  33. package/es/lbm/components/instant-search/links.js +30 -0
  34. package/es/lbm/components/instant-search/links.module.css +96 -0
  35. package/es/lbm/components/instant-search/no-product.d.ts +6 -0
  36. package/es/lbm/components/instant-search/no-product.d.ts.map +1 -0
  37. package/es/lbm/components/instant-search/no-product.js +4 -0
  38. package/es/lbm/components/instant-search/products.d.ts +14 -0
  39. package/es/lbm/components/instant-search/products.d.ts.map +1 -0
  40. package/es/lbm/components/instant-search/products.js +47 -0
  41. package/es/lbm/components/instant-search/products.module.css +163 -0
  42. package/es/lbm/components/instant-search/results.d.ts +79 -0
  43. package/es/lbm/components/instant-search/results.d.ts.map +1 -0
  44. package/es/lbm/components/instant-search/results.js +34 -0
  45. package/es/lbm/components/instant-search/results.module.css +85 -0
  46. package/es/lbm/components/instant-search/search-input.d.ts +15 -0
  47. package/es/lbm/components/instant-search/search-input.d.ts.map +1 -0
  48. package/es/lbm/components/instant-search/search-input.js +56 -0
  49. package/es/lbm/components/instant-search/search-input.module.css +88 -0
  50. package/es/lbm/components/instant-search/services/api.d.ts +2 -0
  51. package/es/lbm/components/instant-search/services/api.d.ts.map +1 -0
  52. package/es/lbm/components/instant-search/services/api.js +22 -0
  53. package/es/lbm/components/instant-search/services/lumiplan-api.d.ts +9 -0
  54. package/es/lbm/components/instant-search/services/lumiplan-api.d.ts.map +1 -0
  55. package/es/lbm/components/instant-search/services/lumiplan-api.js +37 -0
  56. package/es/lbm/components/instant-search/services/messages.d.ts +2 -0
  57. package/es/lbm/components/instant-search/services/messages.d.ts.map +1 -0
  58. package/es/lbm/components/instant-search/services/messages.js +5 -0
  59. package/es/lbm/components/instant-search/services/utils.d.ts +4 -0
  60. package/es/lbm/components/instant-search/services/utils.d.ts.map +1 -0
  61. package/es/lbm/components/instant-search/services/utils.js +28 -0
  62. package/es/lbm/components/instant-search/widgets/access.d.ts +8 -0
  63. package/es/lbm/components/instant-search/widgets/access.d.ts.map +1 -0
  64. package/es/lbm/components/instant-search/widgets/access.js +29 -0
  65. package/es/lbm/components/instant-search/widgets/activity.d.ts +8 -0
  66. package/es/lbm/components/instant-search/widgets/activity.d.ts.map +1 -0
  67. package/es/lbm/components/instant-search/widgets/activity.js +74 -0
  68. package/es/lbm/components/instant-search/widgets/activity.module.css +6 -0
  69. package/es/lbm/components/instant-search/widgets/components/card.d.ts +11 -0
  70. package/es/lbm/components/instant-search/widgets/components/card.d.ts.map +1 -0
  71. package/es/lbm/components/instant-search/widgets/components/card.js +15 -0
  72. package/es/lbm/components/instant-search/widgets/components/card.module.css +60 -0
  73. package/es/lbm/components/instant-search/widgets/components/metric.d.ts +8 -0
  74. package/es/lbm/components/instant-search/widgets/components/metric.d.ts.map +1 -0
  75. package/es/lbm/components/instant-search/widgets/components/metric.js +6 -0
  76. package/es/lbm/components/instant-search/widgets/components/metric.module.css +12 -0
  77. package/es/lbm/components/instant-search/widgets/components/status-with-icon.d.ts +9 -0
  78. package/es/lbm/components/instant-search/widgets/components/status-with-icon.d.ts.map +1 -0
  79. package/es/lbm/components/instant-search/widgets/components/status-with-icon.js +5 -0
  80. package/es/lbm/components/instant-search/widgets/components/status-with-icon.module.css +12 -0
  81. package/es/lbm/components/instant-search/widgets/dawn-nights-openings.d.ts +9 -0
  82. package/es/lbm/components/instant-search/widgets/dawn-nights-openings.d.ts.map +1 -0
  83. package/es/lbm/components/instant-search/widgets/dawn-nights-openings.js +37 -0
  84. package/es/lbm/components/instant-search/widgets/dawn-nights-openings.module.css +33 -0
  85. package/es/lbm/components/instant-search/widgets/lift.d.ts +8 -0
  86. package/es/lbm/components/instant-search/widgets/lift.d.ts.map +1 -0
  87. package/es/lbm/components/instant-search/widgets/lift.js +52 -0
  88. package/es/lbm/components/instant-search/widgets/lift.module.css +6 -0
  89. package/es/lbm/components/instant-search/widgets/lifts.d.ts +8 -0
  90. package/es/lbm/components/instant-search/widgets/lifts.d.ts.map +1 -0
  91. package/es/lbm/components/instant-search/widgets/lifts.js +26 -0
  92. package/es/lbm/components/instant-search/widgets/msem-widget.d.ts +8 -0
  93. package/es/lbm/components/instant-search/widgets/msem-widget.d.ts.map +1 -0
  94. package/es/lbm/components/instant-search/widgets/msem-widget.js +31 -0
  95. package/es/lbm/components/instant-search/widgets/msem-widget.module.css +51 -0
  96. package/es/lbm/components/instant-search/widgets/openings.d.ts +8 -0
  97. package/es/lbm/components/instant-search/widgets/openings.d.ts.map +1 -0
  98. package/es/lbm/components/instant-search/widgets/openings.js +32 -0
  99. package/es/lbm/components/instant-search/widgets/slope.d.ts +8 -0
  100. package/es/lbm/components/instant-search/widgets/slope.d.ts.map +1 -0
  101. package/es/lbm/components/instant-search/widgets/slope.js +73 -0
  102. package/es/lbm/components/instant-search/widgets/slope.module.css +26 -0
  103. package/es/lbm/components/instant-search/widgets/slopes.d.ts +8 -0
  104. package/es/lbm/components/instant-search/widgets/slopes.d.ts.map +1 -0
  105. package/es/lbm/components/instant-search/widgets/slopes.js +26 -0
  106. package/es/lbm/components/instant-search/widgets/snow.d.ts +9 -0
  107. package/es/lbm/components/instant-search/widgets/snow.d.ts.map +1 -0
  108. package/es/lbm/components/instant-search/widgets/snow.js +25 -0
  109. package/es/lbm/components/instant-search/widgets/types.d.ts +27 -0
  110. package/es/lbm/components/instant-search/widgets/types.d.ts.map +1 -0
  111. package/es/lbm/components/instant-search/widgets/types.js +1 -0
  112. package/es/lbm/components/instant-search/widgets/weather.d.ts +9 -0
  113. package/es/lbm/components/instant-search/widgets/weather.d.ts.map +1 -0
  114. package/es/lbm/components/instant-search/widgets/weather.js +36 -0
  115. package/es/lbm/components/instant-search/widgets/weather.module.css +32 -0
  116. package/es/lbm/components/instant-search/widgets/webcam.d.ts +8 -0
  117. package/es/lbm/components/instant-search/widgets/webcam.d.ts.map +1 -0
  118. package/es/lbm/components/instant-search/widgets/webcam.js +9 -0
  119. package/es/lbm/components/instant-search/widgets/webcam.module.css +13 -0
  120. package/es/lbm/components/instant-search/widgets.d.ts +11 -0
  121. package/es/lbm/components/instant-search/widgets.d.ts.map +1 -0
  122. package/es/lbm/components/instant-search/widgets.js +68 -0
  123. package/es/lbm/components/instant-search/widgets.module.css +14 -0
  124. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/calendar.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;4CAqPC"}
1
+ {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/common/components/date-picker/calendar.js"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;4CAuQC"}
@@ -2,15 +2,14 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import classNames from "classnames";
4
4
  import { useUbloContext } from "ublo/with-ublo";
5
- import Month from "./month";
6
- import Popup from "ublo-lib/es/common/components/popup";
7
- import Helper from "./helper";
5
+ import Dialog from "dt-design-system/es/dialog";
8
6
  import Button from "dt-design-system/es/button";
9
7
  import * as Icons from "dt-design-system/es/icons";
8
+ import Month from "./month";
9
+ import Helper from "./helper";
10
10
  import * as Messages from "./messages";
11
11
  import * as Data from "./data";
12
12
  import * as Utils from "./utils";
13
- import datePickerStyles from "./date-picker.module.css";
14
13
  import styles from "./calendar.module.css";
15
14
  export default function Calendar({ date, display, stayDates = [], min, max, onSubmit, availabilities, close, singleDate, submitOnSelectionEnd, disableConfirmModal, defaultSelecting, }) {
16
15
  const isDateObject = Utils.isDate(date);
@@ -116,12 +115,9 @@ export default function Calendar({ date, display, stayDates = [], min, max, onSu
116
115
  [styles.calendarTouch]: hide2ndMonth,
117
116
  [styles.calendarLoading]: isLoading,
118
117
  });
119
- return (_jsxs("div", { className: classes, children: [!singleDate && (_jsx(Helper, { lang: lang, selecting: selecting, selectedDates: selectedDates, availabilities: availabilities, isLoading: isLoading, error: error })), _jsxs("div", { className: styles.months, children: [_jsxs("div", { className: styles.controls, children: [_jsx(Button, { variant: "transparent", className: styles.control, onClick: gotoPreviousMonth, disabled: isPast, children: _jsx(Icons.ChevronLeft, {}) }), _jsx(Button, { variant: "transparent", className: styles.control, onClick: gotoNextMonth, children: _jsx(Icons.ChevronRight, {}) })] }), _jsx(Month, { display: display, month: month, year: year, min: min, max: max, selecting: selecting, setSelecting: setSelecting, selectedDates: selectedDates, setSelectedDates: setSelectedDates, firstSelectedDate: firstSelectedDate, setFirstSelectedDate: setFirstSelectedDate, lastSelectedDate: lastSelectedDate, setLastSelectedDate: setLastSelectedDate, singleDate: singleDate, submitOnSelectionEnd: submitOnSelectionEnd, onSubmit: submit, stays: stays, matchingStays: matchingStays, allMatchingStaysEnd: allMatchingStaysEnd }), !hide2ndMonth && (_jsx(Month, { display: display, month: monthAlt, year: yearAlt, min: min, max: max, selecting: selecting, setSelecting: setSelecting, selectedDates: selectedDates, setSelectedDates: setSelectedDates, firstSelectedDate: firstSelectedDate, setFirstSelectedDate: setFirstSelectedDate, lastSelectedDate: lastSelectedDate, setLastSelectedDate: setLastSelectedDate, singleDate: singleDate, submitOnSelectionEnd: submitOnSelectionEnd, onSubmit: submit, stays: stays, matchingStays: matchingStays, allMatchingStaysEnd: allMatchingStaysEnd }))] }), _jsxs("div", { className: styles.buttons, children: [_jsx(Button, { variant: "transparent", className: styles.close, onClick: close, children: Messages.get(lang, "close") }), showReset && (_jsx(Button, { variant: "link", className: styles.reset, onClick: reset, children: Messages.get(lang, "reset") })), _jsxs(Button, { className: styles.submit, onClick: () => submit(selectedDates), disabled: !submitEnabled, children: [_jsx(Icons.Check, {}), Messages.get(lang, "submit")] })] }), showPopup && (_jsx(Popup, { title: Messages.get(lang, "warning-date-change-title"), className: datePickerStyles.popup, close: () => setShowPopup(false), backdrop: true, children: _jsx(ConfirmDateChangeForm, { lang: lang, cancel: () => setShowPopup(false), confirm: () => {
120
- window.sessionStorage.removeItem("cartId");
121
- submit(selectedDates);
122
- setShowPopup(false);
123
- } }) }))] }));
124
- }
125
- function ConfirmDateChangeForm({ lang, cancel, confirm }) {
126
- return (_jsxs("div", { className: styles.confirmDateChange, children: [_jsx("div", { className: styles.confirmDateChangeMessage, children: Messages.get(lang, "warning-date-change-text") }), _jsxs("div", { className: styles.confirmDateChangeButtons, children: [_jsx("button", { className: classNames(styles.confirmDateChangeButton, styles.confirmDateChangeButtonCancel), onClick: cancel, children: Messages.get(lang, "warning-date-change-cancel") }), _jsx("button", { className: classNames(styles.confirmDateChangeButton, styles.confirmDateChangeButtonConfirm), onClick: confirm, children: Messages.get(lang, "warning-date-change-confirm") })] })] }));
118
+ return (_jsxs("div", { className: classes, children: [!singleDate && (_jsx(Helper, { lang: lang, selecting: selecting, selectedDates: selectedDates, availabilities: availabilities, isLoading: isLoading, error: error })), _jsxs("div", { className: styles.months, children: [_jsxs("div", { className: styles.controls, children: [_jsx(Button, { variant: "transparent", className: styles.control, onClick: gotoPreviousMonth, disabled: isPast, children: _jsx(Icons.ChevronLeft, {}) }), _jsx(Button, { variant: "transparent", className: styles.control, onClick: gotoNextMonth, children: _jsx(Icons.ChevronRight, {}) })] }), _jsx(Month, { display: display, month: month, year: year, min: min, max: max, selecting: selecting, setSelecting: setSelecting, selectedDates: selectedDates, setSelectedDates: setSelectedDates, firstSelectedDate: firstSelectedDate, setFirstSelectedDate: setFirstSelectedDate, lastSelectedDate: lastSelectedDate, setLastSelectedDate: setLastSelectedDate, singleDate: singleDate, submitOnSelectionEnd: submitOnSelectionEnd, onSubmit: submit, stays: stays, matchingStays: matchingStays, allMatchingStaysEnd: allMatchingStaysEnd }), !hide2ndMonth && (_jsx(Month, { display: display, month: monthAlt, year: yearAlt, min: min, max: max, selecting: selecting, setSelecting: setSelecting, selectedDates: selectedDates, setSelectedDates: setSelectedDates, firstSelectedDate: firstSelectedDate, setFirstSelectedDate: setFirstSelectedDate, lastSelectedDate: lastSelectedDate, setLastSelectedDate: setLastSelectedDate, singleDate: singleDate, submitOnSelectionEnd: submitOnSelectionEnd, onSubmit: submit, stays: stays, matchingStays: matchingStays, allMatchingStaysEnd: allMatchingStaysEnd }))] }), _jsxs("div", { className: styles.buttons, children: [_jsx(Button, { variant: "transparent", className: styles.close, onClick: close, children: Messages.get(lang, "close") }), showReset && (_jsx(Button, { variant: "link", className: styles.reset, onClick: reset, children: Messages.get(lang, "reset") })), _jsxs(Button, { className: styles.submit, onClick: () => submit(selectedDates), disabled: !submitEnabled, children: [_jsx(Icons.Check, {}), Messages.get(lang, "submit")] })] }), _jsxs(Dialog, { isOpened: showPopup, className: styles.confirmDateChange, close: () => setShowPopup(false), children: [_jsx("div", { className: styles.confirmDateChangeTitle, children: Messages.get(lang, "warning-date-change-title") }), _jsx("div", { className: styles.confirmDateChangeMessage, children: Messages.get(lang, "warning-date-change-text") }), _jsxs("div", { className: styles.confirmDateChangeButtons, children: [_jsx("button", { className: classNames(styles.confirmDateChangeButton, styles.confirmDateChangeButtonCancel), onClick: () => setShowPopup(false), children: Messages.get(lang, "warning-date-change-cancel") }), _jsx("button", { className: classNames(styles.confirmDateChangeButton, styles.confirmDateChangeButtonConfirm), onClick: () => {
119
+ window.sessionStorage.removeItem("cartId");
120
+ submit(selectedDates);
121
+ setShowPopup(false);
122
+ }, children: Messages.get(lang, "warning-date-change-confirm") })] })] })] }));
127
123
  }
@@ -81,9 +81,17 @@ button.close {
81
81
  .confirmDateChange {
82
82
  display: flex;
83
83
  flex-direction: column;
84
+ padding: 14px;
85
+ }
86
+
87
+ .confirmDateChangeTitle {
88
+ color: var(--ds-grey-900, #1d1d1d);
89
+ font-size: 22px;
90
+ font-weight: 700;
84
91
  }
85
92
 
86
93
  .confirmDateChangeMessage {
94
+ padding-top: 20px;
87
95
  color: var(--ds-grey-700, #232324);
88
96
  font-size: 13px;
89
97
  }
@@ -1,44 +0,0 @@
1
- div.popup {
2
- z-index: 5;
3
- }
4
-
5
- .datePicker {
6
- position: relative;
7
- width: min-content;
8
- max-width: 100%;
9
- display: grid;
10
- grid-template-columns: repeat(3, 1fr);
11
- background-color: var(--ds-grey-000, #fff);
12
- border-radius: inherit;
13
- }
14
-
15
- .datePickerPopup {
16
- position: fixed;
17
- top: 50%;
18
- left: 50%;
19
- transform: translate(-50%, -50%);
20
- z-index: 4;
21
- border-radius: var(--ds-radius-400, 20px);
22
- box-shadow: var(--ds-shadow-300, 0 8px 30px rgba(0, 0, 0, 0.12));
23
- animation: date-picker-appearance 160ms
24
- var(--ds-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
25
- }
26
-
27
- .backdrop {
28
- position: fixed;
29
- top: 0;
30
- left: 0;
31
- width: 100%;
32
- height: 100%;
33
- background-color: rgba(255, 255, 255, 0.4);
34
- backdrop-filter: blur(var(--ds-blur, 8px));
35
- z-index: 3;
36
- animation: date-picker-appearance 160ms
37
- var(--ds-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
38
- }
39
-
40
- @keyframes date-picker-appearance {
41
- 0% {
42
- opacity: 0;
43
- }
44
- }
@@ -53,3 +53,7 @@ svg.controlIcon {
53
53
  .inner > :global(.cms) > :global(section) {
54
54
  scroll-snap-align: start;
55
55
  }
56
+
57
+ .inner > :global(.cms) > :global(section:last-child) {
58
+ scroll-snap-align: end;
59
+ }
@@ -0,0 +1,8 @@
1
+ type Props = {
2
+ lang: string;
3
+ facet: number;
4
+ setFacet: (facet: number) => void;
5
+ };
6
+ export default function ThemeSwitch({ lang, facet, setFacet }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=facet-switch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"facet-switch.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/instant-search/facet-switch.tsx"],"names":[],"mappings":"AAgBA,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IAEd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,KAAK,2CAsBnE"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Select from "dt-design-system/es/select";
3
+ import message from "./services/messages";
4
+ import styles from "./facet-switch.module.css";
5
+ export default function ThemeSwitch({ lang, facet, setFacet }) {
6
+ const facets = {
7
+ 0: { icon: "Snowflake", label: message(lang, "winter") },
8
+ 1: { icon: "Sun", label: message(lang, "summer") },
9
+ };
10
+ const options = Object.keys(facets).map((key) => {
11
+ return { value: key, label: facets[key].label };
12
+ });
13
+ const icon = facets[facet].icon;
14
+ return (_jsx(Select, { className: styles.select, icon: icon, options: options, value: facet.toString(), onValueChange: (value) => setFacet(Number(value)), compact: true }));
15
+ }
@@ -0,0 +1,19 @@
1
+ .select {
2
+ }
3
+
4
+ .select label > span {
5
+ display: none;
6
+ }
7
+
8
+ .label {
9
+ display: flex;
10
+ align-items: center;
11
+ gap: 6px;
12
+ }
13
+
14
+ .icon {
15
+ flex: 0 0 16px;
16
+ width: 16px;
17
+ height: 16px;
18
+ fill: currentColor;
19
+ }
@@ -0,0 +1,12 @@
1
+ import type { Hit } from "./results";
2
+ type Props = {
3
+ lang: string;
4
+ faqs: Hit[];
5
+ loading: boolean;
6
+ sendPlausibleGoal: (path: string) => void;
7
+ maximized: boolean;
8
+ setMaximized: (maximized: boolean) => void;
9
+ };
10
+ export default function Faqs({ lang, faqs, loading, sendPlausibleGoal, maximized, setMaximized, }: Props): import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=faqs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faqs.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/instant-search/faqs.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGrC,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IAEjB,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,SAAS,EAAE,OAAO,CAAC;IAEnB,YAAY,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,EAC3B,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,YAAY,GACb,EAAE,KAAK,2CA4DP"}
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ import Link from "ublo/link";
4
+ import Loader from "dt-design-system/es/loader";
5
+ import Button from "dt-design-system/es/button";
6
+ import * as Icons from "dt-design-system/es/icons";
7
+ import * as Ripple from "dt-design-system/es/ripple";
8
+ import message from "./services/messages";
9
+ import * as Utils from "./services/utils";
10
+ import styles from "./faqs.module.css";
11
+ const PLACEHOLDERS = [...new Array(1)];
12
+ export default function Faqs({ lang, faqs, loading, sendPlausibleGoal, maximized, setMaximized, }) {
13
+ const noResult = !loading && !faqs.length;
14
+ if (noResult)
15
+ return null;
16
+ const toggleMaximized = () => {
17
+ setMaximized(!maximized);
18
+ };
19
+ const hasMultipleFaqs = faqs.length > 1;
20
+ const ButtonIcon = Icons[maximized ? "ChevronsDown" : "ChevronsUp"];
21
+ const buttonLabel = message(lang, maximized ? "hideAllFAQs" : "showAllFAQs");
22
+ const firstFaq = faqs?.[0];
23
+ const otherFaqs = faqs.slice(1);
24
+ const classes = classNames(styles.faqs, {
25
+ [styles.maximized]: maximized,
26
+ });
27
+ return (_jsxs("div", { className: classes, children: [_jsxs("div", { className: styles.header, children: [_jsx("div", { className: styles.title, children: message(lang, "faqs") }), hasMultipleFaqs && (_jsxs(Button, { onClick: toggleMaximized, compact: true, children: [_jsx(ButtonIcon, {}), buttonLabel, " (", faqs.length, ")", _jsx(ButtonIcon, {})] }))] }), _jsxs("div", { className: styles.preview, children: [loading &&
28
+ PLACEHOLDERS.map((_, i) => {
29
+ return (_jsx("div", { className: styles.loaderContainer, children: _jsx(Loader, { className: styles.loader, variant: "overlay" }) }, i));
30
+ }), !loading && firstFaq && (_jsx(Faq, { faq: firstFaq, sendPlausibleGoal: sendPlausibleGoal }))] }), maximized && (_jsx("div", { className: styles.list, children: otherFaqs.map((faq) => {
31
+ return (_jsx(Faq, { faq: faq, sendPlausibleGoal: sendPlausibleGoal }, faq.document.path));
32
+ }) }))] }));
33
+ }
34
+ function Faq({ faq, sendPlausibleGoal }) {
35
+ const { document, highlight } = faq;
36
+ const { title, text, path } = document;
37
+ const decodedPath = decodeURIComponent(path);
38
+ const faqTitle = Utils.wrapWithMark(title, highlight.title?.matched_tokens);
39
+ const faqText = Utils.wrapWithMark(text, highlight.text?.matched_tokens);
40
+ const createRipple = (e) => {
41
+ Ripple.create(e);
42
+ };
43
+ return (_jsxs(Link, { className: styles.faq, href: decodedPath, onClick: sendPlausibleGoal(decodedPath), onMouseDown: createRipple, children: [_jsx("div", { className: styles.faqTitle, dangerouslySetInnerHTML: { __html: faqTitle } }), _jsx("div", { className: styles.faqText, dangerouslySetInnerHTML: { __html: faqText } })] }));
44
+ }
@@ -0,0 +1,102 @@
1
+ .faqs {
2
+ position: sticky;
3
+ bottom: 0;
4
+ display: flex;
5
+ flex-direction: column;
6
+ gap: 12px;
7
+ margin-top: auto;
8
+ padding: 12px;
9
+ background-color: var(--ds-grey-000, #fff);
10
+ border-top: var(--ds-input-border, 1px solid var(--ds-grey-300, #d7d7d7));
11
+ }
12
+
13
+ .faqs.maximized {
14
+ flex: 1 1 100%;
15
+ transform: translateY(-1px);
16
+ }
17
+
18
+ .header {
19
+ align-self: flex-start;
20
+ display: flex;
21
+ align-items: center;
22
+ gap: 8px;
23
+ }
24
+
25
+ .title {
26
+ font-size: 17px;
27
+ font-weight: 700;
28
+ padding: 3px 8px;
29
+ background-color: var(--ds-grey-200, #efefef);
30
+ border-radius: var(--ds-radius-100, 6px);
31
+ }
32
+
33
+ .list {
34
+ display: flex;
35
+ flex-direction: column;
36
+ gap: 12px;
37
+ }
38
+
39
+ .loaderContainer {
40
+ position: relative;
41
+ width: 100%;
42
+ height: 52px;
43
+ border-radius: var(--ds-radius-100, 6px);
44
+ }
45
+
46
+ .faq {
47
+ position: relative;
48
+ display: flex;
49
+ flex-direction: column;
50
+ gap: 8px;
51
+ padding: 6px 6px 6px 12px;
52
+ color: var(--ds-grey-500, #484848);
53
+ border-radius: var(--ds-radius-100, 6px);
54
+ transition: background-color 160ms
55
+ var(--ds-transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
56
+ }
57
+
58
+ .faq:is(:hover, :focus) {
59
+ background-color: var(--ds-grey-100, #f5f5f5);
60
+ }
61
+
62
+ .faq::before {
63
+ content: "";
64
+ position: absolute;
65
+ top: 15%;
66
+ left: 0;
67
+ height: 70%;
68
+ width: 2px;
69
+ background-color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
70
+ opacity: 0.5;
71
+ }
72
+
73
+ .faqTitle {
74
+ font-size: 15px;
75
+ font-weight: 700;
76
+ }
77
+
78
+ .faqText {
79
+ font-size: 14px;
80
+ }
81
+
82
+ .faqTitle mark,
83
+ .faqText mark {
84
+ position: relative;
85
+ display: inline-block;
86
+ font-weight: 700;
87
+ color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
88
+ background-color: transparent;
89
+ }
90
+
91
+ .faqTitle mark::before,
92
+ .faqText mark::before {
93
+ content: "";
94
+ position: absolute;
95
+ top: 0;
96
+ left: 0;
97
+ width: 100%;
98
+ height: 100%;
99
+ background-color: var(--ds-secondary, var(--ds-blue-400, #4177f6));
100
+ border-radius: calc(var(--ds-radius-100, 6px) / 3);
101
+ opacity: 0.15;
102
+ }
@@ -0,0 +1,2 @@
1
+ export default function useConstant(fn: any): any;
2
+ //# sourceMappingURL=use-constant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-constant.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/hooks/use-constant.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAAE,EAAE,GAAG,OAQ1C"}
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ export default function useConstant(fn) {
3
+ const ref = React.useRef();
4
+ if (!ref.current) {
5
+ ref.current = { v: fn() };
6
+ }
7
+ return ref.current.v;
8
+ }
@@ -0,0 +1,11 @@
1
+ import * as React from "react";
2
+ type SearchFunction = (text: string, facet: number) => Promise<any>;
3
+ export default function useDebouncedSearch(searchFunction: SearchFunction): {
4
+ text: string;
5
+ setText: React.Dispatch<React.SetStateAction<string>>;
6
+ facet: number;
7
+ setFacet: React.Dispatch<React.SetStateAction<number>>;
8
+ search: import("react-async-hook").UseAsyncReturn<any, any[]>;
9
+ };
10
+ export {};
11
+ //# sourceMappingURL=use-debounced-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-debounced-search.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/hooks/use-debounced-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B,KAAK,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEpE,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,cAAc,EAAE,cAAc;;;;;;EAcxE"}
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import debouncePromise from "awesome-debounce-promise";
3
+ import { useAsync } from "react-async-hook";
4
+ import useConstant from "./use-constant";
5
+ const DEBOUNCE_AMOUNT = 400;
6
+ export default function useDebouncedSearch(searchFunction) {
7
+ const [text, setText] = React.useState("");
8
+ const [facet, setFacet] = React.useState(0);
9
+ const debouncedSearchFunction = useConstant(() => debouncePromise(searchFunction, DEBOUNCE_AMOUNT));
10
+ const search = useAsync(async () => text.length === 0 ? undefined : debouncedSearchFunction(text, facet), [debouncedSearchFunction, text, facet], { setLoading: (state) => ({ ...state, loading: true }) });
11
+ return { text, setText, facet, setFacet, search };
12
+ }
@@ -0,0 +1,17 @@
1
+ /// <reference types="react" />
2
+ export type SearchOptions = {
3
+ groupLimit?: number;
4
+ page?: number;
5
+ perPage?: number;
6
+ queryBy?: string;
7
+ queryByWeights?: string;
8
+ sortBy?: string;
9
+ };
10
+ export default function useSearch(lang: string, options?: SearchOptions): {
11
+ text: string;
12
+ setText: import("react").Dispatch<import("react").SetStateAction<string>>;
13
+ facet: number;
14
+ setFacet: import("react").Dispatch<import("react").SetStateAction<number>>;
15
+ search: import("react-async-hook").UseAsyncReturn<any, any[]>;
16
+ };
17
+ //# sourceMappingURL=use-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-search.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/hooks/use-search.ts"],"names":[],"mappings":";AAOA,MAAM,MAAM,aAAa,GAAG;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB;;;;;;EAY1E"}
@@ -0,0 +1,10 @@
1
+ import getConfig from "next/config";
2
+ import useDebouncedSearch from "./use-debounced-search";
3
+ import * as API from "../services/api";
4
+ const { publicRuntimeConfig } = getConfig();
5
+ const { site } = publicRuntimeConfig;
6
+ export default function useSearch(lang, options = {}) {
7
+ return useDebouncedSearch(async (query, facet) => {
8
+ return API.fetchResults(site, lang, query, facet, options.groupLimit, options.queryBy, options.queryByWeights);
9
+ });
10
+ }
@@ -0,0 +1,32 @@
1
+ {
2
+ "fr": {
3
+ "try": "Essayez",
4
+ "pages": "Pages",
5
+ "faqs": "Questions fréquentes",
6
+ "information": "Informations",
7
+ "documents": "Documents",
8
+ "noProducts": "Pas de produit correspondant",
9
+ "showOtherResults": "Afficher les autres résultats",
10
+ "winter": "Hiver",
11
+ "summer": "Été",
12
+ "results": "résultats pour",
13
+ "result": "résultat pour",
14
+ "showAllFAQs": "Tout afficher",
15
+ "hideAllFAQs": "Réduire"
16
+ },
17
+ "en": {
18
+ "try": "Try",
19
+ "pages": "Pages",
20
+ "faqs": "FAQs",
21
+ "information": "Information",
22
+ "documents": "Documents",
23
+ "noProducts": "No matching product",
24
+ "showOtherResults": "Show other results",
25
+ "winter": "Winter",
26
+ "summer": "Summer",
27
+ "results": "results for",
28
+ "result": "result for",
29
+ "showAllFAQs": "Show all",
30
+ "hideAllFAQs": "Hide all"
31
+ }
32
+ }
@@ -0,0 +1,3 @@
1
+ import InstantSearch from "./instant-search";
2
+ export default InstantSearch;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/instant-search/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,eAAe,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ import InstantSearch from "./instant-search";
2
+ export default InstantSearch;
@@ -0,0 +1,19 @@
1
+ import { type SearchOptions } from "./hooks/use-search";
2
+ type Props = {
3
+ lang: string;
4
+ className?: string;
5
+ ubloContext: {
6
+ lang: string;
7
+ cmsMode: "connected" | "editing" | "info";
8
+ metadata: Record<string, string>;
9
+ path: string;
10
+ };
11
+ suggestions?: {
12
+ fr?: string[];
13
+ en?: string[];
14
+ };
15
+ options?: SearchOptions;
16
+ };
17
+ export default function InstantSearch({ lang, suggestions, className, options, }: Props): import("react/jsx-runtime").JSX.Element;
18
+ export {};
19
+ //# sourceMappingURL=instant-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instant-search.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/instant-search/instant-search.tsx"],"names":[],"mappings":"AAOA,OAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAKnE,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;QAC1C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,WAAW,CAAC,EAAE;QACZ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;QACd,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;KACf,CAAC;IACF,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,IAAI,EACJ,WAAW,EACX,SAAS,EACT,OAAY,GACb,EAAE,KAAK,2CAmGP"}
@@ -0,0 +1,64 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import classNames from "classnames";
4
+ import Router from "next/router";
5
+ import Input from "dt-design-system/es/input";
6
+ import Dialog from "dt-design-system/es/dialog";
7
+ import SearchInput from "./search-input";
8
+ import Results from "./results";
9
+ import useSearch from "./hooks/use-search";
10
+ import * as Plausible from "../../../common/components/plausible";
11
+ import css from "./instant-search.module.css";
12
+ export default function InstantSearch({ lang, suggestions, className, options = {}, }) {
13
+ const [opened, setOpened] = React.useState(false);
14
+ const { text, setText, facet, setFacet, search } = useSearch(lang, options);
15
+ const classes = classNames(css.search, className);
16
+ const openSearch = () => {
17
+ setOpened(true);
18
+ document.body.style.setProperty("overflow", "hidden");
19
+ };
20
+ const closeSearch = (skipEvent) => {
21
+ setOpened(false);
22
+ setText("");
23
+ document.body.style.removeProperty("overflow");
24
+ if (!skipEvent) {
25
+ const event = search?.result?.length === 0 ? "Search failed" : "Search canceled";
26
+ if (text.length > 0) {
27
+ Plausible.sendGoal(event, {
28
+ Terms: text,
29
+ });
30
+ }
31
+ }
32
+ };
33
+ const sendPlausibleGoal = (path) => () => {
34
+ Plausible.sendGoal("Search", {
35
+ "Terms - Destination": `${text} - ${path}`,
36
+ });
37
+ };
38
+ Router.ready(() => {
39
+ Router.events.on("routeChangeStart", () => {
40
+ if (opened) {
41
+ closeSearch(true);
42
+ }
43
+ });
44
+ });
45
+ const handleKeyPresses = React.useCallback((e) => {
46
+ const allowedKeys = ["k"];
47
+ const { code, ctrlKey, key, metaKey } = e;
48
+ const isAllowed = (ctrlKey || metaKey) &&
49
+ (allowedKeys.includes(code) || allowedKeys.includes(key));
50
+ if (!isAllowed)
51
+ return;
52
+ e.preventDefault();
53
+ if (key === "k" && (ctrlKey || metaKey)) {
54
+ openSearch();
55
+ }
56
+ }, []);
57
+ React.useEffect(() => {
58
+ window.addEventListener("keydown", handleKeyPresses);
59
+ return () => {
60
+ window.removeEventListener("keydown", handleKeyPresses);
61
+ };
62
+ }, [handleKeyPresses]);
63
+ return (_jsxs(_Fragment, { children: [_jsx(Input, { icon: "Search", placeholder: "Que recherchez-vous ?", className: classes, onClick: openSearch, readOnly: true }), _jsxs(Dialog, { className: css.dialog, isOpened: opened, showCloseButton: false, close: closeSearch, container: "body", showAsModal: false, children: [_jsx(SearchInput, { lang: lang, text: text, setText: setText, closeSearch: closeSearch, loading: search.loading === true, suggestions: suggestions }), _jsx(Results, { lang: lang, text: text, facet: facet, setFacet: setFacet, results: search.result, loading: search.loading === true && search.result === undefined, sendPlausibleGoal: sendPlausibleGoal })] })] }));
64
+ }
@@ -0,0 +1,8 @@
1
+ .dialog {
2
+ width: 1400px;
3
+ max-width: calc(100% - 6px);
4
+ max-height: calc(100% - 6px);
5
+ background-color: transparent;
6
+ box-shadow: none;
7
+ pointer-events: auto;
8
+ }
@@ -0,0 +1,12 @@
1
+ import type { Hit } from "./results";
2
+ type Props = {
3
+ linksTitle: string;
4
+ icon: "FileText" | "Info" | "Question" | "User" | "File";
5
+ links: Hit[];
6
+ pageTitleAsTitle?: boolean;
7
+ loading: boolean;
8
+ sendPlausibleGoal: (path: string) => void;
9
+ };
10
+ export default function Links({ icon, linksTitle, links, pageTitleAsTitle, loading, sendPlausibleGoal, }: Props): import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=links.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../../../../src/lbm/components/instant-search/links.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGrC,KAAK,KAAK,GAAG;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;IACzD,KAAK,EAAE,GAAG,EAAE,CAAC;IACb,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;IAEjB,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,CAAC;AAIF,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,IAAI,EACJ,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,OAAO,EACP,iBAAiB,GAClB,EAAE,KAAK,2CAmEP"}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import Link from "ublo/link";
3
+ import Loader from "dt-design-system/es/loader";
4
+ import * as Icons from "dt-design-system/es/icons";
5
+ import * as Ripple from "dt-design-system/es/ripple";
6
+ import * as Utils from "./services/utils";
7
+ import css from "./links.module.css";
8
+ const PLACEHOLDERS = [...new Array(3)];
9
+ export default function Links({ icon, linksTitle, links, pageTitleAsTitle, loading, sendPlausibleGoal, }) {
10
+ const Icon = Icons[icon];
11
+ const noResult = !loading && !links.length;
12
+ const createRipple = (e) => {
13
+ Ripple.create(e);
14
+ };
15
+ if (noResult)
16
+ return null;
17
+ return (_jsxs("div", { className: css.linksSection, children: [_jsx("div", { className: css.linksTitle, children: linksTitle }), _jsxs("div", { className: css.links, children: [loading &&
18
+ PLACEHOLDERS.map((_, i) => {
19
+ return (_jsx("div", { className: css.loaderContainer, children: _jsx(Loader, { className: css.loader, variant: "overlay" }) }, i));
20
+ }), !loading &&
21
+ links.map((link) => {
22
+ const { id, text, parentTitle, path, target } = link.document;
23
+ const decodedPath = decodeURIComponent(target || path);
24
+ const titleProperty = pageTitleAsTitle ? "pageTitle" : "title";
25
+ const linkTitle = Utils.getHighlight(titleProperty, link.highlight) ||
26
+ link.document[titleProperty].trim();
27
+ const linkText = Utils.getHighlight("text", link.highlight, true) || text?.trim();
28
+ return (_jsxs(Link, { href: decodedPath, className: css.link, onClick: sendPlausibleGoal(decodedPath), onMouseDown: createRipple, children: [_jsx(Icon, { className: css.linkIcon }), _jsxs("div", { className: css.linkContent, children: [parentTitle && (_jsx("div", { className: css.linkParent, dangerouslySetInnerHTML: { __html: parentTitle } })), _jsx("div", { className: css.linkTitle, dangerouslySetInnerHTML: { __html: linkTitle } }), linkText && (_jsx("div", { className: css.linkText, dangerouslySetInnerHTML: { __html: linkText } }))] })] }, id));
29
+ })] })] }));
30
+ }