@elice/material-exercise 1.250616.0-teamleaderboard.0 → 1.250618.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.
@@ -8,7 +8,6 @@ var React = require('react');
8
8
  var blocks = require('@elice/blocks');
9
9
  var icons = require('@elice/icons');
10
10
  var intl = require('@elice/intl');
11
- var FileSaver = require('file-saver');
12
11
  var recoil = require('recoil');
13
12
  var recoil$1 = require('../context/recoil.js');
14
13
  require('../context/context.js');
@@ -19,32 +18,48 @@ require('../context/ExerciseProvider.js');
19
18
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
20
19
 
21
20
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
22
- var FileSaver__default = /*#__PURE__*/_interopDefaultCompat(FileSaver);
23
21
 
22
+ //
23
+ //
24
+ //
24
25
  var ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY = 'elice-material-exercise-arduino-agent-modal-closed';
25
26
  var ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE = 'true';
26
- var ARDUINO_AGENT_MAC_DOWNLOAD_URL = 'https://eli.so/arduino-agent-mac';
27
- var ARDUINO_AGENT_WIN_DOWNLOAD_URL = 'https://eli.so/arduino-agent-win';
28
27
  var ARDUINO_AGENT_MANUAL_URL = 'https://eli.so/arduino-faq';
28
+ var ARDUINO_AGENT_MAC_DOWNLOAD_META = Object.freeze({
29
+ mac: {
30
+ filename: 'EliceArdunioAgent-mac.pkg',
31
+ url: 'https://eli.so/arduino-agent-mac'
32
+ },
33
+ win: {
34
+ filename: 'EliceArdunioAgent-win.exe',
35
+ url: 'https://eli.so/arduino-agent-win'
36
+ }
37
+ });
38
+ //
39
+ //
40
+ //
29
41
  var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControllerArduinoAgentModal() {
30
42
  var intl$1 = intl.useRawEliceIntl();
31
43
  var _useRecoilState = recoil.useRecoilState(recoil$1.exerciseArduinoAgentModalState),
32
44
  _useRecoilState2 = _rollupPluginBabelHelpers.slicedToArray(_useRecoilState, 2),
33
45
  open = _useRecoilState2[0],
34
46
  setOpen = _useRecoilState2[1];
47
+ var downloadAgent = function downloadAgent(os) {
48
+ var a = document.createElement('a');
49
+ a.href = ARDUINO_AGENT_MAC_DOWNLOAD_META[os].url;
50
+ a.download = ARDUINO_AGENT_MAC_DOWNLOAD_META[os].filename;
51
+ a.click();
52
+ };
53
+ var handleClose = function handleClose() {
54
+ setOpen(false);
55
+ localStorage.setItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY, ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE);
56
+ };
35
57
  React__default.default.useEffect(function () {
36
58
  var isConfirmed = localStorage.getItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY) === ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE;
37
59
  if (!isConfirmed) {
38
60
  setOpen(true);
39
61
  }
40
62
  }, [setOpen]);
