@elice/material-runbox-legacy 1.240718.0-trasncript.1 → 1.240718.0-trasncript.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 (21) hide show
  1. package/cjs/_virtual/_rollupPluginBabelHelpers.js +383 -0
  2. package/cjs/components/material-runbox-legacy/MaterialRunboxLegacy.js +22 -20
  3. package/cjs/components/material-runbox-legacy/MaterialRunboxLegacy.styled.js +5 -1
  4. package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyContent.js +250 -171
  5. package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyContent.styled.js +10 -6
  6. package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyRunnerRoomWrapper.js +80 -43
  7. package/cjs/components/material-runbox-legacy/MaterialRunboxLegacyStdioWrapper.js +63 -30
  8. package/cjs/components/material-runbox-legacy/index.js +7 -0
  9. package/cjs/components/material-runbox-legacy/locales/index.js +13 -0
  10. package/cjs/components/material-runbox-legacy/websocket.js +2 -2
  11. package/es/_virtual/_rollupPluginBabelHelpers.js +374 -0
  12. package/es/components/material-runbox-legacy/MaterialRunboxLegacy.js +22 -20
  13. package/es/components/material-runbox-legacy/MaterialRunboxLegacy.styled.js +1 -1
  14. package/es/components/material-runbox-legacy/MaterialRunboxLegacyContent.js +246 -171
  15. package/es/components/material-runbox-legacy/MaterialRunboxLegacyContent.styled.js +6 -6
  16. package/es/components/material-runbox-legacy/MaterialRunboxLegacyRunnerRoomWrapper.js +76 -43
  17. package/es/components/material-runbox-legacy/MaterialRunboxLegacyStdioWrapper.js +59 -30
  18. package/es/components/material-runbox-legacy/index.js +1 -0
  19. package/es/components/material-runbox-legacy/locales/index.js +4 -0
  20. package/es/components/material-runbox-legacy/websocket.js +2 -2
  21. package/package.json +9 -12
@@ -2,66 +2,103 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
6
+ var jsxRuntime = require('react/jsx-runtime');
5
7
  var React = require('react');
6
8
  var apiClient = require('@elice/api-client');
7
9
  var materialSharedUtils = require('@elice/material-shared-utils');
8
10
  var MaterialRunboxLegacyStdioWrapper = require('./MaterialRunboxLegacyStdioWrapper.js');
9
11
  var websocket = require('./websocket.js');
10
12
 
