@learnpack/learnpack 5.0.260 → 5.0.262

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.
@@ -10,7 +10,7 @@
10
10
  />
11
11
 
12
12
  <title>Learnpack Creator: Craft tutorials in seconds!</title>
13
- <script type="module" crossorigin src="/creator/assets/index-BvHkfJm4.js"></script>
13
+ <script type="module" crossorigin src="/creator/assets/index-6e9E-1qG.js"></script>
14
14
  <link rel="stylesheet" crossorigin href="/creator/assets/index-DmpsXknz.css">
15
15
  </head>
16
16
  <body>
@@ -11,10 +11,12 @@ export interface ParsedLink {
11
11
  name: string;
12
12
  text: string;
13
13
  }
14
+ export type TDifficulty = "easy" | "beginner" | "intermediate" | "hard";
14
15
  export type FormState = {
15
16
  description: string;
16
17
  duration: number;
17
18
  hasContentIndex: boolean;
19
+ difficulty: TDifficulty;
18
20
  contentIndex: string;
19
21
  language?: string;
20
22
  technologies?: string[];
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.260",
4
+ "version": "5.0.262",
5
5
  "author": "Alejandro Sanchez @alesanchezr",
6
6
  "contributors": [
7
7
  {
@@ -4,7 +4,7 @@ import SelectableCard from "./components/SelectableCard"
4
4
  import Loader from "./components/Loader"
5
5
  import { useNavigate } from "react-router"
6
6
  import { useShallow } from "zustand/react/shallow"
7
- import useStore from "./utils/store"
7
+ import useStore, { TDifficulty } from "./utils/store"
8
8
 
9
9
  import { publicInteractiveCreation, isHuman } from "./utils/rigo"
10
10
  import {
@@ -106,6 +106,7 @@ function App() {
106
106
  purpose,
107
107
  language,
108
108
  new: newParam,
109
+ difficulty,
109
110
  } = checkParams([
110
111
  "description",
111
112
  "duration",
@@ -113,6 +114,7 @@ function App() {
113
114
  "purpose",
114
115
  "language",
115
116
  "new",
117
+ "difficulty",
116
118
  ])
117
119
 
118
120
  if (newParam && newParam.toLowerCase().trim() === "true") {
@@ -155,6 +157,15 @@ function App() {
155
157
  })
156
158
  }
157
159
 
160
+ if (
161
+ difficulty &&
162
+ ["easy", "beginner", "intermediate", "hard"].includes(difficulty)
163
+ ) {
164
+ setFormState({
165
+ difficulty: difficulty as TDifficulty,
166
+ })
167
+ }
168
+
158
169
  if (description && duration && purpose) {
159
170
  setFormState({
160
171
  currentStep: "hasContentIndex",
@@ -363,11 +374,14 @@ function App() {
363
374
  })
364
375
  }
365
376
  }}
366
- // onError={() => {
367
- // setFormState({
368
- // currentStep: "purpose",
369
- // })
370
- // }}
377
+ onError={() => {
378
+ toast.error(t("turnstileModal.error"), {
379
+ duration: 10000,
380
+ })
381
+ setFormState({
382
+ currentStep: "purpose",
383
+ })
384
+ }}
371
385
  />
372
386
  ),
373
387
  },
@@ -444,6 +458,15 @@ function App() {
444
458
  setShowTurnstileModal(false)
445
459
  handleCreateTutorial()
446
460
  }}
461
+ onError={() => {
462
+ toast.error(t("turnstileModal.error"), {
463
+ duration: 10000,
464
+ })
465
+ setShowTurnstileModal(false)
466
+ setFormState({
467
+ currentStep: "purpose",
468
+ })
469
+ }}
447
470
  />
448
471
  )}
