@mirai/core 0.1.14 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@ The first one will be our styles file for the default theme. This file only cont
10
10
 
11
11
  ```html
12
12
  <head>
13
- <link rel="stylesheet" href="https://static.mirai.com/core/theme.css" rel="preload" defer />
13
+ <link rel="stylesheet" href="https://static.mirai.com/core/index.css" rel="preload" defer />
14
14
  ...
15
15
  </head>
16
16
  ```
@@ -19,12 +19,14 @@ var _default = () => {
19
19
  }
20
20
  } = (0, _dataSources.useStore)();
21
21
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ui.InputSelect, {
22
+ name: "locale",
22
23
  options: LOCALES,
23
24
  value: locale,
24
25
  onChange: value => set({
25
26
  locale: value
26
27
  })
27
28
  }), /*#__PURE__*/_react.default.createElement(_ui.InputSelect, {
29
+ name: "currency",
28
30
  options: CURRENCIES,
29
31
  value: currency,
30
32
  onChange: value => set({
@@ -1 +1 @@
1
- {"version":3,"file":"Environment.js","names":["LOCALES","CURRENCIES","set","value","currency","locale","useStore"],"sources":["../../../src/components/__internal__/Environment.jsx"],"sourcesContent":["import { useStore } from '@mirai/data-sources';\nimport { InputSelect } from '@mirai/ui';\nimport React from 'react';\n\nconst LOCALES = ['es-ES', 'en-US', 'en-GB', 'ja-JP', 'de-DE', 'pt-PT'];\nconst CURRENCIES = ['EUR', 'USD', 'GBP', 'JPY'];\n\nexport default () => {\n const {\n set,\n value: { currency, locale },\n } = useStore();\n\n return (\n <>\n <InputSelect options={LOCALES} value={locale} onChange={(value) => set({ locale: value })} />\n <InputSelect options={CURRENCIES} value={currency} onChange={(value) => set({ currency: value })} />\n </>\n );\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAA0B;AAE1B,MAAMA,OAAO,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;AACtE,MAAMC,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AAAC,eAEjC,MAAM;EACnB,MAAM;IACJC,GAAG;IACHC,KAAK,EAAE;MAAEC,QAAQ;MAAEC;IAAO;EAC5B,CAAC,GAAG,IAAAC,qBAAQ,GAAE;EAEd,oBACE,yEACE,6BAAC,eAAW;IAAC,OAAO,EAAEN,OAAQ;IAAC,KAAK,EAAEK,MAAO;IAAC,QAAQ,EAAGF,KAAK,IAAKD,GAAG,CAAC;MAAEG,MAAM,EAAEF;IAAM,CAAC;EAAE,EAAG,eAC7F,6BAAC,eAAW;IAAC,OAAO,EAAEF,UAAW;IAAC,KAAK,EAAEG,QAAS;IAAC,QAAQ,EAAGD,KAAK,IAAKD,GAAG,CAAC;MAAEE,QAAQ,EAAED;IAAM,CAAC;EAAE,EAAG,CACnG;AAEP,CAAC;AAAA"}
1
+ {"version":3,"file":"Environment.js","names":["LOCALES","CURRENCIES","set","value","currency","locale","useStore"],"sources":["../../../src/components/__internal__/Environment.jsx"],"sourcesContent":["import { useStore } from '@mirai/data-sources';\nimport { InputSelect } from '@mirai/ui';\nimport React from 'react';\n\nconst LOCALES = ['es-ES', 'en-US', 'en-GB', 'ja-JP', 'de-DE', 'pt-PT'];\nconst CURRENCIES = ['EUR', 'USD', 'GBP', 'JPY'];\n\nexport default () => {\n const {\n set,\n value: { currency, locale },\n } = useStore();\n\n return (\n <>\n <InputSelect name=\"locale\" options={LOCALES} value={locale} onChange={(value) => set({ locale: value })} />\n <InputSelect\n name=\"currency\"\n options={CURRENCIES}\n value={currency}\n onChange={(value) => set({ currency: value })}\n />\n </>\n );\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AAA0B;AAE1B,MAAMA,OAAO,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;AACtE,MAAMC,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;AAAC,eAEjC,MAAM;EACnB,MAAM;IACJC,GAAG;IACHC,KAAK,EAAE;MAAEC,QAAQ;MAAEC;IAAO;EAC5B,CAAC,GAAG,IAAAC,qBAAQ,GAAE;EAEd,oBACE,yEACE,6BAAC,eAAW;IAAC,IAAI,EAAC,QAAQ;IAAC,OAAO,EAAEN,OAAQ;IAAC,KAAK,EAAEK,MAAO;IAAC,QAAQ,EAAGF,KAAK,IAAKD,GAAG,CAAC;MAAEG,MAAM,EAAEF;IAAM,CAAC;EAAE,EAAG,eAC3G,6BAAC,eAAW;IACV,IAAI,EAAC,UAAU;IACf,OAAO,EAAEF,UAAW;IACpB,KAAK,EAAEG,QAAS;IAChB,QAAQ,EAAGD,KAAK,IAAKD,GAAG,CAAC;MAAEE,QAAQ,EAAED;IAAM,CAAC;EAAE,EAC9C,CACD;AAEP,CAAC;AAAA"}
package/build/index.js CHANGED
@@ -10,18 +10,18 @@ var _helpers = require("./helpers");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  /* eslint-disable no-console */
12
12
 
13
- // ! TODO: Load this file before index.css
14
- // import '../node_modules/@mirai/ui/build/theme/default.theme.css';
15
-
16
- window.Mirai = window.Mirai || {};
17
- window.Mirai.environment = process && process.env && process.env.NODE_ENV || "production";
18
- window.Mirai.services = {
19
- club: process && process.env && process.env.SERVICE_CLUB || "https://api.mirai.com",
20
- engine: process && process.env && process.env.SERVICE_ENGINE || "https://engine.mirai.com",
21
- static: process && process.env && process.env.SERVICE_STATIC || "https://static.mirai.com",
22
- user: process && process.env && process.env.SERVICE_USER || "https://api.mirai.com"
13
+ window.Mirai = {
14
+ ...window.Mirai,
15
+ environment: process && process.env && process.env.NODE_ENV || "production",
16
+ services: {
17
+ booking: process && process.env && process.env.SERVICE_BOOKING || "https://reservation-pre.mirai.com/XMAS/reservation",
18
+ club: process && process.env && process.env.SERVICE_CLUB || "https://api.mirai.com",
19
+ engine: process && process.env && process.env.SERVICE_ENGINE || "https://engine.mirai.com",
20
+ static: process && process.env && process.env.SERVICE_STATIC || "https://static.mirai.com",
21
+ user: process && process.env && process.env.SERVICE_USER || "https://api.mirai.com"
22
+ },
23
+ version: _package.version
23
24
  };
24
- window.Mirai.version = _package.version;
25
25
  window.Mirai.core = async () => {
26
26
  const isProduction = (process && process.env && process.env.NODE_ENV || "production") === 'production';
27
27
  const isDevelopment = (process && process.env && process.env.NODE_ENV || "production") === 'development';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["window","Mirai","environment","services","club","engine","static","user","version","core","isProduction","isDevelopment","console","log","name","urlParams","fetchUrlParams","location","search","substring","cookies","fetchCookies","COOKIE_CART","COOKIE_VALUES","session","fetchSession","env","loadEnvironment","undefined","instance","findInstance","components","findComponents","length","config","fetchConfig","theme","store","consolidateStore","ReactDOM","render","el"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-console */\nimport { MetricsProvider, StoreProvider } from '@mirai/data-sources';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\n// ! TODO: Load this file before index.css\n// import '../node_modules/@mirai/ui/build/theme/default.theme.css';\n\nimport { name, version } from '../package.json';\nimport { Core } from './Core';\nimport { COOKIE_CART, COOKIE_VALUES } from './Core.definition';\nimport {\n consolidateStore,\n fetchConfig,\n fetchCookies,\n fetchSession,\n fetchUrlParams,\n findComponents,\n findInstance,\n loadEnvironment,\n theme,\n} from './helpers';\n\nwindow.Mirai = window.Mirai || {};\n\nwindow.Mirai.environment = process.env.NODE_ENV;\n\nwindow.Mirai.services = {\n club: process.env.SERVICE_CLUB,\n engine: process.env.SERVICE_ENGINE,\n static: process.env.SERVICE_STATIC,\n user: process.env.SERVICE_USER,\n};\n\nwindow.Mirai.version = version;\n\nwindow.Mirai.core = async () => {\n const isProduction = process.env.NODE_ENV === 'production';\n const isDevelopment = process.env.NODE_ENV === 'development';\n\n console.log(`${isProduction ? '🟢' : isDevelopment ? '🟡' : '🔴'} ${name} v${version} [${process.env.NODE_ENV}]`);\n\n // 1. Fetch client-side dataSources\n const urlParams = fetchUrlParams(location.search.substring(1));\n const cookies = fetchCookies([COOKIE_CART, COOKIE_VALUES]);\n const session = fetchSession(urlParams);\n\n // 2. Analize environment\n const environment = urlParams.env && isProduction ? loadEnvironment(urlParams.env) : undefined;\n if (environment) return;\n\n // 3. Find instance\n const instance = findInstance();\n if (!instance) return;\n\n // 4. Find components\n const components = findComponents();\n if (!components.length) return;\n\n // 5. Analize id to fetch its config\n const config = await fetchConfig(instance);\n if (!config) return;\n\n // 6. Theming\n theme();\n\n // 7. Consolidate store\n const store = consolidateStore({ config, cookies, instance, session, urlParams });\n\n // 8. Render components\n ReactDOM.render(\n <React.StrictMode>\n <MetricsProvider token={process.env.METRICS}>\n <StoreProvider value={store}>\n <Core {...{ components }} />\n </StoreProvider>\n </MetricsProvider>\n </React.StrictMode>,\n instance.el,\n );\n};\n\nwindow.Mirai.core();\n"],"mappings":";;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAUmB;AArBnB;;AAKA;AACA;;AAiBAA,MAAM,CAACC,KAAK,GAAGD,MAAM,CAACC,KAAK,IAAI,CAAC,CAAC;AAEjCD,MAAM,CAACC,KAAK,CAACC,WAAW,iEAAuB;AAE/CF,MAAM,CAACC,KAAK,CAACE,QAAQ,GAAG;EACtBC,IAAI,+EAA0B;EAC9BC,MAAM,oFAA4B;EAClCC,MAAM,oFAA4B;EAClCC,IAAI;AACN,CAAC;AAEDP,MAAM,CAACC,KAAK,CAACO,OAAO,GAAGA,gBAAO;AAE9BR,MAAM,CAACC,KAAK,CAACQ,IAAI,GAAG,YAAY;EAC9B,MAAMC,YAAY,GAAG,qEAAyB,YAAY;EAC1D,MAAMC,aAAa,GAAG,qEAAyB,aAAa;EAE5DC,OAAO,CAACC,GAAG,CAAE,GAAEH,YAAY,GAAG,IAAI,GAAGC,aAAa,GAAG,IAAI,GAAG,IAAK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index.js","names":["window","Mirai","environment","services","booking","club","engine","static","user","version","core","isProduction","isDevelopment","console","log","name","urlParams","fetchUrlParams","location","search","substring","cookies","fetchCookies","COOKIE_CART","COOKIE_VALUES","session","fetchSession","env","loadEnvironment","undefined","instance","findInstance","components","findComponents","length","config","fetchConfig","theme","store","consolidateStore","ReactDOM","render","el"],"sources":["../src/index.js"],"sourcesContent":["/* eslint-disable no-console */\nimport { MetricsProvider, StoreProvider } from '@mirai/data-sources';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { name, version } from '../package.json';\nimport { Core } from './Core';\nimport { COOKIE_CART, COOKIE_VALUES } from './Core.definition';\nimport {\n consolidateStore,\n fetchConfig,\n fetchCookies,\n fetchSession,\n fetchUrlParams,\n findComponents,\n findInstance,\n loadEnvironment,\n theme,\n} from './helpers';\n\nwindow.Mirai = {\n ...window.Mirai,\n environment: process.env.NODE_ENV,\n services: {\n booking: process.env.SERVICE_BOOKING,\n club: process.env.SERVICE_CLUB,\n engine: process.env.SERVICE_ENGINE,\n static: process.env.SERVICE_STATIC,\n user: process.env.SERVICE_USER,\n },\n version,\n};\n\nwindow.Mirai.core = async () => {\n const isProduction = process.env.NODE_ENV === 'production';\n const isDevelopment = process.env.NODE_ENV === 'development';\n\n console.log(`${isProduction ? '🟢' : isDevelopment ? '🟡' : '🔴'} ${name} v${version} [${process.env.NODE_ENV}]`);\n\n // 1. Fetch client-side dataSources\n const urlParams = fetchUrlParams(location.search.substring(1));\n const cookies = fetchCookies([COOKIE_CART, COOKIE_VALUES]);\n const session = fetchSession(urlParams);\n\n // 2. Analize environment\n const environment = urlParams.env && isProduction ? loadEnvironment(urlParams.env) : undefined;\n if (environment) return;\n\n // 3. Find instance\n const instance = findInstance();\n if (!instance) return;\n\n // 4. Find components\n const components = findComponents();\n if (!components.length) return;\n\n // 5. Analize id to fetch its config\n const config = await fetchConfig(instance);\n if (!config) return;\n\n // 6. Theming\n theme();\n\n // 7. Consolidate store\n const store = consolidateStore({ config, cookies, instance, session, urlParams });\n\n // 8. Render components\n ReactDOM.render(\n <React.StrictMode>\n <MetricsProvider token={process.env.METRICS}>\n <StoreProvider value={store}>\n <Core {...{ components }} />\n </StoreProvider>\n </MetricsProvider>\n </React.StrictMode>,\n instance.el,\n );\n};\n\nwindow.Mirai.core();\n"],"mappings":";;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AAUmB;AAlBnB;;AAoBAA,MAAM,CAACC,KAAK,GAAG;EACb,GAAGD,MAAM,CAACC,KAAK;EACfC,WAAW,gEAAsB;EACjCC,QAAQ,EAAE;IACRC,OAAO,+GAA6B;IACpCC,IAAI,+EAA0B;IAC9BC,MAAM,oFAA4B;IAClCC,MAAM,oFAA4B;IAClCC,IAAI;EACN,CAAC;EACDC,OAAO,EAAPA;AACF,CAAC;AAEDT,MAAM,CAACC,KAAK,CAACS,IAAI,GAAG,YAAY;EAC9B,MAAMC,YAAY,GAAG,qEAAyB,YAAY;EAC1D,MAAMC,aAAa,GAAG,qEAAyB,aAAa;EAE5DC,OAAO,CAACC,GAAG,CAAE,GAAEH,YAAY,GAAG,IAAI,GAAGC,aAAa,GAAG,IAAI,GAAG,IAAK,IAAGG,aAAK,KAAIN,gBAAQ,KAAE,8DAAuB,GAAE,CAAC;;EAEjH;EACA,MAAMO,SAAS,GAAG,IAAAC,uBAAc,EAACC,QAAQ,CAACC,MAAM,CAACC,SAAS,CAAC,CAAC,CAAC,CAAC;EAC9D,MAAMC,OAAO,GAAG,IAAAC,qBAAY,EAAC,CAACC,kBAAW,EAAEC,oBAAa,CAAC,CAAC;EAC1D,MAAMC,OAAO,GAAG,IAAAC,qBAAY,EAACV,SAAS,CAAC;;EAEvC;EACA,MAAMd,WAAW,GAAGc,SAAS,CAACW,GAAG,IAAIhB,YAAY,GAAG,IAAAiB,wBAAe,EAACZ,SAAS,CAACW,GAAG,CAAC,GAAGE,SAAS;EAC9F,IAAI3B,WAAW,EAAE;;EAEjB;EACA,MAAM4B,QAAQ,GAAG,IAAAC,qBAAY,GAAE;EAC/B,IAAI,CAACD,QAAQ,EAAE;;EAEf;EACA,MAAME,UAAU,GAAG,IAAAC,uBAAc,GAAE;EACnC,IAAI,CAACD,UAAU,CAACE,MAAM,EAAE;;EAExB;EACA,MAAMC,MAAM,GAAG,MAAM,IAAAC,oBAAW,EAACN,QAAQ,CAAC;EAC1C,IAAI,CAACK,MAAM,EAAE;;EAEb;EACA,IAAAE,cAAK,GAAE;;EAEP;EACA,MAAMC,KAAK,GAAG,IAAAC,yBAAgB,EAAC;IAAEJ,MAAM;IAAEd,OAAO;IAAES,QAAQ;IAAEL,OAAO;IAAET;EAAU,CAAC,CAAC;;EAEjF;EACAwB,iBAAQ,CAACC,MAAM,eACb,6BAAC,cAAK,CAAC,UAAU,qBACf,6BAAC,4BAAe;IAAC,KAAK;EAAsB,gBAC1C,6BAAC,0BAAa;IAAC,KAAK,EAAEH;EAAM,gBAC1B,6BAAC,UAAI;IAAON;EAAU,EAAM,CACd,CACA,CACD,EACnBF,QAAQ,CAACY,EAAE,CACZ;AACH,CAAC;AAED1C,MAAM,CAACC,KAAK,CAACS,IAAI,EAAE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mirai/core",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "source": "src/index.js",
5
5
  "repository": "https://gitlab.com/miraicorp/dev/frontend/core",
6
6
  "author": "JΛVI <hello@soyjavi.com>",
@@ -8,7 +8,7 @@
8
8
  "scripts": {
9
9
  "setup": "rm -rf node_modules && rm -rf yarn.lock && yarn install --force",
10
10
  "start": "rm -rf dist && parcel public/index.html --port 8080 --host local.mirai.com --open",
11
- "serve": "rm -rf dist && NODE_ENV=development parcel build public/index.html --no-cache && serve dist -p 8080 -u -n",
11
+ "serve": "serve dist -p 8080 -u -n",
12
12
  "build": "node scripts/build.js",
13
13
  "build:pro": "node scripts/bundle.js",
14
14
  "build:dev": "node scripts/bundle.js development",
@@ -72,5 +72,8 @@
72
72
  "cssModules": {
73
73
  "dashedIdents": true
74
74
  }
75
+ },
76
+ "@parcel/transformer-js": {
77
+ "inlineEnvironment": true
75
78
  }
76
79
  }
File without changes
package/public/index.html CHANGED
@@ -4,11 +4,17 @@
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>@mirai/core</title>
7
- <!-- <link rel="stylesheet" href="https://static.mirai.com/core/theme.css" rel="preload" defer /> -->
7
+ <!-- pro -->
8
+ <!-- <link rel="stylesheet" href="https://static.mirai.com/core/theme.css" rel="preload" defer />
9
+ <!-- <link rel="stylesheet" href="https://static.mirai.com/core/index.css" rel="preload" defer /> -->
10
+ <!-- pre -->
8
11
  <!-- <link rel="stylesheet" href="https://static-pre.mirai.com/core/theme.css" rel="preload" defer /> -->
12
+ <!-- serve -->
9
13
  <!-- <link rel="stylesheet" href="../dist/theme.css" rel="preload" defer /> -->
14
+ <!-- <link rel="stylesheet" href="../dist/index.css" rel="preload" defer /> -->
15
+ <!-- local -->
10
16
  <link rel="stylesheet" href="../src/theme.css" rel="preload" defer />
11
- <link rel="stylesheet" href="index.css" />
17
+ <link rel="stylesheet" href="customer.css" />
12
18
  </head>
13
19
  <body>
14
20
  <noscript>You need to enable JavaScript to run this app.</noscript>
@@ -31,11 +37,12 @@
31
37
  </div>
32
38
  <div data-mirai-component="bookingQuery"></div>
33
39
  <div data-mirai-component="environment"></div>
34
- <!-- <div data-mirai-component="state"></div> -->
40
+ <div data-mirai-component="state"></div>
35
41
  </nav>
36
42
  </header>
37
43
 
38
44
  <section class="finder">
45
+ <!-- This ones are not in our repository> -->
39
46
  <div data-mirai-component="finder"></div>
40
47
  </section>
41
48
 
@@ -79,9 +86,6 @@
79
86
 
80
87
  <section class="wrapper">
81
88
  <!-- <div data-mirai-component="ghost"></div> -->
82
-
83
- <!-- This ones are not in our repository> -->
84
- <div data-mirai-component="fi_nder" data-id="10030559"></div>
85
89
  </section>
86
90
 
87
91
  <footer>