@elice/material-external 1.251120.1 → 1.260128.0-rc.0

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 (33) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +34 -35
  2. package/cjs/components/material-external/MaterialExternal.d.ts +3 -2
  3. package/cjs/components/material-external/MaterialExternal.js +33 -7
  4. package/cjs/components/material-external/MaterialExternalAdminContent.d.ts +4 -4
  5. package/cjs/components/material-external/MaterialExternalAdminContent.js +32 -36
  6. package/cjs/components/material-external/MaterialExternalContent.d.ts +2 -1
  7. package/cjs/components/material-external/MaterialExternalContent.js +13 -6
  8. package/cjs/components/material-external/MaterialExternalIframe.d.ts +9 -2
  9. package/cjs/components/material-external/MaterialExternalIframe.js +87 -4
  10. package/cjs/components/material-external/MaterialExternalNewWindow.js +46 -39
  11. package/cjs/components/material-external/MaterialExternalNotSupported.d.ts +1 -1
  12. package/cjs/components/material-external/MaterialExternalNotSupported.js +1 -2
  13. package/cjs/components/material-external/MaterialExternalRedirect.d.ts +1 -1
  14. package/cjs/components/material-external/MaterialExternalRedirect.js +11 -4
  15. package/es/_virtual/_rollupPluginBabelHelpers.js +34 -35
  16. package/es/components/material-external/MaterialExternal.d.ts +3 -2
  17. package/es/components/material-external/MaterialExternal.js +34 -9
  18. package/es/components/material-external/MaterialExternalAdminContent.d.ts +4 -4
  19. package/es/components/material-external/MaterialExternalAdminContent.js +32 -32
  20. package/es/components/material-external/MaterialExternalContent.d.ts +2 -1
  21. package/es/components/material-external/MaterialExternalContent.js +13 -6
  22. package/es/components/material-external/MaterialExternalIframe.d.ts +9 -2
  23. package/es/components/material-external/MaterialExternalIframe.js +87 -5
  24. package/es/components/material-external/MaterialExternalNewWindow.js +46 -39
  25. package/es/components/material-external/MaterialExternalNotSupported.d.ts +1 -1
  26. package/es/components/material-external/MaterialExternalNotSupported.js +1 -2
  27. package/es/components/material-external/MaterialExternalRedirect.d.ts +1 -1
  28. package/es/components/material-external/MaterialExternalRedirect.js +12 -5
  29. package/package.json +30 -20
  30. package/cjs/components/material-external/MaterialExternal.styled.d.ts +0 -2
  31. package/cjs/components/material-external/MaterialExternal.styled.js +0 -18
  32. package/es/components/material-external/MaterialExternal.styled.d.ts +0 -2
  33. package/es/components/material-external/MaterialExternal.styled.js +0 -11
@@ -4,13 +4,16 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var React = require('react');
7
- var blocks = require('@elice/blocks');
8
7
  var intl = require('@elice/intl');
8
+ var material = require('@mui/material');
9
9
 
10
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
11
 
12
12
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
13
13
 
14
+ //
15
+ //
16
+ //
14
17
  var MaterialExternalRedirect = function MaterialExternalRedirect(_ref) {
15
18
  var materialExternal = _ref.materialExternal;
16
19
  var intl$1 = intl.useRawEliceIntl();
@@ -25,9 +28,13 @@ var MaterialExternalRedirect = function MaterialExternalRedirect(_ref) {
25
28
  window.clearTimeout(timeoutId);
26
29
  };
27
30
  }, [materialExternal]);