41
- var handleClose = function handleClose() {
42
- setOpen(false);
43
- localStorage.setItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY, ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE);
44
- };
45
- var handleDownload = function handleDownload(fileUrl) {
46
- FileSaver__default.default.saveAs(fileUrl);
47
- };
48
63
  var renderAgentInstallInstruction = function renderAgentInstallInstruction() {
49
64
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
50
65
  children: [jsxRuntime.jsx(blocks.Text, {
@@ -73,7 +88,7 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
73
88
  }),
74
89
  iconAlign: "left",
75
90
  onClick: function onClick() {
76
- return handleDownload(ARDUINO_AGENT_WIN_DOWNLOAD_URL);
91
+ return downloadAgent('win');
77
92
  },
78
93
  children: intl$1.formatMessage({
79
94
  id: 'exerciseRunner.controller.arduino.agent.instruction.install.window'
@@ -88,7 +103,7 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
88
103
  }),
89
104
  iconAlign: "left",
90
105
  onClick: function onClick() {
91
- return handleDownload(ARDUINO_AGENT_MAC_DOWNLOAD_URL);
106
+ return downloadAgent('mac');
92
107
  },
93
108
  children: intl$1.formatMessage({
94
109
  id: 'exerciseRunner.controller.arduino.agent.instruction.install.mac'
@@ -99,14 +114,12 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
99
114
  };
100
115
  var renderAgentConnectionInstruction = function renderAgentConnectionInstruction() {
101
116
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
102
- children: [jsxRuntime.jsxs(blocks.Text, {
117
+ children: [jsxRuntime.jsx(blocks.Text, {
103
118
  role: "gray0",
104
119
  bold: true,
105
- children: [intl$1.formatMessage({
106
- id: 'exerciseRunner.controller.arduino.agent.instruction.connect'
107
- }), intl$1.formatMessage({
120
+ children: intl$1.formatMessage({
108
121
  id: 'exerciseRunner.controller.arduino.agent.instruction.connect'
109
- })]
122
+ })
110
123
  }), jsxRuntime.jsx(blocks.Vspace, {
111
124
  height: 0.25
112
125
  }), jsxRuntime.jsx(blocks.Text, {
@@ -4,7 +4,6 @@ import React from 'react';
4
4
  import { Modal, Vspace, Text, Flex, Button, Icon, Hspace } from '@elice/blocks';
5
5
  import { eisWindows, eisMac, eilArrowRightwardsBasic } from '@elice/icons';
6
6
  import { useRawEliceIntl } from '@elice/intl';
7
- import FileSaver from 'file-saver';
8
7
  import { useRecoilState } from 'recoil';
9
8
  import { exerciseArduinoAgentModalState } from '../context/recoil.js';
10
9
  import '../context/context.js';
@@ -12,30 +11,47 @@ import '../context/recoilTypes.js';
12
11
  import '../context/subjects.js';
13
12
  import '../context/ExerciseProvider.js';
14
13
 
14
+ //
15
+ //
16
+ //
15
17
  var ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY = 'elice-material-exercise-arduino-agent-modal-closed';
16
18
  var ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE = 'true';
17
- var ARDUINO_AGENT_MAC_DOWNLOAD_URL = 'https://eli.so/arduino-agent-mac';
18
- var ARDUINO_AGENT_WIN_DOWNLOAD_URL = 'https://eli.so/arduino-agent-win';
19
19
  var ARDUINO_AGENT_MANUAL_URL = 'https://eli.so/arduino-faq';
20
+ var ARDUINO_AGENT_MAC_DOWNLOAD_META = Object.freeze({
21
+ mac: {
22
+ filename: 'EliceArdunioAgent-mac.pkg',
23
+ url: 'https://eli.so/arduino-agent-mac'
24
+ },
25
+ win: {
26
+ filename: 'EliceArdunioAgent-win.exe',
27
+ url: 'https://eli.so/arduino-agent-win'
28
+ }
29
+ });
30
+ //
31
+ //
32
+ //
20
33
  var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControllerArduinoAgentModal() {
21
34
  var intl = useRawEliceIntl();
22
35
  var _useRecoilState = useRecoilState(exerciseArduinoAgentModalState),
23
36
  _useRecoilState2 = _slicedToArray(_useRecoilState, 2),
24
37
  open = _useRecoilState2[0],
25
38
  setOpen = _useRecoilState2[1];
39
+ var downloadAgent = function downloadAgent(os) {
40
+ var a = document.createElement('a');
41
+ a.href = ARDUINO_AGENT_MAC_DOWNLOAD_META[os].url;
42
+ a.download = ARDUINO_AGENT_MAC_DOWNLOAD_META[os].filename;
43
+ a.click();
44
+ };
45
+ var handleClose = function handleClose() {
46
+ setOpen(false);
47
+ localStorage.setItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY, ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE);
48
+ };
26
49
  React.useEffect(function () {
27
50
  var isConfirmed = localStorage.getItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY) === ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE;
28
51
  if (!isConfirmed) {
29
52
  setOpen(true);
30
53
  }
31
54
  }, [setOpen]);
32
- var handleClose = function handleClose() {
33
- setOpen(false);
34
- localStorage.setItem(ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_KEY, ELICE_MATERIAL_EXERCISE_ARDUINO_AGENT_MODAL_VALUE);
35
- };
36
- var handleDownload = function handleDownload(fileUrl) {
37
- FileSaver.saveAs(fileUrl);
38
- };
39
55
  var renderAgentInstallInstruction = function renderAgentInstallInstruction() {
40
56
  return jsxs(Fragment, {
41
57
  children: [jsx(Text, {
@@ -64,7 +80,7 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
64
80
  }),
65
81
  iconAlign: "left",
66
82
  onClick: function onClick() {
67
- return handleDownload(ARDUINO_AGENT_WIN_DOWNLOAD_URL);
83
+ return downloadAgent('win');
68
84
  },
69
85
  children: intl.formatMessage({
70
86
  id: 'exerciseRunner.controller.arduino.agent.instruction.install.window'
@@ -79,7 +95,7 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
79
95
  }),
80
96
  iconAlign: "left",
81
97
  onClick: function onClick() {
82
- return handleDownload(ARDUINO_AGENT_MAC_DOWNLOAD_URL);
98
+ return downloadAgent('mac');
83
99
  },
84
100
  children: intl.formatMessage({
85
101
  id: 'exerciseRunner.controller.arduino.agent.instruction.install.mac'
@@ -90,14 +106,12 @@ var ExerciseRunnerControllerArduinoAgentModal = function ExerciseRunnerControlle
90
106
  };
91
107
  var renderAgentConnectionInstruction = function renderAgentConnectionInstruction() {
92
108
  return jsxs(Fragment, {
93
- children: [jsxs(Text, {
109
+ children: [jsx(Text, {
94
110
  role: "gray0",
95
111
  bold: true,
96
- children: [intl.formatMessage({
97
- id: 'exerciseRunner.controller.arduino.agent.instruction.connect'
98
- }), intl.formatMessage({
112
+ children: intl.formatMessage({
99
113
  id: 'exerciseRunner.controller.arduino.agent.instruction.connect'
100
- })]
114
+ })
101
115
  }), jsx(Vspace, {
102
116
  height: 0.25
103
117
  }), jsx(Text, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-exercise",
3
- "version": "1.250616.0-teamleaderboard.0",
3
+ "version": "1.250618.0",
4
4
  "description": "User view and editing components of Elice material exercise",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -83,8 +83,8 @@
83
83
  "@elice/icons": "^1.230814.0",
84
84
  "@elice/intl": "0.241127.0",
85
85
  "@elice/markdown": "1.241015.0",
86
- "@elice/material-shared-types": "1.250604.0",
87
- "@elice/material-shared-utils": "1.250604.0",
86
+ "@elice/material-shared-types": "1.250618.0",
87
+ "@elice/material-shared-utils": "1.250618.0",
88
88
  "@elice/mui-elements": "^5.250108.0-controllabel.0",
89
89
  "@elice/mui-system": "^5.250108.0-controllabel.0",
90
90
  "@elice/types": "^1.250612.0-teamleaderboard.1",