@pega/dx-component-builder-sdk 0.1.46 → 0.1.48

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 (263) hide show
  1. package/package.json +3 -2
  2. package/src/auth.js +3 -3
  3. package/src/cli.js +1 -1
  4. package/src/constants.js +728 -2
  5. package/src/tasks/authenticate/index.js +1 -1
  6. package/src/tasks/build/helper.js +10 -6
  7. package/src/tasks/build/index.js +76 -22
  8. package/src/tasks/build-all/helper.js +16 -11
  9. package/src/tasks/build-all/index.js +108 -44
  10. package/src/tasks/bundle/{builder → builderAngular}/paths.js +2 -2
  11. package/src/tasks/bundle/builderAngular/webpack.config.js +342 -0
  12. package/src/tasks/bundle/builderReact/index.js +218 -0
  13. package/src/tasks/bundle/builderReact/modules.js +139 -0
  14. package/src/tasks/bundle/builderReact/paths.js +50 -0
  15. package/src/tasks/bundle/{builder → builderReact}/webpack.config.js +5 -4
  16. package/src/tasks/bundle/index.js +64 -5
  17. package/src/tasks/create/index.js +54 -12
  18. package/src/tasks/create/templates/Constellation/field/Boolean/styles.js.mustache +13 -6
  19. package/src/tasks/create/templates/Constellation/field/Date/DateFormatter.js.mustache +7 -7
  20. package/src/tasks/create/templates/Constellation/field/Date/date.js.mustache +8 -8
  21. package/src/tasks/create/templates/Constellation/field/Date/styles.js.mustache +13 -6
  22. package/src/tasks/create/templates/Constellation/field/DateTime/date-time.js.mustache +10 -10
  23. package/src/tasks/create/templates/Constellation/field/DateTime/date-utils.js.mustache +6 -5
  24. package/src/tasks/create/templates/Constellation/field/DateTime/date.js.mustache +6 -3
  25. package/src/tasks/create/templates/Constellation/field/DateTime/styles.js.mustache +13 -6
  26. package/src/tasks/create/templates/Constellation/field/Decimal/index.jsx.mustache +2 -2
  27. package/src/tasks/create/templates/Constellation/field/Decimal/styles.js.mustache +13 -6
  28. package/src/tasks/create/templates/Constellation/field/Decimal-Currency/index.jsx.mustache +2 -2
  29. package/src/tasks/create/templates/Constellation/field/Decimal-Currency/styles.js.mustache +13 -6
  30. package/src/tasks/create/templates/Constellation/field/Decimal-Percentage/index.jsx.mustache +4 -4
  31. package/src/tasks/create/templates/Constellation/field/Decimal-Percentage/styles.js.mustache +13 -6
  32. package/src/tasks/create/templates/Constellation/field/Integer/index.jsx.mustache +2 -2
  33. package/src/tasks/create/templates/Constellation/field/Integer/styles.js.mustache +13 -6
  34. package/src/tasks/create/templates/Constellation/field/Picklist/styles.js.mustache +13 -6
  35. package/src/tasks/create/templates/Constellation/field/Text/styles.js.mustache +13 -6
  36. package/src/tasks/create/templates/Constellation/field/Text-Email/styles.js.mustache +13 -6
  37. package/src/tasks/create/templates/Constellation/field/Text-Input/styles.js.mustache +13 -6
  38. package/src/tasks/create/templates/Constellation/field/Text-Paragraph/styles.js.mustache +13 -6
  39. package/src/tasks/create/templates/Constellation/field/Text-Phone/index.jsx.mustache +0 -1
  40. package/src/tasks/create/templates/Constellation/field/Text-Phone/styles.js.mustache +13 -6
  41. package/src/tasks/create/templates/Constellation/field/Text-URL/styles.js.mustache +13 -6
  42. package/src/tasks/create/templates/Constellation/field/TimeOfDay/styles.js.mustache +14 -0
  43. package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/time-of-day.js.mustache +6 -5
  44. package/src/tasks/create/templates/Constellation/template/DETAILS/demo.stories.jsx.mustache +20 -6
  45. package/src/tasks/create/templates/Constellation/template/DETAILS/index.jsx.mustache +2 -2
  46. package/src/tasks/create/templates/Constellation/template/DETAILS/mock.stories.js.mustache +20 -10
  47. package/src/tasks/create/templates/Constellation/template/DETAILS/styles.js.mustache +13 -6
  48. package/src/tasks/create/templates/Constellation/template/DETAILS-region/demo.stories.jsx.mustache +20 -7
  49. package/src/tasks/create/templates/Constellation/template/DETAILS-region/index.jsx.mustache +2 -2
  50. package/src/tasks/create/templates/Constellation/template/DETAILS-region/mock.stories.js.mustache +28 -13
  51. package/src/tasks/create/templates/Constellation/template/DETAILS-region/styles.js.mustache +13 -6
  52. package/src/tasks/create/templates/Constellation/template/FORM/demo.stories.jsx.mustache +92 -16
  53. package/src/tasks/create/templates/Constellation/template/FORM/index.jsx.mustache +2 -2
  54. package/src/tasks/create/templates/Constellation/template/FORM/mock.stories.js.mustache +24 -12
  55. package/src/tasks/create/templates/Constellation/template/FORM/styles.js.mustache +13 -6
  56. package/src/tasks/create/templates/Constellation/template/FORM-region/demo.stories.jsx.mustache +91 -13
  57. package/src/tasks/create/templates/Constellation/template/FORM-region/index.jsx.mustache +2 -2
  58. package/src/tasks/create/templates/Constellation/template/FORM-region/mock.stories.js.mustache +24 -12
  59. package/src/tasks/create/templates/Constellation/template/FORM-region/styles.js.mustache +13 -6
  60. package/src/tasks/create/templates/Constellation/template/PAGE/demo.stories.jsx.mustache +1 -0
  61. package/src/tasks/create/templates/Constellation/template/PAGE/styles.js.mustache +13 -6
  62. package/src/tasks/create/templates/Constellation/widget/CASE/index.jsx.mustache +2 -2
  63. package/src/tasks/create/templates/Constellation/widget/CASE/styles.js.mustache +13 -6
  64. package/src/tasks/create/templates/Constellation/widget/PAGE/styles.js.mustache +13 -6
  65. package/src/tasks/create/templates/Constellation/widget/PAGE-CASE/Operator.jsx.mustache +2 -2
  66. package/src/tasks/create/templates/Constellation/widget/PAGE-CASE/index.jsx.mustache +2 -2
  67. package/src/tasks/create/templates/Constellation/widget/PAGE-CASE/styles.js.mustache +13 -6
  68. package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.html.mustache +42 -0
  69. package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.scss.mustache +24 -0
  70. package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.spec.ts.mustache +25 -0
  71. package/src/tasks/create/templates/SDK-Angular/field/Boolean/boolean.component.ts.mustache +165 -0
  72. package/src/tasks/create/templates/SDK-Angular/field/Boolean/config.json.mustache +87 -0
  73. package/src/tasks/create/templates/SDK-Angular/field/Boolean/demo.stories.jsx.mustache +56 -0
  74. package/src/tasks/create/templates/SDK-Angular/field/Boolean/mock.stories.js.mustache +15 -0
  75. package/src/tasks/create/templates/SDK-Angular/field/Date/config.json.mustache +147 -0
  76. package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.html.mustache +35 -0
  77. package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.scss.mustache +20 -0
  78. package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.spec.ts.mustache +25 -0
  79. package/src/tasks/create/templates/SDK-Angular/field/Date/date.component.ts.mustache +209 -0
  80. package/src/tasks/create/templates/SDK-Angular/field/DateTime/config.json.mustache +204 -0
  81. package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.html.mustache +31 -0
  82. package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.scss.mustache +20 -0
  83. package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.spec.ts.mustache +25 -0
  84. package/src/tasks/create/templates/SDK-Angular/field/DateTime/date-time.component.ts.mustache +177 -0
  85. package/src/tasks/create/templates/SDK-Angular/field/Decimal/config.json.mustache +94 -0
  86. package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.html.mustache +32 -0
  87. package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.scss.mustache +20 -0
  88. package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.spec.ts.mustache +25 -0
  89. package/src/tasks/create/templates/SDK-Angular/field/Decimal/decimal.component.ts.mustache +170 -0
  90. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/config.json.mustache +125 -0
  91. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.html.mustache +33 -0
  92. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.scss.mustache +20 -0
  93. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.spec.ts.mustache +25 -0
  94. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Currency/decimal-currency.component.ts.mustache +175 -0
  95. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/config.json.mustache +94 -0
  96. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.html.mustache +33 -0
  97. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.scss.mustache +20 -0
  98. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.spec.ts.mustache +25 -0
  99. package/src/tasks/create/templates/SDK-Angular/field/Decimal-Percentage/decimal-percentage.component.ts.mustache +176 -0
  100. package/src/tasks/create/templates/SDK-Angular/field/Integer/config.json.mustache +88 -0
  101. package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.html.mustache +33 -0
  102. package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.scss.mustache +20 -0
  103. package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.spec.ts.mustache +25 -0
  104. package/src/tasks/create/templates/SDK-Angular/field/Integer/integer.component.ts.mustache +180 -0
  105. package/src/tasks/create/templates/SDK-Angular/field/Picklist/config.json.mustache +86 -0
  106. package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.html.mustache +30 -0
  107. package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.scss.mustache +25 -0
  108. package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.spec.ts.mustache +25 -0
  109. package/src/tasks/create/templates/SDK-Angular/field/Picklist/picklist.component.ts.mustache +195 -0
  110. package/src/tasks/create/templates/SDK-Angular/field/Text/config.json.mustache +83 -0
  111. package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.html.mustache +17 -0
  112. package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.scss.mustache +30 -0
  113. package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.spec.ts.mustache +25 -0
  114. package/src/tasks/create/templates/SDK-Angular/field/Text/text.component.ts.mustache +145 -0
  115. package/src/tasks/create/templates/SDK-Angular/field/Text-Email/config.json.mustache +83 -0
  116. package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.html.mustache +31 -0
  117. package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.scss.mustache +20 -0
  118. package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.spec.ts.mustache +25 -0
  119. package/src/tasks/create/templates/SDK-Angular/field/Text-Email/text-email.component.ts.mustache +175 -0
  120. package/src/tasks/create/templates/SDK-Angular/field/Text-Input/config.json.mustache +83 -0
  121. package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.html.mustache +31 -0
  122. package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.scss.mustache +20 -0
  123. package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.spec.ts.mustache +25 -0
  124. package/src/tasks/create/templates/SDK-Angular/field/Text-Input/text.component.ts.mustache +177 -0
  125. package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/config.json.mustache +83 -0
  126. package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.html.mustache +31 -0
  127. package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.scss.mustache +20 -0
  128. package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.spec.ts.mustache +25 -0
  129. package/src/tasks/create/templates/SDK-Angular/field/Text-Paragraph/text-paragraph.component.ts.mustache +179 -0
  130. package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/config.json.mustache +95 -0
  131. package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.html.mustache +30 -0
  132. package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.scss.mustache +81 -0
  133. package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.spec.ts.mustache +25 -0
  134. package/src/tasks/create/templates/SDK-Angular/field/Text-Phone/text-phone.component.ts.mustache +194 -0
  135. package/src/tasks/create/templates/SDK-Angular/field/Text-URL/config.json.mustache +111 -0
  136. package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.html.mustache +30 -0
  137. package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.scss.mustache +20 -0
  138. package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.spec.ts.mustache +26 -0
  139. package/src/tasks/create/templates/SDK-Angular/field/Text-URL/text-url.component.ts.mustache +174 -0
  140. package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.html.mustache +30 -0
  141. package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.scss.mustache +20 -0
  142. package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.spec.ts.mustache +25 -0
  143. package/src/tasks/create/templates/SDK-Angular/field/TimeOfDay/time-of-day.component.ts.mustache +172 -0
  144. package/src/tasks/create/templates/SDK-Angular/template/DETAILS/DefaultForm.svg +29 -0
  145. package/src/tasks/create/templates/SDK-Angular/template/DETAILS/config.json.mustache +21 -0
  146. package/src/tasks/create/templates/SDK-Angular/template/DETAILS/demo.stories.jsx.mustache +71 -0
  147. package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.html.mustache +7 -0
  148. package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.scss.mustache +7 -0
  149. package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.spec.ts.mustache +25 -0
  150. package/src/tasks/create/templates/SDK-Angular/template/DETAILS/details.component.ts.mustache +121 -0
  151. package/src/tasks/create/templates/SDK-Angular/template/DETAILS/mock.stories.js.mustache +294 -0
  152. package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/TwoColumnDetails.svg +28 -0
  153. package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/config.json.mustache +27 -0
  154. package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/demo.stories.jsx.mustache +73 -0
  155. package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.html.mustache +6 -0
  156. package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.scss.mustache +7 -0
  157. package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.spec.ts.mustache +25 -0
  158. package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/details.component.ts.mustache +92 -0
  159. package/src/tasks/create/templates/SDK-Angular/template/DETAILS-region/mock.stories.js.mustache +290 -0
  160. package/src/tasks/create/templates/SDK-Angular/template/FORM/DefaultForm.svg +29 -0
  161. package/src/tasks/create/templates/SDK-Angular/template/FORM/config.json.mustache +45 -0
  162. package/src/tasks/create/templates/SDK-Angular/template/FORM/demo.stories.jsx.mustache +215 -0
  163. package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.html.mustache +23 -0
  164. package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.scss.mustache +33 -0
  165. package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.spec.ts.mustache +25 -0
  166. package/src/tasks/create/templates/SDK-Angular/template/FORM/form.component.ts.mustache +71 -0
  167. package/src/tasks/create/templates/SDK-Angular/template/FORM-region/TwoColumn.svg +38 -0
  168. package/src/tasks/create/templates/SDK-Angular/template/FORM-region/config.json.mustache +49 -0
  169. package/src/tasks/create/templates/SDK-Angular/template/FORM-region/demo.stories.jsx.mustache +183 -0
  170. package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.html.mustache +16 -0
  171. package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.scss.mustache +28 -0
  172. package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.spec.ts.mustache +25 -0
  173. package/src/tasks/create/templates/SDK-Angular/template/FORM-region/form.component.ts.mustache +26 -0
  174. package/src/tasks/create/templates/SDK-Angular/template/FORM-region/mock.stories.js.mustache +132 -0
  175. package/src/tasks/create/templates/SDK-Angular/template/PAGE/OneColumnPage.svg +28 -0
  176. package/src/tasks/create/templates/SDK-Angular/template/PAGE/config.json.mustache +32 -0
  177. package/src/tasks/create/templates/SDK-Angular/template/PAGE/demo.stories.jsx.mustache +80 -0
  178. package/src/tasks/create/templates/SDK-Angular/template/PAGE/mock.stories.js.mustache +115 -0
  179. package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.html.mustache +15 -0
  180. package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.scss.mustache +3 -0
  181. package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.spec.ts.mustache +25 -0
  182. package/src/tasks/create/templates/SDK-Angular/template/PAGE/page.component.ts.mustache +63 -0
  183. package/src/tasks/create/templates/SDK-Angular/widget/CASE/OneColumnPage.svg +36 -0
  184. package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.html.mustache +15 -0
  185. package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.scss.mustache +22 -0
  186. package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.spec.ts.mustache +25 -0
  187. package/src/tasks/create/templates/SDK-Angular/widget/CASE/case.component.ts.mustache +111 -0
  188. package/src/tasks/create/templates/SDK-Angular/widget/CASE/config.json.mustache +23 -0
  189. package/src/tasks/create/templates/SDK-Angular/widget/CASE/demo.stories.jsx.mustache +70 -0
  190. package/src/tasks/create/templates/SDK-Angular/widget/CASE/mock.stories.js.mustache +390 -0
  191. package/src/tasks/create/templates/SDK-Angular/widget/PAGE/OneColumnPage.svg +36 -0
  192. package/src/tasks/create/templates/SDK-Angular/widget/PAGE/config.json.mustache +59 -0
  193. package/src/tasks/create/templates/SDK-Angular/widget/PAGE/demo.stories.jsx.mustache +29 -0
  194. package/src/tasks/create/templates/SDK-Angular/widget/PAGE/mock.stories.js.mustache +23 -0
  195. package/src/tasks/create/templates/SDK-Angular/widget/PAGE/page.component.html.mustache +17 -0
  196. package/src/tasks/create/templates/SDK-Angular/widget/PAGE/page.component.scss.mustache +19 -0
  197. package/src/tasks/create/templates/SDK-Angular/widget/PAGE/page.component.ts.mustache +32 -0
  198. package/src/tasks/create/templates/SDK-Angular/widget/PAGE/pagecomponent.spec.ts.mustache +25 -0
  199. package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/OneColumnPage.svg +36 -0
  200. package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/config.json.mustache +66 -0
  201. package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/demo.stories.jsx.mustache +52 -0
  202. package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/mock.stories.js.mustache +52 -0
  203. package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.html.mustache +28 -0
  204. package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.scss.mustache +137 -0
  205. package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.spec.ts.mustache +25 -0
  206. package/src/tasks/create/templates/SDK-Angular/widget/PAGE-CASE/page-case.component.ts.mustache +115 -0
  207. package/src/tasks/create/templates/SDK-React/field/Boolean/index.tsx.mustache +3 -3
  208. package/src/tasks/create/templates/SDK-React/field/Date/index.tsx.mustache +2 -2
  209. package/src/tasks/create/templates/SDK-React/field/DateTime/index.tsx.mustache +6 -7
  210. package/src/tasks/create/templates/SDK-React/field/Decimal/demo.stories.jsx.mustache +5 -1
  211. package/src/tasks/create/templates/SDK-React/field/Decimal/index.tsx.mustache +78 -28
  212. package/src/tasks/create/templates/SDK-React/field/Decimal-Currency/index.tsx.mustache +3 -3
  213. package/src/tasks/create/templates/SDK-React/field/Decimal-Percentage/index.tsx.mustache +2 -2
  214. package/src/tasks/create/templates/SDK-React/field/Integer/index.tsx.mustache +2 -2
  215. package/src/tasks/create/templates/SDK-React/field/Picklist/demo.stories.jsx.mustache +13 -0
  216. package/src/tasks/create/templates/SDK-React/field/Picklist/index.tsx.mustache +30 -10
  217. package/src/tasks/create/templates/SDK-React/field/Text/index.tsx.mustache +2 -2
  218. package/src/tasks/create/templates/SDK-React/field/Text-Email/index.tsx.mustache +2 -2
  219. package/src/tasks/create/templates/SDK-React/field/Text-Input/index.tsx.mustache +2 -2
  220. package/src/tasks/create/templates/SDK-React/field/Text-Paragraph/index.tsx.mustache +2 -2
  221. package/src/tasks/create/templates/SDK-React/field/Text-Phone/index.tsx.mustache +6 -5
  222. package/src/tasks/create/templates/SDK-React/field/Text-URL/index.tsx.mustache +11 -0
  223. package/src/tasks/create/templates/SDK-React/field/TimeOfDay/config.json.mustache +135 -0
  224. package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/index.tsx.mustache +12 -1
  225. package/src/tasks/create/templates/SDK-React/template/DETAILS/index.tsx.mustache +7 -3
  226. package/src/tasks/create/templates/SDK-React/template/DETAILS-region/index.tsx.mustache +8 -4
  227. package/src/tasks/create/templates/SDK-React/template/FORM/index.tsx.mustache +30 -20
  228. package/src/tasks/create/templates/SDK-React/template/FORM-region/demo.stories.jsx.mustache +2 -2
  229. package/src/tasks/create/templates/SDK-React/template/PAGE/demo.stories.jsx.mustache +1 -0
  230. package/src/tasks/create/templates/SDK-React/widget/CASE/index.tsx.mustache +4 -3
  231. package/src/tasks/create/templates/SDK-React/widget/PAGE/index.tsx.mustache +7 -7
  232. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/demo.stories.jsx.mustache +2 -10
  233. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/index.tsx.mustache +138 -36
  234. package/src/tasks/create/templates/SDK-React/widget/PAGE-CASE/mock.stories.js.mustache +1 -1
  235. package/src/tasks/create-all/index.js +114 -58
  236. package/src/tasks/delete/helper.js +88 -24
  237. package/src/tasks/delete/index.js +17 -8
  238. package/src/tasks/delete-all/helper.js +88 -25
  239. package/src/tasks/delete-all/index.js +15 -6
  240. package/src/tasks/list/index.js +14 -7
  241. package/src/tasks/map/map.js +212 -20
  242. package/src/tasks/map-all/index.js +19 -2
  243. package/src/tasks/override/index.js +137 -76
  244. package/src/tasks/override-all/index.js +54 -6
  245. package/src/tasks/publish/helper.js +93 -50
  246. package/src/tasks/publish/index.js +87 -34
  247. package/src/tasks/publish-all/helper.js +96 -57
  248. package/src/tasks/publish-all/index.js +123 -47
  249. package/src/tasks/rename/index.js +184 -111
  250. package/src/tasks/validator/index.js +31 -7
  251. package/src/util.js +173 -20
  252. package/src/tasks/create/templates/Constellation/field/TimeofDay/styles.js.mustache +0 -7
  253. /package/src/tasks/bundle/{builder → builderAngular}/index.js +0 -0
  254. /package/src/tasks/bundle/{builder → builderAngular}/modules.js +0 -0
  255. /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/config.json.mustache +0 -0
  256. /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/demo.stories.jsx.mustache +0 -0
  257. /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/index.jsx.mustache +0 -0
  258. /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/mock.stories.js.mustache +0 -0
  259. /package/src/tasks/create/templates/Constellation/field/{TimeofDay → TimeOfDay}/suggestions-handler.js +0 -0
  260. /package/src/tasks/create/templates/{SDK-React/field/TimeofDay → SDK-Angular/field/TimeOfDay}/config.json.mustache +0 -0
  261. /package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/demo.stories.jsx.mustache +0 -0
  262. /package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/mock.stories.js.mustache +0 -0
  263. /package/src/tasks/create/templates/SDK-React/field/{TimeofDay → TimeOfDay}/styles.js.mustache +0 -0
