@pega/dx-component-builder-sdk 0.1.6 → 0.1.8

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 (111) hide show
  1. package/package.json +1 -1
  2. package/src/constants.js +8 -4
  3. package/src/tasks/build/helper.js +5 -23
  4. package/src/tasks/build/index.js +54 -7
  5. package/src/tasks/bundle/index.js +2 -2
  6. package/src/tasks/create/index.js +13 -5
  7. package/src/tasks/create/templates/Constellation/Field/Boolean/boolean-format.js.mustache +1 -1
  8. package/src/tasks/create/templates/Constellation/Field/Boolean/demo.stories.jsx.mustache +60 -0
  9. package/src/tasks/create/templates/Constellation/Field/Boolean/index.jsx.mustache +1 -2
  10. package/src/tasks/create/templates/Constellation/Field/Boolean/mock.stories.js.mustache +21 -0
  11. package/src/tasks/create/templates/Constellation/Field/Date/DateFormatter.js.mustache +61 -0
  12. package/src/tasks/create/templates/Constellation/Field/Date/FormattedText.jsx.mustache +41 -0
  13. package/src/tasks/create/templates/Constellation/Field/Date/date.js.mustache +179 -67
  14. package/src/tasks/create/templates/Constellation/Field/Date/demo.stories.jsx.mustache +40 -16
  15. package/src/tasks/create/templates/Constellation/Field/Date/index.jsx.mustache +3 -1
  16. package/src/tasks/create/templates/Constellation/Field/Date/mock.stories.js.mustache +23 -0
  17. package/src/tasks/create/templates/Constellation/Field/DateTime/date-time.js.mustache +0 -1
  18. package/src/tasks/create/templates/Constellation/Field/DateTime/{date-utils.js → date-utils.js.mustache} +1 -0
  19. package/src/tasks/create/templates/Constellation/Field/DateTime/date.js.mustache +1 -0
  20. package/src/tasks/create/templates/Constellation/Field/DateTime/demo.stories.jsx.mustache +40 -15
  21. package/src/tasks/create/templates/Constellation/Field/DateTime/index.jsx.mustache +2 -0
  22. package/src/tasks/create/templates/Constellation/Field/DateTime/mock.stories.js.mustache +23 -0
  23. package/src/tasks/create/templates/Constellation/Field/Decimal/demo.stories.jsx.mustache +22 -17
  24. package/src/tasks/create/templates/Constellation/Field/Decimal/index.jsx.mustache +2 -1
  25. package/src/tasks/create/templates/Constellation/Field/Decimal/mock.stories.js.mustache +21 -0
  26. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/demo.stories.jsx.mustache +25 -17
  27. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/index.jsx.mustache +3 -4
  28. package/src/tasks/create/templates/Constellation/Field/Decimal-Currency/mock.stories.js.mustache +23 -0
  29. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/demo.stories.jsx.mustache +22 -17
  30. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/index.jsx.mustache +8 -2
  31. package/src/tasks/create/templates/Constellation/Field/Decimal-Percentage/mock.stories.js.mustache +21 -0
  32. package/src/tasks/create/templates/Constellation/Field/Integer/demo.stories.jsx.mustache +22 -17
  33. package/src/tasks/create/templates/Constellation/Field/Integer/index.jsx.mustache +2 -1
  34. package/src/tasks/create/templates/Constellation/Field/Integer/mock.stories.js.mustache +21 -0
  35. package/src/tasks/create/templates/Constellation/Field/Picklist/demo.stories.jsx.mustache +42 -14
  36. package/src/tasks/create/templates/Constellation/Field/Picklist/index.jsx.mustache +44 -1
  37. package/src/tasks/create/templates/Constellation/Field/Picklist/mock.stories.js.mustache +67 -0
  38. package/src/tasks/create/templates/Constellation/Field/Text/demo.stories.jsx.mustache +21 -16
  39. package/src/tasks/create/templates/Constellation/Field/Text/mock.stories.js.mustache +13 -0
  40. package/src/tasks/create/templates/Constellation/Field/Text-Email/demo.stories.jsx.mustache +20 -16
  41. package/src/tasks/create/templates/Constellation/Field/Text-Email/index.jsx.mustache +44 -2
  42. package/src/tasks/create/templates/Constellation/Field/Text-Email/mock.stories.js.mustache +22 -0
  43. package/src/tasks/create/templates/Constellation/Field/Text-Input/{StatusWork.js → StatusWork.jsx} +0 -1
  44. package/src/tasks/create/templates/Constellation/Field/Text-Input/demo.stories.jsx.mustache +21 -17
  45. package/src/tasks/create/templates/Constellation/Field/Text-Input/index.jsx.mustache +46 -3
  46. package/src/tasks/create/templates/Constellation/Field/Text-Input/mock.stories.js.mustache +21 -0
  47. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/demo.stories.jsx.mustache +21 -17
  48. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/index.jsx.mustache +44 -2
  49. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/mock.stories.js.mustache +20 -0
  50. package/src/tasks/create/templates/Constellation/Field/Text-Phone/demo.stories.jsx.mustache +19 -17
  51. package/src/tasks/create/templates/Constellation/Field/Text-Phone/index.jsx.mustache +46 -2
  52. package/src/tasks/create/templates/Constellation/Field/Text-Phone/mock.stories.js.mustache +37 -0
  53. package/src/tasks/create/templates/Constellation/Field/Text-URL/demo.stories.jsx.mustache +19 -17
  54. package/src/tasks/create/templates/Constellation/Field/Text-URL/index.jsx.mustache +174 -3
  55. package/src/tasks/create/templates/Constellation/Field/Text-URL/mock.stories.js.mustache +22 -0
  56. package/src/tasks/create/templates/Constellation/Field/TimeofDay/demo.stories.jsx.mustache +24 -16
  57. package/src/tasks/create/templates/Constellation/Field/TimeofDay/mock.stories.js.mustache +20 -0
  58. package/src/tasks/create/templates/Constellation/Field/TimeofDay/time-of-day.js.mustache +1 -0
  59. package/src/tasks/create/templates/Constellation/Template/DETAILS/StatusWork.jsx.mustache +26 -0
  60. package/src/tasks/create/templates/Constellation/Template/DETAILS/demo.stories.jsx.mustache +110 -0
  61. package/src/tasks/create/templates/Constellation/Template/DETAILS/index.jsx.mustache +3 -5
  62. package/src/tasks/create/templates/Constellation/Template/DETAILS/mock.stories.js.mustache +179 -0
  63. package/src/tasks/create/templates/Constellation/Template/DETAILS/utils.js.mustache +3 -6
  64. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/StatusWork.jsx.mustache +26 -0
  65. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/demo.stories.jsx.mustache +118 -0
  66. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/index.jsx.mustache +3 -5
  67. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/mock.stories.js.mustache +215 -0
  68. package/src/tasks/create/templates/Constellation/Template/DETAILS-region/utils.js.mustache +3 -3
  69. package/src/tasks/create/templates/Constellation/Template/FORM/demo.stories.jsx.mustache +89 -0
  70. package/src/tasks/create/templates/Constellation/Template/FORM/index.jsx.mustache +6 -10
  71. package/src/tasks/create/templates/Constellation/Template/FORM/mock.stories.js.mustache +125 -0
  72. package/src/tasks/create/templates/Constellation/Template/FORM-region/demo.stories.jsx.mustache +100 -0
  73. package/src/tasks/create/templates/Constellation/Template/FORM-region/index.jsx.mustache +5 -11
  74. package/src/tasks/create/templates/Constellation/Template/FORM-region/mock.stories.js.mustache +131 -0
  75. package/src/tasks/create/templates/Constellation/Template/PAGE/{GetNextWork.js.mustache → GetNextWork.jsx.mustache} +6 -0
  76. package/src/tasks/create/templates/Constellation/Template/PAGE/demo.stories.jsx.mustache +102 -0
  77. package/src/tasks/create/templates/Constellation/Template/PAGE/index.jsx.mustache +9 -7
  78. package/src/tasks/create/templates/Constellation/Template/PAGE/mock.stories.js.mustache +94 -0
  79. package/src/tasks/create/templates/Constellation/Template/PAGE/utils.js.mustache +4 -1
  80. package/src/tasks/create/templates/Constellation/Widget/CASE/demo.stories.jsx.mustache +78 -0
  81. package/src/tasks/create/templates/Constellation/Widget/CASE/index.jsx.mustache +1 -0
  82. package/src/tasks/create/templates/Constellation/Widget/CASE/mock.stories.js.mustache +389 -0
  83. package/src/tasks/create/templates/Constellation/Widget/PAGE/demo.stories.jsx.mustache +30 -0
  84. package/src/tasks/create/templates/Constellation/Widget/PAGE/mock.stories.js.mustache +22 -0
  85. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Avatar.js.mustache → Avatar.jsx.mustache} +2 -0
  86. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/{Operator.js.mustache → Operator.jsx.mustache} +2 -1
  87. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/demo.stories.jsx.mustache +68 -0
  88. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/index.jsx.mustache +9 -9
  89. package/src/tasks/create/templates/Constellation/Widget/PAGE-CASE/mock.stories.js.mustache +51 -0
  90. package/src/tasks/create/templates/SDK-React/Template/PAGE/demo.stories.jsx.mustache +79 -0
  91. package/src/tasks/create/templates/SDK-React/Template/PAGE/mock.stories.js.mustache +115 -0
  92. package/src/tasks/delete/helper.js +7 -25
  93. package/src/tasks/delete/index.js +2 -3
  94. package/src/tasks/delete-all/helper.js +7 -24
  95. package/src/tasks/delete-all/index.js +2 -3
  96. package/src/tasks/list/helper.js +3 -21
  97. package/src/tasks/list/index.js +2 -3
  98. package/src/tasks/map/map.js +4 -10
  99. package/src/tasks/override/index.js +50 -21
  100. package/src/tasks/publish/helper.js +77 -15
  101. package/src/tasks/publish/index.js +103 -15
  102. package/src/tasks/publish-all/helper.js +77 -13
  103. package/src/tasks/publish-all/index.js +109 -25
  104. package/src/tasks/validator/index.js +7 -5
  105. package/src/util.js +56 -10
  106. package/src/tasks/create/templates/Constellation/Field/Picklist/picklist.js.mustache +0 -43
  107. package/src/tasks/create/templates/Constellation/Field/Text-Email/text-email.js.mustache +0 -43
  108. package/src/tasks/create/templates/Constellation/Field/Text-Input/text-input.js.mustache +0 -43
  109. package/src/tasks/create/templates/Constellation/Field/Text-Paragraph/text-paragraph.js.mustache +0 -43
  110. package/src/tasks/create/templates/Constellation/Field/Text-Phone/text-phone.js.mustache +0 -43
  111. package/src/tasks/create/templates/Constellation/Field/Text-URL/text-url.js.mustache +0 -172
