@learnpack/learnpack 5.0.178 → 5.0.180

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 (32) hide show
  1. package/README.md +13 -13
  2. package/lib/commands/serve.js +32 -18
  3. package/lib/creatorDist/assets/{index-CrWESWmj.css → index-Bnq3eZ3T.css} +13 -3
  4. package/lib/creatorDist/assets/index-hhajeHFt.js +35366 -0
  5. package/lib/creatorDist/index.html +2 -2
  6. package/lib/utils/creatorSocket.d.ts +1 -0
  7. package/lib/utils/creatorSocket.js +24 -0
  8. package/oclif.manifest.json +1 -1
  9. package/package.json +1 -1
  10. package/src/commands/serve.ts +48 -26
  11. package/src/creator/package-lock.json +137 -0
  12. package/src/creator/package.json +1 -0
  13. package/src/creator/src/App.tsx +77 -50
  14. package/src/creator/src/components/ConsumablesManager.tsx +1 -3
  15. package/src/creator/src/components/FileUploader.tsx +136 -44
  16. package/src/creator/src/components/PurposeSelector.tsx +70 -0
  17. package/src/creator/src/components/SelectableCard.tsx +5 -3
  18. package/src/creator/src/components/Uploader.tsx +12 -1
  19. package/src/creator/src/components/syllabus/SyllabusEditor.tsx +6 -12
  20. package/src/creator/src/utils/constants.ts +10 -4
  21. package/src/creator/src/utils/lib.ts +0 -2
  22. package/src/creator/src/utils/rigo.ts +9 -5
  23. package/src/creator/src/utils/socket.ts +61 -0
  24. package/src/creator/src/utils/store.ts +7 -1
  25. package/src/creatorDist/assets/{index-CrWESWmj.css → index-Bnq3eZ3T.css} +13 -3
  26. package/src/creatorDist/assets/index-hhajeHFt.js +35366 -0
  27. package/src/creatorDist/index.html +2 -2
  28. package/src/ui/_app/app.js +19 -8
  29. package/src/ui/app.tar.gz +0 -0
  30. package/src/utils/creatorSocket.ts +30 -0
  31. package/lib/creatorDist/assets/index-BvrB0WCf.js +0 -32991
  32. package/src/creatorDist/assets/index-BvrB0WCf.js +0 -32991
@@ -37,8 +37,6 @@ export function parseLesson(input: string, previous: Lesson[]): Lesson | null {
37
37
  }
38
38
  }
39
39
 
