ublo-lib 1.37.15 → 1.37.16
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/cart-dialog/cart-dialog.d.ts.map +1 -1
- package/es/common/components/cart-dialog/cart-dialog.js +2 -1
- package/es/common/components/cross-selling-editor/services/utils.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/services/utils.js +15 -24
- package/es/common/components/cross-selling-editor/tester/tester.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/tester/tester.js +7 -4
- package/es/common/components/cross-selling-editor/tester/tunnel-offer.d.ts.map +1 -1
- package/es/common/components/cross-selling-editor/tester/tunnel-offer.js +5 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart-dialog.d.ts","sourceRoot":"","sources":["../../../../src/common/components/cart-dialog/cart-dialog.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"cart-dialog.d.ts","sourceRoot":"","sources":["../../../../src/common/components/cart-dialog/cart-dialog.js"],"names":[],"mappings":";AAsBA;;;;;;;;;4CA6DC"}
|
|
@@ -17,12 +17,13 @@ const products = {
|
|
|
17
17
|
SKI_RENTAL: SkiRental,
|
|
18
18
|
VAKARIO: Vakario,
|
|
19
19
|
};
|
|
20
|
+
const STAND_PRODUCTS = ["VAKARIO", "ELLOHA-ACTIVITY"];
|
|
20
21
|
const CartDialog = ({ cart, setCart, shortcuts, paxPlan, facet, zoneId, zonePath, hasImage, }) => {
|
|
21
22
|
if (!cart)
|
|
22
23
|
return null;
|
|
23
24
|
const { cart: cartContent, kind, data } = cart;
|
|
24
25
|
const isSupported = Object.keys(products).includes(kind);
|
|
25
|
-
const convertedKind = kind
|
|
26
|
+
const convertedKind = STAND_PRODUCTS.includes(kind) ? "STAND" : kind;
|
|
26
27
|
if (!cartContent?.cart?.orders?.[convertedKind]?.[0]) {
|
|
27
28
|
return null;
|
|
28
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/cross-selling-editor/services/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAa,MAAM,UAAU,CAAC;AAE9E,KAAK,IAAI,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC5B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,YAAY;;;;;;;CAOxB,CAAC;AAEF,KAAK,QAAQ,GAAG,MAAM,OAAO,YAAY,CAAC;AAE1C,wBAAgB,eAAe,CAC7B,SAAS,EAAE,WAAW,EACtB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,iBAAiB,CAAC,EAAE,MAAM;;;;;IA6D3B;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,GAAG,QAAQ,EACtB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,iBAAiB,CAAC,EAAE,MAAM,YAoB3B;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/cross-selling-editor/services/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,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AK,KAAK,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,WAAW,EAAE,CAAA;CAAE,CAAC;AAE/D,KAAK,IAAI,GAAG;IACV,MAAM,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,MAY3C;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,YAS9C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI;;;;;;;;EAMzC;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,IAAI,YAKpD;AAcD,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,YAQjD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,YAMjD;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,gBAAgB,EAAE,CAUnE;AAED,eAAO,MAAM,SAAS,yBAAyB,CAAC;AAEhD,wBAAgB,SAAS,CAAC,SAAS,EAAE,WAAW,OAc/C;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,UAOlE"}
|
|
@@ -64,25 +64,12 @@ function getMatchingOverrides(item, cartContent, forcedEsfOverride) {
|
|
|
64
64
|
const isDurationTagMatching = checkDurationTags(override, durationTags);
|
|
65
65
|
const isEllohaGroupMatching = checkEllohaGroup(override, ellohaGroups);
|
|
66
66
|
const isEsfProductMatching = checkEsfProduct(override, esfOffersContent, forcedEsfOverride);
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
if (ellohaGroups?.length > 0) {
|
|
75
|
-
isMatching = isEllohaGroupMatching || isMatching;
|
|
76
|
-
}
|
|
77
|
-
if (skiPassDurations?.length > 0) {
|
|
78
|
-
isMatching = isSkiPassDurationMatching || isMatching;
|
|
79
|
-
}
|
|
80
|
-
if (esfOffersContent?.length > 0) {
|
|
81
|
-
isMatching = isEsfProductMatching || isMatching;
|
|
82
|
-
}
|
|
83
|
-
if (stay) {
|
|
84
|
-
isMatching = isStayMatching || isMatching;
|
|
85
|
-
}
|
|
67
|
+
const isMatching = isStayMatching &&
|
|
68
|
+
isMerchantMatching &&
|
|
69
|
+
isSkiPassDurationMatching &&
|
|
70
|
+
isDurationTagMatching &&
|
|
71
|
+
isEllohaGroupMatching &&
|
|
72
|
+
isEsfProductMatching;
|
|
86
73
|
return isMatching ? [...acc, override.id] : acc;
|
|
87
74
|
}, []);
|
|
88
75
|
return matchs;
|
|
@@ -90,7 +77,7 @@ function getMatchingOverrides(item, cartContent, forcedEsfOverride) {
|
|
|
90
77
|
function checkStay(override, stay) {
|
|
91
78
|
const { stayFrom, stayTo, stayDuration } = override.triggers || {};
|
|
92
79
|
if (!stayFrom || !stayTo || !stay?.from || !stay?.to)
|
|
93
|
-
return
|
|
80
|
+
return true;
|
|
94
81
|
const triggerStayFrom = new Date(stayFrom).getTime();
|
|
95
82
|
const triggerStayTo = new Date(stayTo).getTime();
|
|
96
83
|
const stayFromTime = new Date(stay?.from).getTime();
|
|
@@ -104,7 +91,11 @@ function checkStay(override, stay) {
|
|
|
104
91
|
return stayIsBetweenTrigger || stayHasRightDuration;
|
|
105
92
|
}
|
|
106
93
|
function checkMerchants(override, merchants) {
|
|
94
|
+
if (!merchants?.length)
|
|
95
|
+
return false;
|
|
107
96
|
const { merchant = "" } = override.triggers || {};
|
|
97
|
+
if (!merchant)
|
|
98
|
+
return true;
|
|
108
99
|
const splittedMerchant = merchant.split(",").map((m) => m.trim());
|
|
109
100
|
return merchants && splittedMerchant.some((m) => merchants.includes(m));
|
|
110
101
|
}
|
|
@@ -115,7 +106,7 @@ function checkSkiPassDurations(override, skiPassDurations) {
|
|
|
115
106
|
const maxDuration = Math.max(...durations);
|
|
116
107
|
const { skiPassDuration, skiPassDurationOperator = ">=" } = override.triggers || {};
|
|
117
108
|
if (!skiPassDuration)
|
|
118
|
-
return
|
|
109
|
+
return true;
|
|
119
110
|
switch (skiPassDurationOperator) {
|
|
120
111
|
case ">":
|
|
121
112
|
return maxDuration > skiPassDuration;
|
|
@@ -136,7 +127,7 @@ function checkDurationTags(override, durationTags) {
|
|
|
136
127
|
return false;
|
|
137
128
|
const { durationTag } = override.triggers || {};
|
|
138
129
|
if (!durationTag)
|
|
139
|
-
return
|
|
130
|
+
return true;
|
|
140
131
|
return durationTags.includes(durationTag);
|
|
141
132
|
}
|
|
142
133
|
function checkEllohaGroup(override, ellohaGroups) {
|
|
@@ -144,7 +135,7 @@ function checkEllohaGroup(override, ellohaGroups) {
|
|
|
144
135
|
return false;
|
|
145
136
|
const { ellohaGroup } = override.triggers || {};
|
|
146
137
|
if (!ellohaGroup)
|
|
147
|
-
return
|
|
138
|
+
return true;
|
|
148
139
|
return ellohaGroups.includes(ellohaGroup);
|
|
149
140
|
}
|
|
150
141
|
function checkEsfProduct(override, esfOffersContent, forcedEsfOverride) {
|
|
@@ -155,7 +146,7 @@ function checkEsfProduct(override, esfOffersContent, forcedEsfOverride) {
|
|
|
155
146
|
}
|
|
156
147
|
const rules = override.triggers?.esf?.rules;
|
|
157
148
|
if (!rules)
|
|
158
|
-
return
|
|
149
|
+
return true;
|
|
159
150
|
return esfOffersContent.some((content) => {
|
|
160
151
|
const keys = Object.keys(content);
|
|
161
152
|
return keys.some((key) => {
|
|
@@ -1 +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,
|
|
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,2CAqPP"}
|
|
@@ -16,6 +16,7 @@ export default function Tester({ container, config, durations, tunnelOffersOrder
|
|
|
16
16
|
const [skiPassDurations, setSkiPassDurations] = React.useState([]);
|
|
17
17
|
const [durationTags, setDurationTags] = React.useState([]);
|
|
18
18
|
const [esfRules, setEsfRules] = React.useState([]);
|
|
19
|
+
const [ellohaGroups, setEllohaGroups] = React.useState([]);
|
|
19
20
|
const updateStayFrom = (value) => {
|
|
20
21
|
setStayFrom(value);
|
|
21
22
|
const stayToIsUndefined = !stayTo;
|
|
@@ -67,6 +68,7 @@ export default function Tester({ container, config, durations, tunnelOffersOrder
|
|
|
67
68
|
skiPassDurations,
|
|
68
69
|
durationTags,
|
|
69
70
|
esfOffersContent,
|
|
71
|
+
ellohaGroups,
|
|
70
72
|
};
|
|
71
73
|
const sortedOffers = Utils.getSortedOffers(container, cartContent, config, firstActiveEsfRule);
|
|
72
74
|
const activeOverrides = Object.keys(cartOffers).reduce((acc, key) => {
|
|
@@ -106,10 +108,11 @@ export default function Tester({ container, config, durations, tunnelOffersOrder
|
|
|
106
108
|
}
|
|
107
109
|
});
|
|
108
110
|
});
|
|
109
|
-
setMerchants(cartContent?.merchants);
|
|
110
|
-
setSkiPassDurations(cartContent?.skiPassDurations);
|
|
111
|
-
setDurationTags(cartContent?.durationTags);
|
|
112
|
-
setEsfRules(cartContent?.esfRules);
|
|
111
|
+
setMerchants(cartContent?.merchants || []);
|
|
112
|
+
setSkiPassDurations(cartContent?.skiPassDurations || []);
|
|
113
|
+
setDurationTags(cartContent?.durationTags || []);
|
|
114
|
+
setEsfRules(cartContent?.esfRules || []);
|
|
115
|
+
setEllohaGroups(cartContent?.ellohaGroups || []);
|
|
113
116
|
}
|
|
114
117
|
};
|
|
115
118
|
const tunnelOptions = Object.keys(Utils.tunnelOffers)
|
|
@@ -1 +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,
|
|
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,2CA6JP"}
|
|
@@ -14,6 +14,7 @@ export default function TesterTunnelOffer({ kind, value, label, cartOffers, upda
|
|
|
14
14
|
const overrideAllowed = Utils.allowedOverrides.includes(kind);
|
|
15
15
|
const isSkiPasses = kind === "LIFT";
|
|
16
16
|
const isEsf = kind === "ESF";
|
|
17
|
+
const isStandardProduct = kind === "STAND";
|
|
17
18
|
const itemValue = cartOffers[value] || 0;
|
|
18
19
|
const items = [...new Array(itemValue)];
|
|
19
20
|
const esfOverrides = config.ESF?.overrides || [];
|
|
@@ -47,7 +48,10 @@ export default function TesterTunnelOffer({ kind, value, label, cartOffers, upda
|
|
|
47
48
|
return null;
|
|
48
49
|
}
|
|
49
50
|
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 }
|
|
51
|
+
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 }), _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));
|
|
52
|
+
}
|
|
53
|
+
if (isStandardProduct) {
|
|
54
|
+
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 }), _jsx(Input, { className: styles.input, label: `Groupe Elloha n°${number}`, placeholder: "Nom du groupe (Optionnel)", value: state.ellohaGroups?.[index] || "", onValueChange: updateState("ellohaGroups"), compact: true })] }, index));
|
|
51
55
|
}
|
|
52
56
|
return (_jsx(Input, { className: styles.input, label: `Marchand n°${number}`, placeholder: "Code (Optionnel)", value: state.merchants?.[index] || "", onValueChange: updateState("merchants"), compact: true }, index));
|
|
53
57
|
})] })), _jsx(NumberPicker, { label: label, value: itemValue, onChange: updateCartOffers(value), min: 0, max: 10 })] }, label));
|