@@ -0,0 +1,79 @@
1
+ import { withKnobs } from '@storybook/addon-knobs';
2
+
3
+ import AppAnnouncement from '@pega/react-sdk-components/lib/components/widgets/AppAnnouncement';
4
+
5
+ import { pyHome1Resolved, pyHome1Raw } from './mock.stories';
6
+
7
+ import {{COMPONENT_CLASS_NAME}} from './index.tsx';
8
+
9
+ export default {
10
+ title: '{{COMPONENT_CLASS_NAME}}',
11
+ decorators: [withKnobs],
12
+ component: {{COMPONENT_CLASS_NAME}}
13
+ };
14
+
15
+ export const Base{{COMPONENT_CLASS_NAME}} = () => {
16
+
17
+ const configProps = pyHome1Resolved.children[0].children[0].config;
18
+
19
+ const props = {
20
+ getPConnect: () => {
21
+ return {
22
+ getStateProps: () => {
23
+ return {};
24
+ },
25
+ getActionsApi: () => {
26
+ return {
27
+ getNextWork: () => {
28
+ return new Promise(resolve => {
29
+ resolve({});
30
+ });
31
+ },
32
+ updateFieldValue: () => {/* nothing */},
33
+ triggerFieldChange: () => {/* nothing */}
34
+ };
35
+ },
36
+ getChildren: () => {
37
+ return pyHome1Raw.children;
38
+ },
39
+ getComponentName: () => {
40
+ return '';
41
+ },
42
+ getLocalizedValue: value => {
43
+ return value;
44
+ },
45
+ getRawMetadata: () => {
46
+ return pyHome1Raw;
47
+ },
48
+ createComponent: config => {
49
+ if(config.type === 'AppAnnouncement') {
50
+ return (
51
+ <AppAnnouncement
52
+ header='Announcements'
53
+ description={configProps.description}
54
+ image={configProps.image.replace(/ /g, '+')}
55
+ datasource={configProps.datasource}
56
+ label={configProps.label}
57
+ whatsnewlink={configProps.whatsnewlink}
58
+ />
59
+ );
60
+ }
61
+ },
62
+ ignoreSuggestion: () => {/* nothing */},
63
+ acceptSuggestion: () => {/* nothing */},
64
+ setInheritedProps: () => {/* nothing */},
65
+ resolveConfigProps: () => {/* nothing */}
66
+ };
67
+ }
68
+ };
69
+
70
+ const regionAChildren = pyHome1Raw.children[0].children.map(child => {
71
+ return props.getPConnect().createComponent(child);
72
+ });
73
+
74
+ return (
75
+ <>
76
+ <{{COMPONENT_CLASS_NAME}} {...props}>{regionAChildren}</{{COMPONENT_CLASS_NAME}}>
77
+ </>
78
+ );
79
+ };
@@ -0,0 +1,115 @@
1
+ export const pyHome1Raw = {
2
+ name: 'pyHome1',
3
+ type: 'View',
4
+ config: {
5
+ type: 'landingpage',
6
+ template: 'OneColumnPage',
7
+ icon: 'home-solid',
8
+ title: '@ENV APPLICATION_DESC',
9
+ ruleClass: 'DIXL-MediaCo-UIPages',
10
+ localeReference: '@LR DIXL-MEDIACO-UIPAGES!PAGE!PYHOME1',
11
+ enableGetNextWork: true,
12
+ context: 'pyPortal'
13
+ },
14
+ children: [
15
+ {
16
+ name: 'A',
17
+ type: 'Region',
18
+ children: [
19
+ {
20
+ type: 'AppAnnouncement',
21
+ config: {
22
+ label: '@L App announcement',
23
+ description:
24
+ "We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of Cosmos.",
25
+ whatsnewlink: 'https://design.pega.com',
26
+ image:
27
+ 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+',
28
+ datasource: {
29
+ source: [
30
+ {
31
+ "name": "New React based UI rendering"
32
+ },
33
+ {
34
+ "name": "Support for followers and recents"
35
+ },
36
+ {
37
+ "name": "New authoring experience"
38
+ }
39
+ ],
40
+ fields: {
41
+ name: '@P .pyLabel'
42
+ }
43
+ }
44
+ }
45
+ }
46
+ ]
47
+ }
48
+ ],
49
+ classID: 'DIXL-MediaCo-UIPages'
50
+ };
51
+
52
+ export const pyHome1Resolved = {
53
+ name: 'pyHome1',
54
+ type: 'View',
55
+ config: {
56
+ type: 'landingpage',
57
+ template: 'OneColumnPage',
58
+ icon: 'home-solid',
59
+ title: '@ENV APPLICATION_DESC',
60
+ ruleClass: 'DIXL-MediaCo-UIPages',
61
+ localeReference: '@LR DIXL-MEDIACO-UIPAGES!PAGE!PYHOME1',
62
+ enableGetNextWork: true,
63
+ context: 'pyPortal'
64
+ },
65
+ children: [
66
+ {
67
+ name: 'A',
68
+ type: 'Region',
69
+ getPConnect: () => {
70
+ return {
71
+ getComponentName: () => {
72
+ return '';
73
+ },
74
+ getComponent: () => {
75
+ return pyHome1Resolved.children[0];
76
+ },
77
+ getConfigProps: () => {
78
+ return {};
79
+ }
80
+ };
81
+ },
82
+ children: [
83
+ {
84
+ type: 'AppAnnouncement',
85
+ config: {
86
+ label: '@L App announcement',
87
+ description:
88
+ "We've launched a brand new experience to accelerate your workflow. Check out the guides to help you get the most of Cosmos.",
89
+ whatsnewlink: 'https://design.pega.com',
90
+ image:
91
+ 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzOSAxMSI+PHRpdGxlPlBlZ2EgdGV4dC1vbmx5IGxvZ288L3RpdGxlPjxwYXRoIHN0eWxlPSJmaWxsLW9wYWNpdHk6IC4yNTsiIGZpbGw9IiNmZmYiIGQ9Ik03LjcyIDMuODJjMCAyLjI1LTEuNzggMy40MS00IDMuNDFoLTEuNnYzSDBWLjQyaDMuOTRjMi4zNiAwIDMuNzggMS4zOSAzLjc4IDMuNHptLTQtMS40N2gtMS42djNoMS43QTEuNDcgMS40NyAwIDAgMCA1LjUgMy44MmMwLS45MS0uNjUtMS40Ny0xLjc1LTEuNDd6bTcuNjggNS45MWg1LjN2Mkg5LjI5Vi40Mmg3LjM4djEuOTNoLTUuMjR2Mmg0LjI0djEuOWgtNC4yNHpNMjMuMTggMGE1IDUgMCAwIDEgMy41NyAxLjI4TDI1LjYzIDIuOGEzLjc4IDMuNzggMCAwIDAtMS4wNS0uNjNBNC4zMiA0LjMyIDAgMCAwIDIzLjMxIDIgMy4xNyAzLjE3IDAgMCAwIDIwIDUuMjdhMy4xNiAzLjE2IDAgMCAwIDEgMi4zOSAzLjA3IDMuMDcgMCAwIDAgMi4xNy44NCA0LjYgNC42IDAgMCAwIDIuMDktLjVWNi4xOWgtMi4yVjQuMzhoNC4yNXY0LjU2YTUuNDEgNS40MSAwIDAgMS00LjA4IDEuNTdBNS4zNSA1LjM1IDAgMCAxIDE5LjQzIDlhNS4wNSA1LjA1IDAgMCAxLTEuNTYtMy43NCA1LjIxIDUuMjEgMCAwIDEgMS41Ni0zLjc2QTUuMzEgNS4zMSAwIDAgMSAyMy4xOCAwem0xMS4yOS40Mmw0LjEzIDkuNzloLTIuMjVMMzUuNDggOGgtNC4wNmwtLjkgMi4xOGgtMi4yTDMyLjUxLjQyem0uMjUgNS43MkwzMy40NCAzbC0xLjI5IDMuMTR6bTMtNWEuNzEuNzEgMCAwIDEtLjc0Ljc1LjcxLjcxIDAgMCAxLS43My0uNzUuNzMuNzMgMCAwIDEgLjc1LS43Mi43Mi43MiAwIDAgMSAuNzUuNzF6TTM3IC41M2EuNTkuNTkgMCAwIDAtLjYuNi42MS42MSAwIDEgMCAxLjIxIDAgLjYuNiAwIDAgMC0uNjEtLjZ6bS0uMjQgMVYuNzFIMzdjLjEyIDAgLjE4LjA2LjI1LjA2YS4yMS4yMSAwIDAgMSAuMDcuMTguMTkuMTkgMCAwIDEtLjA3LjE4cy0uMDcuMDgtLjEzLjA4bC4yNi4zNmgtLjJMMzcgMS4yOGgtLjF2LjI5em0uMTMtLjQ0aC4yM2EuMjYuMjYgMCAwIDAgLjA3LS4wOWgtLjA2Yy0uMDUtLjE3LS4wNS0uMTctLjEzLS4xN2gtLjF6Ii8+PC9zdmc+',
92
+ datasource: {
93
+ source: [
94
+ {
95
+ "name": "New React based UI rendering"
96
+ },
97
+ {
98
+ "name": "Support for followers and recents"
99
+ },
100
+ {
101
+ "name": "New authoring experience"
102
+ }
103
+ ]
104
+ ,
105
+ fields: {
106
+ name: '@P .pyLabel'
107
+ }
108
+ }
109
+ }
110
+ }
111
+ ]
112
+ }
113
+ ],
114
+ classID: 'DIXL-MediaCo-UIPages'
115
+ };
@@ -3,14 +3,15 @@ import inquirer from 'inquirer';
3
3
  import ora from 'ora';
