@learnpack/learnpack 5.0.172 → 5.0.178

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 (33) hide show
  1. package/README.md +13 -13
  2. package/lib/commands/serve.js +42 -2
  3. package/lib/creatorDist/assets/index-BvrB0WCf.js +32991 -0
  4. package/{src/creatorDist/assets/index-C_YTggyk.css → lib/creatorDist/assets/index-CrWESWmj.css} +43 -11
  5. package/lib/creatorDist/index.html +2 -2
  6. package/lib/utils/api.js +1 -0
  7. package/lib/utils/readDocuments.d.ts +0 -0
  8. package/lib/utils/readDocuments.js +1 -0
  9. package/oclif.manifest.json +1 -1
  10. package/package.json +3 -1
  11. package/src/commands/serve.ts +56 -2
  12. package/src/creator/src/App.tsx +51 -33
  13. package/src/creator/src/components/ConsumablesManager.tsx +1 -0
  14. package/src/creator/src/components/FileUploader.tsx +64 -52
  15. package/src/creator/src/components/Login.tsx +172 -82
  16. package/src/creator/src/components/ResumeCourseModal.tsx +38 -0
  17. package/src/creator/src/components/StepWizard.tsx +12 -10
  18. package/src/creator/src/components/TurnstileChallenge.tsx +2 -7
  19. package/src/creator/src/components/syllabus/ContentIndex.tsx +1 -0
  20. package/src/creator/src/components/syllabus/SyllabusEditor.tsx +54 -20
  21. package/src/creator/src/utils/constants.ts +1 -0
  22. package/src/creator/src/utils/lib.ts +55 -0
  23. package/src/creator/src/utils/rigo.ts +11 -4
  24. package/src/creator/src/utils/store.ts +22 -1
  25. package/src/creatorDist/assets/index-BvrB0WCf.js +32991 -0
  26. package/{lib/creatorDist/assets/index-C_YTggyk.css → src/creatorDist/assets/index-CrWESWmj.css} +43 -11
  27. package/src/creatorDist/index.html +2 -2
  28. package/src/utils/api.ts +1 -0
  29. package/src/utils/readDocuments.ts +0 -0
  30. package/lib/creatorDist/assets/index-CCvMFC6N.js +0 -83701
  31. package/lib/creatorDist/assets/pdf.worker-DSVOJ9H9.js +0 -56037
  32. package/src/creatorDist/assets/index-CCvMFC6N.js +0 -83701
  33. package/src/creatorDist/assets/pdf.worker-DSVOJ9H9.js +0 -56037
@@ -58,8 +58,6 @@
58
58
  --color-red-500: oklch(63.7% 0.237 25.331);
59
59
  --color-red-600: oklch(57.7% 0.245 27.325);
60
60
  --color-red-700: oklch(50.5% 0.213 27.518);
61
- --color-sky-500: oklch(68.5% 0.169 237.323);
62
- --color-sky-600: oklch(58.8% 0.158 241.966);
63
61
  --color-blue-50: oklch(97% 0.014 254.604);
64
62
  --color-blue-100: oklch(93.2% 0.032 255.585);
65
63
  --color-blue-200: oklch(88.2% 0.059 254.128);
@@ -510,6 +508,9 @@
510
508
  .mb-2 {
511
509
  margin-bottom: calc(var(--spacing) * 2);
512
510
  }
511
+ .mb-3 {
512
+ margin-bottom: calc(var(--spacing) * 3);
513
+ }
513
514
  .mb-4 {
514
515
  margin-bottom: calc(var(--spacing) * 4);
515
516
  }
@@ -537,6 +538,9 @@
537
538
  .h-2 {
538
539
  height: calc(var(--spacing) * 2);
539
540
  }
541
+ .h-4 {
542
+ height: calc(var(--spacing) * 4);
543
+ }
540
544
  .h-5 {
541
545
  height: calc(var(--spacing) * 5);
542
546
  }
@@ -588,6 +592,9 @@
588
592
  .w-2 {
589
593
  width: calc(var(--spacing) * 2);
590
594
  }
595
+ .w-4 {
596
+ width: calc(var(--spacing) * 4);
597
+ }
591
598
  .w-4\/5 {
592
599
  width: 80%;
593
600
  }
