@mirai/core 0.3.38 → 0.3.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/.env +1 -0
  2. package/build/components/BookingQuery/BookingQuery.js +3 -1
  3. package/build/components/BookingQuery/BookingQuery.js.map +1 -1
  4. package/build/components/Finder/Finder.js +12 -2
  5. package/build/components/Finder/Finder.js.map +1 -1
  6. package/build/components/Finder/components/Calendar/Calendar.constants.js +2 -1
  7. package/build/components/Finder/components/Calendar/Calendar.constants.js.map +1 -1
  8. package/build/components/Finder/components/Calendar/Calendar.js +70 -40
  9. package/build/components/Finder/components/Calendar/Calendar.js.map +1 -1
  10. package/build/components/Finder/components/Calendar/Calendar.l10n.js +5 -12
  11. package/build/components/Finder/components/Calendar/Calendar.l10n.js.map +1 -1
  12. package/build/components/Finder/components/Calendar/Calendar.module.css +4 -3
  13. package/build/components/Finder/components/Calendar/__tests__/__snapshots__/Calendar.test.js.snap +1921 -2042
  14. package/build/components/Finder/components/Calendar/helpers/fetchPrices.js +2 -2
  15. package/build/components/Finder/components/Calendar/helpers/fetchPrices.js.map +1 -1
  16. package/build/components/Finder/components/Calendar/helpers/getVisibleDate.js +5 -3
  17. package/build/components/Finder/components/Calendar/helpers/getVisibleDate.js.map +1 -1
  18. package/build/components/Finder/components/Calendar/helpers/index.js +22 -0
  19. package/build/components/Finder/components/Calendar/helpers/index.js.map +1 -1
  20. package/build/components/Finder/components/Calendar/helpers/parseValue.js +14 -0
  21. package/build/components/Finder/components/Calendar/helpers/parseValue.js.map +1 -0
  22. package/build/components/Finder/components/Calendar/helpers/valueFormat.js +18 -0
  23. package/build/components/Finder/components/Calendar/helpers/valueFormat.js.map +1 -0
  24. package/build/components/Finder/helpers/parseCalendarProps.js +11 -2
  25. package/build/components/Finder/helpers/parseCalendarProps.js.map +1 -1
  26. package/package.json +1 -1
@@ -18,7 +18,7 @@ const fetchPrices = async function () {
18
18
  } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
