@learnpack/learnpack 5.0.298 → 5.0.301

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 (84) hide show
  1. package/README.md +409 -409
  2. package/lib/commands/audit.js +15 -15
  3. package/lib/commands/breakToken.js +19 -19
  4. package/lib/commands/clean.js +3 -3
  5. package/lib/commands/logout.js +3 -3
  6. package/lib/commands/serve.js +32 -13
  7. package/lib/creatorDist/assets/{index-D25zkBaN.js → index-DoYRptnk.js} +11875 -11992
  8. package/lib/creatorDist/index.html +1 -1
  9. package/lib/managers/config/index.js +77 -77
  10. package/lib/utils/creatorUtilities.js +14 -14
  11. package/lib/utils/templates/isolated/exercises/01-hello-world/README.es.md +26 -26
  12. package/lib/utils/templates/isolated/exercises/01-hello-world/README.md +26 -26
  13. package/lib/utils/templates/scorm/adlcp_rootv1p2.xsd +110 -110
  14. package/lib/utils/templates/scorm/config/index.html +209 -209
  15. package/lib/utils/templates/scorm/ims_xml.xsd +1 -1
  16. package/lib/utils/templates/scorm/imscp_rootv1p1p2.xsd +345 -345
  17. package/lib/utils/templates/scorm/imsmanifest.xml +38 -38
  18. package/lib/utils/templates/scorm/imsmd_rootv1p2p1.xsd +573 -573
  19. package/package.json +1 -1
  20. package/src/commands/audit.ts +487 -487
  21. package/src/commands/breakToken.ts +67 -67
  22. package/src/commands/clean.ts +30 -30
  23. package/src/commands/logout.ts +38 -38
  24. package/src/commands/serve.ts +49 -27
  25. package/src/commands/start.ts +333 -333
  26. package/src/commands/translate.ts +123 -123
  27. package/src/creator/README.md +54 -54
  28. package/src/creator/package-lock.json +6621 -6621
  29. package/src/creator/package.json +55 -55
  30. package/src/creator/src/App.tsx +569 -569
  31. package/src/creator/src/components/FileUploader.tsx +302 -302
  32. package/src/creator/src/components/Icon.tsx +18 -18
  33. package/src/creator/src/components/LessonItem.tsx +152 -152
  34. package/src/creator/src/components/Login.tsx +259 -259
  35. package/src/creator/src/components/syllabus/ContentIndex.tsx +323 -323
  36. package/src/creator/src/components/syllabus/SyllabusEditor.tsx +337 -337
  37. package/src/creator/src/i18n.ts +28 -28
  38. package/src/creator/src/locales/en.json +127 -127
  39. package/src/creator/src/locales/es.json +127 -127
  40. package/src/creator/src/utils/configTypes.ts +122 -122
  41. package/src/creator/src/utils/constants.ts +13 -13
  42. package/src/creator/src/utils/creatorUtils.ts +46 -46
  43. package/src/creator/src/utils/eventBus.ts +2 -2
  44. package/src/creator/src/utils/socket.ts +61 -61
  45. package/src/creator/src/utils/store.ts +222 -222
  46. package/src/creator/src/vite-env.d.ts +1 -1
  47. package/src/creator/vite.config.ts +13 -13
  48. package/src/creatorDist/assets/{index-D25zkBaN.js → index-DoYRptnk.js} +11875 -11992
  49. package/src/creatorDist/index.html +1 -1
  50. package/src/managers/config/defaults.ts +49 -49
  51. package/src/managers/config/exercise.ts +364 -364
  52. package/src/managers/config/index.ts +775 -775
  53. package/src/managers/file.ts +236 -236
  54. package/src/managers/server/routes.ts +554 -554
  55. package/src/managers/telemetry.ts +188 -188
  56. package/src/models/action.ts +13 -13
  57. package/src/models/config-manager.ts +28 -28
  58. package/src/models/config.ts +106 -106
  59. package/src/models/exercise-obj.ts +30 -30
  60. package/src/models/session.ts +39 -39
  61. package/src/models/socket.ts +61 -61
  62. package/src/models/status.ts +16 -16
  63. package/src/ui/_app/app.css +1 -1
  64. package/src/ui/_app/app.js +768 -768
  65. package/src/ui/_app/learnpack.svg +7 -7
  66. package/src/ui/_app/sw.js +59 -59
  67. package/src/ui/app.tar.gz +0 -0
  68. package/src/utils/BaseCommand.ts +56 -56
  69. package/src/utils/audit.ts +392 -392
  70. package/src/utils/checkNotInstalled.ts +267 -267
  71. package/src/utils/convertCreds.js +34 -34
  72. package/src/utils/creatorUtilities.ts +504 -504
  73. package/src/utils/export/README.md +178 -178
  74. package/src/utils/incrementVersion.js +74 -74
  75. package/src/utils/misc.ts +58 -58
  76. package/src/utils/sidebarGenerator.ts +195 -195
  77. package/src/utils/templates/isolated/exercises/01-hello-world/README.es.md +26 -26
  78. package/src/utils/templates/isolated/exercises/01-hello-world/README.md +26 -26
  79. package/src/utils/templates/scorm/adlcp_rootv1p2.xsd +110 -110
  80. package/src/utils/templates/scorm/config/index.html +209 -209
  81. package/src/utils/templates/scorm/ims_xml.xsd +1 -1
  82. package/src/utils/templates/scorm/imscp_rootv1p1p2.xsd +345 -345
  83. package/src/utils/templates/scorm/imsmanifest.xml +38 -38
  84. package/src/utils/templates/scorm/imsmd_rootv1p2p1.xsd +573 -573
