@contractspec/example.learning-journey-ui-onboarding 3.7.16 → 3.7.18

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 (48) hide show
  1. package/.turbo/turbo-build.log +48 -48
  2. package/CHANGELOG.md +36 -0
  3. package/dist/OnboardingMiniApp.js +1 -994
  4. package/dist/browser/OnboardingMiniApp.js +1 -994
  5. package/dist/browser/components/CodeSnippet.js +1 -65
  6. package/dist/browser/components/JourneyMap.js +1 -59
  7. package/dist/browser/components/StepChecklist.js +1 -97
  8. package/dist/browser/components/index.js +1 -219
  9. package/dist/browser/docs/index.js +2 -16
  10. package/dist/browser/docs/learning-journey-ui-onboarding.docblock.js +2 -16
  11. package/dist/browser/example.js +1 -32
  12. package/dist/browser/index.js +2 -1127
  13. package/dist/browser/learning-journey-ui-onboarding.feature.js +1 -18
  14. package/dist/browser/views/Overview.js +1 -240
  15. package/dist/browser/views/Progress.js +1 -275
  16. package/dist/browser/views/Steps.js +1 -192
  17. package/dist/browser/views/Timeline.js +1 -213
  18. package/dist/browser/views/index.js +1 -915
  19. package/dist/components/CodeSnippet.js +1 -65
  20. package/dist/components/JourneyMap.js +1 -59
  21. package/dist/components/StepChecklist.js +1 -97
  22. package/dist/components/index.js +1 -219
  23. package/dist/docs/index.js +2 -16
  24. package/dist/docs/learning-journey-ui-onboarding.docblock.js +2 -16
  25. package/dist/example.js +1 -32
  26. package/dist/index.js +2 -1127
  27. package/dist/learning-journey-ui-onboarding.feature.js +1 -18
  28. package/dist/node/OnboardingMiniApp.js +1 -994
  29. package/dist/node/components/CodeSnippet.js +1 -65
  30. package/dist/node/components/JourneyMap.js +1 -59
  31. package/dist/node/components/StepChecklist.js +1 -97
  32. package/dist/node/components/index.js +1 -219
  33. package/dist/node/docs/index.js +2 -16
  34. package/dist/node/docs/learning-journey-ui-onboarding.docblock.js +2 -16
  35. package/dist/node/example.js +1 -32
  36. package/dist/node/index.js +2 -1127
  37. package/dist/node/learning-journey-ui-onboarding.feature.js +1 -18
  38. package/dist/node/views/Overview.js +1 -240
  39. package/dist/node/views/Progress.js +1 -275
  40. package/dist/node/views/Steps.js +1 -192
  41. package/dist/node/views/Timeline.js +1 -213
  42. package/dist/node/views/index.js +1 -915
  43. package/dist/views/Overview.js +1 -240
  44. package/dist/views/Progress.js +1 -275
  45. package/dist/views/Steps.js +1 -192
  46. package/dist/views/Timeline.js +1 -213
  47. package/dist/views/index.js +1 -915
  48. package/package.json +13 -13
