@contractspec/example.learning-journey-crm-onboarding 3.7.5 → 3.7.7
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 +3 -3
- package/AGENTS.md +48 -26
- package/CHANGELOG.md +11 -0
- package/README.md +62 -32
- package/dist/browser/index.js +47 -47
- package/dist/browser/operations/index.js +1 -1
- package/dist/browser/presentations/index.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +47 -47
- package/dist/node/index.js +47 -47
- package/dist/node/operations/index.js +1 -1
- package/dist/node/presentations/index.js +1 -1
- package/dist/operations/index.js +1 -1
- package/dist/presentations/index.js +1 -1
- package/package.json +9 -9
- package/src/docs/crm-onboarding.docblock.ts +11 -11
- package/src/example.ts +25 -25
- package/src/handlers/demo.handlers.ts +30 -30
- package/src/index.ts +4 -4
- package/src/learning-journey-crm-onboarding.feature.ts +48 -48
- package/src/operations/index.test.ts +36 -37
- package/src/operations/index.ts +93 -93
- package/src/presentations/index.ts +39 -39
- package/src/tests/operations.test-spec.ts +27 -27
- package/src/track.ts +89 -89
- package/tsconfig.json +7 -7
- package/tsdown.config.js +7 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/example.learning-journey-crm-onboarding",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.7",
|
|
4
4
|
"description": "Learning journey track that onboards users to the CRM pipeline example.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -85,21 +85,21 @@
|
|
|
85
85
|
"dev": "contractspec-bun-build dev",
|
|
86
86
|
"clean": "rimraf dist .turbo",
|
|
87
87
|
"lint": "bun lint:fix",
|
|
88
|
-
"lint:fix": "
|
|
89
|
-
"lint:check": "
|
|
88
|
+
"lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
|
|
89
|
+
"lint:check": "biome check .",
|
|
90
90
|
"prebuild": "contractspec-bun-build prebuild",
|
|
91
91
|
"typecheck": "tsc --noEmit"
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
|
-
"@contractspec/lib.contracts-spec": "
|
|
95
|
-
"@contractspec/lib.schema": "3.7.
|
|
96
|
-
"@contractspec/module.learning-journey": "3.7.
|
|
97
|
-
"@contractspec/example.crm-pipeline": "3.7.
|
|
94
|
+
"@contractspec/lib.contracts-spec": "4.0.0",
|
|
95
|
+
"@contractspec/lib.schema": "3.7.6",
|
|
96
|
+
"@contractspec/module.learning-journey": "3.7.7",
|
|
97
|
+
"@contractspec/example.crm-pipeline": "3.7.7"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
|
-
"@contractspec/tool.typescript": "3.7.
|
|
100
|
+
"@contractspec/tool.typescript": "3.7.6",
|
|
101
101
|
"typescript": "^5.9.3",
|
|
102
|
-
"@contractspec/tool.bun": "3.7.
|
|
102
|
+
"@contractspec/tool.bun": "3.7.6"
|
|
103
103
|
},
|
|
104
104
|
"publishConfig": {
|
|
105
105
|
"exports": {
|
|
@@ -2,16 +2,16 @@ import type { DocBlock } from '@contractspec/lib.contracts-spec/docs';
|
|
|
2
2
|
import { registerDocBlocks } from '@contractspec/lib.contracts-spec/docs';
|
|
3
3
|
|
|
4
4
|
const crmOnboardingDocBlocks: DocBlock[] = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
15
|
- **Key**: \`crm_first_win\`
|
|
16
16
|
- **Persona**: CRM adopter
|
|
17
17
|
- **Goal**: From empty CRM to first closed-won deal with follow-up
|
|
@@ -34,7 +34,7 @@ XP: 15/20/20/20/30/30 with 25 bonus within 72h. Badge: \`crm_first_win\`.
|
|
|
34
34
|
- \`learning.onboarding.getProgress\`
|
|
35
35
|
- \`learning.onboarding.recordEvent\` wired from CRM event bus handlers.
|
|
36
36
|
- Surface in CRM dashboard/pipeline UI to guide new users.`,
|
|
37
|
-
|
|
37
|
+
},
|
|
38
38
|
];
|
|
39
39
|
|
|
40
40
|
registerDocBlocks(crmOnboardingDocBlocks);
|
package/src/example.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { defineExample } from '@contractspec/lib.contracts-spec';
|
|
2
2
|
|
|
3
3
|
const example = defineExample({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
29
|
});
|
|
30
30
|
|
|
31
31
|
export default example;
|
|
@@ -1,51 +1,51 @@
|
|
|
1
1
|
import { crmFirstWinTrack } from '../track';
|
|
2
2
|
|
|
3
3
|
interface EmitParams {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
learnerId: string;
|
|
5
|
+
occurredAt?: Date;
|
|
6
|
+
payload?: Record<string, unknown>;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
interface LearningJourneyEvent {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
learnerId: string;
|
|
11
|
+
name: string;
|
|
12
|
+
occurredAt: Date;
|
|
13
|
+
trackId: string;
|
|
14
|
+
payload?: Record<string, unknown>;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
type RecordEvent = (event: LearningJourneyEvent) => unknown;
|
|
18
18
|
|
|
19
19
|
export const crmOnboardingEvents = [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
'pipeline.created',
|
|
21
|
+
'contact.created',
|
|
22
|
+
'deal.created',
|
|
23
|
+
'deal.moved',
|
|
24
|
+
'deal.won',
|
|
25
|
+
'task.completed',
|
|
26
26
|
] as const;
|
|
27
27
|
|
|
28
28
|
export type CrmEvent = (typeof crmOnboardingEvents)[number];
|
|
29
29
|
|
|
30
30
|
export const emitCrmOnboardingEvent = (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
eventName: CrmEvent,
|
|
32
|
+
{ learnerId, occurredAt = new Date(), payload }: EmitParams,
|
|
33
|
+
record?: RecordEvent
|
|
34
34
|
) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
43
|
};
|
|
44
44
|
|
|
45
45
|
export const emitAllCrmOnboardingEvents = (
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
params: EmitParams,
|
|
47
|
+
record?: RecordEvent
|
|
48
48
|
) =>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
crmOnboardingEvents.map((name) =>
|
|
50
|
+
emitCrmOnboardingEvent(name, params, record)
|
|
51
|
+
);
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './track';
|
|
2
1
|
export * from './docs';
|
|
3
|
-
export
|
|
2
|
+
export { default as example } from './example';
|
|
4
3
|
export * from './handlers/demo.handlers';
|
|
5
|
-
export * from './presentations';
|
|
6
4
|
export * from './learning-journey-crm-onboarding.feature';
|
|
7
|
-
export
|
|
5
|
+
export * from './operations';
|
|
6
|
+
export * from './presentations';
|
|
7
|
+
export * from './track';
|
|
@@ -10,59 +10,59 @@ import { defineFeature } from '@contractspec/lib.contracts-spec';
|
|
|
10
10
|
* CRM-specific onboarding track operations and presentations.
|
|
11
11
|
*/
|
|
12
12
|
export const LearningJourneyCrmOnboardingFeature = defineFeature({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
// Events emitted by this feature
|
|
32
|
+
events: [],
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
39
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
// Capability requirements
|
|
63
|
+
capabilities: {
|
|
64
|
+
requires: [{ key: 'identity', version: '1.0.0' }],
|
|
65
|
+
},
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
docs: ['docs.learning-journey.crm-onboarding'],
|
|
68
68
|
});
|
|
@@ -1,49 +1,48 @@
|
|
|
1
1
|
import { describe, expect, it } from 'bun:test';
|
|
2
|
-
|
|
2
|
+
import type { CrmEvent } from '../handlers/demo.handlers';
|
|
3
3
|
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from './index';
|
|
4
|
+
crmOnboardingEvents,
|
|
5
|
+
emitCrmOnboardingEvent,
|
|
6
|
+
} from '../handlers/demo.handlers';
|
|
8
7
|
import { crmFirstWinTrack } from '../track';
|
|
9
8
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
crmOnboardingContracts,
|
|
10
|
+
GetCrmOnboardingTrack,
|
|
11
|
+
RecordCrmOnboardingEvent,
|
|
12
|
+
} from './index';
|
|
14
13
|
|
|
15
14
|
describe('crm onboarding contracts', () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
it('exposes track metadata', () => {
|
|
16
|
+
expect(crmOnboardingContracts.track.id).toBe('crm_first_win');
|
|
17
|
+
expect(crmOnboardingContracts.track.steps.length).toBeGreaterThan(0);
|
|
18
|
+
expect(GetCrmOnboardingTrack.meta.key).toBe(
|
|
19
|
+
'learningJourney.crmOnboarding.getTrack'
|
|
20
|
+
);
|
|
21
|
+
});
|
|
23
22
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
it('allows recording events via demo handler', async () => {
|
|
24
|
+
const [step] = crmFirstWinTrack.steps;
|
|
25
|
+
expect(step).toBeDefined();
|
|
26
|
+
if (!step) throw new Error('Expected at least one CRM onboarding step');
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
const eventName = step.completion.eventName;
|
|
29
|
+
const isCrmEvent = (value: string): value is CrmEvent =>
|
|
30
|
+
crmOnboardingEvents.includes(value as CrmEvent);
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
expect(isCrmEvent(eventName)).toBe(true);
|
|
33
|
+
if (!isCrmEvent(eventName)) {
|
|
34
|
+
throw new Error(`Unexpected event name: ${eventName}`);
|
|
35
|
+
}
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
const result = await emitCrmOnboardingEvent(eventName, {
|
|
38
|
+
learnerId: 'demo-learner',
|
|
39
|
+
});
|
|
40
|
+
expect(result).toBeDefined();
|
|
41
|
+
});
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
it('exposes record event contract', () => {
|
|
44
|
+
expect(RecordCrmOnboardingEvent.meta.key).toBe(
|
|
45
|
+
'learningJourney.crmOnboarding.recordEvent'
|
|
46
|
+
);
|
|
47
|
+
});
|
|
49
48
|
});
|
package/src/operations/index.ts
CHANGED
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
|
|
2
1
|
import { defineCommand, defineQuery } from '@contractspec/lib.contracts-spec';
|
|
2
|
+
import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';
|
|
3
3
|
|
|
4
4
|
import { crmFirstWinTrack } from '../track';
|
|
5
5
|
|
|
6
6
|
const OWNERS = ['examples.learning-journey.crm-onboarding'] as const;
|
|
7
7
|
|
|
8
8
|
const StepModel = defineSchemaModel({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
23
|
});
|
|
24
24
|
|
|
25
25
|
export const CrmOnboardingTrackModel = defineSchemaModel({
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
48
|
});
|
|
49
49
|
|
|
50
50
|
const TrackResponseModel = defineSchemaModel({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
name: 'CrmOnboardingTrackResponse',
|
|
52
|
+
description: 'Response wrapper for CRM onboarding track',
|
|
53
|
+
fields: {
|
|
54
|
+
track: { type: CrmOnboardingTrackModel, isOptional: false },
|
|
55
|
+
},
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
const RecordDemoEventInput = defineSchemaModel({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
67
|
});
|
|
68
68
|
|
|
69
69
|
const SuccessModel = defineSchemaModel({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
name: 'CrmOnboardingSuccess',
|
|
71
|
+
description: 'Generic success response',
|
|
72
|
+
fields: {
|
|
73
|
+
success: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
74
|
+
},
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
export const GetCrmOnboardingTrack = defineQuery({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
97
|
});
|
|
98
98
|
|
|
99
99
|
export const RecordCrmOnboardingEvent = defineCommand({
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
116
|
});
|
|
117
117
|
|
|
118
118
|
export const crmOnboardingContracts = {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
GetCrmOnboardingTrack,
|
|
120
|
+
RecordCrmOnboardingEvent,
|
|
121
|
+
track: crmFirstWinTrack,
|
|
122
122
|
};
|