@learnpack/learnpack 5.0.142 → 5.0.144
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.
- package/README.md +13 -13
- package/lib/creatorDist/assets/{index-BLd63KeV.js → index-CzMCewx6.js} +2854 -2841
- package/lib/creatorDist/assets/{index-Cz25oPGo.css → index-DSOj0E0h.css} +6 -0
- package/lib/creatorDist/index.html +7 -2
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
- package/src/creator/index.html +5 -0
- package/src/creator/src/App.tsx +59 -35
- package/src/creator/src/components/Login.tsx +2 -1
- package/src/creator/src/components/TurnstileChallenge.tsx +83 -0
- package/src/creator/src/utils/store.ts +4 -0
- package/src/creatorDist/assets/{index-BLd63KeV.js → index-CzMCewx6.js} +2854 -2841
- package/src/creatorDist/assets/{index-Cz25oPGo.css → index-DSOj0E0h.css} +6 -0
- package/src/creatorDist/index.html +7 -2
- package/src/ui/_app/app.js +1 -1
- package/src/ui/_app/rigo-float.gif +0 -0
- package/src/ui/app.tar.gz +0 -0
@@ -393,6 +393,9 @@
|
|
393
393
|
.top-2 {
|
394
394
|
top: calc(var(--spacing) * 2);
|
395
395
|
}
|
396
|
+
.right-0 {
|
397
|
+
right: calc(var(--spacing) * 0);
|
398
|
+
}
|
396
399
|
.right-2 {
|
397
400
|
right: calc(var(--spacing) * 2);
|
398
401
|
}
|
@@ -704,6 +707,9 @@
|
|
704
707
|
.gap-3 {
|
705
708
|
gap: calc(var(--spacing) * 3);
|
706
709
|
}
|
710
|
+
.gap-4 {
|
711
|
+
gap: calc(var(--spacing) * 4);
|
712
|
+
}
|
707
713
|
:where(.space-y-2 > :not(:last-child)) {
|
708
714
|
--tw-space-y-reverse: 0;
|
709
715
|
margin-block-start: calc(
|
@@ -10,10 +10,15 @@
|
|
10
10
|
/>
|
11
11
|
|
12
12
|
<title>Learnpack Creator: Craft tutorials in seconds!</title>
|
13
|
-
<script type="module" crossorigin src="/creator/assets/index-
|
14
|
-
<link rel="stylesheet" crossorigin href="/creator/assets/index-
|
13
|
+
<script type="module" crossorigin src="/creator/assets/index-CzMCewx6.js"></script>
|
14
|
+
<link rel="stylesheet" crossorigin href="/creator/assets/index-DSOj0E0h.css">
|
15
15
|
</head>
|
16
16
|
<body>
|
17
17
|
<div id="root"></div>
|
18
|
+
<script
|
19
|
+
src="https://challenges.cloudflare.com/turnstile/v0/api.js"
|
20
|
+
async
|
21
|
+
defer
|
22
|
+
></script>
|
18
23
|
</body>
|
19
24
|
</html>
|
package/oclif.manifest.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":"5.0.
|
1
|
+
{"version":"5.0.144","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.
|
4
|
+
"version": "5.0.144",
|
5
5
|
"author": "Alejandro Sanchez @alesanchezr",
|
6
6
|
"contributors": [
|
7
7
|
{
|
package/src/creator/index.html
CHANGED
package/src/creator/src/App.tsx
CHANGED
@@ -13,16 +13,26 @@ import { Uploader } from "./components/Uploader"
|
|
13
13
|
import toast from "react-hot-toast"
|
14
14
|
import { ParamsChecker } from "./components/ParamsChecker"
|
15
15
|
import { RIGO_FLOAT_GIT } from "./utils/constants"
|
16
|
+
// import TurnstileChallenge from "./components/TurnstileChallenge"
|
17
|
+
|
16
18
|
function App() {
|
17
19
|
const navigate = useNavigate()
|
18
20
|
|
19
|
-
const {
|
21
|
+
const {
|
22
|
+
formState,
|
23
|
+
setFormState,
|
24
|
+
setAuth,
|
25
|
+
push,
|
26
|
+
cleanHistory,
|
27
|
+
setPlanToRedirect,
|
28
|
+
} = useStore(
|
20
29
|
useShallow((state) => ({
|
21
30
|
formState: state.formState,
|
22
31
|
setFormState: state.setFormState,
|
23
32
|
setAuth: state.setAuth,
|
24
33
|
push: state.push,
|
25
34
|
cleanHistory: state.cleanHistory,
|
35
|
+
setPlanToRedirect: state.setPlanToRedirect,
|
26
36
|
}))
|
27
37
|
)
|
28
38
|
|
@@ -69,7 +79,11 @@ function App() {
|
|
69
79
|
}
|
70
80
|
|
71
81
|
const checkDescription = () => {
|
72
|
-
const { description, duration } = checkParams([
|
82
|
+
const { description, duration, plan } = checkParams([
|
83
|
+
"description",
|
84
|
+
"duration",
|
85
|
+
"plan",
|
86
|
+
])
|
73
87
|
if (description) {
|
74
88
|
console.log("description", description)
|
75
89
|
setFormState({
|
@@ -89,6 +103,12 @@ function App() {
|
|
89
103
|
console.log("Invalid duration received in params", duration)
|
90
104
|
}
|
91
105
|
}
|
106
|
+
|
107
|
+
if (plan) {
|
108
|
+
setPlanToRedirect(plan)
|
109
|
+
} else {
|
110
|
+
console.debug("No plan received in params")
|
111
|
+
}
|
92
112
|
}
|
93
113
|
|
94
114
|
const handleCreateTutorial = async () => {
|
@@ -189,39 +209,41 @@ function App() {
|
|
189
209
|
slug: "hasContentIndex",
|
190
210
|
isCompleted: false,
|
191
211
|
content: (
|
192
|
-
|
193
|
-
<
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
hasContentIndex: true,
|
198
|
-
currentStep: "contentIndex",
|
199
|
-
variables: [...formState.variables, "contentIndex"],
|
200
|
-
// variables: [...formState.variables.filter((v) => v !== "hasContentIndex"), "contentIndex"],
|
201
|
-
})
|
202
|
-
}}
|
203
|
-
selected={false}
|
204
|
-
/>
|
205
|
-
<SelectableCard
|
206
|
-
title="No, help me create one"
|
207
|
-
onClick={() => {
|
208
|
-
if (!formState.contentIndex && !formState.description) {
|
209
|
-
toast.error(
|
210
|
-
"Please provide at least a description for your course!"
|
211
|
-
)
|
212
|
+
<>
|
213
|
+
<div className="flex flex-col md:flex-row gap-2 justify-center">
|
214
|
+
<SelectableCard
|
215
|
+
title="Yes"
|
216
|
+
onClick={() => {
|
212
217
|
setFormState({
|
213
|
-
|
218
|
+
hasContentIndex: true,
|
219
|
+
currentStep: "contentIndex",
|
220
|
+
variables: [...formState.variables, "contentIndex"],
|
221
|
+
// variables: [...formState.variables.filter((v) => v !== "hasContentIndex"), "contentIndex"],
|
214
222
|
})
|
215
|
-
|
216
|
-
}
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
223
|
+
}}
|
224
|
+
selected={false}
|
225
|
+
/>
|
226
|
+
<SelectableCard
|
227
|
+
title="No, help me create one"
|
228
|
+
onClick={() => {
|
229
|
+
if (!formState.contentIndex && !formState.description) {
|
230
|
+
toast.error(
|
231
|
+
"Please provide at least a description for your course!"
|
232
|
+
)
|
233
|
+
setFormState({
|
234
|
+
currentStep: "description",
|
235
|
+
})
|
236
|
+
return
|
237
|
+
}
|
238
|
+
setFormState({
|
239
|
+
hasContentIndex: false,
|
240
|
+
isCompleted: true,
|
241
|
+
})
|
242
|
+
}}
|
243
|
+
selected={false}
|
244
|
+
/>
|
245
|
+
</div>
|
246
|
+
</>
|
225
247
|
),
|
226
248
|
},
|
227
249
|
{
|
@@ -252,13 +274,15 @@ function App() {
|
|
252
274
|
return (
|
253
275
|
<>
|
254
276
|
<ParamsChecker />
|
277
|
+
{/* <div id="turnstile-container" style={{ display: "none" }} /> */}
|
278
|
+
|
255
279
|
{formState.isCompleted ? (
|
256
280
|
<Loader
|
257
281
|
text="Learnpack is setting up your tutorial. It may take a moment..."
|
258
282
|
icon={<img src={RIGO_FLOAT_GIT} alt="rigo" className="w-20 h-20" />}
|
259
283
|
/>
|
260
284
|
) : (
|
261
|
-
|
285
|
+
<div className="">
|
262
286
|
<StepWizard
|
263
287
|
formState={formState}
|
264
288
|
steps={buildSteps()}
|
@@ -269,7 +293,7 @@ function App() {
|
|
269
293
|
})
|
270
294
|
}}
|
271
295
|
/>
|
272
|
-
|
296
|
+
</div>
|
273
297
|
)}
|
274
298
|
</>
|
275
299
|
)
|
@@ -11,6 +11,7 @@ export default function Login({ onFinish }: { onFinish: () => void }) {
|
|
11
11
|
const [password, setPassword] = useState("")
|
12
12
|
const [isLoading, setIsLoading] = useState(false)
|
13
13
|
const [showForm, setShowForm] = useState(false)
|
14
|
+
const planToRedirect = useStore((state) => state.planToRedirect)
|
14
15
|
|
15
16
|
const { setAuth } = useStore(
|
16
17
|
useShallow((state) => ({ setAuth: state.setAuth }))
|
@@ -136,7 +137,7 @@ export default function Login({ onFinish }: { onFinish: () => void }) {
|
|
136
137
|
<div className="bg-blue-50 text-sm p-2 rounded text-left">
|
137
138
|
<p className="text-gray-700 m-0">You don't have an account?</p>
|
138
139
|
<a
|
139
|
-
href=
|
140
|
+
href={`https://4geeks.com/checkout?plan=${planToRedirect}`}
|
140
141
|
target="_blank"
|
141
142
|
className="text-blue-600 font-medium"
|
142
143
|
>
|
@@ -0,0 +1,83 @@
|
|
1
|
+
// components/TurnstileChallenge.tsx
|
2
|
+
import { useEffect, useRef, useState } from "react"
|
3
|
+
import toast from "react-hot-toast"
|
4
|
+
|
5
|
+
interface TurnstileChallengeProps {
|
6
|
+
siteKey: string
|
7
|
+
onSuccess: (token: string) => void
|
8
|
+
onError?: () => void
|
9
|
+
autoStart?: boolean
|
10
|
+
}
|
11
|
+
|
12
|
+
declare global {
|
13
|
+
interface Window {
|
14
|
+
turnstile: any
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
const TurnstileChallenge = ({
|
19
|
+
siteKey,
|
20
|
+
onSuccess,
|
21
|
+
onError,
|
22
|
+
autoStart = true,
|
23
|
+
}: TurnstileChallengeProps) => {
|
24
|
+
const containerId = "cf-turnstile-container"
|
25
|
+
const widgetId = useRef<string | null>(null)
|
26
|
+
const [ready, setReady] = useState(false)
|
27
|
+
|
28
|
+
useEffect(() => {
|
29
|
+
const tryRender = () => {
|
30
|
+
if (!window.turnstile || !document.getElementById(containerId)) return
|
31
|
+
|
32
|
+
if (widgetId.current) return
|
33
|
+
|
34
|
+
const id = window.turnstile.render(`#${containerId}`, {
|
35
|
+
sitekey: siteKey,
|
36
|
+
callback: (token: string) => {
|
37
|
+
console.log("token to send", token)
|
38
|
+
|
39
|
+
onSuccess(token)
|
40
|
+
},
|
41
|
+
"error-callback": () => {
|
42
|
+
onError?.()
|
43
|
+
},
|
44
|
+
"refresh-callback": () => {
|
45
|
+
console.log("refresh callback CALLEd")
|
46
|
+
toast.error("Refresh callback called")
|
47
|
+
},
|
48
|
+
})
|
49
|
+
|
50
|
+
widgetId.current = id
|
51
|
+
setReady(true)
|
52
|
+
}
|
53
|
+
|
54
|
+
const interval = setInterval(() => {
|
55
|
+
if (window.turnstile && document.getElementById(containerId)) {
|
56
|
+
clearInterval(interval)
|
57
|
+
if (autoStart) tryRender()
|
58
|
+
}
|
59
|
+
}, 200)
|
60
|
+
|
61
|
+
return () => clearInterval(interval)
|
62
|
+
}, [siteKey, autoStart, onSuccess, onError])
|
63
|
+
|
64
|
+
// const reset = () => {
|
65
|
+
// if (widgetId.current && window.turnstile) {
|
66
|
+
// window.turnstile.reset(widgetId.current)
|
67
|
+
// }
|
68
|
+
// }
|
69
|
+
|
70
|
+
return (
|
71
|
+
// <div className="flex flex-col gap-4 bg-white w-full fixed bottom-0 left-0 right-0 p-4 h-full items-center justify-center">
|
72
|
+
<div className="">
|
73
|
+
{/* <h3 className="text-center text-2xl font-bold">
|
74
|
+
We must verify you are human
|
75
|
+
</h3> */}
|
76
|
+
<div id={containerId} data-refresh-timeout="auto" />
|
77
|
+
{!ready && <p className="">...</p>}
|
78
|
+
{/* <button onClick={reset}>RESET</button> */}
|
79
|
+
</div>
|
80
|
+
)
|
81
|
+
}
|
82
|
+
|
83
|
+
export default TurnstileChallenge
|
@@ -41,6 +41,8 @@ type Store = {
|
|
41
41
|
formState: FormState
|
42
42
|
setAuth: (auth: Auth) => void
|
43
43
|
// syllabus: Syllabus
|
44
|
+
planToRedirect: string
|
45
|
+
setPlanToRedirect: (planToRedirect: string) => void
|
44
46
|
uploadedFiles: UploadedFile[]
|
45
47
|
setUploadedFiles: (uploadedFiles: UploadedFile[]) => void
|
46
48
|
|
@@ -65,6 +67,8 @@ const useStore = create<Store>()(
|
|
65
67
|
userId: "",
|
66
68
|
user: null,
|
67
69
|
},
|
70
|
+
planToRedirect: "learnpack-creator",
|
71
|
+
setPlanToRedirect: (planToRedirect: string) => set({ planToRedirect }),
|
68
72
|
formState: {
|
69
73
|
description: "",
|
70
74
|
duration: 0,
|