@stackfactor/client-api 1.1.228 → 1.1.231

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 (220) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +138 -138
  3. package/declarations/axios.d.ts +1 -1
  4. package/dist/cjs/lib/billingProfiles.d.ts +54 -0
  5. package/dist/cjs/lib/billingProfiles.d.ts.map +1 -0
  6. package/dist/cjs/lib/billingProfiles.js +173 -0
  7. package/dist/cjs/lib/billingProfiles.js.map +1 -0
  8. package/dist/cjs/lib/groups.d.ts +18 -0
  9. package/dist/cjs/lib/groups.d.ts.map +1 -1
  10. package/dist/cjs/lib/groups.js +49 -1
  11. package/dist/cjs/lib/groups.js.map +1 -1
  12. package/dist/cjs/lib/index.d.ts +1 -0
  13. package/dist/cjs/lib/index.d.ts.map +1 -1
  14. package/dist/cjs/lib/index.js +3 -2
  15. package/dist/cjs/lib/index.js.map +1 -1
  16. package/dist/cjs/lib/talentTransfromation.d.ts +29 -0
  17. package/dist/cjs/lib/talentTransfromation.d.ts.map +1 -0
  18. package/dist/cjs/lib/talentTransfromation.js +100 -0
  19. package/dist/cjs/lib/talentTransfromation.js.map +1 -0
  20. package/dist/esm/lib/billingProfiles.d.ts +54 -0
  21. package/dist/esm/lib/billingProfiles.d.ts.map +1 -0
  22. package/dist/esm/lib/billingProfiles.js +163 -0
  23. package/dist/esm/lib/billingProfiles.js.map +1 -0
  24. package/dist/esm/lib/groups.d.ts +18 -0
  25. package/dist/esm/lib/groups.d.ts.map +1 -1
  26. package/dist/esm/lib/groups.js +46 -0
  27. package/dist/esm/lib/groups.js.map +1 -1
  28. package/dist/esm/lib/index.d.ts +1 -0
  29. package/dist/esm/lib/index.d.ts.map +1 -1
  30. package/dist/esm/lib/index.js +1 -0
  31. package/dist/esm/lib/index.js.map +1 -1
  32. package/dist/esm/lib/talentTransfromation.d.ts +29 -0
  33. package/dist/esm/lib/talentTransfromation.d.ts.map +1 -0
  34. package/dist/esm/lib/talentTransfromation.js +93 -0
  35. package/dist/esm/lib/talentTransfromation.js.map +1 -0
  36. package/dist/esm/src/lib/actionNotifications.d.ts +24 -0
  37. package/dist/esm/src/lib/actionNotifications.d.ts.map +1 -0
  38. package/dist/esm/src/lib/actionNotifications.js +67 -0
  39. package/dist/esm/src/lib/actionNotifications.js.map +1 -0
  40. package/dist/esm/src/lib/address.d.ts +8 -0
  41. package/dist/esm/src/lib/address.d.ts.map +1 -0
  42. package/dist/esm/src/lib/address.js +20 -0
  43. package/dist/esm/src/lib/address.js.map +1 -0
  44. package/dist/esm/src/lib/aiAssistant.d.ts +42 -0
  45. package/dist/esm/src/lib/aiAssistant.d.ts.map +1 -0
  46. package/dist/esm/src/lib/aiAssistant.js +126 -0
  47. package/dist/esm/src/lib/aiAssistant.js.map +1 -0
  48. package/dist/esm/src/lib/avatar.d.ts +12 -0
  49. package/dist/esm/src/lib/avatar.d.ts.map +1 -0
  50. package/dist/esm/src/lib/avatar.js +29 -0
  51. package/dist/esm/src/lib/avatar.js.map +1 -0
  52. package/dist/esm/src/lib/axiosClient.d.ts +30 -0
  53. package/dist/esm/src/lib/axiosClient.d.ts.map +1 -0
  54. package/dist/esm/src/lib/axiosClient.js +88 -0
  55. package/dist/esm/src/lib/axiosClient.js.map +1 -0
  56. package/dist/esm/src/lib/config.d.ts +23 -0
  57. package/dist/esm/src/lib/config.d.ts.map +1 -0
  58. package/dist/esm/src/lib/config.js +57 -0
  59. package/dist/esm/src/lib/config.js.map +1 -0
  60. package/dist/esm/src/lib/constants.d.ts +69 -0
  61. package/dist/esm/src/lib/constants.d.ts.map +1 -0
  62. package/dist/esm/src/lib/constants.js +89 -0
  63. package/dist/esm/src/lib/constants.js.map +1 -0
  64. package/dist/esm/src/lib/control.d.ts +103 -0
  65. package/dist/esm/src/lib/control.d.ts.map +1 -0
  66. package/dist/esm/src/lib/control.js +308 -0
  67. package/dist/esm/src/lib/control.js.map +1 -0
  68. package/dist/esm/src/lib/controlTemplate.d.ts +66 -0
  69. package/dist/esm/src/lib/controlTemplate.d.ts.map +1 -0
  70. package/dist/esm/src/lib/controlTemplate.js +200 -0
  71. package/dist/esm/src/lib/controlTemplate.js.map +1 -0
  72. package/dist/esm/src/lib/customFields.d.ts +9 -0
  73. package/dist/esm/src/lib/customFields.d.ts.map +1 -0
  74. package/dist/esm/src/lib/customFields.js +22 -0
  75. package/dist/esm/src/lib/customFields.js.map +1 -0
  76. package/dist/esm/src/lib/dashboard.d.ts +23 -0
  77. package/dist/esm/src/lib/dashboard.d.ts.map +1 -0
  78. package/dist/esm/src/lib/dashboard.js +68 -0
  79. package/dist/esm/src/lib/dashboard.js.map +1 -0
  80. package/dist/esm/src/lib/departmentTrainingPlans.d.ts +53 -0
  81. package/dist/esm/src/lib/departmentTrainingPlans.d.ts.map +1 -0
  82. package/dist/esm/src/lib/departmentTrainingPlans.js +144 -0
  83. package/dist/esm/src/lib/departmentTrainingPlans.js.map +1 -0
  84. package/dist/esm/src/lib/groups.d.ts +90 -0
  85. package/dist/esm/src/lib/groups.d.ts.map +1 -0
  86. package/dist/esm/src/lib/groups.js +258 -0
  87. package/dist/esm/src/lib/groups.js.map +1 -0
  88. package/dist/esm/src/lib/index.d.ts +46 -0
  89. package/dist/esm/src/lib/index.d.ts.map +1 -0
  90. package/dist/esm/src/lib/index.js +45 -0
  91. package/dist/esm/src/lib/index.js.map +1 -0
  92. package/dist/esm/src/lib/integration.d.ts +83 -0
  93. package/dist/esm/src/lib/integration.d.ts.map +1 -0
  94. package/dist/esm/src/lib/integration.js +300 -0
  95. package/dist/esm/src/lib/integration.js.map +1 -0
  96. package/dist/esm/src/lib/integrationConfiguration.d.ts +27 -0
  97. package/dist/esm/src/lib/integrationConfiguration.d.ts.map +1 -0
  98. package/dist/esm/src/lib/integrationConfiguration.js +80 -0
  99. package/dist/esm/src/lib/integrationConfiguration.js.map +1 -0
  100. package/dist/esm/src/lib/integrations/contentGenerator.d.ts +26 -0
  101. package/dist/esm/src/lib/integrations/contentGenerator.d.ts.map +1 -0
  102. package/dist/esm/src/lib/integrations/contentGenerator.js +88 -0
  103. package/dist/esm/src/lib/integrations/contentGenerator.js.map +1 -0
  104. package/dist/esm/src/lib/labSessions.d.ts +54 -0
  105. package/dist/esm/src/lib/labSessions.d.ts.map +1 -0
  106. package/dist/esm/src/lib/labSessions.js +168 -0
  107. package/dist/esm/src/lib/labSessions.js.map +1 -0
  108. package/dist/esm/src/lib/learningContent.d.ts +213 -0
  109. package/dist/esm/src/lib/learningContent.d.ts.map +1 -0
  110. package/dist/esm/src/lib/learningContent.js +690 -0
  111. package/dist/esm/src/lib/learningContent.js.map +1 -0
  112. package/dist/esm/src/lib/learningPath.d.ts +64 -0
  113. package/dist/esm/src/lib/learningPath.d.ts.map +1 -0
  114. package/dist/esm/src/lib/learningPath.js +194 -0
  115. package/dist/esm/src/lib/learningPath.js.map +1 -0
  116. package/dist/esm/src/lib/logger.d.ts +19 -0
  117. package/dist/esm/src/lib/logger.d.ts.map +1 -0
  118. package/dist/esm/src/lib/logger.js +55 -0
  119. package/dist/esm/src/lib/logger.js.map +1 -0
  120. package/dist/esm/src/lib/microSkillsQuizes.d.ts +18 -0
  121. package/dist/esm/src/lib/microSkillsQuizes.d.ts.map +1 -0
  122. package/dist/esm/src/lib/microSkillsQuizes.js +48 -0
  123. package/dist/esm/src/lib/microSkillsQuizes.js.map +1 -0
  124. package/dist/esm/src/lib/policy.d.ts +103 -0
  125. package/dist/esm/src/lib/policy.d.ts.map +1 -0
  126. package/dist/esm/src/lib/policy.js +308 -0
  127. package/dist/esm/src/lib/policy.js.map +1 -0
  128. package/dist/esm/src/lib/policyTemplate.d.ts +66 -0
  129. package/dist/esm/src/lib/policyTemplate.d.ts.map +1 -0
  130. package/dist/esm/src/lib/policyTemplate.js +200 -0
  131. package/dist/esm/src/lib/policyTemplate.js.map +1 -0
  132. package/dist/esm/src/lib/quotas.d.ts +15 -0
  133. package/dist/esm/src/lib/quotas.d.ts.map +1 -0
  134. package/dist/esm/src/lib/quotas.js +45 -0
  135. package/dist/esm/src/lib/quotas.js.map +1 -0
  136. package/dist/esm/src/lib/reports.d.ts +47 -0
  137. package/dist/esm/src/lib/reports.d.ts.map +1 -0
  138. package/dist/esm/src/lib/reports.js +87 -0
  139. package/dist/esm/src/lib/reports.js.map +1 -0
  140. package/dist/esm/src/lib/requirement.d.ts +103 -0
  141. package/dist/esm/src/lib/requirement.d.ts.map +1 -0
  142. package/dist/esm/src/lib/requirement.js +308 -0
  143. package/dist/esm/src/lib/requirement.js.map +1 -0
  144. package/dist/esm/src/lib/requirementTemplate.d.ts +66 -0
  145. package/dist/esm/src/lib/requirementTemplate.d.ts.map +1 -0
  146. package/dist/esm/src/lib/requirementTemplate.js +200 -0
  147. package/dist/esm/src/lib/requirementTemplate.js.map +1 -0
  148. package/dist/esm/src/lib/role.d.ts +119 -0
  149. package/dist/esm/src/lib/role.d.ts.map +1 -0
  150. package/dist/esm/src/lib/role.js +393 -0
  151. package/dist/esm/src/lib/role.js.map +1 -0
  152. package/dist/esm/src/lib/roleTemplate.d.ts +73 -0
  153. package/dist/esm/src/lib/roleTemplate.d.ts.map +1 -0
  154. package/dist/esm/src/lib/roleTemplate.js +224 -0
  155. package/dist/esm/src/lib/roleTemplate.js.map +1 -0
  156. package/dist/esm/src/lib/security.d.ts +27 -0
  157. package/dist/esm/src/lib/security.d.ts.map +1 -0
  158. package/dist/esm/src/lib/security.js +72 -0
  159. package/dist/esm/src/lib/security.js.map +1 -0
  160. package/dist/esm/src/lib/skill.d.ts +141 -0
  161. package/dist/esm/src/lib/skill.d.ts.map +1 -0
  162. package/dist/esm/src/lib/skill.js +418 -0
  163. package/dist/esm/src/lib/skill.js.map +1 -0
  164. package/dist/esm/src/lib/skillAssessmentTestingSession.d.ts +85 -0
  165. package/dist/esm/src/lib/skillAssessmentTestingSession.d.ts.map +1 -0
  166. package/dist/esm/src/lib/skillAssessmentTestingSession.js +261 -0
  167. package/dist/esm/src/lib/skillAssessmentTestingSession.js.map +1 -0
  168. package/dist/esm/src/lib/skillAssessments.d.ts +49 -0
  169. package/dist/esm/src/lib/skillAssessments.d.ts.map +1 -0
  170. package/dist/esm/src/lib/skillAssessments.js +147 -0
  171. package/dist/esm/src/lib/skillAssessments.js.map +1 -0
  172. package/dist/esm/src/lib/skillTemplate.d.ts +87 -0
  173. package/dist/esm/src/lib/skillTemplate.d.ts.map +1 -0
  174. package/dist/esm/src/lib/skillTemplate.js +267 -0
  175. package/dist/esm/src/lib/skillTemplate.js.map +1 -0
  176. package/dist/esm/src/lib/socketError.d.ts +22 -0
  177. package/dist/esm/src/lib/socketError.d.ts.map +1 -0
  178. package/dist/esm/src/lib/socketError.js +12 -0
  179. package/dist/esm/src/lib/socketError.js.map +1 -0
  180. package/dist/esm/src/lib/standard.d.ts +103 -0
  181. package/dist/esm/src/lib/standard.d.ts.map +1 -0
  182. package/dist/esm/src/lib/standard.js +308 -0
  183. package/dist/esm/src/lib/standard.js.map +1 -0
  184. package/dist/esm/src/lib/standardTemplate.d.ts +66 -0
  185. package/dist/esm/src/lib/standardTemplate.d.ts.map +1 -0
  186. package/dist/esm/src/lib/standardTemplate.js +200 -0
  187. package/dist/esm/src/lib/standardTemplate.js.map +1 -0
  188. package/dist/esm/src/lib/talentTransfromation.d.ts +29 -0
  189. package/dist/esm/src/lib/talentTransfromation.d.ts.map +1 -0
  190. package/dist/esm/src/lib/talentTransfromation.js +93 -0
  191. package/dist/esm/src/lib/talentTransfromation.js.map +1 -0
  192. package/dist/esm/src/lib/teams.d.ts +92 -0
  193. package/dist/esm/src/lib/teams.d.ts.map +1 -0
  194. package/dist/esm/src/lib/teams.js +258 -0
  195. package/dist/esm/src/lib/teams.js.map +1 -0
  196. package/dist/esm/src/lib/tenants.d.ts +22 -0
  197. package/dist/esm/src/lib/tenants.d.ts.map +1 -0
  198. package/dist/esm/src/lib/tenants.js +67 -0
  199. package/dist/esm/src/lib/tenants.js.map +1 -0
  200. package/dist/esm/src/lib/trainingPlans.d.ts +96 -0
  201. package/dist/esm/src/lib/trainingPlans.d.ts.map +1 -0
  202. package/dist/esm/src/lib/trainingPlans.js +315 -0
  203. package/dist/esm/src/lib/trainingPlans.js.map +1 -0
  204. package/dist/esm/src/lib/trainingPlansProficiencyLevels.d.ts +32 -0
  205. package/dist/esm/src/lib/trainingPlansProficiencyLevels.d.ts.map +1 -0
  206. package/dist/esm/src/lib/trainingPlansProficiencyLevels.js +90 -0
  207. package/dist/esm/src/lib/trainingPlansProficiencyLevels.js.map +1 -0
  208. package/dist/esm/src/lib/userInformation.d.ts +29 -0
  209. package/dist/esm/src/lib/userInformation.d.ts.map +1 -0
  210. package/dist/esm/src/lib/userInformation.js +75 -0
  211. package/dist/esm/src/lib/userInformation.js.map +1 -0
  212. package/dist/esm/src/lib/users.d.ts +206 -0
  213. package/dist/esm/src/lib/users.d.ts.map +1 -0
  214. package/dist/esm/src/lib/users.js +663 -0
  215. package/dist/esm/src/lib/users.js.map +1 -0
  216. package/dist/esm/src/lib/utils.d.ts +14 -0
  217. package/dist/esm/src/lib/utils.d.ts.map +1 -0
  218. package/dist/esm/src/lib/utils.js +51 -0
  219. package/dist/esm/src/lib/utils.js.map +1 -0
  220. package/package.json +57 -57