4
4
  //import { element } from 'prop-types';
5
5
 
6
- import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, COMPONENT_SCHEMA } from '../../constants.js';
6
+ import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, COMPONENT_SCHEMA, CATEGORY_CONSTELLATION, CATEGORY_CUSTOM, CATEGORY_OVERRIDE } from '../../constants.js';
7
7
  import {
8
8
  constructCompleteUrl,
9
9
  deleteLocalComponent,
10
10
  deleteServerComponent,
11
11
  getComponentsObj,
12
12
  getPegaServerConfig,
13
- nodeFetch
13
+ nodeFetch,
14
+ getOptionsCategory
14
15
  } from '../../util.js';
15
16
  import { getComponentsFromServer } from '../list/helper.js';
16
17
 
@@ -22,25 +23,6 @@ export const SOURCE_OF_COMPONENT_TYPES = {
22
23
  };
23
24
 
24
25
 
25
- export const getOptionsCategory = (options) => {
26
- let categoryType = null;
27
- if (options.params[3]) {
28
- let catType = options.params[3];
29
-
30
- switch (catType.toLowerCase()) {
31
- case "override" :
32
- case "o" :
33
- categoryType = "override";
34
- break;
35
- case "custom" :
36
- case "c" :
37
- categoryType = "custom";
38
- break;
39
- }
40
- }
41
- return categoryType;
42
- }
43
-
44
26
  export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
