@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,55 @@
|
|
|
1
|
+
import { CrmOnboardingTrackModel } from "../operations/index.js";
|
|
2
|
+
import { StabilityEnum, definePresentation } from "@contractspec/lib.contracts";
|
|
3
|
+
|
|
4
|
+
//#region src/presentations/index.ts
|
|
5
|
+
const baseMeta = {
|
|
6
|
+
domain: "learning-journey",
|
|
7
|
+
title: "CRM Onboarding",
|
|
8
|
+
owners: ["@examples.learning-journey.crm-onboarding"],
|
|
9
|
+
tags: [
|
|
10
|
+
"learning",
|
|
11
|
+
"crm",
|
|
12
|
+
"onboarding"
|
|
13
|
+
],
|
|
14
|
+
stability: StabilityEnum.Experimental,
|
|
15
|
+
goal: "Guide CRM users through onboarding",
|
|
16
|
+
context: "CRM onboarding journey"
|
|
17
|
+
};
|
|
18
|
+
const CrmOnboardingTrackPresentation = definePresentation({
|
|
19
|
+
meta: {
|
|
20
|
+
key: "learning.journey.crm.track",
|
|
21
|
+
version: "1.0.0",
|
|
22
|
+
description: "CRM first win track detail",
|
|
23
|
+
...baseMeta
|
|
24
|
+
},
|
|
25
|
+
source: {
|
|
26
|
+
type: "component",
|
|
27
|
+
framework: "react",
|
|
28
|
+
componentKey: "LearningTrackDetail",
|
|
29
|
+
props: CrmOnboardingTrackModel
|
|
30
|
+
},
|
|
31
|
+
targets: [
|
|
32
|
+
"react",
|
|
33
|
+
"markdown",
|
|
34
|
+
"application/json"
|
|
35
|
+
]
|
|
36
|
+
});
|
|
37
|
+
const CrmOnboardingWidgetPresentation = definePresentation({
|
|
38
|
+
meta: {
|
|
39
|
+
key: "learning.journey.crm.widget",
|
|
40
|
+
version: "1.0.0",
|
|
41
|
+
description: "Compact widget for CRM onboarding progress",
|
|
42
|
+
...baseMeta
|
|
43
|
+
},
|
|
44
|
+
source: {
|
|
45
|
+
type: "component",
|
|
46
|
+
framework: "react",
|
|
47
|
+
componentKey: "LearningTrackProgressWidget"
|
|
48
|
+
},
|
|
49
|
+
targets: ["react"]
|
|
50
|
+
});
|
|
51
|
+
const crmOnboardingPresentations = [CrmOnboardingTrackPresentation, CrmOnboardingWidgetPresentation];
|
|
52
|
+
|
|
53
|
+
//#endregion
|
|
54
|
+
export { CrmOnboardingTrackPresentation, CrmOnboardingWidgetPresentation, crmOnboardingPresentations };
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/presentations/index.ts"],"sourcesContent":["import { definePresentation, StabilityEnum, type PresentationSpecMeta } from '@contractspec/lib.contracts';\nimport { CrmOnboardingTrackModel } from '../operations';\n\nconst baseMeta: Pick<\n PresentationSpecMeta,\n 'domain' | 'owners' | 'tags' | 'title' | 'stability' | 'goal' | 'context'\n> = {\n domain: 'learning-journey',\n title: 'CRM Onboarding',\n owners: ['@examples.learning-journey.crm-onboarding'],\n tags: ['learning', 'crm', 'onboarding'],\n stability: StabilityEnum.Experimental,\n goal: 'Guide CRM users through onboarding',\n context: 'CRM onboarding journey',\n};\n\nexport const CrmOnboardingTrackPresentation = definePresentation({\n meta: {\n key: 'learning.journey.crm.track',\n version: '1.0.0',\n description: 'CRM first win track detail',\n ...baseMeta,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'LearningTrackDetail',\n props: CrmOnboardingTrackModel,\n },\n targets: ['react', 'markdown', 'application/json'],\n});\n\nexport const CrmOnboardingWidgetPresentation = definePresentation({\n meta: {\n key: 'learning.journey.crm.widget',\n version: '1.0.0',\n description: 'Compact widget for CRM onboarding progress',\n ...baseMeta,\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'LearningTrackProgressWidget',\n },\n targets: ['react'],\n});\n\nexport const crmOnboardingPresentations = [\n CrmOnboardingTrackPresentation,\n CrmOnboardingWidgetPresentation,\n];\n"],"mappings":";;;;AAGA,MAAM,WAGF;CACF,QAAQ;CACR,OAAO;CACP,QAAQ,CAAC,4CAA4C;CACrD,MAAM;EAAC;EAAY;EAAO;EAAa;CACvC,WAAW,cAAc;CACzB,MAAM;CACN,SAAS;CACV;AAED,MAAa,iCAAiC,mBAAmB;CAC/D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,GAAG;EACJ;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS;EAAC;EAAS;EAAY;EAAmB;CACnD,CAAC;AAEF,MAAa,kCAAkC,mBAAmB;CAChE,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,GAAG;EACJ;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACf;CACD,SAAS,CAAC,QAAQ;CACnB,CAAC;AAEF,MAAa,6BAA6B,CACxC,gCACA,gCACD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as _contractspec_lib_contracts8 from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/tests/operations.test-spec.d.ts
|
|
4
|
+
declare const GetTrackTest: _contractspec_lib_contracts8.TestSpec;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { GetTrackTest };
|
|
7
|
+
//# sourceMappingURL=operations.test-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.test-spec.d.ts","names":[],"sources":["../../src/tests/operations.test-spec.ts"],"sourcesContent":[],"mappings":";;;cAEa,cA4BX,4BAAA,CA5BuB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineTestSpec } from "@contractspec/lib.contracts";
|
|
2
|
+
|
|
3
|
+
//#region src/tests/operations.test-spec.ts
|
|
4
|
+
const GetTrackTest = defineTestSpec({
|
|
5
|
+
meta: {
|
|
6
|
+
key: "learningJourney.crmOnboarding.getTrack.test",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
stability: "experimental",
|
|
9
|
+
owners: ["@example.learning-journey-crm-onboarding"],
|
|
10
|
+
description: "Test for getting CRM onboarding track",
|
|
11
|
+
tags: ["test"]
|
|
12
|
+
},
|
|
13
|
+
target: {
|
|
14
|
+
type: "operation",
|
|
15
|
+
operation: {
|
|
16
|
+
key: "learningJourney.crmOnboarding.getTrack",
|
|
17
|
+
version: "1.0.0"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
scenarios: [{
|
|
21
|
+
key: "success",
|
|
22
|
+
when: { operation: { key: "learningJourney.crmOnboarding.getTrack" } },
|
|
23
|
+
then: [{
|
|
24
|
+
type: "expectOutput",
|
|
25
|
+
match: {}
|
|
26
|
+
}]
|
|
27
|
+
}, {
|
|
28
|
+
key: "error",
|
|
29
|
+
when: { operation: { key: "learningJourney.crmOnboarding.getTrack" } },
|
|
30
|
+
then: [{ type: "expectError" }]
|
|
31
|
+
}]
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { GetTrackTest };
|
|
36
|
+
//# sourceMappingURL=operations.test-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.test-spec.js","names":[],"sources":["../../src/tests/operations.test-spec.ts"],"sourcesContent":["import { defineTestSpec } from '@contractspec/lib.contracts';\n\nexport const GetTrackTest = defineTestSpec({\n meta: {\n key: 'learningJourney.crmOnboarding.getTrack.test',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@example.learning-journey-crm-onboarding'],\n description: 'Test for getting CRM onboarding track',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: {\n key: 'learningJourney.crmOnboarding.getTrack',\n version: '1.0.0',\n },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'learningJourney.crmOnboarding.getTrack' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'learningJourney.crmOnboarding.getTrack' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n"],"mappings":";;;AAEA,MAAa,eAAe,eAAe;CACzC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,2CAA2C;EACpD,aAAa;EACb,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GACT,KAAK;GACL,SAAS;GACV;EACF;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,0CAA0C,EAAE;EACtE,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,0CAA0C,EAAE;EACtE,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC"}
|
package/dist/track.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { LearningJourneyTrackSpec } from "@contractspec/module.learning-journey/track-spec";
|
|
2
|
+
|
|
3
|
+
//#region src/track.d.ts
|
|
4
|
+
declare const crmFirstWinTrack: LearningJourneyTrackSpec;
|
|
5
|
+
declare const crmLearningTracks: LearningJourneyTrackSpec[];
|
|
6
|
+
//#endregion
|
|
7
|
+
export { crmFirstWinTrack, crmLearningTracks };
|
|
8
|
+
//# sourceMappingURL=track.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track.d.ts","names":[],"sources":["../src/track.ts"],"sourcesContent":[],"mappings":";;;cAEa,kBAAkB;cA4FlB,mBAAmB"}
|
package/dist/track.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
//#region src/track.ts
|
|
2
|
+
const crmFirstWinTrack = {
|
|
3
|
+
id: "crm_first_win",
|
|
4
|
+
productId: "crm-pipeline",
|
|
5
|
+
name: "CRM First Win",
|
|
6
|
+
description: "Guide a new CRM user from empty pipeline to first closed-won deal.",
|
|
7
|
+
targetUserSegment: "crm_adopter",
|
|
8
|
+
targetRole: "sales",
|
|
9
|
+
totalXp: 135,
|
|
10
|
+
streakRule: {
|
|
11
|
+
hoursWindow: 72,
|
|
12
|
+
bonusXp: 25
|
|
13
|
+
},
|
|
14
|
+
completionRewards: {
|
|
15
|
+
xpBonus: 25,
|
|
16
|
+
badgeKey: "crm_first_win"
|
|
17
|
+
},
|
|
18
|
+
steps: [
|
|
19
|
+
{
|
|
20
|
+
id: "create_pipeline",
|
|
21
|
+
title: "Create pipeline & stages",
|
|
22
|
+
description: "Create a pipeline with baseline stages.",
|
|
23
|
+
order: 1,
|
|
24
|
+
completion: {
|
|
25
|
+
eventName: "pipeline.created",
|
|
26
|
+
sourceModule: "@contractspec/example.crm-pipeline"
|
|
27
|
+
},
|
|
28
|
+
xpReward: 15,
|
|
29
|
+
metadata: { surface: "pipeline" }
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "create_contact_and_company",
|
|
33
|
+
title: "Create contact and company",
|
|
34
|
+
description: "Add your first contact and associated company.",
|
|
35
|
+
order: 2,
|
|
36
|
+
completion: {
|
|
37
|
+
eventName: "contact.created",
|
|
38
|
+
sourceModule: "@contractspec/example.crm-pipeline"
|
|
39
|
+
},
|
|
40
|
+
xpReward: 20,
|
|
41
|
+
metadata: { surface: "contacts" }
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "create_first_deal",
|
|
45
|
+
title: "Log first deal",
|
|
46
|
+
description: "Create your first deal in the pipeline.",
|
|
47
|
+
order: 3,
|
|
48
|
+
completion: {
|
|
49
|
+
eventName: "deal.created",
|
|
50
|
+
sourceModule: "@contractspec/example.crm-pipeline"
|
|
51
|
+
},
|
|
52
|
+
xpReward: 20,
|
|
53
|
+
metadata: { surface: "deals" }
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "move_deal_in_pipeline",
|
|
57
|
+
title: "Move a deal across stages",
|
|
58
|
+
description: "Move a deal across at least three stages.",
|
|
59
|
+
order: 4,
|
|
60
|
+
completion: {
|
|
61
|
+
eventName: "deal.moved",
|
|
62
|
+
sourceModule: "@contractspec/example.crm-pipeline"
|
|
63
|
+
},
|
|
64
|
+
xpReward: 20,
|
|
65
|
+
metadata: { surface: "deals" }
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: "close_deal_won",
|
|
69
|
+
title: "Close a deal as won",
|
|
70
|
+
description: "Close a deal as won to hit first revenue.",
|
|
71
|
+
order: 5,
|
|
72
|
+
completion: {
|
|
73
|
+
eventName: "deal.won",
|
|
74
|
+
sourceModule: "@contractspec/example.crm-pipeline"
|
|
75
|
+
},
|
|
76
|
+
xpReward: 30,
|
|
77
|
+
metadata: { surface: "deals" }
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "setup_follow_up",
|
|
81
|
+
title: "Create follow-up task",
|
|
82
|
+
description: "Create a follow-up task and notification for a contact or deal.",
|
|
83
|
+
order: 6,
|
|
84
|
+
completion: {
|
|
85
|
+
eventName: "task.completed",
|
|
86
|
+
sourceModule: "@contractspec/example.crm-pipeline",
|
|
87
|
+
payloadFilter: { type: "follow_up" }
|
|
88
|
+
},
|
|
89
|
+
xpReward: 30,
|
|
90
|
+
metadata: { surface: "tasks" }
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
metadata: { surfacedIn: ["crm/dashboard", "crm/pipeline"] }
|
|
94
|
+
};
|
|
95
|
+
const crmLearningTracks = [crmFirstWinTrack];
|
|
96
|
+
|
|
97
|
+
//#endregion
|
|
98
|
+
export { crmFirstWinTrack, crmLearningTracks };
|
|
99
|
+
//# sourceMappingURL=track.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"track.js","names":[],"sources":["../src/track.ts"],"sourcesContent":["import type { LearningJourneyTrackSpec } from '@contractspec/module.learning-journey/track-spec';\n\nexport const crmFirstWinTrack: LearningJourneyTrackSpec = {\n id: 'crm_first_win',\n productId: 'crm-pipeline',\n name: 'CRM First Win',\n description:\n 'Guide a new CRM user from empty pipeline to first closed-won deal.',\n targetUserSegment: 'crm_adopter',\n targetRole: 'sales',\n totalXp: 135,\n streakRule: { hoursWindow: 72, bonusXp: 25 },\n completionRewards: { xpBonus: 25, badgeKey: 'crm_first_win' },\n steps: [\n {\n id: 'create_pipeline',\n title: 'Create pipeline & stages',\n description: 'Create a pipeline with baseline stages.',\n order: 1,\n completion: {\n eventName: 'pipeline.created',\n sourceModule: '@contractspec/example.crm-pipeline',\n },\n xpReward: 15,\n metadata: { surface: 'pipeline' },\n },\n {\n id: 'create_contact_and_company',\n title: 'Create contact and company',\n description: 'Add your first contact and associated company.',\n order: 2,\n completion: {\n eventName: 'contact.created',\n sourceModule: '@contractspec/example.crm-pipeline',\n },\n xpReward: 20,\n metadata: { surface: 'contacts' },\n },\n {\n id: 'create_first_deal',\n title: 'Log first deal',\n description: 'Create your first deal in the pipeline.',\n order: 3,\n completion: {\n eventName: 'deal.created',\n sourceModule: '@contractspec/example.crm-pipeline',\n },\n xpReward: 20,\n metadata: { surface: 'deals' },\n },\n {\n id: 'move_deal_in_pipeline',\n title: 'Move a deal across stages',\n description: 'Move a deal across at least three stages.',\n order: 4,\n completion: {\n eventName: 'deal.moved',\n sourceModule: '@contractspec/example.crm-pipeline',\n },\n xpReward: 20,\n metadata: { surface: 'deals' },\n },\n {\n id: 'close_deal_won',\n title: 'Close a deal as won',\n description: 'Close a deal as won to hit first revenue.',\n order: 5,\n completion: {\n eventName: 'deal.won',\n sourceModule: '@contractspec/example.crm-pipeline',\n },\n xpReward: 30,\n metadata: { surface: 'deals' },\n },\n {\n id: 'setup_follow_up',\n title: 'Create follow-up task',\n description:\n 'Create a follow-up task and notification for a contact or deal.',\n order: 6,\n completion: {\n eventName: 'task.completed',\n sourceModule: '@contractspec/example.crm-pipeline',\n payloadFilter: { type: 'follow_up' },\n },\n xpReward: 30,\n metadata: { surface: 'tasks' },\n },\n ],\n metadata: {\n surfacedIn: ['crm/dashboard', 'crm/pipeline'],\n },\n};\n\nexport const crmLearningTracks: LearningJourneyTrackSpec[] = [crmFirstWinTrack];\n"],"mappings":";AAEA,MAAa,mBAA6C;CACxD,IAAI;CACJ,WAAW;CACX,MAAM;CACN,aACE;CACF,mBAAmB;CACnB,YAAY;CACZ,SAAS;CACT,YAAY;EAAE,aAAa;EAAI,SAAS;EAAI;CAC5C,mBAAmB;EAAE,SAAS;EAAI,UAAU;EAAiB;CAC7D,OAAO;EACL;GACE,IAAI;GACJ,OAAO;GACP,aAAa;GACb,OAAO;GACP,YAAY;IACV,WAAW;IACX,cAAc;IACf;GACD,UAAU;GACV,UAAU,EAAE,SAAS,YAAY;GAClC;EACD;GACE,IAAI;GACJ,OAAO;GACP,aAAa;GACb,OAAO;GACP,YAAY;IACV,WAAW;IACX,cAAc;IACf;GACD,UAAU;GACV,UAAU,EAAE,SAAS,YAAY;GAClC;EACD;GACE,IAAI;GACJ,OAAO;GACP,aAAa;GACb,OAAO;GACP,YAAY;IACV,WAAW;IACX,cAAc;IACf;GACD,UAAU;GACV,UAAU,EAAE,SAAS,SAAS;GAC/B;EACD;GACE,IAAI;GACJ,OAAO;GACP,aAAa;GACb,OAAO;GACP,YAAY;IACV,WAAW;IACX,cAAc;IACf;GACD,UAAU;GACV,UAAU,EAAE,SAAS,SAAS;GAC/B;EACD;GACE,IAAI;GACJ,OAAO;GACP,aAAa;GACb,OAAO;GACP,YAAY;IACV,WAAW;IACX,cAAc;IACf;GACD,UAAU;GACV,UAAU,EAAE,SAAS,SAAS;GAC/B;EACD;GACE,IAAI;GACJ,OAAO;GACP,aACE;GACF,OAAO;GACP,YAAY;IACV,WAAW;IACX,cAAc;IACd,eAAe,EAAE,MAAM,aAAa;IACrC;GACD,UAAU;GACV,UAAU,EAAE,SAAS,SAAS;GAC/B;EACF;CACD,UAAU,EACR,YAAY,CAAC,iBAAiB,eAAe,EAC9C;CACF;AAED,MAAa,oBAAgD,CAAC,iBAAiB"}
|
package/example.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './src/example';
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contractspec/example.learning-journey-crm-onboarding",
|
|
3
|
+
"version": "0.0.0-canary-20260113170453",
|
|
4
|
+
"description": "Learning journey track that onboards users to the CRM pipeline example.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js",
|
|
9
|
+
"./docs": "./dist/docs/index.js",
|
|
10
|
+
"./docs/crm-onboarding.docblock": "./dist/docs/crm-onboarding.docblock.js",
|
|
11
|
+
"./example": "./dist/example.js",
|
|
12
|
+
"./handlers/demo.handlers": "./dist/handlers/demo.handlers.js",
|
|
13
|
+
"./learning-journey-crm-onboarding.feature": "./dist/learning-journey-crm-onboarding.feature.js",
|
|
14
|
+
"./operations": "./dist/operations/index.js",
|
|
15
|
+
"./presentations": "./dist/presentations/index.js",
|
|
16
|
+
"./tests/operations.test-spec": "./dist/tests/operations.test-spec.js",
|
|
17
|
+
"./track": "./dist/track.js",
|
|
18
|
+
"./*": "./*"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
22
|
+
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
23
|
+
"build": "bun build:types && bun build:bundle",
|
|
24
|
+
"build:bundle": "tsdown",
|
|
25
|
+
"build:types": "tsc --noEmit",
|
|
26
|
+
"dev": "bun build:bundle --watch",
|
|
27
|
+
"clean": "rimraf dist .turbo",
|
|
28
|
+
"lint": "bun lint:fix",
|
|
29
|
+
"lint:fix": "eslint src --fix",
|
|
30
|
+
"lint:check": "eslint src"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@contractspec/lib.contracts": "0.0.0-canary-20260113170453",
|
|
34
|
+
"@contractspec/lib.schema": "0.0.0-canary-20260113170453",
|
|
35
|
+
"@contractspec/module.learning-journey": "0.0.0-canary-20260113170453",
|
|
36
|
+
"@contractspec/example.crm-pipeline": "0.0.0-canary-20260113170453"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@contractspec/tool.tsdown": "0.0.0-canary-20260113170453",
|
|
40
|
+
"@contractspec/tool.typescript": "0.0.0-canary-20260113170453",
|
|
41
|
+
"tsdown": "^0.19.0",
|
|
42
|
+
"typescript": "^5.9.3"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"exports": {
|
|
46
|
+
".": "./dist/index.js",
|
|
47
|
+
"./contracts": "./dist/contracts/index.js",
|
|
48
|
+
"./docs": "./dist/docs/index.js",
|
|
49
|
+
"./docs/crm-onboarding.docblock": "./dist/docs/crm-onboarding.docblock.js",
|
|
50
|
+
"./example": "./dist/example.js",
|
|
51
|
+
"./handlers/demo.handlers": "./dist/handlers/demo.handlers.js",
|
|
52
|
+
"./learning-journey-crm-onboarding.feature": "./dist/learning-journey-crm-onboarding.feature.js",
|
|
53
|
+
"./presentations": "./dist/presentations/index.js",
|
|
54
|
+
"./track": "./dist/track.js",
|
|
55
|
+
"./*": "./*"
|
|
56
|
+
},
|
|
57
|
+
"registry": "https://registry.npmjs.org/",
|
|
58
|
+
"access": "public"
|
|
59
|
+
},
|
|
60
|
+
"license": "MIT",
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "https://github.com/lssm-tech/contractspec.git",
|
|
64
|
+
"directory": "packages/examples/learning-journey-crm-onboarding"
|
|
65
|
+
},
|
|
66
|
+
"homepage": "https://contractspec.io"
|
|
67
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { DocBlock } from '@contractspec/lib.contracts/docs';
|
|
2
|
+
import { registerDocBlocks } from '@contractspec/lib.contracts/docs';
|
|
3
|
+
|
|
4
|
+
const crmOnboardingDocBlocks: DocBlock[] = [
|
|
5
|
+
{
|
|
6
|
+
id: 'docs.learning-journey.crm-onboarding',
|
|
7
|
+
title: 'Learning Journey — CRM First Win',
|
|
8
|
+
summary:
|
|
9
|
+
'Onboarding track for the CRM Pipeline example that drives users to first closed-won deal.',
|
|
10
|
+
kind: 'reference',
|
|
11
|
+
visibility: 'public',
|
|
12
|
+
route: '/docs/learning-journey/crm-onboarding',
|
|
13
|
+
tags: ['learning', 'crm', 'onboarding'],
|
|
14
|
+
body: `## Track
|
|
15
|
+
- **Key**: \`crm_first_win\`
|
|
16
|
+
- **Persona**: CRM adopter
|
|
17
|
+
- **Goal**: From empty CRM to first closed-won deal with follow-up
|
|
18
|
+
|
|
19
|
+
## Steps & Events
|
|
20
|
+
1) \`create_pipeline\` → \`pipeline.created\`
|
|
21
|
+
2) \`create_contact_and_company\` → \`contact.created\`
|
|
22
|
+
3) \`create_first_deal\` → \`deal.created\`
|
|
23
|
+
4) \`move_deal_in_pipeline\` → \`deal.moved\`
|
|
24
|
+
5) \`close_deal_won\` → \`deal.won\`
|
|
25
|
+
6) \`setup_follow_up\` → \`task.completed\` (type: follow_up)
|
|
26
|
+
|
|
27
|
+
XP: 15/20/20/20/30/30 with 25 bonus within 72h. Badge: \`crm_first_win\`.
|
|
28
|
+
|
|
29
|
+
## Wiring
|
|
30
|
+
- Depends on \`@contractspec/example.crm-pipeline\` events.
|
|
31
|
+
- Tracks export from \`@contractspec/example.learning-journey-crm-onboarding/track\`.
|
|
32
|
+
- Use onboarding API:
|
|
33
|
+
- \`learning.onboarding.listTracks\`
|
|
34
|
+
- \`learning.onboarding.getProgress\`
|
|
35
|
+
- \`learning.onboarding.recordEvent\` wired from CRM event bus handlers.
|
|
36
|
+
- Surface in CRM dashboard/pipeline UI to guide new users.`,
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
registerDocBlocks(crmOnboardingDocBlocks);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './crm-onboarding.docblock';
|
package/src/example.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineExample } from '@contractspec/lib.contracts';
|
|
2
|
+
|
|
3
|
+
const example = defineExample({
|
|
4
|
+
meta: {
|
|
5
|
+
key: 'learning-journey-crm-onboarding',
|
|
6
|
+
version: '1.0.0',
|
|
7
|
+
title: 'Learning Journey — CRM First Win',
|
|
8
|
+
description:
|
|
9
|
+
'Onboarding track for CRM Pipeline driving users from empty CRM to first closed-won deal.',
|
|
10
|
+
kind: 'template',
|
|
11
|
+
visibility: 'public',
|
|
12
|
+
stability: 'experimental',
|
|
13
|
+
owners: ['@platform.core'],
|
|
14
|
+
tags: ['learning', 'crm', 'onboarding'],
|
|
15
|
+
},
|
|
16
|
+
docs: {
|
|
17
|
+
rootDocId: 'docs.learning-journey.crm-onboarding',
|
|
18
|
+
},
|
|
19
|
+
entrypoints: {
|
|
20
|
+
packageName: '@contractspec/example.learning-journey-crm-onboarding',
|
|
21
|
+
docs: './docs',
|
|
22
|
+
},
|
|
23
|
+
surfaces: {
|
|
24
|
+
templates: true,
|
|
25
|
+
sandbox: { enabled: true, modes: ['playground', 'markdown'] },
|
|
26
|
+
studio: { enabled: true, installable: true },
|
|
27
|
+
mcp: { enabled: true },
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export default example;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { crmFirstWinTrack } from '../track';
|
|
2
|
+
|
|
3
|
+
interface EmitParams {
|
|
4
|
+
learnerId: string;
|
|
5
|
+
occurredAt?: Date;
|
|
6
|
+
payload?: Record<string, unknown>;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface LearningJourneyEvent {
|
|
10
|
+
learnerId: string;
|
|
11
|
+
name: string;
|
|
12
|
+
occurredAt: Date;
|
|
13
|
+
trackId: string;
|
|
14
|
+
payload?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type RecordEvent = (event: LearningJourneyEvent) => unknown;
|
|
18
|
+
|
|
19
|
+
export const crmOnboardingEvents = [
|
|
20
|
+
'pipeline.created',
|
|
21
|
+
'contact.created',
|
|
22
|
+
'deal.created',
|
|
23
|
+
'deal.moved',
|
|
24
|
+
'deal.won',
|
|
25
|
+
'task.completed',
|
|
26
|
+
] as const;
|
|
27
|
+
|
|
28
|
+
export type CrmEvent = (typeof crmOnboardingEvents)[number];
|
|
29
|
+
|
|
30
|
+
export const emitCrmOnboardingEvent = (
|
|
31
|
+
eventName: CrmEvent,
|
|
32
|
+
{ learnerId, occurredAt = new Date(), payload }: EmitParams,
|
|
33
|
+
record?: RecordEvent
|
|
34
|
+
) => {
|
|
35
|
+
const event: LearningJourneyEvent = {
|
|
36
|
+
learnerId,
|
|
37
|
+
name: eventName,
|
|
38
|
+
occurredAt,
|
|
39
|
+
payload,
|
|
40
|
+
trackId: crmFirstWinTrack.id,
|
|
41
|
+
};
|
|
42
|
+
return record ? record(event) : event;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const emitAllCrmOnboardingEvents = (
|
|
46
|
+
params: EmitParams,
|
|
47
|
+
record?: RecordEvent
|
|
48
|
+
) =>
|
|
49
|
+
crmOnboardingEvents.map((name) =>
|
|
50
|
+
emitCrmOnboardingEvent(name, params, record)
|
|
51
|
+
);
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './track';
|
|
2
|
+
export * from './docs';
|
|
3
|
+
export * from './operations';
|
|
4
|
+
export * from './handlers/demo.handlers';
|
|
5
|
+
export * from './presentations';
|
|
6
|
+
export * from './learning-journey-crm-onboarding.feature';
|
|
7
|
+
export { default as example } from './example';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Learning Journey CRM Onboarding Feature Module Specification
|
|
3
|
+
*
|
|
4
|
+
* Defines the feature module for CRM first-win onboarding journey.
|
|
5
|
+
*/
|
|
6
|
+
import { defineFeature } from '@contractspec/lib.contracts';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Learning Journey CRM Onboarding feature module that bundles
|
|
10
|
+
* CRM-specific onboarding track operations and presentations.
|
|
11
|
+
*/
|
|
12
|
+
export const LearningJourneyCrmOnboardingFeature = defineFeature({
|
|
13
|
+
meta: {
|
|
14
|
+
key: 'learning-journey-crm-onboarding',
|
|
15
|
+
title: 'Learning Journey: CRM Onboarding',
|
|
16
|
+
description:
|
|
17
|
+
'CRM first-win onboarding journey with step-by-step guidance for new CRM users',
|
|
18
|
+
domain: 'learning-journey',
|
|
19
|
+
owners: ['@examples.learning-journey.crm-onboarding'],
|
|
20
|
+
tags: ['learning', 'crm', 'onboarding', 'journey'],
|
|
21
|
+
stability: 'experimental',
|
|
22
|
+
version: '1.0.0',
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
// All contract operations included in this feature
|
|
26
|
+
operations: [
|
|
27
|
+
{ key: 'learningJourney.crmOnboarding.recordEvent', version: '1.0.0' },
|
|
28
|
+
{ key: 'learningJourney.crmOnboarding.getTrack', version: '1.0.0' },
|
|
29
|
+
],
|
|
30
|
+
|
|
31
|
+
// Events emitted by this feature
|
|
32
|
+
events: [],
|
|
33
|
+
|
|
34
|
+
// Presentations associated with this feature
|
|
35
|
+
presentations: [
|
|
36
|
+
{ key: 'learning.journey.crm.track', version: '1.0.0' },
|
|
37
|
+
{ key: 'learning.journey.crm.widget', version: '1.0.0' },
|
|
38
|
+
],
|
|
39
|
+
|
|
40
|
+
// Link operations to their primary presentations
|
|
41
|
+
opToPresentation: [
|
|
42
|
+
{
|
|
43
|
+
op: { key: 'learningJourney.crmOnboarding.getTrack', version: '1.0.0' },
|
|
44
|
+
pres: { key: 'learning.journey.crm.track', version: '1.0.0' },
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
|
|
48
|
+
// Target requirements for multi-surface rendering
|
|
49
|
+
presentationsTargets: [
|
|
50
|
+
{
|
|
51
|
+
key: 'learning.journey.crm.track',
|
|
52
|
+
version: '1.0.0',
|
|
53
|
+
targets: ['react', 'markdown', 'application/json'],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: 'learning.journey.crm.widget',
|
|
57
|
+
version: '1.0.0',
|
|
58
|
+
targets: ['react'],
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
|
|
62
|
+
// Capability requirements
|
|
63
|
+
capabilities: {
|
|
64
|
+
requires: [{ key: 'identity', version: '1.0.0' }],
|
|
65
|
+
},
|
|
66
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
GetCrmOnboardingTrack,
|
|
5
|
+
RecordCrmOnboardingEvent,
|
|
6
|
+
crmOnboardingContracts,
|
|
7
|
+
} from './index';
|
|
8
|
+
import { crmFirstWinTrack } from '../track';
|
|
9
|
+
import {
|
|
10
|
+
crmOnboardingEvents,
|
|
11
|
+
emitCrmOnboardingEvent,
|
|
12
|
+
} from '../handlers/demo.handlers';
|
|
13
|
+
import type { CrmEvent } from '../handlers/demo.handlers';
|
|
14
|
+
|
|
15
|
+
describe('crm onboarding contracts', () => {
|
|
16
|
+
it('exposes track metadata', () => {
|
|
17
|
+
expect(crmOnboardingContracts.track.id).toBe('crm_first_win');
|
|
18
|
+
expect(crmOnboardingContracts.track.steps.length).toBeGreaterThan(0);
|
|
19
|
+
expect(GetCrmOnboardingTrack.meta.key).toBe(
|
|
20
|
+
'learningJourney.crmOnboarding.getTrack'
|
|
21
|
+
);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('allows recording events via demo handler', async () => {
|
|
25
|
+
const [step] = crmFirstWinTrack.steps;
|
|
26
|
+
expect(step).toBeDefined();
|
|
27
|
+
if (!step) throw new Error('Expected at least one CRM onboarding step');
|
|
28
|
+
|
|
29
|
+
const eventName = step.completion.eventName;
|
|
30
|
+
const isCrmEvent = (value: string): value is CrmEvent =>
|
|
31
|
+
crmOnboardingEvents.includes(value as CrmEvent);
|
|
32
|
+
|
|
33
|
+
expect(isCrmEvent(eventName)).toBe(true);
|
|
34
|
+
if (!isCrmEvent(eventName)) {
|
|
35
|
+
throw new Error(`Unexpected event name: ${eventName}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const result = await emitCrmOnboardingEvent(eventName, {
|
|
39
|
+
learnerId: 'demo-learner',
|
|
40
|
+
});
|
|
41
|
+
expect(result).toBeDefined();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('exposes record event contract', () => {
|
|
45
|
+
expect(RecordCrmOnboardingEvent.meta.key).toBe(
|
|
46
|
+
'learningJourney.crmOnboarding.recordEvent'
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
});
|