@contractspec/example.learning-journey-crm-onboarding 0.0.0-canary-20260113170453
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$colon$bundle.log +45 -0
- package/.turbo/turbo-build.log +46 -0
- package/CHANGELOG.md +359 -0
- package/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/docs/crm-onboarding.docblock.d.ts +1 -0
- package/dist/docs/crm-onboarding.docblock.js +42 -0
- package/dist/docs/crm-onboarding.docblock.js.map +1 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/example.d.ts +7 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +42 -0
- package/dist/example.js.map +1 -0
- package/dist/handlers/demo.handlers.d.ts +25 -0
- package/dist/handlers/demo.handlers.d.ts.map +1 -0
- package/dist/handlers/demo.handlers.js +26 -0
- package/dist/handlers/demo.handlers.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +9 -0
- package/dist/learning-journey-crm-onboarding.feature.d.ts +12 -0
- package/dist/learning-journey-crm-onboarding.feature.d.ts.map +1 -0
- package/dist/learning-journey-crm-onboarding.feature.js +75 -0
- package/dist/learning-journey-crm-onboarding.feature.js.map +1 -0
- package/dist/operations/index.d.ts +271 -0
- package/dist/operations/index.d.ts.map +1 -0
- package/dist/operations/index.js +176 -0
- package/dist/operations/index.js.map +1 -0
- package/dist/presentations/index.d.ts +9 -0
- package/dist/presentations/index.d.ts.map +1 -0
- package/dist/presentations/index.js +55 -0
- package/dist/presentations/index.js.map +1 -0
- package/dist/tests/operations.test-spec.d.ts +7 -0
- package/dist/tests/operations.test-spec.d.ts.map +1 -0
- package/dist/tests/operations.test-spec.js +36 -0
- package/dist/tests/operations.test-spec.js.map +1 -0
- package/dist/track.d.ts +8 -0
- package/dist/track.d.ts.map +1 -0
- package/dist/track.js +99 -0
- package/dist/track.js.map +1 -0
- package/example.ts +1 -0
- package/package.json +67 -0
- package/src/docs/crm-onboarding.docblock.ts +40 -0
- package/src/docs/index.ts +1 -0
- package/src/example.ts +31 -0
- package/src/handlers/demo.handlers.ts +51 -0
- package/src/index.ts +7 -0
- package/src/learning-journey-crm-onboarding.feature.ts +66 -0
- package/src/operations/index.test.ts +49 -0
- package/src/operations/index.ts +122 -0
- package/src/presentations/index.ts +51 -0
- package/src/tests/operations.test-spec.ts +31 -0
- package/src/track.ts +95 -0
- package/tsconfig.json +9 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +17 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
|
|
2
|
+
import { defineCommand, defineQuery } from '@contractspec/lib.contracts';
|
|
3
|
+
|
|
4
|
+
import { crmFirstWinTrack } from '../track';
|
|
5
|
+
|
|
6
|
+
const OWNERS = ['examples.learning-journey.crm-onboarding'] as const;
|
|
7
|
+
|
|
8
|
+
const StepModel = defineSchemaModel({
|
|
9
|
+
name: 'CrmOnboardingStep',
|
|
10
|
+
description: 'Step metadata for CRM first win journey',
|
|
11
|
+
fields: {
|
|
12
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
13
|
+
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
14
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
15
|
+
completionEvent: {
|
|
16
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
17
|
+
isOptional: false,
|
|
18
|
+
},
|
|
19
|
+
sourceModule: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
20
|
+
xpReward: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
21
|
+
order: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const CrmOnboardingTrackModel = defineSchemaModel({
|
|
26
|
+
name: 'CrmOnboardingTrack',
|
|
27
|
+
description: 'CRM onboarding track definition',
|
|
28
|
+
fields: {
|
|
29
|
+
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
30
|
+
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
31
|
+
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
32
|
+
totalXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
33
|
+
completionXpBonus: {
|
|
34
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
35
|
+
isOptional: true,
|
|
36
|
+
},
|
|
37
|
+
completionBadgeKey: {
|
|
38
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
39
|
+
isOptional: true,
|
|
40
|
+
},
|
|
41
|
+
streakHoursWindow: {
|
|
42
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
43
|
+
isOptional: true,
|
|
44
|
+
},
|
|
45
|
+
streakBonusXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
46
|
+
steps: { type: StepModel, isArray: true, isOptional: false },
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const TrackResponseModel = defineSchemaModel({
|
|
51
|
+
name: 'CrmOnboardingTrackResponse',
|
|
52
|
+
description: 'Response wrapper for CRM onboarding track',
|
|
53
|
+
fields: {
|
|
54
|
+
track: { type: CrmOnboardingTrackModel, isOptional: false },
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const RecordDemoEventInput = defineSchemaModel({
|
|
59
|
+
name: 'CrmOnboardingRecordEventInput',
|
|
60
|
+
description: 'Emit a demo event to advance CRM onboarding steps',
|
|
61
|
+
fields: {
|
|
62
|
+
learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
63
|
+
eventName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
64
|
+
payload: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
65
|
+
occurredAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const SuccessModel = defineSchemaModel({
|
|
70
|
+
name: 'CrmOnboardingSuccess',
|
|
71
|
+
description: 'Generic success response',
|
|
72
|
+
fields: {
|
|
73
|
+
success: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export const GetCrmOnboardingTrack = defineQuery({
|
|
78
|
+
meta: {
|
|
79
|
+
key: 'learningJourney.crmOnboarding.getTrack',
|
|
80
|
+
version: '1.0.0',
|
|
81
|
+
stability: 'experimental',
|
|
82
|
+
owners: [...OWNERS],
|
|
83
|
+
tags: ['learning', 'crm', 'onboarding'],
|
|
84
|
+
description: 'Fetch CRM first win track definition.',
|
|
85
|
+
goal: 'Expose track metadata to UIs and templates.',
|
|
86
|
+
context: 'Called by Studio/Playground to render journey steps.',
|
|
87
|
+
},
|
|
88
|
+
io: {
|
|
89
|
+
input: defineSchemaModel({
|
|
90
|
+
name: 'CrmOnboardingTrackInput',
|
|
91
|
+
description: 'Track input',
|
|
92
|
+
fields: {},
|
|
93
|
+
}),
|
|
94
|
+
output: TrackResponseModel,
|
|
95
|
+
},
|
|
96
|
+
policy: { auth: 'user' },
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
export const RecordCrmOnboardingEvent = defineCommand({
|
|
100
|
+
meta: {
|
|
101
|
+
key: 'learningJourney.crmOnboarding.recordEvent',
|
|
102
|
+
version: '1.0.0',
|
|
103
|
+
stability: 'experimental',
|
|
104
|
+
owners: [...OWNERS],
|
|
105
|
+
tags: ['learning', 'crm', 'onboarding'],
|
|
106
|
+
description: 'Record an event to advance CRM onboarding progress.',
|
|
107
|
+
goal: 'Advance steps via domain events in demo/sandbox contexts.',
|
|
108
|
+
context:
|
|
109
|
+
'Called by handlers or demo scripts to emit step completion events.',
|
|
110
|
+
},
|
|
111
|
+
io: {
|
|
112
|
+
input: RecordDemoEventInput,
|
|
113
|
+
output: SuccessModel,
|
|
114
|
+
},
|
|
115
|
+
policy: { auth: 'user' },
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export const crmOnboardingContracts = {
|
|
119
|
+
GetCrmOnboardingTrack,
|
|
120
|
+
RecordCrmOnboardingEvent,
|
|
121
|
+
track: crmFirstWinTrack,
|
|
122
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { definePresentation, StabilityEnum, type PresentationSpecMeta } from '@contractspec/lib.contracts';
|
|
2
|
+
import { CrmOnboardingTrackModel } from '../operations';
|
|
3
|
+
|
|
4
|
+
const baseMeta: Pick<
|
|
5
|
+
PresentationSpecMeta,
|
|
6
|
+
'domain' | 'owners' | 'tags' | 'title' | 'stability' | 'goal' | 'context'
|
|
7
|
+
> = {
|
|
8
|
+
domain: 'learning-journey',
|
|
9
|
+
title: 'CRM Onboarding',
|
|
10
|
+
owners: ['@examples.learning-journey.crm-onboarding'],
|
|
11
|
+
tags: ['learning', 'crm', 'onboarding'],
|
|
12
|
+
stability: StabilityEnum.Experimental,
|
|
13
|
+
goal: 'Guide CRM users through onboarding',
|
|
14
|
+
context: 'CRM onboarding journey',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const CrmOnboardingTrackPresentation = definePresentation({
|
|
18
|
+
meta: {
|
|
19
|
+
key: 'learning.journey.crm.track',
|
|
20
|
+
version: '1.0.0',
|
|
21
|
+
description: 'CRM first win track detail',
|
|
22
|
+
...baseMeta,
|
|
23
|
+
},
|
|
24
|
+
source: {
|
|
25
|
+
type: 'component',
|
|
26
|
+
framework: 'react',
|
|
27
|
+
componentKey: 'LearningTrackDetail',
|
|
28
|
+
props: CrmOnboardingTrackModel,
|
|
29
|
+
},
|
|
30
|
+
targets: ['react', 'markdown', 'application/json'],
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const CrmOnboardingWidgetPresentation = definePresentation({
|
|
34
|
+
meta: {
|
|
35
|
+
key: 'learning.journey.crm.widget',
|
|
36
|
+
version: '1.0.0',
|
|
37
|
+
description: 'Compact widget for CRM onboarding progress',
|
|
38
|
+
...baseMeta,
|
|
39
|
+
},
|
|
40
|
+
source: {
|
|
41
|
+
type: 'component',
|
|
42
|
+
framework: 'react',
|
|
43
|
+
componentKey: 'LearningTrackProgressWidget',
|
|
44
|
+
},
|
|
45
|
+
targets: ['react'],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const crmOnboardingPresentations = [
|
|
49
|
+
CrmOnboardingTrackPresentation,
|
|
50
|
+
CrmOnboardingWidgetPresentation,
|
|
51
|
+
];
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineTestSpec } from '@contractspec/lib.contracts';
|
|
2
|
+
|
|
3
|
+
export const GetTrackTest = defineTestSpec({
|
|
4
|
+
meta: {
|
|
5
|
+
key: 'learningJourney.crmOnboarding.getTrack.test',
|
|
6
|
+
version: '1.0.0',
|
|
7
|
+
stability: 'experimental',
|
|
8
|
+
owners: ['@example.learning-journey-crm-onboarding'],
|
|
9
|
+
description: 'Test for getting CRM onboarding track',
|
|
10
|
+
tags: ['test'],
|
|
11
|
+
},
|
|
12
|
+
target: {
|
|
13
|
+
type: 'operation',
|
|
14
|
+
operation: {
|
|
15
|
+
key: 'learningJourney.crmOnboarding.getTrack',
|
|
16
|
+
version: '1.0.0',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
scenarios: [
|
|
20
|
+
{
|
|
21
|
+
key: 'success',
|
|
22
|
+
when: { operation: { key: 'learningJourney.crmOnboarding.getTrack' } },
|
|
23
|
+
then: [{ type: 'expectOutput', match: {} }],
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: 'error',
|
|
27
|
+
when: { operation: { key: 'learningJourney.crmOnboarding.getTrack' } },
|
|
28
|
+
then: [{ type: 'expectError' }],
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
});
|
package/src/track.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { LearningJourneyTrackSpec } from '@contractspec/module.learning-journey/track-spec';
|
|
2
|
+
|
|
3
|
+
export const crmFirstWinTrack: LearningJourneyTrackSpec = {
|
|
4
|
+
id: 'crm_first_win',
|
|
5
|
+
productId: 'crm-pipeline',
|
|
6
|
+
name: 'CRM First Win',
|
|
7
|
+
description:
|
|
8
|
+
'Guide a new CRM user from empty pipeline to first closed-won deal.',
|
|
9
|
+
targetUserSegment: 'crm_adopter',
|
|
10
|
+
targetRole: 'sales',
|
|
11
|
+
totalXp: 135,
|
|
12
|
+
streakRule: { hoursWindow: 72, bonusXp: 25 },
|
|
13
|
+
completionRewards: { xpBonus: 25, badgeKey: 'crm_first_win' },
|
|
14
|
+
steps: [
|
|
15
|
+
{
|
|
16
|
+
id: 'create_pipeline',
|
|
17
|
+
title: 'Create pipeline & stages',
|
|
18
|
+
description: 'Create a pipeline with baseline stages.',
|
|
19
|
+
order: 1,
|
|
20
|
+
completion: {
|
|
21
|
+
eventName: 'pipeline.created',
|
|
22
|
+
sourceModule: '@contractspec/example.crm-pipeline',
|
|
23
|
+
},
|
|
24
|
+
xpReward: 15,
|
|
25
|
+
metadata: { surface: 'pipeline' },
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'create_contact_and_company',
|
|
29
|
+
title: 'Create contact and company',
|
|
30
|
+
description: 'Add your first contact and associated company.',
|
|
31
|
+
order: 2,
|
|
32
|
+
completion: {
|
|
33
|
+
eventName: 'contact.created',
|
|
34
|
+
sourceModule: '@contractspec/example.crm-pipeline',
|
|
35
|
+
},
|
|
36
|
+
xpReward: 20,
|
|
37
|
+
metadata: { surface: 'contacts' },
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'create_first_deal',
|
|
41
|
+
title: 'Log first deal',
|
|
42
|
+
description: 'Create your first deal in the pipeline.',
|
|
43
|
+
order: 3,
|
|
44
|
+
completion: {
|
|
45
|
+
eventName: 'deal.created',
|
|
46
|
+
sourceModule: '@contractspec/example.crm-pipeline',
|
|
47
|
+
},
|
|
48
|
+
xpReward: 20,
|
|
49
|
+
metadata: { surface: 'deals' },
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'move_deal_in_pipeline',
|
|
53
|
+
title: 'Move a deal across stages',
|
|
54
|
+
description: 'Move a deal across at least three stages.',
|
|
55
|
+
order: 4,
|
|
56
|
+
completion: {
|
|
57
|
+
eventName: 'deal.moved',
|
|
58
|
+
sourceModule: '@contractspec/example.crm-pipeline',
|
|
59
|
+
},
|
|
60
|
+
xpReward: 20,
|
|
61
|
+
metadata: { surface: 'deals' },
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: 'close_deal_won',
|
|
65
|
+
title: 'Close a deal as won',
|
|
66
|
+
description: 'Close a deal as won to hit first revenue.',
|
|
67
|
+
order: 5,
|
|
68
|
+
completion: {
|
|
69
|
+
eventName: 'deal.won',
|
|
70
|
+
sourceModule: '@contractspec/example.crm-pipeline',
|
|
71
|
+
},
|
|
72
|
+
xpReward: 30,
|
|
73
|
+
metadata: { surface: 'deals' },
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 'setup_follow_up',
|
|
77
|
+
title: 'Create follow-up task',
|
|
78
|
+
description:
|
|
79
|
+
'Create a follow-up task and notification for a contact or deal.',
|
|
80
|
+
order: 6,
|
|
81
|
+
completion: {
|
|
82
|
+
eventName: 'task.completed',
|
|
83
|
+
sourceModule: '@contractspec/example.crm-pipeline',
|
|
84
|
+
payloadFilter: { type: 'follow_up' },
|
|
85
|
+
},
|
|
86
|
+
xpReward: 30,
|
|
87
|
+
metadata: { surface: 'tasks' },
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
metadata: {
|
|
91
|
+
surfacedIn: ['crm/dashboard', 'crm/pipeline'],
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export const crmLearningTracks: LearningJourneyTrackSpec[] = [crmFirstWinTrack];
|