11
- const MaterialRunboxLegacyRunnerRoomWrapper = ({
12
- materialRunboxId
13
- }) => {
14
- const {
15
- apiWsOriginUrl
16
- } = materialSharedUtils.useMaterialConfig();
17
- const abortCtrlRef = React.useRef(new AbortController());
18
- const [runboxRunningId, setRunboxRunningId] = React.useState();
19
- const [isRunboxJoinError, setRunboxJoinError] = React.useState(false);
20
- const [isRunboxRunningCanceling, setRunboxRunningCanceling] = React.useState(false);
13
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
14
+
15
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
16
+
17
+ var MaterialRunboxLegacyRunnerRoomWrapper = function MaterialRunboxLegacyRunnerRoomWrapper(_ref) {
18
+ var materialRunboxId = _ref.materialRunboxId;
19
+ var _useMaterialConfig = materialSharedUtils.useMaterialConfig(),
20
+ apiWsOriginUrl = _useMaterialConfig.apiWsOriginUrl;
21
+ var abortCtrlRef = React__default.default.useRef(new AbortController());
22
+ var _React$useState = React__default.default.useState(),
23
+ _React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
24
+ runboxRunningId = _React$useState2[0],
25
+ setRunboxRunningId = _React$useState2[1];
26
+ var _React$useState3 = React__default.default.useState(false),
27
+ _React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
28
+ isRunboxJoinError = _React$useState4[0],
29
+ setRunboxJoinError = _React$useState4[1];
30
+ var _React$useState5 = React__default.default.useState(false),
31
+ _React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
32
+ isRunboxRunningCanceling = _React$useState6[0],
33
+ setRunboxRunningCanceling = _React$useState6[1];
21
34
  /**
22
35
  * Resolve runner room token.
23
36
  */
24
- const resolveRunnerRoomToken = React.useCallback(async () => {
25
- setRunboxJoinError(false);
26
- abortCtrlRef.current.abort();
27
- abortCtrlRef.current = new AbortController();
28
- return apiClient.postOrgRunnerRoomMaterialRunboxJoin({
29
- materialRunboxId
30
- }, {
31
- signal: abortCtrlRef.current.signal
32
- }).then(res => {
33
- setRunboxJoinError(false);
34
- setRunboxRunningId(res.runboxRunningId);
35
- return res.roomToken;
36
- }).catch(err => {
37
- setRunboxJoinError(true);
38
- throw err;
39
- });
40
- }, [materialRunboxId]);
37
+ var resolveRunnerRoomToken = React__default.default.useCallback( /*#__PURE__*/_rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
38
+ return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
39
+ while (1) switch (_context.prev = _context.next) {
40
+ case 0:
41
+ setRunboxJoinError(false);
42
+ abortCtrlRef.current.abort();
43
+ abortCtrlRef.current = new AbortController();
44
+ return _context.abrupt("return", apiClient.postOrgRunnerRoomMaterialRunboxJoin({
45
+ materialRunboxId: materialRunboxId
46
+ }, {
47
+ signal: abortCtrlRef.current.signal
48
+ }).then(function (res) {
49
+ setRunboxJoinError(false);
50
+ setRunboxRunningId(res.runboxRunningId);
51
+ return res.roomToken;
52
+ }).catch(function (err) {
53
+ setRunboxJoinError(true);
54
+ throw err;
55
+ }));
56
+ case 4:
57
+ case "end":
58
+ return _context.stop();
59
+ }
60
+ }, _callee);
61
+ })), [materialRunboxId]);
41
62
  /**
42
63
  * Reconnect runbox.
43
64
  */
44
- const reconnectRunnerRoomWebSocket = React.useCallback(async () => {
45
- if (!runboxRunningId) {
46
- return;
47
- }
48
- setRunboxRunningCanceling(true);
49
- return apiClient.postOrgMaterialRunboxRunboxRunningCancel({
50
- runboxRunningId
51
- }).then(() => setRunboxRunningCanceling(false)).catch(() => setRunboxRunningCanceling(false));
52
- }, [runboxRunningId]);
65
+ var reconnectRunnerRoomWebSocket = React__default.default.useCallback( /*#__PURE__*/_rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee2() {
66
+ return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee2$(_context2) {
67
+ while (1) switch (_context2.prev = _context2.next) {
68
+ case 0:
69
+ if (runboxRunningId) {
70
+ _context2.next = 2;
71
+ break;
72
+ }
73
+ return _context2.abrupt("return");
74
+ case 2:
75
+ setRunboxRunningCanceling(true);
76
+ return _context2.abrupt("return", apiClient.postOrgMaterialRunboxRunboxRunningCancel({
77
+ runboxRunningId: runboxRunningId
78
+ }).then(function () {
79
+ return setRunboxRunningCanceling(false);
80
+ }).catch(function () {
81
+ return setRunboxRunningCanceling(false);
82
+ }));
83
+ case 4:
84
+ case "end":
85
+ return _context2.stop();
86
+ }
87
+ }, _callee2);
88
+ })), [runboxRunningId]);
53
89
  //
54
90
  //
55
91
  //
56
- return React.createElement(websocket.WSMaterialRunboxLegacyRunnerRoom.Provider, {
92
+ return jsxRuntime.jsx(websocket.WSMaterialRunboxLegacyRunnerRoom.Provider, {
57
93
  enable: !isRunboxRunningCanceling,
58
- endpoint: `${apiWsOriginUrl}/runner_room`,
94
+ endpoint: "".concat(apiWsOriginUrl, "/runner_room"),
59
95
  tokenProvider: resolveRunnerRoomToken,
60
- connectionTimeout: 8000
61
- }, React.createElement(MaterialRunboxLegacyStdioWrapper.default, {
62
- isRunboxJoinError: isRunboxJoinError,
63
- reconnectRunnerRoomWebSocket: reconnectRunnerRoomWebSocket
64
- }));
96
+ connectionTimeout: 8000,
97
+ children: jsxRuntime.jsx(MaterialRunboxLegacyStdioWrapper.default, {
98
+ isRunboxJoinError: isRunboxJoinError,
99
+ reconnectRunnerRoomWebSocket: reconnectRunnerRoomWebSocket
100
+ })
101
+ });
65
102
  };