@@ -715,6 +722,9 @@
715
722
  .gap-3 {
716
723
  gap: calc(var(--spacing) * 3);
717
724
  }
725
+ .gap-4 {
726
+ gap: calc(var(--spacing) * 4);
727
+ }
718
728
  :where(.space-y-2 > :not(:last-child)) {
719
729
  --tw-space-y-reverse: 0;
720
730
  margin-block-start: calc(
@@ -810,12 +820,12 @@
810
820
  .border-gray-300 {
811
821
  border-color: var(--color-gray-300);
812
822
  }
813
- .border-sky-500 {
814
- border-color: var(--color-sky-500);
815
- }
816
823
  .border-transparent {
817
824
  border-color: #0000;
818
825
  }
826
+ .border-t-transparent {
827
+ border-top-color: #0000;
828
+ }
819
829
  .bg-black\/50 {
820
830
  background-color: #00000080;
821
831
  }
@@ -828,6 +838,18 @@
828
838
  );
829
839
  }
830
840
  }
841
+ .bg-black\/60 {
842
+ background-color: #0009;
843
+ }
844
+ @supports (color: color-mix(in lab, red, red)) {
845
+ .bg-black\/60 {
846
+ background-color: color-mix(
847
+ in oklab,
848
+ var(--color-black) 60%,
849
+ transparent
850
+ );
851
+ }
852
+ }
831
853
  .bg-blue-50 {
832
854
  background-color: var(--color-blue-50);
833
855
  }
@@ -837,6 +859,9 @@
837
859
  .bg-blue-400 {
838
860
  background-color: var(--color-blue-400);
839
861
  }
862
+ .bg-blue-500 {
863
+ background-color: var(--color-blue-500);
864
+ }
840
865
  .bg-blue-600 {
841
866
  background-color: var(--color-blue-600);
842
867
  }
@@ -855,9 +880,6 @@
855
880
  .bg-red-50 {
856
881
  background-color: var(--color-red-50);
857
882
  }
858
- .bg-sky-500 {
859
- background-color: var(--color-sky-500);
860
- }
861
883
  .bg-white {
862
884
  background-color: var(--color-white);
863
885
  }
@@ -966,6 +988,10 @@
966
988
  font-size: var(--text-sm);
967
989
  line-height: var(--tw-leading, var(--text-sm--line-height));
968
990
  }
991
+ .text-xl {
992
+ font-size: var(--text-xl);
993
+ line-height: var(--tw-leading, var(--text-xl--line-height));
994
+ }
969
995
  .text-xs {
970
996
  font-size: var(--text-xs);
971
997
  line-height: var(--tw-leading, var(--text-xs--line-height));
@@ -1001,6 +1027,9 @@
1001
1027
  .text-blue-600 {
1002
1028
  color: var(--color-blue-600);
1003
1029
  }
1030
+ .text-blue-700 {
1031
+ color: var(--color-blue-700);
1032
+ }
1004
1033
  .text-blue-900 {
1005
1034
  color: var(--color-blue-900);
1006
1035
  }
@@ -1025,9 +1054,6 @@
1025
1054
  .text-red-600 {
1026
1055
  color: var(--color-red-600);
1027
1056
  }
1028
- .text-sky-600 {
1029
- color: var(--color-sky-600);
1030
- }
1031
1057
  .text-white {
1032
1058
  color: var(--color-white);
1033
1059
  }
@@ -1061,6 +1087,12 @@
1061
1087
  box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow),
1062
1088
  var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1063
1089
  }
