@contractspec/example.learning-journey-crm-onboarding 1.44.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 (51) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +41 -0
  2. package/.turbo/turbo-build.log +42 -0
  3. package/CHANGELOG.md +195 -0
  4. package/LICENSE +21 -0
  5. package/README.md +42 -0
  6. package/dist/docs/crm-onboarding.docblock.d.ts +1 -0
  7. package/dist/docs/crm-onboarding.docblock.js +42 -0
  8. package/dist/docs/crm-onboarding.docblock.js.map +1 -0
  9. package/dist/docs/index.d.ts +1 -0
  10. package/dist/docs/index.js +1 -0
  11. package/dist/example.d.ts +33 -0
  12. package/dist/example.d.ts.map +1 -0
  13. package/dist/example.js +35 -0
  14. package/dist/example.js.map +1 -0
  15. package/dist/handlers/demo.handlers.d.ts +25 -0
  16. package/dist/handlers/demo.handlers.d.ts.map +1 -0
  17. package/dist/handlers/demo.handlers.js +26 -0
  18. package/dist/handlers/demo.handlers.js.map +1 -0
  19. package/dist/index.d.ts +7 -0
  20. package/dist/index.js +9 -0
  21. package/dist/learning-journey-crm-onboarding.feature.d.ts +12 -0
  22. package/dist/learning-journey-crm-onboarding.feature.d.ts.map +1 -0
  23. package/dist/learning-journey-crm-onboarding.feature.js +68 -0
  24. package/dist/learning-journey-crm-onboarding.feature.js.map +1 -0
  25. package/dist/operations/index.d.ts +271 -0
  26. package/dist/operations/index.d.ts.map +1 -0
  27. package/dist/operations/index.js +176 -0
  28. package/dist/operations/index.js.map +1 -0
  29. package/dist/presentations/index.d.ts +9 -0
  30. package/dist/presentations/index.d.ts.map +1 -0
  31. package/dist/presentations/index.js +55 -0
  32. package/dist/presentations/index.js.map +1 -0
  33. package/dist/track.d.ts +8 -0
  34. package/dist/track.d.ts.map +1 -0
  35. package/dist/track.js +99 -0
  36. package/dist/track.js.map +1 -0
  37. package/example.ts +1 -0
  38. package/package.json +68 -0
  39. package/src/docs/crm-onboarding.docblock.ts +40 -0
  40. package/src/docs/index.ts +1 -0
  41. package/src/example.ts +24 -0
  42. package/src/handlers/demo.handlers.ts +51 -0
  43. package/src/index.ts +7 -0
  44. package/src/learning-journey-crm-onboarding.feature.ts +66 -0
  45. package/src/operations/index.test.ts +49 -0
  46. package/src/operations/index.ts +122 -0
  47. package/src/presentations/index.ts +55 -0
  48. package/src/track.ts +95 -0
  49. package/tsconfig.json +9 -0
  50. package/tsconfig.tsbuildinfo +1 -0
  51. package/tsdown.config.js +17 -0
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@contractspec/example.learning-journey-crm-onboarding",
3
+ "version": "1.44.0",
4
+ "description": "Learning journey track that onboards users to the CRM pipeline example.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": "./dist/index.js",
10
+ "./docs": "./dist/docs/index.js",
11
+ "./docs/crm-onboarding.docblock": "./dist/docs/crm-onboarding.docblock.js",
12
+ "./example": "./dist/example.js",
13
+ "./handlers/demo.handlers": "./dist/handlers/demo.handlers.js",
14
+ "./learning-journey-crm-onboarding.feature": "./dist/learning-journey-crm-onboarding.feature.js",
15
+ "./operations": "./dist/operations/index.js",
16
+ "./presentations": "./dist/presentations/index.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": "1.44.0",
34
+ "@contractspec/lib.schema": "1.44.0",
35
+ "@contractspec/module.learning-journey": "1.44.0",
36
+ "@contractspec/example.crm-pipeline": "1.44.0"
37
+ },
38
+ "devDependencies": {
39
+ "@contractspec/tool.tsdown": "1.44.0",
40
+ "@contractspec/tool.typescript": "1.44.0",
41
+ "tsdown": "^0.18.3",
42
+ "typescript": "^5.9.3"
43
+ },
44
+ "module": "./dist/index.js",
45
+ "publishConfig": {
46
+ "exports": {
47
+ ".": "./dist/index.js",
48
+ "./contracts": "./dist/contracts/index.js",
49
+ "./docs": "./dist/docs/index.js",
50
+ "./docs/crm-onboarding.docblock": "./dist/docs/crm-onboarding.docblock.js",
51
+ "./example": "./dist/example.js",
52
+ "./handlers/demo.handlers": "./dist/handlers/demo.handlers.js",
53
+ "./learning-journey-crm-onboarding.feature": "./dist/learning-journey-crm-onboarding.feature.js",
54
+ "./presentations": "./dist/presentations/index.js",
55
+ "./track": "./dist/track.js",
56
+ "./*": "./*"
57
+ },
58
+ "registry": "https://registry.npmjs.org/",
59
+ "access": "public"
60
+ },
61
+ "license": "MIT",
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "https://github.com/lssm-tech/contractspec.git",
65
+ "directory": "packages/examples/learning-journey-crm-onboarding"
66
+ },
67
+ "homepage": "https://contractspec.io"
68
+ }
@@ -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,24 @@
1
+ const example = {
2
+ id: 'learning-journey-crm-onboarding',
3
+ title: 'Learning Journey — CRM First Win',
4
+ summary:
5
+ 'Onboarding track for CRM Pipeline driving users from empty CRM to first closed-won deal.',
6
+ tags: ['learning', 'crm', 'onboarding'],
7
+ kind: 'template',
8
+ visibility: 'public',
9
+ docs: {
10
+ rootDocId: 'docs.learning-journey.crm-onboarding',
11
+ },
12
+ entrypoints: {
13
+ packageName: '@contractspec/example.learning-journey-crm-onboarding',
14
+ docs: './docs',
15
+ },
16
+ surfaces: {
17
+ templates: true,
18
+ sandbox: { enabled: true, modes: ['playground', 'markdown'] },
19
+ studio: { enabled: true, installable: true },
20
+ mcp: { enabled: true },
21
+ },
22
+ } as const;
23
+
24
+ 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 type { FeatureModuleSpec } 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: FeatureModuleSpec = {
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,
23
+ },
24
+
25
+ // All contract operations included in this feature
26
+ operations: [
27
+ { key: 'learningJourney.crmOnboarding.recordEvent', version: 1 },
28
+ { key: 'learningJourney.crmOnboarding.getTrack', version: 1 },
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 },
37
+ { key: 'learning.journey.crm.widget', version: 1 },
38
+ ],
39
+
40
+ // Link operations to their primary presentations
41
+ opToPresentation: [
42
+ {
43
+ op: { key: 'learningJourney.crmOnboarding.getTrack', version: 1 },
44
+ pres: { key: 'learning.journey.crm.track', version: 1 },
45
+ },
46
+ ],
47
+
48
+ // Target requirements for multi-surface rendering
49
+ presentationsTargets: [
50
+ {
51
+ key: 'learning.journey.crm.track',
52
+ version: 1,
53
+ targets: ['react', 'markdown', 'application/json'],
54
+ },
55
+ {
56
+ key: 'learning.journey.crm.widget',
57
+ version: 1,
58
+ targets: ['react'],
59
+ },
60
+ ],
61
+
62
+ // Capability requirements
63
+ capabilities: {
64
+ requires: [{ key: 'identity', version: 1 }],
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
+ });
@@ -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,
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,
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,55 @@
1
+ import type {
2
+ PresentationSpecMeta,
3
+ PresentationSpec,
4
+ } from '@contractspec/lib.contracts';
5
+ import { StabilityEnum } from '@contractspec/lib.contracts';
6
+ import { CrmOnboardingTrackModel } from '../operations';
7
+
8
+ const baseMeta: Pick<
9
+ PresentationSpecMeta,
10
+ 'domain' | 'owners' | 'tags' | 'title' | 'stability' | 'goal' | 'context'
11
+ > = {
12
+ domain: 'learning-journey',
13
+ title: 'CRM Onboarding',
14
+ owners: ['@examples.learning-journey.crm-onboarding'],
15
+ tags: ['learning', 'crm', 'onboarding'],
16
+ stability: StabilityEnum.Experimental,
17
+ goal: 'Guide CRM users through onboarding',
18
+ context: 'CRM onboarding journey',
19
+ };
20
+
21
+ export const CrmOnboardingTrackPresentation: PresentationSpec = {
22
+ meta: {
23
+ key: 'learning.journey.crm.track',
24
+ version: 1,
25
+ description: 'CRM first win track detail',
26
+ ...baseMeta,
27
+ },
28
+ source: {
29
+ type: 'component',
30
+ framework: 'react',
31
+ componentKey: 'LearningTrackDetail',
32
+ props: CrmOnboardingTrackModel,
33
+ },
34
+ targets: ['react', 'markdown', 'application/json'],
35
+ };
36
+
37
+ export const CrmOnboardingWidgetPresentation: PresentationSpec = {
38
+ meta: {
39
+ key: 'learning.journey.crm.widget',
40
+ version: 1,
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
+
52
+ export const crmOnboardingPresentations = [
53
+ CrmOnboardingTrackPresentation,
54
+ CrmOnboardingWidgetPresentation,
55
+ ];
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];
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@contractspec/tool.typescript/react-library.json",
3
+ "include": ["src"],
4
+ "exclude": ["node_modules"],
5
+ "compilerOptions": {
6
+ "rootDir": "src",
7
+ "outDir": "dist"
8
+ }
9
+ }