@@ -0,0 +1,690 @@
1
+ import { getBaseUrl } from "./utils.js";
2
+ import { client } from "./axiosClient.js";
3
+ import { io } from "socket.io-client";
4
+ /**
5
+ * Create learning content and set information
6
+ * @param {Object} data Learning content data
7
+ * @param {String} token Authorization token
8
+ * @returns {Promise<object>} The created learning content
9
+ */
10
+ export const createLearningContent = (data, token) => {
11
+ return new Promise((resolve, reject) => {
12
+ const requestData = {
13
+ data: data,
14
+ };
15
+ const confirmationRequest = client.put("/api/v1/learningcontent", requestData, {
16
+ headers: { authorization: token },
17
+ });
18
+ confirmationRequest
19
+ .then((response) => {
20
+ resolve(response.data);
21
+ })
22
+ .catch((error) => {
23
+ reject(error);
24
+ });
25
+ });
26
+ };
27
+ /**
28
+ * Delete learning content
29
+ * @param {String} id The id of the learning content to be deleted
30
+ * @param {String} comments The comments included with the deletion
31
+ * @param {String} token Authorization token
32
+ * @returns {Promise<object>} The response from the server
33
+ */
34
+ export const deleteLearningContent = (id, comments, token) => {
35
+ const data = {
36
+ id: id,
37
+ };
38
+ if (comments)
39
+ data.comments = comments;
40
+ return new Promise((resolve, reject) => {
41
+ const request = client.delete(`/api/v1/learningcontent/`, {
42
+ headers: { authorization: token },
43
+ data: data,
44
+ });
45
+ request
46
+ .then((response) => {
47
+ resolve(response.data);
48
+ })
49
+ .catch((error) => {
50
+ reject(error);
51
+ });
52
+ });
53
+ };
54
+ /**
55
+ * Delete media for a specific micro skill learning content activity
56
+ * @param {String} id
57
+ * @param {String} microskillid
58
+ * @param {String} activityId
59
+ * @param {String} mediaId
60
+ * @param {String} token
61
+ * @returns {Promise<object>} The response from the server
62
+ * */
63
+ export const deleteLearningContentMicroSkillLearningContentActivityMedia = (id, microskillid, activityId, mediaId, token) => {
64
+ return new Promise((resolve, reject) => {
65
+ const confirmationRequest = client.delete(`/api/v1/learningcontent/media/${id}/${microskillid}/${activityId}/${mediaId}`, {
66
+ headers: { authorization: token },
67
+ });
68
+ confirmationRequest
69
+ .then((response) => {
70
+ resolve(response.data);
71
+ })
72
+ .catch((error) => {
73
+ reject(error);
74
+ });
75
+ });
76
+ };
77
+ /**
78
+ * Discard the learning content draft changes
79
+ * @param {String} id The id of the learning content to be deleted
80
+ * @param {String} token Authorization token
81
+ * @returns {Promise<object>} The response from the server
82
+ */
83
+ export const discardLearningContentChanges = (id, token) => {
84
+ return new Promise((resolve, reject) => {
85
+ const data = {};
86
+ const request = client.get(`/api/v1/learningcontent/discard/${id}`, {
87
+ headers: { authorization: token },
88
+ data: data,
89
+ });
90
+ request
91
+ .then((response) => {
92
+ resolve(response.data);
93
+ })
94
+ .catch((error) => {
95
+ reject(error);
96
+ });
97
+ });
98
+ };
99
+ /**
100
+ * Generate the learning activity content
101
+ * @param {String} learningObjectives
102
+ * @param {String} skillId
103
+ * @param {String} microSkillId
104
+ * @param {Object} learningActivity
105
+ * @param {List<String>} otherLearningActivities
106
+ * @param {String} integrationId
107
+ * @param {String} contentType
108
+ * @param {String} token
109
+ */
110
+ export const generateLearningActivityContent = (learningObjectives, skillId, microSkillId, learningActivity, otherLearningActivities, integrationId, contentType, token, onProgressStatus) => {
111
+ return new Promise((resolve, reject) => {
112
+ const requestData = {
113
+ learningObjectives: learningObjectives,
114
+ learningActivity: learningActivity,
115
+ microSkillId: microSkillId,
116
+ integrationId: integrationId,
117
+ contentType: contentType,
118
+ skillId: skillId,
119
+ };
120
+ if (otherLearningActivities) {
121
+ requestData.otherLearningActivities = otherLearningActivities;
122
+ }
123
+ // Use socket.io for real-time progress updates
124
+ const socket = io(getBaseUrl(), {
125
+ auth: {
126
+ token: token,
127
+ },
128
+ path: `/api/v1/realtime`,
129
+ transports: ["websocket"],
130
+ withCredentials: true,
131
+ reconnection: false,
132
+ });
133
+ // Socket event handlers
134
+ socket.on("connect", () => {
135
+ socket.emit("generatelearningactivitycontent", requestData);
136
+ });
137
+ socket.on("progress", (data) => {
138
+ if (onProgressStatus) {
139
+ onProgressStatus(data);
140
+ }
141
+ });
142
+ socket.on("complete", (data) => {
143
+ socket.disconnect();
144
+ resolve(data);
145
+ });
146
+ socket.on("error", (err) => {
147
+ socket.disconnect();
148
+ reject(err);
149
+ });
150
+ socket.on("disconnect", (reason) => {
151
+ if (reason !== "io client disconnect") {
152
+ reject(new Error(`Socket disconnected: ${reason}`));
153
+ }
154
+ });
155
+ });
156
+ };
157
+ /**
158
+ * Generate micro skill test knowledge
159
+ * @param {String} microSkill
160
+ * @param {String} token
161
+ * @param {Function} onProgressStatus Optional callback for progress updates
162
+ * @returns {Promise<object>}
163
+ */
164
+ export const generateMicroSkillTestKnowledge = (microSkill, token, onProgressStatus) => {
165
+ return new Promise((resolve, reject) => {
166
+ const requestData = {
167
+ microSkill: microSkill,
168
+ };
169
+ // Use socket.io for real-time progress updates
170
+ const socket = io(getBaseUrl(), {
171
+ auth: {
172
+ token: token,
173
+ },
174
+ path: `/api/v1/realtime`,
175
+ transports: ["websocket"],
176
+ withCredentials: true,
177
+ reconnection: false,
178
+ });
179
+ // Socket event handlers
180
+ socket.on("connect", () => {
181
+ socket.emit("generatemicroskilltestknowledge", requestData);
182
+ });
183
+ socket.on("progress", (data) => {
184
+ if (onProgressStatus) {
185
+ onProgressStatus(data);
186
+ }
187
+ });
188
+ socket.on("complete", (data) => {
189
+ socket.disconnect();
190
+ resolve(data);
191
+ });
192
+ socket.on("error", (err) => {
193
+ socket.disconnect();
194
+ reject(err);
195
+ });
196
+ socket.on("disconnect", (reason) => {
197
+ if (reason !== "io client disconnect") {
198
+ reject(new Error(`Socket disconnected: ${reason}`));
199
+ }
200
+ });
201
+ });
202
+ };
203
+ /**
204
+ * Get the learning content information by id
205
+ * @param {String} id The id of the learning content
206
+ * @param {String} version The version of the learning content
207
+ * @param {String} token Authorization token
208
+ * @returns {Promise<object>} The response from the server
209
+ */
210
+ export const getLearningContentInformationById = (id, version, token) => {
211
+ return new Promise((resolve, reject) => {
212
+ const confirmationRequest = client.get(`/api/v1/learningcontent/${id}/${version}`, {
213
+ headers: { authorization: token },
214
+ });
215
+ confirmationRequest
216
+ .then((response) => {
217
+ resolve(response.data);
218
+ })
219
+ .catch((error) => {
220
+ reject(error);
221
+ });
222
+ });
223
+ };
224
+ /**
225
+ * Get the list of available content types
226
+ * @param {Array<String>} filter The filter used to select the learning content
227
+ * @param {String} version The version to be retrieved
228
+ * @param {boolean} includeDeleted When true it will return the deleted records as well
229
+ * @param {String} token Authorization token
230
+ * @returns {Promise<Array<Object>>} The list of available content
231
+ */
232
+ export const getLearningContentList = (filter, version, includeDeleted, token) => {
233
+ return new Promise((resolve, reject) => {
234
+ const requestData = {
235
+ version: version,
236
+ includeDeleted: includeDeleted,
237
+ };
238
+ if (filter)
239
+ requestData.filter = filter;
240
+ const confirmationRequest = client.post(`/api/v1/learningcontent`, requestData, {
241
+ headers: { authorization: token },
242
+ });
243
+ confirmationRequest
244
+ .then((response) => {
245
+ resolve(response.data);
246
+ })
247
+ .catch((error) => {
248
+ reject(error);
249
+ });
250
+ });
251
+ };
252
+ /**
253
+ * Get learning content scene audio
254
+ * @param {String} id
255
+ * @param {String} microSkillId
256
+ * @param {String} learningActivityId
257
+ * @param {String} sceneId
258
+ * @param {String} token
259
+ * @param {String} version
260
+ */
261
+ export const getLearningContentMicroSkillLearningContentActivitySceneAudio = (contentId, microSkillId, learningActivityId, sceneId, token, version) => {
262
+ return new Promise((resolve, reject) => {
263
+ const confirmationRequest = client.get(`/api/v1/learningcontent/audio/${contentId}/${microSkillId}/${learningActivityId}/${sceneId}/${version}`, {
264
+ headers: {
265
+ authorization: token,
266
+ },
267
+ responseType: "blob",
268
+ });
269
+ confirmationRequest
270
+ .then((response) => {
271
+ resolve(response.data);
272
+ })
273
+ .catch((error) => {
274
+ reject(error);
275
+ });
276
+ });
277
+ };
278
+ /**
279
+ * Upload media for a specific micro skill learning content activity
280
+ * @param {String} id
281
+ * @param {String} microskillid
282
+ * @param {String} activityId
283
+ * @param {String} mediaId
284
+ * @param {String} token
285
+ * @returns {Promise<object>} The response from the server
286
+ */
287
+ export const getLearningContentMicroSkillLearningContentActivityMedia = (id, microskillid, activityId, mediaId, token) => {
288
+ return new Promise((resolve, reject) => {
289
+ const confirmationRequest = client.get(`/api/v1/learningcontent/media/${id}/${microskillid}/${activityId}/${mediaId}`, {
290
+ headers: {
291
+ authorization: token,
292
+ },
293
+ responseType: "blob",
294
+ });
295
+ confirmationRequest
296
+ .then((response) => {
297
+ resolve(response.data);
298
+ })
299
+ .catch((error) => {
300
+ reject(error);
301
+ });
302
+ });
303
+ };
304
+ /**
305
+ * Migrate learning content storage
306
+ * @param {String} id The id of the content to be migrated
307
+ * @param {String} token Authorization token
308
+ * @returns {Promise<object>} The response from the server
309
+ */
310
+ export const migrateLearningContentStorageType = (id, token) => {
311
+ return new Promise((resolve, reject) => {
312
+ const data = {};
313
+ const confirmationRequest = client.post(`/api/v1/learningcontent/migratestorage/${id}`, data, {
314
+ headers: { authorization: token },
315
+ });
316
+ confirmationRequest
317
+ .then((response) => {
318
+ resolve(response.data);
319
+ })
320
+ .catch((error) => {
321
+ reject(error);
322
+ });
323
+ });
324
+ };
325
+ /**
326
+ * Publish learning content
327
+ * @param {String} id The id of the content to be published
328
+ * @param {String} comments The comments to be include with the request
329
+ * @param {String} token Authorization token
330
+ * @returns {Promise<object>} The response from the server
331
+ */
332
+ export const publishLearningContent = (id, comments, token) => {
333
+ return new Promise((resolve, reject) => {
334
+ const data = {};
335
+ if (comments)
336
+ data.comments = comments;
337
+ const confirmationRequest = client.post(`/api/v1/learningcontent/publish/${id}`, data, {
338
+ headers: { authorization: token },
339
+ });
340
+ confirmationRequest
341
+ .then((response) => {
342
+ resolve(response.data);
343
+ })
344
+ .catch((error) => {
345
+ reject(error);
346
+ });
347
+ });
348
+ };
349
+ /**
350
+ * Set learning content information
351
+ * @param {String} id The id of the learning content to be updated
352
+ * @param {Object} data Data used to update the learning content
353
+ * @param {String} token Authorization token
354
+ * @returns {Promise<object>} The updated learning content
355
+ */
356
+ export const setLearningContentInformation = (id, data, token) => {
357
+ return new Promise((resolve, reject) => {
358
+ const requestData = {
359
+ data: data,
360
+ id: id,
361
+ };
362
+ const confirmationRequest = client.post(`/api/v1/learningcontent/update`, requestData, {
363
+ headers: { authorization: token },
364
+ });
365
+ confirmationRequest
366
+ .then((response) => {
367
+ resolve(response.data);
368
+ })
369
+ .catch((error) => {
370
+ reject(error);
371
+ });
372
+ });
373
+ };
374
+ /**
375
+ * Set partial content information
376
+ * @param {String} id
377
+ * @param {Object} data
378
+ * @param {String} token
379
+ * @returns {Promise<object>}
380
+ */
381
+ export const setLearningContentPartialContentInformation = (id, data, token) => {
382
+ return new Promise((resolve, reject) => {
383
+ const requestData = {
384
+ data: data,
385
+ id: id,
386
+ };
387
+ const confirmationRequest = client.post(`/api/v1/learningcontent/updatepartialcontent/${id}`, requestData, {
388
+ headers: { authorization: token },
389
+ });
390
+ confirmationRequest
391
+ .then((response) => {
392
+ resolve(response.data);
393
+ })
394
+ .catch((error) => {
395
+ reject(error);
396
+ });
397
+ });
398
+ };
399
+ /**
400
+ * Set the content for a specific learning activity
401
+ * @param {String} id
402
+ * @param {String} learningcontentid
403
+ * @param {String} microSkillId
404
+ * @param {Object} data
405
+ * @param {String} token
406
+ * @returns {Promise<String>} OK word if the operation was successful
407
+ */
408
+ export const setLearningContentLearningContentInformation = (id, learningcontentid, microSkillId, data, token) => {
409
+ return new Promise((resolve, reject) => {
410
+ const requestData = {
411
+ data: data,
412
+ id: id,
413
+ learningcontentid: learningcontentid,
414
+ microSkillId: microSkillId,
415
+ };
416
+ const confirmationRequest = client.post(`/api/v1/learningcontent/updatelearningcontent/`, requestData, {
417
+ headers: { authorization: token },
418
+ });
419
+ confirmationRequest
420
+ .then((response) => {
421
+ resolve(response.data);
422
+ })
423
+ .catch((error) => {
424
+ reject(error);
425
+ });
426
+ });
427
+ };
428
+ /**
429
+ * Set all the learning content for a specific micro skill
430
+ * @param {String} id
431
+ * @param {String} microskillid
432
+ * @param {Object} data
433
+ * @param {String} token
434
+ * @returns {Promise<String>} OK word if the operation was successful
435
+ */
436
+ export const setLearningContentLearningMicroSkillContentInformation = (id, microskillid, data, token) => {
437
+ return new Promise((resolve, reject) => {
438
+ const requestData = {
439
+ data: data,
440
+ };
441
+ const confirmationRequest = client.post(`/api/v1/learningcontent/updatemicroskilllearningcontent/${id}/${microskillid}`, requestData, {
442
+ headers: { authorization: token },
443
+ });
444
+ confirmationRequest
445
+ .then((response) => {
446
+ resolve(response.data);
447
+ })
448
+ .catch((error) => {
449
+ reject(error);
450
+ });
451
+ });
452
+ };
453
+ /**
454
+ * Update the learning content tags
455
+ * @param {String} id The id of the learning to be updated
456
+ * @param {Object} tags Updated learning content tags
457
+ * @param {String} token Authorization token
458
+ */
459
+ export const setLearningContentTags = (id, tags, token) => {
460
+ return new Promise((resolve, reject) => {
461
+ const requestData = {
462
+ tags: tags,
463
+ id: id,
464
+ };
465
+ const confirmationRequest = client.post(`/api/v1/learningcontent/updatetags/`, requestData, {
466
+ headers: { authorization: token },
467
+ });
468
+ confirmationRequest
469
+ .then((response) => {
470
+ resolve(response.data);
471
+ })
472
+ .catch((error) => {
473
+ reject(error);
474
+ });
475
+ });
476
+ };
477
+ /**
478
+ * Upload media for a specific micro skill learning content activity
479
+ * @param {String} id
480
+ * @param {String} microskillid
481
+ * @param {String} activityId
482
+ * @param {String} mediaId
483
+ * @param {Blob} blob
484
+ * @param {String} token
485
+ * @returns {Promise<object>} The response from the server
486
+ */
487
+ export const uploadLearningContentMicroSkillLearningContentActivityMedia = (id, microskillid, activityId, mediaId, blob, token) => {
488
+ const formData = new FormData();
489
+ formData.append("file", blob, "media.bin");
490
+ return new Promise((resolve, reject) => {
491
+ const confirmationRequest = client.post(`/api/v1/learningcontent/media/${id}/${microskillid}/${activityId}/${mediaId}`, formData, {
492
+ headers: {
493
+ authorization: token,
494
+ "Content-Type": "multipart/form-data",
495
+ },
496
+ });
497
+ confirmationRequest
498
+ .then((response) => {
499
+ resolve(response.data);
500
+ })
501
+ .catch((error) => {
502
+ reject(error);
503
+ });
504
+ });
505
+ };
506
+ /**
507
+ * Generate lab configuration content
508
+ * @param {String} skillId The id of the skill
509
+ * @param {String} proficiencyLevel The proficiency level
510
+ * @param {Number} labType The lab type
511
+ * @param {Object} labConfiguration The lab configuration
512
+ * @param {String} token Authorization token
513
+ * @param {String} integrationId Optional integration id
514
+ * @param {Function} onProgressStatus Optional callback for progress updates
515
+ * @returns {Promise<object>} The generated content
516
+ */
517
+ export const generateLabConfigurationContent = (skillId, proficiencyLevel, labType, labConfiguration, token, integrationId, onProgressStatus) => {
518
+ return new Promise((resolve, reject) => {
519
+ const requestData = {
520
+ skillId: skillId,
521
+ proficiencyLevel: proficiencyLevel,
522
+ labType: labType,
523
+ labConfiguration: labConfiguration,
524
+ };
525
+ if (integrationId) {
526
+ requestData.integrationId = integrationId;
527
+ }
528
+ // Use socket.io for real-time progress updates
529
+ const socket = io(getBaseUrl(), {
530
+ auth: {
531
+ token: token,
532
+ },
533
+ path: `/api/v1/realtime`,
534
+ transports: ["websocket"],
535
+ withCredentials: true,
536
+ reconnection: false,
537
+ });
538
+ // Socket event handlers
539
+ socket.on("connect", () => {
540
+ socket.emit("generatelabconfigurationcontent", requestData);
541
+ });
542
+ socket.on("progress", (data) => {
543
+ if (onProgressStatus) {
544
+ onProgressStatus(data);
545
+ }
546
+ });
547
+ socket.on("complete", (data) => {
548
+ socket.disconnect();
549
+ resolve(data);
550
+ });
551
+ socket.on("error", (err) => {
552
+ socket.disconnect();
553
+ reject(err);
554
+ });
555
+ socket.on("disconnect", (reason) => {
556
+ if (reason !== "io client disconnect") {
557
+ reject(new Error(`Socket disconnected: ${reason}`));
558
+ }
559
+ });
560
+ });
561
+ };
562
+ /**
563
+ * Get media for a specific lab configuration
564
+ * @param {String} id The id of the learning content
565
+ * @param {String} labConfigurationId The id of the lab configuration
566
+ * @param {String} mediaId The id of the media
567
+ * @param {String} token Authorization token
568
+ * @returns {Promise<object>} The response from the server
569
+ */
570
+ export const getLearningContentLabConfigurationMedia = (id, labConfigurationId, mediaId, token) => {
571
+ return new Promise((resolve, reject) => {
572
+ const confirmationRequest = client.get(`/api/v1/learningcontent/media/lab/${id}/${labConfigurationId}/${mediaId}`, {
573
+ headers: {
574
+ authorization: token,
575
+ },
576
+ responseType: "blob",
577
+ });
578
+ confirmationRequest
579
+ .then((response) => {
580
+ resolve(response.data);
581
+ })
582
+ .catch((error) => {
583
+ reject(error);
584
+ });
585
+ });
586
+ };
587
+ /**
588
+ * Upload media for a specific lab configuration
589
+ * @param {String} id The id of the learning content
590
+ * @param {String} labConfigurationId The id of the lab configuration
591
+ * @param {String} mediaId The id of the media
592
+ * @param {Blob} blob The media file to upload
593
+ * @param {String} token Authorization token
594
+ * @returns {Promise<object>} The response from the server
595
+ */
596
+ export const uploadLearningContentLabConfigurationMedia = (id, labConfigurationId, mediaId, blob, token) => {
597
+ const formData = new FormData();
598
+ formData.append("file", blob, "media.bin");
599
+ return new Promise((resolve, reject) => {
600
+ const confirmationRequest = client.post(`/api/v1/learningcontent/media/lab/${id}/${labConfigurationId}/${mediaId}`, formData, {
601
+ headers: {
602
+ authorization: token,
603
+ "Content-Type": "multipart/form-data",
604
+ },
605
+ });
606
+ confirmationRequest
607
+ .then((response) => {
608
+ resolve(response.data);
609
+ })
610
+ .catch((error) => {
611
+ reject(error);
612
+ });
613
+ });
614
+ };
615
+ /**
616
+ * Update a single lab configuration for a specific learning content
617
+ * @param {String} id The id of the learning content
618
+ * @param {String} labConfigurationId The id of the lab configuration
619
+ * @param {Object} data The lab configuration data
620
+ * @param {String} token Authorization token
621
+ * @returns {Promise<object>} The response from the server
622
+ */
623
+ export const updateLearningContentLabConfiguration = (id, labConfigurationId, data, token) => {
624
+ return new Promise((resolve, reject) => {
625
+ const requestData = {
626
+ id: id,
627
+ labConfigurationId: labConfigurationId,
628
+ data: data,
629
+ };
630
+ const confirmationRequest = client.post(`/api/v1/learningcontent/updatelabconfiguration`, requestData, {
631
+ headers: { authorization: token },
632
+ });
633
+ confirmationRequest
634
+ .then((response) => {
635
+ resolve(response.data);
636
+ })
637
+ .catch((error) => {
638
+ reject(error);
639
+ });
640
+ });
641
+ };
642
+ /**
643
+ * Update lab configurations for a specific learning content
644
+ * @param {String} id The id of the learning content
645
+ * @param {Array<Object>} data The lab configurations data
646
+ * @param {String} token Authorization token
647
+ * @returns {Promise<object>} The response from the server
648
+ */
649
+ export const updateLearningContentLabConfigurations = (id, data, token) => {
650
+ return new Promise((resolve, reject) => {
651
+ const requestData = {
652
+ data: data,
653
+ };
654
+ const confirmationRequest = client.post(`/api/v1/learningcontent/updatelabconfigurations/${id}`, requestData, {
655
+ headers: { authorization: token },
656
+ });
657
+ confirmationRequest
658
+ .then((response) => {
659
+ resolve(response.data);
660
+ })
661
+ .catch((error) => {
662
+ reject(error);
663
+ });
664
+ });
665
+ };
666
+ /**
667
+ * Watch learning content
668
+ * @param {String} id The id of the learning content to be updated
669
+ * @param {Boolean} watch Set to true or false
670
+ * @param {String} token Authorization token
671
+ */
672
+ export const watchLearningContent = (id, watch, token) => {
673
+ return new Promise((resolve, reject) => {
674
+ const requestData = {
675
+ id: id,
676
+ watch: watch,
677
+ };
678
+ const confirmationRequest = client.post(`/api/v1/learningcontent/watch`, requestData, {
679
+ headers: { authorization: token },
680
+ });
681
+ confirmationRequest
682
+ .then((response) => {
683
+ resolve(response.data);
684
+ })
685
+ .catch((error) => {
686
+ reject(error);
687
+ });
688
+ });
689
+ };
690
+ //# sourceMappingURL=learningContent.js.map