@elice/material-external 1.260430.1 → 1.260514.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.
@@ -46,6 +46,7 @@ var MaterialExternal = function MaterialExternal(_ref) {
46
46
  courseId = _ref.courseId,
47
47
  hasNextLecturePage = _ref.hasNextLecturePage,
48
48
  hasPreviousLecturePage = _ref.hasPreviousLecturePage,
49
+ onNavigate = _ref.onNavigate,
49
50
  onNavigateNextLecturePage = _ref.onNavigateNextLecturePage,
50
51
  onNavigatePreviousLecturePage = _ref.onNavigatePreviousLecturePage,
51
52
  __intl = _ref.__intl;
@@ -65,6 +66,7 @@ var MaterialExternal = function MaterialExternal(_ref) {
65
66
  courseId: courseId,
66
67
  hasNextLecturePage: hasNextLecturePage,
67
68
  hasPreviousLecturePage: hasPreviousLecturePage,
69
+ onNavigate: onNavigate,
68
70
  onNavigateNextLecturePage: onNavigateNextLecturePage,
69
71
  onNavigatePreviousLecturePage: onNavigatePreviousLecturePage
70
72
  })
@@ -30,6 +30,7 @@ var MaterialExternalContent = function MaterialExternalContent(_ref) {
30
30
  courseId = _ref.courseId,
31
31
  hasNextLecturePage = _ref.hasNextLecturePage,
32
32
  hasPreviousLecturePage = _ref.hasPreviousLecturePage,
33
+ onNavigate = _ref.onNavigate,
33
34
  onNavigateNextLecturePage = _ref.onNavigateNextLecturePage,
34
35
  onNavigatePreviousLecturePage = _ref.onNavigatePreviousLecturePage;
35
36
  var intl$1 = intl.useRawEliceIntl();
@@ -63,6 +64,7 @@ var MaterialExternalContent = function MaterialExternalContent(_ref) {
63
64
  courseId: courseId,
64
65
  hasNextLecturePage: hasNextLecturePage,
65
66
  hasPreviousLecturePage: hasPreviousLecturePage,
67
+ onNavigate: onNavigate,
66
68
  onNavigateNextLecturePage: onNavigateNextLecturePage,
67
69
  onNavigatePreviousLecturePage: onNavigatePreviousLecturePage
68
70
  });
@@ -3,6 +3,7 @@ import type { GetOrgMaterialExternalGetResponses } from '@elice/types/es/typings
3
3
  export interface MaterialExternalIframeSDKCommunicationProps {
4
4
  hasPreviousLecturePage?: boolean;
5
5
  hasNextLecturePage?: boolean;
6
+ onNavigate?: (materialId: number) => void;
6
7
  onNavigatePreviousLecturePage?: () => void;
7
8
  onNavigateNextLecturePage?: () => void;
8
9
  }
