@pega/sdk 0.0.12 → 0.0.14

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 (62) hide show
  1. package/README.md +32 -11
  2. package/package.json +1 -1
  3. package/templates/angular-sdk-reference/angular.json +2 -1
  4. package/templates/angular-sdk-reference/package.json +1 -0
  5. package/templates/angular-sdk-reference/pega-constellationjs-0.26.3-local.tgz +0 -0
  6. package/templates/angular-sdk-reference/src/app/app.component.ts +232 -15
  7. package/templates/angular-sdk-reference/src/components/component-map.ts +90 -0
  8. package/templates/angular-sdk-reference/src/components/fields/auto-complete/auto-complete.component.ts +267 -0
  9. package/templates/angular-sdk-reference/src/components/fields/checkbox/checkbox.component.ts +84 -0
  10. package/templates/angular-sdk-reference/src/components/fields/currency/currency.component.ts +97 -0
  11. package/templates/angular-sdk-reference/src/components/fields/date-input/date-input.component.ts +88 -0
  12. package/templates/angular-sdk-reference/src/components/fields/dropdown/dropdown.component.ts +101 -0
  13. package/templates/angular-sdk-reference/src/components/fields/email/email.component.ts +91 -0
  14. package/templates/angular-sdk-reference/src/components/fields/integer/integer.component.ts +93 -0
  15. package/templates/angular-sdk-reference/src/components/fields/phone/phone.component.ts +91 -0
  16. package/templates/angular-sdk-reference/src/components/fields/radio-buttons/radio-buttons.component.ts +102 -0
  17. package/templates/angular-sdk-reference/src/components/fields/text-area/text-area.component.ts +98 -0
  18. package/templates/angular-sdk-reference/src/components/fields/text-input/text-input.component.ts +97 -0
  19. package/templates/angular-sdk-reference/src/components/fields/url-input/url-input.component.ts +94 -0
  20. package/templates/angular-sdk-reference/src/components/infra/assignment/assignment.component.ts +206 -0
  21. package/templates/angular-sdk-reference/src/components/infra/case-summary/case-summary.component.ts +76 -0
  22. package/templates/angular-sdk-reference/src/components/infra/case-view/case-view.component.ts +114 -0
  23. package/templates/angular-sdk-reference/src/components/infra/flow-container/flow-container.component.ts +411 -0
  24. package/templates/angular-sdk-reference/src/components/infra/reference/reference.component.ts +158 -0
  25. package/templates/angular-sdk-reference/src/components/infra/region/region.component.ts +39 -0
  26. package/templates/angular-sdk-reference/src/components/infra/root-container/root-container.component.ts +193 -0
  27. package/templates/angular-sdk-reference/src/components/infra/stages/stages.component.ts +78 -0
  28. package/templates/angular-sdk-reference/src/components/infra/view/view.component.ts +139 -0
  29. package/templates/angular-sdk-reference/src/components/infra/view-container/view-container.component.ts +191 -0
  30. package/templates/angular-sdk-reference/src/components/templates/default-form/default-form.component.ts +101 -0
  31. package/templates/angular-sdk-reference/src/components/templates/narrow-wide/narrow-wide.component.ts +37 -0
  32. package/templates/angular-sdk-reference/src/components/templates/one-column/one-column.component.ts +37 -0
  33. package/templates/angular-sdk-reference/src/components/templates/two-column/two-column.component.ts +37 -0
  34. package/templates/angular-sdk-reference/src/components/templates/wide-narrow/wide-narrow.component.ts +37 -0
  35. package/templates/angular-sdk-reference/src/helpers/event-utils.ts +18 -0
  36. package/templates/angular-sdk-reference/src/helpers/utils.ts +38 -0
  37. package/templates/angular-sdk-reference/src/helpers/versionHelpers.ts +14 -0
  38. package/templates/angular-sdk-reference/tsconfig.json +5 -2
  39. package/templates/react-sdk-reference/.ai-common/agents/embedded-flow-expert.md +20 -13
  40. package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions-embedded.md +2 -2
  41. package/templates/react-sdk-reference/.ai-common/global/ai-agent-instructions.md +1 -1
  42. package/templates/react-sdk-reference/.ai-common/instructions/dse-component.md +1 -1
  43. package/templates/react-sdk-reference/.ai-common/instructions/embedded-component.md +1 -1
  44. package/templates/react-sdk-reference/.ai-common/instructions/field-component.md +1 -1
  45. package/templates/react-sdk-reference/.ai-common/instructions/infra-component.md +1 -1
  46. package/templates/react-sdk-reference/.ai-common/instructions/template-component.md +1 -1
  47. package/templates/react-sdk-reference/.ai-common/instructions/widget-component.md +1 -1
  48. package/templates/react-sdk-reference/.ai-common/prompts/component-manifest.json +7 -0
  49. package/templates/react-sdk-reference/.ai-common/prompts/embedded-component-manifest.md +2 -2
  50. package/templates/react-sdk-reference/.ai-common/prompts/generate-all-components.md +4 -2
  51. package/templates/react-sdk-reference/.ai-common/prompts/generate-embedded-components.md +10 -11
  52. package/templates/react-sdk-reference/.ai-common/skills/connect-pega-server.md +84 -31
  53. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/analyze-customer-repo.md +11 -2
  54. package/templates/react-sdk-reference/.ai-common/skills/embedded-flow/wire-integration.md +6 -6
  55. package/templates/react-sdk-reference/.ai-common/skills/field-components.md +75 -29
  56. package/templates/react-sdk-reference/.ai-common/skills/field-skills/AutoComplete.md +133 -101
  57. package/templates/react-sdk-reference/.ai-common/skills/field-skills/EmbeddedData.md +385 -0
  58. package/templates/react-sdk-reference/.ai-common/skills/field-skills/EmbeddedDataMulti.md +506 -0
  59. package/templates/react-sdk-reference/.ai-common/skills/field-skills/ObjectReference.md +549 -86
  60. package/templates/react-sdk-reference/.ai-common/skills/field-skills/UserReference.md +181 -83
  61. package/templates/react-sdk-reference/.ai-common/skills/template-skills/ListView.md +125 -153
  62. package/templates/react-sdk-reference/.ai-common/skills/template-skills/SimpleTable.md +90 -81
