@elice/material-runbox 1.230418.1 → 1.230418.2

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 (29) hide show
  1. package/cjs/components/material-runbox/MaterialRunbox.d.ts +2 -6
  2. package/cjs/components/material-runbox/MaterialRunbox.js +18 -130
  3. package/cjs/components/material-runbox/MaterialRunboxContent.d.ts +9 -0
  4. package/cjs/components/material-runbox/MaterialRunboxContent.js +153 -0
  5. package/cjs/components/material-runbox/MaterialRunboxHeader.js +8 -4
  6. package/cjs/components/material-runbox/context.d.ts +4 -2
  7. package/cjs/components/material-runbox/hooks/useRunboxControl.js +1 -1
  8. package/cjs/components/material-runbox/locales/en.json.js +7 -0
  9. package/cjs/components/material-runbox/locales/index.d.ts +2 -0
  10. package/cjs/components/material-runbox/locales/index.js +11 -0
  11. package/cjs/components/material-runbox/locales/ko.json.js +7 -0
  12. package/cjs/components/material-runbox/runtime/RuntimeOverlayAssigned.js +1 -1
  13. package/cjs/components/material-runbox/runtime/RuntimeOverlayQueued.js +5 -5
  14. package/cjs/components/material-runbox/runtime/RuntimeOverlayTerminated.js +10 -10
  15. package/es/components/material-runbox/MaterialRunbox.d.ts +2 -6
  16. package/es/components/material-runbox/MaterialRunbox.js +19 -130
  17. package/es/components/material-runbox/MaterialRunboxContent.d.ts +9 -0
  18. package/es/components/material-runbox/MaterialRunboxContent.js +144 -0
  19. package/es/components/material-runbox/MaterialRunboxHeader.js +9 -5
  20. package/es/components/material-runbox/context.d.ts +4 -2
  21. package/es/components/material-runbox/hooks/useRunboxControl.js +1 -1
  22. package/es/components/material-runbox/locales/en.json.js +3 -0
  23. package/es/components/material-runbox/locales/index.d.ts +2 -0
  24. package/es/components/material-runbox/locales/index.js +2 -0
  25. package/es/components/material-runbox/locales/ko.json.js +3 -0
  26. package/es/components/material-runbox/runtime/RuntimeOverlayAssigned.js +1 -1
  27. package/es/components/material-runbox/runtime/RuntimeOverlayQueued.js +5 -5
  28. package/es/components/material-runbox/runtime/RuntimeOverlayTerminated.js +10 -10
  29. package/package.json +4 -4
@@ -1,11 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { MaterialRunboxContextExternalValue } from './context';
3
3
  import type { UseMaterialRunboxApiProps } from './hooks';
4
- export interface MaterialRunboxProps extends MaterialRunboxContextExternalValue, UseMaterialRunboxApiProps {
5
- /** Runbox ID. */
6
- runboxId: string | null;
7
- /** Course ID. */
8
- courseId: number;
9
- }
4
+ import type { MaterialRunboxContentProps } from './MaterialRunboxContent';
5
+ export declare type MaterialRunboxProps = MaterialRunboxContentProps & MaterialRunboxContextExternalValue & UseMaterialRunboxApiProps;
10
6
  declare const MaterialRunbox: React.FC<MaterialRunboxProps>;
11
7
  export default MaterialRunbox;
@@ -2,161 +2,49 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
5
+ var tslib = require('tslib');
6
6
  var React = require('react');
7
7
  var reactIntl = require('react-intl');
8
- var blocks = require('@elice/blocks');
9
- var runboxClient = require('@elice/runbox-client');
10
- var styled = require('@emotion/styled');
11
- var iconsMaterial = require('@mui/icons-material');
12
- var material = require('@mui/material');
13
- var reactQuery = require('@tanstack/react-query');
14
8
  var context = require('./context.js');
15
9
  var useMaterialRunboxApi = require('./hooks/useMaterialRunboxApi.js');
10
+ require('@elice/runbox-client');
16
11
  require('notistack');
17
- var MaterialRunboxBody = require('./MaterialRunboxBody.js');
18
- var MaterialRunboxFooter = require('./MaterialRunboxFooter.js');
19
- var MaterialRunboxHeader = require('./MaterialRunboxHeader.js');
12
+ var index = require('./locales/index.js');
13
+ var MaterialRunboxContent = require('./MaterialRunboxContent.js');
14
+ var en = require('./locales/en.json.js');
20
15
 
21
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
22
17
 
23
18
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
24
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
25
19
 
26
- var _templateObject;
27
20
  //
28
21
  //
29
22
  //