40
- export const CREATOR_API_URL = "http://localhost:3000"
41
-
42
40
  export const uploadFileToBucket = async (content: string, path: string) => {
43
41
  const response = await axios.post(`/upload`, {
44
42
  content,
@@ -1,5 +1,5 @@
1
1
  import toast from "react-hot-toast"
2
- import { RIGOBOT_HOST } from "./constants"
2
+ import { RIGOBOT_HOST, DEV_MODE } from "./constants"
3
3
  import axios, { AxiosError } from "axios"
4
4
 
5
5
  type TInteractiveCreationInputs = {
@@ -9,20 +9,24 @@ type TInteractiveCreationInputs = {
9
9
 
10
10
  export const publicInteractiveCreation = async (
11
11
  inputs: TInteractiveCreationInputs,
12
- publicToken: string
12
+ publicToken: string,
13
+ purposeSlug: string
13
14
  ): Promise<any | null> => {
14
15
  try {
15
16
  const response = await axios.post(
16
- `${RIGOBOT_HOST}/v1/prompting/public/completion/390/`,
17
+ `${RIGOBOT_HOST}/v1/prompting/public/completion/${
18
+ DEV_MODE ? "39" : "390"
19
+ }/`,
17
20
  {
18
21
  inputs: inputs,
19
- include_purpose_objective: false,
22
+ include_purpose_objective: true,
20
23
  execute_async: false,
24
+ purpose_slug: purposeSlug,
21
25
  },
22
26
  {
23
27
  headers: {
24
28
  "Content-Type": "application/json",
25
- Authorization: `Bearer ${publicToken}`,
29
+ Authorization: `Token ${publicToken}`,
26
30
  },
27
31
  }
28
32
  )
@@ -0,0 +1,61 @@
1
+ import { io, Socket } from "socket.io-client"
2
+
3
+ type EventCallback = (...args: any[]) => void
4
+
5
+ class CreatorSocket {
6
+ private socket: Socket | null = null
7
+ private readonly url: string
8
+
9
+ constructor(url: string) {
10
+ this.url = url
11
+ }
12
+
13
+ /**
14
+ * Conecta manualmente al servidor de websockets
15
+ */
16
+ connect() {
17
+ if (this.socket) return
18
+ this.socket = io(this.url, { autoConnect: false, path: "/sockete" })
19
+ this.socket.connect()
20
+ }
21
+
22
+ /**
23
+ * Desconecta del servidor
24
+ */
25
+ disconnect() {
26
+ if (this.socket) {
27
+ this.socket.disconnect()
28
+ this.socket = null
29
+ }
30
+ }
31
+
32
+ /**
33
+ * Verifica si está conectado
34
+ */
35
+ isConnected(): boolean {
36
+ return !!this.socket?.connected
37
+ }
38
+
39
+ /**
40
+ * Registra un evento personalizado
41
+ */
42
+ on(event: string, callback: EventCallback) {
43
+ this.socket?.on(event, callback)
44
+ }
45
+
46
+ /**
47
+ * Emite un evento al servidor
48
+ */
49
+ emit(event: string, ...args: any[]) {
50
+ this.socket?.emit(event, ...args)
51
+ }
52
+
53
+ /**
54
+ * Elimina un evento registrado
55
+ */
56
+ off(event: string, callback?: EventCallback) {
57
+ this.socket?.off(event, callback)
58
+ }
59
+ }
60
+
61
+ export default CreatorSocket
@@ -2,6 +2,7 @@ import { create } from "zustand"
2
2
  import { persist } from "zustand/middleware"
3
3
  import { Lesson } from "../components/LessonItem"
4
4
  import { ParsedFile } from "../components/FileUploader"
5
+ import { TMessage } from "../components/Message"
5
6
  // import { ParsedLink } from "../components/LinkUploader"
6
7
 
7
8
  export type FormState = {
@@ -10,6 +11,7 @@ export type FormState = {
10
11
  targetAudience: string
11
12
  hasContentIndex: boolean
12
13
  contentIndex: string
14
+ purpose: string
13
15
  // sources: ParsedLink[]
14
16
  isCompleted: boolean
15
17
  variables: string[]
@@ -28,7 +30,7 @@ type Auth = {
28
30
  export type Syllabus = {
29
31
  lessons: Lesson[]
30
32
  courseInfo: FormState
31
- sources: ParsedFile[]
33
+ messages: TMessage[]
32
34
  }
33
35
 
34
36
  type Consumables = {
@@ -80,12 +82,14 @@ const useStore = create<Store>()(
80
82
  targetAudience: "",
81
83
  hasContentIndex: false,
82
84
  contentIndex: "",
85
+ purpose: "",
83
86
  // sources: [],
84
87
  isCompleted: false,
85
88
  currentStep: "description",
86
89
  variables: [
87
90
  "description",
88
91
  "duration",
92
+ "purpose",
89
93
  "hasContentIndex",
90
94
  "verifyHuman",
91
95
  ],
@@ -101,10 +105,12 @@ const useStore = create<Store>()(
101
105
  targetAudience: "",
102
106
  hasContentIndex: false,
103
107
  contentIndex: "",
108
+ purpose: "",
104
109
  isCompleted: false,
105
110
  variables: [
106
111
  "description",
107
112
  "duration",
113
+ "purpose",
108
114
  "hasContentIndex",
109
115
  "verifyHuman",
110
116
  ],
@@ -55,6 +55,7 @@
55
55
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
56
56
  "Liberation Mono", "Courier New", monospace;
57
57
  --color-red-50: oklch(97.1% 0.013 17.38);
58
+ --color-red-100: oklch(93.6% 0.032 17.717);
58
59
  --color-red-500: oklch(63.7% 0.237 25.331);
59
60
  --color-red-600: oklch(57.7% 0.245 27.325);
60
61
  --color-red-700: oklch(50.5% 0.213 27.518);
@@ -435,9 +436,6 @@
435
436
  .z-1000 {
436
437
  z-index: 1000;
437
438
  }
438
- .float-right {
439
- float: right;
440
- }
441
439
  .container {
442
440
  width: 100%;
443
441
  }
@@ -868,6 +866,9 @@
868
866
  .bg-gray-50 {
869
867
  background-color: var(--color-gray-50);
870
868
  }
869
+ .bg-gray-100 {
870
+ background-color: var(--color-gray-100);
871
+ }
871
872
  .bg-gray-200 {
872
873
  background-color: var(--color-gray-200);
873
874
  }
@@ -880,6 +881,9 @@
880
881
  .bg-red-50 {
881
882
  background-color: var(--color-red-50);
882
883
  }
884
+ .bg-red-100 {
885
+ background-color: var(--color-red-100);
886
+ }
883
887
  .bg-white {
884
888
  background-color: var(--color-white);
885
889
  }
@@ -1172,6 +1176,9 @@
1172
1176
  .hover\:text-gray-900:hover {
1173
1177
  color: var(--color-gray-900);
1174
1178
  }
1179
+ .hover\:text-red-500:hover {
1180
+ color: var(--color-red-500);
1181
+ }
1175
1182
  .hover\:text-red-700:hover {
1176
1183
  color: var(--color-red-700);
1177
1184
  }
@@ -1200,6 +1207,9 @@
1200
1207
  .disabled\:opacity-40:disabled {
1201
1208
  opacity: 0.4;
1202
1209
  }
1210
+ .disabled\:opacity-50:disabled {
1211
+ opacity: 0.5;
1212
+ }
1203
1213
  @media (min-width: 40rem) {
1204
1214
  .sm\:w-auto {
1205
1215
  width: auto;