45
27
  const defaultPegaServerConfig = await getPegaServerConfig();
46
28
  const categoryType = getOptionsCategory(options);
@@ -62,13 +44,13 @@ export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOp
62
44
  choices: Object.values(SOURCE_OF_COMPONENT_TYPES),
63
45
  default: defaultPegaServerConfig.sourceOfComponents,
64
46
  when(answers) {
65
- return !options.params[4] && answers.category != 'override' && categoryType != 'override';
47
+ return !options.params[4] && answers.category != CATEGORY_OVERRIDE && categoryType != CATEGORY_OVERRIDE;
66
48
  }
67
49
  }
68
50
  ];
69
51
  };
70
52
 
71
- export const deleteLocalComponents = async (sourceOfComponents, category = "custom") => {
53
+ export const deleteLocalComponents = async (sourceOfComponents, category = CATEGORY_CUSTOM) => {
72
54
  const localComponents = await getComponentsObj(true, category);
73
55
  //const localComponentsAndSub = await getComponentsAndSubDirectory();
74
56
 
@@ -90,10 +72,10 @@ export const deleteLocalComponents = async (sourceOfComponents, category = "cust
90
72
  if (answers.confirmDeletion) {
91
73
  await deleteLocalComponent(answers.componentKey, category);
92
74
  if (category === "custom") {
93
- await deleteLocalComponent(answers.componentKey, "constellation");
75
+ await deleteLocalComponent(answers.componentKey, CATEGORY_CONSTELLATION);
94
76
  }
95
77
 
96
- if (category === "override") {
78
+ if (category === CATEGORY_OVERRIDE) {
97
79
  // need to remove the map as well
98
80
  if (answers.componentKey != undefined) {
99
81
  await deleteFromComponentMap(answers.componentKey, category);
@@ -1,14 +1,13 @@
1
1
  import inquirer from 'inquirer';
2
2
  import ora from 'ora';
3
3
  import chalk from 'chalk';
4
- import { showVersion } from '../../util.js';
4
+ import { showVersion, getOptionsCategory } from '../../util.js';
5
5
 
6
6
  import {
7
7
  deleteLocalComponents,
8
8
  SOURCE_OF_COMPONENT_TYPES,
9
9
  deleteServerComponents,
10
- getDeleteComponentsQuestions,
11
- getOptionsCategory
10
+ getDeleteComponentsQuestions
12
11
  } from './helper.js';
13
12
 
14
13
 
@@ -2,7 +2,7 @@ import chalk from 'chalk';
2
2
  import inquirer from 'inquirer';
3
3
  import ora from 'ora';
4
4
 
5
- import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, COMPONENT_SCHEMA } from '../..//constants.js';
5
+ import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, COMPONENT_SCHEMA, CATEGORY_CONSTELLATION, CATEGORY_CUSTOM, CATEGORY_OVERRIDE } from '../..//constants.js';
6
6
  import {
7
7
  constructCompleteUrl,
8
8
  deleteLocalComponent,
@@ -11,7 +11,8 @@ import {
11
11
  getComponentsObj,
12
12
  getPegaServerConfig,
13
13
  validateRulesetVersion,
14
- nodeFetch
14
+ nodeFetch,
15
+ getOptionsCategory
15
16
  } from '../../util.js';
16
17
  import { getComponentsFromServer } from '../list/helper.js';
17
18
 
@@ -22,24 +23,6 @@ export const SOURCE_OF_COMPONENT_TYPES = {
22
23
  LOCAL: 'Local'
23
24
  };
24
25
 
25
- export const getOptionsCategory = (options) => {
26
- let categoryType = null;
27
- if (options.params[3]) {
28
- let catType = options.params[3];
29
-
30
- switch (catType.toLowerCase()) {
31
- case "override" :
32
- case "o" :
33
- categoryType = "override";
34
- break;
35
- case "custom" :
36
- case "c" :
37
- categoryType = "custom";
38
- break;
39
- }
40
- }
41
- return categoryType;
42
- }
43
26
 
44
27
  export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOption) => {
45
28
  const defaultPegaServerConfig = await getPegaServerConfig();
@@ -62,7 +45,7 @@ export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOp
62
45
  choices: Object.values(SOURCE_OF_COMPONENT_TYPES),
63
46
  default: defaultPegaServerConfig.sourceOfComponents,
64
47
  when(answers) {
65
- return !options.params[4] && answers.category != 'override' && categoryType != 'override';
48
+ return !options.params[4] && answers.category != CATEGORY_OVERRIDE && categoryType != CATEGORY_OVERRIDE;
66
49
 
67
50
  }
68
51
  }
@@ -71,7 +54,7 @@ export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOp
71
54
 
72
55
 
73
56
 
74
- export const deleteLocalComponents = async (sourceOfComponents, category = "custom") => {
57
+ export const deleteLocalComponents = async (sourceOfComponents, category = CATEGORY_CUSTOM) => {
75
58
  const localComponents = await getComponentsObj(true, category);
76
59
 
77
60
  for (var index in localComponents) {
@@ -100,10 +83,10 @@ export const deleteLocalComponents = async (sourceOfComponents, category = "cust
100
83
  var componentToDelete = localComponents[index].value;
101
84
  await deleteLocalComponent(componentToDelete, category);
102
85
  if (category === "custom") {
103
- await deleteLocalComponent(componentToDelete, "constellation");
86
+ await deleteLocalComponent(componentToDelete, CATEGORY_CONSTELLATION);
104
87
  }
105
88
 
106
- if (category === "override") {
89
+ if (category === CATEGORY_OVERRIDE) {
107
90
  // need to remove the map as well
108
91
  if (componentToDelete != undefined) {
109
92
  await deleteFromComponentMap(componentToDelete, category);
@@ -6,11 +6,10 @@ import {
6
6
  deleteLocalComponents,
7
7
  SOURCE_OF_COMPONENT_TYPES,
8
8
  deleteServerComponents,
9
- getDeleteComponentsQuestions,
10
- getOptionsCategory
9
+ getDeleteComponentsQuestions
11
10
  } from './helper.js';
12
11
 
13
- import { showVersion } from '../../util.js';
12
+ import { showVersion, getOptionsCategory } from '../../util.js';
14
13
 
15
14
  const deleteComponentsFn = async (sourceOfComponents, answers) => {
16
15
  switch (sourceOfComponents) {
@@ -4,8 +4,8 @@ import https from 'https';
4
4
  import chalk from 'chalk';
5
5
  import fetch from 'node-fetch';
6
6
 
7
- import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH, COMPONENT_SCHEMA } from '../../constants.js';
8
- import { constructCompleteUrl, getComponents, getPegaServerConfig } from '../../util.js';
7
+ import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, TOKEN_PATH, COMPONENT_SCHEMA, CATEGORY_CUSTOM } from '../../constants.js';
8
+ import { constructCompleteUrl, getComponents, getPegaServerConfig, getOptionsCategory } from '../../util.js';
9
9
 
10
10
 
11
11
  export const SOURCE_OF_COMPONENT_TYPES = {
@@ -13,24 +13,6 @@ export const SOURCE_OF_COMPONENT_TYPES = {
13
13
  LOCAL: 'Local'
14
14
  };
15
15
 
16
- export const getOptionsCategory = (options) => {
17
- let categoryType = null;
18
- if (options.params[3]) {
19
- let catType = options.params[3];
20
-
21
- switch (catType.toLowerCase()) {
22
- case "override" :
23
- case "o" :
24
- categoryType = "override";
25
- break;
26
- case "custom" :
27
- case "c" :
28
- categoryType = "custom";
29
- break;
30
- }
31
- }
32
- return categoryType;
33
- }
34
16
 
35
17
  export const getListComponentsQuestions = async (options, sourceOfComponentsOption) => {
36
18
  const defaultPegaServerConfig = await getPegaServerConfig();
@@ -60,7 +42,7 @@ export const getListComponentsQuestions = async (options, sourceOfComponentsOpti
60
42
  ];
61
43
  };
62
44
 
63
- export const listLocalComponents = async (sourceOfComponents, category = "custom") => {
45
+ export const listLocalComponents = async (sourceOfComponents, category = CATEGORY_CUSTOM) => {
64
46
  let localComponents = await getComponents(false, category);
65
47
  localComponents = localComponents.map(name => ({ 'Rule name': name }));
66
48
  if (localComponents.length > 0) {
@@ -7,11 +7,10 @@ import {
7
7
  SOURCE_OF_COMPONENT_TYPES,
8
8
  getComponentsFromServer,
9
9
  displayServerComponents,
10
- getListComponentsQuestions,
11
- getOptionsCategory
10
+ getListComponentsQuestions
12
11
  } from './helper.js';
13
12
 
14
- import { showVersion } from '../../util.js';
13
+ import { showVersion, getOptionsCategory } from '../../util.js';
15
14
 
16
15
 
17
16
  const getList = async (sourceOfComponents, answers) => {
@@ -10,7 +10,8 @@ import {
10
10
 
11
11
  import {
12
12
  COMPONENTS_DIRECTORY_PATH,
13
- DXCB_CONFIG_JSON_FILENAME
13
+ DXCB_CONFIG_JSON_FILENAME,
14
+ CATEGORY_CUSTOM
14
15
  } from '../../constants.js';
15
16
 
16
17
  export const SDK_LOCAL_COMPONENT_MAP_FILENAME = "sdk-local-component-map.js";
@@ -18,7 +19,7 @@ export const COMPONENT_PATH = "./src/components";
18
19
  export const IMPORT_END_TAG = "/*import end";
19
20
  export const MAP_END_TAG = "/*map end";
20
21
 
21
- export const updateComponentMap = async (componentKey, category = "custom") => {
22
+ export const updateComponentMap = async (componentKey, category = CATEGORY_CUSTOM) => {
22
23
 
23
24
  const pegaConfigJsonPath = path.join(path.resolve(), DXCB_CONFIG_JSON_FILENAME);
24
25
  const pegaLocalComponentMapPath = path.join(path.resolve(), SDK_LOCAL_COMPONENT_MAP_FILENAME);
@@ -55,8 +56,6 @@ export const updateComponentMap = async (componentKey, category = "custom") => {
55
56
 
56
57
  mapData = mapDataStart.concat(importFull).concat("\n").concat(mapDataEnd);
57
58
 
58
-
59
-
60
59
  // add map
61
60
  let endMapIndex = mapData.indexOf(MAP_END_TAG);
62
61
  mapDataStart = mapData.substring(0, endMapIndex);
@@ -64,11 +63,6 @@ export const updateComponentMap = async (componentKey, category = "custom") => {
64
63
 
65
64
  mapData = mapDataStart.concat(" ").concat(mapFull).concat("\n").concat(mapDataEnd);
66
65
 
67
-
68
- //console.log(mapData);
69
-
70
- //console.log("update");
71
-
72
66
  fs.writeFileSync(pegaLocalComponentMapPath, mapData, { encoding: 'utf8' });
73
67
 
74
68
 
@@ -77,7 +71,7 @@ export const updateComponentMap = async (componentKey, category = "custom") => {
77
71
 
78
72
  };
79
73
 
80
- export const deleteFromComponentMap = async (componentKey, category = "custom") => {
74
+ export const deleteFromComponentMap = async (componentKey, category = CATEGORY_CUSTOM) => {
81
75
  const pegaLocalComponentMapPath = path.join(path.resolve(), SDK_LOCAL_COMPONENT_MAP_FILENAME);
82
76
  const categoryDirectory = join("/", category.toLowerCase());
83
77
  const pegaConfigJsonPath = path.join(path.resolve(), DXCB_CONFIG_JSON_FILENAME);
@@ -10,15 +10,7 @@ import ncp from 'ncp';
10
10
  import chalk from 'chalk';
11
11
  import { updateComponentMap } from '../map/map.js';
12
12
 
13
- import { checkPathAccess, getTokenUrl, showVersion } from '../../util.js';
14
-
15
-
16
- export const DXCB_CONFIG_JSON_FILENAME = 'dxcb.config.json';
17
- export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
18
-
19
- const pegaConfigJsonPath = path.join(path.resolve(), DXCB_CONFIG_JSON_FILENAME);
20
- const pegaConfigInternalJsonPath = path.join(path.resolve(), DXCB_CONFIG_INTERNAL_JSON_FILENAME);
21
-
13
+ import { checkPathAccess, getTokenUrl, showVersion, getDirectoryFiles, getPegaConfig } from '../../util.js';
22
14
  import {
23
15
  convertIntoPascalCase,
24
16
  compileMustacheTemplate,
@@ -28,7 +20,15 @@ import {
28
20
  sanitize,
29
21
  validateSemver
30
22
  } from '@pega/dx-component-builder-sdk/src/util.js';
31
- import { COMPONENT_SCHEMA } from '../../constants.js';
23
+ import { COMPONENT_SCHEMA, CATEGORY_OVERRIDE } from '../../constants.js';
24
+
25
+ export const DXCB_CONFIG_JSON_FILENAME = 'dxcb.config.json';
26
+ export const DXCB_CONFIG_INTERNAL_JSON_FILENAME = 'src/dxcb.config.json';
27
+
28
+ const pegaConfigJsonPath = path.join(path.resolve(), DXCB_CONFIG_JSON_FILENAME);
29
+ const pegaConfigInternalJsonPath = path.join(path.resolve(), DXCB_CONFIG_INTERNAL_JSON_FILENAME);
30
+
31
+
32
32
 
33
33
  const copy = promisify(ncp);
34
34
 
@@ -39,9 +39,21 @@ const copyComponentTemplate = async options => {
39
39
  };
40
40
 
41
41
 
42
+ const getListAvailableComponents = async (type) => {
43
+ const components = await getComponents(false, CATEGORY_OVERRIDE);
44
+ const fullList = COMPONENT_SCHEMA.overrideComponent[type];
45
+ let availList = [];
46
+ for (var el in fullList) {
47
+ if (components.includes(fullList[el].value)) {
48
+ availList.push(new inquirer.Separator("** " + fullList[el].name));
49
+ }
50
+ else {
51
+ availList.push(fullList[el]);
52
+ }
53
+ }
42
54
 
43
-
44
-
55
+ return availList;
56
+ }
45
57
 
46
58
 
47
59
  const validateCompile = async (
@@ -52,8 +64,15 @@ const validateCompile = async (
52
64
  options
53
65
  ) => {
54
66
 
67
+ let pegaConfig =
68
+ await getPegaConfig();
69
+ let templateParentDir = "node_modules/@pega/react-sdk-overrides/lib";
70
+ if (pegaConfig['override-templates-path'] && pegaConfig['override-templates-path'] != "") {
71
+ templateParentDir = pegaConfig['override-templates-path'];
72
+ }
73
+
55
74
  // componentName has sub directory if components are in a sub directory of main "type"
56
- const overrideDirectory = `node_modules/@pega/react-sdk-overrides/lib/${type}/${componentName}`;
75
+ const overrideDirectory = `${templateParentDir}/${type}/${componentName}`;
57
76
 
58
77
  await checkPathAccess(overrideDirectory);
59
78
 
@@ -62,9 +81,9 @@ const validateCompile = async (
62
81
  componentKey = componentKey.split("/")[1];
63
82
  }
64
83
  const typeLC = type.toLowerCase();
65
- const targetDirectory = await getComponentDirectoryPath(join(typeLC, "/",componentKey), "override");
84
+ const targetDirectory = await getComponentDirectoryPath(join(typeLC, "/",componentKey), CATEGORY_OVERRIDE);
66
85
 
67
- const components = await getComponents(false, "override");
86
+ const components = await getComponents(false, CATEGORY_OVERRIDE);
68
87
  if (components.includes(componentKey)) {
69
88
  console.log(chalk.red(`${componentKey} component already exists in ${targetDirectory}`));
70
89
  return;
@@ -80,7 +99,7 @@ const validateCompile = async (
80
99
  console.log(chalk.green(`> Created ${componentKey} component in ${targetDirectory}`));
81
100
 
82
101
  const componentKeyWithType = join(type, componentKey);
83
- await updateComponentMap(componentKeyWithType, "override");
102
+ await updateComponentMap(componentKeyWithType, CATEGORY_OVERRIDE);
84
103
 
85
104
  console.log(chalk.green(`> Added ${componentKeyWithType} to map`));
86
105
 
@@ -130,6 +149,11 @@ export default async options => {
130
149
  let componentDefaults = await getComponentDefaults();
131
150
  componentDefaults.library = library;
132
151
 
152
+ const formsList = await getListAvailableComponents("forms");
153
+ const desList = await getListAvailableComponents("designSystemExtensions");
154
+ const templateList = await getListAvailableComponents("templates");
155
+ const widgetList = await getListAvailableComponents("widgets");
156
+ const infraList = await getListAvailableComponents("infra");
133
157
 
134
158
  const questions = [
135
159
  {
@@ -145,7 +169,8 @@ export default async options => {
145
169
  name: 'componentName',
146
170
  type: 'rawlist',
147
171
  message: 'Enter component to be overridden',
148
- choices: COMPONENT_SCHEMA.overrideComponent.forms,
172
+ choices: formsList,
173
+ pageSize: 15,
149
174
  when(answers) {
150
175
  return answers.type === 'forms' || promptType === 'forms';
151
176
  }
@@ -154,7 +179,8 @@ export default async options => {
154
179
  name: 'componentName',
155
180
  type: 'rawlist',
156
181
  message: 'Enter component to be overridden',
157
- choices: COMPONENT_SCHEMA.overrideComponent.designSystemExtensions,
182
+ choices: desList,
183
+ pageSize: 15,
158
184
  when(answers) {
159
185
  return answers.type === 'designSystemExtensions' || promptType === 'designSystemExtensions';
160
186
  }
@@ -163,7 +189,8 @@ export default async options => {
163
189
  name: 'componentName',
164
190
  type: 'rawlist',
165
191
  message: 'Enter component to be overridden',
166
- choices: COMPONENT_SCHEMA.overrideComponent.infra,
192
+ choices: infraList,
193
+ pageSize: 15,
167
194
  when(answers) {
168
195
  return answers.type === 'infra' || promptType === 'infra';
169
196
  }
@@ -172,7 +199,8 @@ export default async options => {
172
199
  name: 'componentName',
173
200
  type: 'rawlist',
174
201
  message: 'Enter component to be overridden',
175
- choices: COMPONENT_SCHEMA.overrideComponent.templates,
202
+ choices: templateList,
203
+ pageSize: 15,
176
204
  when(answers) {
177
205
  return answers.type === 'templates' || promptType === 'templates';
178
206
  }
@@ -181,7 +209,8 @@ export default async options => {
181
209
  name: 'componentName',
182
210
  type: 'rawlist',
183
211
  message: 'Enter component to be overridden',
184
- choices: COMPONENT_SCHEMA.overrideComponent.widgets,
212
+ choices: widgetList,
213
+ pageSize: 15,
185
214
  when(answers) {
186
215
  return answers.type === 'widgets' || promptType === 'widgets';
187
216
  }