@contractspec/example.learning-journey-registry 1.57.0 → 1.58.0

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 (77) hide show
  1. package/.turbo/turbo-build.log +52 -55
  2. package/.turbo/turbo-prebuild.log +1 -0
  3. package/CHANGELOG.md +23 -0
  4. package/dist/api-types.d.ts +33 -37
  5. package/dist/api-types.d.ts.map +1 -1
  6. package/dist/api-types.js +1 -0
  7. package/dist/api.d.ts +7 -11
  8. package/dist/api.d.ts.map +1 -1
  9. package/dist/api.js +261 -161
  10. package/dist/api.test.d.ts +2 -0
  11. package/dist/api.test.d.ts.map +1 -0
  12. package/dist/browser/api-types.js +0 -0
  13. package/dist/browser/api.js +270 -0
  14. package/dist/browser/docs/index.js +33 -0
  15. package/dist/browser/docs/learning-journey-registry.docblock.js +33 -0
  16. package/dist/browser/example.js +32 -0
  17. package/dist/browser/index.js +540 -0
  18. package/dist/browser/learning-journey-registry.feature.js +45 -0
  19. package/dist/browser/presentations/index.js +67 -0
  20. package/dist/browser/progress-store.js +34 -0
  21. package/dist/browser/tracks.js +52 -0
  22. package/dist/browser/ui/LearningMiniApp.js +133 -0
  23. package/dist/browser/ui/index.js +133 -0
  24. package/dist/docs/index.d.ts +2 -1
  25. package/dist/docs/index.d.ts.map +1 -0
  26. package/dist/docs/index.js +34 -1
  27. package/dist/docs/learning-journey-registry.docblock.d.ts +2 -1
  28. package/dist/docs/learning-journey-registry.docblock.d.ts.map +1 -0
  29. package/dist/docs/learning-journey-registry.docblock.js +18 -22
  30. package/dist/example.d.ts +2 -6
  31. package/dist/example.d.ts.map +1 -1
  32. package/dist/example.js +31 -39
  33. package/dist/index.d.ts +8 -8
  34. package/dist/index.d.ts.map +1 -0
  35. package/dist/index.js +541 -10
  36. package/dist/learning-journey-registry.feature.d.ts +1 -6
  37. package/dist/learning-journey-registry.feature.d.ts.map +1 -1
  38. package/dist/learning-journey-registry.feature.js +44 -73
  39. package/dist/node/api-types.js +0 -0
  40. package/dist/node/api.js +270 -0
  41. package/dist/node/docs/index.js +33 -0
  42. package/dist/node/docs/learning-journey-registry.docblock.js +33 -0
  43. package/dist/node/example.js +32 -0
  44. package/dist/node/index.js +540 -0
  45. package/dist/node/learning-journey-registry.feature.js +45 -0
  46. package/dist/node/presentations/index.js +67 -0
  47. package/dist/node/progress-store.js +34 -0
  48. package/dist/node/tracks.js +52 -0
  49. package/dist/node/ui/LearningMiniApp.js +133 -0
  50. package/dist/node/ui/index.js +133 -0
  51. package/dist/presentations/index.d.ts +4 -9
  52. package/dist/presentations/index.d.ts.map +1 -1
  53. package/dist/presentations/index.js +63 -66
  54. package/dist/progress-store.d.ts +6 -10
  55. package/dist/progress-store.d.ts.map +1 -1
  56. package/dist/progress-store.js +33 -29
  57. package/dist/tracks.d.ts +33 -36
  58. package/dist/tracks.d.ts.map +1 -1
  59. package/dist/tracks.js +44 -39
  60. package/dist/ui/LearningMiniApp.d.ts +8 -16
  61. package/dist/ui/LearningMiniApp.d.ts.map +1 -1
  62. package/dist/ui/LearningMiniApp.js +123 -69
  63. package/dist/ui/index.d.ts +2 -2
  64. package/dist/ui/index.d.ts.map +1 -0
  65. package/dist/ui/index.js +134 -3
  66. package/package.json +143 -48
  67. package/tsdown.config.js +1 -2
  68. package/.turbo/turbo-build$colon$bundle.log +0 -55
  69. package/dist/api.js.map +0 -1
  70. package/dist/docs/learning-journey-registry.docblock.js.map +0 -1
  71. package/dist/example.js.map +0 -1
  72. package/dist/learning-journey-registry.feature.js.map +0 -1
  73. package/dist/presentations/index.js.map +0 -1
  74. package/dist/progress-store.js.map +0 -1
  75. package/dist/tracks.js.map +0 -1
  76. package/dist/ui/LearningMiniApp.js.map +0 -1
  77. package/tsconfig.tsbuildinfo +0 -1
