@mirai/core 0.1.5 → 0.1.7
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/.env +1 -1
- package/build/Core.provider.js +11 -4
- package/build/Core.provider.js.map +1 -1
- package/build/helpers/consolidateStore.js +20 -1
- package/build/helpers/consolidateStore.js.map +1 -1
- package/build/index.js +1 -1
- package/build/services/Club/get.js +4 -1
- package/build/services/Club/get.js.map +1 -1
- package/package.json +1 -1
package/.env
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
BUNDLE_DEV=https://js-pre.mirai.com/core/index.js
|
|
2
2
|
BUNDLE_LOCALHOST=http://local.mirai.com:9090/dist/index.js?version=localhost
|
|
3
3
|
|
|
4
|
-
METRICS=
|
|
4
|
+
METRICS=8499ad730df132d03f1d532e287a9920
|
|
5
5
|
|
|
6
6
|
SERVICE_CLUB=https://api.mirai.com
|
|
7
7
|
SERVICE_ENGINE=https://engine.mirai.com
|
package/build/Core.provider.js
CHANGED
|
@@ -19,7 +19,9 @@ const CoreProvider = _ref => {
|
|
|
19
19
|
currency,
|
|
20
20
|
id,
|
|
21
21
|
locale,
|
|
22
|
-
|
|
22
|
+
metrics,
|
|
23
|
+
type,
|
|
24
|
+
value = {}
|
|
23
25
|
} = _ref;
|
|
24
26
|
const [store, setStore] = (0, _react.useState)();
|
|
25
27
|
(0, _react.useLayoutEffect)(() => {
|
|
@@ -45,9 +47,12 @@ const CoreProvider = _ref => {
|
|
|
45
47
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
46
48
|
}, []);
|
|
47
49
|
return store ? /*#__PURE__*/_react.default.createElement(_dataSources.MetricsProvider, {
|
|
48
|
-
token: process && process.env && process.env.METRICS || "
|
|
50
|
+
token: metrics || process && process.env && process.env.METRICS || "8499ad730df132d03f1d532e287a9920"
|
|
49
51
|
}, /*#__PURE__*/_react.default.createElement(_dataSources.StoreProvider, {
|
|
50
|
-
value:
|
|
52
|
+
value: {
|
|
53
|
+
...store,
|
|
54
|
+
...value
|
|
55
|
+
}
|
|
51
56
|
}, /*#__PURE__*/_react.default.createElement(_Core.Core, null, children))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
52
57
|
};
|
|
53
58
|
exports.CoreProvider = CoreProvider;
|
|
@@ -56,6 +61,8 @@ CoreProvider.propTypes = {
|
|
|
56
61
|
currency: _propTypes.default.string,
|
|
57
62
|
id: _propTypes.default.string.isRequired,
|
|
58
63
|
locale: _propTypes.default.string,
|
|
59
|
-
|
|
64
|
+
metrics: _propTypes.default.string,
|
|
65
|
+
type: _propTypes.default.oneOf(['hotel', 'chain']),
|
|
66
|
+
value: _propTypes.default.shape({})
|
|
60
67
|
};
|
|
61
68
|
//# sourceMappingURL=Core.provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Core.provider.js","names":["CoreProvider","children","currency","id","locale","type","store","setStore","useState","useLayoutEffect","urlParams","fetchUrlParams","location","search","substring","cookies","fetchCookies","COOKIE_CART","COOKIE_VALUES","session","fetchSession","instance","config","fetchConfig","consolidateStore","propTypes","PropTypes","node","isRequired","string","oneOf"],"sources":["../src/Core.provider.jsx"],"sourcesContent":["import { MetricsProvider, StoreProvider } from '@mirai/data-sources';\nimport PropTypes from 'prop-types';\nimport React, { useLayoutEffect, useState } from 'react';\n\nimport { Core } from './Core';\nimport { COOKIE_CART, COOKIE_VALUES } from './Core.definition';\nimport { consolidateStore, fetchConfig, fetchCookies, fetchSession, fetchUrlParams } from './helpers';\n\nconst CoreProvider = ({ children, currency, id, locale, type }) => {\n const [store, setStore] = useState();\n\n useLayoutEffect(() => {\n (async () => {\n const urlParams = fetchUrlParams(location.search.substring(1));\n const cookies = fetchCookies([COOKIE_CART, COOKIE_VALUES]);\n const session = fetchSession(urlParams);\n\n const instance = { currency, id, type, locale };\n const config = await fetchConfig(instance);\n\n setStore(consolidateStore({ config, cookies, instance, session, urlParams }));\n })();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return store ? (\n <MetricsProvider token={process.env.METRICS}>\n <StoreProvider value={store}>\n <Core>{children}</Core>\n </StoreProvider>\n </MetricsProvider>\n ) : (\n <></>\n );\n};\n\nCoreProvider.propTypes = {\n children: PropTypes.node.isRequired,\n currency: PropTypes.string,\n id: PropTypes.string.isRequired,\n locale: PropTypes.string,\n type: PropTypes.oneOf(['hotel', 'chain']),\n};\n\nexport { CoreProvider };\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AAAsG;AAAA;AAAA;AAEtG,MAAMA,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"Core.provider.js","names":["CoreProvider","children","currency","id","locale","metrics","type","value","store","setStore","useState","useLayoutEffect","urlParams","fetchUrlParams","location","search","substring","cookies","fetchCookies","COOKIE_CART","COOKIE_VALUES","session","fetchSession","instance","config","fetchConfig","consolidateStore","propTypes","PropTypes","node","isRequired","string","oneOf","shape"],"sources":["../src/Core.provider.jsx"],"sourcesContent":["import { MetricsProvider, StoreProvider } from '@mirai/data-sources';\nimport PropTypes from 'prop-types';\nimport React, { useLayoutEffect, useState } from 'react';\n\nimport { Core } from './Core';\nimport { COOKIE_CART, COOKIE_VALUES } from './Core.definition';\nimport { consolidateStore, fetchConfig, fetchCookies, fetchSession, fetchUrlParams } from './helpers';\n\nconst CoreProvider = ({ children, currency, id, locale, metrics, type, value = {} }) => {\n const [store, setStore] = useState();\n\n useLayoutEffect(() => {\n (async () => {\n const urlParams = fetchUrlParams(location.search.substring(1));\n const cookies = fetchCookies([COOKIE_CART, COOKIE_VALUES]);\n const session = fetchSession(urlParams);\n\n const instance = { currency, id, type, locale };\n const config = await fetchConfig(instance);\n\n setStore(consolidateStore({ config, cookies, instance, session, urlParams }));\n })();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return store ? (\n <MetricsProvider token={metrics || process.env.METRICS}>\n <StoreProvider value={{ ...store, ...value }}>\n <Core>{children}</Core>\n </StoreProvider>\n </MetricsProvider>\n ) : (\n <></>\n );\n};\n\nCoreProvider.propTypes = {\n children: PropTypes.node.isRequired,\n currency: PropTypes.string,\n id: PropTypes.string.isRequired,\n locale: PropTypes.string,\n metrics: PropTypes.string,\n type: PropTypes.oneOf(['hotel', 'chain']),\n value: PropTypes.shape({}),\n};\n\nexport { CoreProvider };\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAEA;AACA;AACA;AAAsG;AAAA;AAAA;AAEtG,MAAMA,YAAY,GAAG,QAAmE;EAAA,IAAlE;IAAEC,QAAQ;IAAEC,QAAQ;IAAEC,EAAE;IAAEC,MAAM;IAAEC,OAAO;IAAEC,IAAI;IAAEC,KAAK,GAAG,CAAC;EAAE,CAAC;EACjF,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAC,eAAQ,GAAE;EAEpC,IAAAC,sBAAe,EAAC,MAAM;IACpB,CAAC,YAAY;MACX,MAAMC,SAAS,GAAG,IAAAC,uBAAc,EAACC,QAAQ,CAACC,MAAM,CAACC,SAAS,CAAC,CAAC,CAAC,CAAC;MAC9D,MAAMC,OAAO,GAAG,IAAAC,qBAAY,EAAC,CAACC,kBAAW,EAAEC,oBAAa,CAAC,CAAC;MAC1D,MAAMC,OAAO,GAAG,IAAAC,qBAAY,EAACV,SAAS,CAAC;MAEvC,MAAMW,QAAQ,GAAG;QAAErB,QAAQ;QAAEC,EAAE;QAAEG,IAAI;QAAEF;MAAO,CAAC;MAC/C,MAAMoB,MAAM,GAAG,MAAM,IAAAC,oBAAW,EAACF,QAAQ,CAAC;MAE1Cd,QAAQ,CAAC,IAAAiB,yBAAgB,EAAC;QAAEF,MAAM;QAAEP,OAAO;QAAEM,QAAQ;QAAEF,OAAO;QAAET;MAAU,CAAC,CAAC,CAAC;IAC/E,CAAC,GAAG;IACJ;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOJ,KAAK,gBACV,6BAAC,4BAAe;IAAC,KAAK,EAAEH,OAAO;EAAwB,gBACrD,6BAAC,0BAAa;IAAC,KAAK,EAAE;MAAE,GAAGG,KAAK;MAAE,GAAGD;IAAM;EAAE,gBAC3C,6BAAC,UAAI,QAAEN,QAAQ,CAAQ,CACT,CACA,gBAElB,2DACD;AACH,CAAC;AAAC;AAEFD,YAAY,CAAC2B,SAAS,GAAG;EACvB1B,QAAQ,EAAE2B,kBAAS,CAACC,IAAI,CAACC,UAAU;EACnC5B,QAAQ,EAAE0B,kBAAS,CAACG,MAAM;EAC1B5B,EAAE,EAAEyB,kBAAS,CAACG,MAAM,CAACD,UAAU;EAC/B1B,MAAM,EAAEwB,kBAAS,CAACG,MAAM;EACxB1B,OAAO,EAAEuB,kBAAS,CAACG,MAAM;EACzBzB,IAAI,EAAEsB,kBAAS,CAACI,KAAK,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;EACzCzB,KAAK,EAAEqB,kBAAS,CAACK,KAAK,CAAC,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -32,7 +32,6 @@ const consolidateStore = function () {
|
|
|
32
32
|
const currency = (forceUri ? urlParams.currency : undefined) || cookies.currency || urlParams.currency || instance.currency || _locale.DEFAULT_CURRENCY;
|
|
33
33
|
|
|
34
34
|
// club // ! TODO Check if we need more
|
|
35
|
-
|
|
36
35
|
let club;
|
|
37
36
|
if (config.club) {
|
|
38
37
|
let {
|
|
@@ -61,6 +60,21 @@ const consolidateStore = function () {
|
|
|
61
60
|
let hotel = {
|
|
62
61
|
id
|
|
63
62
|
};
|
|
63
|
+
|
|
64
|
+
// promo
|
|
65
|
+
let promo;
|
|
66
|
+
if (config.showPromoNav) {
|
|
67
|
+
const {
|
|
68
|
+
accomodation: {
|
|
69
|
+
promo: configPromo = {}
|
|
70
|
+
} = {},
|
|
71
|
+
promoText: placeholder = {}
|
|
72
|
+
} = config;
|
|
73
|
+
promo = {
|
|
74
|
+
...configPromo,
|
|
75
|
+
placeholder
|
|
76
|
+
};
|
|
77
|
+
}
|
|
64
78
|
return {
|
|
65
79
|
config,
|
|
66
80
|
cookies,
|
|
@@ -76,10 +90,15 @@ const consolidateStore = function () {
|
|
|
76
90
|
// entities,
|
|
77
91
|
club,
|
|
78
92
|
hotel,
|
|
93
|
+
promo,
|
|
79
94
|
session,
|
|
80
95
|
// components
|
|
81
96
|
finder: {
|
|
82
97
|
// ! TODO: we should hydrate it
|
|
98
|
+
place: undefined,
|
|
99
|
+
calendar: undefined,
|
|
100
|
+
occupation: undefined,
|
|
101
|
+
promocode: promo?.code
|
|
83
102
|
},
|
|
84
103
|
signup: undefined
|
|
85
104
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consolidateStore.js","names":["consolidateStore","config","cookies","instance","el","id","type","session","urlParams","forceUri","navigatorLanguage","countryLanguage","window","navigator","language","split","country","locale","lang","currency","undefined","DEFAULT_CURRENCY","club","authentication","idClub","name","conditionsUrl","conditions","privacyPolicyUrl","privacy","url","hotel","DEFAULT_LOCALE","finder","signup"],"sources":["../../src/helpers/consolidateStore.js"],"sourcesContent":["import { DEFAULT_CURRENCY, DEFAULT_LOCALE } from '@mirai/locale';\n\n/* eslint-disable no-unused-vars */\nexport const consolidateStore = ({\n config = {},\n cookies = {},\n instance: { el, 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 // ! TODO Check if we need more\n
|
|
1
|
+
{"version":3,"file":"consolidateStore.js","names":["consolidateStore","config","cookies","instance","el","id","type","session","urlParams","forceUri","navigatorLanguage","countryLanguage","window","navigator","language","split","country","locale","lang","currency","undefined","DEFAULT_CURRENCY","club","authentication","idClub","name","conditionsUrl","conditions","privacyPolicyUrl","privacy","url","hotel","promo","showPromoNav","accomodation","configPromo","promoText","placeholder","DEFAULT_LOCALE","finder","place","calendar","occupation","promocode","code","signup"],"sources":["../../src/helpers/consolidateStore.js"],"sourcesContent":["import { DEFAULT_CURRENCY, DEFAULT_LOCALE } from '@mirai/locale';\n\n/* eslint-disable no-unused-vars */\nexport const consolidateStore = ({\n config = {},\n cookies = {},\n instance: { el, 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 // ! TODO Check if we need more\n let club;\n if (config.club) {\n let {\n club: {\n club: { authentication, idClub: id, name },\n conditionsUrl: conditions,\n privacyPolicyUrl: privacy,\n },\n } = config;\n club = { authentication, id, name, url: { conditions, privacy } };\n }\n\n // hotel // ! TODO how we will hydrate it?\n let hotel = {\n id,\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 // region\n currency,\n language,\n country,\n locale: language && country ? `${language}-${country}` : DEFAULT_LOCALE,\n // entities,\n club,\n hotel,\n promo,\n session,\n // components\n finder: {\n // ! TODO: we should hydrate it\n place: undefined,\n calendar: undefined,\n occupation: undefined,\n promocode: promo?.code,\n },\n signup: undefined,\n };\n};\n"],"mappings":";;;;;;AAAA;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,EAAE;MAAEC,IAAI;MAAE,GAAGH;IAAS,CAAC,GAAG,CAAC,CAAC;IAC5CI,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,GAAGR,QAAQ,CAACc,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;;EAErF;EACA,MAAMC,QAAQ,GACZ,CAACV,QAAQ,GAAGD,SAAS,CAACW,QAAQ,GAAGC,SAAS,KAC1ClB,OAAO,CAACiB,QAAQ,IAChBX,SAAS,CAACW,QAAQ,IAClBhB,QAAQ,CAACgB,QAAQ,IACjBE,wBAAgB;;EAElB;EACA,IAAIC,IAAI;EACR,IAAIrB,MAAM,CAACqB,IAAI,EAAE;IACf,IAAI;MACFA,IAAI,EAAE;QACJA,IAAI,EAAE;UAAEC,cAAc;UAAEC,MAAM,EAAEnB,EAAE;UAAEoB;QAAK,CAAC;QAC1CC,aAAa,EAAEC,UAAU;QACzBC,gBAAgB,EAAEC;MACpB;IACF,CAAC,GAAG5B,MAAM;IACVqB,IAAI,GAAG;MAAEC,cAAc;MAAElB,EAAE;MAAEoB,IAAI;MAAEK,GAAG,EAAE;QAAEH,UAAU;QAAEE;MAAQ;IAAE,CAAC;EACnE;;EAEA;EACA,IAAIE,KAAK,GAAG;IACV1B;EACF,CAAC;;EAED;EACA,IAAI2B,KAAK;EACT,IAAI/B,MAAM,CAACgC,YAAY,EAAE;IACvB,MAAM;MAAEC,YAAY,EAAE;QAAEF,KAAK,EAAEG,WAAW,GAAG,CAAC;MAAE,CAAC,GAAG,CAAC,CAAC;MAAEC,SAAS,EAAEC,WAAW,GAAG,CAAC;IAAE,CAAC,GAAGpC,MAAM;IAC9F+B,KAAK,GAAG;MAAE,GAAGG,WAAW;MAAEE;IAAY,CAAC;EACzC;EAEA,OAAO;IACLpC,MAAM;IACNC,OAAO;IACPM,SAAS;IACT,GAAGL,QAAQ;IACXE,EAAE;IACFC,IAAI;IACJ;IACAa,QAAQ;IACRL,QAAQ;IACRE,OAAO;IACPC,MAAM,EAAEH,QAAQ,IAAIE,OAAO,GAAI,GAAEF,QAAS,IAAGE,OAAQ,EAAC,GAAGsB,sBAAc;IACvE;IACAhB,IAAI;IACJS,KAAK;IACLC,KAAK;IACLzB,OAAO;IACP;IACAgC,MAAM,EAAE;MACN;MACAC,KAAK,EAAEpB,SAAS;MAChBqB,QAAQ,EAAErB,SAAS;MACnBsB,UAAU,EAAEtB,SAAS;MACrBuB,SAAS,EAAEX,KAAK,EAAEY;IACpB,CAAC;IACDC,MAAM,EAAEzB;EACV,CAAC;AACH,CAAC;AAAC"}
|
package/build/index.js
CHANGED
|
@@ -56,7 +56,7 @@ window.Mirai.core = async () => {
|
|
|
56
56
|
|
|
57
57
|
// 8. Render components
|
|
58
58
|
_reactDom.default.render( /*#__PURE__*/_react.default.createElement(_react.default.StrictMode, null, /*#__PURE__*/_react.default.createElement(_dataSources.MetricsProvider, {
|
|
59
|
-
token: process && process.env && process.env.METRICS || "
|
|
59
|
+
token: process && process.env && process.env.METRICS || "8499ad730df132d03f1d532e287a9920"
|
|
60
60
|
}, /*#__PURE__*/_react.default.createElement(_dataSources.StoreProvider, {
|
|
61
61
|
value: store
|
|
62
62
|
}, /*#__PURE__*/_react.default.createElement(_Core.Core, {
|
|
@@ -17,7 +17,10 @@ const get = async id => {
|
|
|
17
17
|
if (!value) {
|
|
18
18
|
value = await (0, _dataSources.request)({
|
|
19
19
|
hostname: process && process.env && process.env.SERVICE_CLUB || "https://api.mirai.com",
|
|
20
|
-
endpoint: `/club/v1/get_info_club?idTokenProvider=${id}
|
|
20
|
+
endpoint: `/club/v1/get_info_club?idTokenProvider=${id}`,
|
|
21
|
+
headers: {
|
|
22
|
+
'X-Requested-With': undefined
|
|
23
|
+
} // ! TODO: Should be fixed by backend team
|
|
21
24
|
}).catch(() => {});
|
|
22
25
|
storage.set(key, value);
|
|
23
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","names":["get","id","storage","Storage","adapter","LocalAdapter","cache","CACHE_LIMIT","key","CLUB_STORAGE_KEY","value","request","hostname","endpoint","catch","set"],"sources":["../../../src/services/Club/get.js"],"sourcesContent":["import { LocalAdapter, request, Storage } from '@mirai/data-sources';\n\nimport { CACHE_LIMIT, CLUB_STORAGE_KEY } from './constants';\n\nexport const get = async (id) => {\n if (!id || typeof id !== 'string') return;\n\n const storage = new Storage({ adapter: LocalAdapter, cache: CACHE_LIMIT });\n const key = `${CLUB_STORAGE_KEY}:get:${id}`;\n let value = storage.get(key);\n\n if (!value) {\n value = await request({\n hostname: process.env.SERVICE_CLUB,\n endpoint: `/club/v1/get_info_club?idTokenProvider=${id}`,\n }).catch(() => {});\n\n storage.set(key, value);\n }\n\n return value;\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAEO,MAAMA,GAAG,GAAG,MAAOC,EAAE,IAAK;EAC/B,IAAI,CAACA,EAAE,IAAI,OAAOA,EAAE,KAAK,QAAQ,EAAE;EAEnC,MAAMC,OAAO,GAAG,IAAIC,oBAAO,CAAC;IAAEC,OAAO,EAAEC,yBAAY;IAAEC,KAAK,EAAEC;EAAY,CAAC,CAAC;EAC1E,MAAMC,GAAG,GAAI,GAAEC,2BAAiB,QAAOR,EAAG,EAAC;EAC3C,IAAIS,KAAK,GAAGR,OAAO,CAACF,GAAG,CAACQ,GAAG,CAAC;EAE5B,IAAI,CAACE,KAAK,EAAE;IACVA,KAAK,GAAG,MAAM,IAAAC,oBAAO,EAAC;MACpBC,QAAQ,+EAA0B;MAClCC,QAAQ,EAAG,0CAAyCZ,EAAG;
|
|
1
|
+
{"version":3,"file":"get.js","names":["get","id","storage","Storage","adapter","LocalAdapter","cache","CACHE_LIMIT","key","CLUB_STORAGE_KEY","value","request","hostname","endpoint","headers","undefined","catch","set"],"sources":["../../../src/services/Club/get.js"],"sourcesContent":["import { LocalAdapter, request, Storage } from '@mirai/data-sources';\n\nimport { CACHE_LIMIT, CLUB_STORAGE_KEY } from './constants';\n\nexport const get = async (id) => {\n if (!id || typeof id !== 'string') return;\n\n const storage = new Storage({ adapter: LocalAdapter, cache: CACHE_LIMIT });\n const key = `${CLUB_STORAGE_KEY}:get:${id}`;\n let value = storage.get(key);\n\n if (!value) {\n value = await request({\n hostname: process.env.SERVICE_CLUB,\n endpoint: `/club/v1/get_info_club?idTokenProvider=${id}`,\n headers: { 'X-Requested-With': undefined }, // ! TODO: Should be fixed by backend team\n }).catch(() => {});\n\n storage.set(key, value);\n }\n\n return value;\n};\n"],"mappings":";;;;;;AAAA;AAEA;AAEO,MAAMA,GAAG,GAAG,MAAOC,EAAE,IAAK;EAC/B,IAAI,CAACA,EAAE,IAAI,OAAOA,EAAE,KAAK,QAAQ,EAAE;EAEnC,MAAMC,OAAO,GAAG,IAAIC,oBAAO,CAAC;IAAEC,OAAO,EAAEC,yBAAY;IAAEC,KAAK,EAAEC;EAAY,CAAC,CAAC;EAC1E,MAAMC,GAAG,GAAI,GAAEC,2BAAiB,QAAOR,EAAG,EAAC;EAC3C,IAAIS,KAAK,GAAGR,OAAO,CAACF,GAAG,CAACQ,GAAG,CAAC;EAE5B,IAAI,CAACE,KAAK,EAAE;IACVA,KAAK,GAAG,MAAM,IAAAC,oBAAO,EAAC;MACpBC,QAAQ,+EAA0B;MAClCC,QAAQ,EAAG,0CAAyCZ,EAAG,EAAC;MACxDa,OAAO,EAAE;QAAE,kBAAkB,EAAEC;MAAU,CAAC,CAAE;IAC9C,CAAC,CAAC,CAACC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAElBd,OAAO,CAACe,GAAG,CAACT,GAAG,EAAEE,KAAK,CAAC;EACzB;EAEA,OAAOA,KAAK;AACd,CAAC;AAAC"}
|