@mirai/core 0.1.76 → 0.1.78
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/Core.Notifications.js +4 -2
- package/build/Core.Notifications.js.map +1 -1
- package/build/components/index.js +1 -0
- package/build/components/index.js.map +1 -1
- package/build/components/user/Checkout.js +10 -0
- package/build/components/user/Checkout.js.map +1 -0
- package/package.json +1 -1
- package/public/index.html +5 -6
- package/site/checkout/index.html +20 -0
- package/site/index.html +7 -3
|
@@ -22,7 +22,9 @@ const Notifications = () => {
|
|
|
22
22
|
const [, setTimestamp] = (0, _react.useState)();
|
|
23
23
|
const {
|
|
24
24
|
value: {
|
|
25
|
-
session
|
|
25
|
+
session: {
|
|
26
|
+
authorization
|
|
27
|
+
} = {}
|
|
26
28
|
}
|
|
27
29
|
} = (0, _dataSources.useStore)();
|
|
28
30
|
(0, _react.useEffect)(() => {
|
|
@@ -32,7 +34,7 @@ const Notifications = () => {
|
|
|
32
34
|
}, []);
|
|
33
35
|
(0, _react.useEffect)(() => {
|
|
34
36
|
queue = {};
|
|
35
|
-
}, [
|
|
37
|
+
}, [authorization]);
|
|
36
38
|
const handleAdd = notification => {
|
|
37
39
|
if (!notification) return;
|
|
38
40
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Core.Notifications.js","names":["EVENT_NAME","queue","Notifications","translate","useLocale","setTimestamp","useState","value","session","useStore","useEffect","Event","subscribe","handleAdd","unsubscribe","notification","success","warning","id","Date","getTime","Math","random","toFixed","visible","forceRender","setTimeout","parseMotion","handleClose","motionExpand","Theme","get","parseFloat","replace","keys","Object","style","notifications","sort","map","key","index","defaultMessage","props","styles","item","zIndex","length","displayName","propTypes"],"sources":["../src/Core.Notifications.jsx"],"sourcesContent":["import { Event, useStore } from '@mirai/data-sources';\nimport { useLocale } from '@mirai/locale';\nimport { Notification, styles, Theme, View } from '@mirai/ui';\nimport React, { useEffect, useState } from 'react';\n\nimport style from './Core.Notifications.module.css';\n\nconst EVENT_NAME = 'notification';\nlet queue = {};\n\nconst Notifications = () => {\n const { translate } = useLocale();\n const [, setTimestamp] = useState();\n const {\n value: { session },\n } = useStore();\n\n useEffect(() => {\n Event.subscribe(EVENT_NAME, handleAdd);\n return () => Event.unsubscribe(EVENT_NAME, handleAdd);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n queue = {};\n }, [
|
|
1
|
+
{"version":3,"file":"Core.Notifications.js","names":["EVENT_NAME","queue","Notifications","translate","useLocale","setTimestamp","useState","value","session","authorization","useStore","useEffect","Event","subscribe","handleAdd","unsubscribe","notification","success","warning","id","Date","getTime","Math","random","toFixed","visible","forceRender","setTimeout","parseMotion","handleClose","motionExpand","Theme","get","parseFloat","replace","keys","Object","style","notifications","sort","map","key","index","defaultMessage","props","styles","item","zIndex","length","displayName","propTypes"],"sources":["../src/Core.Notifications.jsx"],"sourcesContent":["import { Event, useStore } from '@mirai/data-sources';\nimport { useLocale } from '@mirai/locale';\nimport { Notification, styles, Theme, View } from '@mirai/ui';\nimport React, { useEffect, useState } from 'react';\n\nimport style from './Core.Notifications.module.css';\n\nconst EVENT_NAME = 'notification';\nlet queue = {};\n\nconst Notifications = () => {\n const { translate } = useLocale();\n const [, setTimestamp] = useState();\n const {\n value: { session: { authorization } = {} },\n } = useStore();\n\n useEffect(() => {\n Event.subscribe(EVENT_NAME, handleAdd);\n return () => Event.unsubscribe(EVENT_NAME, handleAdd);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n queue = {};\n }, [authorization]);\n\n const handleAdd = (notification) => {\n if (!notification) return;\n\n const { success, warning } = notification;\n const id = `${new Date().getTime()}:${Math.random().toFixed(8)}`;\n\n queue[id] = { ...notification, visible: false };\n forceRender();\n\n setTimeout(() => {\n queue[id].visible = true;\n forceRender();\n }, parseMotion());\n\n if (success || warning) setTimeout(() => handleClose(id), success ? 5000 : 10000);\n\n return;\n };\n\n const handleClose = (id) => {\n if (!queue[id]) return;\n\n setTimestamp(() => {\n queue[id].visible = false;\n\n setTimeout(() => {\n delete queue[id];\n forceRender();\n }, parseMotion());\n\n return new Date().getTime();\n });\n };\n\n const forceRender = () => setTimestamp(new Date().getTime());\n\n const parseMotion = () => {\n const { motionExpand = '0.3s' } = Theme.get();\n\n return parseFloat(motionExpand.replace('s')) * 1000;\n };\n\n const keys = Object.keys(queue);\n\n return (\n <View className={style.notifications}>\n {keys.sort().map((key, index) => {\n const { defaultMessage, id, visible = false, ...props } = queue[key];\n\n return (\n <Notification\n {...props}\n key={key}\n wide\n onClose={() => handleClose(key)}\n className={styles(style.item, visible && style.visible)}\n style={{ zIndex: keys.length - index }}\n >\n {translate({ id, defaultMessage })}\n </Notification>\n );\n })}\n </View>\n );\n};\n\nNotifications.displayName = 'core:components:Notifications';\n\nNotifications.propTypes = {};\n\nexport { Notifications };\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AAEA;AAAoD;AAAA;AAAA;AAAA;AAEpD,MAAMA,UAAU,GAAG,cAAc;AACjC,IAAIC,KAAK,GAAG,CAAC,CAAC;AAEd,MAAMC,aAAa,GAAG,MAAM;EAC1B,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,iBAAS,GAAE;EACjC,MAAM,GAAGC,YAAY,CAAC,GAAG,IAAAC,eAAQ,GAAE;EACnC,MAAM;IACJC,KAAK,EAAE;MAAEC,OAAO,EAAE;QAAEC;MAAc,CAAC,GAAG,CAAC;IAAE;EAC3C,CAAC,GAAG,IAAAC,qBAAQ,GAAE;EAEd,IAAAC,gBAAS,EAAC,MAAM;IACdC,kBAAK,CAACC,SAAS,CAACb,UAAU,EAAEc,SAAS,CAAC;IACtC,OAAO,MAAMF,kBAAK,CAACG,WAAW,CAACf,UAAU,EAAEc,SAAS,CAAC;IACrD;EACF,CAAC,EAAE,EAAE,CAAC;EAEN,IAAAH,gBAAS,EAAC,MAAM;IACdV,KAAK,GAAG,CAAC,CAAC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O,CAAC,GAAGC,SAAK,CAACC,GAAG,EAAE;IAE7C,OAAOC,UAAU,CAACH,YAAY,CAACI,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI;EACrD,CAAC;EAED,MAAMC,IAAI,GAAGC,MAAM,CAACD,IAAI,CAAClC,KAAK,CAAC;EAE/B,oBACE,6BAAC,QAAI;IAAC,SAAS,EAAEoC,gCAAK,CAACC;EAAc,GAClCH,IAAI,CAACI,IAAI,EAAE,CAACC,GAAG,CAAC,CAACC,GAAG,EAAEC,KAAK,KAAK;IAC/B,MAAM;MAAEC,cAAc;MAAExB,EAAE;MAAEM,OAAO,GAAG,KAAK;MAAE,GAAGmB;IAAM,CAAC,GAAG3C,KAAK,CAACwC,GAAG,CAAC;IAEpE,oBACE,6BAAC,gBAAY,eACPG,KAAK;MACT,GAAG,EAAEH,GAAI;MACT,IAAI;MACJ,OAAO,EAAE,MAAMZ,WAAW,CAACY,GAAG,CAAE;MAChC,SAAS,EAAE,IAAAI,UAAM,EAACR,gCAAK,CAACS,IAAI,EAAErB,OAAO,IAAIY,gCAAK,CAACZ,OAAO,CAAE;MACxD,KAAK,EAAE;QAAEsB,MAAM,EAAEZ,IAAI,CAACa,MAAM,GAAGN;MAAM;IAAE,IAEtCvC,SAAS,CAAC;MAAEgB,EAAE;MAAEwB;IAAe,CAAC,CAAC,CACrB;EAEnB,CAAC,CAAC,CACG;AAEX,CAAC;AAAC;AAEFzC,aAAa,CAAC+C,WAAW,GAAG,+BAA+B;AAE3D/C,aAAa,CAACgD,SAAS,GAAG,CAAC,CAAC"}
|
|
@@ -21,6 +21,7 @@ const COMPONENTS = {
|
|
|
21
21
|
// @mirai/user
|
|
22
22
|
booking: /*#__PURE__*/_react.default.lazy(() => Promise.resolve().then(() => _interopRequireWildcard(require('./user/Booking')))),
|
|
23
23
|
bookingQuery: /*#__PURE__*/_react.default.lazy(() => Promise.resolve().then(() => _interopRequireWildcard(require('./user/BookingQuery')))),
|
|
24
|
+
checkout: /*#__PURE__*/_react.default.lazy(() => Promise.resolve().then(() => _interopRequireWildcard(require('./user/Checkout')))),
|
|
24
25
|
profile: /*#__PURE__*/_react.default.lazy(() => Promise.resolve().then(() => _interopRequireWildcard(require('./user/Profile')))),
|
|
25
26
|
session: /*#__PURE__*/_react.default.lazy(() => Promise.resolve().then(() => _interopRequireWildcard(require('./user/Session')))),
|
|
26
27
|
signup: /*#__PURE__*/_react.default.lazy(() => Promise.resolve().then(() => _interopRequireWildcard(require('./user/Signup')))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["COMPONENTS","deals","React","lazy","booking","bookingQuery","profile","session","signup","environment","state","SKELETONS"],"sources":["../../src/components/index.js"],"sourcesContent":["import React from 'react';\n\nimport deals from './finder/Deals.skeleton';\nimport booking from './user/Booking.skeleton';\nimport bookingQuery from './user/BookingQuery.skeleton';\nimport profile from './user/Profile.skeleton';\nimport session from './user/Session.skeleton';\nimport signup from './user/Signup.skeleton';\n\nconst COMPONENTS = {\n // @mirai/finder\n // finder: React.lazy(() => import('./finder/Finder')),\n deals: React.lazy(() => import('./finder/Deals')),\n\n // @mirai/user\n booking: React.lazy(() => import('./user/Booking')),\n bookingQuery: React.lazy(() => import('./user/BookingQuery')),\n profile: React.lazy(() => import('./user/Profile')),\n session: React.lazy(() => import('./user/Session')),\n signup: React.lazy(() => import('./user/Signup')),\n\n // Internal\n environment: React.lazy(() => import('./__internal__/Environment')),\n state: React.lazy(() => import('./__internal__/State')),\n};\n\nconst SKELETONS = {\n // @mirai/finder\n deals,\n\n // @mirai/user\n booking,\n bookingQuery,\n profile,\n session,\n signup,\n\n // Internal\n};\n\nexport { COMPONENTS, SKELETONS };\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AAA4C;AAAA;AAAA;AAE5C,MAAMA,UAAU,GAAG;EACjB;EACA;EACAC,KAAK,eAAEC,cAAK,CAACC,IAAI,CAAC,mEAAa,gBAAgB,GAAC,CAAC;EAEjD;EACAC,OAAO,eAAEF,cAAK,CAACC,IAAI,CAAC,mEAAa,gBAAgB,GAAC,CAAC;EACnDE,YAAY,eAAEH,cAAK,CAACC,IAAI,CAAC,mEAAa,qBAAqB,GAAC,CAAC;EAC7DG,
|
|
1
|
+
{"version":3,"file":"index.js","names":["COMPONENTS","deals","React","lazy","booking","bookingQuery","checkout","profile","session","signup","environment","state","SKELETONS"],"sources":["../../src/components/index.js"],"sourcesContent":["import React from 'react';\n\nimport deals from './finder/Deals.skeleton';\nimport booking from './user/Booking.skeleton';\nimport bookingQuery from './user/BookingQuery.skeleton';\nimport profile from './user/Profile.skeleton';\nimport session from './user/Session.skeleton';\nimport signup from './user/Signup.skeleton';\n\nconst COMPONENTS = {\n // @mirai/finder\n // finder: React.lazy(() => import('./finder/Finder')),\n deals: React.lazy(() => import('./finder/Deals')),\n\n // @mirai/user\n booking: React.lazy(() => import('./user/Booking')),\n bookingQuery: React.lazy(() => import('./user/BookingQuery')),\n checkout: React.lazy(() => import('./user/Checkout')),\n profile: React.lazy(() => import('./user/Profile')),\n session: React.lazy(() => import('./user/Session')),\n signup: React.lazy(() => import('./user/Signup')),\n\n // Internal\n environment: React.lazy(() => import('./__internal__/Environment')),\n state: React.lazy(() => import('./__internal__/State')),\n};\n\nconst SKELETONS = {\n // @mirai/finder\n deals,\n\n // @mirai/user\n booking,\n bookingQuery,\n profile,\n session,\n signup,\n\n // Internal\n};\n\nexport { COMPONENTS, SKELETONS };\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AAA4C;AAAA;AAAA;AAE5C,MAAMA,UAAU,GAAG;EACjB;EACA;EACAC,KAAK,eAAEC,cAAK,CAACC,IAAI,CAAC,mEAAa,gBAAgB,GAAC,CAAC;EAEjD;EACAC,OAAO,eAAEF,cAAK,CAACC,IAAI,CAAC,mEAAa,gBAAgB,GAAC,CAAC;EACnDE,YAAY,eAAEH,cAAK,CAACC,IAAI,CAAC,mEAAa,qBAAqB,GAAC,CAAC;EAC7DG,QAAQ,eAAEJ,cAAK,CAACC,IAAI,CAAC,mEAAa,iBAAiB,GAAC,CAAC;EACrDI,OAAO,eAAEL,cAAK,CAACC,IAAI,CAAC,mEAAa,gBAAgB,GAAC,CAAC;EACnDK,OAAO,eAAEN,cAAK,CAACC,IAAI,CAAC,mEAAa,gBAAgB,GAAC,CAAC;EACnDM,MAAM,eAAEP,cAAK,CAACC,IAAI,CAAC,mEAAa,eAAe,GAAC,CAAC;EAEjD;EACAO,WAAW,eAAER,cAAK,CAACC,IAAI,CAAC,mEAAa,4BAA4B,GAAC,CAAC;EACnEQ,KAAK,eAAET,cAAK,CAACC,IAAI,CAAC,mEAAa,sBAAsB,GAAC;AACxD,CAAC;AAAC;AAEF,MAAMS,SAAS,GAAG;EAChB;EACAX,KAAK,EAALA,cAAK;EAEL;EACAG,OAAO,EAAPA,gBAAO;EACPC,YAAY,EAAZA,qBAAY;EACZE,OAAO,EAAPA,gBAAO;EACPC,OAAO,EAAPA,gBAAO;EACPC,MAAM,EAANA;;EAEA;AACF,CAAC;AAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkout.js","names":["Checkout"],"sources":["../../../src/components/user/Checkout.jsx"],"sourcesContent":["import { Checkout } from '@mirai/user';\n\nexport default Checkout;\n"],"mappings":";;;;;;AAAA;AAAuC,eAExBA,cAAQ;AAAA"}
|
package/package.json
CHANGED
package/public/index.html
CHANGED
|
@@ -30,14 +30,13 @@
|
|
|
30
30
|
<div data-mirai-component="session"></div>
|
|
31
31
|
<div data-mirai-component="session">
|
|
32
32
|
<div data-ghost>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
<p class="login">Login</p>
|
|
34
|
+
<div>
|
|
35
|
+
<p class="account">{{firstName}} - {{email}}</p>
|
|
36
|
+
</div>
|
|
37
37
|
</div>
|
|
38
38
|
</div>
|
|
39
|
-
<div data-mirai-component="bookingQuery">
|
|
40
|
-
</div>
|
|
39
|
+
<div data-mirai-component="bookingQuery"></div>
|
|
41
40
|
<div data-mirai-component="environment" data-mobile="false"></div>
|
|
42
41
|
<div data-mirai-component="state"></div>
|
|
43
42
|
</nav>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>@mirai/core</title>
|
|
7
|
+
<link rel="stylesheet" href="{url}/index.css" rel="preload" defer />
|
|
8
|
+
<link rel="stylesheet" href="{url}/site/customer.css" />
|
|
9
|
+
<link rel="stylesheet" href="{url}/site/core.css" />
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div data-mirai-id="501404" data-hotel="100376545" data-type="chain" data-locale="en-GB"></div>
|
|
13
|
+
|
|
14
|
+
<section class="checkout">
|
|
15
|
+
<div data-mirai-component="checkout"></div>
|
|
16
|
+
</section>
|
|
17
|
+
|
|
18
|
+
<script type="module" defer src="{url}/index.js"></script>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
package/site/index.html
CHANGED
|
@@ -22,8 +22,9 @@
|
|
|
22
22
|
<div data-ghost>
|
|
23
23
|
<p class="login">Login Ghost</p>
|
|
24
24
|
<p class="account">{{firstName}} - Ghost}</p>
|
|
25
|
+
</div>
|
|
25
26
|
</div>
|
|
26
|
-
|
|
27
|
+
|
|
27
28
|
<div data-mirai-component="bookingQuery"></div>
|
|
28
29
|
<div data-mirai-component="bookingQuery">
|
|
29
30
|
<button data-ghost class="book">My Booking Ghost</button>
|
|
@@ -41,10 +42,13 @@
|
|
|
41
42
|
<div data-mirai-component="deals" data-id="205800"></div>
|
|
42
43
|
</section> -->
|
|
43
44
|
<section class="links">
|
|
44
|
-
<a href="{url}/site/
|
|
45
|
+
<a href="{url}/site/signup/index.html">Signup</a>
|
|
45
46
|
<a href="{url}/site/profile/index.html">Profile</a>
|
|
46
|
-
|
|
47
|
+
<!-- -->
|
|
48
|
+
<a href="{url}/site/deals/index.html">Deals</a>
|
|
49
|
+
<!-- -->
|
|
47
50
|
<a href="{url}/site/booking/index.html">Booking</a>
|
|
51
|
+
<a href="{url}/site/checkout/index.html">Checkout</a>
|
|
48
52
|
</section>
|
|
49
53
|
|
|
50
54
|
<footer>Mirai Tech - Copyright, 2023</footer>
|