@@ -1,222 +1,222 @@
1
- import { create } from "zustand"
2
- import { persist } from "zustand/middleware"
3
- import { Lesson } from "../components/LessonItem"
4
- import { ParsedFile } from "../components/FileUploader"
5
- import { TMessage } from "../components/Message"
6
- // import { ParsedLink } from "../components/LinkUploader"
7
- export type TDifficulty = "easy" | "beginner" | "intermediate" | "hard"
8
-
9
- export type FormState = {
10
- description: string
11
- duration: number
12
- hasContentIndex: boolean
13
- contentIndex: string
14
- purpose: string
15
- difficulty: TDifficulty
16
- slug: string
17
- language?: string
18
- isCompleted: boolean
19
- variables: string[]
20
- currentStep: string
21
- title?: string
22
- technologies?: string[]
23
- }
24
-
25
- type Auth = {
26
- bcToken: string
27
- rigoToken: string
28
- userId: string
29
- user: any
30
- publicToken: string
31
- }
32
- export type Syllabus = {
33
- lessons: Lesson[]
34
- courseInfo: FormState
35
- // messages: TMessage[]
36
- }
37
-
38
- type Consumables = {
39
- [key: string]: number
40
- }
41
-
42
- type TTechnology = {
43
- slug: string
44
- lang: string
45
- }
46
-
47
- type Store = {
48
- auth: Auth
49
- formState: FormState
50
- setFormState: (formState: Partial<FormState>) => void
51
- resetFormState: () => void
52
- setAuth: (auth: Auth) => void
53
- // syllabus: Syllabus
54
- planToRedirect: string
55
- setPlanToRedirect: (planToRedirect: string) => void
56
- uploadedFiles: ParsedFile[]
57
- setUploadedFiles: (uploadedFiles: ParsedFile[]) => void
58
- messages: TMessage[]
59
- setMessages: (
60
- messages: TMessage[] | ((prev: TMessage[]) => TMessage[])
61
- ) => void
62
- cleanHistory: () => void
63
- history: Syllabus[]
64
- technologies: TTechnology[]
65
- setTechnologies: (technologies: TTechnology[]) => void
66
- undo: () => void
67
- push: (syllabus: Syllabus) => void
68
- cleanAll: () => void
69
- // setSyllabus: (syllabus: Partial<Syllabus>) => void
70
- consumables: Consumables
71
- setConsumables: (consumables: Partial<Consumables>) => void
72
- mode: "student" | "teacher"
73
- setMode: (mode: "student" | "teacher") => void
74
- }
75
-
76
- const useStore = create<Store>()(
77
- persist(
78
- (set) => ({
79
- auth: {
80
- bcToken: "",
81
- rigoToken: "",
82
- userId: "",
83
- user: null,
84
- publicToken: "",
85
- },
86
- planToRedirect: "learnpack-creator",
87
- setPlanToRedirect: (planToRedirect: string) => set({ planToRedirect }),
88
- formState: {
89
- description: "",
90
- duration: 0,
91
- slug: "",
92
- hasContentIndex: false,
93
- contentIndex: "",
94
- purpose: "",
95
- language: "en",
96
- technologies: [],
97
- difficulty: "beginner",
98
- // sources: [],
99
- isCompleted: false,
100
- currentStep: "description",
101
- variables: [
102
- "description",
103
- "duration",
104
- "purpose",
105
- "hasContentIndex",
106
- "verifyHuman",
107
- ],
108
- },
109
- messages: [],
110
- technologies: [],
111
- setTechnologies: (technologies: TTechnology[]) => set({ technologies }),
112
- setMessages: (
113
- messages: TMessage[] | ((prev: TMessage[]) => TMessage[])
114
- ) => {
115
- set((state) => ({
116
- messages:
117
- typeof messages === "function"
118
- ? messages(state.messages)
119
- : messages,
120
- }))
121
- },
122
- setFormState: (formState: Partial<FormState>) =>
123
- set((state) => ({ formState: { ...state.formState, ...formState } })),
124
- resetFormState: () =>
125
- set({
126
- formState: {
127
- slug: "",
128
- currentStep: "description",
129
- description: "",
130
- duration: 0,
131
- language: "en",
132
- difficulty: "beginner",
133
- technologies: [],
134
- hasContentIndex: false,
135
- contentIndex: "",
136
- purpose: "",
137
- isCompleted: false,
138
- variables: [
139
- "description",
140
- "duration",
141
- "purpose",
142
- "hasContentIndex",
143
- "verifyHuman",
144
- ],
145
- },
146
- }),
147
-
148
- setUploadedFiles: (uploadedFiles) =>
149
- set(() => ({
150
- uploadedFiles: [...uploadedFiles],
151
- })),
152
- uploadedFiles: [],
153
- history: [],
154
- push: (syllabus: Syllabus) => {
155
- set((state) => ({
156
- history: [...state.history, syllabus],
157
- }))
158
- },
159
-
160
- undo: () => {
161
- set((state) => {
162
- return {
163
- history: state.history.slice(0, -1),
164
- }
165
- })
166
- },
167
- cleanHistory: () => {
168
- set(() => ({ history: [] }))
169
- },
170
- cleanAll: () => {
171
- set({
172
- uploadedFiles: [],
173
- messages: [],
174
- history: [],
175
- technologies: [],
176
- formState: {
177
- description: "",
178
- duration: 0,
179
- slug: "",
180
- difficulty: "beginner",
181
- language: "en",
182
- technologies: [],
183
- hasContentIndex: false,
184
- contentIndex: "",
185
- purpose: "",
186
- isCompleted: false,
187
- variables: [
188
- "description",
189
- "duration",
190
- "purpose",
191
- "hasContentIndex",
192
- "verifyHuman",
193
- ],
194
- currentStep: "description",
195
- },
196
- })
197
- },
198
- consumables: {},
199
- setConsumables: (consumables: Partial<Consumables>) =>
200
- set((state) => {
201
- const sanitized: Consumables = Object.fromEntries(
202
- Object.entries(consumables).map(([k, v]) => [k, v ?? 0])
203
- )
204
- return {
205
- consumables: {
206
- ...state.consumables,
207
- ...sanitized,
208
- },
209
- }
210
- }),
211
-
212
- setAuth: (auth: Auth) => set({ auth }),
213
- mode: "student",
214
- setMode: (mode: "student" | "teacher") => set({ mode }),
215
- }),
216
- {
217
- name: "syllabus-storage",
218
- }
219
- )
220
- )
221
-
222
- export default useStore
1
+ import { create } from "zustand"
2
+ import { persist } from "zustand/middleware"
3
+ import { Lesson } from "../components/LessonItem"
4
+ import { ParsedFile } from "../components/FileUploader"
5
+ import { TMessage } from "../components/Message"
6
+ // import { ParsedLink } from "../components/LinkUploader"
7
+ export type TDifficulty = "easy" | "beginner" | "intermediate" | "hard"
8
+
9
+ export type FormState = {
10
+ description: string
11
+ duration: number
12
+ hasContentIndex: boolean
13
+ contentIndex: string
14
+ purpose: string
15
+ difficulty: TDifficulty
16
+ slug: string
17
+ language?: string
18
+ isCompleted: boolean
19
+ variables: string[]
20
+ currentStep: string
21
+ title?: string
22
+ technologies?: string[]
23
+ }
24
+
25
+ type Auth = {
26
+ bcToken: string
27
+ rigoToken: string
28
+ userId: string
29
+ user: any
30
+ publicToken: string
31
+ }
32
+ export type Syllabus = {
33
+ lessons: Lesson[]
34
+ courseInfo: FormState
35
+ // messages: TMessage[]
36
+ }
37
+
38
+ type Consumables = {
39
+ [key: string]: number
40
+ }
41
+
42
+ type TTechnology = {
43
+ slug: string
44
+ lang: string
45
+ }
46
+
47
+ type Store = {
48
+ auth: Auth
49
+ formState: FormState
50
+ setFormState: (formState: Partial<FormState>) => void
51
+ resetFormState: () => void
52
+ setAuth: (auth: Auth) => void
53
+ // syllabus: Syllabus
54
+ planToRedirect: string
55
+ setPlanToRedirect: (planToRedirect: string) => void
56
+ uploadedFiles: ParsedFile[]
57
+ setUploadedFiles: (uploadedFiles: ParsedFile[]) => void
58
+ messages: TMessage[]
59
+ setMessages: (
60
+ messages: TMessage[] | ((prev: TMessage[]) => TMessage[])
61
+ ) => void
62
+ cleanHistory: () => void
63
+ history: Syllabus[]
64
+ technologies: TTechnology[]
65
+ setTechnologies: (technologies: TTechnology[]) => void
66
+ undo: () => void
67
+ push: (syllabus: Syllabus) => void
68
+ cleanAll: () => void
69
+ // setSyllabus: (syllabus: Partial<Syllabus>) => void
70
+ consumables: Consumables
71
+ setConsumables: (consumables: Partial<Consumables>) => void
72
+ mode: "student" | "teacher"
73
+ setMode: (mode: "student" | "teacher") => void
74
+ }
75
+
76
+ const useStore = create<Store>()(
77
+ persist(
78
+ (set) => ({
79
+ auth: {
80
+ bcToken: "",
81
+ rigoToken: "",
82
+ userId: "",
83
+ user: null,
84
+ publicToken: "",
85
+ },
86
+ planToRedirect: "learnpack-creator",
87
+ setPlanToRedirect: (planToRedirect: string) => set({ planToRedirect }),
88
+ formState: {
89
+ description: "",
90
+ duration: 0,
91
+ slug: "",
92
+ hasContentIndex: false,
93
+ contentIndex: "",
94
+ purpose: "",
95
+ language: "en",
96
+ technologies: [],
97
+ difficulty: "beginner",
98
+ // sources: [],
99
+ isCompleted: false,
100
+ currentStep: "description",
101
+ variables: [
102
+ "description",
103
+ "duration",
104
+ "purpose",
105
+ "hasContentIndex",
106
+ "verifyHuman",
107
+ ],
108
+ },
109
+ messages: [],
110
+ technologies: [],
111
+ setTechnologies: (technologies: TTechnology[]) => set({ technologies }),
112
+ setMessages: (
113
+ messages: TMessage[] | ((prev: TMessage[]) => TMessage[])
114
+ ) => {
115
+ set((state) => ({
116
+ messages:
117
+ typeof messages === "function"
118
+ ? messages(state.messages)
119
+ : messages,
120
+ }))
121
+ },
122
+ setFormState: (formState: Partial<FormState>) =>
123
+ set((state) => ({ formState: { ...state.formState, ...formState } })),
124
+ resetFormState: () =>
125
+ set({
126
+ formState: {
127
+ slug: "",
128
+ currentStep: "description",
129
+ description: "",
130
+ duration: 0,
131
+ language: "en",
132
+ difficulty: "beginner",
133
+ technologies: [],
134
+ hasContentIndex: false,
135
+ contentIndex: "",
136
+ purpose: "",
137
+ isCompleted: false,
138
+ variables: [
139
+ "description",
140
+ "duration",
141
+ "purpose",
142
+ "hasContentIndex",
143
+ "verifyHuman",
144
+ ],
145
+ },
146
+ }),
147
+
148
+ setUploadedFiles: (uploadedFiles) =>
149
+ set(() => ({
150
+ uploadedFiles: [...uploadedFiles],
151
+ })),
152
+ uploadedFiles: [],
153
+ history: [],
154
+ push: (syllabus: Syllabus) => {
155
+ set((state) => ({
156
+ history: [...state.history, syllabus],
157
+ }))
158
+ },
159
+
160
+ undo: () => {
161
+ set((state) => {
162
+ return {
163
+ history: state.history.slice(0, -1),
164
+ }
165
+ })
166
+ },
167
+ cleanHistory: () => {
168
+ set(() => ({ history: [] }))
169
+ },
170
+ cleanAll: () => {
171
+ set({
172
+ uploadedFiles: [],
173
+ messages: [],
174
+ history: [],
175
+ technologies: [],
176
+ formState: {
177
+ description: "",
178
+ duration: 0,
179
+ slug: "",
180
+ difficulty: "beginner",
181
+ language: "en",
182
+ technologies: [],
183
+ hasContentIndex: false,
184
+ contentIndex: "",
185
+ purpose: "",
186
+ isCompleted: false,
187
+ variables: [
188
+ "description",
189
+ "duration",
190
+ "purpose",
191
+ "hasContentIndex",
192
+ "verifyHuman",
193
+ ],
194
+ currentStep: "description",
195
+ },
196
+ })
197
+ },
198
+ consumables: {},
199
+ setConsumables: (consumables: Partial<Consumables>) =>
200
+ set((state) => {
201
+ const sanitized: Consumables = Object.fromEntries(
202
+ Object.entries(consumables).map(([k, v]) => [k, v ?? 0])
203
+ )
204
+ return {
205
+ consumables: {
206
+ ...state.consumables,
207
+ ...sanitized,
208
+ },
209
+ }
210
+ }),
211
+
212
+ setAuth: (auth: Auth) => set({ auth }),
213
+ mode: "student",
214
+ setMode: (mode: "student" | "teacher") => set({ mode }),
215
+ }),
216
+ {
217
+ name: "syllabus-storage",
218
+ }
219
+ )
220
+ )
221
+
222
+ export default useStore
@@ -1 +1 @@
1
- /// <reference types="vite/client" />
1
+ /// <reference types="vite/client" />
@@ -1,13 +1,13 @@
1
- import { defineConfig } from "vite"
2
- import react from "@vitejs/plugin-react-swc"
3
- import tailwindcss from "@tailwindcss/vite"
4
-
5
- // https://vite.dev/config/
6
- export default defineConfig({
7
- plugins: [react(), tailwindcss()],
8
- base: "/creator/",
9
- build: {
10
- outDir: "../creatorDist",
11
- emptyOutDir: true,
12
- },
13
- })
1
+ import { defineConfig } from "vite"
2
+ import react from "@vitejs/plugin-react-swc"
3
+ import tailwindcss from "@tailwindcss/vite"
4
+
5
+ // https://vite.dev/config/
6
+ export default defineConfig({
7
+ plugins: [react(), tailwindcss()],
8
+ base: "/creator/",
9
+ build: {
10
+ outDir: "../creatorDist",
11
+ emptyOutDir: true,
12
+ },
13
+ })