package/dist/index.js CHANGED
@@ -1,10 +1,541 @@
1
- import { crmLearningTracks, learningJourneyTracks, mapStep, mapTrackSpecToDto, onboardingTrackCatalog, platformLearningTracks, studioLearningTracks } from "./tracks.js";
2
- import { getProgress, listTracks, recordEvent } from "./api.js";
3
- import example from "./example.js";
4
- import "./docs/index.js";
5
- import { LearningTrackDetailPresentation, LearningTrackListPresentation, LearningTrackProgressWidgetPresentation, learningJourneyPresentations } from "./presentations/index.js";
6
- import { LearningJourneyRegistryFeature } from "./learning-journey-registry.feature.js";
7
- import { LearningMiniApp, getLearningTemplateIds, isLearningTemplate } from "./ui/LearningMiniApp.js";
8
- import "./ui/index.js";
9
-
10
- export { LearningJourneyRegistryFeature, LearningMiniApp, LearningTrackDetailPresentation, LearningTrackListPresentation, LearningTrackProgressWidgetPresentation, crmLearningTracks, example, getLearningTemplateIds, getProgress, isLearningTemplate, learningJourneyPresentations, learningJourneyTracks, listTracks, mapStep, mapTrackSpecToDto, onboardingTrackCatalog, platformLearningTracks, recordEvent, studioLearningTracks };
1
+ // @bun
2
+ // src/tracks.ts
3
+ import { crmLearningTracks } from "@contractspec/example.learning-journey-crm-onboarding/track";
4
+ import { drillTracks } from "@contractspec/example.learning-journey-duo-drills/track";
5
+ import { ambientCoachTracks } from "@contractspec/example.learning-journey-ambient-coach/track";
6
+ import { questTracks } from "@contractspec/example.learning-journey-quest-challenges/track";
7
+ import { platformLearningTracks } from "@contractspec/example.learning-journey-platform-tour/track";
8
+ import { studioLearningTracks } from "@contractspec/example.learning-journey-studio-onboarding/track";
9
+ var mapStep = (step) => ({
10
+ id: step.id,
11
+ title: step.title,
12
+ description: step.description,
13
+ completionEvent: step.completion.eventName,
14
+ completionCondition: step.completion,
15
+ xpReward: step.xpReward,
16
+ isRequired: step.isRequired,
17
+ canSkip: step.canSkip,
18
+ actionUrl: step.actionUrl,
19
+ actionLabel: step.actionLabel,
20
+ availability: step.availability,
21
+ metadata: step.metadata
22
+ });
23
+ var mapTrackSpecToDto = (track) => ({
24
+ id: track.id,
25
+ name: track.name,
26
+ description: track.description,
27
+ productId: track.productId,
28
+ targetUserSegment: track.targetUserSegment,
29
+ targetRole: track.targetRole,
30
+ totalXp: track.totalXp,
31
+ streakRule: track.streakRule,
32
+ completionRewards: track.completionRewards,
33
+ steps: track.steps.map(mapStep),
34
+ metadata: track.metadata
35
+ });
36
+ var learningJourneyTracks = [
37
+ ...studioLearningTracks,
38
+ ...platformLearningTracks,
39
+ ...crmLearningTracks,
40
+ ...drillTracks,
41
+ ...ambientCoachTracks,
42
+ ...questTracks
43
+ ];
44
+ var onboardingTrackCatalog = learningJourneyTracks.map(mapTrackSpecToDto);
45
+ // src/progress-store.ts
46
+ var progressStore = new Map;
47
+ var getTrackResolver = (tracks) => (trackId) => tracks.find((t) => t.id === trackId);
48
+ var getLearnerTracks = (learnerId) => {
49
+ const existing = progressStore.get(learnerId);
50
+ if (existing)
51
+ return existing;
52
+ const map = new Map;
53
+ progressStore.set(learnerId, map);
54
+ return map;
55
+ };
56
+ var initProgress = (learnerId, track) => ({
57
+ learnerId,
58
+ trackId: track.id,
59
+ progress: 0,
60
+ isCompleted: false,
61
+ xpEarned: 0,
62
+ steps: track.steps.map((step) => ({
63
+ id: step.id,
64
+ status: "PENDING",
65
+ xpEarned: 0,
66
+ occurrences: 0,
67
+ masteryCount: 0
68
+ })),
69
+ startedAt: undefined,
70
+ completedAt: undefined,
71
+ lastActivityAt: undefined
72
+ });
73
+
74
+ // src/api.ts
75
+ var getTrack = getTrackResolver(learningJourneyTracks);
76
+ var matchesFilter = (filter, payload) => {
77
+ if (!filter)
78
+ return true;
79
+ if (!payload)
80
+ return false;
81
+ return Object.entries(filter).every(([key, value]) => payload[key] === value);
82
+ };
83
+ var matchesBaseEvent = (condition, event) => {
84
+ if (condition.eventName !== event.name)
85
+ return false;
86
+ if (condition.eventVersion !== undefined && event.version !== undefined) {
87
+ if (condition.eventVersion !== event.version)
88
+ return false;
89
+ }
90
+ if (condition.sourceModule && event.sourceModule && condition.sourceModule !== event.sourceModule) {
91
+ return false;
92
+ }
93
+ return matchesFilter(condition.payloadFilter, event.payload);
94
+ };
95
+ var matchesCondition = (condition, event, step, trackStartedAt) => {
96
+ if (condition.kind === "count") {
97
+ if (!matchesBaseEvent(condition, event))
98
+ return { matched: false };
99
+ const occurrences = (step.occurrences ?? 0) + 1;
100
+ const within = condition.withinHours === undefined || Boolean(trackStartedAt && event.occurredAt && (event.occurredAt.getTime() - trackStartedAt.getTime()) / (1000 * 60 * 60) <= condition.withinHours);
101
+ return { matched: within && occurrences >= condition.atLeast, occurrences };
102
+ }
103
+ if (condition.kind === "time_window") {
104
+ if (!matchesBaseEvent(condition, event))
105
+ return { matched: false };
106
+ if (condition.withinHoursOfStart !== undefined && trackStartedAt && event.occurredAt) {
107
+ const hoursSinceStart = (event.occurredAt.getTime() - trackStartedAt.getTime()) / (1000 * 60 * 60);
108
+ if (hoursSinceStart > condition.withinHoursOfStart) {
109
+ return { matched: false };
110
+ }
111
+ }
112
+ return { matched: true };
113
+ }
114
+ if (condition.kind === "srs_mastery") {
115
+ if (event.name !== condition.eventName)
116
+ return { matched: false };
117
+ const payload = event.payload;
118
+ if (!matchesFilter(condition.payloadFilter, payload)) {
119
+ return { matched: false };
120
+ }
121
+ const skillKey = condition.skillIdField ?? "skillId";
122
+ const masteryKey = condition.masteryField ?? "mastery";
123
+ const skillId = payload?.[skillKey];
124
+ const masteryValue = payload?.[masteryKey];
125
+ if (skillId === undefined || masteryValue === undefined) {
126
+ return { matched: false };
127
+ }
128
+ if (typeof masteryValue !== "number")
129
+ return { matched: false };
130
+ if (masteryValue < condition.minimumMastery)
131
+ return { matched: false };
132
+ const masteryCount = (step.masteryCount ?? 0) + 1;
133
+ const required = condition.requiredCount ?? 1;
134
+ return { matched: masteryCount >= required, masteryCount };
135
+ }
136
+ return { matched: matchesBaseEvent(condition, event) };
137
+ };
138
+ var getAvailability = (availability, startedAt) => {
139
+ if (!availability || !startedAt)
140
+ return {};
141
+ const baseTime = startedAt.getTime();
142
+ let unlockTime = baseTime;
143
+ if (availability.unlockOnDay !== undefined) {
144
+ unlockTime = baseTime + (availability.unlockOnDay - 1) * 24 * 60 * 60 * 1000;
145
+ }
146
+ if (availability.unlockAfterHours !== undefined) {
147
+ unlockTime = baseTime + availability.unlockAfterHours * 60 * 60 * 1000;
148
+ }
149
+ const availableAt = new Date(unlockTime);
150
+ const dueAt = availability.dueWithinHours !== undefined ? new Date(availableAt.getTime() + availability.dueWithinHours * 60 * 60 * 1000) : undefined;
151
+ return { availableAt, dueAt };
152
+ };
153
+ var computeProgressPercent = (steps) => {
154
+ const total = steps.length || 1;
155
+ const done = steps.filter((s) => s.status === "COMPLETED").length;
156
+ return Math.round(done / total * 100);
157
+ };
158
+ var applyTrackCompletionBonuses = (track, progress) => {
159
+ if (progress.isCompleted)
160
+ return progress;
161
+ const completedAt = new Date;
162
+ const startedAt = progress.startedAt ?? completedAt;
163
+ const hoursElapsed = (completedAt.getTime() - startedAt.getTime()) / (1000 * 60 * 60);
164
+ let xpEarned = progress.xpEarned;
165
+ const { completionRewards, streakRule } = track;
166
+ if (completionRewards?.xpBonus) {
167
+ xpEarned += completionRewards.xpBonus;
168
+ }
169
+ if (streakRule?.hoursWindow !== undefined && hoursElapsed <= streakRule.hoursWindow && streakRule.bonusXp) {
170
+ xpEarned += streakRule.bonusXp;
171
+ }
172
+ return {
173
+ ...progress,
174
+ xpEarned,
175
+ isCompleted: true,
176
+ completedAt,
177
+ lastActivityAt: completedAt
178
+ };
179
+ };
180
+ var listTracks = (learnerId) => {
181
+ const progressMap = learnerId ? getLearnerTracks(learnerId) : undefined;
182
+ const progress = learnerId && progressMap ? Array.from(progressMap.values()) : [];
183
+ return {
184
+ tracks: learningJourneyTracks,
185
+ progress
186
+ };
187
+ };
188
+ var getProgress = (trackId, learnerId) => {
189
+ const track = getTrack(trackId);
190
+ if (!track)
191
+ return;
192
+ const map = getLearnerTracks(learnerId);
193
+ const existing = map.get(trackId) ?? initProgress(learnerId, track);
194
+ map.set(trackId, existing);
195
+ return existing;
196
+ };
197
+ var recordEvent = (event) => {
198
+ const targets = event.trackId !== undefined ? learningJourneyTracks.filter((t) => t.id === event.trackId) : learningJourneyTracks;
199
+ const updated = [];
200
+ const eventTime = event.occurredAt ?? new Date;
201
+ for (const track of targets) {
202
+ const map = getLearnerTracks(event.learnerId);
203
+ const current = map.get(track.id) ?? initProgress(event.learnerId, track);
204
+ const startedAt = current.startedAt ?? eventTime;
205
+ let changed = current.startedAt === undefined;
206
+ const steps = current.steps.map((step) => {
207
+ if (step.status === "COMPLETED")
208
+ return step;
209
+ const spec = track.steps.find((s) => s.id === step.id);
210
+ if (!spec)
211
+ return step;
212
+ const { availableAt, dueAt } = getAvailability(spec.availability, startedAt);
213
+ if (availableAt && eventTime < availableAt) {
214
+ return { ...step, availableAt, dueAt };
215
+ }
216
+ if (dueAt && eventTime > dueAt) {
217
+ return { ...step, availableAt, dueAt };
218
+ }
219
+ const result = matchesCondition(spec.completion, event, step, startedAt);
220
+ if (result.matched) {
221
+ changed = true;
222
+ return {
223
+ ...step,
224
+ status: "COMPLETED",
225
+ xpEarned: spec.xpReward ?? 0,
226
+ completedAt: eventTime,
227
+ triggeringEvent: event.name,
228
+ eventPayload: event.payload,
229
+ occurrences: result.occurrences ?? step.occurrences,
230
+ masteryCount: result.masteryCount ?? step.masteryCount,
231
+ availableAt,
232
+ dueAt
233
+ };
234
+ }
235
+ if (result.occurrences !== undefined || result.masteryCount !== undefined) {
236
+ changed = true;
237
+ }
238
+ return {
239
+ ...step,
240
+ occurrences: result.occurrences ?? step.occurrences,
241
+ masteryCount: result.masteryCount ?? step.masteryCount,
242
+ availableAt,
243
+ dueAt
244
+ };
245
+ });
246
+ if (!changed) {
247
+ continue;
248
+ }
249
+ const xpEarned = steps.reduce((sum, s) => sum + s.xpEarned, 0) + (track.totalXp ?? 0);
250
+ let progress = {
251
+ ...current,
252
+ steps,
253
+ xpEarned,
254
+ startedAt,
255
+ lastActivityAt: eventTime,
256
+ progress: computeProgressPercent(steps)
257
+ };
258
+ const allDone = steps.every((s) => s.status === "COMPLETED");
259
+ if (allDone) {
260
+ progress = applyTrackCompletionBonuses(track, progress);
261
+ }
262
+ map.set(track.id, progress);
263
+ updated.push(progress);
264
+ }
265
+ return updated;
266
+ };
267
+
268
+ // src/docs/learning-journey-registry.docblock.ts
269
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
270
+ var registryDocBlocks = [
271
+ {
272
+ id: "docs.learning-journey.registry",
273
+ title: "Learning Journey \u2014 Example Track Registry",
274
+ summary: "Aggregates learning journey example tracks (Studio onboarding, Platform tour, CRM first win, Drills, Ambient Coach, Quest challenges).",
275
+ kind: "usage",
276
+ visibility: "public",
277
+ route: "/docs/learning-journey/registry",
278
+ tags: ["learning", "registry", "onboarding"],
279
+ body: `## Tracks
280
+ - \`studio_getting_started\` (Studio onboarding)
281
+ - \`platform_primitives_tour\` (Platform primitives)
282
+ - \`crm_first_win\` (CRM pipeline onboarding)
283
+ - \`drills_language_basics\` (Drills & SRS)
284
+ - \`money_ambient_coach\`, \`coliving_ambient_coach\` (Ambient tips)
285
+ - \`money_reset_7day\` (Quest/challenge)
286
+
287
+ ## Exports
288
+ - \`learningJourneyTracks\` \u2014 raw specs
289
+ - \`onboardingTrackCatalog\` \u2014 DTOs aligned with onboarding API
290
+ - \`mapTrackSpecToDto\` \u2014 helper to map individual tracks
291
+
292
+ ## Wiring
293
+ - Use with onboarding API contracts:
294
+ - \`learning.onboarding.listTracks\`
295
+ - \`learning.onboarding.getProgress\`
296
+ - \`learning.onboarding.recordEvent\`
297
+ - Intended for registry/adapters in Studio UI or services that surface tracks.`
298
+ }
299
+ ];
300
+ registerDocBlocks(registryDocBlocks);
301
+ // src/example.ts
302
+ import { defineExample } from "@contractspec/lib.contracts";
303
+ var example = defineExample({
304
+ meta: {
305
+ key: "learning-journey-registry",
306
+ version: "1.0.0",
307
+ title: "Learning Journey Registry",
308
+ description: "Registry of learning journey tracks + presentations + UI mini-app bindings.",
309
+ kind: "library",
310
+ visibility: "public",
311
+ stability: "experimental",
312
+ owners: ["@platform.core"],
313
+ tags: ["learning", "journey", "registry"]
314
+ },
315
+ docs: {
316
+ rootDocId: "docs.examples.learning-journey-registry"
317
+ },
318
+ entrypoints: {
319
+ packageName: "@contractspec/example.learning-journey-registry",
320
+ docs: "./docs"
321
+ },
322
+ surfaces: {
323
+ templates: true,
324
+ sandbox: { enabled: true, modes: ["markdown", "specs"] },
325
+ studio: { enabled: true, installable: true },
326
+ mcp: { enabled: true }
327
+ }
328
+ });
329
+ var example_default = example;
330
+
331
+ // src/presentations/index.ts
332
+ import {
333
+ definePresentation,
334
+ StabilityEnum
335
+ } from "@contractspec/lib.contracts";
336
+ var baseMeta = {
337
+ domain: "learning-journey",
338
+ title: "Learning Journey",
339
+ owners: ["@learning-team"],
340
+ tags: ["learning", "journey", "onboarding"],
341
+ stability: StabilityEnum.Experimental,
342
+ goal: "Progress through learning tracks",
343
+ context: "Learning journey section"
344
+ };
345
+ var LearningTrackListPresentation = definePresentation({
346
+ meta: {
347
+ key: "learning.journey.track_list",
348
+ version: "1.0.0",
349
+ description: "List of learning journeys available to the learner.",
350
+ ...baseMeta
351
+ },
352
+ source: {
353
+ type: "component",
354
+ framework: "react",
355
+ componentKey: "LearningTrackList"
356
+ },
357
+ targets: ["react", "markdown"]
358
+ });
359
+ var LearningTrackDetailPresentation = definePresentation({
360
+ meta: {
361
+ key: "learning.journey.track_detail",
362
+ version: "1.0.0",
363
+ description: "Track detail with steps and progress state.",
364
+ ...baseMeta
365
+ },
366
+ source: {
367
+ type: "component",
368
+ framework: "react",
369
+ componentKey: "LearningTrackDetail"
370
+ },
371
+ targets: ["react", "markdown", "application/json"]
372
+ });
373
+ var LearningTrackProgressWidgetPresentation = definePresentation({
374
+ meta: {
375
+ key: "learning.journey.progress_widget",
376
+ version: "1.0.0",
377
+ description: "Compact widget showing progress for active track.",
378
+ ...baseMeta
379
+ },
380
+ source: {
381
+ type: "component",
382
+ framework: "react",
383
+ componentKey: "LearningTrackProgressWidget"
384
+ },
385
+ targets: ["react"]
386
+ });
387
+ var learningJourneyPresentations = [
388
+ LearningTrackListPresentation,
389
+ LearningTrackDetailPresentation,
390
+ LearningTrackProgressWidgetPresentation
391
+ ];
392
+
393
+ // src/learning-journey-registry.feature.ts
394
+ import { defineFeature } from "@contractspec/lib.contracts";
395
+ var LearningJourneyRegistryFeature = defineFeature({
396
+ meta: {
397
+ key: "learning-journey-registry",
398
+ version: "1.0.0",
399
+ title: "Learning Journey Registry",
400
+ description: "Shared registry and presentations for learning journey tracks",
401
+ domain: "learning-journey",
402
+ owners: ["@learning-team"],
403
+ tags: ["learning", "journey", "onboarding", "registry"],
404
+ stability: "experimental"
405
+ },
406
+ operations: [],
407
+ events: [],
408
+ presentations: [
409
+ { key: "learning.journey.track_list", version: "1.0.0" },
410
+ { key: "learning.journey.track_detail", version: "1.0.0" },
411
+ { key: "learning.journey.progress_widget", version: "1.0.0" }
412
+ ],
413
+ opToPresentation: [],
414
+ presentationsTargets: [
415
+ {
416
+ key: "learning.journey.track_list",
417
+ version: "1.0.0",
418
+ targets: ["react", "markdown"]
419
+ },
420
+ {
421
+ key: "learning.journey.track_detail",
422
+ version: "1.0.0",
423
+ targets: ["react", "markdown", "application/json"]
424
+ },
425
+ {
426
+ key: "learning.journey.progress_widget",
427
+ version: "1.0.0",
428
+ targets: ["react"]
429
+ }
430
+ ],
431
+ capabilities: {
432
+ requires: [{ key: "identity", version: "1.0.0" }]
433
+ }
434
+ });
435
+
436
+ // src/ui/LearningMiniApp.tsx
437
+ import { useMemo } from "react";
438
+ import { GamifiedMiniApp } from "@contractspec/example.learning-journey-ui-gamified";
439
+ import { OnboardingMiniApp } from "@contractspec/example.learning-journey-ui-onboarding";
440
+ import { CoachingMiniApp } from "@contractspec/example.learning-journey-ui-coaching";
441
+ import { jsxDEV } from "react/jsx-dev-runtime";
442
+ "use client";
443
+ var TEMPLATE_TO_TRACK = {
444
+ "learning-journey-duo-drills": "drills_language_basics",
445
+ "learning-journey-quest-challenges": "money_reset_7day",
446
+ "learning-journey-studio-onboarding": "studio_getting_started",
447
+ "learning-journey-platform-tour": "platform_tour",
448
+ "learning-journey-ambient-coach": "money_ambient_coach",
449
+ "learning-journey-crm-onboarding": "crm_first_win"
450
+ };
451
+ var TEMPLATE_TO_APP_TYPE = {
452
+ "learning-journey-duo-drills": "gamified",
453
+ "learning-journey-quest-challenges": "gamified",
454
+ "learning-journey-studio-onboarding": "onboarding",
455
+ "learning-journey-platform-tour": "onboarding",
456
+ "learning-journey-ambient-coach": "coaching",
457
+ "learning-journey-crm-onboarding": "coaching"
458
+ };
459
+ function LearningMiniApp({
460
+ templateId,
461
+ initialView = "overview",
462
+ onViewChange
463
+ }) {
464
+ const track = useMemo(() => {
465
+ const trackId = TEMPLATE_TO_TRACK[templateId];
466
+ if (!trackId)
467
+ return null;
468
+ return learningJourneyTracks.find((t) => t.id === trackId);
469
+ }, [templateId]);
470
+ const appType = TEMPLATE_TO_APP_TYPE[templateId];
471
+ if (!track) {
472
+ return /* @__PURE__ */ jsxDEV("div", {
473
+ className: "rounded-lg border border-amber-500/50 bg-amber-500/10 p-6 text-center",
474
+ children: /* @__PURE__ */ jsxDEV("p", {
475
+ className: "text-amber-500",
476
+ children: [
477
+ "Unknown learning template: ",
478
+ templateId
479
+ ]
480
+ }, undefined, true, undefined, this)
481
+ }, undefined, false, undefined, this);
482
+ }
483
+ switch (appType) {
484
+ case "gamified":
485
+ return /* @__PURE__ */ jsxDEV(GamifiedMiniApp, {
486
+ track,
487
+ initialView,
488
+ onViewChange
489
+ }, undefined, false, undefined, this);
490
+ case "onboarding":
491
+ return /* @__PURE__ */ jsxDEV(OnboardingMiniApp, {
492
+ track,
493
+ initialView,
494
+ onViewChange
495
+ }, undefined, false, undefined, this);
496
+ case "coaching":
497
+ return /* @__PURE__ */ jsxDEV(CoachingMiniApp, {
498
+ track,
499
+ initialView,
500
+ onViewChange
501
+ }, undefined, false, undefined, this);
502
+ default:
503
+ return /* @__PURE__ */ jsxDEV("div", {
504
+ className: "rounded-lg border border-red-500/50 bg-red-500/10 p-6 text-center",
505
+ children: /* @__PURE__ */ jsxDEV("p", {
506
+ className: "text-red-500",
507
+ children: [
508
+ "Unknown app type for template: ",
509
+ templateId
510
+ ]
511
+ }, undefined, true, undefined, this)
512
+ }, undefined, false, undefined, this);
513
+ }
514
+ }
515
+ function isLearningTemplate(templateId) {
516
+ return templateId in TEMPLATE_TO_TRACK;
517
+ }
518
+ function getLearningTemplateIds() {
519
+ return Object.keys(TEMPLATE_TO_TRACK);
520
+ }
521
+ export {
522
+ studioLearningTracks,
523
+ recordEvent,
524
+ platformLearningTracks,
525
+ onboardingTrackCatalog,
526
+ mapTrackSpecToDto,
527
+ mapStep,
528
+ listTracks,
529
+ learningJourneyTracks,
530
+ learningJourneyPresentations,
531
+ isLearningTemplate,
532
+ getProgress,
533
+ getLearningTemplateIds,
534
+ example_default as example,
535
+ crmLearningTracks,
536
+ LearningTrackProgressWidgetPresentation,
537
+ LearningTrackListPresentation,
538
+ LearningTrackDetailPresentation,
539
+ LearningMiniApp,
540
+ LearningJourneyRegistryFeature
541
+ };
@@ -1,11 +1,6 @@
1
- import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
-
3
- //#region src/learning-journey-registry.feature.d.ts
4
1
  /**
5
2
  * Learning Journey Registry feature module that bundles
6
3
  * the shared presentations for learning journey tracks.
7
4
  */