@@ -1,994 +1 @@
1
- // src/views/Overview.tsx
2
- import { XpBar } from "@contractspec/example.learning-journey-ui-shared";
3
- import { Button } from "@contractspec/lib.design-system";
4
- import {
5
- Card,
6
- CardContent,
7
- CardHeader,
8
- CardTitle
9
- } from "@contractspec/lib.ui-kit-web/ui/card";
10
- import { Progress } from "@contractspec/lib.ui-kit-web/ui/progress";
11
- import { jsxDEV } from "react/jsx-dev-runtime";
12
- "use client";
13
- function Overview({
14
- track,
15
- progress,
16
- onStart
17
- }) {
18
- const totalSteps = track.steps.length;
19
- const completedSteps = progress.completedStepIds.length;
20
- const percentComplete = totalSteps > 0 ? completedSteps / totalSteps * 100 : 0;
21
- const isComplete = completedSteps === totalSteps;
22
- const remainingSteps = totalSteps - completedSteps;
23
- const estimatedMinutes = remainingSteps * 5;
24
- const totalXp = track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) + (track.completionRewards?.xpBonus ?? 0);
25
- return /* @__PURE__ */ jsxDEV("div", {
26
- className: "space-y-6",
27
- children: [
28
- /* @__PURE__ */ jsxDEV(Card, {
29
- className: "overflow-hidden bg-gradient-to-r from-blue-500/10 via-violet-500/10 to-purple-500/10",
30
- children: /* @__PURE__ */ jsxDEV(CardContent, {
31
- className: "p-8",
32
- children: /* @__PURE__ */ jsxDEV("div", {
33
- className: "flex flex-col items-center gap-6 text-center md:flex-row md:text-left",
34
- children: [
35
- /* @__PURE__ */ jsxDEV("div", {
36
- className: "flex h-20 w-20 items-center justify-center rounded-2xl bg-gradient-to-br from-blue-500 to-violet-600 text-4xl shadow-lg",
37
- children: isComplete ? "\uD83C\uDF89" : "\uD83D\uDE80"
38
- }, undefined, false, undefined, this),
39
- /* @__PURE__ */ jsxDEV("div", {
40
- className: "flex-1",
41
- children: [
42
- /* @__PURE__ */ jsxDEV("h1", {
43
- className: "font-bold text-2xl",
44
- children: track.name
45
- }, undefined, false, undefined, this),
46
- /* @__PURE__ */ jsxDEV("p", {
47
- className: "mt-1 max-w-2xl text-muted-foreground",
48
- children: track.description
49
- }, undefined, false, undefined, this),
50
- !isComplete && /* @__PURE__ */ jsxDEV("p", {
51
- className: "mt-3 text-muted-foreground text-sm",
52
- children: [
53
- "⏱️ Estimated time:",
54
- " ",
55
- estimatedMinutes > 0 ? `~${estimatedMinutes} minutes` : "Less than a minute"
56
- ]
57
- }, undefined, true, undefined, this)
58
- ]
59
- }, undefined, true, undefined, this),
60
- !isComplete && /* @__PURE__ */ jsxDEV(Button, {
61
- size: "lg",
62
- onClick: onStart,
63
- children: completedSteps > 0 ? "Continue" : "Get Started"
64
- }, undefined, false, undefined, this)
65
- ]
66
- }, undefined, true, undefined, this)
67
- }, undefined, false, undefined, this)
68
- }, undefined, false, undefined, this),
69
- /* @__PURE__ */ jsxDEV("div", {
70
- className: "grid gap-4 md:grid-cols-3",
71
- children: [
72
- /* @__PURE__ */ jsxDEV(Card, {
73
- children: [
74
- /* @__PURE__ */ jsxDEV(CardHeader, {
75
- className: "pb-2",
76
- children: /* @__PURE__ */ jsxDEV(CardTitle, {
77
- className: "font-medium text-muted-foreground text-sm",
78
- children: "Progress"
79
- }, undefined, false, undefined, this)
80
- }, undefined, false, undefined, this),
81
- /* @__PURE__ */ jsxDEV(CardContent, {
82
- children: [
83
- /* @__PURE__ */ jsxDEV("div", {
84
- className: "font-bold text-3xl",
85
- children: [
86
- Math.round(percentComplete),
87
- "%"
88
- ]
89
- }, undefined, true, undefined, this),
90
- /* @__PURE__ */ jsxDEV(Progress, {
91
- value: percentComplete,
92
- className: "mt-2 h-2"
93
- }, undefined, false, undefined, this),
94
- /* @__PURE__ */ jsxDEV("p", {
95
- className: "mt-2 text-muted-foreground text-sm",
96
- children: [
97
- completedSteps,
98
- " of ",
99
- totalSteps,
100
- " steps completed"
101
- ]
102
- }, undefined, true, undefined, this)
103
- ]
104
- }, undefined, true, undefined, this)
105
- ]
106
- }, undefined, true, undefined, this),
107
- /* @__PURE__ */ jsxDEV(Card, {
108
- children: [
109
- /* @__PURE__ */ jsxDEV(CardHeader, {
110
- className: "pb-2",
111
- children: /* @__PURE__ */ jsxDEV(CardTitle, {
112
- className: "font-medium text-muted-foreground text-sm",
113
- children: "XP Earned"
114
- }, undefined, false, undefined, this)
115
- }, undefined, false, undefined, this),
116
- /* @__PURE__ */ jsxDEV(CardContent, {
117
- children: [
118
- /* @__PURE__ */ jsxDEV("div", {
119
- className: "font-bold text-3xl text-blue-500",
120
- children: progress.xpEarned
121
- }, undefined, false, undefined, this),
122
- /* @__PURE__ */ jsxDEV(XpBar, {
123
- current: progress.xpEarned,
124
- max: totalXp,
125
- showLabel: false,
126
- size: "sm"
127
- }, undefined, false, undefined, this)
128
- ]
129
- }, undefined, true, undefined, this)
130
- ]
131
- }, undefined, true, undefined, this),
132
- /* @__PURE__ */ jsxDEV(Card, {
133
- children: [
134
- /* @__PURE__ */ jsxDEV(CardHeader, {
135
- className: "pb-2",
136
- children: /* @__PURE__ */ jsxDEV(CardTitle, {
137
- className: "font-medium text-muted-foreground text-sm",
138
- children: "Time Remaining"
139
- }, undefined, false, undefined, this)
140
- }, undefined, false, undefined, this),
141
- /* @__PURE__ */ jsxDEV(CardContent, {
142
- children: [
143
- /* @__PURE__ */ jsxDEV("div", {
144
- className: "font-bold text-3xl",
145
- children: isComplete ? "✓" : `~${estimatedMinutes}m`
146
- }, undefined, false, undefined, this),
147
- /* @__PURE__ */ jsxDEV("p", {
148
- className: "mt-2 text-muted-foreground text-sm",
149
- children: isComplete ? "All done!" : `${remainingSteps} steps to go`
150
- }, undefined, false, undefined, this)
151
- ]
152
- }, undefined, true, undefined, this)
153
- ]
154
- }, undefined, true, undefined, this)
155
- ]
156
- }, undefined, true, undefined, this),
157
- /* @__PURE__ */ jsxDEV(Card, {
158
- children: [
159
- /* @__PURE__ */ jsxDEV(CardHeader, {
160
- children: /* @__PURE__ */ jsxDEV(CardTitle, {
161
- className: "flex items-center gap-2",
162
- children: [
163
- /* @__PURE__ */ jsxDEV("span", {
164
- children: "\uD83D\uDCCB"
165
- }, undefined, false, undefined, this),
166
- /* @__PURE__ */ jsxDEV("span", {
167
- children: "Your Journey"
168
- }, undefined, false, undefined, this)
169
- ]
170
- }, undefined, true, undefined, this)
171
- }, undefined, false, undefined, this),
172
- /* @__PURE__ */ jsxDEV(CardContent, {
173
- children: /* @__PURE__ */ jsxDEV("div", {
174
- className: "space-y-3",
175
- children: track.steps.map((step, index) => {
176
- const isStepCompleted = progress.completedStepIds.includes(step.id);
177
- const isCurrent = !isStepCompleted && track.steps.slice(0, index).every((s) => progress.completedStepIds.includes(s.id));
178
- return /* @__PURE__ */ jsxDEV("div", {
179
- className: "flex items-center gap-4 rounded-lg border p-3",
180
- children: [
181
- /* @__PURE__ */ jsxDEV("div", {
182
- className: `flex h-8 w-8 shrink-0 items-center justify-center rounded-full font-semibold text-sm ${isStepCompleted ? "bg-green-500 text-white" : isCurrent ? "bg-blue-500 text-white" : "bg-muted text-muted-foreground"}`,
183
- children: isStepCompleted ? "✓" : index + 1
184
- }, undefined, false, undefined, this),
185
- /* @__PURE__ */ jsxDEV("div", {
186
- className: "min-w-0 flex-1",
187
- children: /* @__PURE__ */ jsxDEV("p", {
188
- className: `font-medium ${isStepCompleted ? "text-green-500" : isCurrent ? "text-foreground" : "text-muted-foreground"}`,
189
- children: step.title
190
- }, undefined, false, undefined, this)
191
- }, undefined, false, undefined, this),
192
- step.xpReward && /* @__PURE__ */ jsxDEV("span", {
193
- className: "text-muted-foreground text-sm",
194
- children: [
195
- "+",
196
- step.xpReward,
197
- " XP"
198
- ]
199
- }, undefined, true, undefined, this)
200
- ]
201
- }, step.id, true, undefined, this);
202
- })
203
- }, undefined, false, undefined, this)
204
- }, undefined, false, undefined, this)
205
- ]
206
- }, undefined, true, undefined, this),
207
- isComplete && /* @__PURE__ */ jsxDEV(Card, {
208
- className: "border-green-500/50 bg-green-500/5",
209
- children: /* @__PURE__ */ jsxDEV(CardContent, {
210
- className: "flex items-center gap-4 p-6",
211
- children: [
212
- /* @__PURE__ */ jsxDEV("div", {
213
- className: "text-4xl",
214
- children: "\uD83C\uDF89"
215
- }, undefined, false, undefined, this),
216
- /* @__PURE__ */ jsxDEV("div", {
217
- children: [
218
- /* @__PURE__ */ jsxDEV("h3", {
219
- className: "font-semibold text-green-500 text-lg",
220
- children: "Onboarding Complete!"
221
- }, undefined, false, undefined, this),
222
- /* @__PURE__ */ jsxDEV("p", {
223
- className: "text-muted-foreground",
224
- children: [
225
- "You've completed all ",
226
- totalSteps,
227
- " steps. Welcome aboard!"
228
- ]
229
- }, undefined, true, undefined, this)
230
- ]
231
- }, undefined, true, undefined, this)
232
- ]
233
- }, undefined, true, undefined, this)
234
- }, undefined, false, undefined, this)
235
- ]
236
- }, undefined, true, undefined, this);
237
- }
238
-
239
- // src/views/Progress.tsx
240
- import {
241
- BadgeDisplay,
242
- XpBar as XpBar2
243
- } from "@contractspec/example.learning-journey-ui-shared";
244
- import {
245
- Card as Card2,
246
- CardContent as CardContent2,
247
- CardHeader as CardHeader2,
248
- CardTitle as CardTitle2
249
- } from "@contractspec/lib.ui-kit-web/ui/card";
250
- import { Progress as Progress2 } from "@contractspec/lib.ui-kit-web/ui/progress";
251
- import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
252
- "use client";
253
- function ProgressView({ track, progress }) {
254
- const totalSteps = track.steps.length;
255
- const completedSteps = progress.completedStepIds.length;
256
- const percentComplete = totalSteps > 0 ? completedSteps / totalSteps * 100 : 0;
257
- const totalXp = track.totalXp ?? track.steps.reduce((sum, s) => sum + (s.xpReward ?? 0), 0) + (track.completionRewards?.xpBonus ?? 0);
258
- const remainingSteps = totalSteps - completedSteps;
259
- const estimatedMinutes = remainingSteps * 5;
260
- return /* @__PURE__ */ jsxDEV2("div", {
261
- className: "space-y-6",
262
- children: [
263
- /* @__PURE__ */ jsxDEV2(Card2, {
264
- children: [
265
- /* @__PURE__ */ jsxDEV2(CardHeader2, {
266
- children: /* @__PURE__ */ jsxDEV2(CardTitle2, {
267
- className: "flex items-center gap-2",
268
- children: [
269
- /* @__PURE__ */ jsxDEV2("span", {
270
- children: "\uD83D\uDCC8"
271
- }, undefined, false, undefined, this),
272
- /* @__PURE__ */ jsxDEV2("span", {
273
- children: "Your Progress"
274
- }, undefined, false, undefined, this)
275
- ]
276
- }, undefined, true, undefined, this)
277
- }, undefined, false, undefined, this),
278
- /* @__PURE__ */ jsxDEV2(CardContent2, {
279
- className: "space-y-6",
280
- children: [
281
- /* @__PURE__ */ jsxDEV2("div", {
282
- className: "flex items-center justify-center",
283
- children: /* @__PURE__ */ jsxDEV2("div", {
284
- className: "relative flex h-40 w-40 items-center justify-center",
285
- children: [
286
- /* @__PURE__ */ jsxDEV2("svg", {
287
- className: "absolute h-full w-full -rotate-90",
288
- viewBox: "0 0 100 100",
289
- children: [
290
- /* @__PURE__ */ jsxDEV2("circle", {
291
- cx: "50",
292
- cy: "50",
293
- r: "45",
294
- fill: "none",
295
- strokeWidth: "8",
296
- className: "stroke-muted"
297
- }, undefined, false, undefined, this),
298
- /* @__PURE__ */ jsxDEV2("circle", {
299
- cx: "50",
300
- cy: "50",
301
- r: "45",
302
- fill: "none",
303
- strokeWidth: "8",
304
- strokeLinecap: "round",
305
- strokeDasharray: `${percentComplete * 2.83} 283`,
306
- className: "stroke-blue-500 transition-all duration-500"
307
- }, undefined, false, undefined, this)
308
- ]
309
- }, undefined, true, undefined, this),
310
- /* @__PURE__ */ jsxDEV2("div", {
311
- className: "text-center",
312
- children: [
313
- /* @__PURE__ */ jsxDEV2("div", {
314
- className: "font-bold text-3xl",
315
- children: [
316
- Math.round(percentComplete),
317
- "%"
318
- ]
319
- }, undefined, true, undefined, this),
320
- /* @__PURE__ */ jsxDEV2("div", {
321
- className: "text-muted-foreground text-sm",
322
- children: "Complete"
323
- }, undefined, false, undefined, this)
324
- ]
325
- }, undefined, true, undefined, this)
326
- ]
327
- }, undefined, true, undefined, this)
328
- }, undefined, false, undefined, this),
329
- /* @__PURE__ */ jsxDEV2("div", {
330
- className: "grid grid-cols-3 gap-4 text-center",
331
- children: [
332
- /* @__PURE__ */ jsxDEV2("div", {
333
- children: [
334
- /* @__PURE__ */ jsxDEV2("div", {
335
- className: "font-bold text-2xl text-green-500",
336
- children: completedSteps
337
- }, undefined, false, undefined, this),
338
- /* @__PURE__ */ jsxDEV2("div", {
339
- className: "text-muted-foreground text-sm",
340
- children: "Completed"
341
- }, undefined, false, undefined, this)
342
- ]
343
- }, undefined, true, undefined, this),
344
- /* @__PURE__ */ jsxDEV2("div", {
345
- children: [
346
- /* @__PURE__ */ jsxDEV2("div", {
347
- className: "font-bold text-2xl text-orange-500",
348
- children: remainingSteps
349
- }, undefined, false, undefined, this),
350
- /* @__PURE__ */ jsxDEV2("div", {
351
- className: "text-muted-foreground text-sm",
352
- children: "Remaining"
353
- }, undefined, false, undefined, this)
354
- ]
355
- }, undefined, true, undefined, this),
356
- /* @__PURE__ */ jsxDEV2("div", {
357
- children: [
358
- /* @__PURE__ */ jsxDEV2("div", {
359
- className: "font-bold text-2xl",
360
- children: [
361
- estimatedMinutes,
362
- "m"
363
- ]
364
- }, undefined, true, undefined, this),
365
- /* @__PURE__ */ jsxDEV2("div", {
366
- className: "text-muted-foreground text-sm",
367
- children: "Est. Time"
368
- }, undefined, false, undefined, this)
369
- ]
370
- }, undefined, true, undefined, this)
371
- ]
372
- }, undefined, true, undefined, this)
373
- ]
374
- }, undefined, true, undefined, this)
375
- ]
376
- }, undefined, true, undefined, this),
377
- /* @__PURE__ */ jsxDEV2(Card2, {
378
- children: [
379
- /* @__PURE__ */ jsxDEV2(CardHeader2, {
380
- children: /* @__PURE__ */ jsxDEV2(CardTitle2, {
381
- className: "flex items-center gap-2",
382
- children: [
383
- /* @__PURE__ */ jsxDEV2("span", {
384
- children: "⚡"
385
- }, undefined, false, undefined, this),
386
- /* @__PURE__ */ jsxDEV2("span", {
387
- children: "Experience Points"
388
- }, undefined, false, undefined, this)
389
- ]
390
- }, undefined, true, undefined, this)
391
- }, undefined, false, undefined, this),
392
- /* @__PURE__ */ jsxDEV2(CardContent2, {
393
- className: "space-y-4",
394
- children: [
395
- /* @__PURE__ */ jsxDEV2("div", {
396
- className: "flex items-baseline gap-2",
397
- children: [
398
- /* @__PURE__ */ jsxDEV2("span", {
399
- className: "font-bold text-3xl text-blue-500",
400
- children: progress.xpEarned
401
- }, undefined, false, undefined, this),
402
- /* @__PURE__ */ jsxDEV2("span", {
403
- className: "text-muted-foreground",
404
- children: [
405
- "/ ",
406
- totalXp,
407
- " XP"
408
- ]
409
- }, undefined, true, undefined, this)
410
- ]
411
- }, undefined, true, undefined, this),
412
- /* @__PURE__ */ jsxDEV2(XpBar2, {
413
- current: progress.xpEarned,
414
- max: totalXp,
415
- showLabel: false,
416
- size: "lg"
417
- }, undefined, false, undefined, this)
418
- ]
419
- }, undefined, true, undefined, this)
420
- ]
421
- }, undefined, true, undefined, this),
422
- /* @__PURE__ */ jsxDEV2(Card2, {
423
- children: [
424
- /* @__PURE__ */ jsxDEV2(CardHeader2, {
425
- children: /* @__PURE__ */ jsxDEV2(CardTitle2, {
426
- className: "flex items-center gap-2",
427
- children: [
428
- /* @__PURE__ */ jsxDEV2("span", {
429
- children: "\uD83C\uDFC5"
430
- }, undefined, false, undefined, this),
431
- /* @__PURE__ */ jsxDEV2("span", {
432
- children: "Achievements"
433
- }, undefined, false, undefined, this)
434
- ]
435
- }, undefined, true, undefined, this)
436
- }, undefined, false, undefined, this),
437
- /* @__PURE__ */ jsxDEV2(CardContent2, {
438
- children: [
439
- /* @__PURE__ */ jsxDEV2(BadgeDisplay, {
440
- badges: progress.badges,
441
- size: "lg"
442
- }, undefined, false, undefined, this),
443
- progress.badges.length === 0 && track.completionRewards?.badgeKey && /* @__PURE__ */ jsxDEV2("p", {
444
- className: "text-muted-foreground text-sm",
445
- children: [
446
- 'Complete all steps to earn the "',
447
- track.completionRewards.badgeKey,
448
- '" badge!'
449
- ]
450
- }, undefined, true, undefined, this)
451
- ]
452
- }, undefined, true, undefined, this)
453
- ]
454
- }, undefined, true, undefined, this),
455
- /* @__PURE__ */ jsxDEV2(Card2, {
456
- children: [
457
- /* @__PURE__ */ jsxDEV2(CardHeader2, {
458
- children: /* @__PURE__ */ jsxDEV2(CardTitle2, {
459
- className: "flex items-center gap-2",
460
- children: [
461
- /* @__PURE__ */ jsxDEV2("span", {
462
- children: "\uD83D\uDCCB"
463
- }, undefined, false, undefined, this),
464
- /* @__PURE__ */ jsxDEV2("span", {
465
- children: "Step Details"
466
- }, undefined, false, undefined, this)
467
- ]
468
- }, undefined, true, undefined, this)
469
- }, undefined, false, undefined, this),
470
- /* @__PURE__ */ jsxDEV2(CardContent2, {
471
- children: /* @__PURE__ */ jsxDEV2("div", {
472
- className: "space-y-3",
473
- children: track.steps.map((step, index) => {
474
- const isCompleted = progress.completedStepIds.includes(step.id);
475
- const stepProgress = isCompleted ? 100 : 0;
476
- return /* @__PURE__ */ jsxDEV2("div", {
477
- className: "space-y-1",
478
- children: [
479
- /* @__PURE__ */ jsxDEV2("div", {
480
- className: "flex items-center justify-between text-sm",
481
- children: [
482
- /* @__PURE__ */ jsxDEV2("span", {
483
- className: isCompleted ? "text-green-500" : "text-foreground",
484
- children: [
485
- index + 1,
486
- ". ",
487
- step.title
488
- ]
489
- }, undefined, true, undefined, this),
490
- /* @__PURE__ */ jsxDEV2("span", {
491
- className: isCompleted ? "text-green-500" : "text-muted-foreground",
492
- children: isCompleted ? "✓" : "Pending"
493
- }, undefined, false, undefined, this)
494
- ]
495
- }, undefined, true, undefined, this),
496
- /* @__PURE__ */ jsxDEV2(Progress2, {
497
- value: stepProgress,
498
- className: "h-1"
499
- }, undefined, false, undefined, this)
500
- ]
501
- }, step.id, true, undefined, this);
502
- })
503
- }, undefined, false, undefined, this)
504
- }, undefined, false, undefined, this)
505
- ]
506
- }, undefined, true, undefined, this)
507
- ]
508
- }, undefined, true, undefined, this);
509
- }
510
- // src/components/StepChecklist.tsx
511
- import { Button as Button2 } from "@contractspec/lib.design-system";
512
- import { cn } from "@contractspec/lib.ui-kit-core";
513
- import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
514
- "use client";
515
- function StepChecklist({
516
- step,
517
- stepNumber,
518
- isCompleted,
519
- isCurrent,
520
- isExpanded,
521
- onToggle,
522
- onComplete
523
- }) {
524
- return /* @__PURE__ */ jsxDEV3("div", {
525
- className: cn("rounded-xl border transition-all", isCompleted && "border-green-500/50 bg-green-500/5", isCurrent && !isCompleted && "border-violet-500 bg-violet-500/5", !isCompleted && !isCurrent && "border-border"),
526
- children: [
527
- /* @__PURE__ */ jsxDEV3("button", {
528
- type: "button",
529
- className: "flex w-full items-center gap-4 p-4 text-left",
530
- onClick: onToggle,
531
- children: [
532
- /* @__PURE__ */ jsxDEV3("div", {
533
- className: cn("flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 font-semibold text-sm transition-colors", isCompleted && "border-green-500 bg-green-500 text-white", isCurrent && !isCompleted && "border-violet-500 text-violet-500", !isCompleted && !isCurrent && "border-muted-foreground text-muted-foreground"),
534
- children: isCompleted ? "✓" : stepNumber
535
- }, undefined, false, undefined, this),
536
- /* @__PURE__ */ jsxDEV3("div", {
537
- className: "min-w-0 flex-1",
538
- children: [
539
- /* @__PURE__ */ jsxDEV3("h4", {
540
- className: cn("font-semibold", isCompleted && "text-green-500", isCurrent && !isCompleted && "text-foreground", !isCompleted && !isCurrent && "text-muted-foreground"),
541
- children: step.title
542
- }, undefined, false, undefined, this),
543
- !isExpanded && step.description && /* @__PURE__ */ jsxDEV3("p", {
544
- className: "truncate text-muted-foreground text-sm",
545
- children: step.description
546
- }, undefined, false, undefined, this)
547
- ]
548
- }, undefined, true, undefined, this),
549
- step.xpReward && /* @__PURE__ */ jsxDEV3("span", {
550
- className: cn("shrink-0 rounded-full px-2 py-1 font-semibold text-xs", isCompleted ? "bg-green-500/10 text-green-500" : "bg-muted text-muted-foreground"),
551
- children: [
552
- "+",
553
- step.xpReward,
554
- " XP"
555
- ]
556
- }, undefined, true, undefined, this),
557
- /* @__PURE__ */ jsxDEV3("span", {
558
- className: cn("shrink-0 transition-transform", isExpanded && "rotate-180"),
559
- children: "▼"
560
- }, undefined, false, undefined, this)
561
- ]
562
- }, undefined, true, undefined, this),
563
- isExpanded && /* @__PURE__ */ jsxDEV3("div", {
564
- className: "border-t px-4 py-4",
565
- children: [
566
- step.description && /* @__PURE__ */ jsxDEV3("p", {
567
- className: "mb-4 text-muted-foreground",
568
- children: step.description
569
- }, undefined, false, undefined, this),
570
- step.instructions && /* @__PURE__ */ jsxDEV3("div", {
571
- className: "mb-4 rounded-lg bg-muted p-4",
572
- children: [
573
- /* @__PURE__ */ jsxDEV3("p", {
574
- className: "mb-2 font-medium text-sm",
575
- children: "Instructions:"
576
- }, undefined, false, undefined, this),
577
- /* @__PURE__ */ jsxDEV3("p", {
578
- className: "text-muted-foreground text-sm",
579
- children: step.instructions
580
- }, undefined, false, undefined, this)
581
- ]
582
- }, undefined, true, undefined, this),
583
- /* @__PURE__ */ jsxDEV3("div", {
584
- className: "flex flex-wrap gap-2",
585
- children: [
586
- step.actionUrl && /* @__PURE__ */ jsxDEV3(Button2, {
587
- variant: "outline",
588
- size: "sm",
589
- onClick: () => window.open(step.actionUrl, "_blank"),
590
- children: step.actionLabel ?? "Try it"
591
- }, undefined, false, undefined, this),
592
- !isCompleted && /* @__PURE__ */ jsxDEV3(Button2, {
593
- size: "sm",
594
- onClick: onComplete,
595
- children: "Mark as Complete"
596
- }, undefined, false, undefined, this)
597
- ]
598
- }, undefined, true, undefined, this)
599
- ]
600
- }, undefined, true, undefined, this)
601
- ]
602
- }, undefined, true, undefined, this);
603
- }
604
-
605
- // src/views/Steps.tsx
606
- import { Progress as Progress3 } from "@contractspec/lib.ui-kit-web/ui/progress";
607
- import { useState } from "react";
608
- import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
609
- "use client";
610
- function Steps({ track, progress, onStepComplete }) {
611
- const [expandedStepId, setExpandedStepId] = useState(() => {
612
- const firstIncomplete = track.steps.find((s) => !progress.completedStepIds.includes(s.id));
613
- return firstIncomplete?.id ?? null;
614
- });
615
- const completedSteps = progress.completedStepIds.length;
616
- const totalSteps = track.steps.length;
617
- const percentComplete = totalSteps > 0 ? completedSteps / totalSteps * 100 : 0;
618
- const currentStepIndex = track.steps.findIndex((s) => !progress.completedStepIds.includes(s.id));
619
- return /* @__PURE__ */ jsxDEV4("div", {
620
- className: "space-y-6",
621
- children: [
622
- /* @__PURE__ */ jsxDEV4("div", {
623
- className: "space-y-2",
624
- children: [
625
- /* @__PURE__ */ jsxDEV4("div", {
626
- className: "flex items-center justify-between",
627
- children: [
628
- /* @__PURE__ */ jsxDEV4("h2", {
629
- className: "font-bold text-xl",
630
- children: "Complete Each Step"
631
- }, undefined, false, undefined, this),
632
- /* @__PURE__ */ jsxDEV4("span", {
633
- className: "text-muted-foreground text-sm",
634
- children: [
635
- completedSteps,
636
- " / ",
637
- totalSteps,
638
- " completed"
639
- ]
640
- }, undefined, true, undefined, this)
641
- ]
642
- }, undefined, true, undefined, this),
643
- /* @__PURE__ */ jsxDEV4(Progress3, {
644
- value: percentComplete,
645
- className: "h-2"
646
- }, undefined, false, undefined, this)
647
- ]
648
- }, undefined, true, undefined, this),
649
- /* @__PURE__ */ jsxDEV4("div", {
650
- className: "space-y-3",
651
- children: track.steps.map((step, index) => {
652
- const isCompleted = progress.completedStepIds.includes(step.id);
653
- const isCurrent = index === currentStepIndex;
654
- return /* @__PURE__ */ jsxDEV4(StepChecklist, {
655
- step,
656
- stepNumber: index + 1,
657
- isCompleted,
658
- isCurrent,
659
- isExpanded: expandedStepId === step.id,
660
- onToggle: () => setExpandedStepId(expandedStepId === step.id ? null : step.id),
661
- onComplete: () => {
662
- onStepComplete?.(step.id);
663
- const nextStep = track.steps[index + 1];
664
- if (nextStep && !progress.completedStepIds.includes(nextStep.id)) {
665
- setExpandedStepId(nextStep.id);
666
- }
667
- }
668
- }, step.id, false, undefined, this);
669
- })
670
- }, undefined, false, undefined, this),
671
- track.completionRewards && percentComplete < 100 && /* @__PURE__ */ jsxDEV4("div", {
672
- className: "rounded-lg border border-blue-500/30 bg-blue-500/5 p-4",
673
- children: /* @__PURE__ */ jsxDEV4("p", {
674
- className: "text-sm",
675
- children: [
676
- "\uD83C\uDF81 Complete all steps to unlock:",
677
- track.completionRewards.xpBonus && /* @__PURE__ */ jsxDEV4("span", {
678
- className: "ml-2 font-semibold text-blue-500",
679
- children: [
680
- "+",
681
- track.completionRewards.xpBonus,
682
- " XP bonus"
683
- ]
684
- }, undefined, true, undefined, this),
685
- track.completionRewards.badgeKey && /* @__PURE__ */ jsxDEV4("span", {
686
- className: "ml-2 font-semibold text-amber-500",
687
- children: [
688
- '+ "',
689
- track.completionRewards.badgeKey,
690
- '" badge'
691
- ]
692
- }, undefined, true, undefined, this)
693
- ]
694
- }, undefined, true, undefined, this)
695
- }, undefined, false, undefined, this)
696
- ]
697
- }, undefined, true, undefined, this);
698
- }
699
-
700
- // src/components/JourneyMap.tsx
701
- import { cn as cn2 } from "@contractspec/lib.ui-kit-web/ui/utils";
702
- import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
703
- "use client";
704
- var SURFACE_ICONS = {
705
- templates: "\uD83D\uDCCB",
706
- "spec-editor": "✏️",
707
- regenerator: "\uD83D\uDD04",
708
- playground: "\uD83C\uDFAE",
709
- evolution: "\uD83E\uDD16",
710
- dashboard: "\uD83D\uDCCA",
711
- settings: "⚙️",
712
- default: "\uD83D\uDCCD"
713
- };
714
- function JourneyMap({
715
- steps,
716
- completedStepIds,
717
- currentStepId
718
- }) {
719
- return /* @__PURE__ */ jsxDEV5("div", {
720
- className: "relative overflow-x-auto pb-4",
721
- children: /* @__PURE__ */ jsxDEV5("div", {
722
- className: "flex min-w-max items-center gap-2",
723
- children: steps.map((step, index) => {
724
- const isCompleted = completedStepIds.includes(step.id);
725
- const isCurrent = step.id === currentStepId;
726
- const surface = step.metadata?.surface ?? "default";
727
- const icon = SURFACE_ICONS[surface] ?? SURFACE_ICONS.default;
728
- return /* @__PURE__ */ jsxDEV5("div", {
729
- className: "flex items-center",
730
- children: [
731
- /* @__PURE__ */ jsxDEV5("div", {
732
- className: "flex flex-col items-center gap-2",
733
- children: [
734
- /* @__PURE__ */ jsxDEV5("div", {
735
- className: cn2("flex h-14 w-14 items-center justify-center rounded-2xl border-2 text-2xl transition-all", isCompleted && "border-green-500 bg-green-500/10", isCurrent && !isCompleted && "border-violet-500 bg-violet-500/10 ring-4 ring-violet-500/20", !isCompleted && !isCurrent && "border-muted bg-muted/50"),
736
- children: isCompleted ? "✓" : icon
737
- }, undefined, false, undefined, this),
738
- /* @__PURE__ */ jsxDEV5("div", {
739
- className: "text-center",
740
- children: /* @__PURE__ */ jsxDEV5("p", {
741
- className: cn2("max-w-[100px] truncate font-medium text-xs", isCompleted && "text-green-500", isCurrent && !isCompleted && "text-violet-500", !isCompleted && !isCurrent && "text-muted-foreground"),
742
- children: step.title
743
- }, undefined, false, undefined, this)
744
- }, undefined, false, undefined, this)
745
- ]
746
- }, undefined, true, undefined, this),
747
- index < steps.length - 1 && /* @__PURE__ */ jsxDEV5("div", {
748
- className: cn2("mx-2 h-1 w-8 rounded-full transition-colors", completedStepIds.includes(steps[index + 1]?.id ?? "") ? "bg-green-500" : isCompleted ? "bg-green-500/50" : "bg-muted")
749
- }, undefined, false, undefined, this)
750
- ]
751
- }, step.id, true, undefined, this);
752
- })
753
- }, undefined, false, undefined, this)
754
- }, undefined, false, undefined, this);
755
- }
756
-
757
- // src/views/Timeline.tsx
758
- import {
759
- Card as Card3,
760
- CardContent as CardContent3,
761
- CardHeader as CardHeader3,
762
- CardTitle as CardTitle3
763
- } from "@contractspec/lib.ui-kit-web/ui/card";
764
- import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
765
- "use client";
766
- function Timeline({ track, progress }) {
767
- const currentStepId = track.steps.find((s) => !progress.completedStepIds.includes(s.id))?.id ?? null;
768
- return /* @__PURE__ */ jsxDEV6("div", {
769
- className: "space-y-6",
770
- children: [
771
- /* @__PURE__ */ jsxDEV6("div", {
772
- className: "text-center",
773
- children: [
774
- /* @__PURE__ */ jsxDEV6("h2", {
775
- className: "font-bold text-xl",
776
- children: "Your Learning Journey"
777
- }, undefined, false, undefined, this),
778
- /* @__PURE__ */ jsxDEV6("p", {
779
- className: "text-muted-foreground",
780
- children: "Follow the path through each surface and feature"
781
- }, undefined, false, undefined, this)
782
- ]
783
- }, undefined, true, undefined, this),
784
- /* @__PURE__ */ jsxDEV6(Card3, {
785
- children: [
786
- /* @__PURE__ */ jsxDEV6(CardHeader3, {
787
- children: /* @__PURE__ */ jsxDEV6(CardTitle3, {
788
- className: "flex items-center gap-2",
789
- children: [
790
- /* @__PURE__ */ jsxDEV6("span", {
791
- children: "\uD83D\uDDFA️"
792
- }, undefined, false, undefined, this),
793
- /* @__PURE__ */ jsxDEV6("span", {
794
- children: "Journey Map"
795
- }, undefined, false, undefined, this)
796
- ]
797
- }, undefined, true, undefined, this)
798
- }, undefined, false, undefined, this),
799
- /* @__PURE__ */ jsxDEV6(CardContent3, {
800
- children: /* @__PURE__ */ jsxDEV6(JourneyMap, {
801
- steps: track.steps,
802
- completedStepIds: progress.completedStepIds,
803
- currentStepId
804
- }, undefined, false, undefined, this)
805
- }, undefined, false, undefined, this)
806
- ]
807
- }, undefined, true, undefined, this),
808
- /* @__PURE__ */ jsxDEV6(Card3, {
809
- children: [
810
- /* @__PURE__ */ jsxDEV6(CardHeader3, {
811
- children: /* @__PURE__ */ jsxDEV6(CardTitle3, {
812
- className: "flex items-center gap-2",
813
- children: [
814
- /* @__PURE__ */ jsxDEV6("span", {
815
- children: "\uD83D\uDCCD"
816
- }, undefined, false, undefined, this),
817
- /* @__PURE__ */ jsxDEV6("span", {
818
- children: "Step by Step"
819
- }, undefined, false, undefined, this)
820
- ]
821
- }, undefined, true, undefined, this)
822
- }, undefined, false, undefined, this),
823
- /* @__PURE__ */ jsxDEV6(CardContent3, {
824
- children: /* @__PURE__ */ jsxDEV6("div", {
825
- className: "relative",
826
- children: [
827
- /* @__PURE__ */ jsxDEV6("div", {
828
- className: "absolute top-0 left-4 h-full w-0.5 bg-border"
829
- }, undefined, false, undefined, this),
830
- /* @__PURE__ */ jsxDEV6("div", {
831
- className: "space-y-6",
832
- children: track.steps.map((step, index) => {
833
- const isCompleted = progress.completedStepIds.includes(step.id);
834
- const isCurrent = step.id === currentStepId;
835
- const surface = step.metadata?.surface ?? "general";
836
- return /* @__PURE__ */ jsxDEV6("div", {
837
- className: "relative flex gap-4 pl-2",
838
- children: [
839
- /* @__PURE__ */ jsxDEV6("div", {
840
- className: `relative z-10 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 transition-all ${isCompleted ? "border-green-500 bg-green-500 text-white" : isCurrent ? "border-blue-500 bg-blue-500 text-white ring-4 ring-blue-500/20" : "border-border bg-background text-muted-foreground"}`,
841
- children: isCompleted ? "✓" : index + 1
842
- }, undefined, false, undefined, this),
843
- /* @__PURE__ */ jsxDEV6("div", {
844
- className: "flex-1 pb-2",
845
- children: /* @__PURE__ */ jsxDEV6("div", {
846
- className: "rounded-lg border p-4",
847
- children: [
848
- /* @__PURE__ */ jsxDEV6("div", {
849
- className: "flex items-start justify-between gap-2",
850
- children: [
851
- /* @__PURE__ */ jsxDEV6("div", {
852
- children: [
853
- /* @__PURE__ */ jsxDEV6("div", {
854
- className: "flex items-center gap-2",
855
- children: [
856
- /* @__PURE__ */ jsxDEV6("h4", {
857
- className: `font-semibold ${isCompleted ? "text-green-500" : isCurrent ? "text-blue-500" : "text-foreground"}`,
858
- children: step.title
859
- }, undefined, false, undefined, this),
860
- /* @__PURE__ */ jsxDEV6("span", {
861
- className: "rounded bg-muted px-2 py-0.5 text-muted-foreground text-xs",
862
- children: surface
863
- }, undefined, false, undefined, this)
864
- ]
865
- }, undefined, true, undefined, this),
866
- /* @__PURE__ */ jsxDEV6("p", {
867
- className: "mt-1 text-muted-foreground text-sm",
868
- children: step.description
869
- }, undefined, false, undefined, this)
870
- ]
871
- }, undefined, true, undefined, this),
872
- step.xpReward && /* @__PURE__ */ jsxDEV6("span", {
873
- className: `shrink-0 rounded-full px-2 py-1 font-semibold text-xs ${isCompleted ? "bg-green-500/10 text-green-500" : "bg-muted text-muted-foreground"}`,
874
- children: [
875
- "+",
876
- step.xpReward,
877
- " XP"
878
- ]
879
- }, undefined, true, undefined, this)
880
- ]
881
- }, undefined, true, undefined, this),
882
- /* @__PURE__ */ jsxDEV6("div", {
883
- className: "mt-3 text-xs",
884
- children: isCompleted ? /* @__PURE__ */ jsxDEV6("span", {
885
- className: "text-green-500",
886
- children: "✓ Completed"
887
- }, undefined, false, undefined, this) : isCurrent ? /* @__PURE__ */ jsxDEV6("span", {
888
- className: "text-blue-500",
889
- children: "→ In Progress"
890
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV6("span", {
891
- className: "text-muted-foreground",
892
- children: "○ Not Started"
893
- }, undefined, false, undefined, this)
894
- }, undefined, false, undefined, this)
895
- ]
896
- }, undefined, true, undefined, this)
897
- }, undefined, false, undefined, this)
898
- ]
899
- }, step.id, true, undefined, this);
900
- })
901
- }, undefined, false, undefined, this)
902
- ]
903
- }, undefined, true, undefined, this)
904
- }, undefined, false, undefined, this)
905
- ]
906
- }, undefined, true, undefined, this)
907
- ]
908
- }, undefined, true, undefined, this);
909
- }
910
-
911
- // src/OnboardingMiniApp.tsx
912
- import {
913
- useLearningProgress,
914
- ViewTabs
915
- } from "@contractspec/example.learning-journey-ui-shared";
916
- import { Card as Card4, CardContent as CardContent4 } from "@contractspec/lib.ui-kit-web/ui/card";
917
- import { useCallback, useState as useState2 } from "react";
918
- import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
919
- "use client";
920
- function OnboardingMiniApp({
921
- track,
922
- progress: externalProgress,
923
- onStepComplete: externalOnStepComplete,
924
- onViewChange,
925
- initialView = "overview"
926
- }) {
927
- const [currentView, setCurrentView] = useState2(initialView);
928
- const { progress: internalProgress, completeStep: internalCompleteStep } = useLearningProgress(track);
929
- const progress = externalProgress ?? internalProgress;
930
- const handleViewChange = useCallback((view) => {
931
- setCurrentView(view);
932
- onViewChange?.(view);
933
- }, [onViewChange]);
934
- const handleStepComplete = useCallback((stepId) => {
935
- if (externalOnStepComplete) {
936
- externalOnStepComplete(stepId);
937
- } else {
938
- internalCompleteStep(stepId);
939
- }
940
- }, [externalOnStepComplete, internalCompleteStep]);
941
- const handleStartFromOverview = useCallback(() => {
942
- setCurrentView("steps");
943
- onViewChange?.("steps");
944
- }, [onViewChange]);
945
- const renderView = () => {
946
- const viewProps = {
947
- track,
948
- progress,
949
- onStepComplete: handleStepComplete
950
- };
951
- switch (currentView) {
952
- case "overview":
953
- return /* @__PURE__ */ jsxDEV7(Overview, {
954
- ...viewProps,
955
- onStart: handleStartFromOverview
956
- }, undefined, false, undefined, this);
957
- case "steps":
958
- return /* @__PURE__ */ jsxDEV7(Steps, {
959
- ...viewProps
960
- }, undefined, false, undefined, this);
961
- case "progress":
962
- return /* @__PURE__ */ jsxDEV7(ProgressView, {
963
- ...viewProps
964
- }, undefined, false, undefined, this);
965
- case "timeline":
966
- return /* @__PURE__ */ jsxDEV7(Timeline, {
967
- ...viewProps
968
- }, undefined, false, undefined, this);
969
- default:
970
- return /* @__PURE__ */ jsxDEV7(Overview, {
971
- ...viewProps,
972
- onStart: handleStartFromOverview
973
- }, undefined, false, undefined, this);
974
- }
975
- };
976
- return /* @__PURE__ */ jsxDEV7("div", {
977
- className: "space-y-6",
978
- children: [
979
- /* @__PURE__ */ jsxDEV7(Card4, {
980
- children: /* @__PURE__ */ jsxDEV7(CardContent4, {
981
- className: "p-4",
982
- children: /* @__PURE__ */ jsxDEV7(ViewTabs, {
983
- currentView,
984
- onViewChange: handleViewChange
985
- }, undefined, false, undefined, this)
986
- }, undefined, false, undefined, this)
987
- }, undefined, false, undefined, this),
988
- renderView()
989
- ]
990
- }, undefined, true, undefined, this);
991
- }
992
- export {
993
- OnboardingMiniApp
994
- };
1
+ import{XpBar as t}from"@contractspec/example.learning-journey-ui-shared";import{Button as e}from"@contractspec/lib.design-system";import{Card as E,CardContent as M,CardHeader as P,CardTitle as u}from"@contractspec/lib.ui-kit-web/ui/card";import{Progress as s}from"@contractspec/lib.ui-kit-web/ui/progress";import{jsx as L,jsxs as U}from"react/jsx-runtime";function m({track:f,progress:N,onStart:y}){let b=f.steps.length,K=N.completedStepIds.length,z=b>0?K/b*100:0,G=K===b,Z=b-K,Y=Z*5,W=f.totalXp??f.steps.reduce((R,D)=>R+(D.xpReward??0),0)+(f.completionRewards?.xpBonus??0);return U("div",{className:"space-y-6",children:[L(E,{className:"overflow-hidden bg-gradient-to-r from-blue-500/10 via-violet-500/10 to-purple-500/10",children:L(M,{className:"p-8",children:U("div",{className:"flex flex-col items-center gap-6 text-center md:flex-row md:text-left",children:[L("div",{className:"flex h-20 w-20 items-center justify-center rounded-2xl bg-gradient-to-br from-blue-500 to-violet-600 text-4xl shadow-lg",children:G?"\uD83C\uDF89":"\uD83D\uDE80"}),U("div",{className:"flex-1",children:[L("h1",{className:"font-bold text-2xl",children:f.name}),L("p",{className:"mt-1 max-w-2xl text-muted-foreground",children:f.description}),!G&&U("p",{className:"mt-3 text-muted-foreground text-sm",children:["⏱️ Estimated time:"," ",Y>0?`~${Y} minutes`:"Less than a minute"]})]}),!G&&L(e,{size:"lg",onClick:y,children:K>0?"Continue":"Get Started"})]})})}),U("div",{className:"grid gap-4 md:grid-cols-3",children:[U(E,{children:[L(P,{className:"pb-2",children:L(u,{className:"font-medium text-muted-foreground text-sm",children:"Progress"})}),U(M,{children:[U("div",{className:"font-bold text-3xl",children:[Math.round(z),"%"]}),L(s,{value:z,className:"mt-2 h-2"}),U("p",{className:"mt-2 text-muted-foreground text-sm",children:[K," of ",b," steps completed"]})]})]}),U(E,{children:[L(P,{className:"pb-2",children:L(u,{className:"font-medium text-muted-foreground text-sm",children:"XP Earned"})}),U(M,{children:[L("div",{className:"font-bold text-3xl text-blue-500",children:N.xpEarned}),L(t,{current:N.xpEarned,max:W,showLabel:!1,size:"sm"})]})]}),U(E,{children:[L(P,{className:"pb-2",children:L(u,{className:"font-medium text-muted-foreground text-sm",children:"Time Remaining"})}),U(M,{children:[L("div",{className:"font-bold text-3xl",children:G?"✓":`~${Y}m`}),L("p",{className:"mt-2 text-muted-foreground text-sm",children:G?"All done!":`${Z} steps to go`})]})]})]}),U(E,{children:[L(P,{children:U(u,{className:"flex items-center gap-2",children:[L("span",{children:"\uD83D\uDCCB"}),L("span",{children:"Your Journey"})]})}),L(M,{children:L("div",{className:"space-y-3",children:f.steps.map((R,D)=>{let _=N.completedStepIds.includes(R.id),F=!_&&f.steps.slice(0,D).every(($)=>N.completedStepIds.includes($.id));return U("div",{className:"flex items-center gap-4 rounded-lg border p-3",children:[L("div",{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full font-semibold text-sm ${_?"bg-green-500 text-white":F?"bg-blue-500 text-white":"bg-muted text-muted-foreground"}`,children:_?"✓":D+1}),L("div",{className:"min-w-0 flex-1",children:L("p",{className:`font-medium ${_?"text-green-500":F?"text-foreground":"text-muted-foreground"}`,children:R.title})}),R.xpReward&&U("span",{className:"text-muted-foreground text-sm",children:["+",R.xpReward," XP"]})]},R.id)})})})]}),G&&L(E,{className:"border-green-500/50 bg-green-500/5",children:U(M,{className:"flex items-center gap-4 p-6",children:[L("div",{className:"text-4xl",children:"\uD83C\uDF89"}),U("div",{children:[L("h3",{className:"font-semibold text-green-500 text-lg",children:"Onboarding Complete!"}),U("p",{className:"text-muted-foreground",children:["You've completed all ",b," steps. Welcome aboard!"]})]})]})})]})}import{BadgeDisplay as f0,XpBar as b0}from"@contractspec/example.learning-journey-ui-shared";import{Card as V,CardContent as I,CardHeader as w,CardTitle as g}from"@contractspec/lib.ui-kit-web/ui/card";import{Progress as N0}from"@contractspec/lib.ui-kit-web/ui/progress";import{jsx as q,jsxs as J}from"react/jsx-runtime";function l({track:f,progress:N}){let y=f.steps.length,b=N.completedStepIds.length,K=y>0?b/y*100:0,z=f.totalXp??f.steps.reduce((Y,W)=>Y+(W.xpReward??0),0)+(f.completionRewards?.xpBonus??0),G=y-b,Z=G*5;return J("div",{className:"space-y-6",children:[J(V,{children:[q(w,{children:J(g,{className:"flex items-center gap-2",children:[q("span",{children:"\uD83D\uDCC8"}),q("span",{children:"Your Progress"})]})}),J(I,{className:"space-y-6",children:[q("div",{className:"flex items-center justify-center",children:J("div",{className:"relative flex h-40 w-40 items-center justify-center",children:[J("svg",{className:"absolute h-full w-full -rotate-90",viewBox:"0 0 100 100",children:[q("circle",{cx:"50",cy:"50",r:"45",fill:"none",strokeWidth:"8",className:"stroke-muted"}),q("circle",{cx:"50",cy:"50",r:"45",fill:"none",strokeWidth:"8",strokeLinecap:"round",strokeDasharray:`${K*2.83} 283`,className:"stroke-blue-500 transition-all duration-500"})]}),J("div",{className:"text-center",children:[J("div",{className:"font-bold text-3xl",children:[Math.round(K),"%"]}),q("div",{className:"text-muted-foreground text-sm",children:"Complete"})]})]})}),J("div",{className:"grid grid-cols-3 gap-4 text-center",children:[J("div",{children:[q("div",{className:"font-bold text-2xl text-green-500",children:b}),q("div",{className:"text-muted-foreground text-sm",children:"Completed"})]}),J("div",{children:[q("div",{className:"font-bold text-2xl text-orange-500",children:G}),q("div",{className:"text-muted-foreground text-sm",children:"Remaining"})]}),J("div",{children:[J("div",{className:"font-bold text-2xl",children:[Z,"m"]}),q("div",{className:"text-muted-foreground text-sm",children:"Est. Time"})]})]})]})]}),J(V,{children:[q(w,{children:J(g,{className:"flex items-center gap-2",children:[q("span",{children:"⚡"}),q("span",{children:"Experience Points"})]})}),J(I,{className:"space-y-4",children:[J("div",{className:"flex items-baseline gap-2",children:[q("span",{className:"font-bold text-3xl text-blue-500",children:N.xpEarned}),J("span",{className:"text-muted-foreground",children:["/ ",z," XP"]})]}),q(b0,{current:N.xpEarned,max:z,showLabel:!1,size:"lg"})]})]}),J(V,{children:[q(w,{children:J(g,{className:"flex items-center gap-2",children:[q("span",{children:"\uD83C\uDFC5"}),q("span",{children:"Achievements"})]})}),J(I,{children:[q(f0,{badges:N.badges,size:"lg"}),N.badges.length===0&&f.completionRewards?.badgeKey&&J("p",{className:"text-muted-foreground text-sm",children:['Complete all steps to earn the "',f.completionRewards.badgeKey,'" badge!']})]})]}),J(V,{children:[q(w,{children:J(g,{className:"flex items-center gap-2",children:[q("span",{children:"\uD83D\uDCCB"}),q("span",{children:"Step Details"})]})}),q(I,{children:q("div",{className:"space-y-3",children:f.steps.map((Y,W)=>{let R=N.completedStepIds.includes(Y.id),D=R?100:0;return J("div",{className:"space-y-1",children:[J("div",{className:"flex items-center justify-between text-sm",children:[J("span",{className:R?"text-green-500":"text-foreground",children:[W+1,". ",Y.title]}),q("span",{className:R?"text-green-500":"text-muted-foreground",children:R?"✓":"Pending"})]}),q(N0,{value:D,className:"h-1"})]},Y.id)})})})]})]})}import{Button as n}from"@contractspec/lib.design-system";import{cn as T}from"@contractspec/lib.ui-kit-core";import{jsx as A,jsxs as X}from"react/jsx-runtime";function c({step:f,stepNumber:N,isCompleted:y,isCurrent:b,isExpanded:K,onToggle:z,onComplete:G}){return X("div",{className:T("rounded-xl border transition-all",y&&"border-green-500/50 bg-green-500/5",b&&!y&&"border-violet-500 bg-violet-500/5",!y&&!b&&"border-border"),children:[X("button",{type:"button",className:"flex w-full items-center gap-4 p-4 text-left",onClick:z,children:[A("div",{className:T("flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 font-semibold text-sm transition-colors",y&&"border-green-500 bg-green-500 text-white",b&&!y&&"border-violet-500 text-violet-500",!y&&!b&&"border-muted-foreground text-muted-foreground"),children:y?"✓":N}),X("div",{className:"min-w-0 flex-1",children:[A("h4",{className:T("font-semibold",y&&"text-green-500",b&&!y&&"text-foreground",!y&&!b&&"text-muted-foreground"),children:f.title}),!K&&f.description&&A("p",{className:"truncate text-muted-foreground text-sm",children:f.description})]}),f.xpReward&&X("span",{className:T("shrink-0 rounded-full px-2 py-1 font-semibold text-xs",y?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"),children:["+",f.xpReward," XP"]}),A("span",{className:T("shrink-0 transition-transform",K&&"rotate-180"),children:"▼"})]}),K&&X("div",{className:"border-t px-4 py-4",children:[f.description&&A("p",{className:"mb-4 text-muted-foreground",children:f.description}),f.instructions&&X("div",{className:"mb-4 rounded-lg bg-muted p-4",children:[A("p",{className:"mb-2 font-medium text-sm",children:"Instructions:"}),A("p",{className:"text-muted-foreground text-sm",children:f.instructions})]}),X("div",{className:"flex flex-wrap gap-2",children:[f.actionUrl&&A(n,{variant:"outline",size:"sm",onClick:()=>window.open(f.actionUrl,"_blank"),children:f.actionLabel??"Try it"}),!y&&A(n,{size:"sm",onClick:G,children:"Mark as Complete"})]})]})]})}import{Progress as y0}from"@contractspec/lib.ui-kit-web/ui/progress";import{useState as z0}from"react";import{jsx as O,jsxs as h}from"react/jsx-runtime";function o({track:f,progress:N,onStepComplete:y}){let[b,K]=z0(()=>{return f.steps.find((R)=>!N.completedStepIds.includes(R.id))?.id??null}),z=N.completedStepIds.length,G=f.steps.length,Z=G>0?z/G*100:0,Y=f.steps.findIndex((W)=>!N.completedStepIds.includes(W.id));return h("div",{className:"space-y-6",children:[h("div",{className:"space-y-2",children:[h("div",{className:"flex items-center justify-between",children:[O("h2",{className:"font-bold text-xl",children:"Complete Each Step"}),h("span",{className:"text-muted-foreground text-sm",children:[z," / ",G," completed"]})]}),O(y0,{value:Z,className:"h-2"})]}),O("div",{className:"space-y-3",children:f.steps.map((W,R)=>{let D=N.completedStepIds.includes(W.id),_=R===Y;return O(c,{step:W,stepNumber:R+1,isCompleted:D,isCurrent:_,isExpanded:b===W.id,onToggle:()=>K(b===W.id?null:W.id),onComplete:()=>{y?.(W.id);let F=f.steps[R+1];if(F&&!N.completedStepIds.includes(F.id))K(F.id)}},W.id)})}),f.completionRewards&&Z<100&&O("div",{className:"rounded-lg border border-blue-500/30 bg-blue-500/5 p-4",children:h("p",{className:"text-sm",children:["\uD83C\uDF81 Complete all steps to unlock:",f.completionRewards.xpBonus&&h("span",{className:"ml-2 font-semibold text-blue-500",children:["+",f.completionRewards.xpBonus," XP bonus"]}),f.completionRewards.badgeKey&&h("span",{className:"ml-2 font-semibold text-amber-500",children:['+ "',f.completionRewards.badgeKey,'" badge']})]})})]})}import{cn as k}from"@contractspec/lib.ui-kit-web/ui/utils";import{jsx as H,jsxs as i}from"react/jsx-runtime";var d={templates:"\uD83D\uDCCB","spec-editor":"✏️",regenerator:"\uD83D\uDD04",playground:"\uD83C\uDFAE",evolution:"\uD83E\uDD16",dashboard:"\uD83D\uDCCA",settings:"⚙️",default:"\uD83D\uDCCD"};function C({steps:f,completedStepIds:N,currentStepId:y}){return H("div",{className:"relative overflow-x-auto pb-4",children:H("div",{className:"flex min-w-max items-center gap-2",children:f.map((b,K)=>{let z=N.includes(b.id),G=b.id===y,Z=b.metadata?.surface??"default",Y=d[Z]??d.default;return i("div",{className:"flex items-center",children:[i("div",{className:"flex flex-col items-center gap-2",children:[H("div",{className:k("flex h-14 w-14 items-center justify-center rounded-2xl border-2 text-2xl transition-all",z&&"border-green-500 bg-green-500/10",G&&!z&&"border-violet-500 bg-violet-500/10 ring-4 ring-violet-500/20",!z&&!G&&"border-muted bg-muted/50"),children:z?"✓":Y}),H("div",{className:"text-center",children:H("p",{className:k("max-w-[100px] truncate font-medium text-xs",z&&"text-green-500",G&&!z&&"text-violet-500",!z&&!G&&"text-muted-foreground"),children:b.title})})]}),K<f.length-1&&H("div",{className:k("mx-2 h-1 w-8 rounded-full transition-colors",N.includes(f[K+1]?.id??"")?"bg-green-500":z?"bg-green-500/50":"bg-muted")})]},b.id)})})})}import{Card as a,CardContent as j,CardHeader as x,CardTitle as p}from"@contractspec/lib.ui-kit-web/ui/card";import{jsx as Q,jsxs as B}from"react/jsx-runtime";function r({track:f,progress:N}){let y=f.steps.find((b)=>!N.completedStepIds.includes(b.id))?.id??null;return B("div",{className:"space-y-6",children:[B("div",{className:"text-center",children:[Q("h2",{className:"font-bold text-xl",children:"Your Learning Journey"}),Q("p",{className:"text-muted-foreground",children:"Follow the path through each surface and feature"})]}),B(a,{children:[Q(x,{children:B(p,{className:"flex items-center gap-2",children:[Q("span",{children:"\uD83D\uDDFA️"}),Q("span",{children:"Journey Map"})]})}),Q(j,{children:Q(C,{steps:f.steps,completedStepIds:N.completedStepIds,currentStepId:y})})]}),B(a,{children:[Q(x,{children:B(p,{className:"flex items-center gap-2",children:[Q("span",{children:"\uD83D\uDCCD"}),Q("span",{children:"Step by Step"})]})}),Q(j,{children:B("div",{className:"relative",children:[Q("div",{className:"absolute top-0 left-4 h-full w-0.5 bg-border"}),Q("div",{className:"space-y-6",children:f.steps.map((b,K)=>{let z=N.completedStepIds.includes(b.id),G=b.id===y,Z=b.metadata?.surface??"general";return B("div",{className:"relative flex gap-4 pl-2",children:[Q("div",{className:`relative z-10 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border-2 transition-all ${z?"border-green-500 bg-green-500 text-white":G?"border-blue-500 bg-blue-500 text-white ring-4 ring-blue-500/20":"border-border bg-background text-muted-foreground"}`,children:z?"✓":K+1}),Q("div",{className:"flex-1 pb-2",children:B("div",{className:"rounded-lg border p-4",children:[B("div",{className:"flex items-start justify-between gap-2",children:[B("div",{children:[B("div",{className:"flex items-center gap-2",children:[Q("h4",{className:`font-semibold ${z?"text-green-500":G?"text-blue-500":"text-foreground"}`,children:b.title}),Q("span",{className:"rounded bg-muted px-2 py-0.5 text-muted-foreground text-xs",children:Z})]}),Q("p",{className:"mt-1 text-muted-foreground text-sm",children:b.description})]}),b.xpReward&&B("span",{className:`shrink-0 rounded-full px-2 py-1 font-semibold text-xs ${z?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"}`,children:["+",b.xpReward," XP"]})]}),Q("div",{className:"mt-3 text-xs",children:z?Q("span",{className:"text-green-500",children:"✓ Completed"}):G?Q("span",{className:"text-blue-500",children:"→ In Progress"}):Q("span",{className:"text-muted-foreground",children:"○ Not Started"})})]})})]},b.id)})})]})})]})]})}import{useLearningProgress as L0,ViewTabs as q0}from"@contractspec/example.learning-journey-ui-shared";import{Card as G0,CardContent as J0}from"@contractspec/lib.ui-kit-web/ui/card";import{useCallback as S,useState as K0}from"react";import{jsx as v,jsxs as Q0}from"react/jsx-runtime";function C0({track:f,progress:N,onStepComplete:y,onViewChange:b,initialView:K="overview"}){let[z,G]=K0(K),{progress:Z,completeStep:Y}=L0(f),W=N??Z,R=S(($)=>{G($),b?.($)},[b]),D=S(($)=>{if(y)y($);else Y($)},[y,Y]),_=S(()=>{G("steps"),b?.("steps")},[b]);return Q0("div",{className:"space-y-6",children:[v(G0,{children:v(J0,{className:"p-4",children:v(q0,{currentView:z,onViewChange:R})})}),(()=>{let $={track:f,progress:W,onStepComplete:D};switch(z){case"overview":return v(m,{...$,onStart:_});case"steps":return v(o,{...$});case"progress":return v(l,{...$});case"timeline":return v(r,{...$});default:return v(m,{...$,onStart:_})}})()]})}export{C0 as OnboardingMiniApp};