449
472
  {formState.isCompleted && history.length === 0 ? (
@@ -36,17 +36,17 @@ export const PurposeSelector: React.FC<PurposeSelectorProps> = ({
36
36
  // description: t("purposeSelector.learnpack-lesson-writer.description"),
37
37
  // },
38
38
  {
39
- slug: "homework-and-exam-preparation-aid",
40
- label: t("purposeSelector.homework-and-exam-preparation-aid.label"),
39
+ slug: "skill-building-facilitator",
40
+ label: t("purposeSelector.skill-building-facilitator.label"),
41
41
  description: t(
42
- "purposeSelector.homework-and-exam-preparation-aid.description"
42
+ "purposeSelector.skill-building-facilitator.description"
43
43
  ),
44
44
  },
45
45
  {
46
- slug: "skill-building-facilitator",
47
- label: t("purposeSelector.skill-building-facilitator.label"),
46
+ slug: "homework-and-exam-preparation-aid",
47
+ label: t("purposeSelector.homework-and-exam-preparation-aid.label"),
48
48
  description: t(
49
- "purposeSelector.skill-building-facilitator.description"
49
+ "purposeSelector.homework-and-exam-preparation-aid.description"
50
50
  ),
51
51
  },
52
52
  {
@@ -5,32 +5,47 @@ import { toast } from "react-hot-toast"
5
5
  import useStore from "../utils/store"
6
6
  import { useTranslation } from "react-i18next"
7
7
 
8
- export default function TurnstileModal({ onClose }: { onClose: () => void }) {
8
+ export default function TurnstileModal({
9
+ onClose,
10
+ onError,
11
+ }: {
12
+ onClose: () => void
13
+ onError: () => void
14
+ }) {
9
15
  const auth = useStore((state) => state.auth)
10
16
  const setAuth = useStore((state) => state.setAuth)
11
17
  const { t } = useTranslation()
12
18
 
13
19
  return (
14
20
  <div className="fixed inset-0 bg-black/50 flex items-center justify-center z-1000">
15
- <TurnstileChallenge
16
- siteKey={
17
- DEV_MODE ? "0x4AAAAAABeKMBYYinMU4Ib0" : "0x4AAAAAABeZ9tjEevGBsJFU"
18
- }
19
- onSuccess={async (token) => {
20
- const { human, message, token: jwtToken } = await isHuman(token)
21
- if (human) {
22
- toast.success(t("stepWizard.humanSuccess"))
23
- setAuth({
24
- ...auth,
25
- publicToken: jwtToken,
26
- })
27
- onClose()
28
- } else {
29
- toast.error(message)
30
- onClose()
21
+ <div className="bg-white p-4 rounded-lg max-w-md w-full flex flex-col items-center justify-center gap-4">
22
+ <h2 className="text-xl font-semibold text-center">
23
+ {t("turnstileModal.title")}
24
+ </h2>
25
+ <TurnstileChallenge
26
+ siteKey={
27
+ DEV_MODE ? "0x4AAAAAABeKMBYYinMU4Ib0" : "0x4AAAAAABeZ9tjEevGBsJFU"
31
28
  }
32
- }}
33
- />
29
+ onSuccess={async (token) => {
30
+ const { human, message, token: jwtToken } = await isHuman(token)
31
+ if (human) {
32
+ toast.success(t("stepWizard.humanSuccess"))
33
+ setAuth({
34
+ ...auth,
35
+ publicToken: jwtToken,
36
+ })
37
+ onClose()
38
+ } else {
39
+ console.error(message, "turnstileModal error")
40
+ onError()
41
+ }
42
+ }}
43
+ onError={() => {
44
+ console.error("turnstileModal error")
45
+ onError()
46
+ }}
47
+ />
48
+ </div>
34
49
  </div>
35
50
  )
36
51
  }
@@ -115,5 +115,9 @@
115
115
  "loginWithEmail": "Login with Email",
116
116
  "youDontHaveAnAccount": "You don't have an account?",
117
117
  "registerHere": "Register here."
118
+ },
119
+ "turnstileModal": {
120
+ "title": "We need to verify you are a human, wait a moment...",
121
+ "error": "Error verifying you are a human, please try again, if the problem persists, use a different browser."
118
122
  }
119
123
  }
@@ -115,5 +115,9 @@
115
115
  "loginWithEmail": "Iniciar sesión con Email",
116
116
  "youDontHaveAnAccount": "¿No tienes una cuenta?",
117
117
  "registerHere": "Regístrate aquí."
118
+ },
119
+ "turnstileModal": {
120
+ "title": "Necesitamos verificar que eres un humano, espera un momento...",
121
+ "error": "Error al verificar que eres un humano, por favor intenta de nuevo, si el problema persiste, usa un navegador diferente."
118
122
  }
119
123
  }
@@ -4,6 +4,7 @@ import { Lesson } from "../components/LessonItem"
4
4
  import { ParsedFile } from "../components/FileUploader"
5
5
  import { TMessage } from "../components/Message"
6
6
  // import { ParsedLink } from "../components/LinkUploader"
7
+ export type TDifficulty = "easy" | "beginner" | "intermediate" | "hard"
7
8
 
8
9
  export type FormState = {
9
10
  description: string
@@ -11,6 +12,7 @@ export type FormState = {
11
12
  hasContentIndex: boolean
12
13
  contentIndex: string
13
14
  purpose: string
15
+ difficulty: TDifficulty
14
16
  slug: string
15
17
  language?: string
16
18
  isCompleted: boolean
@@ -92,6 +94,7 @@ const useStore = create<Store>()(
92
94
  purpose: "",
93
95
  language: "en",
94
96
  technologies: [],
97
+ difficulty: "beginner",
95
98
  // sources: [],
96
99
  isCompleted: false,
97
100
  currentStep: "description",
@@ -126,6 +129,7 @@ const useStore = create<Store>()(
126
129
  description: "",
127
130
  duration: 0,
128
131
  language: "en",
132
+ difficulty: "beginner",
129
133
  technologies: [],
130
134
  hasContentIndex: false,
131
135
  contentIndex: "",
@@ -173,6 +177,7 @@ const useStore = create<Store>()(
173
177
  description: "",
174
178
  duration: 0,
175
179
  slug: "",
180
+ difficulty: "beginner",
176
181
  language: "en",
177
182
  technologies: [],
178
183
  hasContentIndex: false,