8
- declare const LearningJourneyRegistryFeature: _contractspec_lib_contracts0.FeatureModuleSpec;
9
- //#endregion
10
- export { LearningJourneyRegistryFeature };
5
+ export declare const LearningJourneyRegistryFeature: import("@contractspec/lib.contracts").FeatureModuleSpec;
11
6
  //# sourceMappingURL=learning-journey-registry.feature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"learning-journey-registry.feature.d.ts","names":[],"sources":["../src/learning-journey-registry.feature.ts"],"mappings":";;;;;;AAWA;cAAa,8BAAA,EAoDX,4BAAA,CApDyC,iBAAA"}
1
+ {"version":3,"file":"learning-journey-registry.feature.d.ts","sourceRoot":"","sources":["../src/learning-journey-registry.feature.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,eAAO,MAAM,8BAA8B,yDAoDzC,CAAC"}
@@ -1,75 +1,46 @@
1
+ // @bun
2
+ // src/learning-journey-registry.feature.ts
1
3
  import { defineFeature } from "@contractspec/lib.contracts";
2
-
3
- //#region src/learning-journey-registry.feature.ts
4
- /**
5
- * Learning Journey Registry Feature Module Specification
6
- *
7
- * Defines the feature module for the learning journey registry.
8
- */
9
- /**
10
- * Learning Journey Registry feature module that bundles
11
- * the shared presentations for learning journey tracks.
12
- */
13
- const LearningJourneyRegistryFeature = defineFeature({
14
- meta: {
15
- key: "learning-journey-registry",
16
- version: "1.0.0",
17
- title: "Learning Journey Registry",
18
- description: "Shared registry and presentations for learning journey tracks",
19
- domain: "learning-journey",
20
- owners: ["@learning-team"],
21
- tags: [
22
- "learning",
23
- "journey",
24
- "onboarding",
25
- "registry"
26
- ],
27
- stability: "experimental"
28
- },
29
- operations: [],
30
- events: [],
31
- presentations: [
32
- {
33
- key: "learning.journey.track_list",
34
- version: "1.0.0"
35
- },
36
- {
37
- key: "learning.journey.track_detail",
38
- version: "1.0.0"
39
- },
40
- {
41
- key: "learning.journey.progress_widget",
42
- version: "1.0.0"
43
- }
44
- ],
45
- opToPresentation: [],
46
- presentationsTargets: [
47
- {
48
- key: "learning.journey.track_list",
49
- version: "1.0.0",
50
- targets: ["react", "markdown"]
51
- },
52
- {
53
- key: "learning.journey.track_detail",
54
- version: "1.0.0",
55
- targets: [
56
- "react",
57
- "markdown",
58
- "application/json"
59
- ]
60
- },
61
- {
62
- key: "learning.journey.progress_widget",
63
- version: "1.0.0",
64
- targets: ["react"]
65
- }
66
- ],
67
- capabilities: { requires: [{
68
- key: "identity",
69
- version: "1.0.0"
70
- }] }
4
+ var LearningJourneyRegistryFeature = defineFeature({
5
+ meta: {
6
+ key: "learning-journey-registry",
7
+ version: "1.0.0",
8
+ title: "Learning Journey Registry",
9
+ description: "Shared registry and presentations for learning journey tracks",
10
+ domain: "learning-journey",
11
+ owners: ["@learning-team"],
12
+ tags: ["learning", "journey", "onboarding", "registry"],
13
+ stability: "experimental"
14
+ },
15
+ operations: [],
16
+ events: [],
17
+ presentations: [
18
+ { key: "learning.journey.track_list", version: "1.0.0" },
19
+ { key: "learning.journey.track_detail", version: "1.0.0" },
20
+ { key: "learning.journey.progress_widget", version: "1.0.0" }
21
+ ],
22
+ opToPresentation: [],
23
+ presentationsTargets: [
24
+ {
25
+ key: "learning.journey.track_list",
26
+ version: "1.0.0",
27
+ targets: ["react", "markdown"]
28
+ },
29
+ {
30
+ key: "learning.journey.track_detail",
31
+ version: "1.0.0",
32
+ targets: ["react", "markdown", "application/json"]
33
+ },
34
+ {
35
+ key: "learning.journey.progress_widget",
36
+ version: "1.0.0",
37
+ targets: ["react"]
38
+ }
39
+ ],
40
+ capabilities: {
41
+ requires: [{ key: "identity", version: "1.0.0" }]
42
+ }
71
43
  });
72
-
73
- //#endregion
74
- export { LearningJourneyRegistryFeature };
75
- //# sourceMappingURL=learning-journey-registry.feature.js.map
44
+ export {
45
+ LearningJourneyRegistryFeature
46
+ };
File without changes