@@ -9,7 +9,7 @@ import ncp from 'ncp';
9
9
  import chalk from 'chalk';
10
10
 
11
11
  import { checkPathAccess, showVersion, getFramework } from '../../util.js';
12
- import { CATEGORY_CONSTELLATION,
12
+ import { CATEGORY_CONSTELLATION, CATEGORY_CUSTOM,
13
13
  SDK_CONFIG_JSON_FILENAME,
14
14
  DXCB_CONFIG,
15
15
  DXCB_COMPONENT_DEFAULTS,
@@ -25,6 +25,7 @@ const pegaConfigInternalJsonPath = path.join(path.resolve(), DXCB_CONFIG_INTERNA
25
25
 
26
26
  import {
27
27
  convertIntoPascalCase,
28
+ convertIntoKebabCase,
28
29
  compileMustacheTemplate,
29
30
  getComponentDirectoryPath,
30
31
  getPegaConfig,
@@ -110,6 +111,9 @@ export const compileMustacheTemplates = async (
110
111
  allowedApplications = [].concat(allowedApplications);
111
112
  }
112
113
 
114
+ const componentKeyKebab = convertIntoKebabCase(convertIntoPascalCase(componentKey));
115
+ const framework = await getFramework();
116
+
113
117
  allowedApplications = allowedApplications.filter(el => !!el.trim()).map(el => el.trim());
114
118
  files.forEach(file => {
115
119
  const filePath = path.join(componentDirectory, file);
@@ -119,6 +123,7 @@ export const compileMustacheTemplates = async (
119
123
  COMPONENT_NAME: componentName,
120
124
  COMPONENT_LABEL: componentLabel,
121
125
  COMPONENT_CLASS_NAME: componentClassName,
126
+ COMPONENT_CLASS_NAME_KEBAB: componentKeyKebab,
122
127
  ORGANIZATION: organization,
123
128
  VERSION: version,
124
129
  LIBRARY: library,
@@ -132,7 +137,22 @@ export const compileMustacheTemplates = async (
132
137
  IS_PHONE: isPhone
133
138
  });
134
139
  fs.writeFileSync(filePath, output);
135
- fs.renameSync(filePath, filePath.replace('.mustache', ''));
140
+
141
+ switch (framework) {
142
+ case "SDK-React":
143
+ fs.renameSync(filePath, filePath.replace('.mustache', ''));
144
+ break;
145
+ case "SDK-Angular":
146
+ let newFilePath = filePath.replace('.mustache', '');
147
+ const typeAng = convertIntoKebabCase(convertIntoPascalCase(mustacheSubType)).concat(".component");
148
+ newFilePath = newFilePath.replace(typeAng, componentKeyKebab.concat(".component"));
149
+
150
+ fs.renameSync(filePath, newFilePath);
151
+ break;
152
+ case "SDK-WebComponents":
153
+ fs.renameSync(filePath, filePath.replace('.mustache', ''));
154
+ break;
155
+ }
136
156
  });
137
157
  };
138
158
 
@@ -213,10 +233,10 @@ export const validateCompileAll = async (
213
233
  const type = "Widget";
214
234
  const subtype = COMPONENT_SCHEMA.subtype.widget[widgetIdx].value;
215
235
  const prefixNoSpace = prefix.replace(/\s+/g, '');
216
- let widgetNameOriginal = COMPONENT_SCHEMA.subtype.template[widgetIdx].name;
236
+ let widgetNameOriginal = COMPONENT_SCHEMA.subtype.widget[widgetIdx].name;
217
237
  let widgetName = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.widget[widgetIdx].name).concat("Widget");
218
238
  let widgetLabel = convertIntoPascalCase(COMPONENT_SCHEMA.subtype.widget[widgetIdx].name).concat(" Widget");
219
- if (widgetNameOriginal.indexOf("&") >= 0) {
239
+ if (widgetName.indexOf("&") >= 0) {
220
240
  widgetName = convertIntoPascalCase(widgetNameOriginal.replace(" & ", ""));
221
241
  }
222
242
  const componentName = "".concat(prefixNoSpace).concat(widgetName);
@@ -282,7 +302,7 @@ export const validateCompile = async (
282
302
 
283
303
  const templateDir = `${templateParentDir}/${typeLC}/${sSubType}`;
284
304
  let templateDirectory = fileURLToPath(new URL(templateDir, import.meta.url));
285
- templateDirectory = templateDirectory.replace("/create-all", "/create");
305
+ templateDirectory = templateDirectory.replace( path.sep + "create-all", path.sep + "create");
286
306
 
287
307
  const templateDirConstellation = `./templates/Constellation/${typeLC}/${sSubType}`;
288
308
  let templateDirectoryConstellation = fileURLToPath(new URL(templateDirConstellation, import.meta.url));
@@ -290,17 +310,30 @@ export const validateCompile = async (
290
310
 
291
311
  const componentKey = `${organization}_${library}_${componentName}`;
292
312
 
293
-
294
- const targetDirectory = await getComponentDirectoryPath(join(typeLC, "/",componentKey));
313
+ let targetDirectory = "";
314
+ switch (framework) {
315
+ case "SDK-React":
316
+ targetDirectory = await getComponentDirectoryPath(join(typeLC, "/",componentKey));
317
+ break;
318
+ case "SDK-Angular":
319
+ let componentKeyAng = convertIntoKebabCase(convertIntoPascalCase(componentKey));
320
+ targetDirectory = await getComponentDirectoryPath(join(typeLC, "/",componentKeyAng));
321
+ break;
322
+ case "SDK-WebComponents":
323
+ break;
324
+ }
325
+
326
+ //const targetDirectory = await getComponentDirectoryPath(join(typeLC, "/",componentKey));
295
327
  const targetDirectoryConstellation = await getComponentDirectoryPath(join(typeLC, "/",componentKey), CATEGORY_CONSTELLATION);
296
328
 
297
- const components = await getComponents(false);
329
+ // keep old way fo getting components
330
+ const components = await getComponents(false, CATEGORY_CUSTOM, false);
298
331
 
299
332
  if (!onlyCompanion) {
300
333
  if (components.includes(componentKey)) {
301
334
  console.log(chalk.red(`${componentKey} component already exists in ${targetDirectory}`));
302
335
 
303
- let componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
336
+ let componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION, false);
304
337
  if (components.includes(componentKey)) {
305
338
  console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
306
339
  }
@@ -308,7 +341,7 @@ export const validateCompile = async (
308
341
  return;
309
342
  }
310
343
  // test for constellation
311
- const componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
344
+ const componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION, false);
312
345
  if (componentsConstellation.includes(componentKey)) {
313
346
  console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
314
347
  return;
@@ -316,7 +349,7 @@ export const validateCompile = async (
316
349
  }
317
350
  else {
318
351
  // test for constellation
319
- const componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION);
352
+ const componentsConstellation = await getComponents(false, CATEGORY_CONSTELLATION, false);
320
353
  if (componentsConstellation.includes(componentKey)) {
321
354
  console.log(chalk.red(`${componentKey} associated component already exists in ${targetDirectoryConstellation}`));
322
355
  return;
@@ -389,58 +422,20 @@ export default async options => {
389
422
 
390
423
  const componentData = data[DXCB_CONFIG][DXCB_COMPONENT_DEFAULTS];
391
424
 
392
- const { organization, library} = componentData;
425
+ let { organization, library} = componentData;
393
426
 
394
427
  let componentDefaults = await getComponentDefaults();
395
428
  componentDefaults.library = library;
396
429
 
430
+ if (options.params.length >= 8) {
431
+ const prefix = options.params[3];
432
+ const version = options.params[4];
433
+ const library = options.params[5];
434
+ const allowedApplications = options.params[6];
397
435
 
398
- const questions = [
399
- {
400
- name: 'prefix',
401
- message: 'Enter prefix label'
402
- },
403
- {
404
- name: 'version',
405
- message: 'Enter component version',
406
- default: componentDefaults.version,
407
- validate: value => {
408
- if (validateSemver(value)) {
409
- return true;
410
- }
411
- return 'Please provide semver compatible version e.g 0.0.1';
412
- }
413
- },
414
- {
415
- name: 'library',
416
- message: 'Enter library name (required)',
417
- default: componentDefaults.library,
418
- validate: value => {
419
- /* value should not be empty
420
- It should not have spaces
421
- It should not start with a number
422
- Only case-insensitive alphanumeric values are allowed
423
- */
424
- if (value && !/^\d/.test(value) && value === sanitize(value)) {
425
- return true;
426
- }
427
- return 'Only alphanumeric values are allowed, starting with alphabets';
428
- }
429
- },
430
- {
431
- name: 'allowedApplications',
432
- message: 'Please enter the application names to be supported (comma-separated). ',
433
- suffix: 'Keep empty for all applications'
434
- }
435
- ];
436
+ // overwrite
437
+ organization = options.params[7];
436
438
 
437
- await inquirer.prompt(questions).then(async answers => {
438
- const {
439
- prefix,
440
- library,
441
- version,
442
- allowedApplications
443
- } = answers;
444
439
  await validateCompileAll(
445
440
  {
446
441
  prefix,
@@ -451,6 +446,67 @@ export default async options => {
451
446
  },
452
447
  options
453
448
  );
454
- });
449
+ } else {
450
+ const questions = [
451
+ {
452
+ name: 'prefix',
453
+ message: 'Enter prefix label'
454
+ },
455
+ {
456
+ name: 'version',
457
+ message: 'Enter component version',
458
+ default: componentDefaults.version,
459
+ validate: value => {
460
+ if (validateSemver(value)) {
461
+ return true;
462
+ }
463
+ return 'Please provide semver compatible version e.g 0.0.1';
464
+ }
465
+ },
466
+ {
467
+ name: 'library',
468
+ message: 'Enter library name (required)',
469
+ default: componentDefaults.library,
470
+ validate: value => {
471
+ /* value should not be empty
472
+ It should not have spaces
473
+ It should not start with a number
474
+ Only case-insensitive alphanumeric values are allowed
475
+ */
476
+ if (value && !/^\d/.test(value) && value === sanitize(value)) {
477
+ return true;
478
+ }
479
+ return 'Only alphanumeric values are allowed, starting with alphabets';
480
+ }
481
+ },
482
+ {
483
+ name: 'allowedApplications',
484
+ message: 'Please enter the application names to be supported (comma-separated). ',
485
+ suffix: 'Keep empty for all applications'
486
+ }
487
+ ];
488
+
489
+ await inquirer.prompt(questions).then(async answers => {
490
+ const {
491
+ library,
492
+ version,
493
+ allowedApplications
494
+ } = answers;
495
+ let { prefix } = answers;
496
+ prefix = prefix.replace(/\W+/g, "");
497
+ await validateCompileAll(
498
+ {
499
+ prefix,
500
+ library,
501
+ version,
502
+ allowedApplications,
503
+ organization
504
+ },
505
+ options
506
+ );
507
+ });
508
+ }
509
+
510
+
455
511
 
456
512
  };
@@ -1,15 +1,21 @@
1
1
  import chalk from 'chalk';
2
2
  import inquirer from 'inquirer';
3
3
  import ora from 'ora';
4
+ import { join } from 'path';
4
5
  //import { element } from 'prop-types';
5
6
 
6
7
  import { LIST_COMPONENT_SERVICE_REST_ENDPOINT, COMPONENT_SCHEMA, CATEGORY_CONSTELLATION, CATEGORY_CUSTOM, CATEGORY_OVERRIDE } from '../../constants.js';
7
8
  import {
8
9
  deleteLocalComponent,
10
+ getLocalComponentConfig,
11
+ getFramework,
9
12
  deleteServerComponent,
10
13
  getComponentsObj,
11
- getPegaServerConfig
14
+ getPegaServerConfig,
15
+ convertIntoKebabCase,
16
+ convertIntoPascalCase
12
17
  } from '../../util.js';
18
+
13
19
  import { getComponentsFromServer } from '../list/helper.js';
14
20
 
15
21
  import { deleteFromComponentMap } from '../map/map.js';
@@ -57,36 +63,80 @@ export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOp
57
63
  ];
58
64
  };
59
65
 
60
- export const deleteLocalComponents = async (sourceOfComponents, category = CATEGORY_CUSTOM) => {
66
+ export const deleteLocalComponents = async (sourceOfComponents, category = CATEGORY_CUSTOM, options) => {
61
67
  const localComponents = await getComponentsObj(true, category);
62
68
  //const localComponentsAndSub = await getComponentsAndSubDirectory();
63
69
 
70
+ let confirmDeletion;
71
+ let componentKey;
72
+
64
73
  if (localComponents.length > 0) {
65
- const answers = await inquirer.prompt([
66
- {
67
- name: 'componentKey',
68
- type: 'rawlist',
69
- pageSize: 15,
70
- message: 'Select component to delete',
71
- choices: localComponents
72
- },
73
- {
74
- name: 'confirmDeletion',
75
- type: 'confirm',
76
- message: 'Are you sure ?',
77
- default: false
78
- }
79
- ]);
80
- if (answers.confirmDeletion) {
81
- await deleteLocalComponent(answers.componentKey, category);
82
- if (category === "custom") {
83
- await deleteLocalComponent(answers.componentKey, CATEGORY_CONSTELLATION);
74
+ if (options.params.length >= 7) {
75
+ componentKey = options.params[5];
76
+ const sDeletion = options.params[6];
77
+ confirmDeletion = sDeletion === 'Y' || sDeletion === 'y' || sDeletion === true || sDeletion === 'true';
78
+
79
+ } else {
80
+ const answers = await inquirer.prompt([
81
+ {
82
+ name: 'componentKey',
83
+ type: 'rawlist',
84
+ pageSize: 15,
85
+ message: 'Select component to delete',
86
+ choices: localComponents
87
+ },
88
+ {
89
+ name: 'confirmDeletion',
90
+ type: 'confirm',
91
+ message: 'Are you sure ?',
92
+ default: false
93
+ }
94
+ ]);
95
+ ({componentKey, confirmDeletion} = answers);;
96
+
97
+ }
98
+
99
+ if (confirmDeletion) {
100
+
101
+ const framework = await getFramework();
102
+ let customComponentKey = componentKey;
103
+
104
+ switch (framework) {
105
+ case "SDK-Angular":
106
+ // because of naming Pascal case vs Kebab case, given Pascal - use for associated
107
+ // Kebab case customComponentKey
108
+
109
+ let arComp = componentKey.split("/");
110
+ arComp[1] = convertIntoKebabCase(convertIntoPascalCase(arComp[1]));
111
+ customComponentKey = arComp.join("/");
112
+
113
+ await deleteLocalComponent(customComponentKey, category);
114
+ if (category === CATEGORY_CUSTOM) {
115
+ await deleteLocalComponent(componentKey, CATEGORY_CONSTELLATION);
116
+ }
117
+
118
+ break;
119
+ case "SDK-React":
120
+ await deleteLocalComponent(componentKey, category);
121
+ if (category === CATEGORY_CUSTOM) {
122
+ await deleteLocalComponent(componentKey, CATEGORY_CONSTELLATION);
123
+ }
124
+ break;
125
+ case "SDK-WebComponents":
126
+ await deleteLocalComponent(componentToDelete, category);
127
+ if (category === CATEGORY_CUSTOM) {
128
+ await deleteLocalComponent(componentToDelete, CATEGORY_CONSTELLATION);
129
+ }
130
+ break;
84
131
  }
85
132
 
133
+
134
+
86
135
  if (category === CATEGORY_OVERRIDE || category === CATEGORY_CUSTOM) {
87
136
  // need to remove the map as well
88
- if (answers.componentKey != undefined) {
89
- await deleteFromComponentMap(answers.componentKey, category);
137
+ if (customComponentKey != undefined) {
138
+
139
+ await deleteFromComponentMap(customComponentKey, category);
90
140
  }
91
141
  else {
92
142
  console.log(chalk.bold.yellow(`No component in map: ` + componentName));
@@ -104,6 +154,8 @@ export const deleteServerComponents = async (sourceOfComponents, answers) => {
104
154
  const spinner = ora('Fetching components from server').start();
105
155
  const data = await getComponentsFromServer(answers);
106
156
  const componentObj = await getComponentsObj(false);
157
+
158
+ const framework = await getFramework();
107
159
 
108
160
  const serverComponents = JSON.parse(data);
109
161
  spinner.stop();
@@ -135,7 +187,19 @@ export const deleteServerComponents = async (sourceOfComponents, answers) => {
135
187
  await deleteServerComponent(answers.componentToDelete);
136
188
 
137
189
  const componentName = answers.componentToDelete.split("~")[0];
138
- const componentKey = componentObj.find( theObj => theObj.name === componentName);
190
+ let componentKey;
191
+
192
+ switch (framework) {
193
+ case "SDK-Angular":
194
+ const tempComponentName = convertIntoKebabCase(convertIntoPascalCase(componentName));
195
+ componentKey = componentObj.find( theObj => theObj.name === tempComponentName);
196
+ break;
197
+ case "SDK-React":
198
+ componentKey = componentObj.find( theObj => theObj.name === componentName);
199
+ break;
200
+ case "SDK-WebComponents":
201
+ break;
202
+ }
139
203
 
140
204
  // check to see if component is an override component
141
205
  if (componentKey === undefined) {
@@ -10,14 +10,23 @@ import {
10
10
 
11
11
 
12
12
 
13
- const deleteComponentsFn = async (sourceOfComponents, answers) => {
13
+ const deleteComponentsFn = async (sourceOfComponents, answers, options) => {
14
+
15
+ let category;
16
+ if (answers != null) {
17
+ category = answers.category;
18
+ }
19
+ else {
20
+ category = options.params[4];
21
+ }
22
+
14
23
  switch (sourceOfComponents) {
15
24
  case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
16
- await deleteLocalComponents(sourceOfComponents, answers.category);
25
+ await deleteLocalComponents(sourceOfComponents, category, options);
17
26
  break;
18
27
  }
19
28
  case SOURCE_OF_COMPONENT_TYPES.SERVER: {
20
- await deleteServerComponents(sourceOfComponents, answers);
29
+ await deleteServerComponents(sourceOfComponents, answers, options);
21
30
  break;
22
31
  }
23
32
  default: {
@@ -31,14 +40,14 @@ export default async options => {
31
40
  showVersion();
32
41
 
33
42
  let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
34
- if (options.params[4] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
43
+ if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
35
44
  sourceOfComponentsOption = options.params[3];
36
- await deleteComponentsFn(sourceOfComponentsOption);
37
- } else if (options.params[4] === SOURCE_OF_COMPONENT_TYPES.SERVER) {
45
+ await deleteComponentsFn(sourceOfComponentsOption, null, options);
46
+ } else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.SERVER) {
38
47
  sourceOfComponentsOption = options.params[3];
39
48
  const questions = await getDeleteComponentsQuestions(options, sourceOfComponentsOption);
40
49
  const answers = await inquirer.prompt(questions);
41
- await deleteComponentsFn(sourceOfComponentsOption, answers);
50
+ await deleteComponentsFn(sourceOfComponentsOption, answers, options);
42
51
  } else {
43
52
  const questions = await getDeleteComponentsQuestions(options);
44
53
  let answers = await inquirer.prompt(questions);
@@ -50,6 +59,6 @@ export default async options => {
50
59
  if (categoryType != null) {
51
60
  answers.category = categoryType;
52
61
  }
53
- await deleteComponentsFn(sourceOfComponents, answers);
62
+ await deleteComponentsFn(sourceOfComponents, answers, options);
54
63
  }
55
64
  };
@@ -1,6 +1,7 @@
1
1
  import chalk from 'chalk';
2
2
  import inquirer from 'inquirer';
3
3
  import ora from 'ora';
4
+ import { join } from 'path';
4
5
 
5
6
  import { COMPONENT_SCHEMA, CATEGORY_CONSTELLATION, CATEGORY_CUSTOM, CATEGORY_OVERRIDE } from '../..//constants.js';
6
7
  import {
@@ -9,7 +10,11 @@ import {
9
10
  getComponentsObj,
10
11
  getPegaServerConfig,
11
12
  validateRulesetVersion,
12
- getOptionsCategory
13
+ getOptionsCategory,
14
+ getFramework,
15
+ getLocalComponentKeyFromConfig,
16
+ convertIntoKebabCase,
17
+ convertIntoPascalCase
13
18
  } from '../../util.js';
14
19
  import { getComponentsFromServer } from '../list/helper.js';
15
20
 
@@ -60,44 +65,86 @@ export const getDeleteComponentsQuestions = async (options, sourceOfComponentsOp
60
65
 
61
66
 
62
67
 
63
- export const deleteLocalComponents = async (sourceOfComponents, category = CATEGORY_CUSTOM) => {
68
+ export const deleteLocalComponents = async (sourceOfComponents, category = CATEGORY_CUSTOM, options) => {
64
69
  const localComponents = await getComponentsObj(true, category);
70
+ const framework = await getFramework();
65
71
 
66
- for (var index in localComponents) {
67
- if (localComponents[index].type != undefined && localComponents[index].type === "separator") {
68
- console.log(chalk.bold.green(localComponents[index]));
69
- }
70
- else {
71
- console.log(chalk.bold.green(localComponents[index].name));
72
- }
73
-
74
- }
72
+ let confirmDeletion;
75
73
 
76
74
  if (localComponents.length > 0) {
77
- const answers = await inquirer.prompt([
75
+ if (options.params.length >= 6) {
76
+ const sDeletion = options.params[5];
77
+ confirmDeletion = sDeletion === 'Y' || sDeletion === 'y' || sDeletion === true || sDeletion === 'true';
78
78
 
79
- {
80
- name: 'confirmDeletion',
81
- type: 'confirm',
82
- message: 'Delete all local ?',
83
- default: false
79
+ } else {
80
+
81
+ for (var index in localComponents) {
82
+ if (localComponents[index].type != undefined && localComponents[index].type === "separator") {
83
+ console.log(chalk.bold.green(localComponents[index]));
84
+ }
85
+ else {
86
+ console.log(chalk.bold.green(localComponents[index].name));
87
+ }
88
+
84
89
  }
85
- ]);
86
- if (answers.confirmDeletion) {
90
+
91
+ const answers = await inquirer.prompt([
92
+
93
+ {
94
+ name: 'confirmDeletion',
95
+ type: 'confirm',
96
+ message: 'Delete all local ?',
97
+ default: false
98
+ }
99
+ ]);
100
+
101
+ confirmDeletion = answers.confirmDeletion;
102
+ }
103
+
104
+ if (confirmDeletion) {
87
105
  for (var index in localComponents) {
88
106
  if (localComponents[index].type == undefined) {
89
107
  var componentToDelete = localComponents[index].value;
90
- await deleteLocalComponent(componentToDelete, category);
91
- if (category === CATEGORY_CUSTOM) {
92
- await deleteLocalComponent(componentToDelete, CATEGORY_CONSTELLATION);
108
+
109
+ let customComponentKey = componentToDelete;
110
+
111
+ switch (framework) {
112
+ case "SDK-Angular":
113
+ // because of naming Pascal case vs Kebab case, given Pascal - use for associated
114
+ // Kebab case customComponentKey
115
+
116
+ let arComp = componentToDelete.split("/");
117
+ arComp[1] = convertIntoKebabCase(convertIntoPascalCase(arComp[1]));
118
+ customComponentKey = arComp.join("/");
119
+
120
+ await deleteLocalComponent(customComponentKey, category);
121
+ if (category === CATEGORY_CUSTOM) {
122
+ await deleteLocalComponent(componentToDelete, CATEGORY_CONSTELLATION);
123
+ }
124
+
125
+ break;
126
+ case "SDK-React":
127
+ await deleteLocalComponent(componentToDelete, category);
128
+ if (category === CATEGORY_CUSTOM) {
129
+ await deleteLocalComponent(componentToDelete, CATEGORY_CONSTELLATION);
130
+ }
131
+ break;
132
+ case "SDK-WebComponents":
133
+ await deleteLocalComponent(componentToDelete, category);
134
+ if (category === CATEGORY_CUSTOM) {
135
+ await deleteLocalComponent(componentToDelete, CATEGORY_CONSTELLATION);
136
+ }
137
+ break;
93
138
  }
94
139
 
140
+
141
+
95
142
  // need to remove the map as well
96
143
  if (componentToDelete != undefined) {
97
- await deleteFromComponentMap(componentToDelete, category);
144
+ await deleteFromComponentMap(customComponentKey, category);
98
145
  }
99
146
  else {
100
- console.log(chalk.bold.redBright(`No component in map: ` + componentToDelete));
147
+ console.log(chalk.bold.redBright(`No component in map: ` + customComponentKey));
101
148
  }
102
149
 
103
150
  }
@@ -116,6 +163,8 @@ export const deleteServerComponents = async (sourceOfComponents, answers) => {
116
163
  const defaultPegaConfig = await getPegaServerConfig();
117
164
  const componentObj = await getComponentsObj(false);
118
165
 
166
+ const framework = await getFramework();
167
+
119
168
  const serverComponents = JSON.parse(data);
120
169
  spinner.stop();
121
170
  if (serverComponents && serverComponents.pxResults?.length > 0) {
@@ -183,7 +232,21 @@ export const deleteServerComponents = async (sourceOfComponents, answers) => {
183
232
  await deleteServerComponent(componentToDelete);
184
233
 
185
234
  const componentName = componentToDelete.split("~")[0];
186
- const componentKey = componentObj.find( theObj => theObj.name === componentName);
235
+ let componentKey;
236
+
237
+ switch (framework) {
238
+ case "SDK-Angular":
239
+ const tempComponentName = convertIntoKebabCase(convertIntoPascalCase(componentName));
240
+ componentKey = componentObj.find( theObj => theObj.name === tempComponentName);
241
+ break;
242
+ case "SDK-React":
243
+ componentKey = componentObj.find( theObj => theObj.name === componentName);
244
+ break;
245
+ case "SDK-WebComponents":
246
+ break;
247
+ }
248
+
249
+
187
250
 
188
251
  // check to see if component is an override component
189
252
  if (componentKey === undefined) {
@@ -9,14 +9,23 @@ import {
9
9
 
10
10
  import { showVersion, getOptionsCategory } from '../../util.js';
11
11
 
12
- const deleteComponentsFn = async (sourceOfComponents, answers) => {
12
+ const deleteComponentsFn = async (sourceOfComponents, answers, options) => {
13
+
14
+ let category;
15
+ if (answers != null) {
16
+ category = answers.category;
17
+ }
18
+ else {
19
+ category = options.params[4];
20
+ }
21
+
13
22
  switch (sourceOfComponents) {
14
23
  case SOURCE_OF_COMPONENT_TYPES.LOCAL: {
15
- await deleteLocalComponents(sourceOfComponents, answers.category);
24
+ await deleteLocalComponents(sourceOfComponents, category, options);
16
25
  break;
17
26
  }
18
27
  case SOURCE_OF_COMPONENT_TYPES.SERVER: {
19
- await deleteServerComponents(sourceOfComponents, answers);
28
+ await deleteServerComponents(sourceOfComponents, answers, options);
20
29
  break;
21
30
  }
22
31
  default: {
@@ -32,12 +41,12 @@ export default async options => {
32
41
  let sourceOfComponentsOption = SOURCE_OF_COMPONENT_TYPES.LOCAL;
33
42
  if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.LOCAL) {
34
43
  sourceOfComponentsOption = options.params[3];
35
- await deleteComponentsFn(sourceOfComponentsOption);
44
+ await deleteComponentsFn(sourceOfComponentsOption, null, options);
36
45
  } else if (options.params[3] === SOURCE_OF_COMPONENT_TYPES.SERVER) {
37
46
  sourceOfComponentsOption = options.params[3];
38
47
  const questions = await getDeleteComponentsQuestions(options, sourceOfComponentsOption);
39
48
  const answers = await inquirer.prompt(questions);
40
- await deleteComponentsFn(sourceOfComponentsOption, answers);
49
+ await deleteComponentsFn(sourceOfComponentsOption, answers, options);
41
50
  } else {
42
51
  const questions = await getDeleteComponentsQuestions(options);
43
52
  let answers = await inquirer.prompt(questions);
@@ -49,6 +58,6 @@ export default async options => {
49
58
  if (categoryType != null) {
50
59
  answers.category = categoryType;
51
60
  }
52
- await deleteComponentsFn(sourceOfComponents, answers);
61
+ await deleteComponentsFn(sourceOfComponents, answers, options);
53
62
  }
54
63
  };