1090
+ .shadow-xl {
1091
+ --tw-shadow: 0 20px 25px -5px var(--tw-shadow-color, #0000001a),
1092
+ 0 8px 10px -6px var(--tw-shadow-color, #0000001a);
1093
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow),
1094
+ var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1095
+ }
1064
1096
  .transition {
1065
1097
  transition-property: color, background-color, border-color, outline-color,
1066
1098
  text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via,
@@ -10,8 +10,8 @@
10
10
  />
11
11
 
12
12
  <title>Learnpack Creator: Craft tutorials in seconds!</title>
13
- <script type="module" crossorigin src="/creator/assets/index-CCvMFC6N.js"></script>
14
- <link rel="stylesheet" crossorigin href="/creator/assets/index-C_YTggyk.css">
13
+ <script type="module" crossorigin src="/creator/assets/index-BvrB0WCf.js"></script>
14
+ <link rel="stylesheet" crossorigin href="/creator/assets/index-CrWESWmj.css">
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
package/lib/utils/api.js CHANGED
@@ -7,6 +7,7 @@ const cli_ux_1 = require("cli-ux");
7
7
  const axios_1 = require("axios");
8
8
  const HOST = "https://breathecode.herokuapp.com";
9
9
  exports.RIGOBOT_HOST = "https://rigobot.herokuapp.com";
10
+ // export const RIGOBOT_HOST = "https://rigobot-test-cca7d841c9d8.herokuapp.com"
10
11
  // export const RIGOBOT_HOST =
11
12
  // "https://8000-charlytoc-rigobot-bmwdeam7cev.ws-us118.gitpod.io"
12
13
  // eslint-disable-next-line
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -1 +1 @@
1
- {"version":"5.0.172","commands":{"audit":{"id":"audit","description":"learnpack audit is the command in charge of creating an auditory of the repository\n...\nlearnpack audit checks for the following information in a repository:\n 1. The configuration object has slug, repository and description. (Error)\n 2. The command learnpack clean has been run. (Error)\n 3. If a markdown or test file doesn't have any content. (Error)\n 4. The links are accessing to valid servers. (Error)\n 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)\n 6. The external images are working (If they are pointing to a valid server). (Error)\n 7. The exercises directory names are valid. (Error)\n 8. If an exercise doesn't have a README file. (Error)\n 9. The exercises array (Of the config file) has content. (Error)\n 10. The exercses have the same translations. (Warning)\n 11. The .gitignore file exists. (Warning)\n 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false}},"args":[]},"breakToken":{"id":"breakToken","description":"Break the token","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"clean":{"id":"clean","description":"Clean the configuration object\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"download":{"id":"download","description":"Describe the command here\n...\nExtra documentation goes here\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"init":{"id":"init","description":"Create a new learning package: Book, Tutorial or Exercise","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"logout":{"id":"logout","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"publish":{"id":"publish","description":"Builds the project by copying necessary files and directories into a zip file","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Runs a small server to build tutorials","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"start":{"id":"start","description":"Runs a small server with all the exercise instructions","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"disableGrading":{"name":"disableGrading","type":"boolean","char":"D","description":"disble grading functionality","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Watch for file changes","allowNo":false},"editor":{"name":"editor","type":"option","char":"e","description":"[preview, extension]","options":["extension","preview"]},"version":{"name":"version","type":"option","char":"v","description":"E.g: 1.0.1"},"grading":{"name":"grading","type":"option","char":"g","description":"[isolated, incremental]","options":["isolated","incremental"]},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"test":{"id":"test","description":"Test exercises","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"args":[{"name":"exerciseSlug","description":"The name of the exercise to test","required":false,"hidden":false}]},"translate":{"id":"translate","description":"List all the lessons, the user is able of select many of them to translate to the given languages","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"args":[]}}}
1
+ {"version":"5.0.178","commands":{"audit":{"id":"audit","description":"learnpack audit is the command in charge of creating an auditory of the repository\n...\nlearnpack audit checks for the following information in a repository:\n 1. The configuration object has slug, repository and description. (Error)\n 2. The command learnpack clean has been run. (Error)\n 3. If a markdown or test file doesn't have any content. (Error)\n 4. The links are accessing to valid servers. (Error)\n 5. The relative images are working (If they have the shortest path to the image or if the images exists in the assets). (Error)\n 6. The external images are working (If they are pointing to a valid server). (Error)\n 7. The exercises directory names are valid. (Error)\n 8. If an exercise doesn't have a README file. (Error)\n 9. The exercises array (Of the config file) has content. (Error)\n 10. The exercses have the same translations. (Warning)\n 11. The .gitignore file exists. (Warning)\n 12. If there is a file within the exercises folder but not inside of any particular exercise's folder. (Warning)\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false}},"args":[]},"breakToken":{"id":"breakToken","description":"Break the token","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"clean":{"id":"clean","description":"Clean the configuration object\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[]},"download":{"id":"download","description":"Describe the command here\n...\nExtra documentation goes here\n","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"init":{"id":"init","description":"Create a new learning package: Book, Tutorial or Exercise","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"grading":{"name":"grading","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"logout":{"id":"logout","description":"Describe the command here\n ...\n Extra documentation goes here\n ","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"package","description":"The unique string that identifies this package on learnpack","required":false,"hidden":false}]},"publish":{"id":"publish","description":"Builds the project by copying necessary files and directories into a zip file","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"strict":{"name":"strict","type":"boolean","char":"s","description":"strict mode","allowNo":false},"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Runs a small server to build tutorials","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"start":{"id":"start","description":"Runs a small server with all the exercise instructions","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false},"port":{"name":"port","type":"option","char":"p","description":"server port"},"host":{"name":"host","type":"option","char":"h","description":"server host"},"disableGrading":{"name":"disableGrading","type":"boolean","char":"D","description":"disble grading functionality","allowNo":false},"watch":{"name":"watch","type":"boolean","char":"w","description":"Watch for file changes","allowNo":false},"editor":{"name":"editor","type":"option","char":"e","description":"[preview, extension]","options":["extension","preview"]},"version":{"name":"version","type":"option","char":"v","description":"E.g: 1.0.1"},"grading":{"name":"grading","type":"option","char":"g","description":"[isolated, incremental]","options":["isolated","incremental"]},"debug":{"name":"debug","type":"boolean","char":"d","description":"debugger mode for more verbage","allowNo":false}},"args":[]},"test":{"id":"test","description":"Test exercises","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"args":[{"name":"exerciseSlug","description":"The name of the exercise to test","required":false,"hidden":false}]},"translate":{"id":"translate","description":"List all the lessons, the user is able of select many of them to translate to the given languages","pluginName":"@learnpack/learnpack","pluginType":"core","aliases":[],"flags":{"yes":{"name":"yes","type":"boolean","char":"y","description":"Skip all prompts and initialize an empty project","allowNo":false}},"args":[]}}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@learnpack/learnpack",
3
3
  "description": "Seamlessly build, sell and/or take interactive & auto-graded tutorials, start learning now or build a new tutorial to your audience.",
4
- "version": "5.0.172",
4
+ "version": "5.0.178",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "contributors": [
7
7
  {
@@ -44,10 +44,12 @@
44
44
  "espree": "^9.3.2",
45
45
  "eta": "^1.2.0",
46
46
  "express": "^4.17.1",
47
+ "file-type": "^21.0.0",
47
48
  "form-data": "^4.0.2",
48
49
  "front-matter": "^4.0.2",
49
50
  "html-to-text": "^9.0.5",
50
51
  "js-yaml": "^4.1.0",
52
+ "jszip": "^3.10.1",
51
53
  "markdown-it": "^14.1.0",
52
54
  "mkdirp": "^3.0.1",
53
55
  "moment": "^2.27.0",
@@ -1,6 +1,6 @@
1
1
  import { flags } from "@oclif/command"
2
- // import multer from "multer"
3
- // import * as ytdl from "ytdl-core"
2
+
3
+ // import { readDocument } from "../utils/readDocuments"
4
4
  import { YoutubeTranscript } from "youtube-transcript"
5
5
  import * as express from "express"
6
6
  import * as cors from "cors"
@@ -535,6 +535,60 @@ export default class ServeCommand extends SessionCommand {
535
535
  }
536
536
  )
537
537
 
538
+ app.post("/read-document", upload.single("file"), async (req, res) => {
539
+ console.log("READING A DOCUMENT")
540
+ // const rigoToken = req.header("x-rigo-token")
541
+ // if (!rigoToken) {
542
+ // return res.status(400).json({ error: "Rigo token is required" })
543
+ // }
544
+
545
+ try {
546
+ // eslint-disable-next-line
547
+ // @ts-ignore
548
+ if (!req.file) {
549
+ return res.status(400).json({ error: "Missing file" })
550
+ }
551
+
552
+ const resultId = `${Date.now()}-${Math.floor(Math.random() * 1e6)}`
553
+
554
+ const webhookUrl = `https://9cw5zmww-3000.use2.devtunnels.ms/document/results/result_id/${resultId}/`
555
+
556
+ // Construir form-data para enviar al servidor proxy
557
+ const formData = new FormData()
558
+ // eslint-disable-next-line
559
+ // @ts-ignore
560
+ formData.append("file", req.file.buffer, {
561
+ // eslint-disable-next-line
562
+ // @ts-ignore
563
+ filename: req.file.originalname,
564
+ // eslint-disable-next-line
565
+ // @ts-ignore
566
+ contentType: req.file.mimetype,
567
+ })
568
+ formData.append("webhook_callback_url", webhookUrl)
569
+
570
+ // Hacer POST al servidor externo
571
+ const response = await axios.post(
572
+ `${RIGOBOT_HOST}/v1/learnpack/documents/pdf/read`,
573
+ formData,
574
+ {
575
+ headers: {
576
+ ...formData.getHeaders(),
577
+ Authorization: `Token `,
578
+ },
579
+ maxBodyLength: Infinity,
580
+ }
581
+ )
582
+ console.log("RESPONSE FROM RIGOBOT", response)
583
+
584
+ // Responder con el UUID generado
585
+ return res.json({ resultId })
586
+ } catch (error) {
587
+ console.error("❌ Error in /read-document:", error)
588
+ return res.status(500).json({ error: (error as Error).message })
589
+ }
590
+ })
591
+
538
592
  app.get("/check-preview-image/:slug", async (req, res) => {
539
593
  const { slug } = req.params
540
594
  const file = bucket.file(`courses/${slug}/preview.png`)
@@ -6,7 +6,7 @@ import { useNavigate } from "react-router"
6
6
  import { useShallow } from "zustand/react/shallow"
7
7
  import useStore from "./utils/store"
8
8
 
9
- import { interactiveCreation, isHuman } from "./utils/rigo"
9
+ import { publicInteractiveCreation, isHuman } from "./utils/rigo"
10
10
  import { checkParams, loginWithToken, parseLesson } from "./utils/lib"
11
11
 
12
12
  import { Uploader } from "./components/Uploader"
@@ -15,6 +15,7 @@ import { ParamsChecker } from "./components/ParamsChecker"
15
15
  import { RIGO_FLOAT_GIT } from "./utils/constants"
16
16
  import TurnstileChallenge from "./components/TurnstileChallenge"
17
17
  // import TurnstileChallenge from "./components/TurnstileChallenge"
18
+ import ResumeCourseModal from "./components/ResumeCourseModal"
18
19
 
19
20
  function App() {
20
21
  const navigate = useNavigate()
@@ -26,16 +27,22 @@ function App() {
26
27
  push,
27
28
  cleanHistory,
28
29
  setPlanToRedirect,
30
+ history,
29
31
  uploadedFiles,
32
+ auth,
33
+ resetFormState,
30
34
  } = useStore(
31
35
  useShallow((state) => ({
32
36
  formState: state.formState,
33
37
  setFormState: state.setFormState,
34
38
  setAuth: state.setAuth,
35
39
  push: state.push,
40
+ history: state.history,
36
41
  cleanHistory: state.cleanHistory,
37
42
  setPlanToRedirect: state.setPlanToRedirect,
38
43
  uploadedFiles: state.uploadedFiles,
44
+ auth: state.auth,
45
+ resetFormState: state.resetFormState,
39
46
  }))
40
47
  )
41
48
 
@@ -59,6 +66,7 @@ function App() {
59
66
  userId: user.id,
60
67
  rigoToken: user.rigobot.key,
61
68
  user: user,
69
+ publicToken: "",
62
70
  })
63
71
  }
64
72
  }
@@ -100,8 +108,9 @@ function App() {
100
108
  try {
101
109
  cleanHistory()
102
110
 
103
- const res = await interactiveCreation({
104
- courseInfo: `${JSON.stringify(formState)}
111
+ const res = await publicInteractiveCreation(
112
+ {
113
+ courseInfo: `${JSON.stringify(formState)}
105
114
  ${
106
115
  uploadedFiles.length > 0
107
116
  ? `These files where uploaded by the user: \n\n${JSON.stringify(
@@ -109,8 +118,10 @@ ${
109
118
  )}`
110
119
  : ""
111
120
  }`,
112
- prevInteractions: "",
113
- })
121
+ prevInteractions: "",
122
+ },
123
+ auth.publicToken
124
+ )
114
125
  const lessons = res.parsed.listOfSteps.map((lesson: any) => {
115
126
  return parseLesson(lesson, [])
116
127
  })
@@ -126,22 +137,11 @@ ${
126
137
  })
127
138
  navigate("/creator/syllabus")
128
139
  setFormState({
129
- description: "",
130
- duration: 0,
131
- targetAudience: "",
132
- hasContentIndex: false,
133
- contentIndex: "",
134
140
  isCompleted: false,
135
141
  currentStep: "description",
136
- variables: [
137
- "description",
138
- "duration",
139
- "hasContentIndex",
140
- "verifyHuman",
141
- ],
142
142
  })
143
143
  } catch (error) {
144
- console.error(error)
144
+ console.error(error, "ERROR CREATING TUTORIAL")
145
145
  toast.error("Something went wrong. Please try again.")
146
146
  setFormState({
147
147
  isCompleted: false,
@@ -279,14 +279,20 @@ ${
279
279
  isCompleted: false,
280
280
  content: (
281
281
  <TurnstileChallenge
282
+ // siteKey={"0x4AAAAAABeKMBYYinMU4Ib0"}
282
283
  siteKey={"0x4AAAAAABeZ9tjEevGBsJFU"}
283
284
  onSuccess={async (token) => {
284
- const _isHuman = await isHuman(token)
285
- if (_isHuman) {
285
+ const { human, message, token: jwtToken } = await isHuman(token)
286
+ if (human) {
286
287
  toast.success("You are a human! 👌🏻")
288
+
289
+ setAuth({
290
+ ...auth,
291
+ publicToken: jwtToken,
292
+ })
287
293
  setFormState({ isCompleted: true })
288
294
  } else {
289
- toast.error("You are not a human! 🤖")
295
+ toast.error(message)
290
296
  setFormState({
291
297
  currentStep: "hasContentIndex",
292
298
  })
@@ -297,8 +303,6 @@ ${
297
303
  },
298
304
  ]
299
305
 
300
- console.log(formState.variables, "FORM STATE VAIRABLEs")
301
-
302
306
  return steps.filter(
303
307
  (step) =>
304
308
  formState.variables.includes(step.slug) ||
@@ -309,22 +313,36 @@ ${
309
313
  return (
310
314
  <>
311
315
  <ParamsChecker />
312
- {formState.isCompleted ? (
316
+ {formState.isCompleted && history.length === 0 ? (
313
317
  <Loader
314
318
  text="Learnpack is setting up your tutorial. It may take a moment..."
315
319
  icon={<img src={RIGO_FLOAT_GIT} alt="rigo" className="w-20 h-20" />}
316
320
  />
317
321
  ) : (
318
- <StepWizard
319
- formState={formState}
320
- steps={buildSteps()}
321
- setFormState={setFormState}
322
- onFinish={() => {
323
- setFormState({
324
- isCompleted: true,
325
- })
326
- }}
327
- />
322
+ <>
323
+ {history.length > 0 && (
324
+ <ResumeCourseModal
325
+ onContinue={() => {
326
+ navigate("/creator/syllabus")
327
+ }}
328
+ onStartOver={() => {
329
+ resetFormState()
330
+ cleanHistory()
331
+ }}
332
+ />
333
+ )}
334
+ <StepWizard
335
+ hideLastButton={true}
336
+ formState={formState}
337
+ steps={buildSteps()}
338
+ setFormState={setFormState}
339
+ onFinish={() => {
340
+ setFormState({
341
+ isCompleted: true,
342
+ })
343
+ }}
344
+ />
345
+ </>
328
346
  )}
329
347
  </>
330
348
  )
@@ -24,6 +24,7 @@ export const ConsumablesManager = () => {
24
24
  rigoToken: "",
25
25
  userId: "",
26
26
  user: null,
27
+ publicToken: "",
27
28
  })
28
29
  }
29
30
  }