@mirai/core 0.1.49 → 0.1.51
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.
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.consolidateStore = void 0;
|
|
7
7
|
var _locale = require("@mirai/locale");
|
|
8
|
+
var _ui = require("@mirai/ui");
|
|
8
9
|
var _Core = require("../Core.constants");
|
|
9
10
|
var _getAccommodationType = require("./getAccommodationType");
|
|
10
11
|
/* eslint-disable no-unused-vars */
|
|
@@ -30,6 +31,7 @@ const consolidateStore = function () {
|
|
|
30
31
|
const [navigatorLanguage, countryLanguage] = window.navigator.language?.split('-') || [];
|
|
31
32
|
let [language = navigatorLanguage, country = countryLanguage] = instance.locale?.split('-') || [];
|
|
32
33
|
if (urlParams.lang && urlParams.lang === navigatorLanguage) language = urlParams.lang;
|
|
34
|
+
if (language === 'ar') _ui.Theme.setDirection(_ui.DIRECTION_TYPE.RIGHT);
|
|
33
35
|
|
|
34
36
|
// currency
|
|
35
37
|
const currency = (forceUri ? urlParams.currency : undefined) || cookies.currency || urlParams.currency || instance.currency || _locale.DEFAULT_CURRENCY;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consolidateStore.js","names":["consolidateStore","config","cookies","instance","el","hotel","hotelId","id","type","session","urlParams","forceUri","navigatorLanguage","countryLanguage","window","navigator","language","split","country","locale","lang","currency","undefined","DEFAULT_CURRENCY","club","active","authentication","idClub","name","conditionsUrl","conditions","privacyPolicyUrl","privacy","url","accommodationType","getAccommodationType","lodgingDenomination","TYPE","CHAIN","maxNights","maxBookingDays","maxRooms","accomodation","rooms","maxOccupation","home","location","origin","commissionCode","hsri","COMMISSION_TYPE","promo","showPromoNav","configPromo","promoText","placeholder","DEFAULT_LOCALE","finder","place","calendar","occupation","promocode","code","deals","signup"],"sources":["../../src/helpers/consolidateStore.js"],"sourcesContent":["import { DEFAULT_CURRENCY, DEFAULT_LOCALE } from '@mirai/locale';\n\nimport { COMMISSION_TYPE, TYPE } from '../Core.constants';\nimport { getAccommodationType } from './getAccommodationType';\n\n/* eslint-disable no-unused-vars */\nexport const consolidateStore = ({\n config = {},\n cookies = {},\n instance: { el, hotel: hotelId, id, type, ...instance } = {},\n session,\n urlParams = {},\n} = {}) => {\n const { forceUri = false } = urlParams;\n\n // language & country\n const [navigatorLanguage, countryLanguage] = window.navigator.language?.split('-') || [];\n let [language = navigatorLanguage, country = countryLanguage] = instance.locale?.split('-') || [];\n if (urlParams.lang && urlParams.lang === navigatorLanguage) language = urlParams.lang;\n\n // currency\n const currency =\n (forceUri ? urlParams.currency : undefined) ||\n cookies.currency ||\n urlParams.currency ||\n instance.currency ||\n DEFAULT_CURRENCY;\n\n // club\n let club;\n if (config.club) {\n let {\n club: {\n club: { active, authentication, idClub: id, name },\n conditionsUrl: conditions,\n privacyPolicyUrl: privacy,\n },\n } = config;\n club = { active, authentication, id, name, url: { conditions, privacy } };\n }\n\n // hotel\n let hotel = {\n accommodationType: getAccommodationType(config.lodgingDenomination, hotelId),\n id: type === TYPE.CHAIN ? hotelId : id,\n maxNights: config.maxBookingDays,\n maxRooms: config.accomodation?.rooms?.maxOccupation,\n url: urlParams.home || window.location.origin,\n };\n\n // origin\n let origin = {\n commissionCode: urlParams.hsri || COMMISSION_TYPE[type],\n };\n\n // promo\n let promo;\n if (config.showPromoNav) {\n const { accomodation: { promo: configPromo = {} } = {}, promoText: placeholder = {} } = config;\n promo = { ...configPromo, placeholder };\n }\n\n return {\n config,\n cookies,\n urlParams,\n ...instance,\n id,\n type,\n\n // region\n currency,\n language,\n country,\n locale: language && country ? `${language}-${country}` : DEFAULT_LOCALE,\n\n // entities,\n club,\n hotel,\n origin,\n promo,\n session,\n\n // @mirai/finder\n finder: {\n // ! TODO: we should hydrate it\n place: undefined,\n calendar: undefined,\n occupation: undefined,\n promocode: promo?.code,\n },\n deals: undefined,\n\n // @mirai/user\n signup: undefined,\n };\n};\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AAEA;AACO,MAAMA,gBAAgB,GAAG,YAMrB;EAAA,IANsB;IAC/BC,MAAM,GAAG,CAAC,CAAC;IACXC,OAAO,GAAG,CAAC,CAAC;IACZC,QAAQ,EAAE;MAAEC,EAAE;MAAEC,KAAK,EAAEC,OAAO;MAAEC,EAAE;MAAEC,IAAI;MAAE,GAAGL;IAAS,CAAC,GAAG,CAAC,CAAC;IAC5DM,OAAO;IACPC,SAAS,GAAG,CAAC;EACf,CAAC,uEAAG,CAAC,CAAC;EACJ,MAAM;IAAEC,QAAQ,GAAG;EAAM,CAAC,GAAGD,SAAS;;EAEtC;EACA,MAAM,CAACE,iBAAiB,EAAEC,eAAe,CAAC,GAAGC,MAAM,CAACC,SAAS,CAACC,QAAQ,EAAEC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE;EACxF,IAAI,CAACD,QAAQ,GAAGJ,iBAAiB,EAAEM,OAAO,GAAGL,eAAe,CAAC,GAAGV,QAAQ,CAACgB,MAAM,EAAEF,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE;EACjG,IAAIP,SAAS,CAACU,IAAI,IAAIV,SAAS,CAACU,IAAI,KAAKR,iBAAiB,EAAEI,QAAQ,GAAGN,SAAS,CAACU,IAAI;;
|
|
1
|
+
{"version":3,"file":"consolidateStore.js","names":["consolidateStore","config","cookies","instance","el","hotel","hotelId","id","type","session","urlParams","forceUri","navigatorLanguage","countryLanguage","window","navigator","language","split","country","locale","lang","Theme","setDirection","DIRECTION_TYPE","RIGHT","currency","undefined","DEFAULT_CURRENCY","club","active","authentication","idClub","name","conditionsUrl","conditions","privacyPolicyUrl","privacy","url","accommodationType","getAccommodationType","lodgingDenomination","TYPE","CHAIN","maxNights","maxBookingDays","maxRooms","accomodation","rooms","maxOccupation","home","location","origin","commissionCode","hsri","COMMISSION_TYPE","promo","showPromoNav","configPromo","promoText","placeholder","DEFAULT_LOCALE","finder","place","calendar","occupation","promocode","code","deals","signup"],"sources":["../../src/helpers/consolidateStore.js"],"sourcesContent":["import { DEFAULT_CURRENCY, DEFAULT_LOCALE } from '@mirai/locale';\nimport { DIRECTION_TYPE, Theme } from '@mirai/ui';\n\nimport { COMMISSION_TYPE, TYPE } from '../Core.constants';\nimport { getAccommodationType } from './getAccommodationType';\n\n/* eslint-disable no-unused-vars */\nexport const consolidateStore = ({\n config = {},\n cookies = {},\n instance: { el, hotel: hotelId, id, type, ...instance } = {},\n session,\n urlParams = {},\n} = {}) => {\n const { forceUri = false } = urlParams;\n\n // language & country\n const [navigatorLanguage, countryLanguage] = window.navigator.language?.split('-') || [];\n let [language = navigatorLanguage, country = countryLanguage] = instance.locale?.split('-') || [];\n if (urlParams.lang && urlParams.lang === navigatorLanguage) language = urlParams.lang;\n if (language === 'ar') Theme.setDirection(DIRECTION_TYPE.RIGHT);\n\n // currency\n const currency =\n (forceUri ? urlParams.currency : undefined) ||\n cookies.currency ||\n urlParams.currency ||\n instance.currency ||\n DEFAULT_CURRENCY;\n\n // club\n let club;\n if (config.club) {\n let {\n club: {\n club: { active, authentication, idClub: id, name },\n conditionsUrl: conditions,\n privacyPolicyUrl: privacy,\n },\n } = config;\n club = { active, authentication, id, name, url: { conditions, privacy } };\n }\n\n // hotel\n let hotel = {\n accommodationType: getAccommodationType(config.lodgingDenomination, hotelId),\n id: type === TYPE.CHAIN ? hotelId : id,\n maxNights: config.maxBookingDays,\n maxRooms: config.accomodation?.rooms?.maxOccupation,\n url: urlParams.home || window.location.origin,\n };\n\n // origin\n let origin = {\n commissionCode: urlParams.hsri || COMMISSION_TYPE[type],\n };\n\n // promo\n let promo;\n if (config.showPromoNav) {\n const { accomodation: { promo: configPromo = {} } = {}, promoText: placeholder = {} } = config;\n promo = { ...configPromo, placeholder };\n }\n\n return {\n config,\n cookies,\n urlParams,\n ...instance,\n id,\n type,\n\n // region\n currency,\n language,\n country,\n locale: language && country ? `${language}-${country}` : DEFAULT_LOCALE,\n\n // entities,\n club,\n hotel,\n origin,\n promo,\n session,\n\n // @mirai/finder\n finder: {\n // ! TODO: we should hydrate it\n place: undefined,\n calendar: undefined,\n occupation: undefined,\n promocode: promo?.code,\n },\n deals: undefined,\n\n // @mirai/user\n signup: undefined,\n };\n};\n"],"mappings":";;;;;;AAAA;AACA;AAEA;AACA;AAEA;AACO,MAAMA,gBAAgB,GAAG,YAMrB;EAAA,IANsB;IAC/BC,MAAM,GAAG,CAAC,CAAC;IACXC,OAAO,GAAG,CAAC,CAAC;IACZC,QAAQ,EAAE;MAAEC,EAAE;MAAEC,KAAK,EAAEC,OAAO;MAAEC,EAAE;MAAEC,IAAI;MAAE,GAAGL;IAAS,CAAC,GAAG,CAAC,CAAC;IAC5DM,OAAO;IACPC,SAAS,GAAG,CAAC;EACf,CAAC,uEAAG,CAAC,CAAC;EACJ,MAAM;IAAEC,QAAQ,GAAG;EAAM,CAAC,GAAGD,SAAS;;EAEtC;EACA,MAAM,CAACE,iBAAiB,EAAEC,eAAe,CAAC,GAAGC,MAAM,CAACC,SAAS,CAACC,QAAQ,EAAEC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE;EACxF,IAAI,CAACD,QAAQ,GAAGJ,iBAAiB,EAAEM,OAAO,GAAGL,eAAe,CAAC,GAAGV,QAAQ,CAACgB,MAAM,EAAEF,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE;EACjG,IAAIP,SAAS,CAACU,IAAI,IAAIV,SAAS,CAACU,IAAI,KAAKR,iBAAiB,EAAEI,QAAQ,GAAGN,SAAS,CAACU,IAAI;EACrF,IAAIJ,QAAQ,KAAK,IAAI,EAAEK,SAAK,CAACC,YAAY,CAACC,kBAAc,CAACC,KAAK,CAAC;;EAE/D;EACA,MAAMC,QAAQ,GACZ,CAACd,QAAQ,GAAGD,SAAS,CAACe,QAAQ,GAAGC,SAAS,KAC1CxB,OAAO,CAACuB,QAAQ,IAChBf,SAAS,CAACe,QAAQ,IAClBtB,QAAQ,CAACsB,QAAQ,IACjBE,w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1D,MAAM;IACNC,OAAO;IACPQ,SAAS;IACT,GAAGP,QAAQ;IACXI,EAAE;IACFC,IAAI;IAEJ;IACAiB,QAAQ;IACRT,QAAQ;IACRE,OAAO;IACPC,MAAM,EAAEH,QAAQ,IAAIE,OAAO,GAAI,GAAEF,QAAS,IAAGE,OAAQ,EAAC,GAAG0C,sBAAc;IAEvE;IACAhC,IAAI;IACJvB,KAAK;IACL8C,MAAM;IACNI,KAAK;IACL9C,OAAO;IAEP;IACAoD,MAAM,EAAE;MACN;MACAC,KAAK,EAAEpC,SAAS;MAChBqC,QAAQ,EAAErC,SAAS;MACnBsC,UAAU,EAAEtC,SAAS;MACrBuC,SAAS,EAAEV,KAAK,EAAEW;IACpB,CAAC;IACDC,KAAK,EAAEzC,SAAS;IAEhB;IACA0C,MAAM,EAAE1C;EACV,CAAC;AACH,CAAC;AAAC"}
|
package/build/helpers/theme.js
CHANGED
|
@@ -8,13 +8,7 @@ const VARIABLES = {
|
|
|
8
8
|
'--mirai-ui-accent': '--corporative-color',
|
|
9
9
|
'--mirai-ui-border-radius': '--border-radius'
|
|
10
10
|
};
|
|
11
|
-
const
|
|
12
|
-
body: {
|
|
13
|
-
'--mirai-ui-font': 'font-family',
|
|
14
|
-
'--mirai-ui-font-bold': 'font-family',
|
|
15
|
-
'--mirai-ui-input-font': 'font-family'
|
|
16
|
-
}
|
|
17
|
-
};
|
|
11
|
+
const FONT_FAMILY = 'font-family';
|
|
18
12
|
const theme = () => {
|
|
19
13
|
const processed = [];
|
|
20
14
|
const setVariable = (key, value) => {
|
|
@@ -30,20 +24,20 @@ const theme = () => {
|
|
|
30
24
|
});
|
|
31
25
|
|
|
32
26
|
// CSS Selectors
|
|
33
|
-
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} catch (error) {
|
|
43
|
-
// eslint-disable-next-line no-console
|
|
44
|
-
console.error(error);
|
|
27
|
+
function getFont() {
|
|
28
|
+
let font;
|
|
29
|
+
const bodyFont = window.getComputedStyle(document.body).getPropertyValue(FONT_FAMILY);
|
|
30
|
+
if (bodyFont && bodyFont !== '"Times New Roman"') {
|
|
31
|
+
font = bodyFont;
|
|
32
|
+
} else {
|
|
33
|
+
const miBe = document.querySelector('.mi-be');
|
|
34
|
+
const miBeFont = miBe ? window.getComputedStyle(miBe).getPropertyValue(FONT_FAMILY) : undefined;
|
|
35
|
+
if (miBeFont && miBeFont !== '"Times New Roman"') font = miBeFont;
|
|
45
36
|
}
|
|
46
|
-
|
|
37
|
+
return font;
|
|
38
|
+
}
|
|
39
|
+
const font = getFont();
|
|
40
|
+
if (font) setVariable('--mirai-ui-font', font);
|
|
47
41
|
};
|
|
48
42
|
exports.theme = theme;
|
|
49
43
|
//# sourceMappingURL=theme.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","names":["VARIABLES","
|
|
1
|
+
{"version":3,"file":"theme.js","names":["VARIABLES","FONT_FAMILY","theme","processed","setVariable","key","value","includes","document","documentElement","style","setProperty","trim","push","Object","entries","forEach","variable","legacy","getComputedStyle","getPropertyValue","getFont","font","bodyFont","window","body","miBe","querySelector","miBeFont","undefined"],"sources":["../../src/helpers/theme.js"],"sourcesContent":["const VARIABLES = {\n '--mirai-ui-accent': '--corporative-color',\n '--mirai-ui-border-radius': '--border-radius',\n};\n\nconst FONT_FAMILY = 'font-family';\n\nexport const theme = () => {\n const processed = [];\n\n const setVariable = (key, value) => {\n if (!value || processed.includes(key)) return;\n\n document.documentElement.style.setProperty(key, value.trim());\n processed.push(key);\n };\n\n // CSS variables\n Object.entries(VARIABLES).forEach(([variable, legacy]) => {\n setVariable(variable, getComputedStyle(document.documentElement).getPropertyValue(legacy));\n });\n\n // CSS Selectors\n function getFont() {\n let font;\n\n const bodyFont = window.getComputedStyle(document.body).getPropertyValue(FONT_FAMILY);\n if (bodyFont && bodyFont !== '\"Times New Roman\"') {\n font = bodyFont;\n } else {\n const miBe = document.querySelector('.mi-be');\n const miBeFont = miBe ? window.getComputedStyle(miBe).getPropertyValue(FONT_FAMILY) : undefined;\n if (miBeFont && miBeFont !== '\"Times New Roman\"') font = miBeFont;\n }\n\n return font;\n }\n\n const font = getFont();\n if (font) setVariable('--mirai-ui-font', font);\n};\n"],"mappings":";;;;;;AAAA,MAAMA,SAAS,GAAG;EAChB,mBAAmB,EAAE,qBAAqB;EAC1C,0BAA0B,EAAE;AAC9B,CAAC;AAED,MAAMC,WAAW,GAAG,aAAa;AAE1B,MAAMC,KAAK,GAAG,MAAM;EACzB,MAAMC,SAAS,GAAG,EAAE;EAEpB,MAAMC,WAAW,GAAG,CAACC,GAAG,EAAEC,KAAK,KAAK;IAClC,IAAI,CAACA,KAAK,IAAIH,SAAS,CAACI,QAAQ,CAACF,GAAG,CAAC,EAAE;IAEvCG,QAAQ,CAACC,eAAe,CAACC,KAAK,CAACC,WAAW,CAACN,GAAG,EAAEC,KAAK,CAACM,IAAI,EAAE,CAAC;IAC7DT,SAAS,CAACU,IAAI,CAACR,GAAG,CAAC;EACrB,CAAC;;EAED;EACAS,MAAM,CAACC,OAAO,CAACf,SAAS,CAAC,CAACgB,OAAO,CAAC,QAAwB;IAAA,IAAvB,CAACC,QAAQ,EAAEC,MAAM,CAAC;IACnDd,WAAW,CAACa,QAAQ,EAAEE,gBAAgB,CAACX,QAAQ,CAACC,eAAe,CAAC,CAACW,gBAAgB,CAACF,MAAM,CAAC,CAAC;EAC5F,CAAC,CAAC;;EAEF;EACA,SAASG,OAAO,GAAG;IACjB,IAAIC,IAAI;IAER,MAAMC,QAAQ,GAAGC,MAAM,CAACL,gBAAgB,CAACX,QAAQ,CAACiB,IAAI,CAAC,CAACL,gBAAgB,CAACnB,WAAW,CAAC;IACrF,IAAIsB,QAAQ,IAAIA,QAAQ,KAAK,mBAAmB,EAAE;MAChDD,IAAI,GAAGC,QAAQ;IACjB,CAAC,MAAM;MACL,MAAMG,IAAI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