@learnpack/learnpack 5.0.178 → 5.0.182

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-Bf-gM0Dm.js +35364 -0
  4. package/lib/creatorDist/assets/{index-CrWESWmj.css → index-Bnq3eZ3T.css} +13 -3
  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 +78 -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-Bf-gM0Dm.js +35364 -0
  26. package/src/creatorDist/assets/{index-CrWESWmj.css → index-Bnq3eZ3T.css} +13 -3
  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
  ],