@contractspec/example.learning-journey-studio-onboarding 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 +46 -50
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +27 -0
- package/dist/browser/docs/index.js +35 -0
- package/dist/browser/docs/studio-onboarding.docblock.js +35 -0
- package/dist/browser/example.js +32 -0
- package/dist/browser/handlers/demo.handlers.js +107 -0
- package/dist/browser/index.js +393 -0
- package/dist/browser/learning-journey-studio-onboarding.feature.js +50 -0
- package/dist/browser/operations/index.js +201 -0
- package/dist/browser/presentations/index.js +250 -0
- package/dist/browser/tests/operations.test-spec.js +34 -0
- package/dist/browser/track.js +87 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +36 -1
- package/dist/docs/studio-onboarding.docblock.d.ts +2 -1
- package/dist/docs/studio-onboarding.docblock.d.ts.map +1 -0
- package/dist/docs/studio-onboarding.docblock.js +21 -25
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +31 -39
- package/dist/handlers/demo.handlers.d.ts +12 -17
- package/dist/handlers/demo.handlers.d.ts.map +1 -1
- package/dist/handlers/demo.handlers.js +105 -21
- package/dist/index.d.ts +8 -7
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +394 -9
- package/dist/learning-journey-studio-onboarding.feature.d.ts +1 -6
- package/dist/learning-journey-studio-onboarding.feature.d.ts.map +1 -1
- package/dist/learning-journey-studio-onboarding.feature.js +49 -73
- package/dist/node/docs/index.js +35 -0
- package/dist/node/docs/studio-onboarding.docblock.js +35 -0
- package/dist/node/example.js +32 -0
- package/dist/node/handlers/demo.handlers.js +107 -0
- package/dist/node/index.js +393 -0
- package/dist/node/learning-journey-studio-onboarding.feature.js +50 -0
- package/dist/node/operations/index.js +201 -0
- package/dist/node/presentations/index.js +250 -0
- package/dist/node/tests/operations.test-spec.js +34 -0
- package/dist/node/track.js +87 -0
- package/dist/operations/index.d.ts +229 -236
- package/dist/operations/index.d.ts.map +1 -1
- package/dist/operations/index.js +193 -167
- package/dist/operations/index.test.d.ts +2 -0
- package/dist/operations/index.test.d.ts.map +1 -0
- package/dist/presentations/index.d.ts +3 -8
- package/dist/presentations/index.d.ts.map +1 -1
- package/dist/presentations/index.js +248 -54
- package/dist/tests/operations.test-spec.d.ts +1 -6
- package/dist/tests/operations.test-spec.d.ts.map +1 -1
- package/dist/tests/operations.test-spec.js +33 -34
- package/dist/track.d.ts +3 -7
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +87 -90
- package/package.json +118 -34
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -50
- package/dist/docs/studio-onboarding.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/demo.handlers.js.map +0 -1
- package/dist/learning-journey-studio-onboarding.feature.js.map +0 -1
- package/dist/operations/index.js.map +0 -1
- package/dist/presentations/index.js.map +0 -1
- package/dist/tests/operations.test-spec.js.map +0 -1
- package/dist/track.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
// src/track.ts
|
|
2
|
+
var studioGettingStartedTrack = {
|
|
3
|
+
id: "studio_getting_started",
|
|
4
|
+
productId: "contractspec-studio",
|
|
5
|
+
name: "Studio Getting Started",
|
|
6
|
+
description: "First 30 minutes in Studio: create a project, edit the spec, deploy/regenerate, and try key modules.",
|
|
7
|
+
targetUserSegment: "new_studio_user",
|
|
8
|
+
targetRole: "developer",
|
|
9
|
+
totalXp: 110,
|
|
10
|
+
streakRule: { hoursWindow: 48, bonusXp: 25 },
|
|
11
|
+
completionRewards: { xpBonus: 25, badgeKey: "studio_first_30m" },
|
|
12
|
+
steps: [
|
|
13
|
+
{
|
|
14
|
+
id: "choose_template",
|
|
15
|
+
title: "Choose a template",
|
|
16
|
+
description: "Create your first Studio project (starter template).",
|
|
17
|
+
order: 1,
|
|
18
|
+
completion: {
|
|
19
|
+
eventName: "studio.template.instantiated",
|
|
20
|
+
sourceModule: "@contractspec/bundle.studio"
|
|
21
|
+
},
|
|
22
|
+
xpReward: 20,
|
|
23
|
+
metadata: { surface: "projects" }
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "edit_spec",
|
|
27
|
+
title: "Edit the spec",
|
|
28
|
+
description: "Change the spec (not generated code) and save.",
|
|
29
|
+
instructions: "Open spec editor, tweak a contract or presentation, save.",
|
|
30
|
+
order: 2,
|
|
31
|
+
completion: {
|
|
32
|
+
eventName: "spec.changed",
|
|
33
|
+
sourceModule: "@contractspec/bundle.studio"
|
|
34
|
+
},
|
|
35
|
+
xpReward: 20,
|
|
36
|
+
metadata: { surface: "spec-editor" }
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "regenerate_app",
|
|
40
|
+
title: "Regenerate the app",
|
|
41
|
+
description: "Regenerate artifacts from the updated spec.",
|
|
42
|
+
order: 3,
|
|
43
|
+
completion: {
|
|
44
|
+
eventName: "regeneration.completed",
|
|
45
|
+
sourceModule: "@contractspec/lib.contracts/regenerator"
|
|
46
|
+
},
|
|
47
|
+
xpReward: 20,
|
|
48
|
+
metadata: { surface: "regenerator" }
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "open_canvas",
|
|
52
|
+
title: "Open the canvas",
|
|
53
|
+
description: "Visit the canvas module for your project.",
|
|
54
|
+
order: 4,
|
|
55
|
+
completion: {
|
|
56
|
+
eventName: "module.navigated",
|
|
57
|
+
sourceModule: "@contractspec/bundle.studio",
|
|
58
|
+
payloadFilter: { moduleId: "canvas" }
|
|
59
|
+
},
|
|
60
|
+
xpReward: 20,
|
|
61
|
+
metadata: { surface: "canvas" }
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "try_evolution_mode",
|
|
65
|
+
title: "Try evolution mode",
|
|
66
|
+
description: "Request a change via Evolution, then regenerate.",
|
|
67
|
+
order: 5,
|
|
68
|
+
completion: {
|
|
69
|
+
eventName: "studio.evolution.applied",
|
|
70
|
+
sourceModule: "@contractspec/lib.evolution"
|
|
71
|
+
},
|
|
72
|
+
xpReward: 30,
|
|
73
|
+
metadata: { surface: "evolution" }
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
metadata: {
|
|
77
|
+
persona: "first_run",
|
|
78
|
+
surfacedIn: ["studio/home", "studio/sidebar/learning"]
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var studioLearningTracks = [
|
|
82
|
+
studioGettingStartedTrack
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
// src/operations/index.ts
|
|
86
|
+
import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
|
|
87
|
+
import { defineCommand, defineQuery } from "@contractspec/lib.contracts";
|
|
88
|
+
var OWNERS = ["examples.learning-journey.studio-onboarding"];
|
|
89
|
+
var StepModel = defineSchemaModel({
|
|
90
|
+
name: "StudioOnboardingStep",
|
|
91
|
+
description: "Step metadata for Studio onboarding journey",
|
|
92
|
+
fields: {
|
|
93
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
94
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
95
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
96
|
+
completionEvent: {
|
|
97
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
98
|
+
isOptional: false
|
|
99
|
+
},
|
|
100
|
+
sourceModule: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
101
|
+
xpReward: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
102
|
+
order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
var StudioOnboardingTrackModel = defineSchemaModel({
|
|
106
|
+
name: "StudioOnboardingTrack",
|
|
107
|
+
description: "Studio onboarding track definition",
|
|
108
|
+
fields: {
|
|
109
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
110
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
111
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
112
|
+
totalXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
113
|
+
completionXpBonus: {
|
|
114
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
115
|
+
isOptional: true
|
|
116
|
+
},
|
|
117
|
+
completionBadgeKey: {
|
|
118
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
119
|
+
isOptional: true
|
|
120
|
+
},
|
|
121
|
+
streakHoursWindow: {
|
|
122
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
123
|
+
isOptional: true
|
|
124
|
+
},
|
|
125
|
+
streakBonusXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
126
|
+
steps: { type: StepModel, isArray: true, isOptional: false }
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
var TrackResponseModel = defineSchemaModel({
|
|
130
|
+
name: "StudioOnboardingTrackResponse",
|
|
131
|
+
description: "Response wrapper for studio onboarding track",
|
|
132
|
+
fields: {
|
|
133
|
+
track: { type: StudioOnboardingTrackModel, isOptional: false }
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
var RecordDemoEventInput = defineSchemaModel({
|
|
137
|
+
name: "StudioOnboardingRecordEventInput",
|
|
138
|
+
description: "Emit a demo event to advance Studio onboarding steps",
|
|
139
|
+
fields: {
|
|
140
|
+
learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
141
|
+
eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
142
|
+
payload: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
143
|
+
occurredAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
var SuccessModel = defineSchemaModel({
|
|
147
|
+
name: "StudioOnboardingSuccess",
|
|
148
|
+
description: "Generic success response",
|
|
149
|
+
fields: {
|
|
150
|
+
success: { type: ScalarTypeEnum.Boolean(), isOptional: false }
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
var GetStudioOnboardingTrack = defineQuery({
|
|
154
|
+
meta: {
|
|
155
|
+
key: "learningJourney.studioOnboarding.getTrack",
|
|
156
|
+
version: "1.0.0",
|
|
157
|
+
stability: "experimental",
|
|
158
|
+
owners: [...OWNERS],
|
|
159
|
+
tags: ["learning", "onboarding", "studio"],
|
|
160
|
+
description: "Fetch the Studio onboarding track definition.",
|
|
161
|
+
goal: "Expose track metadata to UIs and templates.",
|
|
162
|
+
context: "Called by Studio/Playground to render journey steps."
|
|
163
|
+
},
|
|
164
|
+
io: {
|
|
165
|
+
input: defineSchemaModel({
|
|
166
|
+
name: "StudioOnboardingTrackInput",
|
|
167
|
+
description: "Track input",
|
|
168
|
+
fields: {}
|
|
169
|
+
}),
|
|
170
|
+
output: TrackResponseModel
|
|
171
|
+
},
|
|
172
|
+
policy: { auth: "user" }
|
|
173
|
+
});
|
|
174
|
+
var RecordStudioOnboardingEvent = defineCommand({
|
|
175
|
+
meta: {
|
|
176
|
+
key: "learningJourney.studioOnboarding.recordEvent",
|
|
177
|
+
version: "1.0.0",
|
|
178
|
+
stability: "experimental",
|
|
179
|
+
owners: [...OWNERS],
|
|
180
|
+
tags: ["learning", "onboarding", "studio"],
|
|
181
|
+
description: "Record an event to advance Studio onboarding progress.",
|
|
182
|
+
goal: "Advance steps via domain events in demo/sandbox contexts.",
|
|
183
|
+
context: "Called by handlers or demo scripts to emit step completion events."
|
|
184
|
+
},
|
|
185
|
+
io: {
|
|
186
|
+
input: RecordDemoEventInput,
|
|
187
|
+
output: SuccessModel
|
|
188
|
+
},
|
|
189
|
+
policy: { auth: "user" }
|
|
190
|
+
});
|
|
191
|
+
var studioOnboardingContracts = {
|
|
192
|
+
GetStudioOnboardingTrack,
|
|
193
|
+
RecordStudioOnboardingEvent,
|
|
194
|
+
track: studioGettingStartedTrack
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// src/presentations/index.ts
|
|
198
|
+
import {
|
|
199
|
+
definePresentation,
|
|
200
|
+
StabilityEnum
|
|
201
|
+
} from "@contractspec/lib.contracts";
|
|
202
|
+
var baseMeta = {
|
|
203
|
+
domain: "learning-journey",
|
|
204
|
+
title: "Studio Onboarding",
|
|
205
|
+
owners: ["@examples.learning-journey.studio-onboarding"],
|
|
206
|
+
tags: ["learning", "onboarding", "studio"],
|
|
207
|
+
stability: StabilityEnum.Experimental
|
|
208
|
+
};
|
|
209
|
+
var StudioOnboardingTrackPresentation = definePresentation({
|
|
210
|
+
meta: {
|
|
211
|
+
key: "learning.journey.studio.track",
|
|
212
|
+
version: "1.0.0",
|
|
213
|
+
description: "Studio onboarding track detail",
|
|
214
|
+
goal: "Visualize the onboarding track for the user.",
|
|
215
|
+
context: "Displayed in the Studio dashboard.",
|
|
216
|
+
...baseMeta
|
|
217
|
+
},
|
|
218
|
+
source: {
|
|
219
|
+
type: "component",
|
|
220
|
+
framework: "react",
|
|
221
|
+
componentKey: "LearningTrackDetail",
|
|
222
|
+
props: StudioOnboardingTrackModel
|
|
223
|
+
},
|
|
224
|
+
targets: ["react", "markdown", "application/json"]
|
|
225
|
+
});
|
|
226
|
+
var StudioOnboardingWidgetPresentation = definePresentation({
|
|
227
|
+
meta: {
|
|
228
|
+
key: "learning.journey.studio.widget",
|
|
229
|
+
version: "1.0.0",
|
|
230
|
+
description: "Compact widget for Studio onboarding progress",
|
|
231
|
+
goal: "Show quick progress summary.",
|
|
232
|
+
context: "Displayed in the Studio sidebar or header.",
|
|
233
|
+
...baseMeta
|
|
234
|
+
},
|
|
235
|
+
source: {
|
|
236
|
+
type: "component",
|
|
237
|
+
framework: "react",
|
|
238
|
+
componentKey: "LearningTrackProgressWidget"
|
|
239
|
+
},
|
|
240
|
+
targets: ["react"]
|
|
241
|
+
});
|
|
242
|
+
var studioOnboardingPresentations = [
|
|
243
|
+
StudioOnboardingTrackPresentation,
|
|
244
|
+
StudioOnboardingWidgetPresentation
|
|
245
|
+
];
|
|
246
|
+
export {
|
|
247
|
+
studioOnboardingPresentations,
|
|
248
|
+
StudioOnboardingWidgetPresentation,
|
|
249
|
+
StudioOnboardingTrackPresentation
|
|
250
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/tests/operations.test-spec.ts
|
|
2
|
+
import { defineTestSpec } from "@contractspec/lib.contracts";
|
|
3
|
+
var GetTrackTest = defineTestSpec({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "learningJourney.studioOnboarding.getTrack.test",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
stability: "experimental",
|
|
8
|
+
owners: ["@example.learning-journey-studio-onboarding"],
|
|
9
|
+
description: "Test for getting studio onboarding track",
|
|
10
|
+
tags: ["test"]
|
|
11
|
+
},
|
|
12
|
+
target: {
|
|
13
|
+
type: "operation",
|
|
14
|
+
operation: {
|
|
15
|
+
key: "learningJourney.studioOnboarding.getTrack",
|
|
16
|
+
version: "1.0.0"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
scenarios: [
|
|
20
|
+
{
|
|
21
|
+
key: "success",
|
|
22
|
+
when: { operation: { key: "learningJourney.studioOnboarding.getTrack" } },
|
|
23
|
+
then: [{ type: "expectOutput", match: {} }]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: "error",
|
|
27
|
+
when: { operation: { key: "learningJourney.studioOnboarding.getTrack" } },
|
|
28
|
+
then: [{ type: "expectError" }]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
GetTrackTest
|
|
34
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// src/track.ts
|
|
2
|
+
var studioGettingStartedTrack = {
|
|
3
|
+
id: "studio_getting_started",
|
|
4
|
+
productId: "contractspec-studio",
|
|
5
|
+
name: "Studio Getting Started",
|
|
6
|
+
description: "First 30 minutes in Studio: create a project, edit the spec, deploy/regenerate, and try key modules.",
|
|
7
|
+
targetUserSegment: "new_studio_user",
|
|
8
|
+
targetRole: "developer",
|
|
9
|
+
totalXp: 110,
|
|
10
|
+
streakRule: { hoursWindow: 48, bonusXp: 25 },
|
|
11
|
+
completionRewards: { xpBonus: 25, badgeKey: "studio_first_30m" },
|
|
12
|
+
steps: [
|
|
13
|
+
{
|
|
14
|
+
id: "choose_template",
|
|
15
|
+
title: "Choose a template",
|
|
16
|
+
description: "Create your first Studio project (starter template).",
|
|
17
|
+
order: 1,
|
|
18
|
+
completion: {
|
|
19
|
+
eventName: "studio.template.instantiated",
|
|
20
|
+
sourceModule: "@contractspec/bundle.studio"
|
|
21
|
+
},
|
|
22
|
+
xpReward: 20,
|
|
23
|
+
metadata: { surface: "projects" }
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "edit_spec",
|
|
27
|
+
title: "Edit the spec",
|
|
28
|
+
description: "Change the spec (not generated code) and save.",
|
|
29
|
+
instructions: "Open spec editor, tweak a contract or presentation, save.",
|
|
30
|
+
order: 2,
|
|
31
|
+
completion: {
|
|
32
|
+
eventName: "spec.changed",
|
|
33
|
+
sourceModule: "@contractspec/bundle.studio"
|
|
34
|
+
},
|
|
35
|
+
xpReward: 20,
|
|
36
|
+
metadata: { surface: "spec-editor" }
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "regenerate_app",
|
|
40
|
+
title: "Regenerate the app",
|
|
41
|
+
description: "Regenerate artifacts from the updated spec.",
|
|
42
|
+
order: 3,
|
|
43
|
+
completion: {
|
|
44
|
+
eventName: "regeneration.completed",
|
|
45
|
+
sourceModule: "@contractspec/lib.contracts/regenerator"
|
|
46
|
+
},
|
|
47
|
+
xpReward: 20,
|
|
48
|
+
metadata: { surface: "regenerator" }
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "open_canvas",
|
|
52
|
+
title: "Open the canvas",
|
|
53
|
+
description: "Visit the canvas module for your project.",
|
|
54
|
+
order: 4,
|
|
55
|
+
completion: {
|
|
56
|
+
eventName: "module.navigated",
|
|
57
|
+
sourceModule: "@contractspec/bundle.studio",
|
|
58
|
+
payloadFilter: { moduleId: "canvas" }
|
|
59
|
+
},
|
|
60
|
+
xpReward: 20,
|
|
61
|
+
metadata: { surface: "canvas" }
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "try_evolution_mode",
|
|
65
|
+
title: "Try evolution mode",
|
|
66
|
+
description: "Request a change via Evolution, then regenerate.",
|
|
67
|
+
order: 5,
|
|
68
|
+
completion: {
|
|
69
|
+
eventName: "studio.evolution.applied",
|
|
70
|
+
sourceModule: "@contractspec/lib.evolution"
|
|
71
|
+
},
|
|
72
|
+
xpReward: 30,
|
|
73
|
+
metadata: { surface: "evolution" }
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
metadata: {
|
|
77
|
+
persona: "first_run",
|
|
78
|
+
surfacedIn: ["studio/home", "studio/sidebar/learning"]
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
var studioLearningTracks = [
|
|
82
|
+
studioGettingStartedTrack
|
|
83
|
+
];
|
|
84
|
+
export {
|
|
85
|
+
studioLearningTracks,
|
|
86
|
+
studioGettingStartedTrack
|
|
87
|
+
};
|