@@ -0,0 +1,206 @@
1
+ /**
2
+ * Assignment — renders the current assignment step and its action buttons.
3
+ *
4
+ * Receives assignment children (the form to fill) and action buttons from the
5
+ * case's actionButtons metadata. Delegates form rendering to children and
6
+ * handles submit/cancel/save/navigate actions via the actionsAPI.
7
+ *
8
+ * In the component hierarchy, FlowContainer renders Assignment explicitly,
9
+ * passing routed view children and itemKey. Assignment wraps those children
10
+ * with action buttons below — matching the reference angular-sdk pattern.
11
+ *
12
+ * Pattern reference: angular-sdk-components AssignmentComponent + sdk-react Assignment
13
+ */
14
+
15
+ /* eslint-disable @typescript-eslint/no-explicit-any */
16
+ import { Component, Input, ChangeDetectorRef, NgZone } from '@angular/core';
17
+ import type { OnInit, OnDestroy } from '@angular/core';
18
+ import { CommonModule } from '@angular/common';
19
+ import { PConnectBridgeComponent } from '@pega/sdk-angular';
20
+
21
+ @Component({
22
+ selector: 'pega-assignment',
23
+ standalone: true,
24
+ imports: [CommonModule, PConnectBridgeComponent],
25
+ template: `
26
+ <div *ngIf="bReady">
27
+ <!-- Render assignment children (the form) -->
28
+ <div *ngFor="let child of childGetters">
29
+ <pconnect-bridge [getPConnect]="child"></pconnect-bridge>
30
+ </div>
31
+
32
+ <!-- Action buttons -->
33
+ <div
34
+ *ngIf="arMainButtons.length > 0 || arSecondaryButtons.length > 0"
35
+ style="display: flex; gap: 0.5rem; margin-top: 1rem; justify-content: flex-end;"
36
+ >
37
+ <button
38
+ *ngFor="let btn of arSecondaryButtons"
39
+ (click)="buttonPress(btn.jsAction, 'secondary')"
40
+ style="padding: 0.5rem 1rem; border: 1px solid #d1d5db; border-radius: 0.375rem; background: white; cursor: pointer;"
41
+ >
42
+ {{ btn.name }}
43
+ </button>
44
+ <button
45
+ *ngFor="let btn of arMainButtons"
46
+ (click)="buttonPress(btn.jsAction, 'primary')"
47
+ style="padding: 0.5rem 1rem; border: none; border-radius: 0.375rem; background: #2563eb; color: white; cursor: pointer;"
48
+ >
49
+ {{ btn.name }}
50
+ </button>
51
+ </div>
52
+ </div>
53
+ `,
54
+ })
55
+ export class AssignmentComponent implements OnInit, OnDestroy {
56
+ @Input() props: any;
57
+
58
+ bReady = false;
59
+ childGetters: Array<() => typeof PConnect> = [];
60
+ arMainButtons: any[] = [];
61
+ arSecondaryButtons: any[] = [];
62
+
63
+ private pConn: any;
64
+ private actionsAPI: any;
65
+ private itemKey = '';
66
+ private storeUnsub: (() => void) | undefined;
67
+
68
+ constructor(
69
+ private ngZone: NgZone,
70
+ private cdr: ChangeDetectorRef,
71
+ ) {}
72
+
73
+ ngOnInit(): void {
74
+ this.pConn = this.props.getPConnect();
75
+ this.itemKey = this.props.itemKey ?? '';
76
+
77
+ this.initComponent();
78
+
79
+ // Subscribe to store for updates (action buttons may change between steps)
80
+ this.storeUnsub = PCore.getStore().subscribe(() => {
81
+ this.updateSelf();
82
+ });
83
+ }
84
+
85
+ ngOnDestroy(): void {
86
+ this.storeUnsub?.();
87
+ }
88
+
89
+ private initComponent(): void {
90
+ const baseContext = this.pConn.getContextName?.() ?? '';
91
+ const acName = this.pConn.getContainerName?.() ?? '';
92
+ if (!this.itemKey) {
93
+ this.itemKey = `${baseContext}/${acName}`;
94
+ }
95
+
96
+ this.pConn.isBoundToState();
97
+ this.updateSelf();
98
+ }
99
+
100
+ private updateSelf(): void {
101
+ // Children come from FlowContainer's arChildren prop (the routed view PConnect),
102
+ // matching the reference pattern where FlowContainer passes arChildren$ to Assignment.
103
+ const arChildrenFromProps = this.props.arChildren;
104
+ if (arChildrenFromProps && arChildrenFromProps.length > 0) {
105
+ this.childGetters = arChildrenFromProps.map((child: any) => {
106
+ return child.getPConnect ?? (() => child);
107
+ });
108
+ } else {
109
+ // Fallback: get children from pConn
110
+ const children = this.pConn.getChildren?.() ?? [];
111
+ this.childGetters = children.map((child: any) => {
112
+ return child.getPConnect ?? (() => child);
113
+ });
114
+ }
115
+
116
+ // Update itemKey from props if changed
117
+ if (this.props.itemKey) {
118
+ this.itemKey = this.props.itemKey;
119
+ }
120
+
121
+ // Extract action buttons from case data.
122
+ // Reference pattern: Assignment gets caseInfo from its own pConn's data object,
123
+ // and actionsAPI from the first child work item's pConn.
124
+ this.extractActionButtons();
125
+
126
+ this.ngZone.run(() => {
127
+ this.bReady = true;
128
+ this.cdr.detectChanges();
129
+ });
130
+ }
131
+
132
+ private extractActionButtons(): void {
133
+ // Get action buttons from the Assignment's own pConn case data
134
+ const oData = this.pConn.getDataObject?.() ?? {};
135
+ const caseInfo = oData?.caseInfo;
136
+
137
+ if (caseInfo?.actionButtons) {
138
+ this.arMainButtons = caseInfo.actionButtons.main ?? [];
139
+ this.arSecondaryButtons = caseInfo.actionButtons.secondary ?? [];
140
+ }
141
+
142
+ // Get actionsAPI from the Assignment's own pConn (not from child).
143
+ // The Assignment pConn has the correct context for finishAssignment/cancelAssignment.
144
+ try {
145
+ this.actionsAPI = this.pConn.getActionsApi?.() ?? null;
146
+ } catch {
147
+ // actionsApi may not be available
148
+ }
149
+ }
150
+
151
+ buttonPress(sAction: string, sButtonType: string): void {
152
+ if (!this.actionsAPI) return;
153
+
154
+ const finishAssignment = this.actionsAPI.finishAssignment?.bind(
155
+ this.actionsAPI,
156
+ );
157
+ const cancelAssignment = this.actionsAPI.cancelAssignment?.bind(
158
+ this.actionsAPI,
159
+ );
160
+ const navigateToStep = this.actionsAPI.navigateToStep?.bind(
161
+ this.actionsAPI,
162
+ );
163
+ const saveAssignment = this.actionsAPI.saveAssignment?.bind(
164
+ this.actionsAPI,
165
+ );
166
+
167
+ if (sButtonType === 'secondary') {
168
+ switch (sAction) {
169
+ case 'navigateToStep':
170
+ navigateToStep?.('previous', this.itemKey)?.catch(() => {
171
+ console.error('Assignment: Navigation failed');
172
+ });
173
+ break;
174
+ case 'saveAssignment':
175
+ saveAssignment?.(this.itemKey)?.catch(() => {
176
+ console.error('Assignment: Save failed');
177
+ });
178
+ break;
179
+ case 'cancelAssignment': {
180
+ const { PUB_SUB_EVENTS } = PCore.getConstants() as any;
181
+ const { publish } = PCore.getPubSubUtils();
182
+ cancelAssignment?.(this.itemKey, false)
183
+ ?.then((data: any) => {
184
+ publish(PUB_SUB_EVENTS.EVENT_CANCEL, data);
185
+ })
186
+ ?.catch(() => {
187
+ console.error('Assignment: Cancel failed');
188
+ });
189
+ break;
190
+ }
191
+ default:
192
+ break;
193
+ }
194
+ } else if (sButtonType === 'primary') {
195
+ switch (sAction) {
196
+ case 'finishAssignment':
197
+ finishAssignment?.(this.itemKey)?.catch(() => {
198
+ console.error('Assignment: Submit failed');
199
+ });
200
+ break;
201
+ default:
202
+ break;
203
+ }
204
+ }
205
+ }
206
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * CaseSummary — renders case summary header with status badge.
3
+ *
4
+ * Pattern reference: angular-sdk-components CaseSummaryComponent + sdk-react CaseSummary
5
+ */
6
+
7
+ /* eslint-disable @typescript-eslint/no-explicit-any */
8
+ import { Component, Input, ChangeDetectorRef, NgZone } from '@angular/core';
9
+ import type { OnInit, OnDestroy } from '@angular/core';
10
+ import { CommonModule } from '@angular/common';
11
+ import type { Unsubscribe } from '@pega/sdk-angular';
12
+
13
+ @Component({
14
+ selector: 'pega-case-summary',
15
+ standalone: true,
16
+ imports: [CommonModule],
17
+ template: `
18
+ <div
19
+ style="display: flex; justify-content: space-between; align-items: center;
20
+ padding: 0.75rem 1rem; background: #f9fafb; border-radius: 0.375rem; margin-bottom: 1rem;"
21
+ >
22
+ <span style="font-weight: 600; font-size: 0.875rem;">
23
+ {{ header || 'Case' }}
24
+ </span>
25
+ <span
26
+ *ngIf="status"
27
+ style="font-size: 0.75rem; padding: 0.25rem 0.5rem; background: #dbeafe; color: #1d4ed8; border-radius: 1rem;"
28
+ >
29
+ {{ status }}
30
+ </span>
31
+ </div>
32
+ `,
33
+ })
34
+ export class CaseSummaryComponent implements OnInit, OnDestroy {
35
+ @Input() props: any;
36
+
37
+ header = '';
38
+ status = '';
39
+
40
+ private pConn: any;
41
+ private observable: any;
42
+ private storeUnsub: Unsubscribe | undefined;
43
+
44
+ constructor(
45
+ private ngZone: NgZone,
46
+ private cdr: ChangeDetectorRef,
47
+ ) {}
48
+
49
+ ngOnInit(): void {
50
+ // @ts-ignore
51
+ const { PConnectObservable } = PCore.getInitialiser().getSdkCore() as any;
52
+
53
+ this.pConn = this.props.getPConnect();
54
+ this.observable = new PConnectObservable(this.pConn);
55
+ this.updateSelf();
56
+
57
+ this.storeUnsub = this.observable.subscribe(() => {
58
+ this.updateSelf();
59
+ });
60
+ }
61
+
62
+ ngOnDestroy(): void {
63
+ this.storeUnsub?.();
64
+ this.observable?.destroy();
65
+ }
66
+
67
+ private updateSelf(): void {
68
+ const configProps = this.pConn.resolveConfigProps(this.pConn.getConfigProps());
69
+ this.header = configProps.header ?? '';
70
+ this.status = configProps.status ?? '';
71
+
72
+ this.ngZone.run(() => {
73
+ this.cdr.detectChanges();
74
+ });
75
+ }
76
+ }
@@ -0,0 +1,114 @@
1
+ /**
2
+ * CaseView — renders the full case view with header, actions menu, and tabs/content.
3
+ *
4
+ * Simplified version that shows heading, status, and renders children.
5
+ *
6
+ * Pattern reference: angular-sdk-components CaseViewComponent + sdk-react CaseView
7
+ */
8
+
9
+ /* eslint-disable @typescript-eslint/no-explicit-any */
10
+ import { Component, Input, ChangeDetectorRef, NgZone } from '@angular/core';
11
+ import type { OnInit, OnDestroy } from '@angular/core';
12
+ import { CommonModule } from '@angular/common';
13
+ import type { Unsubscribe } from '@pega/sdk-angular';
14
+ import { PConnectBridgeComponent } from '@pega/sdk-angular';
15
+
16
+ @Component({
17
+ selector: 'pega-case-view',
18
+ standalone: true,
19
+ imports: [CommonModule, PConnectBridgeComponent],
20
+ template: `
21
+ <div>
22
+ <div *ngIf="heading" style="font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem;">
23
+ {{ heading }}
24
+ </div>
25
+ <div *ngIf="id" style="font-size: 0.75rem; color: #6b7280; margin-bottom: 1rem;">
26
+ {{ id }}
27
+ </div>
28
+
29
+ <!-- Case summary -->
30
+ <div *ngIf="caseSummaryGetPConnect">
31
+ <pconnect-bridge [getPConnect]="caseSummaryGetPConnect"></pconnect-bridge>
32
+ </div>
33
+
34
+ <!-- Children (tabs, stages, etc.) -->
35
+ <div *ngFor="let getter of childGetters">
36
+ <pconnect-bridge [getPConnect]="getter"></pconnect-bridge>
37
+ </div>
38
+ </div>
39
+ `,
40
+ })
41
+ export class CaseViewComponent implements OnInit, OnDestroy {
42
+ @Input() props: any;
43
+
44
+ heading = '';
45
+ id = '';
46
+ status = '';
47
+ caseSummaryGetPConnect: (() => typeof PConnect) | null = null;
48
+ childGetters: Array<() => typeof PConnect> = [];
49
+
50
+ private pConn: any;
51
+ private observable: any;
52
+ private storeUnsub: Unsubscribe | undefined;
53
+
54
+ constructor(
55
+ private ngZone: NgZone,
56
+ private cdr: ChangeDetectorRef,
57
+ ) {}
58
+
59
+ ngOnInit(): void {
60
+ this.pConn = this.props.getPConnect();
61
+
62
+ // @ts-ignore
63
+ const { PConnectObservable } = PCore.getInitialiser().getSdkCore() as any;
64
+ this.observable = new PConnectObservable(this.pConn);
65
+ this.updateSelf();
66
+
67
+ this.storeUnsub = this.observable.subscribe(() => {
68
+ this.updateSelf();
69
+ });
70
+ }
71
+
72
+ ngOnDestroy(): void {
73
+ this.storeUnsub?.();
74
+ this.observable?.destroy();
75
+ }
76
+
77
+ private updateSelf(): void {
78
+ const configProps = this.pConn.resolveConfigProps(this.pConn.getConfigProps());
79
+
80
+ this.heading = configProps.header ?? '';
81
+ this.id = configProps.subheader ?? '';
82
+
83
+ const children = this.pConn.getChildren?.() ?? [];
84
+
85
+ // First child is typically the case summary (if applicable)
86
+ if (children.length > 0) {
87
+ const firstChild = children[0];
88
+ const firstPConn = firstChild.getPConnect?.() ?? firstChild;
89
+ const firstCompName = firstPConn.getComponentName?.() ?? '';
90
+
91
+ if (firstCompName === 'CaseSummary' || firstCompName === 'CaseSummaryFields') {
92
+ this.caseSummaryGetPConnect = firstChild.getPConnect ?? (() => firstChild);
93
+ this.childGetters = children.slice(1).map((child: any) => {
94
+ return child.getPConnect ?? (() => child);
95
+ });
96
+ } else {
97
+ this.caseSummaryGetPConnect = null;
98
+ this.childGetters = children.map((child: any) => {
99
+ return child.getPConnect ?? (() => child);
100
+ });
101
+ }
102
+ } else {
103
+ this.childGetters = [];
104
+ this.caseSummaryGetPConnect = null;
105
+ }
106
+
107
+ // Update okToInitFlowContainer
108
+ sessionStorage.setItem('okToInitFlowContainer', 'true');
109
+
110
+ this.ngZone.run(() => {
111
+ this.cdr.detectChanges();
112
+ });
113
+ }
114
+ }