66
103
 
67
104
  exports.default = MaterialRunboxLegacyRunnerRoomWrapper;
@@ -2,35 +2,53 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
6
+ var jsxRuntime = require('react/jsx-runtime');
5
7
  var React = require('react');
6
8
  var MaterialRunboxLegacyContent = require('./MaterialRunboxLegacyContent.js');
7
9
  var websocket = require('./websocket.js');
8
10
 
9
- const RECONNECT_DELAY = 500;
10
- const MaterialRunboxLegacyStdioWrapper = ({
11
- isRunboxJoinError,
12
- reconnectRunnerRoomWebSocket
13
- }) => {
14
- const [roomToken, setRoomToken] = React.useState('');
15
- const [wsUri, setWsUri] = React.useState('');
16
- const [runboxUrl, setRunboxUrl] = React.useState(null);
17
- const [isRunboxTerminated, setRunboxTerminated] = React.useState(false);
18
- const {
19
- close: closeRunnerRoom
20
- } = websocket.WSMaterialRunboxLegacyRunnerRoom.useControls();
21
- const runnerRoomWsStatus = websocket.WSMaterialRunboxLegacyRunnerRoom.useReadyState();
11
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
12
+
13
+ var React__default = /*#__PURE__*/_interopDefaultCompat(React);
14
+
15
+ var RECONNECT_DELAY = 500;
16
+ var MaterialRunboxLegacyStdioWrapper = function MaterialRunboxLegacyStdioWrapper(_ref) {
17
+ var isRunboxJoinError = _ref.isRunboxJoinError,
18
+ reconnectRunnerRoomWebSocket = _ref.reconnectRunnerRoomWebSocket;
19
+ var _React$useState = React__default.default.useState(''),
20
+ _React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
21
+ roomToken = _React$useState2[0],
22
+ setRoomToken = _React$useState2[1];
23
+ var _React$useState3 = React__default.default.useState(''),
24
+ _React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
25
+ wsUri = _React$useState4[0],
26
+ setWsUri = _React$useState4[1];
27
+ var _React$useState5 = React__default.default.useState(null),
28
+ _React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
29
+ runboxUrl = _React$useState6[0],
30
+ setRunboxUrl = _React$useState6[1];
31
+ var _React$useState7 = React__default.default.useState(false),
32
+ _React$useState8 = _rollupPluginBabelHelpers.slicedToArray(_React$useState7, 2),
33
+ isRunboxTerminated = _React$useState8[0],
34
+ setRunboxTerminated = _React$useState8[1];
35
+ var _WSMaterialRunboxLega = websocket.WSMaterialRunboxLegacyRunnerRoom.useControls(),
36
+ closeRunnerRoom = _WSMaterialRunboxLega.close;
37
+ var runnerRoomWsStatus = websocket.WSMaterialRunboxLegacyRunnerRoom.useReadyState();
22
38
  /**
23
39
  * Reconnect runbox.
24
40
  */
25
- const reconnect = () => {
41
+ var reconnect = function reconnect() {
26
42
  setRunboxUrl(null);
27
43
  setRunboxTerminated(false);
28
- setTimeout(() => void reconnectRunnerRoomWebSocket(), RECONNECT_DELAY);
44
+ setTimeout(function () {
45
+ return void reconnectRunnerRoomWebSocket();
46
+ }, RECONNECT_DELAY);
29
47
  };
30
48
  //
31
49
  //
32
50
  //
33
- websocket.WSMaterialRunboxLegacyRunnerRoom.useMessage(message => {
51
+ websocket.WSMaterialRunboxLegacyRunnerRoom.useMessage(function (message) {
34
52
  switch (message.type) {
35
53
  case 'ROOM_PREPARED':
36
54
  setRoomToken(message.data.roomToken);
@@ -42,13 +60,11 @@ const MaterialRunboxLegacyStdioWrapper = ({
42
60
  setRunboxTerminated(true);
43
61
  break;
44
62
  }
45
- }, {
46
- camelize: true
47
63
  });
48
64
  //
49
65
  // Remove runbox url, when websocket is not open state.
50
66
  //
51
- React.useEffect(() => {
67
+ React__default.default.useEffect(function () {
52
68
  if (runnerRoomWsStatus !== WebSocket.OPEN) {
53
69
  setRunboxUrl(null);
54
70
  }
@@ -56,19 +72,36 @@ const MaterialRunboxLegacyStdioWrapper = ({
56
72
  //
57
73
  //
58
74
  //
59
- const isReady = Boolean(wsUri) && Boolean(roomToken);
60
- return React.createElement(websocket.WSMaterialRunboxLegacyStdio.Provider, {
75
+ var isReady = Boolean(wsUri) && Boolean(roomToken);
76
+ return jsxRuntime.jsx(websocket.WSMaterialRunboxLegacyStdio.Provider, {
61
77
  enable: isReady,
62
- endpoint: `${wsUri}/client/stdio`,
63
- tokenProvider: async () => roomToken,
78
+ endpoint: "".concat(wsUri, "/client/stdio"),
79
+ tokenProvider: function () {
80
+ var _tokenProvider = _rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee() {
81
+ return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee$(_context) {
82
+ while (1) switch (_context.prev = _context.next) {
83
+ case 0:
84
+ return _context.abrupt("return", roomToken);
85
+ case 1:
86
+ case "end":
87
+ return _context.stop();
88
+ }
89
+ }, _callee);
90
+ }));
91
+ function tokenProvider() {
92
+ return _tokenProvider.apply(this, arguments);
93
+ }
94
+ return tokenProvider;
95
+ }(),
64
96
  maxRetries: 5,
65
- heartAttack: true
66
- }, isReady ? React.createElement(MaterialRunboxLegacyContent.default, {
67
- runboxUrl: runboxUrl,
68
- isRunboxJoinError: isRunboxJoinError,
69
- isRunboxTerminated: isRunboxTerminated,
70
- reconnect: reconnect
71
- }) : null);
97
+ heartAttack: true,
98
+ children: isReady ? jsxRuntime.jsx(MaterialRunboxLegacyContent.default, {
99
+ runboxUrl: runboxUrl,
100
+ isRunboxJoinError: isRunboxJoinError,
101
+ isRunboxTerminated: isRunboxTerminated,
102
+ reconnect: reconnect
103
+ }) : null
104
+ });
72
105
  };
73
106
 
74
107
  exports.default = MaterialRunboxLegacyStdioWrapper;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var MaterialRunboxLegacy = require('./MaterialRunboxLegacy.js');
4
+
5
+
6
+
7
+ exports.MaterialRunboxLegacy = MaterialRunboxLegacy.default;
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var en = require('./en.json.js');
4
+ var ko = require('./ko.json.js');
5
+ var th = require('./th.json.js');
6
+ var ja = require('./ja.json.js');
7
+
8
+
9
+
10
+ exports.messageEn = en.default;
11
+ exports.messageKo = ko.default;
12
+ exports.messageTh = th.default;
13
+ exports.messageJa = ja.default;
@@ -6,11 +6,11 @@ var websocket = require('@elice/websocket');
6
6
  * Websocket instance for material runbox runner room.
7
7
  * - endpoint: `/runner_room`
8
8
  */
9
- const WSMaterialRunboxLegacyRunnerRoom = new websocket.EliceWebSocketReact();
9
+ var WSMaterialRunboxLegacyRunnerRoom = new websocket.EliceWebSocketReact();
10
10
  /**
11
11
  * Websocket instance for material runbox stdio.
12
12
  */
13
- const WSMaterialRunboxLegacyStdio = new websocket.EliceWebSocketReact();
13
+ var WSMaterialRunboxLegacyStdio = new websocket.EliceWebSocketReact();
14
14
 
15
15
  exports.WSMaterialRunboxLegacyRunnerRoom = WSMaterialRunboxLegacyRunnerRoom;
16
16
  exports.WSMaterialRunboxLegacyStdio = WSMaterialRunboxLegacyStdio;