@elice/material-quiz 1.240811.0-recommend.0 → 1.240811.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.
@@ -13,7 +13,6 @@ var types = require('@elice/types');
13
13
  var material = require('@mui/material');
14
14
  var styled = require('styled-components');
15
15
  var element = require('../../constant/element.js');
16
- var CourseApiContext = require('./context/CourseApiContext.js');
17
16
  var MaterialQuizContext = require('./context/MaterialQuizContext.js');
18
17
  var en = require('./locales/en.json.js');
19
18
  var ko = require('./locales/ko.json.js');
@@ -148,7 +147,6 @@ var MaterialQuiz = function MaterialQuiz() {
148
147
  var MaterialQuizContainer = function MaterialQuizContainer(_ref7) {
149
148
  var materialQuizId = _ref7.materialQuizId,
150
149
  userId = _ref7.userId,
151
- eliceCourseApiConfiguration = _ref7.eliceCourseApiConfiguration,
152
150
  onDirty = _ref7.onDirty,
153
151
  onSubmit = _ref7.onSubmit,
154
152
  onNext = _ref7.onNext,
@@ -157,17 +155,13 @@ var MaterialQuizContainer = function MaterialQuizContainer(_ref7) {
157
155
  value: __intl,
158
156
  children: jsxRuntime.jsx(material.ThemeProvider, {
159
157
  theme: eliceTheme,
160
- children: jsxRuntime.jsx(CourseApiContext.default, {
161
- eliceCourseApiConfiguration: eliceCourseApiConfiguration,
162
- children: jsxRuntime.jsx(MaterialQuizContext.MaterialQuizProvider, {
163
- materialQuizId: materialQuizId,
164
- eliceCourseApiConfiguration: eliceCourseApiConfiguration,
165
- userId: userId,
166
- onDirty: onDirty,
167
- onSubmit: onSubmit,
168
- onNext: onNext,
169
- children: jsxRuntime.jsx(MaterialQuiz, {})
170
- })
158
+ children: jsxRuntime.jsx(MaterialQuizContext.MaterialQuizProvider, {
159
+ materialQuizId: materialQuizId,
160
+ userId: userId,
161
+ onDirty: onDirty,
162
+ onSubmit: onSubmit,
163
+ onNext: onNext,
164
+ children: jsxRuntime.jsx(MaterialQuiz, {})
171
165
  })
172
166
  })
173
167
  });
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { APIStatus } from '@elice/material-shared-types';
3
3
  import type { GetOrgCourseGetResponses, GetOrgLectureGetResponses, GetOrgMaterialQuizGetResponses } from '@elice/types';
4
- import type { CourseApiContextProps } from './CourseApiContext';
5
4
  export interface State {
6
5
  course?: GetOrgCourseGetResponses['course'];
7
6
  lecture?: GetOrgLectureGetResponses['lecture'];
@@ -11,11 +10,9 @@ export interface State {
11
10
  initStatus: APIStatus;
12
11
  isLongPassage: boolean;
13
12
  isInitialLoading: boolean;
14
- isRecommendLecture: boolean;
15
13
  }
16
14
  export type MaterialQuizProps = {
17
15
  materialQuizId: number;
18
- eliceCourseApiConfiguration: CourseApiContextProps['eliceCourseApiConfiguration'];
19
16
  userId?: number;
20
17
  locale?: string;
21
18
  onDirty: (isDirty: boolean) => void;
@@ -6,7 +6,6 @@ var React = require('react');
6
6
  var apiClient = require('@elice/api-client');
7
7
  var materialSharedUtils = require('@elice/material-shared-utils');
8
8
  var types = require('@elice/types');
9
- var CourseApiContext = require('./CourseApiContext.js');
10
9
 
11
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
12
11
 
@@ -34,28 +33,22 @@ function MaterialQuizProvider(_ref) {
34
33
  _React$useState4 = _rollupPluginBabelHelpers.slicedToArray(_React$useState3, 2),
35
34
  lecture = _React$useState4[0],
36
35
  setLecture = _React$useState4[1];
37
- var _useCourseApiContext = CourseApiContext.useCourseApiContext(),
38
- eliceCourseApi = _useCourseApiContext.course;
39
- var _React$useState5 = React__default.default.useState(false),
36
+ var _React$useState5 = React__default.default.useState('idle'),
40
37
  _React$useState6 = _rollupPluginBabelHelpers.slicedToArray(_React$useState5, 2),
41
- isRecommendLecture = _React$useState6[0],
42
- setIsRecommendLecture = _React$useState6[1];
43
- var _React$useState7 = React__default.default.useState('idle'),
38
+ initStatus = _React$useState6[0],
39
+ setInitStatus = _React$useState6[1];
40
+ var _React$useState7 = React__default.default.useState(false),
44
41
  _React$useState8 = _rollupPluginBabelHelpers.slicedToArray(_React$useState7, 2),
45
- initStatus = _React$useState8[0],
46
- setInitStatus = _React$useState8[1];
42
+ vertical = _React$useState8[0],
43
+ setVertical = _React$useState8[1];
47
44
  var _React$useState9 = React__default.default.useState(false),
48
45
  _React$useState10 = _rollupPluginBabelHelpers.slicedToArray(_React$useState9, 2),
49
- vertical = _React$useState10[0],
50
- setVertical = _React$useState10[1];
51
- var _React$useState11 = React__default.default.useState(false),
46
+ isLongPassage = _React$useState10[0],
47
+ setIsLongPassage = _React$useState10[1];
48
+ var _React$useState11 = React__default.default.useState(true),
52
49
  _React$useState12 = _rollupPluginBabelHelpers.slicedToArray(_React$useState11, 2),
53
- isLongPassage = _React$useState12[0],
54
- setIsLongPassage = _React$useState12[1];
55
- var _React$useState13 = React__default.default.useState(true),
56
- _React$useState14 = _rollupPluginBabelHelpers.slicedToArray(_React$useState13, 2),
57
- isInitialLoading = _React$useState14[0],
58
- setIsInitialLoading = _React$useState14[1];
50
+ isInitialLoading = _React$useState12[0],
51
+ setIsInitialLoading = _React$useState12[1];
59
52
  var canInit = materialSharedUtils.useMaterialConfigApiClientUpdate(apiClient.config.init);
60
53
  var resetLayout = function resetLayout() {
61
54
  setIsInitialLoading(true);
@@ -96,7 +89,7 @@ function MaterialQuizProvider(_ref) {
96
89
  materialLecturePage = _useMaterialFetchRaw.materialLecturePage,
97
90
  refreshOrgMaterialQuiz = _useMaterialFetchRaw.refetch;
98
91
  var init = React__default.default.useCallback( /*#__PURE__*/_rollupPluginBabelHelpers.asyncToGenerator( /*#__PURE__*/_rollupPluginBabelHelpers.regeneratorRuntime().mark(function _callee2() {
99
- var _a, _b, controller, signal, _yield$getOrgCourseGe, _course, _yield$getOrgLectureG, _lecture, recommendLectureId;
92
+ var controller, signal, _yield$getOrgCourseGe, _course, _yield$getOrgLectureG, _lecture;
100
93
  return _rollupPluginBabelHelpers.regeneratorRuntime().wrap(function _callee2$(_context2) {
101
94
  while (1) switch (_context2.prev = _context2.next) {
102
95
  case 0:
@@ -128,38 +121,26 @@ function MaterialQuizProvider(_ref) {
128
121
  case 12:
129
122
  _yield$getOrgLectureG = _context2.sent;
130
123
  _lecture = _yield$getOrgLectureG.lecture;
131
- _context2.next = 16;
132
- return eliceCourseApi.courseCourseIdGet({
133
- courseId: (_a = _course === null || _course === void 0 ? void 0 : _course.id) !== null && _a !== void 0 ? _a : 0,
134
- eliceCourseId: (_b = _course === null || _course === void 0 ? void 0 : _course.id) !== null && _b !== void 0 ? _b : 0
135
- }, {
136
- signal: signal
137
- }).then(function (eliceCourse) {
138
- return eliceCourse.recommendLectureId;
139
- });
140
- case 16:
141
- recommendLectureId = _context2.sent;
142
124
  setCourse(_course);
143
125
  setLecture(_lecture);
144
- setIsRecommendLecture(_lecture.id === recommendLectureId);
145
126
  setInitStatus('resolved');
146
- _context2.next = 27;
127
+ _context2.next = 23;
147
128
  break;
148
- case 23:
149
- _context2.prev = 23;
129
+ case 19:
130
+ _context2.prev = 19;
150
131
  _context2.t0 = _context2["catch"](2);
151
132
  console.error(_context2.t0);
152
133
  setInitStatus('rejected');
153
- case 27:
134
+ case 23:
154
135
  return _context2.abrupt("return", function () {
155
136
  return controller.abort();
156
137
  });
157
- case 28:
138
+ case 24:
158
139
  case "end":
159
140
  return _context2.stop();
160
141
  }
161
- }, _callee2, null, [[2, 23]]);
162
- })), [materialLecturePage, eliceCourseApi]);
142
+ }, _callee2, null, [[2, 19]]);
143
+ })), [materialLecturePage]);
163
144
  React.useEffect(function () {
164
145
  if (materialQuizId) {
165
146
  resetLayout();
@@ -179,8 +160,7 @@ function MaterialQuizProvider(_ref) {
179
160
  vertical: vertical,
180
161
  initStatus: initStatus,
181
162
  isLongPassage: isLongPassage,
182
- isInitialLoading: isInitialLoading,
183
- isRecommendLecture: isRecommendLecture
163
+ isInitialLoading: isInitialLoading
184
164
  },
185
165
  children: jsxRuntime.jsx(DispatchContext.Provider, {
186
166
  value: {
@@ -88,8 +88,7 @@ var QuestionBox = function QuestionBox(_a) {
88
88
  var intl$1 = intl.useRawEliceIntl();
89
89
  var _useMaterialQuizState = MaterialQuizContext.useMaterialQuizState(),
90
90
  vertical = _useMaterialQuizState.vertical,
91
- isLongPassage = _useMaterialQuizState.isLongPassage,
92
- isRecommendLecture = _useMaterialQuizState.isRecommendLecture;
91
+ isLongPassage = _useMaterialQuizState.isLongPassage;
93
92
  var intersectionRef = React__default.default.useRef(null);
94
93
  var headerRef = React__default.default.useRef(null);
95
94
  var bodyRef = React__default.default.useRef(null);
@@ -177,7 +176,7 @@ var QuestionBox = function QuestionBox(_a) {
177
176
  }, action, {
178
177
  children: action.children
179
178
  }), index);
180
- }), isNextActive && !isRecommendLecture ? jsxRuntime.jsx(StyledPrimaryButton, {
179
+ }), isNextActive ? jsxRuntime.jsx(StyledPrimaryButton, {
181
180
  isFluid: vertical,
182
181
  size: "small",
183
182
  border: false,
@@ -9,7 +9,6 @@ import { enums } from '@elice/types';
9
9
  import { ThemeProvider } from '@mui/material';
10
10
  import styled from 'styled-components';
11
11
  import { MATERIAL_QUIZ_CONTAINER_ID } from '../../constant/element.js';
12
- import CourseApiContextProvider from './context/CourseApiContext.js';
13
12
  import { MaterialQuizProvider, useMaterialQuizState, useMaterialQuizDispatch } from './context/MaterialQuizContext.js';
14
13
  import messageEn from './locales/en.json.js';
15
14
  import messageKo from './locales/ko.json.js';
@@ -139,7 +138,6 @@ var MaterialQuiz = function MaterialQuiz() {
139
138
  var MaterialQuizContainer = function MaterialQuizContainer(_ref7) {
140
139
  var materialQuizId = _ref7.materialQuizId,
141
140
  userId = _ref7.userId,
142
- eliceCourseApiConfiguration = _ref7.eliceCourseApiConfiguration,
143
141
  onDirty = _ref7.onDirty,
144
142
  onSubmit = _ref7.onSubmit,
145
143
  onNext = _ref7.onNext,
@@ -148,17 +146,13 @@ var MaterialQuizContainer = function MaterialQuizContainer(_ref7) {
148
146
  value: __intl,
149
147
  children: jsx(ThemeProvider, {
150
148
  theme: eliceTheme,
151
- children: jsx(CourseApiContextProvider, {
152
- eliceCourseApiConfiguration: eliceCourseApiConfiguration,
153
- children: jsx(MaterialQuizProvider, {
154
- materialQuizId: materialQuizId,
155
- eliceCourseApiConfiguration: eliceCourseApiConfiguration,
156
- userId: userId,
157
- onDirty: onDirty,
158
- onSubmit: onSubmit,
159
- onNext: onNext,
160
- children: jsx(MaterialQuiz, {})
161
- })
149
+ children: jsx(MaterialQuizProvider, {
150
+ materialQuizId: materialQuizId,
151
+ userId: userId,
152
+ onDirty: onDirty,
153
+ onSubmit: onSubmit,
154
+ onNext: onNext,
155
+ children: jsx(MaterialQuiz, {})
162
156
  })
163
157
  })
164
158
  });
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { APIStatus } from '@elice/material-shared-types';
3
3
  import type { GetOrgCourseGetResponses, GetOrgLectureGetResponses, GetOrgMaterialQuizGetResponses } from '@elice/types';
4
- import type { CourseApiContextProps } from './CourseApiContext';
5
4
  export interface State {
6
5
  course?: GetOrgCourseGetResponses['course'];
7
6
  lecture?: GetOrgLectureGetResponses['lecture'];
@@ -11,11 +10,9 @@ export interface State {
11
10
  initStatus: APIStatus;
12
11
  isLongPassage: boolean;
13
12
  isInitialLoading: boolean;
14
- isRecommendLecture: boolean;
15
13
  }
16
14
  export type MaterialQuizProps = {
17
15
  materialQuizId: number;
18
- eliceCourseApiConfiguration: CourseApiContextProps['eliceCourseApiConfiguration'];
19
16
  userId?: number;
20
17
  locale?: string;
21
18
  onDirty: (isDirty: boolean) => void;
@@ -4,7 +4,6 @@ import React, { useEffect } from 'react';
4
4
  import { config, getOrgMaterialQuizGet, postOrgMaterialQuizOptionsSetSelect, getOrgLectureGet, getOrgCourseGet } from '@elice/api-client';
5
5
  import { useMaterialConfigApiClientUpdate, useMaterialFetchRaw } from '@elice/material-shared-utils';
6
6
  import { enums } from '@elice/types';
7
- import { useCourseApiContext } from './CourseApiContext.js';
8
7
 
9
8
  var StateContext = React.createContext(undefined);
10
9
  var DispatchContext = React.createContext(undefined);
@@ -28,28 +27,22 @@ function MaterialQuizProvider(_ref) {
28
27
  _React$useState4 = _slicedToArray(_React$useState3, 2),
29
28
  lecture = _React$useState4[0],
30
29
  setLecture = _React$useState4[1];
31
- var _useCourseApiContext = useCourseApiContext(),
32
- eliceCourseApi = _useCourseApiContext.course;
33
- var _React$useState5 = React.useState(false),
30
+ var _React$useState5 = React.useState('idle'),
34
31
  _React$useState6 = _slicedToArray(_React$useState5, 2),
35
- isRecommendLecture = _React$useState6[0],
36
- setIsRecommendLecture = _React$useState6[1];
37
- var _React$useState7 = React.useState('idle'),
32
+ initStatus = _React$useState6[0],
33
+ setInitStatus = _React$useState6[1];
34
+ var _React$useState7 = React.useState(false),
38
35
  _React$useState8 = _slicedToArray(_React$useState7, 2),
39
- initStatus = _React$useState8[0],
40
- setInitStatus = _React$useState8[1];
36
+ vertical = _React$useState8[0],
37
+ setVertical = _React$useState8[1];
41
38
  var _React$useState9 = React.useState(false),
42
39
  _React$useState10 = _slicedToArray(_React$useState9, 2),
43
- vertical = _React$useState10[0],
44
- setVertical = _React$useState10[1];
45
- var _React$useState11 = React.useState(false),
40
+ isLongPassage = _React$useState10[0],
41
+ setIsLongPassage = _React$useState10[1];
42
+ var _React$useState11 = React.useState(true),
46
43
  _React$useState12 = _slicedToArray(_React$useState11, 2),
47
- isLongPassage = _React$useState12[0],
48
- setIsLongPassage = _React$useState12[1];
49
- var _React$useState13 = React.useState(true),
50
- _React$useState14 = _slicedToArray(_React$useState13, 2),
51
- isInitialLoading = _React$useState14[0],
52
- setIsInitialLoading = _React$useState14[1];
44
+ isInitialLoading = _React$useState12[0],
45
+ setIsInitialLoading = _React$useState12[1];
53
46
  var canInit = useMaterialConfigApiClientUpdate(config.init);
54
47
  var resetLayout = function resetLayout() {
55
48
  setIsInitialLoading(true);
@@ -90,7 +83,7 @@ function MaterialQuizProvider(_ref) {
90
83
  materialLecturePage = _useMaterialFetchRaw.materialLecturePage,
91
84
  refreshOrgMaterialQuiz = _useMaterialFetchRaw.refetch;
92
85
  var init = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
93
- var _a, _b, controller, signal, _yield$getOrgCourseGe, _course, _yield$getOrgLectureG, _lecture, recommendLectureId;
86
+ var controller, signal, _yield$getOrgCourseGe, _course, _yield$getOrgLectureG, _lecture;
94
87
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
95
88
  while (1) switch (_context2.prev = _context2.next) {
96
89
  case 0:
@@ -122,38 +115,26 @@ function MaterialQuizProvider(_ref) {
122
115
  case 12:
123
116
  _yield$getOrgLectureG = _context2.sent;
124
117
  _lecture = _yield$getOrgLectureG.lecture;
125
- _context2.next = 16;
126
- return eliceCourseApi.courseCourseIdGet({
127
- courseId: (_a = _course === null || _course === void 0 ? void 0 : _course.id) !== null && _a !== void 0 ? _a : 0,
128
- eliceCourseId: (_b = _course === null || _course === void 0 ? void 0 : _course.id) !== null && _b !== void 0 ? _b : 0
129
- }, {
130
- signal: signal
131
- }).then(function (eliceCourse) {
132
- return eliceCourse.recommendLectureId;
133
- });
134
- case 16:
135
- recommendLectureId = _context2.sent;
136
118
  setCourse(_course);
137
119
  setLecture(_lecture);
138
- setIsRecommendLecture(_lecture.id === recommendLectureId);
139
120
  setInitStatus('resolved');
140
- _context2.next = 27;
121
+ _context2.next = 23;
141
122
  break;
142
- case 23:
143
- _context2.prev = 23;
123
+ case 19:
124
+ _context2.prev = 19;
144
125
  _context2.t0 = _context2["catch"](2);
145
126
  console.error(_context2.t0);
146
127
  setInitStatus('rejected');
147
- case 27:
128
+ case 23:
148
129
  return _context2.abrupt("return", function () {
149
130
  return controller.abort();
150
131
  });
151
- case 28:
132
+ case 24:
152
133
  case "end":
153
134
  return _context2.stop();
154
135
  }
155
- }, _callee2, null, [[2, 23]]);
156
- })), [materialLecturePage, eliceCourseApi]);
136
+ }, _callee2, null, [[2, 19]]);
137
+ })), [materialLecturePage]);
157
138
  useEffect(function () {
158
139
  if (materialQuizId) {
159
140
  resetLayout();
@@ -173,8 +154,7 @@ function MaterialQuizProvider(_ref) {
173
154
  vertical: vertical,
174
155
  initStatus: initStatus,
175
156
  isLongPassage: isLongPassage,
176
- isInitialLoading: isInitialLoading,
177
- isRecommendLecture: isRecommendLecture
157
+ isInitialLoading: isInitialLoading
178
158
  },
179
159
  children: jsx(DispatchContext.Provider, {
180
160
  value: {
@@ -78,8 +78,7 @@ var QuestionBox = function QuestionBox(_a) {
78
78
  var intl = useRawEliceIntl();
79
79
  var _useMaterialQuizState = useMaterialQuizState(),
80
80
  vertical = _useMaterialQuizState.vertical,
81
- isLongPassage = _useMaterialQuizState.isLongPassage,
82
- isRecommendLecture = _useMaterialQuizState.isRecommendLecture;
81
+ isLongPassage = _useMaterialQuizState.isLongPassage;
83
82
  var intersectionRef = React.useRef(null);
84
83
  var headerRef = React.useRef(null);
85
84
  var bodyRef = React.useRef(null);
@@ -167,7 +166,7 @@ var QuestionBox = function QuestionBox(_a) {
167
166
  }, action, {
168
167
  children: action.children
169
168
  }), index);
170
- }), isNextActive && !isRecommendLecture ? jsx(StyledPrimaryButton, {
169
+ }), isNextActive ? jsx(StyledPrimaryButton, {
171
170
  isFluid: vertical,
172
171
  size: "small",
173
172
  border: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-quiz",
3
- "version": "1.240811.0-recommend.0",
3
+ "version": "1.240811.0",
4
4
  "description": "User view and editing components of Elice material quiz",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -35,7 +35,6 @@
35
35
  "@elice/mui-system": "^5",
36
36
  "@elice/types": "^1",
37
37
  "@elice/wysiwyg": "^1",
38
- "@elice/openapi-client-course": "^1",
39
38
  "@emotion/react": "^11.10.0",
40
39
  "@emotion/styled": "^11.10.0",
41
40
  "@fortawesome/pro-regular-svg-icons": "^6",
@@ -67,10 +66,9 @@
67
66
  "@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
68
67
  "@elice/intl": "0.240425.0-rc.2",
69
68
  "@elice/markdown": "^1.240124.0",
70
- "@elice/material-shared-types": "1.240811.0-recommend.0",
71
- "@elice/material-shared-utils": "1.240811.0-recommend.0",
69
+ "@elice/material-shared-types": "1.240811.0",
70
+ "@elice/material-shared-utils": "1.240811.0",
72
71
  "@elice/mui-system": "^5.240108.1",
73
- "@elice/openapi-client-course": "^1.230814.0",
74
72
  "@elice/types": "1.240709.0",
75
73
  "@elice/wysiwyg": "1.240716.1",
76
74
  "@emotion/react": "^11.10.5",
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { CourseApi as EliceCourseCourseApi } from '@elice/openapi-client-course';
3
- import type { Configuration as EliceCourseApiConfiguration } from '@elice/openapi-client-course';
4
- export interface CourseApiContextValue {
5
- course: EliceCourseCourseApi;
6
- }
7
- export interface CourseApiContextProps {
8
- children?: React.ReactNode;
9
- eliceCourseApiConfiguration: EliceCourseApiConfiguration;
10
- }
11
- export declare const CourseApiContext: React.Context<CourseApiContextValue>;
12
- export declare const useCourseApiContext: () => CourseApiContextValue;
13
- declare const CourseApiContextProvider: React.FC<CourseApiContextProps>;
14
- export default CourseApiContextProvider;
@@ -1,58 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
6
- var jsxRuntime = require('react/jsx-runtime');
7
- var React = require('react');
8
- var openapiClientCourse = require('@elice/openapi-client-course');
9
-
10
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
-
12
- var React__default = /*#__PURE__*/_interopDefaultCompat(React);
13
-
14
- //
15
- //
16
- //
17
- var CourseApiContext = React__default.default.createContext({});
18
- var useCourseApiContext = function useCourseApiContext() {
19
- return React__default.default.useContext(CourseApiContext);
20
- };
21
- //
22
- //
23
- //
24
- var CourseApiContextProvider = function CourseApiContextProvider(_ref) {
25
- var children = _ref.children,
26
- eliceCourseApiConfiguration = _ref.eliceCourseApiConfiguration;
27
- var createCourseApi = function createCourseApi() {
28
- return Object.freeze({
29
- course: new openapiClientCourse.CourseApi(eliceCourseApiConfiguration)
30
- });
31
- };
32
- //
33
- //
34
- //
35
- var _React$useState = React__default.default.useState(createCourseApi),
36
- _React$useState2 = _rollupPluginBabelHelpers.slicedToArray(_React$useState, 2),
37
- courseApi = _React$useState2[0],
38
- setCourseApi = _React$useState2[1];
39
- //
40
- //
41
- //
42
- React__default.default.useEffect(function () {
43
- return setCourseApi(createCourseApi);
44
- },
45
- // eslint-disable-next-line react-hooks/exhaustive-deps
46
- [eliceCourseApiConfiguration]);
47
- //
48
- //
49
- //
50
- return jsxRuntime.jsx(CourseApiContext.Provider, {
51
- children: children,
52
- value: courseApi
53
- });
54
- };
55
-
56
- exports.CourseApiContext = CourseApiContext;
57
- exports.default = CourseApiContextProvider;
58
- exports.useCourseApiContext = useCourseApiContext;
@@ -1,14 +0,0 @@
1
- import React from 'react';
2
- import { CourseApi as EliceCourseCourseApi } from '@elice/openapi-client-course';
3
- import type { Configuration as EliceCourseApiConfiguration } from '@elice/openapi-client-course';
4
- export interface CourseApiContextValue {
5
- course: EliceCourseCourseApi;
6
- }
7
- export interface CourseApiContextProps {
8
- children?: React.ReactNode;
9
- eliceCourseApiConfiguration: EliceCourseApiConfiguration;
10
- }
11
- export declare const CourseApiContext: React.Context<CourseApiContextValue>;
12
- export declare const useCourseApiContext: () => CourseApiContextValue;
13
- declare const CourseApiContextProvider: React.FC<CourseApiContextProps>;
14
- export default CourseApiContextProvider;
@@ -1,48 +0,0 @@
1
- import { slicedToArray as _slicedToArray } from '../../../_virtual/_rollupPluginBabelHelpers.js';
2
- import { jsx } from 'react/jsx-runtime';
3
- import React from 'react';
4
- import { CourseApi } from '@elice/openapi-client-course';
5
-
6
- //
7
- //
8
- //
9
- var CourseApiContext = React.createContext({});
10
- var useCourseApiContext = function useCourseApiContext() {
11
- return React.useContext(CourseApiContext);
12
- };
13
- //
14
- //
15
- //
16
- var CourseApiContextProvider = function CourseApiContextProvider(_ref) {
17
- var children = _ref.children,
18
- eliceCourseApiConfiguration = _ref.eliceCourseApiConfiguration;
19
- var createCourseApi = function createCourseApi() {
20
- return Object.freeze({
21
- course: new CourseApi(eliceCourseApiConfiguration)
22
- });
23
- };
24
- //
25
- //
26
- //
27
- var _React$useState = React.useState(createCourseApi),
28
- _React$useState2 = _slicedToArray(_React$useState, 2),
29
- courseApi = _React$useState2[0],
30
- setCourseApi = _React$useState2[1];
31
- //
32
- //
33
- //
34
- React.useEffect(function () {
35
- return setCourseApi(createCourseApi);
36
- },
37
- // eslint-disable-next-line react-hooks/exhaustive-deps
38
- [eliceCourseApiConfiguration]);
39
- //
40
- //
41
- //
42
- return jsx(CourseApiContext.Provider, {
43
- children: children,
44
- value: courseApi
45
- });
46
- };
47
-
48
- export { CourseApiContext, CourseApiContextProvider as default, useCourseApiContext };