28
- return jsxRuntime.jsxs(jsxRuntime.Fragment, {
29
- children: [jsxRuntime.jsx(blocks.Spinner, {}), jsxRuntime.jsx(blocks.Text, {
30
- role: "white",
31
+ return jsxRuntime.jsxs(material.Stack, {
32
+ gap: "0.5rem",
33
+ alignItems: "center",
34
+ children: [jsxRuntime.jsx(material.CircularProgress, {}), jsxRuntime.jsx(material.Typography, {
35
+ variant: "body2",
36
+ color: "text.secondary",
37
+ textAlign: "center",
31
38
  children: intl$1.formatMessage({
32
39
  id: 'external.loader.redirect.description'
33
40
  })
@@ -1,48 +1,47 @@
1
- function _iterableToArrayLimit(arr, i) {
2
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
3
- if (null != _i) {
4
- var _s,
5
- _e,
6
- _x,
7
- _r,
8
- _arr = [],
9
- _n = !0,
10
- _d = !1;
1
+ function _arrayLikeToArray(r, a) {
2
+ (null == a || a > r.length) && (a = r.length);
3
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
4
+ return n;
5
+ }
6
+ function _arrayWithHoles(r) {
7
+ if (Array.isArray(r)) return r;
8
+ }
9
+ function _iterableToArrayLimit(r, l) {
10
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
11
+ if (null != t) {
12
+ var e,
13
+ n,
14
+ i,
15
+ u,
16
+ a = [],
17
+ f = true,
18
+ o = false;
11
19
  try {
12
- if (_x = (_i = _i.call(arr)).next, 0 === i) ; else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
13
- } catch (err) {
14
- _d = !0, _e = err;
20
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
21
+ } catch (r) {
22
+ o = true, n = r;
15
23
  } finally {
16
24
  try {
17
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
25
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
18
26
  } finally {
19
- if (_d) throw _e;
27
+ if (o) throw n;
20
28
  }
21
29
  }
22
- return _arr;
30
+ return a;
23
31
  }
24
32
  }
25
- function _slicedToArray(arr, i) {
26
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
27
- }
28
- function _arrayWithHoles(arr) {
29
- if (Array.isArray(arr)) return arr;
30
- }
31
- function _unsupportedIterableToArray(o, minLen) {
32
- if (!o) return;
33
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
34
- var n = Object.prototype.toString.call(o).slice(8, -1);
35
- if (n === "Object" && o.constructor) n = o.constructor.name;
36
- if (n === "Map" || n === "Set") return Array.from(o);
37
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
38
- }
39
- function _arrayLikeToArray(arr, len) {
40
- if (len == null || len > arr.length) len = arr.length;
41
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
42
- return arr2;
43
- }
44
33
  function _nonIterableRest() {
45
34
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
46
35
  }
36
+ function _slicedToArray(r, e) {
37
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
38
+ }
39
+ function _unsupportedIterableToArray(r, a) {
40
+ if (r) {
41
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
42
+ var t = {}.toString.call(r).slice(8, -1);
43
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
44
+ }
45
+ }
47
46
 
48
47
  export { _arrayLikeToArray as arrayLikeToArray, _arrayWithHoles as arrayWithHoles, _iterableToArrayLimit as iterableToArrayLimit, _nonIterableRest as nonIterableRest, _slicedToArray as slicedToArray, _unsupportedIterableToArray as unsupportedIterableToArray };
@@ -1,6 +1,7 @@
1
- import React from 'react';
2
1
  import type { WithIntlComponentBuilderProps } from '@elice/intl';
3
- export interface MaterialExternalProps {
2
+ import type React from 'react';
3
+ import type { MaterialExternalIframeSDKCommunicationProps } from './MaterialExternalIframe';
4
+ export interface MaterialExternalProps extends MaterialExternalIframeSDKCommunicationProps {
4
5
  className?: string;
5
6
  materialExternalId: number;
6
7
  /** metadata logging */
@@ -1,34 +1,59 @@
1
+ import _styled from '@emotion/styled/base';
1
2
  import { jsx } from 'react/jsx-runtime';
2
3
  import { IntlComponentBuilder, RawEliceIntlProvider } from '@elice/intl';
3
4
  import classnames from 'classnames';
5
+ import MaterialExternalAdminContent from './MaterialExternalAdminContent.js';
6
+ import MaterialExternalContent from './MaterialExternalContent.js';
4
7
  import messageEn from './locales/en.json.js';
5
8
  import messageKo from './locales/ko.json.js';
6
- import MaterialExternalContent from './MaterialExternalAdminContent.js';
7
- import MaterialExternalContent$1 from './MaterialExternalContent.js';
8
- import { StyledExternalWrap } from './MaterialExternal.styled.js';
9
9
 
10
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
11
+ //
12
+ //
13
+ //
14
+ var ExternalContainer = /*#__PURE__*/_styled("div", {
15
+ target: "edzebp10"
16
+ })("production" === "production" ? {
17
+ name: "1b2cl51",
18
+ styles: "display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;background-color:#fff"
19
+ } : {
20
+ name: "1b2cl51",
21
+ styles: "display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;background-color:#fff",
22
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
23
+ });
24
+ //
25
+ //
26
+ //
10
27
  var MaterialExternal = function MaterialExternal(_ref) {
11
28
  var materialExternalId = _ref.materialExternalId,
12
29
  userId = _ref.userId,
13
30
  className = _ref.className,
14
31
  courseId = _ref.courseId,
32
+ hasNextLecturePage = _ref.hasNextLecturePage,
33
+ hasPreviousLecturePage = _ref.hasPreviousLecturePage,
34
+ onNavigateNextLecturePage = _ref.onNavigateNextLecturePage,
35
+ onNavigatePreviousLecturePage = _ref.onNavigatePreviousLecturePage,
15
36
  __intl = _ref.__intl;
16
37
  var prefixCls = 'em-material-external';
17
38
  return jsx(RawEliceIntlProvider, {
18
39
  value: __intl,
19
- children: jsx(StyledExternalWrap, {
40
+ children: jsx(ExternalContainer, {
20
41
  className: classnames(prefixCls, className),
21
- children: userId ? jsx(MaterialExternalContent, {
42
+ children: userId ? jsx(MaterialExternalAdminContent, {
22
43
  materialExternalId: materialExternalId,
23
44
  courseId: courseId,
24
45
  userId: userId
25
- }) : jsx(MaterialExternalContent$1, {
46
+ }) : jsx(MaterialExternalContent, {
26
47
  materialExternalId: materialExternalId,
27
- courseId: courseId
48
+ courseId: courseId,
49
+ hasNextLecturePage: hasNextLecturePage,
50
+ hasPreviousLecturePage: hasPreviousLecturePage,
51
+ onNavigateNextLecturePage: onNavigateNextLecturePage,
52
+ onNavigatePreviousLecturePage: onNavigatePreviousLecturePage
28
53
  })
29
54
  })
30
55
  });
31
56
  };
32
- var MaterialExternal$1 = new IntlComponentBuilder(MaterialExternal).add('en', messageEn).add('ko', messageKo).addAsync('th', import('./locales/th.json.js')).addAsync('ja', import('./locales/ja.json.js')).build();
57
+ var MaterialExternal_default = new IntlComponentBuilder(MaterialExternal).add('en', messageEn).add('ko', messageKo).addAsync('th', import('./locales/th.json.js')).addAsync('ja', import('./locales/ja.json.js')).build();
33
58
 
34
- export { MaterialExternal$1 as default };
59
+ export { MaterialExternal_default as default };
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- export interface MaterialExternalContentProps {
1
+ import type React from 'react';
2
+ export interface MaterialExternalAdminContentProps {
3
3
  materialExternalId: number;
4
4
  userId: number;
5
5
  courseId?: number;
6
6
  }
7
- declare const MaterialExternalContent: React.FC<MaterialExternalContentProps>;
8
- export default MaterialExternalContent;
7
+ declare const MaterialExternalAdminContent: React.FC<MaterialExternalAdminContentProps>;
8
+ export default MaterialExternalAdminContent;
@@ -1,44 +1,44 @@
1
- import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
1
  import { jsx } from 'react/jsx-runtime';
3
- import React from 'react';
4
2
  import { getOrgMaterialExternalTutorExternalUrlGet } from '@elice/api-client';
5
- import { Spinner, Text } from '@elice/blocks';
6
3
  import { useRawEliceIntl } from '@elice/intl';
4
+ import { CircularProgress, Typography } from '@mui/material';
5
+ import { useQuery } from '@tanstack/react-query';
7
6
  import MaterialExternalIframe from './MaterialExternalIframe.js';
8
7
 
9
- var MaterialExternalContent = function MaterialExternalContent(_ref) {
8
+ //
9
+ //
10
+ //
11
+ var MaterialExternalAdminContent = function MaterialExternalAdminContent(_ref) {
10
12
  var materialExternalId = _ref.materialExternalId,
11
13
  userId = _ref.userId,
12
14
  courseId = _ref.courseId;
13
15
  var intl = useRawEliceIntl();
14
- var _React$useState = React.useState(''),
15
- _React$useState2 = _slicedToArray(_React$useState, 2),
16
- externalUrl = _React$useState2[0],
17
- setExternalUrl = _React$useState2[1];
18
- var _React$useState3 = React.useState('idle'),
19
- _React$useState4 = _slicedToArray(_React$useState3, 2),
20
- externalGetStatus = _React$useState4[0],
21
- setExternalGetStatus = _React$useState4[1];
22
- React.useEffect(function () {
23
- if (materialExternalId && userId) {
24
- setExternalGetStatus('pending');
25
- getOrgMaterialExternalTutorExternalUrlGet({
26
- materialExternalId: materialExternalId,
27
- userId: userId
28
- }).then(function (value) {
29
- setExternalUrl(value.externalUrl);
30
- setExternalGetStatus('resolved');
31
- }).catch(function () {
32
- return setExternalGetStatus('rejected');
33
- });
34
- }
35
- }, [materialExternalId, userId]);
36
- if (externalGetStatus === 'pending') {
37
- return jsx(Spinner, {});
16
+ var _useQuery = useQuery({
17
+ queryKey: ['materialExternalAdminContent', materialExternalId, userId],
18
+ queryFn: function queryFn(_ref2) {
19
+ var signal = _ref2.signal;
20
+ return getOrgMaterialExternalTutorExternalUrlGet({
21
+ materialExternalId: materialExternalId,
22
+ userId: userId
23
+ }, {
24
+ signal: signal
25
+ });
26
+ },
27
+ select: function select(data) {
28
+ return data.externalUrl;
29
+ }
30
+ }),
31
+ externalUrl = _useQuery.data,
32
+ isLoading = _useQuery.isLoading,
33
+ isError = _useQuery.isError;
34
+ //
35
+ //
36
+ //
37
+ if (isLoading) {
38
+ return jsx(CircularProgress, {});
38
39
  }
39
- if (externalGetStatus === 'rejected' || !externalUrl) {
40
- return jsx(Text, {
41
- role: "white",
40
+ if (isError || !externalUrl) {
41
+ return jsx(Typography, {
42
42
  children: intl.formatMessage({
43
43
  id: 'external.status.rejected'
44
44
  })
@@ -54,4 +54,4 @@ var MaterialExternalContent = function MaterialExternalContent(_ref) {
54
54
  });
55
55
  };
56
56
 
57
- export { MaterialExternalContent as default };
57
+ export { MaterialExternalAdminContent as default };
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- export interface MaterialExternalContentProps {
2
+ import type { MaterialExternalIframeSDKCommunicationProps } from './MaterialExternalIframe';
3
+ export interface MaterialExternalContentProps extends MaterialExternalIframeSDKCommunicationProps {
3
4
  materialExternalId: number;
4
5
  courseId?: number;
5
6
  }
@@ -1,10 +1,10 @@
1
1
  import { jsx, Fragment } from 'react/jsx-runtime';
2
2
  import React from 'react';
3
3
  import { getOrgMaterialExternalGet, config } from '@elice/api-client';
4
- import { Text, Spinner } from '@elice/blocks';
5
4
  import { useRawEliceIntl } from '@elice/intl';
6
5
  import { useMaterialFetch } from '@elice/material-shared-utils';
7
6
  import { enums } from '@elice/types';
7
+ import { Typography, CircularProgress } from '@mui/material';
8
8
  import MaterialExternalIframe from './MaterialExternalIframe.js';
9
9
  import MaterialExternalNewWindow from './MaterialExternalNewWindow.js';
10
10
  import MaterialExternalNotSupported from './MaterialExternalNotSupported.js';
@@ -19,7 +19,11 @@ var LEGACY_RUNBOX_V2_URL_PATTERN = /^https?:\/\/api-runbox\.elice\.io/;
19
19
  //
20
20
  var MaterialExternalContent = function MaterialExternalContent(_ref) {
21
21
  var materialExternalId = _ref.materialExternalId,
22
- courseId = _ref.courseId;
22
+ courseId = _ref.courseId,
23
+ hasNextLecturePage = _ref.hasNextLecturePage,
24
+ hasPreviousLecturePage = _ref.hasPreviousLecturePage,
25
+ onNavigateNextLecturePage = _ref.onNavigateNextLecturePage,
26
+ onNavigatePreviousLecturePage = _ref.onNavigatePreviousLecturePage;
23
27
  var intl = useRawEliceIntl();
24
28
  var _useMaterialFetch = useMaterialFetch(enums.LectureMaterialType.External, React.useCallback(function (signal) {
25
29
  return getOrgMaterialExternalGet({
@@ -31,15 +35,14 @@ var MaterialExternalContent = function MaterialExternalContent(_ref) {
31
35
  materialExternal = _useMaterialFetch.materialExternal,
32
36
  externalGetStatus = _useMaterialFetch.status;
33
37
  if (externalGetStatus === 'rejected') {
34
- return jsx(Text, {
35
- role: "white",
38
+ return jsx(Typography, {
36
39
  children: intl.formatMessage({
37
40
  id: 'external.status.rejected'
38
41
  })
39
42
  });
40
43
  }
41
44
  if (externalGetStatus === 'pending' || !materialExternal) {
42
- return jsx(Spinner, {});
45
+ return jsx(CircularProgress, {});
43
46
  }
44
47
  /**
45
48
  *
@@ -49,7 +52,11 @@ var MaterialExternalContent = function MaterialExternalContent(_ref) {
49
52
  case enums.MaterialExternalDisplayType.Iframe:
50
53
  return jsx(MaterialExternalIframe, {
51
54
  materialExternal: materialExternal,
52
- courseId: courseId
55
+ courseId: courseId,
56
+ hasNextLecturePage: hasNextLecturePage,
57
+ hasPreviousLecturePage: hasPreviousLecturePage,
58
+ onNavigateNextLecturePage: onNavigateNextLecturePage,
59
+ onNavigatePreviousLecturePage: onNavigatePreviousLecturePage
53
60
  });
54
61
  case enums.MaterialExternalDisplayType.Redirect:
55
62
  return jsx(MaterialExternalRedirect, {
@@ -1,7 +1,14 @@
1
1
  import React from 'react';
2
2
  import type { GetOrgMaterialExternalGetResponses } from '@elice/types/es/typings/apis/orgMaterialExternal';
3
- declare const MaterialExternalIframe: React.FC<{
3
+ export interface MaterialExternalIframeSDKCommunicationProps {
4
+ hasPreviousLecturePage?: boolean;
5
+ hasNextLecturePage?: boolean;
6
+ onNavigatePreviousLecturePage?: () => void;
7
+ onNavigateNextLecturePage?: () => void;
8
+ }
9
+ export interface MaterialExternalIframeProps extends MaterialExternalIframeSDKCommunicationProps {
4
10
  materialExternal: Pick<GetOrgMaterialExternalGetResponses['materialExternal'], 'title' | 'externalUrl' | 'id'>;
5
11
  courseId?: number;
6
- }>;
12
+ }
13
+ declare const MaterialExternalIframe: React.FC<MaterialExternalIframeProps>;
7
14
  export default MaterialExternalIframe;
@@ -1,12 +1,45 @@
1
+ import _styled from '@emotion/styled/base';
1
2
  import { jsx } from 'react/jsx-runtime';
2
- import React from 'react';
3
+ import React, { useRef } from 'react';
3
4
  import { useRawEliceIntl } from '@elice/intl';
4
- import { StyledExternalDisplay } from './MaterialExternal.styled.js';
5
5
 
6
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
7
+ //
8
+ //
9
+ //
10
+ var ExternalIframe = /*#__PURE__*/_styled("iframe", {
11
+ target: "e1bq11yf0"
12
+ })("production" === "production" ? {
13
+ name: "1nxwo53",
14
+ styles: "width:100%;height:100%;border:0;background-color:#fff"
15
+ } : {
16
+ name: "1nxwo53",
17
+ styles: "width:100%;height:100%;border:0;background-color:#fff",
18
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
+ });
20
+ //
21
+ //
22
+ //
6
23
  var MaterialExternalIframe = function MaterialExternalIframe(_ref) {
7
24
  var materialExternal = _ref.materialExternal,
8
- courseId = _ref.courseId;
25
+ courseId = _ref.courseId,
26
+ _hasNextLecturePage = _ref.hasNextLecturePage,
27
+ _hasPreviousLecturePage = _ref.hasPreviousLecturePage,
28
+ _onNavigateNextLecturePage = _ref.onNavigateNextLecturePage,
29
+ _onNavigatePreviousLecturePage = _ref.onNavigatePreviousLecturePage;
9
30
  var intl = useRawEliceIntl();
31
+ var iframeRef = React.useRef(null);
32
+ var hasPreviousLecturePage = useRef(_hasPreviousLecturePage);
33
+ hasPreviousLecturePage.current = _hasPreviousLecturePage;
34
+ var hasNextLecturePage = useRef(_hasNextLecturePage);
35
+ hasNextLecturePage.current = _hasNextLecturePage;
36
+ var onNavigatePreviousLecturePage = useRef(_onNavigatePreviousLecturePage);
37
+ onNavigatePreviousLecturePage.current = _onNavigatePreviousLecturePage;
38
+ var onNavigateNextLecturePage = useRef(_onNavigateNextLecturePage);
39
+ onNavigateNextLecturePage.current = _onNavigateNextLecturePage;
40
+ /**
41
+ * Material external URL.
42
+ */
10
43
  var materialExternalUrl = React.useMemo(function () {
11
44
  var externalUrl = new URL(materialExternal.externalUrl);
12
45
  externalUrl.searchParams.append('course_id', String(courseId !== null && courseId !== void 0 ? courseId : ''));
@@ -15,10 +48,59 @@ var MaterialExternalIframe = function MaterialExternalIframe(_ref) {
15
48
  externalUrl.searchParams.append('locale', intl.locale);
16
49
  return externalUrl.href;
17
50
  }, [materialExternal.externalUrl, materialExternal.id, courseId, intl.locale]);
18
- return jsx(StyledExternalDisplay, {
51
+ //
52
+ //
53
+ //
54
+ React.useEffect(function () {
55
+ var iframeEl = iframeRef.current;
56
+ if (!iframeEl) {
57
+ return;
58
+ }
59
+ var __handle = function __handle(e) {
60
+ var _a, _b, _c;
61
+ if (e.data.from === 'eliceio-contents-sdk') {
62
+ switch (e.data.type) {
63
+ // navigation - prev
64
+ case 'navigate-prev':
65
+ {
66
+ (_a = onNavigatePreviousLecturePage.current) === null || _a === void 0 ? void 0 : _a.call(onNavigatePreviousLecturePage);
67
+ break;
68
+ }
69
+ // navigation - next
70
+ case 'navigate-next':
71
+ {
72
+ (_b = onNavigateNextLecturePage.current) === null || _b === void 0 ? void 0 : _b.call(onNavigateNextLecturePage);
73
+ break;
74
+ }
75
+ // navigation - state-sync
76
+ case 'navigate-state-sync':
77
+ {
78
+ (_c = iframeEl.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage(Object.assign(Object.assign({}, e.data), {
79
+ from: 'elice-web',
80
+ type: 'navigate-state-sync',
81
+ payload: {
82
+ hasNextLecturePage: hasNextLecturePage.current,
83
+ hasPreviousLecturePage: hasPreviousLecturePage.current
84
+ }
85
+ }), '*');
86
+ break;
87
+ }
88
+ }
89
+ }
90
+ };
91
+ window.addEventListener('message', __handle);
92
+ return function () {
93
+ window.removeEventListener('message', __handle);
94
+ };
95
+ }, []);
96
+ //
97
+ //
98
+ //
99
+ return jsx(ExternalIframe, {
19
100
  title: materialExternal.title,
20
101
  src: materialExternalUrl,
21
- allow: "clipboard-read; clipboard-write; camera *; microphone *; bluetooth *; fullscreen;"
102
+ allow: "clipboard-read; clipboard-write; camera *; microphone *; bluetooth *; fullscreen;",
103
+ ref: iframeRef
22
104
  });
23
105
  };
24
106
 
@@ -1,11 +1,13 @@
1
1
  import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import React, { useState } from 'react';
4
- import { SafeImage, Vspace, Text, Button, Spinner } from '@elice/blocks';
5
- import { base } from '@elice/design-tokens';
6
4
  import { useRawEliceIntl } from '@elice/intl';
5
+ import { Stack, Box, Typography, Button, CircularProgress } from '@mui/material';
7
6
  import img from '../../assets/calendar.png.js';
8
7
 
8
+ //
9
+ //
10
+ //
9
11
  var MaterialExternalNewWindow = function MaterialExternalNewWindow(_ref) {
10
12
  var materialExternal = _ref.materialExternal;
11
13
  var intl = useRawEliceIntl();
@@ -28,53 +30,58 @@ var MaterialExternalNewWindow = function MaterialExternalNewWindow(_ref) {
28
30
  /**
29
31
  *
30
32
  */
31
- var newTabReOpenContentPage = jsxs(Fragment, {
32
- children: [jsx(SafeImage, {
33
- src: img,
34
- width: "8rem",
35
- height: "6rem",
36
- alt: "newWindow"
37
- }), jsx(Vspace, {
38
- height: 1
39
- }), jsx(Text, {
40
- role: "white",
41
- size: "large",
42
- bold: true,
43
- children: intl.formatMessage({
44
- id: 'external.newWindow.title'
45
- })
46
- }), jsx(Vspace, {
47
- height: 0.75
48
- }), jsx(Text, {
49
- role: "white",
50
- size: "small",
51
- children: intl.formatMessage({
52
- id: 'external.newWindow.description'
53
- })
54
- }), jsx(Vspace, {
55
- height: 2
33
+ var newTabReOpenContentPage = jsxs(Stack, {
34
+ gap: "2rem",
35
+ alignItems: "center",
36
+ children: [jsxs(Stack, {
37
+ gap: "1rem",
38
+ alignItems: "center",
39
+ children: [jsx(Box, {
40
+ component: "img",
41
+ src: img,
42
+ alt: "newWindow",
43
+ sx: {
44
+ width: '8rem',
45
+ height: '6rem'
46
+ }
47
+ }), jsxs(Stack, {
48
+ gap: "0.25rem",
49
+ alignItems: "center",
50
+ children: [jsx(Typography, {
51
+ variant: "h6",
52
+ color: "text.primary",
53
+ textAlign: "center",
54
+ children: intl.formatMessage({
55
+ id: 'external.newWindow.title'
56
+ })
57
+ }), jsx(Typography, {
58
+ variant: "body2",
59
+ color: "text.secondary",
60
+ textAlign: "center",
61
+ children: intl.formatMessage({
62
+ id: 'external.newWindow.description'
63
+ })
64
+ })]
65
+ })]
56
66
  }), jsx(Button, {
57
67
  size: "small",
58
68
  onClick: function onClick() {
59
69
  return window.open(materialExternal === null || materialExternal === void 0 ? void 0 : materialExternal.externalUrl);
60
70
  },
61
- children: jsx(Text, {
62
- size: "small",
63
- customStyles: {
64
- color: base.color.navy0
65
- },
66
- children: intl.formatMessage({
67
- id: 'external.newWindow.button.label'
68
- })
71
+ children: intl.formatMessage({
72
+ id: 'external.newWindow.button.label'
69
73
  })
70
74
  })]
71
75
  });
72
76
  /**
73
77
  * Open new tab external page after 5 seconds.
74
78
  */
75
- var waitExternalPage = jsxs(Fragment, {
76
- children: [jsx(Spinner, {}), jsx(Text, {
77
- role: "white",
79
+ var waitExternalPage = jsxs(Stack, {
80
+ gap: "0.5rem",
81
+ alignItems: "center",
82
+ children: [jsx(CircularProgress, {}), jsx(Typography, {
83
+ variant: "body2",
84
+ color: "text.secondary",
78
85
  children: intl.formatMessage({
79
86
  id: 'external.loader.newWindow.description'
80
87
  })
@@ -1,3 +1,3 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  declare const MaterialExternalNotSupported: React.FC;
3
3
  export default MaterialExternalNotSupported;
@@ -1,5 +1,4 @@
1
1
  import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { base } from '@elice/design-tokens';
3
2
  import { useRawEliceIntl } from '@elice/intl';
4
3
  import { Stack, Box, Typography } from '@mui/material';
5
4
  import img from '../../assets/empty-default.png.js';
@@ -18,7 +17,7 @@ var MaterialExternalNotSupported = function MaterialExternalNotSupported() {
18
17
  justifyContent: "center",
19
18
  alignItems: "center",
20
19
  padding: "2rem",
21
- bgcolor: base.color.navy9,
20
+ bgcolor: "#fff",
22
21
  gap: "2rem",
23
22
  width: "100%",
24
23
  height: "100%",
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import type { GetOrgMaterialExternalGetResponses } from '@elice/types/es/typings/apis/orgMaterialExternal';
2
+ import type { GetOrgMaterialExternalGetResponses } from '@elice/types';
3
3
  declare const MaterialExternalRedirect: React.FC<GetOrgMaterialExternalGetResponses>;
4
4
  export default MaterialExternalRedirect;