@@ -34,6 +34,7 @@ var MaterialExternalIframe = function MaterialExternalIframe(_ref) {
34
34
  courseId = _ref.courseId,
35
35
  _hasNextLecturePage = _ref.hasNextLecturePage,
36
36
  _hasPreviousLecturePage = _ref.hasPreviousLecturePage,
37
+ _onNavigate = _ref.onNavigate,
37
38
  _onNavigateNextLecturePage = _ref.onNavigateNextLecturePage,
38
39
  _onNavigatePreviousLecturePage = _ref.onNavigatePreviousLecturePage;
39
40
  var intl$1 = intl.useRawEliceIntl();
@@ -42,6 +43,8 @@ var MaterialExternalIframe = function MaterialExternalIframe(_ref) {
42
43
  hasPreviousLecturePage.current = _hasPreviousLecturePage;
43
44
  var hasNextLecturePage = React.useRef(_hasNextLecturePage);
44
45
  hasNextLecturePage.current = _hasNextLecturePage;
46
+ var onNavigate = React.useRef(_onNavigate);
47
+ onNavigate.current = _onNavigate;
45
48
  var onNavigatePreviousLecturePage = React.useRef(_onNavigatePreviousLecturePage);
46
49
  onNavigatePreviousLecturePage.current = _onNavigatePreviousLecturePage;
47
50
  var onNavigateNextLecturePage = React.useRef(_onNavigateNextLecturePage);
@@ -66,25 +69,34 @@ var MaterialExternalIframe = function MaterialExternalIframe(_ref) {
66
69
  return;
67
70
  }
68
71
  var __handle = function __handle(e) {
69
- var _a, _b, _c;
72
+ var _a, _b, _c, _d, _e;
70
73
  if (e.data.from === 'eliceio-contents-sdk') {
71
74
  switch (e.data.type) {
75
+ // navigation - by material id
76
+ case 'navigate':
77
+ {
78
+ var materialId = Number((_a = e.data.payload) === null || _a === void 0 ? void 0 : _a.materialId);
79
+ if (Number.isFinite(materialId)) {
80
+ (_b = onNavigate.current) === null || _b === void 0 ? void 0 : _b.call(onNavigate, materialId);
81
+ }
82
+ break;
83
+ }
72
84
  // navigation - prev
73
85
  case 'navigate-prev':
74
86
  {
75
- (_a = onNavigatePreviousLecturePage.current) === null || _a === void 0 ? void 0 : _a.call(onNavigatePreviousLecturePage);
87
+ (_c = onNavigatePreviousLecturePage.current) === null || _c === void 0 ? void 0 : _c.call(onNavigatePreviousLecturePage);
76
88
  break;
77
89
  }
78
90
  // navigation - next
79
91
  case 'navigate-next':
80
92
  {
81
- (_b = onNavigateNextLecturePage.current) === null || _b === void 0 ? void 0 : _b.call(onNavigateNextLecturePage);
93
+ (_d = onNavigateNextLecturePage.current) === null || _d === void 0 ? void 0 : _d.call(onNavigateNextLecturePage);
82
94
  break;
83
95
  }
84
96
  // navigation - state-sync
85
97
  case 'navigate-state-sync':
86
98
  {
87
- (_c = iframeEl.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage(Object.assign(Object.assign({}, e.data), {
99
+ (_e = iframeEl.contentWindow) === null || _e === void 0 ? void 0 : _e.postMessage(Object.assign(Object.assign({}, e.data), {
88
100
  from: 'elice-web',
89
101
  type: 'navigate-state-sync',
90
102
  payload: {
@@ -37,6 +37,7 @@ var MaterialExternal = function MaterialExternal(_ref) {
37
37
  courseId = _ref.courseId,
38
38
  hasNextLecturePage = _ref.hasNextLecturePage,
39
39
  hasPreviousLecturePage = _ref.hasPreviousLecturePage,
40
+ onNavigate = _ref.onNavigate,
40
41
  onNavigateNextLecturePage = _ref.onNavigateNextLecturePage,
41
42
  onNavigatePreviousLecturePage = _ref.onNavigatePreviousLecturePage,
42
43
  __intl = _ref.__intl;
@@ -56,6 +57,7 @@ var MaterialExternal = function MaterialExternal(_ref) {
56
57
  courseId: courseId,
57
58
  hasNextLecturePage: hasNextLecturePage,
58
59
  hasPreviousLecturePage: hasPreviousLecturePage,
60
+ onNavigate: onNavigate,
59
61
  onNavigateNextLecturePage: onNavigateNextLecturePage,
60
62
  onNavigatePreviousLecturePage: onNavigatePreviousLecturePage
61
63
  })
@@ -22,6 +22,7 @@ var MaterialExternalContent = function MaterialExternalContent(_ref) {
22
22
  courseId = _ref.courseId,
23
23
  hasNextLecturePage = _ref.hasNextLecturePage,
24
24
  hasPreviousLecturePage = _ref.hasPreviousLecturePage,
25
+ onNavigate = _ref.onNavigate,
25
26
  onNavigateNextLecturePage = _ref.onNavigateNextLecturePage,
26
27
  onNavigatePreviousLecturePage = _ref.onNavigatePreviousLecturePage;
27
28
  var intl = useRawEliceIntl();
@@ -55,6 +56,7 @@ var MaterialExternalContent = function MaterialExternalContent(_ref) {
55
56
  courseId: courseId,
56
57
  hasNextLecturePage: hasNextLecturePage,
57
58
  hasPreviousLecturePage: hasPreviousLecturePage,
59
+ onNavigate: onNavigate,
58
60
  onNavigateNextLecturePage: onNavigateNextLecturePage,
59
61
  onNavigatePreviousLecturePage: onNavigatePreviousLecturePage
60
62
  });
@@ -3,6 +3,7 @@ import type { GetOrgMaterialExternalGetResponses } from '@elice/types/es/typings
3
3
  export interface MaterialExternalIframeSDKCommunicationProps {
4
4
  hasPreviousLecturePage?: boolean;
5
5
  hasNextLecturePage?: boolean;
6
+ onNavigate?: (materialId: number) => void;
6
7
  onNavigatePreviousLecturePage?: () => void;
7
8
  onNavigateNextLecturePage?: () => void;
8
9
  }
@@ -25,6 +25,7 @@ var MaterialExternalIframe = function MaterialExternalIframe(_ref) {
25
25
  courseId = _ref.courseId,
26
26
  _hasNextLecturePage = _ref.hasNextLecturePage,
27
27
  _hasPreviousLecturePage = _ref.hasPreviousLecturePage,
28
+ _onNavigate = _ref.onNavigate,
28
29
  _onNavigateNextLecturePage = _ref.onNavigateNextLecturePage,
29
30
  _onNavigatePreviousLecturePage = _ref.onNavigatePreviousLecturePage;
30
31
  var intl = useRawEliceIntl();
@@ -33,6 +34,8 @@ var MaterialExternalIframe = function MaterialExternalIframe(_ref) {
33
34
  hasPreviousLecturePage.current = _hasPreviousLecturePage;
34
35
  var hasNextLecturePage = useRef(_hasNextLecturePage);
35
36
  hasNextLecturePage.current = _hasNextLecturePage;
37
+ var onNavigate = useRef(_onNavigate);
38
+ onNavigate.current = _onNavigate;
36
39
  var onNavigatePreviousLecturePage = useRef(_onNavigatePreviousLecturePage);
37
40
  onNavigatePreviousLecturePage.current = _onNavigatePreviousLecturePage;
38
41
  var onNavigateNextLecturePage = useRef(_onNavigateNextLecturePage);
@@ -57,25 +60,34 @@ var MaterialExternalIframe = function MaterialExternalIframe(_ref) {
57
60
  return;
58
61
  }
59
62
  var __handle = function __handle(e) {
60
- var _a, _b, _c;
63
+ var _a, _b, _c, _d, _e;
61
64
  if (e.data.from === 'eliceio-contents-sdk') {
62
65
  switch (e.data.type) {
66
+ // navigation - by material id
67
+ case 'navigate':
68
+ {
69
+ var materialId = Number((_a = e.data.payload) === null || _a === void 0 ? void 0 : _a.materialId);
70
+ if (Number.isFinite(materialId)) {
71
+ (_b = onNavigate.current) === null || _b === void 0 ? void 0 : _b.call(onNavigate, materialId);
72
+ }
73
+ break;
74
+ }
63
75
  // navigation - prev
64
76
  case 'navigate-prev':
65
77
  {
66
- (_a = onNavigatePreviousLecturePage.current) === null || _a === void 0 ? void 0 : _a.call(onNavigatePreviousLecturePage);
78
+ (_c = onNavigatePreviousLecturePage.current) === null || _c === void 0 ? void 0 : _c.call(onNavigatePreviousLecturePage);
67
79
  break;
68
80
  }
69
81
  // navigation - next
70
82
  case 'navigate-next':
71
83
  {
72
- (_b = onNavigateNextLecturePage.current) === null || _b === void 0 ? void 0 : _b.call(onNavigateNextLecturePage);
84
+ (_d = onNavigateNextLecturePage.current) === null || _d === void 0 ? void 0 : _d.call(onNavigateNextLecturePage);
73
85
  break;
74
86
  }
75
87
  // navigation - state-sync
76
88
  case 'navigate-state-sync':
77
89
  {
78
- (_c = iframeEl.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage(Object.assign(Object.assign({}, e.data), {
90
+ (_e = iframeEl.contentWindow) === null || _e === void 0 ? void 0 : _e.postMessage(Object.assign(Object.assign({}, e.data), {
79
91
  from: 'elice-web',
80
92
  type: 'navigate-state-sync',
81
93
  payload: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elice/material-external",
3
- "version": "1.260430.1",
3
+ "version": "1.260514.0",
4
4
  "description": "User view and editing components of Elice material external",
5
5
  "repository": "https://git.elicer.io/elice/frontend/library/elice-material",
6
6
  "license": "UNLICENSED",
@@ -31,8 +31,8 @@
31
31
  "@tanstack/react-query": "^4",
32
32
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
33
33
  "react-use": "^17.0.0",
34
- "@elice/material-shared-utils": "1.260430.1",
35
- "@elice/material-shared-types": "1.260430.1"
34
+ "@elice/material-shared-types": "1.260514.0",
35
+ "@elice/material-shared-utils": "1.260514.0"
36
36
  },
37
37
  "dependencies": {
38
38
  "classnames": "^2.2.0",
@@ -55,7 +55,7 @@
55
55
  "@mui/x-date-pickers": "^6.7.0",
56
56
  "@tanstack/react-query": "^4.29.3",
57
57
  "@types/classnames": "^2.3.1",
58
- "@types/react": "~17.0.9",
58
+ "@types/react": "^18.2.0",
59
59
  "cross-env": "^7.0.3",
60
60
  "del-cli": "^3.0.1",
61
61
  "eslint": "~9.39.0",
@@ -64,8 +64,8 @@
64
64
  "react-use": "^17.2.4",
65
65
  "rollup": "^4.0.0",
66
66
  "typescript": "~5.9.3",
67
- "@elice/material-shared-types": "1.260430.1",
68
- "@elice/material-shared-utils": "1.260430.1"
67
+ "@elice/material-shared-utils": "1.260514.0",
68
+ "@elice/material-shared-types": "1.260514.0"
69
69
  },
70
70
  "scripts": {
71
71
  "start": "run-s watch",