30
- var DEFAULT_DATA = [null, null, null];
31
- //
32
- //
33
- //
34
- var StyledRunboxContainer = styled__default["default"].div(_templateObject || (_templateObject = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n"])));
35
- //
36
- //
37
- //
38
- var MaterialRunbox = function MaterialRunbox(_ref) {
39
- var runboxId = _ref.runboxId,
40
- courseId = _ref.courseId,
41
- locale = _ref.locale,
42
- showMessenger = _ref.showMessenger,
43
- eliceMaterialRunboxApiConfiguration = _ref.eliceMaterialRunboxApiConfiguration;
23
+ var MaterialRunbox = function MaterialRunbox(_a) {
24
+ var _a$enableAutoShutdown = _a.enableAutoShutdownToggle,
25
+ enableAutoShutdownToggle = _a$enableAutoShutdown === void 0 ? false : _a$enableAutoShutdown,
26
+ _a$locale = _a.locale,
27
+ locale = _a$locale === void 0 ? 'ko' : _a$locale,
28
+ showMessenger = _a.showMessenger,
29
+ eliceMaterialRunboxApiConfiguration = _a.eliceMaterialRunboxApiConfiguration,
30
+ materialRunboxProps = tslib.__rest(_a, ["enableAutoShutdownToggle", "locale", "showMessenger", "eliceMaterialRunboxApiConfiguration"]);
44
31
  var apis = useMaterialRunboxApi.useMaterialRunboxApi({
45
32
  eliceMaterialRunboxApiConfiguration: eliceMaterialRunboxApiConfiguration
46
33
  });
47
34
  //
48
35
  //
49
36
  //
50
- var _useQuery = reactQuery.useQuery({
51
- enabled: Boolean(runboxId),
52
- queryKey: ['eliceMaterialRunboxRunboxApi.runboxRunboxIdGet', 'eliceMaterialRunboxRuntimeTemplateApi.runtimeTemplateRuntimeTemplateIdGet', runboxId, courseId],
53
- queryFn: function queryFn(_ref2) {
54
- var signal = _ref2.signal;
55
- return apis.materialRunboxApi.runbox.runboxRunboxIdGet({
56
- runboxId: runboxId,
57
- eliceCourseId: courseId
58
- }, {
59
- signal: signal
60
- }).then(function (runbox) {
61
- return Promise.all([
62
- // runbox
63
- runbox,
64
- // runtime
65
- apis.materialRunboxApi.runtime.runtimeGet({
66
- filterImageId: runbox.imageId,
67
- filterRuntimeTemplateId: runbox.runtimeTemplateId,
68
- skip: 0,
69
- count: 1,
70
- eliceCourseId: courseId
71
- }, {
72
- signal: signal
73
- }).then(function (runtimes) {
74
- var _a;
75
- return (_a = runtimes[0]) !== null && _a !== void 0 ? _a : null;
76
- }),
77
- // runtimeTemplate
78
- apis.materialRunboxApi.runtimeTemplate.runtimeTemplateRuntimeTemplateIdGet({
79
- runtimeTemplateId: runbox.runtimeTemplateId,
80
- eliceCourseId: courseId
81
- }, {
82
- signal: signal
83
- })]);
84
- });
85
- },
86
- cacheTime: 0,
87
- keepPreviousData: true,
88
- refetchOnWindowFocus: false
89
- }),
90
- _useQuery$data = _useQuery.data,
91
- _useQuery$data2 = _useQuery$data === void 0 ? DEFAULT_DATA : _useQuery$data,
92
- _useQuery$data3 = _rollupPluginBabelHelpers.slicedToArray(_useQuery$data2, 3),
93
- runbox = _useQuery$data3[0],
94
- runtime = _useQuery$data3[1],
95
- runtimeTemplate = _useQuery$data3[2],
96
- isInitialLoading = _useQuery.isInitialLoading,
97
- isError = _useQuery.isError,
98
- refetch = _useQuery.refetch;
99
- //
100
- //
101
- //
102
- if (isInitialLoading) {
103
- return React__default["default"].createElement(StyledRunboxContainer, null, React__default["default"].createElement(blocks.Spinner, null));
104
- }
105
- if (isError) {
106
- return React__default["default"].createElement(StyledRunboxContainer, null, React__default["default"].createElement(material.Stack, {
107
- gap: "1.5rem"
108
- }, React__default["default"].createElement(material.Typography, {
109
- variant: "h6"
110
- }, React__default["default"].createElement(reactIntl.FormattedMessage, {
111
- id: "material.runbox.runtime.message.startError"
112
- })), React__default["default"].createElement(material.Stack, {
113
- gap: "0.5rem"
114
- }, React__default["default"].createElement(material.Button, {
115
- startIcon: React__default["default"].createElement(iconsMaterial.Refresh, null),
116
- onClick: function onClick() {
117
- return refetch();
118
- }
119
- }, React__default["default"].createElement(reactIntl.FormattedMessage, {
120
- id: "common.retry"
121
- })), React__default["default"].createElement(material.Button, {
122
- variant: "outlined",
123
- onClick: function onClick() {
124
- return showMessenger();
125
- }
126
- }, React__default["default"].createElement(reactIntl.FormattedMessage, {
127
- id: "common.support"
128
- })))));
129
- }
130
- if (!runbox || !runtimeTemplate) {
131
- return null;
132
- }
133
- var props = {
134
- runbox: runbox,
135
- runtime: runtime,
136
- runtimeTemplate: runtimeTemplate,
137
- courseId: courseId,
138
- refetch: refetch
139
- };
140
37
  return React__default["default"].createElement(context.MaterialRunboxContext.Provider, {
141
38
  value: Object.assign({
39
+ enableAutoShutdownToggle: enableAutoShutdownToggle,
142
40
  locale: locale,
143
41
  showMessenger: showMessenger
144
42
  }, apis)
145
- }, React__default["default"].createElement(runboxClient.EliceRunboxProvider, {
146
- runboxId: runbox.id,
147
- runboxApiHeartbeat: function runboxApiHeartbeat(_ref3) {
148
- var id = _ref3.id,
149
- signal = _ref3.signal;
150
- return apis.materialRunboxApi.runbox.runboxRunboxIdHeartbeatPost({
151
- runboxId: id,
152
- eliceCourseId: courseId
153
- }, {
154
- signal: signal
155
- });
156
- },
43
+ }, React__default["default"].createElement(reactIntl.IntlProvider, {
157
44
  locale: locale,
158
- onRunboxRefetchRequest: refetch
159
- }, React__default["default"].createElement(StyledRunboxContainer, null, React__default["default"].createElement(MaterialRunboxHeader["default"], Object.assign({}, props)), React__default["default"].createElement(MaterialRunboxBody["default"], Object.assign({}, props)), React__default["default"].createElement(MaterialRunboxFooter["default"], Object.assign({}, props)))));
45
+ defaultLocale: "en",
46
+ messages: locale in index ? index[locale] : en["default"]
47
+ }, React__default["default"].createElement(MaterialRunboxContent["default"], Object.assign({}, materialRunboxProps))));
160
48
  };
161
49
 
162
50
  exports["default"] = MaterialRunbox;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export interface MaterialRunboxContentProps {
3
+ /** Runbox ID. */
4
+ runboxId: string | null;
5
+ /** Course ID. */
6
+ courseId: number;
7
+ }
8
+ declare const MaterialRunboxContent: React.FC<MaterialRunboxContentProps>;
9
+ export default MaterialRunboxContent;
@@ -0,0 +1,153 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
6
+ var React = require('react');
7
+ var reactIntl = require('react-intl');
8
+ var blocks = require('@elice/blocks');
9
+ var runboxClient = require('@elice/runbox-client');
10
+ var styled = require('@emotion/styled');
11
+ var iconsMaterial = require('@mui/icons-material');
12
+ var material = require('@mui/material');
13
+ var reactQuery = require('@tanstack/react-query');
14
+ var context = require('./context.js');
15
+ var MaterialRunboxBody = require('./MaterialRunboxBody.js');
16
+ var MaterialRunboxFooter = require('./MaterialRunboxFooter.js');
17
+ var MaterialRunboxHeader = require('./MaterialRunboxHeader.js');
18
+
19
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
+
21
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
+ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
23
+
24
+ var _templateObject;
25
+ //
26
+ //
27
+ //
28
+ var DEFAULT_DATA = [null, null, null];
29
+ //
30
+ //
31
+ //
32
+ var StyledRunboxContainer = styled__default["default"].div(_templateObject || (_templateObject = _rollupPluginBabelHelpers.taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n"])));
33
+ //
34
+ //
35
+ //
36
+ var MaterialRunboxContent = function MaterialRunboxContent(_ref) {
37
+ var runboxId = _ref.runboxId,
38
+ courseId = _ref.courseId;
39
+ var _React$useContext = React__default["default"].useContext(context.MaterialRunboxContext),
40
+ materialRunboxApi = _React$useContext.materialRunboxApi,
41
+ locale = _React$useContext.locale,
42
+ showMessenger = _React$useContext.showMessenger;
43
+ //
44
+ //
45
+ //
46
+ var _useQuery = reactQuery.useQuery({
47
+ enabled: Boolean(runboxId),
48
+ queryKey: ['eliceMaterialRunboxRunboxApi.runboxRunboxIdGet', 'eliceMaterialRunboxRuntimeTemplateApi.runtimeTemplateRuntimeTemplateIdGet', runboxId, courseId],
49
+ queryFn: function queryFn(_ref2) {
50
+ var signal = _ref2.signal;
51
+ return materialRunboxApi.runbox.runboxRunboxIdGet({
52
+ runboxId: runboxId,
53
+ eliceCourseId: courseId
54
+ }, {
55
+ signal: signal
56
+ }).then(function (runbox) {
57
+ return Promise.all([
58
+ // runbox
59
+ runbox,
60
+ // runtime
61
+ materialRunboxApi.runtime.runtimeGet({
62
+ filterImageId: runbox.imageId,
63
+ filterRuntimeTemplateId: runbox.runtimeTemplateId,
64
+ skip: 0,
65
+ count: 1,
66
+ eliceCourseId: courseId
67
+ }, {
68
+ signal: signal
69
+ }).then(function (runtimes) {
70
+ var _a;
71
+ return (_a = runtimes[0]) !== null && _a !== void 0 ? _a : null;
72
+ }),
73
+ // runtimeTemplate
74
+ materialRunboxApi.runtimeTemplate.runtimeTemplateRuntimeTemplateIdGet({
75
+ runtimeTemplateId: runbox.runtimeTemplateId,
76
+ eliceCourseId: courseId
77
+ }, {
78
+ signal: signal
79
+ })]);
80
+ });
81
+ },
82
+ cacheTime: 0,
83
+ keepPreviousData: true,
84
+ refetchOnWindowFocus: false
85
+ }),
86
+ _useQuery$data = _useQuery.data,
87
+ _useQuery$data2 = _useQuery$data === void 0 ? DEFAULT_DATA : _useQuery$data,
88
+ _useQuery$data3 = _rollupPluginBabelHelpers.slicedToArray(_useQuery$data2, 3),
89
+ runbox = _useQuery$data3[0],
90
+ runtime = _useQuery$data3[1],
91
+ runtimeTemplate = _useQuery$data3[2],
92
+ isInitialLoading = _useQuery.isInitialLoading,
93
+ isError = _useQuery.isError,
94
+ refetch = _useQuery.refetch;
95
+ //
96
+ //
97
+ //
98
+ if (isInitialLoading) {
99
+ return React__default["default"].createElement(StyledRunboxContainer, null, React__default["default"].createElement(blocks.Spinner, null));
100
+ }
101
+ if (isError) {
102
+ return React__default["default"].createElement(StyledRunboxContainer, null, React__default["default"].createElement(material.Stack, {
103
+ gap: "1.5rem"
104
+ }, React__default["default"].createElement(material.Typography, {
105
+ variant: "h6"
106
+ }, React__default["default"].createElement(reactIntl.FormattedMessage, {
107
+ id: "runbox.runtime.message.startError"
108
+ })), React__default["default"].createElement(material.Stack, {
109
+ gap: "0.5rem"
110
+ }, React__default["default"].createElement(material.Button, {
111
+ startIcon: React__default["default"].createElement(iconsMaterial.Refresh, null),
112
+ onClick: function onClick() {
113
+ return refetch();
114
+ }
115
+ }, React__default["default"].createElement(reactIntl.FormattedMessage, {
116
+ id: "runbox.common.retry"
117
+ })), typeof showMessenger === 'function' ? React__default["default"].createElement(material.Button, {
118
+ variant: "outlined",
119
+ onClick: function onClick() {
120
+ return showMessenger();
121
+ }
122
+ }, React__default["default"].createElement(reactIntl.FormattedMessage, {
123
+ id: "runbox.common.support"
124
+ })) : null)));
125
+ }
126
+ if (!runbox || !runtimeTemplate) {
127
+ return null;
128
+ }
129
+ var props = {
130
+ runbox: runbox,
131
+ runtime: runtime,
132
+ runtimeTemplate: runtimeTemplate,
133
+ courseId: courseId,
134
+ refetch: refetch
135
+ };
136
+ return React__default["default"].createElement(runboxClient.EliceRunboxProvider, {
137
+ runboxId: runbox.id,
138
+ runboxApiHeartbeat: function runboxApiHeartbeat(_ref3) {
139
+ var id = _ref3.id,
140
+ signal = _ref3.signal;
141
+ return materialRunboxApi.runbox.runboxRunboxIdHeartbeatPost({
142
+ runboxId: id,
143
+ eliceCourseId: courseId
144
+ }, {
145
+ signal: signal
146
+ });
147
+ },
148
+ locale: locale,
149
+ onRunboxRefetchRequest: refetch
150
+ }, React__default["default"].createElement(StyledRunboxContainer, null, React__default["default"].createElement(MaterialRunboxHeader["default"], Object.assign({}, props)), React__default["default"].createElement(MaterialRunboxBody["default"], Object.assign({}, props)), React__default["default"].createElement(MaterialRunboxFooter["default"], Object.assign({}, props))));
151
+ };
152
+
153
+ exports["default"] = MaterialRunboxContent;
@@ -38,7 +38,8 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
38
38
  refetch = _ref2.refetch;
39
39
  var intl = reactIntl.useIntl();
40
40
  var _React$useContext = React__default["default"].useContext(context.MaterialRunboxContext),
41
- materialRunboxApi = _React$useContext.materialRunboxApi;
41
+ materialRunboxApi = _React$useContext.materialRunboxApi,
42
+ enableAutoShutdownToggle = _React$useContext.enableAutoShutdownToggle;
42
43
  var _useEliceRunboxRunnin = runboxClient.useEliceRunboxRunning(),
43
44
  status = _useEliceRunboxRunnin.status;
44
45
  var _useRunboxControl = useRunboxControl.useRunboxControl({
@@ -70,9 +71,12 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
70
71
  */
71
72
  var renderHeaderAutoShutdownSwitch = function renderHeaderAutoShutdownSwitch() {
72
73
  var _a;
74
+ if (!enableAutoShutdownToggle) {
75
+ return null;
76
+ }
73
77
  return React__default["default"].createElement(material.Tooltip, {
74
78
  title: intl.formatMessage({
75
- id: runtimeTemplate.autoShutdown ? 'material.runbox.header.autoShutdownDisabledTooltip' : 'material.runbox.header.autoShutdownTooltip'
79
+ id: runtimeTemplate.autoShutdown ? 'runbox.header.autoShutdownDisabledTooltip' : 'runbox.header.autoShutdownTooltip'
76
80
  }, {
77
81
  time: intl.formatNumber((_a = runtimeTemplate.quotaPerSession) !== null && _a !== void 0 ? _a : 2880, {
78
82
  style: 'unit',
@@ -87,7 +91,7 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
87
91
  onChange: handleAutoShutdownSwitchChange
88
92
  }),
89
93
  label: intl.formatMessage({
90
- id: 'material.runbox.header.autoShutdown'
94
+ id: 'runbox.header.autoShutdown'
91
95
  }),
92
96
  componentsProps: {
93
97
  typography: {
@@ -102,7 +106,7 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
102
106
  var renderHeaderRestartButton = function renderHeaderRestartButton() {
103
107
  return React__default["default"].createElement(material.Tooltip, {
104
108
  title: intl.formatMessage({
105
- id: 'material.runbox.header.restart'
109
+ id: 'runbox.header.restart'
106
110
  })
107
111
  }, React__default["default"].createElement(material.IconButton, {
108
112
  disabled: !isRunboxRunning,
@@ -3,9 +3,11 @@ import type { UseMaterialRunboxApiReturn } from './hooks';
3
3
  export declare type MaterialRunboxContextValue = MaterialRunboxContextExternalValue & MaterialRunboxContextInternalValue;
4
4
  export interface MaterialRunboxContextExternalValue {
5
5
  /** */
6
- locale: string;
6
+ enableAutoShutdownToggle?: boolean;
7
7
  /** */
8
- showMessenger: () => void;
8
+ locale?: string;
9
+ /** */
10
+ showMessenger?: () => void;
9
11
  }
10
12
  export declare type MaterialRunboxContextInternalValue = UseMaterialRunboxApiReturn;
11
13
  export declare const MaterialRunboxContext: import("react").Context<MaterialRunboxContextValue>;
@@ -47,7 +47,7 @@ var useRunboxControl = function useRunboxControl(props) {
47
47
  }).catch(function (err) {
48
48
  if (err.name !== 'AbortError') {
49
49
  enqueueSnackbar(intl.formatMessage({
50
- id: 'material.runbox.runtime.message.startError'
50
+ id: 'runbox.runtime.message.startError'
51
51
  }), {
52
52
  variant: 'error'
53
53
  });
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var en = {"runbox.common.retry":"Retry","runbox.common.support":"Support","runbox.header.autoShutdown":"Always on","runbox.header.autoShutdownDisabledTooltip":"This runtime automatically shuts down after {time}, which is set as the per-session usage time.","runbox.header.autoShutdownTooltip":"If set to always on, the runtime will not shut down even if you leave the learning material. However, it will automatically shut down after {time}, which is set as the session-specific usage time of the runtime.","runbox.header.restart":"Restart runbox","runbox.runtime.message.startError":"There was an error starting the runbox.","runbox.runtime.overlay.assigned.description":"Runbox is running.\nPlease wait!","runbox.runtime.overlay.queued.description":"Currently queued {waiters} times...","runbox.runtime.overlay.queued.description_zero":"Runbox will run soon","runbox.runtime.overlay.terminated.description.default":"The runtime terminated due to an unexpected problem.\nClick the button below to reconnect to the runbox.","runbox.runtime.overlay.terminated.description.general":"The runtime connected to the runbox has ended.\nTo reconnect to the runbox, click the button below.","runbox.runtime.overlay.terminated.description.os_disk_is_full":"Runtime has ended because the disk is full.\nIf you have recently deleted a runbox, it may take some time to reflect.","runbox.runtime.overlay.terminated.description.quota_exceeded":"The runtime has ended because the runtime has expired.","runbox.runtime.overlay.terminated.description.quota_per_session_exceeded":"Runbox has been running for 24 hours and the runtime has ended.\nTo reconnect to the runbox, click the button below.","runbox.runtime.overlay.terminated.description.unexpected":"If the problem persists, please contact customer service.","runbox.runtime.overlay.terminated.restart":"Reconnect","runbox.runtime.overlay.terminated.title":"Runtime disconnected"};
6
+
7
+ exports["default"] = en;
@@ -0,0 +1,2 @@
1
+ export { default as en } from './en.json';
2
+ export { default as ko } from './ko.json';
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var en = require('./en.json.js');
6
+ var ko = require('./ko.json.js');
7
+
8
+
9
+
10
+ exports.en = en["default"];
11
+ exports.ko = ko["default"];
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var ko = {"runbox.common.retry":"재시도","runbox.common.support":"고객센터","runbox.header.autoShutdown":"항상 켜두기","runbox.header.autoShutdownDisabledTooltip":"해당 런타임은 세션별 사용 시간으로 설정된 {time}이 지나면 자동으로 종료됩니다.","runbox.header.autoShutdownTooltip":"항상 켜두기를 설정하면 학습 자료 밖으로 나가도 런타임이 종료되지 않습니다. 다만, 해당 런타임의 세션별 사용 시간으로 설정된 {time}이 지나면 자동으로 종료됩니다.","runbox.header.restart":"런박스 재시작","runbox.runtime.message.startError":"런박스를 시작하는 중에 오류가 발생했습니다.","runbox.runtime.overlay.assigned.description":"런박스가 실행 중입니다.\n잠시만 기다려주세요!","runbox.runtime.overlay.queued.description":"현재 {waiters}번째 대기 중입니다...","runbox.runtime.overlay.queued.description_zero":"곧 런박스가 실행됩니다","runbox.runtime.overlay.terminated.description.default":"예상치 못한 문제로 런타임이 종료되었습니다.\n런박스를 재접속하려면 아래 버튼을 눌러주세요.","runbox.runtime.overlay.terminated.description.general":"런박스에 연결된 런타임이 종료되었습니다.\n런박스를 재접속하려면 아래 버튼을 눌러주세요.","runbox.runtime.overlay.terminated.description.os_disk_is_full":"디스크가 가득 차서 런타임이 종료되었습니다.\n최근 런박스를 삭제하셨다면 반영까지 시간이 소요될 수 있습니다.","runbox.runtime.overlay.terminated.description.quota_exceeded":"런타임 사용시간이 만료되어 런타임이 종료되었습니다.","runbox.runtime.overlay.terminated.description.quota_per_session_exceeded":"런박스를 실행한지 24시간이 경과하여 런타임이 종료되었습니다.\n런박스를 재접속하려면 아래 버튼을 눌러주세요.","runbox.runtime.overlay.terminated.description.unexpected":"문제가 지속되면 고객센터에 문의해주세요.","runbox.runtime.overlay.terminated.restart":"재접속","runbox.runtime.overlay.terminated.title":"런타임 연결 해제됨"};
6
+
7
+ exports["default"] = ko;
@@ -41,7 +41,7 @@ var RuntimeOverlayAssigned = function RuntimeOverlayAssigned() {
41
41
  textAlign: 'center'
42
42
  }
43
43
  }, React__default["default"].createElement(reactIntl.FormattedMessage, {
44
- id: "material.runbox.runtime.overlay.assigned.description"
44
+ id: "runbox.runtime.overlay.assigned.description"
45
45
  })));
46
46
  };
47
47
 
@@ -45,19 +45,19 @@ var RuntimeOverlayQueued = function RuntimeOverlayQueued(_ref) {
45
45
  variant: "subtitle2",
46
46
  color: "text:secondary"
47
47
  }, numWaiters > 0 ? React__default["default"].createElement(reactIntl.FormattedMessage, {
48
- id: "material.runbox.runtime.overlay.queued.description",
48
+ id: "runbox.runtime.overlay.queued.description",
49
49
  values: {
50
50
  waiters: numWaiters
51
51
  }
52
52
  }) : React__default["default"].createElement(reactIntl.FormattedMessage, {
53
- id: "material.runbox.runtime.overlay.queued.description_zero"
54
- })), React__default["default"].createElement(material.Button, {
53
+ id: "runbox.runtime.overlay.queued.description_zero"
54
+ })), typeof showMessenger === 'function' ? React__default["default"].createElement(material.Button, {
55
55
  variant: "outlined",
56
56
  startIcon: React__default["default"].createElement(iconsMaterial.QuestionAnswer, null),
57
57
  onClick: showMessenger
58
58
  }, React__default["default"].createElement(reactIntl.FormattedMessage, {
59
- id: "common.support"
60
- })));
59
+ id: "runbox.common.support"
60
+ })) : null);
61
61
  };
62
62
 
63
63
  exports["default"] = RuntimeOverlayQueued;
@@ -47,14 +47,14 @@ var RuntimeOverlayTerminated = function RuntimeOverlayTerminated(_ref) {
47
47
  case 'auto_shutdown':
48
48
  return {
49
49
  description: intl.formatMessage({
50
- id: 'material.runbox.runtime.overlay.terminated.description.general'
50
+ id: 'runbox.runtime.overlay.terminated.description.general'
51
51
  }),
52
52
  unexpected: false
53
53
  };
54
54
  case 'quota_exceeded':
55
55
  return {
56
56
  description: intl.formatMessage({
57
- id: 'material.runbox.runtime.overlay.terminated.description.quota_exceeded'
57
+ id: 'runbox.runtime.overlay.terminated.description.quota_exceeded'
58
58
  }),
59
59
  unexpected: false
60
60
  };
@@ -62,7 +62,7 @@ var RuntimeOverlayTerminated = function RuntimeOverlayTerminated(_ref) {
62
62
  case 'quota_per_session_exceeded':
63
63
  return {
64
64
  description: intl.formatMessage({
65
- id: 'material.runbox.runtime.overlay.terminated.description.quota_per_session_exceeded'
65
+ id: 'runbox.runtime.overlay.terminated.description.quota_per_session_exceeded'
66
66
  }),
67
67
  unexpected: false
68
68
  };
@@ -70,14 +70,14 @@ var RuntimeOverlayTerminated = function RuntimeOverlayTerminated(_ref) {
70
70
  case 'os_disk_is_full':
71
71
  return {
72
72
  description: intl.formatMessage({
73
- id: 'material.runbox.runtime.overlay.terminated.description.os_disk_is_full'
73
+ id: 'runbox.runtime.overlay.terminated.description.os_disk_is_full'
74
74
  }),
75
75
  unexpected: true
76
76
  };
77
77
  default:
78
78
  return {
79
79
  description: intl.formatMessage({
80
- id: 'material.runbox.runtime.overlay.terminated.description.default'
80
+ id: 'runbox.runtime.overlay.terminated.description.default'
81
81
  }),
82
82
  unexpected: true
83
83
  };
@@ -113,13 +113,13 @@ var RuntimeOverlayTerminated = function RuntimeOverlayTerminated(_ref) {
113
113
  variant: "h6",
114
114
  textAlign: "center"
115
115
  }, React__default["default"].createElement(reactIntl.FormattedMessage, {
116
- id: "material.runbox.runtime.overlay.terminated.title"
116
+ id: "runbox.runtime.overlay.terminated.title"
117
117
  })), React__default["default"].createElement(material.Typography, {
118
118
  variant: "body2",
119
119
  textAlign: "center",
120
120
  whiteSpace: "pre-line"
121
121
  }, runtimeTerminatedAction.unexpected ? runtimeTerminatedAction.description.concat('\n', intl.formatMessage({
122
- id: 'material.runbox.runtime.overlay.terminated.description.unexpected'
122
+ id: 'runbox.runtime.overlay.terminated.description.unexpected'
123
123
  })) : runtimeTerminatedAction.description)), React__default["default"].createElement(material.Stack, {
124
124
  gap: "0.5rem",
125
125
  sx: {
@@ -132,12 +132,12 @@ var RuntimeOverlayTerminated = function RuntimeOverlayTerminated(_ref) {
132
132
  startIcon: React__default["default"].createElement(iconsMaterial.PlayArrow, null),
133
133
  onClick: handleRestart
134
134
  }, React__default["default"].createElement(reactIntl.FormattedMessage, {
135
- id: "material.runbox.runtime.overlay.terminated.restart"
136
- })), runtimeTerminatedAction.unexpected ? React__default["default"].createElement(material.Button, {
135
+ id: "runbox.runtime.overlay.terminated.restart"
136
+ })), runtimeTerminatedAction.unexpected && typeof showMessenger === 'function' ? React__default["default"].createElement(material.Button, {
137
137
  variant: "text",
138
138
  onClick: showMessenger
139
139
  }, React__default["default"].createElement(reactIntl.FormattedMessage, {
140
- id: "common.support"
140
+ id: "runbox.common.support"
141
141
  })) : null)));
142
142
  };
143
143
 
@@ -1,11 +1,7 @@
1
1
  import React from 'react';
2
2
  import type { MaterialRunboxContextExternalValue } from './context';
3
3
  import type { UseMaterialRunboxApiProps } from './hooks';
4
- export interface MaterialRunboxProps extends MaterialRunboxContextExternalValue, UseMaterialRunboxApiProps {
5
- /** Runbox ID. */
6
- runboxId: string | null;
7
- /** Course ID. */
8
- courseId: number;
9
- }
4
+ import type { MaterialRunboxContentProps } from './MaterialRunboxContent';
5
+ export declare type MaterialRunboxProps = MaterialRunboxContentProps & MaterialRunboxContextExternalValue & UseMaterialRunboxApiProps;
10
6
  declare const MaterialRunbox: React.FC<MaterialRunboxProps>;
11
7
  export default MaterialRunbox;
@@ -1,153 +1,42 @@
1
- import { taggedTemplateLiteral as _taggedTemplateLiteral, slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
1
+ import { __rest } from 'tslib';
2
2
  import React from 'react';
3
- import { FormattedMessage } from 'react-intl';
4
- import { Spinner } from '@elice/blocks';
5
- import { EliceRunboxProvider } from '@elice/runbox-client';
6
- import styled from '@emotion/styled';
7
- import { Refresh } from '@mui/icons-material';
8
- import { Stack, Typography, Button } from '@mui/material';
9
- import { useQuery } from '@tanstack/react-query';
3
+ import { IntlProvider } from 'react-intl';
10
4
  import { MaterialRunboxContext } from './context.js';
11
5
  import { useMaterialRunboxApi } from './hooks/useMaterialRunboxApi.js';
6
+ import '@elice/runbox-client';
12
7
  import 'notistack';
13
- import MaterialRunboxBody from './MaterialRunboxBody.js';
14
- import MaterialRunboxFooter from './MaterialRunboxFooter.js';
15
- import MaterialRunboxHeader from './MaterialRunboxHeader.js';
8
+ import * as index from './locales/index.js';
9
+ import MaterialRunboxContent from './MaterialRunboxContent.js';
10
+ import en from './locales/en.json.js';
16
11
 
17
- var _templateObject;
18
12
  //
19
13
  //
20
14
  //
21
- var DEFAULT_DATA = [null, null, null];
22
- //
23
- //
24
- //
25
- var StyledRunboxContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n"])));
26
- //
27
- //
28
- //
29
- var MaterialRunbox = function MaterialRunbox(_ref) {
30
- var runboxId = _ref.runboxId,
31
- courseId = _ref.courseId,
32
- locale = _ref.locale,
33
- showMessenger = _ref.showMessenger,
34
- eliceMaterialRunboxApiConfiguration = _ref.eliceMaterialRunboxApiConfiguration;
15
+ var MaterialRunbox = function MaterialRunbox(_a) {
16
+ var _a$enableAutoShutdown = _a.enableAutoShutdownToggle,
17
+ enableAutoShutdownToggle = _a$enableAutoShutdown === void 0 ? false : _a$enableAutoShutdown,
18
+ _a$locale = _a.locale,
19
+ locale = _a$locale === void 0 ? 'ko' : _a$locale,
20
+ showMessenger = _a.showMessenger,
21
+ eliceMaterialRunboxApiConfiguration = _a.eliceMaterialRunboxApiConfiguration,
22
+ materialRunboxProps = __rest(_a, ["enableAutoShutdownToggle", "locale", "showMessenger", "eliceMaterialRunboxApiConfiguration"]);
35
23
  var apis = useMaterialRunboxApi({
36
24
  eliceMaterialRunboxApiConfiguration: eliceMaterialRunboxApiConfiguration
37
25
  });
38
26
  //
39
27
  //
40
28
  //
41
- var _useQuery = useQuery({
42
- enabled: Boolean(runboxId),
43
- queryKey: ['eliceMaterialRunboxRunboxApi.runboxRunboxIdGet', 'eliceMaterialRunboxRuntimeTemplateApi.runtimeTemplateRuntimeTemplateIdGet', runboxId, courseId],
44
- queryFn: function queryFn(_ref2) {
45
- var signal = _ref2.signal;
46
- return apis.materialRunboxApi.runbox.runboxRunboxIdGet({
47
- runboxId: runboxId,
48
- eliceCourseId: courseId
49
- }, {
50
- signal: signal
51
- }).then(function (runbox) {
52
- return Promise.all([
53
- // runbox
54
- runbox,
55
- // runtime
56
- apis.materialRunboxApi.runtime.runtimeGet({
57
- filterImageId: runbox.imageId,
58
- filterRuntimeTemplateId: runbox.runtimeTemplateId,
59
- skip: 0,
60
- count: 1,
61
- eliceCourseId: courseId
62
- }, {
63
- signal: signal
64
- }).then(function (runtimes) {
65
- var _a;
66
- return (_a = runtimes[0]) !== null && _a !== void 0 ? _a : null;
67
- }),
68
- // runtimeTemplate
69
- apis.materialRunboxApi.runtimeTemplate.runtimeTemplateRuntimeTemplateIdGet({
70
- runtimeTemplateId: runbox.runtimeTemplateId,
71
- eliceCourseId: courseId
72
- }, {
73
- signal: signal
74
- })]);
75
- });
76
- },
77
- cacheTime: 0,
78
- keepPreviousData: true,
79
- refetchOnWindowFocus: false
80
- }),
81
- _useQuery$data = _useQuery.data,
82
- _useQuery$data2 = _useQuery$data === void 0 ? DEFAULT_DATA : _useQuery$data,
83
- _useQuery$data3 = _slicedToArray(_useQuery$data2, 3),
84
- runbox = _useQuery$data3[0],
85
- runtime = _useQuery$data3[1],
86
- runtimeTemplate = _useQuery$data3[2],
87
- isInitialLoading = _useQuery.isInitialLoading,
88
- isError = _useQuery.isError,
89
- refetch = _useQuery.refetch;
90
- //
91
- //
92
- //
93
- if (isInitialLoading) {
94
- return React.createElement(StyledRunboxContainer, null, React.createElement(Spinner, null));
95
- }
96
- if (isError) {
97
- return React.createElement(StyledRunboxContainer, null, React.createElement(Stack, {
98
- gap: "1.5rem"
99
- }, React.createElement(Typography, {
100
- variant: "h6"
101
- }, React.createElement(FormattedMessage, {
102
- id: "material.runbox.runtime.message.startError"
103
- })), React.createElement(Stack, {
104
- gap: "0.5rem"
105
- }, React.createElement(Button, {
106
- startIcon: React.createElement(Refresh, null),
107
- onClick: function onClick() {
108
- return refetch();
109
- }
110
- }, React.createElement(FormattedMessage, {
111
- id: "common.retry"
112
- })), React.createElement(Button, {
113
- variant: "outlined",
114
- onClick: function onClick() {
115
- return showMessenger();
116
- }
117
- }, React.createElement(FormattedMessage, {
118
- id: "common.support"
119
- })))));
120
- }
121
- if (!runbox || !runtimeTemplate) {
122
- return null;
123
- }
124
- var props = {
125
- runbox: runbox,
126
- runtime: runtime,
127
- runtimeTemplate: runtimeTemplate,
128
- courseId: courseId,
129
- refetch: refetch
130
- };
131
29
  return React.createElement(MaterialRunboxContext.Provider, {
132
30
  value: Object.assign({
31
+ enableAutoShutdownToggle: enableAutoShutdownToggle,
133
32
  locale: locale,
134
33
  showMessenger: showMessenger
135
34
  }, apis)
136
- }, React.createElement(EliceRunboxProvider, {
137
- runboxId: runbox.id,
138
- runboxApiHeartbeat: function runboxApiHeartbeat(_ref3) {
139
- var id = _ref3.id,
140
- signal = _ref3.signal;
141
- return apis.materialRunboxApi.runbox.runboxRunboxIdHeartbeatPost({
142
- runboxId: id,
143
- eliceCourseId: courseId
144
- }, {
145
- signal: signal
146
- });
147
- },
35
+ }, React.createElement(IntlProvider, {
148
36
  locale: locale,
149
- onRunboxRefetchRequest: refetch
150
- }, React.createElement(StyledRunboxContainer, null, React.createElement(MaterialRunboxHeader, Object.assign({}, props)), React.createElement(MaterialRunboxBody, Object.assign({}, props)), React.createElement(MaterialRunboxFooter, Object.assign({}, props)))));
37
+ defaultLocale: "en",
38
+ messages: locale in index ? index[locale] : en
39
+ }, React.createElement(MaterialRunboxContent, Object.assign({}, materialRunboxProps))));
151
40
  };
152
41
 
153
42
  export { MaterialRunbox as default };
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ export interface MaterialRunboxContentProps {
3
+ /** Runbox ID. */
4
+ runboxId: string | null;
5
+ /** Course ID. */
6
+ courseId: number;
7
+ }
8
+ declare const MaterialRunboxContent: React.FC<MaterialRunboxContentProps>;
9
+ export default MaterialRunboxContent;
@@ -0,0 +1,144 @@
1
+ import { taggedTemplateLiteral as _taggedTemplateLiteral, slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
2
+ import React from 'react';
3
+ import { FormattedMessage } from 'react-intl';
4
+ import { Spinner } from '@elice/blocks';
5
+ import { EliceRunboxProvider } from '@elice/runbox-client';
6
+ import styled from '@emotion/styled';
7
+ import { Refresh } from '@mui/icons-material';
8
+ import { Stack, Typography, Button } from '@mui/material';
9
+ import { useQuery } from '@tanstack/react-query';
10
+ import { MaterialRunboxContext } from './context.js';
11
+ import MaterialRunboxBody from './MaterialRunboxBody.js';
12
+ import MaterialRunboxFooter from './MaterialRunboxFooter.js';
13
+ import MaterialRunboxHeader from './MaterialRunboxHeader.js';
14
+
15
+ var _templateObject;
16
+ //
17
+ //
18
+ //
19
+ var DEFAULT_DATA = [null, null, null];
20
+ //
21
+ //
22
+ //
23
+ var StyledRunboxContainer = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n width: 100%;\n height: 100%;\n"])));
24
+ //
25
+ //
26
+ //
27
+ var MaterialRunboxContent = function MaterialRunboxContent(_ref) {
28
+ var runboxId = _ref.runboxId,
29
+ courseId = _ref.courseId;
30
+ var _React$useContext = React.useContext(MaterialRunboxContext),
31
+ materialRunboxApi = _React$useContext.materialRunboxApi,
32
+ locale = _React$useContext.locale,
33
+ showMessenger = _React$useContext.showMessenger;
34
+ //
35
+ //
36
+ //
37
+ var _useQuery = useQuery({
38
+ enabled: Boolean(runboxId),
39
+ queryKey: ['eliceMaterialRunboxRunboxApi.runboxRunboxIdGet', 'eliceMaterialRunboxRuntimeTemplateApi.runtimeTemplateRuntimeTemplateIdGet', runboxId, courseId],
40
+ queryFn: function queryFn(_ref2) {
41
+ var signal = _ref2.signal;
42
+ return materialRunboxApi.runbox.runboxRunboxIdGet({
43
+ runboxId: runboxId,
44
+ eliceCourseId: courseId
45
+ }, {
46
+ signal: signal
47
+ }).then(function (runbox) {
48
+ return Promise.all([
49
+ // runbox
50
+ runbox,
51
+ // runtime
52
+ materialRunboxApi.runtime.runtimeGet({
53
+ filterImageId: runbox.imageId,
54
+ filterRuntimeTemplateId: runbox.runtimeTemplateId,
55
+ skip: 0,
56
+ count: 1,
57
+ eliceCourseId: courseId
58
+ }, {
59
+ signal: signal
60
+ }).then(function (runtimes) {
61
+ var _a;
62
+ return (_a = runtimes[0]) !== null && _a !== void 0 ? _a : null;
63
+ }),
64
+ // runtimeTemplate
65
+ materialRunboxApi.runtimeTemplate.runtimeTemplateRuntimeTemplateIdGet({
66
+ runtimeTemplateId: runbox.runtimeTemplateId,
67
+ eliceCourseId: courseId
68
+ }, {
69
+ signal: signal
70
+ })]);
71
+ });
72
+ },
73
+ cacheTime: 0,
74
+ keepPreviousData: true,
75
+ refetchOnWindowFocus: false
76
+ }),
77
+ _useQuery$data = _useQuery.data,
78
+ _useQuery$data2 = _useQuery$data === void 0 ? DEFAULT_DATA : _useQuery$data,
79
+ _useQuery$data3 = _slicedToArray(_useQuery$data2, 3),
80
+ runbox = _useQuery$data3[0],
81
+ runtime = _useQuery$data3[1],
82
+ runtimeTemplate = _useQuery$data3[2],
83
+ isInitialLoading = _useQuery.isInitialLoading,
84
+ isError = _useQuery.isError,
85
+ refetch = _useQuery.refetch;
86
+ //
87
+ //
88
+ //
89
+ if (isInitialLoading) {
90
+ return React.createElement(StyledRunboxContainer, null, React.createElement(Spinner, null));
91
+ }
92
+ if (isError) {
93
+ return React.createElement(StyledRunboxContainer, null, React.createElement(Stack, {
94
+ gap: "1.5rem"
95
+ }, React.createElement(Typography, {
96
+ variant: "h6"
97
+ }, React.createElement(FormattedMessage, {
98
+ id: "runbox.runtime.message.startError"
99
+ })), React.createElement(Stack, {
100
+ gap: "0.5rem"
101
+ }, React.createElement(Button, {
102
+ startIcon: React.createElement(Refresh, null),
103
+ onClick: function onClick() {
104
+ return refetch();
105
+ }
106
+ }, React.createElement(FormattedMessage, {
107
+ id: "runbox.common.retry"
108
+ })), typeof showMessenger === 'function' ? React.createElement(Button, {
109
+ variant: "outlined",
110
+ onClick: function onClick() {
111
+ return showMessenger();
112
+ }
113
+ }, React.createElement(FormattedMessage, {
114
+ id: "runbox.common.support"
115
+ })) : null)));
116
+ }
117
+ if (!runbox || !runtimeTemplate) {
118
+ return null;
119
+ }
120
+ var props = {
121
+ runbox: runbox,
122
+ runtime: runtime,
123
+ runtimeTemplate: runtimeTemplate,
124
+ courseId: courseId,
125
+ refetch: refetch
126
+ };
127
+ return React.createElement(EliceRunboxProvider, {
128
+ runboxId: runbox.id,
129
+ runboxApiHeartbeat: function runboxApiHeartbeat(_ref3) {
130
+ var id = _ref3.id,
131
+ signal = _ref3.signal;
132
+ return materialRunboxApi.runbox.runboxRunboxIdHeartbeatPost({
133
+ runboxId: id,
134
+ eliceCourseId: courseId
135
+ }, {
136
+ signal: signal
137
+ });
138
+ },
139
+ locale: locale,
140
+ onRunboxRefetchRequest: refetch
141
+ }, React.createElement(StyledRunboxContainer, null, React.createElement(MaterialRunboxHeader, Object.assign({}, props)), React.createElement(MaterialRunboxBody, Object.assign({}, props)), React.createElement(MaterialRunboxFooter, Object.assign({}, props))));
142
+ };
143
+
144
+ export { MaterialRunboxContent as default };
@@ -4,7 +4,7 @@ import { useIntl } from 'react-intl';
4
4
  import { useEliceRunboxRunning } from '@elice/runbox-client';
5
5
  import styled from '@emotion/styled';
6
6
  import { RestartAlt } from '@mui/icons-material';
7
- import { Stack, Box, Tooltip, FormControlLabel, Switch, IconButton } from '@mui/material';
7
+ import { Stack, Box, Tooltip, IconButton, FormControlLabel, Switch } from '@mui/material';
8
8
  import { MaterialRunboxContext } from './context.js';
9
9
  import '@elice/openapi-client-material-runbox';
10
10
  import { useRunboxControl } from './hooks/useRunboxControl.js';
@@ -29,7 +29,8 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
29
29
  refetch = _ref2.refetch;
30
30
  var intl = useIntl();
31
31
  var _React$useContext = React.useContext(MaterialRunboxContext),
32
- materialRunboxApi = _React$useContext.materialRunboxApi;
32
+ materialRunboxApi = _React$useContext.materialRunboxApi,
33
+ enableAutoShutdownToggle = _React$useContext.enableAutoShutdownToggle;
33
34
  var _useEliceRunboxRunnin = useEliceRunboxRunning(),
34
35
  status = _useEliceRunboxRunnin.status;
35
36
  var _useRunboxControl = useRunboxControl({
@@ -61,9 +62,12 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
61
62
  */
62
63
  var renderHeaderAutoShutdownSwitch = function renderHeaderAutoShutdownSwitch() {
63
64
  var _a;
65
+ if (!enableAutoShutdownToggle) {
66
+ return null;
67
+ }
64
68
  return React.createElement(Tooltip, {
65
69
  title: intl.formatMessage({
66
- id: runtimeTemplate.autoShutdown ? 'material.runbox.header.autoShutdownDisabledTooltip' : 'material.runbox.header.autoShutdownTooltip'
70
+ id: runtimeTemplate.autoShutdown ? 'runbox.header.autoShutdownDisabledTooltip' : 'runbox.header.autoShutdownTooltip'
67
71
  }, {
68
72
  time: intl.formatNumber((_a = runtimeTemplate.quotaPerSession) !== null && _a !== void 0 ? _a : 2880, {
69
73
  style: 'unit',
@@ -78,7 +82,7 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
78
82
  onChange: handleAutoShutdownSwitchChange
79
83
  }),
80
84
  label: intl.formatMessage({
81
- id: 'material.runbox.header.autoShutdown'
85
+ id: 'runbox.header.autoShutdown'
82
86
  }),
83
87
  componentsProps: {
84
88
  typography: {
@@ -93,7 +97,7 @@ var MaterialRunboxHeader = function MaterialRunboxHeader(_ref2) {
93
97
  var renderHeaderRestartButton = function renderHeaderRestartButton() {
94
98
  return React.createElement(Tooltip, {
95
99
  title: intl.formatMessage({
96
- id: 'material.runbox.header.restart'
100
+ id: 'runbox.header.restart'
97
101
  })
98
102
  }, React.createElement(IconButton, {
99
103
  disabled: !isRunboxRunning,
@@ -3,9 +3,11 @@ import type { UseMaterialRunboxApiReturn } from './hooks';
3
3
  export declare type MaterialRunboxContextValue = MaterialRunboxContextExternalValue & MaterialRunboxContextInternalValue;
4
4
  export interface MaterialRunboxContextExternalValue {
5
5
  /** */
6
- locale: string;
6
+ enableAutoShutdownToggle?: boolean;
7
7
  /** */
8
- showMessenger: () => void;
8
+ locale?: string;
9
+ /** */
10
+ showMessenger?: () => void;
9
11
  }
10
12
  export declare type MaterialRunboxContextInternalValue = UseMaterialRunboxApiReturn;
11
13
  export declare const MaterialRunboxContext: import("react").Context<MaterialRunboxContextValue>;
@@ -43,7 +43,7 @@ var useRunboxControl = function useRunboxControl(props) {
43
43
  }).catch(function (err) {
44
44
  if (err.name !== 'AbortError') {
45
45
  enqueueSnackbar(intl.formatMessage({
46
- id: 'material.runbox.runtime.message.startError'
46
+ id: 'runbox.runtime.message.startError'
47
47
  }), {
48
48
  variant: 'error'
49
49
  });
@@ -0,0 +1,3 @@
1
+ var en = {"runbox.common.retry":"Retry","runbox.common.support":"Support","runbox.header.autoShutdown":"Always on","runbox.header.autoShutdownDisabledTooltip":"This runtime automatically shuts down after {time}, which is set as the per-session usage time.","runbox.header.autoShutdownTooltip":"If set to always on, the runtime will not shut down even if you leave the learning material. However, it will automatically shut down after {time}, which is set as the session-specific usage time of the runtime.","runbox.header.restart":"Restart runbox","runbox.runtime.message.startError":"There was an error starting the runbox.","runbox.runtime.overlay.assigned.description":"Runbox is running.\nPlease wait!","runbox.runtime.overlay.queued.description":"Currently queued {waiters} times...","runbox.runtime.overlay.queued.description_zero":"Runbox will run soon","runbox.runtime.overlay.terminated.description.default":"The runtime terminated due to an unexpected problem.\nClick the button below to reconnect to the runbox.","runbox.runtime.overlay.terminated.description.general":"The runtime connected to the runbox has ended.\nTo reconnect to the runbox, click the button below.","runbox.runtime.overlay.terminated.description.os_disk_is_full":"Runtime has ended because the disk is full.\nIf you have recently deleted a runbox, it may take some time to reflect.","runbox.runtime.overlay.terminated.description.quota_exceeded":"The runtime has ended because the runtime has expired.","runbox.runtime.overlay.terminated.description.quota_per_session_exceeded":"Runbox has been running for 24 hours and the runtime has ended.\nTo reconnect to the runbox, click the button below.","runbox.runtime.overlay.terminated.description.unexpected":"If the problem persists, please contact customer service.","runbox.runtime.overlay.terminated.restart":"Reconnect","runbox.runtime.overlay.terminated.title":"Runtime disconnected"};
2
+
3
+ export { en as default };
@@ -0,0 +1,2 @@
1
+ export { default as en } from './en.json';
2
+ export { default as ko } from './ko.json';
@@ -0,0 +1,2 @@
1
+ export { default as en } from './en.json.js';
2
+ export { default as ko } from './ko.json.js';
@@ -0,0 +1,3 @@
1
+ var ko = {"runbox.common.retry":"재시도","runbox.common.support":"고객센터","runbox.header.autoShutdown":"항상 켜두기","runbox.header.autoShutdownDisabledTooltip":"해당 런타임은 세션별 사용 시간으로 설정된 {time}이 지나면 자동으로 종료됩니다.","runbox.header.autoShutdownTooltip":"항상 켜두기를 설정하면 학습 자료 밖으로 나가도 런타임이 종료되지 않습니다. 다만, 해당 런타임의 세션별 사용 시간으로 설정된 {time}이 지나면 자동으로 종료됩니다.","runbox.header.restart":"런박스 재시작","runbox.runtime.message.startError":"런박스를 시작하는 중에 오류가 발생했습니다.","runbox.runtime.overlay.assigned.description":"런박스가 실행 중입니다.\n잠시만 기다려주세요!","runbox.runtime.overlay.queued.description":"현재 {waiters}번째 대기 중입니다...","runbox.runtime.overlay.queued.description_zero":"곧 런박스가 실행됩니다","runbox.runtime.overlay.terminated.description.default":"예상치 못한 문제로 런타임이 종료되었습니다.\n런박스를 재접속하려면 아래 버튼을 눌러주세요.","runbox.runtime.overlay.terminated.description.general":"런박스에 연결된 런타임이 종료되었습니다.\n런박스를 재접속하려면 아래 버튼을 눌러주세요.","runbox.runtime.overlay.terminated.description.os_disk_is_full":"디스크가 가득 차서 런타임이 종료되었습니다.\n최근 런박스를 삭제하셨다면 반영까지 시간이 소요될 수 있습니다.","runbox.runtime.overlay.terminated.description.quota_exceeded":"런타임 사용시간이 만료되어 런타임이 종료되었습니다.","runbox.runtime.overlay.terminated.description.quota_per_session_exceeded":"런박스를 실행한지 24시간이 경과하여 런타임이 종료되었습니다.\n런박스를 재접속하려면 아래 버튼을 눌러주세요.","runbox.runtime.overlay.terminated.description.unexpected":"문제가 지속되면 고객센터에 문의해주세요.","runbox.runtime.overlay.terminated.restart":"재접속","runbox.runtime.overlay.terminated.title":"런타임 연결 해제됨"};
2
+
3
+ export { ko as default };
@@ -33,7 +33,7 @@ var RuntimeOverlayAssigned = function RuntimeOverlayAssigned() {
33
33
  textAlign: 'center'
34
34
  }
35
35
  }, React.createElement(FormattedMessage, {
36
- id: "material.runbox.runtime.overlay.assigned.description"
36
+ id: "runbox.runtime.overlay.assigned.description"
37
37
  })));
38
38
  };
39
39
 
@@ -37,19 +37,19 @@ var RuntimeOverlayQueued = function RuntimeOverlayQueued(_ref) {
37
37
  variant: "subtitle2",
38
38
  color: "text:secondary"
39
39
  }, numWaiters > 0 ? React.createElement(FormattedMessage, {
40
- id: "material.runbox.runtime.overlay.queued.description",
40
+ id: "runbox.runtime.overlay.queued.description",
41
41
  values: {
42
42
  waiters: numWaiters
43
43
  }
44
44
  }) : React.createElement(FormattedMessage, {
45
- id: "material.runbox.runtime.overlay.queued.description_zero"
46
- })), React.createElement(Button, {
45
+ id: "runbox.runtime.overlay.queued.description_zero"
46
+ })), typeof showMessenger === 'function' ? React.createElement(Button, {
47
47
  variant: "outlined",
48
48
  startIcon: React.createElement(QuestionAnswer, null),
49
49
  onClick: showMessenger
50
50
  }, React.createElement(FormattedMessage, {
51
- id: "common.support"
52
- })));
51
+ id: "runbox.common.support"
52
+ })) : null);
53
53
  };
54
54
 
55
55
  export { RuntimeOverlayQueued as default };
@@ -39,14 +39,14 @@ var RuntimeOverlayTerminated = function RuntimeOverlayTerminated(_ref) {
39
39
  case 'auto_shutdown':
40
40
  return {
41
41
  description: intl.formatMessage({
42
- id: 'material.runbox.runtime.overlay.terminated.description.general'
42
+ id: 'runbox.runtime.overlay.terminated.description.general'
43
43
  }),
44
44
  unexpected: false
45
45
  };
46
46
  case 'quota_exceeded':
47
47
  return {
48
48
  description: intl.formatMessage({
49
- id: 'material.runbox.runtime.overlay.terminated.description.quota_exceeded'
49
+ id: 'runbox.runtime.overlay.terminated.description.quota_exceeded'
50
50
  }),
51
51
  unexpected: false
52
52
  };
@@ -54,7 +54,7 @@ var RuntimeOverlayTerminated = function RuntimeOverlayTerminated(_ref) {
54
54
  case 'quota_per_session_exceeded':
55
55
  return {
56
56
  description: intl.formatMessage({
57
- id: 'material.runbox.runtime.overlay.terminated.description.quota_per_session_exceeded'
57
+ id: 'runbox.runtime.overlay.terminated.description.quota_per_session_exceeded'
58
58
  }),
59
59
  unexpected: false
60
60
  };
@@ -62,14 +62,14 @@ var RuntimeOverlayTerminated = function RuntimeOverlayTerminated(_ref) {
62
62
  case 'os_disk_is_full':
63
63
  return {
64
64
  description: intl.formatMessage({
65
- id: 'material.runbox.runtime.overlay.terminated.description.os_disk_is_full'
65
+ id: 'runbox.runtime.overlay.terminated.description.os_disk_is_full'
66
66
  }),
67
67
  unexpected: true
68
68
  };
69
69
  default:
70
70
  return {
71
71
  description: intl.formatMessage({
72
- id: 'material.runbox.runtime.overlay.terminated.description.default'
72
+ id: 'runbox.runtime.overlay.terminated.description.default'
73
73
  }),
74
74
  unexpected: true
75
75
  };
@@ -105,13 +105,13 @@ var RuntimeOverlayTerminated = function RuntimeOverlayTerminated(_ref) {
105
105
  variant: "h6",
106
106
  textAlign: "center"
107
107
  }, React.createElement(FormattedMessage, {
108
- id: "material.runbox.runtime.overlay.terminated.title"
108
+ id: "runbox.runtime.overlay.terminated.title"
109
109
  })), React.createElement(Typography, {
110
110
  variant: "body2",
111
111
  textAlign: "center",
112
112
  whiteSpace: "pre-line"
113
113
  }, runtimeTerminatedAction.unexpected ? runtimeTerminatedAction.description.concat('\n', intl.formatMessage({
114
- id: 'material.runbox.runtime.overlay.terminated.description.unexpected'
114
+ id: 'runbox.runtime.overlay.terminated.description.unexpected'
115
115
  })) : runtimeTerminatedAction.description)), React.createElement(Stack, {
116
116
  gap: "0.5rem",
117
117
  sx: {
@@ -124,12 +124,12 @@ var RuntimeOverlayTerminated = function RuntimeOverlayTerminated(_ref) {
124
124
  startIcon: React.createElement(PlayArrow, null),
125
125
  onClick: handleRestart
126
126
  }, React.createElement(FormattedMessage, {
127
- id: "material.runbox.runtime.overlay.terminated.restart"
128
- })), runtimeTerminatedAction.unexpected ? React.createElement(Button, {
127
+ id: "runbox.runtime.overlay.terminated.restart"
128
+ })), runtimeTerminatedAction.unexpected && typeof showMessenger === 'function' ? React.createElement(Button, {
129
129
  variant: "text",
130
130
  onClick: showMessenger
131
131
  }, React.createElement(FormattedMessage, {
132
- id: "common.support"
132
+ id: "runbox.common.support"
133
133
  })) : null)));
134
134
  };
135
135
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-runbox",
3
- "version": "1.230418.1",
3
+ "version": "1.230418.2",
4
4
  "description": "User view and editing components of Elice material runbox",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -49,8 +49,8 @@
49
49
  "tslib": "^2.3.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@elice/material-shared-types": "1.230418.1",
53
- "@elice/material-shared-utils": "1.230418.1",
52
+ "@elice/material-shared-types": "1.230418.2",
53
+ "@elice/material-shared-utils": "1.230418.2",
54
54
  "@elice/openapi-client-material-runbox": "^1.230417.0",
55
55
  "@elice/runbox-client": "^1.230412.0",
56
56
  "@emotion/react": "^11.10.5",
@@ -66,5 +66,5 @@
66
66
  "react-intl": "^5.20.10",
67
67
  "react-use": "^17.2.4"
68
68
  },
69
- "gitHead": "9c1ccec857ef44c667da271e9782ca20ff713390"
69
+ "gitHead": "8833ce9a281e499e465a0382324501af039ec027"
70
70
  }