19
19
  const responses = await Promise.all(Array.from(Array(rangeMonths).keys()).map(index => _services.ServicePricing.getStatic(id, (0, _locale.dateFormat)(index ? (0, _locale.dateCalc)(from, index, 'months') : from, {
20
20
  format: _helpers.CALENDAR_FORMAT
21
- }), MONTHS, currency)));
21
+ }), MONTHS, currency).catch(() => ({}))));
22
22
  const next = {
23
23
  currency,
24
24
  values: {}
@@ -32,7 +32,7 @@ const fetchPrices = async function () {
32
32
  currency,
33
33
  fancy: true,
34
34
  locale,
35
- symbol: false
35
+ symbol: true
36
36
  };
37
37
  if (currency) next.currency = currency;
38
38
  Object.entries(prices).forEach(_ref => {
@@ -1 +1 @@
1
- {"version":3,"file":"fetchPrices.js","names":["_locale","require","_services","_helpers","MONTHS","fetchPrices","currency","from","id","locale","rangeMonths","arguments","length","undefined","responses","Promise","all","Array","keys","map","index","ServicePricing","getStatic","dateFormat","dateCalc","format","CALENDAR_FORMAT","next","values","forEach","prices","common","fancy","symbol","Object","entries","_ref","date","price","currencyFormat","value","exports"],"sources":["../../../../../../src/components/Finder/components/Calendar/helpers/fetchPrices.js"],"sourcesContent":["import { dateCalc, dateFormat, currencyFormat } from '@mirai/locale';\nimport { ServicePricing } from '@mirai/services';\n\nimport { CALENDAR_FORMAT } from '../../../../helpers';\n\nconst MONTHS = 1;\n\nexport const fetchPrices = async ({ currency, from, id, locale, rangeMonths = 2 } = {}) => {\n const responses = await Promise.all(\n Array.from(Array(rangeMonths).keys()).map((index) =>\n ServicePricing.getStatic(\n id,\n dateFormat(index ? dateCalc(from, index, 'months') : from, { format: CALENDAR_FORMAT }),\n MONTHS,\n currency,\n ),\n ),\n );\n\n const next = { currency, values: {} };\n\n responses.forEach(({ currency, prices = {} } = {}) => {\n const common = { currency, fancy: true, locale, symbol: false };\n\n if (currency) next.currency = currency;\n\n Object.entries(prices).forEach(([date, price]) => {\n if (price) next.values[date] = currencyFormat({ ...common, value: price });\n });\n });\n\n return next;\n};\n"],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,MAAM,CAACC,OAAO,CAACL,MAAM,CAAC,CAACD,OAAO,CAACO,IAAA,IAAmB;MAAA,IAAlB,CAACC,IAAI,EAAEC,KAAK,CAAC,GAAAF,IAAA;MAC3C,IAAIE,KAAK,EAAEX,IAAI,CAACC,MAAM,CAACS,IAAI,CAAC,GAAG,IAAAE,sBAAc,EAAC;QAAE,GAAGR,MAAM;QAAES,KAAK,EAAEF;MAAM,CAAC,CAAC;IAC5E,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOX,IAAI;AACb,CAAC;AAACc,OAAA,CAAApC,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"file":"fetchPrices.js","names":["_locale","require","_services","_helpers","MONTHS","fetchPrices","currency","from","id","locale","rangeMonths","arguments","length","undefined","responses","Promise","all","Array","keys","map","index","ServicePricing","getStatic","dateFormat","dateCalc","format","CALENDAR_FORMAT","catch","next","values","forEach","prices","common","fancy","symbol","Object","entries","_ref","date","price","currencyFormat","value","exports"],"sources":["../../../../../../src/components/Finder/components/Calendar/helpers/fetchPrices.js"],"sourcesContent":["import { dateCalc, dateFormat, currencyFormat } from '@mirai/locale';\nimport { ServicePricing } from '@mirai/services';\n\nimport { CALENDAR_FORMAT } from '../../../../helpers';\n\nconst MONTHS = 1;\n\nexport const fetchPrices = async ({ currency, from, id, locale, rangeMonths = 2 } = {}) => {\n const responses = await Promise.all(\n Array.from(Array(rangeMonths).keys()).map((index) =>\n ServicePricing.getStatic(\n id,\n dateFormat(index ? dateCalc(from, index, 'months') : from, { format: CALENDAR_FORMAT }),\n MONTHS,\n currency,\n ).catch(() => ({})),\n ),\n );\n\n const next = { currency, values: {} };\n\n responses.forEach(({ currency, prices = {} } = {}) => {\n const common = { currency, fancy: true, locale, symbol: true };\n\n if (currency) next.currency = currency;\n\n Object.entries(prices).forEach(([date, price]) => {\n if (price) next.values[date] = currencyFormat({ ...common, value: price });\n });\n });\n\n return next;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC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;IAEtC6B,MAAM,CAACC,OAAO,CAACL,MAAM,CAAC,CAACD,OAAO,CAACO,IAAA,IAAmB;MAAA,IAAlB,CAACC,IAAI,EAAEC,KAAK,CAAC,GAAAF,IAAA;MAC3C,IAAIE,KAAK,EAAEX,IAAI,CAACC,MAAM,CAACS,IAAI,CAAC,GAAG,IAAAE,sBAAc,EAAC;QAAE,GAAGR,MAAM;QAAES,KAAK,EAAEF;MAAM,CAAC,CAAC;IAC5E,CAAC,CAAC;EACJ,CAAC,CAAC;EAEF,OAAOX,IAAI;AACb,CAAC;AAACc,OAAA,CAAArC,WAAA,GAAAA,WAAA"}
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getVisibleDate = void 0;
7
7
  var _locale = require("@mirai/locale");
8
8
  var _helpers = require("../../../../helpers");
9
- const getVisibleDate = scrollPercentage => {
10
- if (!scrollPercentage) return;
11
- const months = Math.floor((scrollPercentage * _helpers.MONTHS_IN_MOBILE - 1) / 100);
9
+ const getVisibleDate = (scrollPercentage, maxDate) => {
10
+ var _dateDiff;
11
+ if (scrollPercentage === undefined) return;
12
12
  const today = new Date();
13
+ const maxMonths = maxDate && ((_dateDiff = (0, _locale.dateDiff)(today, (0, _locale.parseDate)(maxDate))) === null || _dateDiff === void 0 ? void 0 : _dateDiff.months) || _helpers.MONTHS_IN_MOBILE;
14
+ const months = Math.round((scrollPercentage * maxMonths - 1) / 100);
13
15
  return months ? (0, _locale.dateCalc)(today, months, 'months') : undefined;
14
16
  };
15
17
  exports.getVisibleDate = getVisibleDate;
@@ -1 +1 @@
1
- {"version":3,"file":"getVisibleDate.js","names":["_locale","require","_helpers","getVisibleDate","scrollPercentage","months","Math","floor","MONTHS_IN_MOBILE","today","Date","dateCalc","undefined","exports"],"sources":["../../../../../../src/components/Finder/components/Calendar/helpers/getVisibleDate.js"],"sourcesContent":["import { dateCalc } from '@mirai/locale';\n\nimport { MONTHS_IN_MOBILE } from '../../../../helpers';\n\nexport const getVisibleDate = (scrollPercentage) => {\n if (!scrollPercentage) return;\n\n const months = Math.floor((scrollPercentage * MONTHS_IN_MOBILE - 1) / 100);\n const today = new Date();\n\n return months ? dateCalc(today, months, 'months') : undefined;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,cAAc,GAAIC,gBAAgB,IAAK;EAClD,IAAI,CAACA,gBAAgB,EAAE;EAEvB,MAAMC,MAAM,GAAGC,IAAI,CAACC,KAAK,CAAC,CAACH,gBAAgB,GAAGI,yBAAgB,GAAG,CAAC,IAAI,GAAG,CAAC;EAC1E,MAAMC,KAAK,GAAG,IAAIC,IAAI,CAAC,CAAC;EAExB,OAAOL,MAAM,GAAG,IAAAM,gBAAQ,EAACF,KAAK,EAAEJ,MAAM,EAAE,QAAQ,CAAC,GAAGO,SAAS;AAC/D,CAAC;AAACC,OAAA,CAAAV,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"file":"getVisibleDate.js","names":["_locale","require","_helpers","getVisibleDate","scrollPercentage","maxDate","_dateDiff","undefined","today","Date","maxMonths","dateDiff","parseDate","months","MONTHS_IN_MOBILE","Math","round","dateCalc","exports"],"sources":["../../../../../../src/components/Finder/components/Calendar/helpers/getVisibleDate.js"],"sourcesContent":["import { dateCalc, dateDiff, parseDate } from '@mirai/locale';\n\nimport { MONTHS_IN_MOBILE } from '../../../../helpers';\n\nexport const getVisibleDate = (scrollPercentage, maxDate) => {\n if (scrollPercentage === undefined) return;\n\n const today = new Date();\n const maxMonths = (maxDate && dateDiff(today, parseDate(maxDate))?.months) || MONTHS_IN_MOBILE;\n const months = Math.round((scrollPercentage * maxMonths - 1) / 100);\n\n return months ? dateCalc(today, months, 'months') : undefined;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,cAAc,GAAGA,CAACC,gBAAgB,EAAEC,OAAO,KAAK;EAAA,IAAAC,SAAA;EAC3D,IAAIF,gBAAgB,KAAKG,SAAS,EAAE;EAEpC,MAAMC,KAAK,GAAG,IAAIC,IAAI,CAAC,CAAC;EACxB,MAAMC,SAAS,GAAIL,OAAO,MAAAC,SAAA,GAAI,IAAAK,gBAAQ,EAACH,KAAK,EAAE,IAAAI,iBAAS,EAACP,OAAO,CAAC,CAAC,cAAAC,SAAA,uBAAnCA,SAAA,CAAqCO,MAAM,KAAKC,yBAAgB;EAC9F,MAAMD,MAAM,GAAGE,IAAI,CAACC,KAAK,CAAC,CAACZ,gBAAgB,GAAGM,SAAS,GAAG,CAAC,IAAI,GAAG,CAAC;EAEnE,OAAOG,MAAM,GAAG,IAAAI,gBAAQ,EAACT,KAAK,EAAEK,MAAM,EAAE,QAAQ,CAAC,GAAGN,SAAS;AAC/D,CAAC;AAACW,OAAA,CAAAf,cAAA,GAAAA,cAAA"}
@@ -25,4 +25,26 @@ Object.keys(_getVisibleDate).forEach(function (key) {
25
25
  }
26
26
  });
27
27
  });
28
+ var _parseValue = require("./parseValue");
29
+ Object.keys(_parseValue).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _parseValue[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _parseValue[key];
36
+ }
37
+ });
38
+ });
39
+ var _valueFormat = require("./valueFormat");
40
+ Object.keys(_valueFormat).forEach(function (key) {
41
+ if (key === "default" || key === "__esModule") return;
42
+ if (key in exports && exports[key] === _valueFormat[key]) return;
43
+ Object.defineProperty(exports, key, {
44
+ enumerable: true,
45
+ get: function () {
46
+ return _valueFormat[key];
47
+ }
48
+ });
49
+ });
28
50
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_fetchPrices","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getVisibleDate"],"sources":["../../../../../../src/components/Finder/components/Calendar/helpers/index.js"],"sourcesContent":["export * from './fetchPrices';\nexport * from './getVisibleDate';\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,YAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,eAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,eAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,eAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,eAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"file":"index.js","names":["_fetchPrices","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_getVisibleDate","_parseValue","_valueFormat"],"sources":["../../../../../../src/components/Finder/components/Calendar/helpers/index.js"],"sourcesContent":["export * from './fetchPrices';\nexport * from './getVisibleDate';\nexport * from './parseValue';\nexport * from './valueFormat';\n"],"mappings":";;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,YAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,YAAA,CAAAK,GAAA;EAAAH,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14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.parseValue = void 0;
7
+ var _locale = require("@mirai/locale");
8
+ var _helpers = require("../../../../helpers");
9
+ const parseValue = function () {
10
+ let [from, to] = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
11
+ return [from ? (0, _locale.parseDate)(from, _helpers.CALENDAR_FORMAT) : undefined, to ? (0, _locale.parseDate)(to, _helpers.CALENDAR_FORMAT) : undefined];
12
+ };
13
+ exports.parseValue = parseValue;
14
+ //# sourceMappingURL=parseValue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseValue.js","names":["_locale","require","_helpers","parseValue","from","to","arguments","length","undefined","parseDate","CALENDAR_FORMAT","exports"],"sources":["../../../../../../src/components/Finder/components/Calendar/helpers/parseValue.js"],"sourcesContent":["import { parseDate } from '@mirai/locale';\n\nimport { CALENDAR_FORMAT } from '../../../../helpers';\n\nexport const parseValue = ([from, to] = []) => [\n from ? parseDate(from, CALENDAR_FORMAT) : undefined,\n to ? parseDate(to, CALENDAR_FORMAT) : undefined,\n];\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,UAAU,GAAG,SAAAA,CAAA;EAAA,IAAC,CAACC,IAAI,EAAEC,EAAE,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,OAAK,CAC7CF,IAAI,GAAG,IAAAK,iBAAS,EAACL,IAAI,EAAEM,wBAAe,CAAC,GAAGF,SAAS,EACnDH,EAAE,GAAG,IAAAI,iBAAS,EAACJ,EAAE,EAAEK,wBAAe,CAAC,GAAGF,SAAS,CAChD;AAAA;AAACG,OAAA,CAAAR,UAAA,GAAAA,UAAA"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.valueFormat = void 0;
7
+ var _locale = require("@mirai/locale");
8
+ var _helpers = require("../../../../helpers");
9
+ const valueFormat = function () {
10
+ let [from, to] = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
11
+ return [from ? (0, _locale.dateFormat)(from, {
12
+ format: _helpers.CALENDAR_FORMAT
13
+ }) : undefined, to ? (0, _locale.dateFormat)(to, {
14
+ format: _helpers.CALENDAR_FORMAT
15
+ }) : undefined];
16
+ };
17
+ exports.valueFormat = valueFormat;
18
+ //# sourceMappingURL=valueFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"valueFormat.js","names":["_locale","require","_helpers","valueFormat","from","to","arguments","length","undefined","dateFormat","format","CALENDAR_FORMAT","exports"],"sources":["../../../../../../src/components/Finder/components/Calendar/helpers/valueFormat.js"],"sourcesContent":["import { dateFormat } from '@mirai/locale';\n\nimport { CALENDAR_FORMAT } from '../../../../helpers';\n\nexport const valueFormat = ([from, to] = []) => [\n from ? dateFormat(from, { format: CALENDAR_FORMAT }) : undefined,\n to ? dateFormat(to, { format: CALENDAR_FORMAT }) : undefined,\n];\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAEO,MAAME,WAAW,GAAG,SAAAA,CAAA;EAAA,IAAC,CAACC,IAAI,EAAEC,EAAE,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAAA,OAAK,CAC9CF,IAAI,GAAG,IAAAK,kBAAU,EAACL,IAAI,EAAE;IAAEM,MAAM,EAAEC;EAAgB,CAAC,CAAC,GAAGH,SAAS,EAChEH,EAAE,GAAG,IAAAI,kBAAU,EAACJ,EAAE,EAAE;IAAEK,MAAM,EAAEC;EAAgB,CAAC,CAAC,GAAGH,SAAS,CAC7D;AAAA;AAACI,OAAA,CAAAT,WAAA,GAAAA,WAAA"}
@@ -7,15 +7,24 @@ exports.parseCalendarProps = void 0;
7
7
  var _locale = require("@mirai/locale");
8
8
  var _helpers = require("../../helpers");
9
9
  var _Calendar = require("../components/Calendar/Calendar.constants");
10
+ var _Finder = require("../Finder.constants");
10
11
  const TAXES = [_Calendar.TAX, _Calendar.TAX_FREE, _Calendar.TAX_PARTIAL];
11
12
  const parseCalendarProps = function () {
12
- let {
13
+ var _variants$find;
14
+ let calendar = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15
+ let id = arguments.length > 1 ? arguments[1] : undefined;
16
+ let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _Finder.TYPE.HOTEL;
17
+ let variants = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
18
+ const {
13
19
  maxDays = 365,
14
20
  maxNights: rangeMaxDays = 31,
15
21
  nightsForDeal: rangeMinDays,
16
22
  prices: showPrices = false,
17
23
  pricesWithTaxes: pricesLegend
18
- } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24
+ } = type === _Finder.TYPE.HOTEL ? calendar : {
25
+ ...calendar,
26
+ ...(((_variants$find = variants.find(item => item.id == id)) === null || _variants$find === void 0 ? void 0 : _variants$find.calendar) || {})
27
+ };
19
28
  return {
20
29
  rangeMaxDays,
21
30
  rangeMinDays,
@@ -1 +1 @@
1
- {"version":3,"file":"parseCalendarProps.js","names":["_locale","require","_helpers","_Calendar","TAXES","TAX","TAX_FREE","TAX_PARTIAL","parseCalendarProps","maxDays","maxNights","rangeMaxDays","nightsForDeal","rangeMinDays","prices","showPrices","pricesWithTaxes","pricesLegend","arguments","length","undefined","includes","to","dateFormat","dateCalc","Date","CALENDAR_FORMAT","exports"],"sources":["../../../../src/components/Finder/helpers/parseCalendarProps.js"],"sourcesContent":["import { dateCalc, dateFormat } from '@mirai/locale';\n\nimport { CALENDAR_FORMAT } from '../../helpers';\nimport { TAX, TAX_FREE, TAX_PARTIAL } from '../components/Calendar/Calendar.constants';\n\nconst TAXES = [TAX, TAX_FREE, TAX_PARTIAL];\n\nexport const parseCalendarProps = ({\n maxDays = 365,\n maxNights: rangeMaxDays = 31,\n nightsForDeal: rangeMinDays,\n prices: showPrices = false,\n pricesWithTaxes: pricesLegend,\n} = {}) => ({\n rangeMaxDays,\n rangeMinDays,\n pricesLegend: TAXES.includes(pricesLegend) ? pricesLegend : showPrices ? TAX : undefined,\n showPrices,\n to: dateFormat(dateCalc(new Date(), maxDays, 'days'), CALENDAR_FORMAT),\n});\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,MAAMG,KAAK,GAAG,CAACC,aAAG,EAAEC,kBAAQ,EAAEC,qBAAW,CAAC;AAEnC,MAAMC,kBAAkB,GAAG,SAAAA,CAAA;EAAA,IAAC;IACjCC,OAAO,GAAG,GAAG;IACbC,SAAS,EAAEC,YAAY,GAAG,EAAE;IAC5BC,aAAa,EAAEC,YAAY;IAC3BC,MAAM,EAAEC,UAAU,GAAG,KAAK;IAC1BC,eAAe,EAAEC;EACnB,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,OAAM;IACVP,YAAY;IACZE,YAAY;IACZI,YAAY,EAAEb,KAAK,CAACiB,QAAQ,CAACJ,YAAY,CAAC,GAAGA,YAAY,GAAGF,UAAU,GAAGV,aAAG,GAAGe,SAAS;IACxFL,UAAU;IACVO,EAAE,EAAE,IAAAC,kBAAU,EAAC,IAAAC,gBAAQ,EAAC,IAAIC,IAAI,CAAC,CAAC,EAAEhB,OAAO,EAAE,MAAM,CAAC,EAAEiB,wBAAe;EACvE,CAAC;AAAA,CAAC;AAACC,OAAA,CAAAnB,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"file":"parseCalendarProps.js","names":["_locale","require","_helpers","_Calendar","_Finder","TAXES","TAX","TAX_FREE","TAX_PARTIAL","parseCalendarProps","_variants$find","calendar","arguments","length","undefined","id","type","TYPE","HOTEL","variants","maxDays","maxNights","rangeMaxDays","nightsForDeal","rangeMinDays","prices","showPrices","pricesWithTaxes","pricesLegend","find","item","includes","to","dateFormat","dateCalc","Date","CALENDAR_FORMAT","exports"],"sources":["../../../../src/components/Finder/helpers/parseCalendarProps.js"],"sourcesContent":["import { dateCalc, dateFormat } from '@mirai/locale';\n\nimport { CALENDAR_FORMAT } from '../../helpers';\nimport { TAX, TAX_FREE, TAX_PARTIAL } from '../components/Calendar/Calendar.constants';\nimport { TYPE } from '../Finder.constants';\n\nconst TAXES = [TAX, TAX_FREE, TAX_PARTIAL];\n\nexport const parseCalendarProps = (calendar = {}, id, type = TYPE.HOTEL, variants = []) => {\n const {\n maxDays = 365,\n maxNights: rangeMaxDays = 31,\n nightsForDeal: rangeMinDays,\n prices: showPrices = false,\n pricesWithTaxes: pricesLegend,\n } = type === TYPE.HOTEL ? calendar : { ...calendar, ...(variants.find((item) => item.id == id)?.calendar || {}) };\n\n return {\n rangeMaxDays,\n rangeMinDays,\n pricesLegend: TAXES.includes(pricesLegend) ? pricesLegend : showPrices ? TAX : undefined,\n showPrices,\n to: dateFormat(dateCalc(new Date(), maxDays, 'days'), CALENDAR_FORMAT),\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,MAAMI,KAAK,GAAG,CAACC,aAAG,EAAEC,kBAAQ,EAAEC,qBAAW,CAAC;AAEnC,MAAMC,kBAAkB,GAAG,SAAAA,CAAA,EAAyD;EAAA,IAAAC,cAAA;EAAA,IAAxDC,QAAQ,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,IAAEG,EAAE,GAAAH,SAAA,CAAAC,MAAA,OAAAD,SAAA,MAAAE,SAAA;EAAA,IAAEE,IAAI,GAAAJ,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGK,YAAI,CAACC,KAAK;EAAA,IAAEC,QAAQ,GAAAP,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EACpF,MAAM;IACJQ,OAAO,GAAG,GAAG;IACbC,SAAS,EAAEC,YAAY,GAAG,EAAE;IAC5BC,aAAa,EAAEC,YAAY;IAC3BC,MAAM,EAAEC,UAAU,GAAG,KAAK;IAC1BC,eAAe,EAAEC;EACnB,CAAC,GAAGZ,IAAI,KAAKC,YAAI,CAACC,KAAK,GAAGP,QAAQ,GAAG;IAAE,GAAGA,QAAQ;IAAE,IAAI,EAAAD,cAAA,GAAAS,QAAQ,CAACU,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACf,EAAE,IAAIA,EAAE,CAAC,cAAAL,cAAA,uBAAtCA,cAAA,CAAwCC,QAAQ,KAAI,CAAC,CAAC;EAAE,CAAC;EAEjH,OAAO;IACLW,YAAY;IACZE,YAAY;IACZI,YAAY,EAAEvB,KAAK,CAAC0B,QAAQ,CAACH,YAAY,CAAC,GAAGA,YAAY,GAAGF,UAAU,GAAGpB,aAAG,GAAGQ,SAAS;IACxFY,UAAU;IACVM,EAAE,EAAE,IAAAC,kBAAU,EAAC,IAAAC,gBAAQ,EAAC,IAAIC,IAAI,CAAC,CAAC,EAAEf,OAAO,EAAE,MAAM,CAAC,EAAEgB,wBAAe;EACvE,CAAC;AACH,CAAC;AAACC,OAAA,CAAA5B,kBAAA,GAAAA,kBAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirai/core",
3
- "version": "0.3.38",
3
+ "version": "0.3.40",
4
4
  "source": "src/index.js",
5
5
  "repository": "https://gitlab.com/miraicorp/dev/frontend/core",
6
6
  "author": "JΛVI <hello@soyjavi.com>",