@contractspec/example.learning-journey-registry 1.57.0 → 1.59.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.
- package/.turbo/turbo-build.log +52 -55
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +45 -0
- package/dist/api-types.d.ts +33 -37
- package/dist/api-types.d.ts.map +1 -1
- package/dist/api-types.js +1 -0
- package/dist/api.d.ts +7 -11
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +261 -161
- package/dist/api.test.d.ts +2 -0
- package/dist/api.test.d.ts.map +1 -0
- package/dist/browser/api-types.js +0 -0
- package/dist/browser/api.js +270 -0
- package/dist/browser/docs/index.js +33 -0
- package/dist/browser/docs/learning-journey-registry.docblock.js +33 -0
- package/dist/browser/example.js +32 -0
- package/dist/browser/index.js +540 -0
- package/dist/browser/learning-journey-registry.feature.js +45 -0
- package/dist/browser/presentations/index.js +67 -0
- package/dist/browser/progress-store.js +34 -0
- package/dist/browser/tracks.js +52 -0
- package/dist/browser/ui/LearningMiniApp.js +133 -0
- package/dist/browser/ui/index.js +133 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +34 -1
- package/dist/docs/learning-journey-registry.docblock.d.ts +2 -1
- package/dist/docs/learning-journey-registry.docblock.d.ts.map +1 -0
- package/dist/docs/learning-journey-registry.docblock.js +18 -22
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +31 -39
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +541 -10
- package/dist/learning-journey-registry.feature.d.ts +1 -6
- package/dist/learning-journey-registry.feature.d.ts.map +1 -1
- package/dist/learning-journey-registry.feature.js +44 -73
- package/dist/node/api-types.js +0 -0
- package/dist/node/api.js +270 -0
- package/dist/node/docs/index.js +33 -0
- package/dist/node/docs/learning-journey-registry.docblock.js +33 -0
- package/dist/node/example.js +32 -0
- package/dist/node/index.js +540 -0
- package/dist/node/learning-journey-registry.feature.js +45 -0
- package/dist/node/presentations/index.js +67 -0
- package/dist/node/progress-store.js +34 -0
- package/dist/node/tracks.js +52 -0
- package/dist/node/ui/LearningMiniApp.js +133 -0
- package/dist/node/ui/index.js +133 -0
- package/dist/presentations/index.d.ts +4 -9
- package/dist/presentations/index.d.ts.map +1 -1
- package/dist/presentations/index.js +63 -66
- package/dist/progress-store.d.ts +6 -10
- package/dist/progress-store.d.ts.map +1 -1
- package/dist/progress-store.js +33 -29
- package/dist/tracks.d.ts +33 -36
- package/dist/tracks.d.ts.map +1 -1
- package/dist/tracks.js +44 -39
- package/dist/ui/LearningMiniApp.d.ts +8 -16
- package/dist/ui/LearningMiniApp.d.ts.map +1 -1
- package/dist/ui/LearningMiniApp.js +123 -69
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +134 -3
- package/package.json +143 -48
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -55
- package/dist/api.js.map +0 -1
- package/dist/docs/learning-journey-registry.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/learning-journey-registry.feature.js.map +0 -1
- package/dist/presentations/index.js.map +0 -1
- package/dist/progress-store.js.map +0 -1
- package/dist/tracks.js.map +0 -1
- package/dist/ui/LearningMiniApp.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
package/dist/tracks.js
CHANGED
|
@@ -1,48 +1,53 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/tracks.ts
|
|
1
3
|
import { crmLearningTracks } from "@contractspec/example.learning-journey-crm-onboarding/track";
|
|
2
4
|
import { drillTracks } from "@contractspec/example.learning-journey-duo-drills/track";
|
|
3
5
|
import { ambientCoachTracks } from "@contractspec/example.learning-journey-ambient-coach/track";
|
|
4
6
|
import { questTracks } from "@contractspec/example.learning-journey-quest-challenges/track";
|
|
5
7
|
import { platformLearningTracks } from "@contractspec/example.learning-journey-platform-tour/track";
|
|
6
8
|
import { studioLearningTracks } from "@contractspec/example.learning-journey-studio-onboarding/track";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
availability: step.availability,
|
|
21
|
-
metadata: step.metadata
|
|
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
22
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
35
|
});
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
var learningJourneyTracks = [
|
|
37
|
+
...studioLearningTracks,
|
|
38
|
+
...platformLearningTracks,
|
|
39
|
+
...crmLearningTracks,
|
|
40
|
+
...drillTracks,
|
|
41
|
+
...ambientCoachTracks,
|
|
42
|
+
...questTracks
|
|
43
43
|
];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
var onboardingTrackCatalog = learningJourneyTracks.map(mapTrackSpecToDto);
|
|
45
|
+
export {
|
|
46
|
+
studioLearningTracks,
|
|
47
|
+
platformLearningTracks,
|
|
48
|
+
onboardingTrackCatalog,
|
|
49
|
+
mapTrackSpecToDto,
|
|
50
|
+
mapStep,
|
|
51
|
+
learningJourneyTracks,
|
|
52
|
+
crmLearningTracks
|
|
53
|
+
};
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { LearningView } from "@contractspec/example.learning-journey-ui-shared";
|
|
3
|
-
|
|
4
|
-
//#region src/ui/LearningMiniApp.d.ts
|
|
1
|
+
import type { LearningView } from '@contractspec/example.learning-journey-ui-shared';
|
|
5
2
|
/** Template IDs that map to learning journey tracks */
|
|
6
3
|
type LearningTemplateId = 'learning-journey-duo-drills' | 'learning-journey-quest-challenges' | 'learning-journey-studio-onboarding' | 'learning-journey-platform-tour' | 'learning-journey-ambient-coach' | 'learning-journey-crm-onboarding';
|
|
7
4
|
interface LearningMiniAppProps {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
templateId: string;
|
|
6
|
+
initialView?: LearningView;
|
|
7
|
+
onViewChange?: (view: LearningView) => void;
|
|
11
8
|
}
|
|
12
9
|
/** Router component that picks the correct mini-app based on template ID */
|
|
13
|
-
declare function LearningMiniApp({
|
|
14
|
-
templateId,
|
|
15
|
-
initialView,
|
|
16
|
-
onViewChange
|
|
17
|
-
}: LearningMiniAppProps): react_jsx_runtime0.JSX.Element;
|
|
10
|
+
export declare function LearningMiniApp({ templateId, initialView, onViewChange, }: LearningMiniAppProps): import("react/jsx-runtime").JSX.Element;
|
|
18
11
|
/** Check if a template ID is a learning journey template */
|
|
19
|
-
declare function isLearningTemplate(templateId: string): templateId is LearningTemplateId;
|
|
12
|
+
export declare function isLearningTemplate(templateId: string): templateId is LearningTemplateId;
|
|
20
13
|
/** Get all learning template IDs */
|
|
21
|
-
declare function getLearningTemplateIds(): LearningTemplateId[];
|
|
22
|
-
|
|
23
|
-
export { LearningMiniApp, getLearningTemplateIds, isLearningTemplate };
|
|
14
|
+
export declare function getLearningTemplateIds(): LearningTemplateId[];
|
|
15
|
+
export {};
|
|
24
16
|
//# sourceMappingURL=LearningMiniApp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LearningMiniApp.d.ts","
|
|
1
|
+
{"version":3,"file":"LearningMiniApp.d.ts","sourceRoot":"","sources":["../../src/ui/LearningMiniApp.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAC;AAGrF,uDAAuD;AACvD,KAAK,kBAAkB,GACnB,6BAA6B,GAC7B,mCAAmC,GACnC,oCAAoC,GACpC,gCAAgC,GAChC,gCAAgC,GAChC,iCAAiC,CAAC;AAyBtC,UAAU,oBAAoB;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CAC7C;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,WAAwB,EACxB,YAAY,GACb,EAAE,oBAAoB,2CAwDtB;AAED,4DAA4D;AAC5D,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,MAAM,GACjB,UAAU,IAAI,kBAAkB,CAElC;AAED,oCAAoC;AACpC,wBAAgB,sBAAsB,IAAI,kBAAkB,EAAE,CAE7D"}
|
|
@@ -1,80 +1,134 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
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/ui/LearningMiniApp.tsx
|
|
4
46
|
import { useMemo } from "react";
|
|
5
47
|
import { GamifiedMiniApp } from "@contractspec/example.learning-journey-ui-gamified";
|
|
6
48
|
import { OnboardingMiniApp } from "@contractspec/example.learning-journey-ui-onboarding";
|
|
7
49
|
import { CoachingMiniApp } from "@contractspec/example.learning-journey-ui-coaching";
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"learning-journey-ambient-coach": "money_ambient_coach",
|
|
18
|
-
"learning-journey-crm-onboarding": "crm_first_win"
|
|
50
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
51
|
+
"use client";
|
|
52
|
+
var TEMPLATE_TO_TRACK = {
|
|
53
|
+
"learning-journey-duo-drills": "drills_language_basics",
|
|
54
|
+
"learning-journey-quest-challenges": "money_reset_7day",
|
|
55
|
+
"learning-journey-studio-onboarding": "studio_getting_started",
|
|
56
|
+
"learning-journey-platform-tour": "platform_tour",
|
|
57
|
+
"learning-journey-ambient-coach": "money_ambient_coach",
|
|
58
|
+
"learning-journey-crm-onboarding": "crm_first_win"
|
|
19
59
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"learning-journey-crm-onboarding": "coaching"
|
|
60
|
+
var TEMPLATE_TO_APP_TYPE = {
|
|
61
|
+
"learning-journey-duo-drills": "gamified",
|
|
62
|
+
"learning-journey-quest-challenges": "gamified",
|
|
63
|
+
"learning-journey-studio-onboarding": "onboarding",
|
|
64
|
+
"learning-journey-platform-tour": "onboarding",
|
|
65
|
+
"learning-journey-ambient-coach": "coaching",
|
|
66
|
+
"learning-journey-crm-onboarding": "coaching"
|
|
28
67
|
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
+
function LearningMiniApp({
|
|
69
|
+
templateId,
|
|
70
|
+
initialView = "overview",
|
|
71
|
+
onViewChange
|
|
72
|
+
}) {
|
|
73
|
+
const track = useMemo(() => {
|
|
74
|
+
const trackId = TEMPLATE_TO_TRACK[templateId];
|
|
75
|
+
if (!trackId)
|
|
76
|
+
return null;
|
|
77
|
+
return learningJourneyTracks.find((t) => t.id === trackId);
|
|
78
|
+
}, [templateId]);
|
|
79
|
+
const appType = TEMPLATE_TO_APP_TYPE[templateId];
|
|
80
|
+
if (!track) {
|
|
81
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
82
|
+
className: "rounded-lg border border-amber-500/50 bg-amber-500/10 p-6 text-center",
|
|
83
|
+
children: /* @__PURE__ */ jsxDEV("p", {
|
|
84
|
+
className: "text-amber-500",
|
|
85
|
+
children: [
|
|
86
|
+
"Unknown learning template: ",
|
|
87
|
+
templateId
|
|
88
|
+
]
|
|
89
|
+
}, undefined, true, undefined, this)
|
|
90
|
+
}, undefined, false, undefined, this);
|
|
91
|
+
}
|
|
92
|
+
switch (appType) {
|
|
93
|
+
case "gamified":
|
|
94
|
+
return /* @__PURE__ */ jsxDEV(GamifiedMiniApp, {
|
|
95
|
+
track,
|
|
96
|
+
initialView,
|
|
97
|
+
onViewChange
|
|
98
|
+
}, undefined, false, undefined, this);
|
|
99
|
+
case "onboarding":
|
|
100
|
+
return /* @__PURE__ */ jsxDEV(OnboardingMiniApp, {
|
|
101
|
+
track,
|
|
102
|
+
initialView,
|
|
103
|
+
onViewChange
|
|
104
|
+
}, undefined, false, undefined, this);
|
|
105
|
+
case "coaching":
|
|
106
|
+
return /* @__PURE__ */ jsxDEV(CoachingMiniApp, {
|
|
107
|
+
track,
|
|
108
|
+
initialView,
|
|
109
|
+
onViewChange
|
|
110
|
+
}, undefined, false, undefined, this);
|
|
111
|
+
default:
|
|
112
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
113
|
+
className: "rounded-lg border border-red-500/50 bg-red-500/10 p-6 text-center",
|
|
114
|
+
children: /* @__PURE__ */ jsxDEV("p", {
|
|
115
|
+
className: "text-red-500",
|
|
116
|
+
children: [
|
|
117
|
+
"Unknown app type for template: ",
|
|
118
|
+
templateId
|
|
119
|
+
]
|
|
120
|
+
}, undefined, true, undefined, this)
|
|
121
|
+
}, undefined, false, undefined, this);
|
|
122
|
+
}
|
|
68
123
|
}
|
|
69
|
-
/** Check if a template ID is a learning journey template */
|
|
70
124
|
function isLearningTemplate(templateId) {
|
|
71
|
-
|
|
125
|
+
return templateId in TEMPLATE_TO_TRACK;
|
|
72
126
|
}
|
|
73
|
-
/** Get all learning template IDs */
|
|
74
127
|
function getLearningTemplateIds() {
|
|
75
|
-
|
|
128
|
+
return Object.keys(TEMPLATE_TO_TRACK);
|
|
76
129
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
130
|
+
export {
|
|
131
|
+
isLearningTemplate,
|
|
132
|
+
getLearningTemplateIds,
|
|
133
|
+
LearningMiniApp
|
|
134
|
+
};
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export { LearningMiniApp, isLearningTemplate, getLearningTemplateIds, } from './LearningMiniApp';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC"}
|
package/dist/ui/index.js
CHANGED
|
@@ -1,3 +1,134 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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/ui/LearningMiniApp.tsx
|
|
46
|
+
import { useMemo } from "react";
|
|
47
|
+
import { GamifiedMiniApp } from "@contractspec/example.learning-journey-ui-gamified";
|
|
48
|
+
import { OnboardingMiniApp } from "@contractspec/example.learning-journey-ui-onboarding";
|
|
49
|
+
import { CoachingMiniApp } from "@contractspec/example.learning-journey-ui-coaching";
|
|
50
|
+
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
51
|
+
"use client";
|
|
52
|
+
var TEMPLATE_TO_TRACK = {
|
|
53
|
+
"learning-journey-duo-drills": "drills_language_basics",
|
|
54
|
+
"learning-journey-quest-challenges": "money_reset_7day",
|
|
55
|
+
"learning-journey-studio-onboarding": "studio_getting_started",
|
|
56
|
+
"learning-journey-platform-tour": "platform_tour",
|
|
57
|
+
"learning-journey-ambient-coach": "money_ambient_coach",
|
|
58
|
+
"learning-journey-crm-onboarding": "crm_first_win"
|
|
59
|
+
};
|
|
60
|
+
var TEMPLATE_TO_APP_TYPE = {
|
|
61
|
+
"learning-journey-duo-drills": "gamified",
|
|
62
|
+
"learning-journey-quest-challenges": "gamified",
|
|
63
|
+
"learning-journey-studio-onboarding": "onboarding",
|
|
64
|
+
"learning-journey-platform-tour": "onboarding",
|
|
65
|
+
"learning-journey-ambient-coach": "coaching",
|
|
66
|
+
"learning-journey-crm-onboarding": "coaching"
|
|
67
|
+
};
|
|
68
|
+
function LearningMiniApp({
|
|
69
|
+
templateId,
|
|
70
|
+
initialView = "overview",
|
|
71
|
+
onViewChange
|
|
72
|
+
}) {
|
|
73
|
+
const track = useMemo(() => {
|
|
74
|
+
const trackId = TEMPLATE_TO_TRACK[templateId];
|
|
75
|
+
if (!trackId)
|
|
76
|
+
return null;
|
|
77
|
+
return learningJourneyTracks.find((t) => t.id === trackId);
|
|
78
|
+
}, [templateId]);
|
|
79
|
+
const appType = TEMPLATE_TO_APP_TYPE[templateId];
|
|
80
|
+
if (!track) {
|
|
81
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
82
|
+
className: "rounded-lg border border-amber-500/50 bg-amber-500/10 p-6 text-center",
|
|
83
|
+
children: /* @__PURE__ */ jsxDEV("p", {
|
|
84
|
+
className: "text-amber-500",
|
|
85
|
+
children: [
|
|
86
|
+
"Unknown learning template: ",
|
|
87
|
+
templateId
|
|
88
|
+
]
|
|
89
|
+
}, undefined, true, undefined, this)
|
|
90
|
+
}, undefined, false, undefined, this);
|
|
91
|
+
}
|
|
92
|
+
switch (appType) {
|
|
93
|
+
case "gamified":
|
|
94
|
+
return /* @__PURE__ */ jsxDEV(GamifiedMiniApp, {
|
|
95
|
+
track,
|
|
96
|
+
initialView,
|
|
97
|
+
onViewChange
|
|
98
|
+
}, undefined, false, undefined, this);
|
|
99
|
+
case "onboarding":
|
|
100
|
+
return /* @__PURE__ */ jsxDEV(OnboardingMiniApp, {
|
|
101
|
+
track,
|
|
102
|
+
initialView,
|
|
103
|
+
onViewChange
|
|
104
|
+
}, undefined, false, undefined, this);
|
|
105
|
+
case "coaching":
|
|
106
|
+
return /* @__PURE__ */ jsxDEV(CoachingMiniApp, {
|
|
107
|
+
track,
|
|
108
|
+
initialView,
|
|
109
|
+
onViewChange
|
|
110
|
+
}, undefined, false, undefined, this);
|
|
111
|
+
default:
|
|
112
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
113
|
+
className: "rounded-lg border border-red-500/50 bg-red-500/10 p-6 text-center",
|
|
114
|
+
children: /* @__PURE__ */ jsxDEV("p", {
|
|
115
|
+
className: "text-red-500",
|
|
116
|
+
children: [
|
|
117
|
+
"Unknown app type for template: ",
|
|
118
|
+
templateId
|
|
119
|
+
]
|
|
120
|
+
}, undefined, true, undefined, this)
|
|
121
|
+
}, undefined, false, undefined, this);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function isLearningTemplate(templateId) {
|
|
125
|
+
return templateId in TEMPLATE_TO_TRACK;
|
|
126
|
+
}
|
|
127
|
+
function getLearningTemplateIds() {
|
|
128
|
+
return Object.keys(TEMPLATE_TO_TRACK);
|
|
129
|
+
}
|
|
130
|
+
export {
|
|
131
|
+
isLearningTemplate,
|
|
132
|
+
getLearningTemplateIds,
|
|
133
|
+
LearningMiniApp
|
|
134
|
+
};
|