ublo-lib 1.36.31 → 1.37.1
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.
- package/es/common/components/cross-selling-editor/cross-selling-editor.d.ts +3 -1
- package/es/common/components/cross-selling-editor/cross-selling-editor.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/cross-selling-editor.js +4 -2
- package/es/common/components/cross-selling-editor/editor.d.ts +3 -1
- package/es/common/components/cross-selling-editor/editor.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/editor.js +2 -2
- package/es/common/components/cross-selling-editor/esf/index.d.ts +3 -0
- package/es/common/components/cross-selling-editor/esf/index.d.ts.map +1 -0
- package/es/common/components/cross-selling-editor/esf/index.js +2 -0
- package/es/common/components/cross-selling-editor/esf/special-rule-form.d.ts +12 -0
- package/es/common/components/cross-selling-editor/esf/special-rule-form.d.ts.map +1 -0
- package/es/common/components/cross-selling-editor/esf/special-rule-form.js +27 -0
- package/es/common/components/cross-selling-editor/esf/special-rule-form.module.css +4 -0
- package/es/common/components/cross-selling-editor/esf/step-1.d.ts +12 -0
- package/es/common/components/cross-selling-editor/esf/step-1.d.ts.map +1 -0
- package/es/common/components/cross-selling-editor/esf/step-1.js +78 -0
- package/es/common/components/cross-selling-editor/esf/step-1.module.css +35 -0
- package/es/common/components/cross-selling-editor/esf/step-2.d.ts +12 -0
- package/es/common/components/cross-selling-editor/esf/step-2.d.ts.map +1 -0
- package/es/common/components/cross-selling-editor/esf/step-2.js +157 -0
- package/es/common/components/cross-selling-editor/esf/step-2.module.css +72 -0
- package/es/common/components/cross-selling-editor/hooks/use-custom-offers.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/hooks/use-custom-offers.js +8 -4
- package/es/common/components/cross-selling-editor/hooks/use-fetch.d.ts +12 -0
- package/es/common/components/cross-selling-editor/hooks/use-fetch.d.ts.map +1 -0
- package/es/common/components/cross-selling-editor/hooks/use-fetch.js +35 -0
- package/es/common/components/cross-selling-editor/hooks/use-tunnel-offers.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/hooks/use-tunnel-offers.js +6 -4
- package/es/common/components/cross-selling-editor/override-trigger-form.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/override-trigger-form.js +4 -2
- package/es/common/components/cross-selling-editor/override-trigger-form.module.css +1 -0
- package/es/common/components/cross-selling-editor/override.d.ts +2 -1
- package/es/common/components/cross-selling-editor/override.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/override.js +12 -6
- package/es/common/components/cross-selling-editor/overrides-list.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/overrides-list.js +9 -6
- package/es/common/components/cross-selling-editor/overrides-list.module.css +24 -8
- package/es/common/components/cross-selling-editor/rules.d.ts +3 -2
- package/es/common/components/cross-selling-editor/rules.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/rules.js +18 -7
- package/es/common/components/cross-selling-editor/services/api.d.ts +7 -0
- package/es/common/components/cross-selling-editor/services/api.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/services/api.js +101 -3
- package/es/common/components/cross-selling-editor/services/utils.d.ts +12 -6
- package/es/common/components/cross-selling-editor/services/utils.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/services/utils.js +80 -13
- package/es/common/components/cross-selling-editor/tester/index.d.ts +3 -0
- package/es/common/components/cross-selling-editor/tester/index.d.ts.map +1 -0
- package/es/common/components/cross-selling-editor/tester/index.js +2 -0
- package/es/common/components/cross-selling-editor/tester/tester.d.ts +11 -0
- package/es/common/components/cross-selling-editor/tester/tester.d.ts.map +1 -0
- package/es/common/components/cross-selling-editor/{tester.js → tester/tester.js} +72 -27
- package/es/common/components/cross-selling-editor/{tester.module.css → tester/tester.module.css} +1 -0
- package/es/common/components/cross-selling-editor/{tester-tunnel-offer.d.ts → tester/tunnel-offer.d.ts} +4 -3
- package/es/common/components/cross-selling-editor/tester/tunnel-offer.d.ts.map +1 -0
- package/es/common/components/cross-selling-editor/tester/tunnel-offer.js +54 -0
- package/es/common/components/cross-selling-editor/{tester-tunnel-offer.module.css → tester/tunnel-offer.module.css} +16 -3
- package/es/common/components/cross-selling-editor/types.d.ts +66 -0
- package/es/common/components/cross-selling-editor/types.d.ts.map +1 -1
- package/es/lbm/components/instant-search/services/api.d.ts +0 -1
- package/es/lbm/components/instant-search/services/api.d.ts.map +1 -1
- package/es/lbm/components/instant-search/services/api.js +1 -12
- package/package.json +1 -1
- package/es/common/components/cross-selling-editor/tester-tunnel-offer.d.ts.map +0 -1
- package/es/common/components/cross-selling-editor/tester-tunnel-offer.js +0 -21
- package/es/common/components/cross-selling-editor/tester.d.ts +0 -10
- package/es/common/components/cross-selling-editor/tester.d.ts.map +0 -1
|
@@ -2,11 +2,11 @@ export const tunnelOffers = {
|
|
|
2
2
|
HOT: "Hébergement",
|
|
3
3
|
LIFT: "Forfait",
|
|
4
4
|
SKI_RENTAL: "Location de matériel",
|
|
5
|
-
ESF: "
|
|
5
|
+
ESF: "Produit esf",
|
|
6
6
|
CONCIERGERIE: "Conciergerie",
|
|
7
7
|
STAND: "Autre produit",
|
|
8
8
|
};
|
|
9
|
-
export function getSortedOffers(container, cartContent, config) {
|
|
9
|
+
export function getSortedOffers(container, cartContent, config, forcedEsfOverride) {
|
|
10
10
|
if (!container || !cartContent || !config)
|
|
11
11
|
return [];
|
|
12
12
|
const sections = Array.from(container.querySelectorAll(".tunnel-offer"));
|
|
@@ -23,13 +23,13 @@ export function getSortedOffers(container, cartContent, config) {
|
|
|
23
23
|
const title = clonedSection.querySelector(".tunnel-offer__title, [data-title]")?.textContent;
|
|
24
24
|
const uuid = section.getAttribute("data-uuid") || "";
|
|
25
25
|
const weight = Object.keys(config).reduce((acc, key) => {
|
|
26
|
-
const override = getActiveOverride(key, cartContent, config);
|
|
26
|
+
const override = getActiveOverride(key, cartContent, config, forcedEsfOverride);
|
|
27
27
|
const currentWeight = override?.rules?.[uuid]?.weight || 0;
|
|
28
28
|
const inCart = cartContent.items[key] || 0;
|
|
29
29
|
return acc + currentWeight * inCart;
|
|
30
30
|
}, 0);
|
|
31
31
|
const isHidden = Object.keys(config).some((key) => {
|
|
32
|
-
const override = getActiveOverride(key, cartContent, config);
|
|
32
|
+
const override = getActiveOverride(key, cartContent, config, forcedEsfOverride);
|
|
33
33
|
const isHidden = override?.rules?.[uuid]?.hidden || false;
|
|
34
34
|
const inCart = cartContent.items[key] || 0;
|
|
35
35
|
return inCart ? isHidden : false;
|
|
@@ -40,32 +40,36 @@ export function getSortedOffers(container, cartContent, config) {
|
|
|
40
40
|
const sortedOffers = filteredOffers.sort((a, b) => b.weight - a.weight);
|
|
41
41
|
return sortedOffers;
|
|
42
42
|
}
|
|
43
|
-
export function getActiveOverride(key, cartContent, config) {
|
|
43
|
+
export function getActiveOverride(key, cartContent, config, forcedEsfOverride) {
|
|
44
44
|
const { items } = cartContent;
|
|
45
45
|
const amountInCart = items[key];
|
|
46
46
|
const item = config[key];
|
|
47
47
|
if (!amountInCart)
|
|
48
48
|
return item?.default;
|
|
49
|
-
const matchingOverrides = getMatchingOverrides(item, cartContent);
|
|
49
|
+
const matchingOverrides = getMatchingOverrides(item, cartContent, forcedEsfOverride);
|
|
50
50
|
const activeOverride = matchingOverrides.length > 0
|
|
51
51
|
? item?.overrides.find((o) => o.id === matchingOverrides[0])
|
|
52
52
|
: item?.default || {};
|
|
53
53
|
return activeOverride;
|
|
54
54
|
}
|
|
55
|
-
function getMatchingOverrides(item, cartContent) {
|
|
55
|
+
function getMatchingOverrides(item, cartContent, forcedEsfOverride) {
|
|
56
56
|
if (!item)
|
|
57
57
|
return [];
|
|
58
58
|
const { overrides = [] } = item;
|
|
59
59
|
const matchs = overrides.reduce((acc, override) => {
|
|
60
|
-
const { stay, merchants, skiPassDurations = [], durationTags, } = cartContent;
|
|
60
|
+
const { stay, merchants, skiPassDurations = [], durationTags, ellohaGroups, esfOffersContent, } = cartContent;
|
|
61
61
|
const isStayMatching = checkStay(override, stay);
|
|
62
62
|
const isMerchantMatching = checkMerchants(override, merchants);
|
|
63
63
|
const isSkiPassDurationMatching = checkSkiPassDurations(override, skiPassDurations);
|
|
64
64
|
const isDurationTagMatching = checkDurationTags(override, durationTags);
|
|
65
|
+
const isEllohaGroupMatching = checkEllohaGroup(override, ellohaGroups);
|
|
66
|
+
const isEsfProductMatching = checkEsfProduct(override, esfOffersContent, forcedEsfOverride);
|
|
65
67
|
const isMatching = isStayMatching ||
|
|
66
68
|
isMerchantMatching ||
|
|
67
69
|
isSkiPassDurationMatching ||
|
|
68
|
-
isDurationTagMatching
|
|
70
|
+
isDurationTagMatching ||
|
|
71
|
+
isEllohaGroupMatching ||
|
|
72
|
+
isEsfProductMatching;
|
|
69
73
|
return isMatching ? [...acc, override.id] : acc;
|
|
70
74
|
}, []);
|
|
71
75
|
return matchs;
|
|
@@ -94,7 +98,8 @@ function checkMerchants(override, merchants) {
|
|
|
94
98
|
function checkSkiPassDurations(override, skiPassDurations) {
|
|
95
99
|
if (!skiPassDurations)
|
|
96
100
|
return false;
|
|
97
|
-
const
|
|
101
|
+
const durations = skiPassDurations.map(Number);
|
|
102
|
+
const maxDuration = Math.max(...durations);
|
|
98
103
|
const { skiPassDuration, skiPassDurationOperator = ">=" } = override.triggers || {};
|
|
99
104
|
if (!skiPassDuration)
|
|
100
105
|
return false;
|
|
@@ -121,7 +126,33 @@ function checkDurationTags(override, durationTags) {
|
|
|
121
126
|
return false;
|
|
122
127
|
return durationTags.includes(durationTag);
|
|
123
128
|
}
|
|
124
|
-
|
|
129
|
+
function checkEllohaGroup(override, ellohaGroups) {
|
|
130
|
+
if (!ellohaGroups)
|
|
131
|
+
return false;
|
|
132
|
+
const { ellohaGroup } = override.triggers || {};
|
|
133
|
+
if (!ellohaGroup)
|
|
134
|
+
return false;
|
|
135
|
+
return ellohaGroups.includes(ellohaGroup);
|
|
136
|
+
}
|
|
137
|
+
function checkEsfProduct(override, esfOffersContent, forcedEsfOverride) {
|
|
138
|
+
if (!esfOffersContent)
|
|
139
|
+
return false;
|
|
140
|
+
if (forcedEsfOverride) {
|
|
141
|
+
return override.name === forcedEsfOverride;
|
|
142
|
+
}
|
|
143
|
+
const rules = override.triggers?.esf?.rules;
|
|
144
|
+
if (!rules)
|
|
145
|
+
return false;
|
|
146
|
+
return esfOffersContent.some((content) => {
|
|
147
|
+
const keys = Object.keys(content);
|
|
148
|
+
return keys.some((key) => {
|
|
149
|
+
return content[key]?.some((value) => {
|
|
150
|
+
return rules[key].includes(value);
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
export const allowedOverrides = ["HOT", "LIFT", "SKI_RENTAL", "STAND", "ESF"];
|
|
125
156
|
export function hasAllowedOverrides(kind) {
|
|
126
157
|
return allowedOverrides.includes(kind);
|
|
127
158
|
}
|
|
@@ -160,7 +191,7 @@ export function getStayFromCart(cart) {
|
|
|
160
191
|
const duration = bareDuration / (1000 * 3600 * 24);
|
|
161
192
|
return { from, to, duration };
|
|
162
193
|
}
|
|
163
|
-
export
|
|
194
|
+
export function getSkiPassDurationFromCart(cart) {
|
|
164
195
|
const { LIFT: items } = cart.orders;
|
|
165
196
|
if (!items?.length)
|
|
166
197
|
return [];
|
|
@@ -177,7 +208,7 @@ function patchDuration(duration) {
|
|
|
177
208
|
}
|
|
178
209
|
return 1;
|
|
179
210
|
}
|
|
180
|
-
export
|
|
211
|
+
export function getDurationTagsFromCart(cart) {
|
|
181
212
|
const { LIFT: items } = cart.orders;
|
|
182
213
|
if (!items?.length)
|
|
183
214
|
return [];
|
|
@@ -187,9 +218,45 @@ export async function getDurationTagsFromCart(cart) {
|
|
|
187
218
|
const uniqueTags = tags?.length > 0 ? [...new Set(tags)] : [];
|
|
188
219
|
return uniqueTags;
|
|
189
220
|
}
|
|
221
|
+
export function getEllohaGroupsFromCart(cart) {
|
|
222
|
+
const { STAND: items } = cart.orders;
|
|
223
|
+
if (!items?.length)
|
|
224
|
+
return [];
|
|
225
|
+
const groups = items[0].inscriptions.map((i) => i.categoryGroupCode);
|
|
226
|
+
const uniqueGroups = groups?.length > 0 ? [...new Set(groups)] : [];
|
|
227
|
+
return uniqueGroups;
|
|
228
|
+
}
|
|
229
|
+
export function getEsfOffersFromCart(cart) {
|
|
230
|
+
const { ESF: items } = cart.orders;
|
|
231
|
+
if (!items?.length)
|
|
232
|
+
return [];
|
|
233
|
+
return items.reduce((acc, item) => {
|
|
234
|
+
const { inscriptions } = item;
|
|
235
|
+
const offers = inscriptions
|
|
236
|
+
.map((inscription) => inscription?.codes)
|
|
237
|
+
.filter(Boolean);
|
|
238
|
+
return [...acc, ...offers];
|
|
239
|
+
}, []);
|
|
240
|
+
}
|
|
190
241
|
export const CONFIG_ID = "cross-selling-editor";
|
|
191
242
|
export function getConfig(container) {
|
|
243
|
+
const allConfigs = container?.querySelectorAll(`#${CONFIG_ID}`);
|
|
244
|
+
if (allConfigs.length > 1) {
|
|
245
|
+
Array.from(allConfigs).forEach((config) => {
|
|
246
|
+
const isEmpty = config.textContent?.trim().length === 0 || config.textContent === "{}";
|
|
247
|
+
if (isEmpty) {
|
|
248
|
+
config.remove();
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
}
|
|
192
252
|
const config = container?.querySelector(`#${CONFIG_ID}`);
|
|
193
253
|
const json = JSON.parse(config?.textContent || "{}");
|
|
194
254
|
return json;
|
|
195
255
|
}
|
|
256
|
+
export function getIntervalLengthFromDates(from, to) {
|
|
257
|
+
const stayFrom = new Date(from).getTime();
|
|
258
|
+
const stayTo = new Date(to).getTime();
|
|
259
|
+
const diffTime = Math.abs(stayTo - stayFrom);
|
|
260
|
+
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
|
261
|
+
return diffDays;
|
|
262
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/cross-selling-editor/tester/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Config, Durations } from "../types";
|
|
2
|
+
type Props = {
|
|
3
|
+
container: HTMLElement;
|
|
4
|
+
config: Config;
|
|
5
|
+
durations?: Durations;
|
|
6
|
+
tunnelOffersOrder?: string[];
|
|
7
|
+
displayedTunnelOffers?: string[];
|
|
8
|
+
};
|
|
9
|
+
export default function Tester({ container, config, durations, tunnelOffersOrder, displayedTunnelOffers, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=tester.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tester.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/cross-selling-editor/tester/tester.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAoB,MAAM,UAAU,CAAC;AAEpE,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,WAAW,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,EAC7B,SAAS,EACT,MAAM,EACN,SAAS,EACT,iBAAiB,EACjB,qBAAqB,GACtB,EAAE,KAAK,2CAkPP"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import Input from "dt-design-system/es/input";
|
|
4
4
|
import Popover from "dt-design-system/es/popover";
|
|
5
5
|
import Button from "dt-design-system/es/button";
|
|
6
6
|
import * as Icons from "dt-design-system/es/icons";
|
|
7
|
-
import TesterTunnelOffer from "./
|
|
8
|
-
import * as Utils from "
|
|
7
|
+
import TesterTunnelOffer from "./tunnel-offer";
|
|
8
|
+
import * as Utils from "../services/utils";
|
|
9
9
|
import styles from "./tester.module.css";
|
|
10
|
-
export default function Tester({ container, config,
|
|
10
|
+
export default function Tester({ container, config, durations, tunnelOffersOrder, displayedTunnelOffers, }) {
|
|
11
11
|
const ref = React.useRef(null);
|
|
12
12
|
const [stayFrom, setStayFrom] = React.useState("");
|
|
13
13
|
const [stayTo, setStayTo] = React.useState("");
|
|
@@ -15,6 +15,7 @@ export default function Tester({ container, config, tunnelOffers, durations, })
|
|
|
15
15
|
const [merchants, setMerchants] = React.useState([]);
|
|
16
16
|
const [skiPassDurations, setSkiPassDurations] = React.useState([]);
|
|
17
17
|
const [durationTags, setDurationTags] = React.useState([]);
|
|
18
|
+
const [esfRules, setEsfRules] = React.useState([]);
|
|
18
19
|
const updateStayFrom = (value) => {
|
|
19
20
|
setStayFrom(value);
|
|
20
21
|
const stayToIsUndefined = !stayTo;
|
|
@@ -36,6 +37,28 @@ export default function Tester({ container, config, tunnelOffers, durations, })
|
|
|
36
37
|
setStayFrom(newValue);
|
|
37
38
|
}
|
|
38
39
|
};
|
|
40
|
+
const esfOffersContent = (config.ESF?.overrides || []).reduce((acc, override) => {
|
|
41
|
+
const isMatching = esfRules?.includes(override.name);
|
|
42
|
+
if (isMatching) {
|
|
43
|
+
const { kinds, activities, levels, meetings } = override.triggers.esf?.rules || {};
|
|
44
|
+
const config = {
|
|
45
|
+
kinds: kinds ? [kinds] : undefined,
|
|
46
|
+
activities: activities?.split(",").filter(Boolean),
|
|
47
|
+
levels: levels?.split(",").filter(Boolean),
|
|
48
|
+
meetings: meetings?.split(",").filter(Boolean),
|
|
49
|
+
};
|
|
50
|
+
return [...acc, config];
|
|
51
|
+
}
|
|
52
|
+
return acc;
|
|
53
|
+
}, []);
|
|
54
|
+
const allEsfOverridesNames = config.ESF?.overrides?.map(({ name }) => name) || [];
|
|
55
|
+
const firstActiveEsfRule = esfRules?.reduce((acc, rule) => {
|
|
56
|
+
if (!acc)
|
|
57
|
+
return rule;
|
|
58
|
+
const accIndex = allEsfOverridesNames.indexOf(acc);
|
|
59
|
+
const ruleIndex = allEsfOverridesNames.indexOf(rule);
|
|
60
|
+
return ruleIndex < accIndex ? rule : acc;
|
|
61
|
+
}, undefined);
|
|
39
62
|
const stay = Utils.getStayFromCart({ stayFrom, stayTo });
|
|
40
63
|
const cartContent = {
|
|
41
64
|
items: cartOffers,
|
|
@@ -43,8 +66,9 @@ export default function Tester({ container, config, tunnelOffers, durations, })
|
|
|
43
66
|
merchants,
|
|
44
67
|
skiPassDurations,
|
|
45
68
|
durationTags,
|
|
69
|
+
esfOffersContent,
|
|
46
70
|
};
|
|
47
|
-
const sortedOffers = Utils.getSortedOffers(container, cartContent, config);
|
|
71
|
+
const sortedOffers = Utils.getSortedOffers(container, cartContent, config, firstActiveEsfRule);
|
|
48
72
|
const activeOverrides = Object.keys(cartOffers).reduce((acc, key) => {
|
|
49
73
|
const name = Utils.tunnelOffers[key];
|
|
50
74
|
const override = Utils.getActiveOverride(key, cartContent, config);
|
|
@@ -53,7 +77,11 @@ export default function Tester({ container, config, tunnelOffers, durations, })
|
|
|
53
77
|
return acc;
|
|
54
78
|
return { ...acc, [name]: [...(acc[name] || []), override.name] };
|
|
55
79
|
}, {});
|
|
56
|
-
const
|
|
80
|
+
const activeEsfRules = esfRules?.length
|
|
81
|
+
? { "Produit esf": [firstActiveEsfRule] }
|
|
82
|
+
: {};
|
|
83
|
+
const allOverrides = { ...activeOverrides, ...activeEsfRules };
|
|
84
|
+
const activeOverridesKeys = Object.keys(allOverrides);
|
|
57
85
|
const hasActiveOverride = activeOverridesKeys.length > 0;
|
|
58
86
|
const updateCartOffers = (kind) => (value) => {
|
|
59
87
|
setCartOffers((prev) => ({ ...prev, [kind]: value }));
|
|
@@ -61,32 +89,49 @@ export default function Tester({ container, config, tunnelOffers, durations, })
|
|
|
61
89
|
const refreshCartContent = () => {
|
|
62
90
|
const container = ref.current;
|
|
63
91
|
if (container) {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
92
|
+
const states = Array.from(container.querySelectorAll("[data-item-state]"));
|
|
93
|
+
let cartContent = {};
|
|
94
|
+
states.forEach((stateItem) => {
|
|
95
|
+
const state = stateItem.getAttribute("data-item-state");
|
|
96
|
+
if (!state)
|
|
97
|
+
return;
|
|
98
|
+
const parsedState = JSON.parse(state);
|
|
99
|
+
Object.keys(parsedState).forEach((key) => {
|
|
100
|
+
const values = parsedState[key];
|
|
101
|
+
for (const subKey in values) {
|
|
102
|
+
cartContent = {
|
|
103
|
+
...cartContent,
|
|
104
|
+
[key]: [...(cartContent[key] || []), values[subKey]],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
setMerchants(cartContent?.merchants);
|
|
110
|
+
setSkiPassDurations(cartContent?.skiPassDurations);
|
|
111
|
+
setDurationTags(cartContent?.durationTags);
|
|
112
|
+
setEsfRules(cartContent?.esfRules);
|
|
79
113
|
}
|
|
80
114
|
};
|
|
81
|
-
const tunnelOptions = Object.keys(tunnelOffers)
|
|
82
|
-
|
|
115
|
+
const tunnelOptions = Object.keys(Utils.tunnelOffers)
|
|
116
|
+
.map((key) => {
|
|
117
|
+
const label = Utils.tunnelOffers[key];
|
|
83
118
|
return { key, value: key, label };
|
|
119
|
+
})
|
|
120
|
+
.filter(({ value }) => {
|
|
121
|
+
if (!displayedTunnelOffers)
|
|
122
|
+
return true;
|
|
123
|
+
return displayedTunnelOffers.includes(value);
|
|
124
|
+
})
|
|
125
|
+
.sort((a, b) => {
|
|
126
|
+
if (!tunnelOffersOrder)
|
|
127
|
+
return 0;
|
|
128
|
+
return (tunnelOffersOrder.indexOf(a.value) - tunnelOffersOrder.indexOf(b.value));
|
|
84
129
|
});
|
|
85
130
|
return (_jsx("div", { className: styles.tester, children: _jsxs("div", { className: styles.content, children: [_jsxs("div", { className: styles.title, children: ["Pr\u00E9visualisation", _jsxs(Popover, { className: styles.popover, trigger: _jsx(Button, { variant: "transparent", children: _jsx(Icons.Info, {}) }), children: ["Vous pouvez tester les r\u00E8gles de suggestions en modifiant le contenu du panier ci-dessous.", _jsx("br", {}), "Les suggestions de produits s'afficheront dessous en temps r\u00E9el."] })] }), _jsxs("div", { className: styles.header, children: [_jsx("div", { className: styles.headerTitle, children: "Simulez un contenu de panier" }), _jsxs("div", { className: styles.stay, children: [_jsx(Input, { className: styles.input, type: "date", label: "Date de d\u00E9but de s\u00E9jour", value: stayFrom || "", onValueChange: updateStayFrom, compact: true }), _jsx(Input, { className: styles.input, type: "date", label: "Date de fin de s\u00E9jour", value: stayTo || "", onValueChange: updateStayTo, compact: true })] }), _jsx("div", { ref: ref, className: styles.tunnelOffers, children: tunnelOptions.map(({ key, value, label }) => {
|
|
86
|
-
return (_jsx(TesterTunnelOffer, { kind: key, value: value, label: label, cartOffers: cartOffers, updateCartOffers: updateCartOffers, refreshCartContent: refreshCartContent, durations: durations }, key.concat(label)));
|
|
87
|
-
}) })] }), _jsxs("div", { className: styles.activeOverrides, children: [_jsxs("span", { className: styles.activeOverridesTitle, children: ["
|
|
88
|
-
const values =
|
|
89
|
-
return (_jsxs(
|
|
131
|
+
return (_jsx(TesterTunnelOffer, { kind: key, value: value, label: label, cartOffers: cartOffers, updateCartOffers: updateCartOffers, refreshCartContent: refreshCartContent, durations: durations, config: config }, key.concat(label)));
|
|
132
|
+
}) })] }), _jsxs("div", { className: styles.activeOverrides, children: [_jsxs("span", { className: styles.activeOverridesTitle, children: ["Surcharges et r\u00E8gles actives :", " "] }), hasActiveOverride ? (activeOverridesKeys.map((key) => {
|
|
133
|
+
const values = allOverrides[key];
|
|
134
|
+
return (_jsxs(React.Fragment, { children: [_jsxs("span", { className: styles.activeOverride, children: [key, " (", values.join(", "), ")"] }), " "] }, key));
|
|
90
135
|
})) : (_jsx("span", { className: styles.noActiveOverride, children: "Aucune" }))] }), _jsx("div", { className: styles.offers, "data-custom-offers": "", children: sortedOffers.map(({ title, weight, elementHTML }) => {
|
|
91
136
|
return (_jsxs("div", { className: styles.offer, "data-custom-offer": "", children: [_jsx("div", { className: styles.offerContent, dangerouslySetInnerHTML: { __html: elementHTML } }), _jsxs("div", { className: styles.offerWeight, children: ["Priorit\u00E9 : ", _jsx("b", { children: weight })] })] }, title));
|
|
92
137
|
}) })] }) }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Durations } from "
|
|
1
|
+
import type { Config, Durations } from "../types";
|
|
2
2
|
type Props = {
|
|
3
3
|
kind: string;
|
|
4
4
|
value: string;
|
|
@@ -7,7 +7,8 @@ type Props = {
|
|
|
7
7
|
updateCartOffers: (kind: string) => (value: number) => void;
|
|
8
8
|
refreshCartContent: () => void;
|
|
9
9
|
durations?: Durations;
|
|
10
|
+
config: Config;
|
|
10
11
|
};
|
|
11
|
-
export default function TesterTunnelOffer({ kind, value, label, cartOffers, updateCartOffers, refreshCartContent, durations, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default function TesterTunnelOffer({ kind, value, label, cartOffers, updateCartOffers, refreshCartContent, durations, config, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
13
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=tunnel-offer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tunnel-offer.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/cross-selling-editor/tester/tunnel-offer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAIlD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEnC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,IAAI,EACJ,KAAK,EACL,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,MAAM,GACP,EAAE,KAAK,2CAsIP"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import NumberPicker from "dt-design-system/es/number-picker";
|
|
4
|
+
import Input from "dt-design-system/es/input";
|
|
5
|
+
import Select from "dt-design-system/es/select";
|
|
6
|
+
import Popover from "dt-design-system/es/popover";
|
|
7
|
+
import Button from "dt-design-system/es/button";
|
|
8
|
+
import * as Icons from "dt-design-system/es/icons";
|
|
9
|
+
import * as Utils from "../services/utils";
|
|
10
|
+
import styles from "./tunnel-offer.module.css";
|
|
11
|
+
import Checkbox from "dt-design-system/es/checkbox";
|
|
12
|
+
export default function TesterTunnelOffer({ kind, value, label, cartOffers, updateCartOffers, refreshCartContent, durations, config, }) {
|
|
13
|
+
const [state, setState] = React.useState({});
|
|
14
|
+
const overrideAllowed = Utils.allowedOverrides.includes(kind);
|
|
15
|
+
const isSkiPasses = kind === "LIFT";
|
|
16
|
+
const isEsf = kind === "ESF";
|
|
17
|
+
const itemValue = cartOffers[value] || 0;
|
|
18
|
+
const items = [...new Array(itemValue)];
|
|
19
|
+
const esfOverrides = config.ESF?.overrides || [];
|
|
20
|
+
const updateAppliedEsfRules = (name) => (checked) => {
|
|
21
|
+
const currentValues = state.esfRules || [];
|
|
22
|
+
if (!checked) {
|
|
23
|
+
const newValues = currentValues.filter((value) => value !== name);
|
|
24
|
+
const newState = { ...state, esfRules: newValues };
|
|
25
|
+
setState(newState);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const newState = { ...state, esfRules: [...currentValues, name] };
|
|
29
|
+
setState(newState);
|
|
30
|
+
}
|
|
31
|
+
window.requestAnimationFrame(refreshCartContent);
|
|
32
|
+
};
|
|
33
|
+
return (_jsxs("div", { className: styles.item, "data-item-state": JSON.stringify(state), children: [overrideAllowed && items.length > 0 && (_jsxs(Popover, { className: styles.popover, trigger: _jsx(Button, { children: _jsx(Icons.Settings, {}) }), children: [isEsf && (_jsxs(_Fragment, { children: [_jsx("div", { className: styles.esfRulesTitle, children: "R\u00E8gle(s) \u00E0 appliquer" }), !esfOverrides.length && "Aucune de règle spéciale", esfOverrides.map((override) => {
|
|
34
|
+
const { id, name } = override;
|
|
35
|
+
return (_jsx(Checkbox, { label: name, checked: state.esfRules?.includes(name) || false, onCheckedChange: updateAppliedEsfRules(name) }, id));
|
|
36
|
+
})] })), overrideAllowed &&
|
|
37
|
+
items.map((_, index) => {
|
|
38
|
+
const number = index + 1;
|
|
39
|
+
const updateState = (key) => (value) => {
|
|
40
|
+
const currentValues = state[key] || {};
|
|
41
|
+
const newValues = { ...currentValues, [index]: value };
|
|
42
|
+
const newState = { ...state, [key]: newValues };
|
|
43
|
+
setState(newState);
|
|
44
|
+
window.requestAnimationFrame(refreshCartContent);
|
|
45
|
+
};
|
|
46
|
+
if (isEsf) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
if (isSkiPasses) {
|
|
50
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Input, { className: styles.input, label: `Marchand n°${number}`, placeholder: "Code (Optionnel)", value: state.merchants?.[index] || "", onValueChange: updateState("merchants"), compact: true }, index), _jsx(Input, { type: "number", className: styles.input, label: `Durée du forfait n°${number}`, placeholder: "En jour(s) (Optionnel)", min: 0, max: 40, value: state.skiPassDurations?.[index] || 0, onValueChange: updateState("skiPassDurations"), compact: true }), durations && (_jsx(Select, { className: styles.input, label: durations?.title + ` n°${number}`, placeholder: " ", options: durations?.tags, value: state.durationTags?.[index] || "", onValueChange: updateState("durationTags"), compact: true }))] }, index));
|
|
51
|
+
}
|
|
52
|
+
return (_jsx(Input, { className: styles.input, label: `Marchand n°${number}`, placeholder: "Code (Optionnel)", value: state.merchants?.[index] || "", onValueChange: updateState("merchants"), compact: true }, index));
|
|
53
|
+
})] })), _jsx(NumberPicker, { label: label, value: itemValue, onChange: updateCartOffers(value), min: 0, max: 10 })] }, label));
|
|
54
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
.item {
|
|
2
2
|
display: flex;
|
|
3
|
-
|
|
4
|
-
gap: 6px;
|
|
3
|
+
gap: 9px;
|
|
5
4
|
padding: 10px;
|
|
6
5
|
background-color: var(--ds-grey-000, #fff);
|
|
7
|
-
border
|
|
6
|
+
border: 1px solid var(--ds-grey-200, #ededed);
|
|
7
|
+
border-radius: var(--ds-radius-200, 8px);
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
.input > label {
|
|
@@ -16,3 +16,16 @@
|
|
|
16
16
|
.input > label > div {
|
|
17
17
|
flex: 1 1 auto;
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
.popover {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: 6px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.esfRulesTitle {
|
|
27
|
+
margin-bottom: 10px;
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
text-align: center;
|
|
30
|
+
font-weight: 700;
|
|
31
|
+
}
|
|
@@ -7,6 +7,18 @@ type Triggers = {
|
|
|
7
7
|
skiPassDuration?: number;
|
|
8
8
|
skiPassDurationOperator?: Operator;
|
|
9
9
|
durationTag?: string;
|
|
10
|
+
ellohaGroup?: string;
|
|
11
|
+
esf?: {
|
|
12
|
+
season?: string;
|
|
13
|
+
rules?: {
|
|
14
|
+
levels?: string;
|
|
15
|
+
activities?: string;
|
|
16
|
+
kinds?: string;
|
|
17
|
+
meetings?: string;
|
|
18
|
+
products?: string;
|
|
19
|
+
};
|
|
20
|
+
products?: string;
|
|
21
|
+
};
|
|
10
22
|
};
|
|
11
23
|
export type Override = {
|
|
12
24
|
id?: number;
|
|
@@ -26,5 +38,59 @@ export type Durations = {
|
|
|
26
38
|
title: string;
|
|
27
39
|
tags: string[];
|
|
28
40
|
};
|
|
41
|
+
export type EsfWelcome = {
|
|
42
|
+
availableSeasons: string[];
|
|
43
|
+
} | null;
|
|
44
|
+
export type EsfAge = {
|
|
45
|
+
ages: string[];
|
|
46
|
+
};
|
|
47
|
+
export type EsfAges = {
|
|
48
|
+
choices: EsfAge[];
|
|
49
|
+
};
|
|
50
|
+
export type EsfKind = {
|
|
51
|
+
code: string;
|
|
52
|
+
name: string;
|
|
53
|
+
};
|
|
54
|
+
export type EsfKinds = {
|
|
55
|
+
choices: EsfKind[];
|
|
56
|
+
};
|
|
57
|
+
export type EsfActivity = {
|
|
58
|
+
code: string;
|
|
59
|
+
name: string;
|
|
60
|
+
};
|
|
61
|
+
export type EsfActivities = {
|
|
62
|
+
choices: EsfActivity[];
|
|
63
|
+
};
|
|
64
|
+
export type EsfLevel = {
|
|
65
|
+
code: string;
|
|
66
|
+
name: string;
|
|
67
|
+
};
|
|
68
|
+
export type EsfLevels = {
|
|
69
|
+
choices: EsfLevel[];
|
|
70
|
+
};
|
|
71
|
+
export type EsfMeeting = {
|
|
72
|
+
code: string;
|
|
73
|
+
name: string;
|
|
74
|
+
};
|
|
75
|
+
export type EsfMeetings = {
|
|
76
|
+
choices: EsfMeeting[];
|
|
77
|
+
};
|
|
78
|
+
export type EsfProduct = {
|
|
79
|
+
code: string;
|
|
80
|
+
name: string;
|
|
81
|
+
price: number;
|
|
82
|
+
};
|
|
83
|
+
export type EsfProducts = {
|
|
84
|
+
choices: {
|
|
85
|
+
start: string;
|
|
86
|
+
products: EsfProduct[];
|
|
87
|
+
}[];
|
|
88
|
+
};
|
|
89
|
+
export type EsfOffersContent = {
|
|
90
|
+
kinds?: string[];
|
|
91
|
+
activities?: string[];
|
|
92
|
+
levels?: string[];
|
|
93
|
+
meetings?: string[];
|
|
94
|
+
};
|
|
29
95
|
export {};
|
|
30
96
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/common/components/cross-selling-editor/types.ts"],"names":[],"mappings":"AAAA,KAAK,QAAQ,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;AAE9C,KAAK,QAAQ,GAAG;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB,CAAC,EAAE,QAAQ,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/common/components/cross-selling-editor/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -15,5 +15,4 @@ export type GoogleSearchResult = {
|
|
|
15
15
|
};
|
|
16
16
|
export declare function fetchOTResults(query: string, lang: string): Promise<GoogleSearchResult[]>;
|
|
17
17
|
export declare function fetchEvaluation(site: string, lang: string, facet: number, groupLimit?: number, queryBy?: string, queryByWeights?: string, semantic?: boolean): Promise<any>;
|
|
18
|
-
export declare function indexPerType(type: string, entries: any[]): Promise<any>;
|
|
19
18
|
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/services/api.ts"],"names":[],"mappings":"AAkCA,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,MAAW,EACvB,OAAO,GAAE,MAA8B,EACvC,cAAc,CAAC,EAAE,MAAM,EACvB,QAAQ,CAAC,EAAE,OAAO,gBAenB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE;QACR,SAAS,EAAE;YACT,GAAG,EAAE,MAAM,CAAC;SACb,EAAE,CAAC;QACJ,aAAa,EAAE;YACb,GAAG,EAAE,MAAM,CAAC;SACb,EAAE,CAAC;KACL,CAAC;CACH,CAAC;AAEF,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iCAW/D;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,MAAW,EACvB,OAAO,GAAE,MAA8B,EACvC,cAAc,CAAC,EAAE,MAAM,EACvB,QAAQ,CAAC,EAAE,OAAO,gBAanB
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/lbm/components/instant-search/services/api.ts"],"names":[],"mappings":"AAkCA,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,MAAW,EACvB,OAAO,GAAE,MAA8B,EACvC,cAAc,CAAC,EAAE,MAAM,EACvB,QAAQ,CAAC,EAAE,OAAO,gBAenB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE;QACR,SAAS,EAAE;YACT,GAAG,EAAE,MAAM,CAAC;SACb,EAAE,CAAC;QACJ,aAAa,EAAE;YACb,GAAG,EAAE,MAAM,CAAC;SACb,EAAE,CAAC;KACL,CAAC;CACH,CAAC;AAEF,wBAAsB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,iCAW/D;AAED,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,UAAU,GAAE,MAAW,EACvB,OAAO,GAAE,MAA8B,EACvC,cAAc,CAAC,EAAE,MAAM,EACvB,QAAQ,CAAC,EAAE,OAAO,gBAanB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Fetcher from "../../../../common/utils/fetcher";
|
|
2
2
|
import getConfig from "next/config";
|
|
3
3
|
const { publicRuntimeConfig } = getConfig();
|
|
4
|
-
const { searchApi: api, googleSites
|
|
4
|
+
const { searchApi: api, googleSites } = publicRuntimeConfig;
|
|
5
5
|
const QUERY_ITEMS = [
|
|
6
6
|
"title",
|
|
7
7
|
"text",
|
|
@@ -42,14 +42,3 @@ export function fetchEvaluation(site, lang, facet, groupLimit = 40, queryBy = QU
|
|
|
42
42
|
...searchParams(facet, groupLimit, queryBy, queryByWeights, semantic),
|
|
43
43
|
}, { site, lang }, undefined, undefined);
|
|
44
44
|
}
|
|
45
|
-
export async function indexPerType(type, entries) {
|
|
46
|
-
const endpoint = `${api}/api/ublo-search/index/lbm/per-type`;
|
|
47
|
-
return Fetcher.post(endpoint, {
|
|
48
|
-
site,
|
|
49
|
-
type,
|
|
50
|
-
lang: "fr",
|
|
51
|
-
index: entries,
|
|
52
|
-
}, {}, {
|
|
53
|
-
Authorization: "VerUfemboy45",
|
|
54
|
-
});
|
|
55
|
-
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tester-tunnel-offer.d.ts","sourceRoot":"","sources":["../../../../src/common/components/cross-selling-editor/tester-tunnel-offer.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,kBAAkB,EAAE,MAAM,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,IAAI,EACJ,KAAK,EACL,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,GACV,EAAE,KAAK,2CA6DP"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import NumberPicker from "dt-design-system/es/number-picker";
|
|
4
|
-
import Input from "dt-design-system/es/input";
|
|
5
|
-
import Select from "dt-design-system/es/select";
|
|
6
|
-
import * as Utils from "./services/utils";
|
|
7
|
-
import styles from "./tester-tunnel-offer.module.css";
|
|
8
|
-
export default function TesterTunnelOffer({ kind, value, label, cartOffers, updateCartOffers, refreshCartContent, durations, }) {
|
|
9
|
-
const overrideAllowed = Utils.allowedOverrides.includes(kind);
|
|
10
|
-
const isSkiPasses = kind === "LIFT";
|
|
11
|
-
const itemValue = cartOffers[value] || 0;
|
|
12
|
-
const items = [...new Array(itemValue)];
|
|
13
|
-
return (_jsxs("div", { className: styles.item, children: [_jsx(NumberPicker, { label: label, value: itemValue, onChange: updateCartOffers(value), min: 0, max: 10 }), overrideAllowed &&
|
|
14
|
-
items.map((_, index) => {
|
|
15
|
-
const number = index + 1;
|
|
16
|
-
if (isSkiPasses) {
|
|
17
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Input, { type: "number", className: styles.input, "data-kind": "skiPassDuration", label: `Durée du forfait n°${number}`, placeholder: "En jour(s) (Optionnel)", min: 0, max: 40, onChange: refreshCartContent, compact: true }), durations && (_jsx(Select, { className: styles.input, label: durations?.title + ` n°${number}`, placeholder: " ", "data-kind": "durationTags", options: durations?.tags, onChange: refreshCartContent, compact: true }))] }, index));
|
|
18
|
-
}
|
|
19
|
-
return (_jsx(Input, { className: styles.input, "data-kind": "merchant", label: `Marchand n°${number}`, placeholder: "Code (Optionnel)", onChange: refreshCartContent, compact: true }, index));
|
|
20
|
-
})] }, label));
|
|
21
|
-
}
|