@mirai/core 0.3.18 → 0.3.19
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/build/components/Deals/__tests__/__snapshots__/Deals.test.js.snap +22 -22
- package/build/components/Finder/Finder.compact.js +131 -0
- package/build/components/Finder/Finder.compact.js.map +1 -0
- package/build/components/Finder/Finder.constants.js +6 -3
- package/build/components/Finder/Finder.constants.js.map +1 -1
- package/build/components/Finder/Finder.js +73 -43
- package/build/components/Finder/Finder.js.map +1 -1
- package/build/components/Finder/Finder.module.css +36 -0
- package/build/components/Finder/Finder.skeleton.js +48 -0
- package/build/components/Finder/Finder.skeleton.js.map +1 -0
- package/build/components/Finder/__tests__/__snapshots__/Finder.test.js.snap +6049 -931
- package/build/components/Finder/components/Calendar/Calendar.js +4 -7
- package/build/components/Finder/components/Calendar/Calendar.js.map +1 -1
- package/build/components/Finder/helpers/getForwarderUrl.js +62 -0
- package/build/components/Finder/helpers/getForwarderUrl.js.map +1 -0
- package/build/components/Finder/helpers/index.js +11 -0
- package/build/components/Finder/helpers/index.js.map +1 -1
- package/build/components/Rates/Rates.js +47 -30
- package/build/components/Rates/Rates.js.map +1 -1
- package/build/components/Rates/Rates.module.css +3 -6
- package/build/components/Rates/components/Item/Item.js +4 -2
- package/build/components/Rates/components/Item/Item.js.map +1 -1
- package/build/components/Rates/components/Item/Item.l10n.js +6 -0
- package/build/components/Rates/components/Item/Item.l10n.js.map +1 -1
- package/build/components/State/State.js +2 -2
- package/build/components/State/State.js.map +1 -1
- package/build/components/State/State.module.css +1 -0
- package/build/components/__shared__/FieldOccupation/FieldOccupation.js +1 -1
- package/build/components/__shared__/FieldOccupation/FieldOccupation.js.map +1 -1
- package/build/components/__shared__/FieldOccupation/__tests__/__snapshots__/FieldOccupation.test.js.snap +37 -37
- package/build/components/__shared__/FieldOccupation/helpers/getOccupationCaption.js +9 -9
- package/build/components/__shared__/FieldOccupation/helpers/getOccupationCaption.js.map +1 -1
- package/build/components/__shared__/Occupation/helpers/toParties.js.map +1 -1
- package/build/components/helpers/ICON.js +1 -0
- package/build/components/helpers/ICON.js.map +1 -1
- package/build/components/helpers/index.js +11 -0
- package/build/components/helpers/index.js.map +1 -1
- package/build/components/helpers/parseToParties.js +18 -0
- package/build/components/helpers/parseToParties.js.map +1 -0
- package/build/components/index.js +2 -2
- package/build/components/index.js.map +1 -1
- package/package.json +1 -1
- package/public/App.Container.jsx +2 -2
- package/public/App.module.css +5 -0
- package/public/routes/Home.jsx +2 -2
- package/public/routes/routes.module.css +5 -0
- package/public/themes/monalisa.theme.css +6 -4
|
@@ -1618,11 +1618,11 @@ exports[`component:<Deals> inherit:className 1`] = `
|
|
|
1618
1618
|
xmlns="http://www.w3.org/2000/svg"
|
|
1619
1619
|
>
|
|
1620
1620
|
<path
|
|
1621
|
-
d="M0
|
|
1621
|
+
d="M0 0h24v24H0z"
|
|
1622
1622
|
fill="none"
|
|
1623
1623
|
/>
|
|
1624
1624
|
<path
|
|
1625
|
-
d="
|
|
1625
|
+
d="M16.67 13.13C18.04 14.06 19 15.32 19 17v3h4v-3c0-2.18-3.57-3.47-6.33-3.87zM15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4c-.47 0-.91.1-1.33.24a5.98 5.98 0 010 7.52c.42.14.86.24 1.33.24zM9 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zM9 13c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4zm6 5H3v-.99C3.2 16.29 6.3 15 9 15s5.8 1.29 6 2v1z"
|
|
1626
1626
|
/>
|
|
1627
1627
|
</svg>
|
|
1628
1628
|
</span>
|
|
@@ -1632,13 +1632,13 @@ exports[`component:<Deals> inherit:className 1`] = `
|
|
|
1632
1632
|
<span
|
|
1633
1633
|
class="text action"
|
|
1634
1634
|
>
|
|
1635
|
-
finder.label.
|
|
1635
|
+
finder.label.occupation
|
|
1636
1636
|
<span
|
|
1637
1637
|
style="text-decoration: underline;"
|
|
1638
1638
|
>
|
|
1639
|
-
type
|
|
1639
|
+
type
|
|
1640
1640
|
</span>
|
|
1641
|
-
|
|
1641
|
+
guest · finder.label.place_type.room
|
|
1642
1642
|
</span>
|
|
1643
1643
|
</div>
|
|
1644
1644
|
<span
|
|
@@ -3555,11 +3555,11 @@ exports[`component:<Deals> prop:value 1`] = `
|
|
|
3555
3555
|
xmlns="http://www.w3.org/2000/svg"
|
|
3556
3556
|
>
|
|
3557
3557
|
<path
|
|
3558
|
-
d="M0
|
|
3558
|
+
d="M0 0h24v24H0z"
|
|
3559
3559
|
fill="none"
|
|
3560
3560
|
/>
|
|
3561
3561
|
<path
|
|
3562
|
-
d="
|
|
3562
|
+
d="M16.67 13.13C18.04 14.06 19 15.32 19 17v3h4v-3c0-2.18-3.57-3.47-6.33-3.87zM15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4c-.47 0-.91.1-1.33.24a5.98 5.98 0 010 7.52c.42.14.86.24 1.33.24zM9 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zM9 13c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4zm6 5H3v-.99C3.2 16.29 6.3 15 9 15s5.8 1.29 6 2v1z"
|
|
3563
3563
|
/>
|
|
3564
3564
|
</svg>
|
|
3565
3565
|
</span>
|
|
@@ -3569,19 +3569,19 @@ exports[`component:<Deals> prop:value 1`] = `
|
|
|
3569
3569
|
<span
|
|
3570
3570
|
class="text action"
|
|
3571
3571
|
>
|
|
3572
|
-
finder.label.
|
|
3572
|
+
finder.label.occupation
|
|
3573
3573
|
<span
|
|
3574
3574
|
style="text-decoration: underline;"
|
|
3575
3575
|
>
|
|
3576
|
-
type
|
|
3576
|
+
type
|
|
3577
3577
|
</span>
|
|
3578
|
-
|
|
3578
|
+
adult, finder.label.occupation
|
|
3579
3579
|
<span
|
|
3580
3580
|
style="text-decoration: underline;"
|
|
3581
3581
|
>
|
|
3582
|
-
|
|
3582
|
+
type
|
|
3583
3583
|
</span>
|
|
3584
|
-
|
|
3584
|
+
child · finder.label.place_type.room
|
|
3585
3585
|
</span>
|
|
3586
3586
|
</div>
|
|
3587
3587
|
<span
|
|
@@ -5638,11 +5638,11 @@ exports[`component:<Deals> renders 1`] = `
|
|
|
5638
5638
|
xmlns="http://www.w3.org/2000/svg"
|
|
5639
5639
|
>
|
|
5640
5640
|
<path
|
|
5641
|
-
d="M0
|
|
5641
|
+
d="M0 0h24v24H0z"
|
|
5642
5642
|
fill="none"
|
|
5643
5643
|
/>
|
|
5644
5644
|
<path
|
|
5645
|
-
d="
|
|
5645
|
+
d="M16.67 13.13C18.04 14.06 19 15.32 19 17v3h4v-3c0-2.18-3.57-3.47-6.33-3.87zM15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4c-.47 0-.91.1-1.33.24a5.98 5.98 0 010 7.52c.42.14.86.24 1.33.24zM9 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zM9 13c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4zm6 5H3v-.99C3.2 16.29 6.3 15 9 15s5.8 1.29 6 2v1z"
|
|
5646
5646
|
/>
|
|
5647
5647
|
</svg>
|
|
5648
5648
|
</span>
|
|
@@ -5652,13 +5652,13 @@ exports[`component:<Deals> renders 1`] = `
|
|
|
5652
5652
|
<span
|
|
5653
5653
|
class="text action"
|
|
5654
5654
|
>
|
|
5655
|
-
finder.label.
|
|
5655
|
+
finder.label.occupation
|
|
5656
5656
|
<span
|
|
5657
5657
|
style="text-decoration: underline;"
|
|
5658
5658
|
>
|
|
5659
|
-
type
|
|
5659
|
+
type
|
|
5660
5660
|
</span>
|
|
5661
|
-
|
|
5661
|
+
guest · finder.label.place_type.room
|
|
5662
5662
|
</span>
|
|
5663
5663
|
</div>
|
|
5664
5664
|
<span
|
|
@@ -7574,11 +7574,11 @@ exports[`component:<Deals> testID 1`] = `
|
|
|
7574
7574
|
xmlns="http://www.w3.org/2000/svg"
|
|
7575
7575
|
>
|
|
7576
7576
|
<path
|
|
7577
|
-
d="M0
|
|
7577
|
+
d="M0 0h24v24H0z"
|
|
7578
7578
|
fill="none"
|
|
7579
7579
|
/>
|
|
7580
7580
|
<path
|
|
7581
|
-
d="
|
|
7581
|
+
d="M16.67 13.13C18.04 14.06 19 15.32 19 17v3h4v-3c0-2.18-3.57-3.47-6.33-3.87zM15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4c-.47 0-.91.1-1.33.24a5.98 5.98 0 010 7.52c.42.14.86.24 1.33.24zM9 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0-6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zM9 13c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4zm6 5H3v-.99C3.2 16.29 6.3 15 9 15s5.8 1.29 6 2v1z"
|
|
7582
7582
|
/>
|
|
7583
7583
|
</svg>
|
|
7584
7584
|
</span>
|
|
@@ -7588,13 +7588,13 @@ exports[`component:<Deals> testID 1`] = `
|
|
|
7588
7588
|
<span
|
|
7589
7589
|
class="text action"
|
|
7590
7590
|
>
|
|
7591
|
-
finder.label.
|
|
7591
|
+
finder.label.occupation
|
|
7592
7592
|
<span
|
|
7593
7593
|
style="text-decoration: underline;"
|
|
7594
7594
|
>
|
|
7595
|
-
type
|
|
7595
|
+
type
|
|
7596
7596
|
</span>
|
|
7597
|
-
|
|
7597
|
+
guest · finder.label.place_type.room
|
|
7598
7598
|
</span>
|
|
7599
7599
|
</div>
|
|
7600
7600
|
<span
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Compact = void 0;
|
|
8
|
+
var _dataSources = require("@mirai/data-sources");
|
|
9
|
+
var _locale = require("@mirai/locale");
|
|
10
|
+
var _ui = require("@mirai/ui");
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
var _Finder = require("./Finder.constants");
|
|
14
|
+
var style = _interopRequireWildcard(require("./Finder.module.css"));
|
|
15
|
+
var _helpers = require("./helpers");
|
|
16
|
+
var _BookingDates = require("../__shared__/BookingDates/BookingDates.l10n");
|
|
17
|
+
var _helpers2 = require("../__shared__/FieldOccupation/helpers");
|
|
18
|
+
var _helpers3 = require("../helpers");
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
25
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
26
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
27
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
28
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
30
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
31
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
32
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
33
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
34
|
+
var DATE_FORMAT_COMPACT = {
|
|
35
|
+
month: 'short',
|
|
36
|
+
day: 'numeric'
|
|
37
|
+
};
|
|
38
|
+
var Compact = exports.Compact = function Compact() {
|
|
39
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
40
|
+
_ref$dataSource = _ref.dataSource,
|
|
41
|
+
_ref$dataSource2 = _ref$dataSource === void 0 ? {} : _ref$dataSource,
|
|
42
|
+
_ref$dataSource2$plac = _ref$dataSource2.places,
|
|
43
|
+
places = _ref$dataSource2$plac === void 0 ? {} : _ref$dataSource2$plac,
|
|
44
|
+
placesSource = _ref$dataSource2.placesSource,
|
|
45
|
+
_ref$value = _ref.value,
|
|
46
|
+
_ref$value2 = _ref$value === void 0 ? {} : _ref$value,
|
|
47
|
+
_ref$value2$calendar = _ref$value2.calendar,
|
|
48
|
+
_ref$value2$calendar2 = _ref$value2$calendar === void 0 ? [] : _ref$value2$calendar,
|
|
49
|
+
_ref$value2$calendar3 = _slicedToArray(_ref$value2$calendar2, 2),
|
|
50
|
+
from = _ref$value2$calendar3[0],
|
|
51
|
+
to = _ref$value2$calendar3[1],
|
|
52
|
+
_ref$value2$occupatio = _ref$value2.occupation,
|
|
53
|
+
occupation = _ref$value2$occupatio === void 0 ? [] : _ref$value2$occupatio,
|
|
54
|
+
_ref$value2$place = _ref$value2.place,
|
|
55
|
+
_ref$value2$place2 = _ref$value2$place === void 0 ? {} : _ref$value2$place,
|
|
56
|
+
place = _ref$value2$place2.value,
|
|
57
|
+
promocode = _ref$value2.promocode,
|
|
58
|
+
_ref$onExpand = _ref.onExpand,
|
|
59
|
+
onExpand = _ref$onExpand === void 0 ? function () {} : _ref$onExpand,
|
|
60
|
+
_ref$onSubmit = _ref.onSubmit,
|
|
61
|
+
onSubmit = _ref$onSubmit === void 0 ? function () {} : _ref$onSubmit;
|
|
62
|
+
var _useDevice = (0, _ui.useDevice)(),
|
|
63
|
+
isMobile = _useDevice.isMobile;
|
|
64
|
+
var _useLocale = (0, _locale.useLocale)(),
|
|
65
|
+
dateFormat = _useLocale.dateFormat,
|
|
66
|
+
translate = _useLocale.translate;
|
|
67
|
+
var _useStore = (0, _dataSources.useStore)(),
|
|
68
|
+
_useStore$value = _useStore.value,
|
|
69
|
+
_useStore$value$confi = _useStore$value.config,
|
|
70
|
+
_useStore$value$confi2 = _useStore$value$confi === void 0 ? {} : _useStore$value$confi,
|
|
71
|
+
dataSource = _useStore$value$confi2.hotels,
|
|
72
|
+
individual = _useStore$value$confi2.lodgingDenomination,
|
|
73
|
+
locale = _useStore$value.locale;
|
|
74
|
+
var hotels = (0, _helpers.getHotels)(placesSource, place);
|
|
75
|
+
var icon = {
|
|
76
|
+
className: style.icon
|
|
77
|
+
};
|
|
78
|
+
var text = {
|
|
79
|
+
action: !isMobile,
|
|
80
|
+
small: isMobile
|
|
81
|
+
};
|
|
82
|
+
return /*#__PURE__*/_react.default.createElement(_ui.View, {
|
|
83
|
+
row: true,
|
|
84
|
+
className: style.compact
|
|
85
|
+
}, place && /*#__PURE__*/_react.default.createElement(_ui.Pressable, {
|
|
86
|
+
onPress: function onPress() {
|
|
87
|
+
return onExpand(_Finder.VIEW.PLACE);
|
|
88
|
+
}
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Icon, _extends({}, icon, {
|
|
90
|
+
value: _Finder.FIELD.PLACE.icon
|
|
91
|
+
})), /*#__PURE__*/_react.default.createElement(_ui.Text, text, (0, _helpers.getPlaceCaption)(place, places.options))), /*#__PURE__*/_react.default.createElement(_ui.Pressable, {
|
|
92
|
+
onPress: function onPress() {
|
|
93
|
+
return onExpand(_Finder.VIEW.CALENDAR);
|
|
94
|
+
}
|
|
95
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Icon, _extends({}, icon, {
|
|
96
|
+
value: _Finder.FIELD.CALENDAR.icon
|
|
97
|
+
})), /*#__PURE__*/_react.default.createElement(_ui.Text, text, "".concat(from ? dateFormat(from, _objectSpread({
|
|
98
|
+
locale: locale
|
|
99
|
+
}, DATE_FORMAT_COMPACT)) : translate(_BookingDates.L10N.LABEL_CHECK_IN), " \u2500 ").concat(to ? dateFormat(to, _objectSpread({
|
|
100
|
+
locale: locale
|
|
101
|
+
}, DATE_FORMAT_COMPACT)) : translate(_BookingDates.L10N.LABEL_CHECK_OUT)))), /*#__PURE__*/_react.default.createElement(_ui.Pressable, {
|
|
102
|
+
onPress: function onPress() {
|
|
103
|
+
return onExpand(_Finder.VIEW.OCCUPATION);
|
|
104
|
+
}
|
|
105
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Icon, _extends({}, icon, {
|
|
106
|
+
value: _Finder.FIELD.OCCUPATION.icon
|
|
107
|
+
})), /*#__PURE__*/_react.default.createElement(_ui.Text, text, (0, _helpers2.getOccupationCaption)(occupation, translate, (0, _helpers2.getAccommodationType)({
|
|
108
|
+
dataSource: dataSource,
|
|
109
|
+
hotels: hotels,
|
|
110
|
+
individual: individual
|
|
111
|
+
})))), promocode && !isMobile && /*#__PURE__*/_react.default.createElement(_ui.Pressable, {
|
|
112
|
+
onPress: function onPress() {
|
|
113
|
+
return onExpand(_Finder.VIEW.PROMOCODE);
|
|
114
|
+
}
|
|
115
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Icon, _extends({}, icon, {
|
|
116
|
+
value: _Finder.FIELD.PROMOCODE.icon
|
|
117
|
+
})), /*#__PURE__*/_react.default.createElement(_ui.Text, text, promocode)), !isMobile && /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
118
|
+
small: true,
|
|
119
|
+
squared: true,
|
|
120
|
+
onPress: onSubmit
|
|
121
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Icon, {
|
|
122
|
+
value: _helpers3.ICON.SEARCH
|
|
123
|
+
})));
|
|
124
|
+
};
|
|
125
|
+
Compact.propTypes = {
|
|
126
|
+
dataSource: _propTypes.default.any,
|
|
127
|
+
value: _propTypes.default.any,
|
|
128
|
+
onExpand: _propTypes.default.func,
|
|
129
|
+
onSubmit: _propTypes.default.func
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=Finder.compact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Finder.compact.js","names":["_dataSources","require","_locale","_ui","_propTypes","_interopRequireDefault","_react","_Finder","style","_interopRequireWildcard","_helpers","_BookingDates","_helpers2","_helpers3","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","e","r","t","keys","getOwnPropertySymbols","o","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","Number","_extends","assign","bind","target","i","source","_slicedToArray","arr","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","minLen","_arrayLikeToArray","n","toString","slice","constructor","name","Array","from","test","len","arr2","l","iterator","u","a","f","next","done","return","isArray","DATE_FORMAT_COMPACT","month","day","Compact","exports","_ref","_ref$dataSource","dataSource","_ref$dataSource2","_ref$dataSource2$plac","places","placesSource","_ref$value","_ref$value2","_ref$value2$calendar","calendar","_ref$value2$calendar2","_ref$value2$calendar3","to","_ref$value2$occupatio","occupation","_ref$value2$place","place","_ref$value2$place2","promocode","_ref$onExpand","onExpand","_ref$onSubmit","onSubmit","_useDevice","useDevice","isMobile","_useLocale","useLocale","dateFormat","translate","_useStore","useStore","_useStore$value","_useStore$value$confi","config","_useStore$value$confi2","hotels","individual","lodgingDenomination","locale","getHotels","icon","className","text","action","small","createElement","View","row","compact","Pressable","onPress","VIEW","PLACE","Icon","FIELD","Text","getPlaceCaption","options","CALENDAR","concat","L10N","LABEL_CHECK_IN","LABEL_CHECK_OUT","OCCUPATION","getOccupationCaption","getAccommodationType","PROMOCODE","Button","squared","ICON","SEARCH","propTypes","PropTypes","any","func"],"sources":["../../../src/components/Finder/Finder.compact.jsx"],"sourcesContent":["import { useStore } from '@mirai/data-sources';\nimport { useLocale } from '@mirai/locale';\nimport { Button, Icon, Pressable, Text, useDevice, View } from '@mirai/ui';\nimport PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { FIELD } from './Finder.constants';\nimport { VIEW } from './Finder.constants';\nimport * as style from './Finder.module.css';\nimport { getHotels, getPlaceCaption } from './helpers';\nimport {} from './helpers';\nimport { L10N } from '../__shared__/BookingDates/BookingDates.l10n';\nimport { getAccommodationType, getOccupationCaption } from '../__shared__/FieldOccupation/helpers';\nimport { ICON } from '../helpers';\n\nconst DATE_FORMAT_COMPACT = { month: 'short', day: 'numeric' };\n\nconst Compact = ({\n dataSource: { places = {}, placesSource } = {},\n value: { calendar: [from, to] = [], occupation = [], place: { value: place } = {}, promocode } = {},\n onExpand = () => {},\n onSubmit = () => {},\n} = {}) => {\n const { isMobile } = useDevice();\n const { dateFormat, translate } = useLocale();\n const {\n value: { config: { hotels: dataSource, lodgingDenomination: individual } = {}, locale },\n } = useStore();\n\n const hotels = getHotels(placesSource, place);\n\n const icon = { className: style.icon };\n const text = { action: !isMobile, small: isMobile };\n\n return (\n <View row className={style.compact}>\n {place && (\n <Pressable onPress={() => onExpand(VIEW.PLACE)}>\n <Icon {...icon} value={FIELD.PLACE.icon} />\n <Text {...text}>{getPlaceCaption(place, places.options)}</Text>\n </Pressable>\n )}\n\n <Pressable onPress={() => onExpand(VIEW.CALENDAR)}>\n <Icon {...icon} value={FIELD.CALENDAR.icon} />\n <Text {...text}>\n {`${from ? dateFormat(from, { locale, ...DATE_FORMAT_COMPACT }) : translate(L10N.LABEL_CHECK_IN)} ─ ${\n to ? dateFormat(to, { locale, ...DATE_FORMAT_COMPACT }) : translate(L10N.LABEL_CHECK_OUT)\n }`}\n </Text>\n </Pressable>\n\n <Pressable onPress={() => onExpand(VIEW.OCCUPATION)}>\n <Icon {...icon} value={FIELD.OCCUPATION.icon} />\n <Text {...text}>\n {getOccupationCaption(occupation, translate, getAccommodationType({ dataSource, hotels, individual }))}\n </Text>\n </Pressable>\n\n {promocode && !isMobile && (\n <Pressable onPress={() => onExpand(VIEW.PROMOCODE)}>\n <Icon {...icon} value={FIELD.PROMOCODE.icon} />\n <Text {...text}>{promocode}</Text>\n </Pressable>\n )}\n\n {!isMobile && (\n <Button small squared onPress={onSubmit}>\n <Icon value={ICON.SEARCH} />\n </Button>\n )}\n </View>\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Property(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VIEW = exports.TYPE = exports.FIELD = void 0;
|
|
7
|
+
var _Core = require("../../Core.constants");
|
|
7
8
|
var _helpers = require("../helpers");
|
|
9
|
+
var CHAIN = _Core.TYPE.CHAIN,
|
|
10
|
+
HOTEL = _Core.TYPE.HOTEL;
|
|
8
11
|
var FIELD = exports.FIELD = {
|
|
9
12
|
PLACE: {
|
|
10
13
|
icon: _helpers.ICON.BED_DOUBLE,
|
|
@@ -15,7 +18,7 @@ var FIELD = exports.FIELD = {
|
|
|
15
18
|
tabIndex: 1
|
|
16
19
|
},
|
|
17
20
|
OCCUPATION: {
|
|
18
|
-
icon: _helpers.ICON.
|
|
21
|
+
icon: _helpers.ICON.PEOPLE,
|
|
19
22
|
tabIndex: 2
|
|
20
23
|
},
|
|
21
24
|
PROMOCODE: {
|
|
@@ -31,7 +34,7 @@ var VIEW = exports.VIEW = {
|
|
|
31
34
|
PROMOCODE: 'promocode'
|
|
32
35
|
};
|
|
33
36
|
var TYPE = exports.TYPE = {
|
|
34
|
-
CHAIN:
|
|
35
|
-
HOTEL:
|
|
37
|
+
CHAIN: CHAIN,
|
|
38
|
+
HOTEL: HOTEL
|
|
36
39
|
};
|
|
37
40
|
//# sourceMappingURL=Finder.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Finder.constants.js","names":["
|
|
1
|
+
{"version":3,"file":"Finder.constants.js","names":["_Core","require","_helpers","CHAIN","coreTYPE","HOTEL","FIELD","exports","PLACE","icon","ICON","BED_DOUBLE","tabIndex","CALENDAR","OCCUPATION","PEOPLE","PROMOCODE","LOCK","inputMode","VIEW","TYPE"],"sources":["../../../src/components/Finder/Finder.constants.js"],"sourcesContent":["import { TYPE as coreTYPE } from '../../Core.constants';\nimport { ICON } from '../helpers';\n\nconst { CHAIN, HOTEL } = coreTYPE;\n\nconst FIELD = {\n PLACE: {\n icon: ICON.BED_DOUBLE,\n tabIndex: 0,\n },\n CALENDAR: {\n icon: ICON.CALENDAR,\n tabIndex: 1,\n },\n OCCUPATION: {\n icon: ICON.PEOPLE,\n tabIndex: 2,\n },\n PROMOCODE: {\n icon: ICON.LOCK,\n inputMode: true,\n tabIndex: 3,\n },\n};\n\nconst VIEW = {\n PLACE: 'place',\n CALENDAR: 'calendar',\n OCCUPATION: 'occupation',\n PROMOCODE: 'promocode',\n};\n\nconst TYPE = {\n CHAIN,\n HOTEL,\n};\n\nexport { FIELD, TYPE, VIEW };\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEA,IAAQE,KAAK,GAAYC,UAAQ,CAAzBD,KAAK;EAAEE,KAAK,GAAKD,UAAQ,CAAlBC,KAAK;AAEpB,IAAMC,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG;EACZE,KAAK,EAAE;IACLC,IAAI,EAAEC,aAAI,CAACC,UAAU;IACrBC,QAAQ,EAAE;EACZ,CAAC;EACDC,QAAQ,EAAE;IACRJ,IAAI,EAAEC,aAAI,CAACG,QAAQ;IACnBD,QAAQ,EAAE;EACZ,CAAC;EACDE,UAAU,EAAE;IACVL,IAAI,EAAEC,aAAI,CAACK,MAAM;IACjBH,QAAQ,EAAE;EACZ,CAAC;EACDI,SAAS,EAAE;IACTP,IAAI,EAAEC,aAAI,CAACO,IAAI;IACfC,SAAS,EAAE,IAAI;IACfN,QAAQ,EAAE;EACZ;AACF,CAAC;AAED,IAAMO,IAAI,GAAAZ,OAAA,CAAAY,IAAA,GAAG;EACXX,KAAK,EAAE,OAAO;EACdK,QAAQ,EAAE,UAAU;EACpBC,UAAU,EAAE,YAAY;EACxBE,SAAS,EAAE;AACb,CAAC;AAED,IAAMI,IAAI,GAAAb,OAAA,CAAAa,IAAA,GAAG;EACXjB,KAAK,EAALA,KAAK;EACLE,KAAK,EAALA;AACF,CAAC"}
|
|
@@ -11,16 +11,17 @@ var _ui = require("@mirai/ui");
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _components = require("./components");
|
|
14
|
-
var _Finder = require("./Finder.
|
|
15
|
-
var _Finder2 = require("./Finder.
|
|
14
|
+
var _Finder = require("./Finder.compact");
|
|
15
|
+
var _Finder2 = require("./Finder.constants");
|
|
16
|
+
var _Finder3 = require("./Finder.l10n");
|
|
16
17
|
var style = _interopRequireWildcard(require("./Finder.module.css"));
|
|
17
18
|
var _helpers = require("./helpers");
|
|
18
19
|
var _shared__ = require("../__shared__");
|
|
19
20
|
var _helpers2 = require("../__shared__/Occupation/helpers");
|
|
20
21
|
var _Occupation = require("../__shared__/Occupation/Occupation.constants");
|
|
21
22
|
var _helpers3 = require("../helpers");
|
|
22
|
-
var _excluded = ["layout", "onChange", "onSubmit"],
|
|
23
|
-
_excluded2 = ["finder", "type"];
|
|
23
|
+
var _excluded = ["compact", "layout", "text", "onChange", "onExpand", "onSubmit"],
|
|
24
|
+
_excluded2 = ["currency", "finder", "locale", "type"];
|
|
24
25
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
26
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -38,27 +39,30 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
38
39
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
40
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
40
41
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
41
|
-
var HOTEL =
|
|
42
|
+
var HOTEL = _Finder2.TYPE.HOTEL;
|
|
42
43
|
var Finder = exports.Finder = function Finder(_ref) {
|
|
43
44
|
var _dataSource$places, _dataSource$promo, _dataSource$cta;
|
|
44
|
-
var
|
|
45
|
+
var compact = _ref.compact,
|
|
46
|
+
layout = _ref.layout,
|
|
47
|
+
text = _ref.text,
|
|
45
48
|
_ref$onChange = _ref.onChange,
|
|
46
49
|
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
47
|
-
_ref$
|
|
48
|
-
|
|
50
|
+
_ref$onExpand = _ref.onExpand,
|
|
51
|
+
onExpand = _ref$onExpand === void 0 ? function () {} : _ref$onExpand,
|
|
52
|
+
onSubmit = _ref.onSubmit,
|
|
49
53
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
50
54
|
var _useDevice = (0, _ui.useDevice)(),
|
|
51
55
|
isMobile = _useDevice.isMobile;
|
|
52
56
|
var _useLocale = (0, _locale.useLocale)(),
|
|
53
|
-
currency = _useLocale.currency,
|
|
54
57
|
dateFormat = _useLocale.dateFormat,
|
|
55
|
-
locale = _useLocale.locale,
|
|
56
58
|
translate = _useLocale.translate;
|
|
57
59
|
var ref = (0, _react.useRef)(null);
|
|
58
60
|
var _useStore = (0, _dataSources.useStore)(),
|
|
59
61
|
set = _useStore.set,
|
|
60
62
|
_useStore$value = _useStore.value,
|
|
63
|
+
currency = _useStore$value.currency,
|
|
61
64
|
storeFinder = _useStore$value.finder,
|
|
65
|
+
locale = _useStore$value.locale,
|
|
62
66
|
_useStore$value$type = _useStore$value.type,
|
|
63
67
|
type = _useStore$value$type === void 0 ? HOTEL : _useStore$value$type,
|
|
64
68
|
store = _objectWithoutProperties(_useStore$value, _excluded2);
|
|
@@ -79,17 +83,22 @@ var Finder = exports.Finder = function Finder(_ref) {
|
|
|
79
83
|
visited = _useState8[0],
|
|
80
84
|
setVisited = _useState8[1];
|
|
81
85
|
(0, _react.useEffect)(function () {
|
|
82
|
-
// ! TODO: Improve
|
|
83
|
-
// const handleClickOutside = ({ target }) => {
|
|
84
|
-
// if (!ref.current?.contains(target)) setVisible(undefined);
|
|
85
|
-
// };
|
|
86
|
-
// document.addEventListener('click', handleClickOutside, true);
|
|
87
|
-
// return () => document.removeEventListener('click', handleClickOutside, true);
|
|
88
86
|
if (!(storeFinder !== null && storeFinder !== void 0 && storeFinder.occupation)) set({
|
|
89
87
|
finder: _objectSpread(_objectSpread({}, storeFinder), {}, {
|
|
90
88
|
occupation: [(0, _helpers2.prepareRoom)(_Occupation.DATASOURCE)]
|
|
91
89
|
})
|
|
92
90
|
});
|
|
91
|
+
if (isMobile) return;
|
|
92
|
+
var handleClickOutside = function handleClickOutside() {
|
|
93
|
+
var _ref$current;
|
|
94
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
95
|
+
target = _ref2.target;
|
|
96
|
+
return !((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(target)) && setVisible(undefined);
|
|
97
|
+
};
|
|
98
|
+
document.addEventListener('click', handleClickOutside, true);
|
|
99
|
+
return function () {
|
|
100
|
+
return document.removeEventListener('click', handleClickOutside, true);
|
|
101
|
+
};
|
|
93
102
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
94
103
|
}, []);
|
|
95
104
|
(0, _react.useEffect)(function () {
|
|
@@ -101,6 +110,10 @@ var Finder = exports.Finder = function Finder(_ref) {
|
|
|
101
110
|
visible && setVisited(_objectSpread(_objectSpread({}, visited), {}, _defineProperty({}, "".concat(visible), true)));
|
|
102
111
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
103
112
|
}, [visible]);
|
|
113
|
+
var handleExpand = function handleExpand(value) {
|
|
114
|
+
setVisible(value);
|
|
115
|
+
setTimeout(onExpand, 10);
|
|
116
|
+
};
|
|
104
117
|
var handleChange = function handleChange(field, fieldValue) {
|
|
105
118
|
var next = _objectSpread(_objectSpread({}, value), {}, _defineProperty({}, field, fieldValue));
|
|
106
119
|
setValue(next);
|
|
@@ -110,14 +123,26 @@ var Finder = exports.Finder = function Finder(_ref) {
|
|
|
110
123
|
});
|
|
111
124
|
};
|
|
112
125
|
var handleSubmit = function handleSubmit() {
|
|
126
|
+
var _Object$keys$filter = Object.keys(error).filter(function (key) {
|
|
127
|
+
return !!error[key];
|
|
128
|
+
}),
|
|
129
|
+
_Object$keys$filter2 = _slicedToArray(_Object$keys$filter, 1),
|
|
130
|
+
firstError = _Object$keys$filter2[0];
|
|
131
|
+
if (firstError) return setVisible(firstError);
|
|
113
132
|
setVisible(undefined);
|
|
114
|
-
|
|
115
|
-
|
|
133
|
+
var forwarderUrl = (0, _helpers.getForwarderUrl)(_objectSpread(_objectSpread({}, value), {}, {
|
|
134
|
+
currency: currency,
|
|
135
|
+
locale: locale,
|
|
136
|
+
store: store
|
|
137
|
+
}));
|
|
138
|
+
if (onSubmit) onSubmit(_objectSpread(_objectSpread({}, value), {}, {
|
|
139
|
+
forwarderUrl: forwarderUrl
|
|
140
|
+
}));else window.location.href = forwarderUrl;
|
|
116
141
|
};
|
|
117
142
|
var assistant = function assistant() {
|
|
118
143
|
var _value$calendar = value.calendar,
|
|
119
144
|
calendar = _value$calendar === void 0 ? [] : _value$calendar;
|
|
120
|
-
if (visible ===
|
|
145
|
+
if (visible === _Finder2.VIEW.PLACE && !visited.calendar && calendar.length !== 2) setVisible(_Finder2.VIEW.CALENDAR);else if (visible === _Finder2.VIEW.CALENDAR && !visited.occupation) setVisible(_Finder2.VIEW.OCCUPATION);else setVisible(undefined);
|
|
121
146
|
};
|
|
122
147
|
var _value$place = value.place,
|
|
123
148
|
place = _value$place === void 0 ? {} : _value$place,
|
|
@@ -126,41 +151,45 @@ var Finder = exports.Finder = function Finder(_ref) {
|
|
|
126
151
|
occupation = value.occupation,
|
|
127
152
|
promocode = value.promocode;
|
|
128
153
|
var testId = others.testId;
|
|
129
|
-
var isValid = (0, _helpers.validate)(error);
|
|
130
154
|
var dataSource = (0, _helpers.getDataSource)(_objectSpread({
|
|
131
155
|
type: type
|
|
132
156
|
}, store));
|
|
133
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
157
|
+
return compact && !visible ? /*#__PURE__*/_react.default.createElement(_Finder.Compact, {
|
|
158
|
+
value: value,
|
|
159
|
+
dataSource: dataSource,
|
|
160
|
+
onExpand: handleExpand,
|
|
161
|
+
onSubmit: handleSubmit
|
|
162
|
+
}) : /*#__PURE__*/_react.default.createElement(_ui.View, _extends({}, others, {
|
|
134
163
|
role: "finder",
|
|
135
164
|
ref: ref,
|
|
136
165
|
row: !isMobile,
|
|
137
166
|
className: (0, _ui.styles)(style.finder, layout && style[layout], others.className)
|
|
138
|
-
}), dataSource.places && /*#__PURE__*/_react.default.createElement(_shared__.Field, _extends({},
|
|
167
|
+
}), dataSource.places && /*#__PURE__*/_react.default.createElement(_shared__.Field, _extends({}, _Finder2.FIELD.PLACE, {
|
|
139
168
|
caption: (0, _helpers.getPlaceCaption)(place.value, dataSource.places.options),
|
|
140
|
-
label: translate(
|
|
141
|
-
placeholder: dataSource.places.placeholder || translate(
|
|
142
|
-
visible: visible ===
|
|
169
|
+
label: translate(_Finder3.L10N.LABEL_WHERE),
|
|
170
|
+
placeholder: dataSource.places.placeholder || translate(_Finder3.L10N.LABEL_WHERE_PLACEHOLDER),
|
|
171
|
+
visible: visible === _Finder2.VIEW.PLACE,
|
|
143
172
|
onPress: function onPress() {
|
|
144
|
-
return setVisible(visible !==
|
|
173
|
+
return setVisible(visible !== _Finder2.VIEW.PLACE ? _Finder2.VIEW.PLACE : undefined);
|
|
145
174
|
}
|
|
146
175
|
}), /*#__PURE__*/_react.default.createElement(_components.Places, {
|
|
147
|
-
autoColumn: visible ===
|
|
176
|
+
autoColumn: visible === _Finder2.VIEW.PLACE,
|
|
148
177
|
dataSource: dataSource.places.options,
|
|
149
178
|
value: place.value,
|
|
150
179
|
onChange: function onChange(place, event) {
|
|
151
|
-
handleChange(
|
|
180
|
+
handleChange(_Finder2.VIEW.PLACE, place, event);
|
|
152
181
|
!isMobile && assistant();
|
|
153
182
|
},
|
|
154
183
|
onSubmit: isMobile ? assistant : undefined,
|
|
155
184
|
testId: testId ? "".concat(testId, "-places") : undefined
|
|
156
|
-
})), /*#__PURE__*/_react.default.createElement(_shared__.Field, _extends({},
|
|
185
|
+
})), /*#__PURE__*/_react.default.createElement(_shared__.Field, _extends({}, _Finder2.FIELD.CALENDAR, {
|
|
157
186
|
caption: calendar.length ? (0, _helpers3.getCalendarCaption)(calendar, translate, dateFormat) : undefined,
|
|
158
187
|
centered: type !== HOTEL,
|
|
159
|
-
label: translate(
|
|
188
|
+
label: translate(_Finder3.L10N.LABEL_WHEN),
|
|
160
189
|
placeholder: (0, _helpers3.getCalendarCaption)(undefined, translate, dateFormat),
|
|
161
|
-
visible: visible ===
|
|
190
|
+
visible: visible === _Finder2.VIEW.CALENDAR,
|
|
162
191
|
onPress: function onPress() {
|
|
163
|
-
return setVisible(visible !==
|
|
192
|
+
return setVisible(visible !== _Finder2.VIEW.CALENDAR ? _Finder2.VIEW.CALENDAR : undefined);
|
|
164
193
|
}
|
|
165
194
|
}), /*#__PURE__*/_react.default.createElement(_components.Calendar, _extends({}, (0, _helpers.parseCalendarProps)(dataSource.calendar), {
|
|
166
195
|
currency: currency,
|
|
@@ -168,7 +197,7 @@ var Finder = exports.Finder = function Finder(_ref) {
|
|
|
168
197
|
showPrices: type === HOTEL,
|
|
169
198
|
value: calendar,
|
|
170
199
|
onChange: function onChange(calendar, event) {
|
|
171
|
-
handleChange(
|
|
200
|
+
handleChange(_Finder2.VIEW.CALENDAR, calendar, event);
|
|
172
201
|
if (!isMobile && calendar.length === 2) assistant();
|
|
173
202
|
},
|
|
174
203
|
onError: function onError(calendar) {
|
|
@@ -191,18 +220,18 @@ var Finder = exports.Finder = function Finder(_ref) {
|
|
|
191
220
|
hotels: (0, _helpers.getHotels)(dataSource.placesSource, place.value),
|
|
192
221
|
maxRooms: dataSource.maxRooms,
|
|
193
222
|
value: occupation,
|
|
194
|
-
visible: visible ===
|
|
223
|
+
visible: visible === _Finder2.VIEW.OCCUPATION,
|
|
195
224
|
onChange: function onChange(occupation, event) {
|
|
196
|
-
return handleChange(
|
|
225
|
+
return handleChange(_Finder2.VIEW.OCCUPATION, occupation, event);
|
|
197
226
|
},
|
|
198
227
|
onError: function onError(occupation) {
|
|
199
|
-
if (!isMobile && visible !==
|
|
228
|
+
if (!isMobile && visible !== _Finder2.VIEW.OCCUPATION) setVisible(_Finder2.VIEW.OCCUPATION);
|
|
200
229
|
setError(_objectSpread(_objectSpread({}, error), {}, {
|
|
201
230
|
occupation: occupation
|
|
202
231
|
}));
|
|
203
232
|
},
|
|
204
233
|
onPress: function onPress() {
|
|
205
|
-
return setVisible(visible !==
|
|
234
|
+
return setVisible(visible !== _Finder2.VIEW.OCCUPATION ? _Finder2.VIEW.OCCUPATION : undefined);
|
|
206
235
|
},
|
|
207
236
|
onValid: function onValid() {
|
|
208
237
|
return setError(_objectSpread(_objectSpread({}, error), {}, {
|
|
@@ -213,30 +242,31 @@ var Finder = exports.Finder = function Finder(_ref) {
|
|
|
213
242
|
}), /*#__PURE__*/_react.default.createElement(_shared__.FieldPromocode, {
|
|
214
243
|
placeholder: (_dataSource$promo = dataSource.promo) === null || _dataSource$promo === void 0 ? void 0 : _dataSource$promo.placeholder,
|
|
215
244
|
value: promocode,
|
|
216
|
-
visible: visible ===
|
|
245
|
+
visible: visible === _Finder2.VIEW.PROMOCODE,
|
|
217
246
|
onChange: function onChange(promocode, event) {
|
|
218
|
-
return handleChange(
|
|
247
|
+
return handleChange(_Finder2.VIEW.PROMOCODE, promocode, event);
|
|
219
248
|
},
|
|
220
249
|
onEnter: function onEnter() {
|
|
221
|
-
return setVisible(
|
|
250
|
+
return setVisible(_Finder2.VIEW.PROMOCODE);
|
|
222
251
|
},
|
|
223
252
|
onLeave: function onLeave() {
|
|
224
253
|
return setVisible(undefined);
|
|
225
254
|
},
|
|
226
255
|
testId: testId ? "".concat(testId, "-promocode") : undefined
|
|
227
256
|
}), /*#__PURE__*/_react.default.createElement(_ui.Button, {
|
|
228
|
-
disabled: !isValid,
|
|
229
257
|
large: true,
|
|
230
258
|
wide: isMobile,
|
|
231
259
|
onPress: handleSubmit,
|
|
232
260
|
className: style.button,
|
|
233
261
|
testId: testId ? "".concat(testId, "-submit") : undefined
|
|
234
|
-
}, ((_dataSource$cta = dataSource.cta) === null || _dataSource$cta === void 0 ? void 0 : _dataSource$cta.placeholder) || translate(
|
|
262
|
+
}, text || ((_dataSource$cta = dataSource.cta) === null || _dataSource$cta === void 0 ? void 0 : _dataSource$cta.placeholder) || translate(_Finder3.L10N.ACTION_BOOK)));
|
|
235
263
|
};
|
|
236
|
-
Finder.displayName = 'Mirai:Finder:Finder';
|
|
237
264
|
Finder.propTypes = {
|
|
265
|
+
compact: _propTypes.default.bool,
|
|
238
266
|
layout: _propTypes.default.oneOf(['column']),
|
|
267
|
+
text: _propTypes.default.string,
|
|
239
268
|
onChange: _propTypes.default.func,
|
|
269
|
+
onExpand: _propTypes.default.func,
|
|
240
270
|
onSubmit: _propTypes.default.func
|
|
241
271
|
};
|
|
242
272
|
//# sourceMappingURL=Finder.js.map
|