@webiny/api-apw 0.0.0-unstable.1e66d121db → 0.0.0-unstable.611c5af35e

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 (239) hide show
  1. package/ApwChangeRequestNotification.d.ts +27 -0
  2. package/ApwChangeRequestNotification.js +30 -0
  3. package/ApwChangeRequestNotification.js.map +1 -0
  4. package/ApwCommentNotification.d.ts +27 -0
  5. package/ApwCommentNotification.js +30 -0
  6. package/ApwCommentNotification.js.map +1 -0
  7. package/ApwContentReviewNotification.d.ts +26 -0
  8. package/ApwContentReviewNotification.js +30 -0
  9. package/ApwContentReviewNotification.js.map +1 -0
  10. package/ApwContentUrlPlugin.d.ts +19 -0
  11. package/ApwContentUrlPlugin.js +30 -0
  12. package/ApwContentUrlPlugin.js.map +1 -0
  13. package/ContentApwSettingsPlugin.js +0 -5
  14. package/ContentApwSettingsPlugin.js.map +1 -1
  15. package/crud/createChangeRequestMethods.js +4 -11
  16. package/crud/createChangeRequestMethods.js.map +1 -1
  17. package/crud/createCommentMethods.js +4 -12
  18. package/crud/createCommentMethods.js.map +1 -1
  19. package/crud/createContentReviewMethods.js +32 -86
  20. package/crud/createContentReviewMethods.js.map +1 -1
  21. package/crud/createReviewerMethods.js +4 -12
  22. package/crud/createReviewerMethods.js.map +1 -1
  23. package/crud/createWorkflowMethods.js +4 -17
  24. package/crud/createWorkflowMethods.js.map +1 -1
  25. package/crud/index.js +0 -25
  26. package/crud/index.js.map +1 -1
  27. package/crud/utils.js +0 -28
  28. package/crud/utils.js.map +1 -1
  29. package/index.d.ts +3 -3
  30. package/index.js +5 -13
  31. package/index.js.map +1 -1
  32. package/package.json +35 -35
  33. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +0 -15
  34. package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
  35. package/plugins/cms/apwEntryPlugins.js +0 -8
  36. package/plugins/cms/apwEntryPlugins.js.map +1 -1
  37. package/plugins/cms/index.js +5 -10
  38. package/plugins/cms/index.js.map +1 -1
  39. package/plugins/cms/linkContentReviewToEntry.js +0 -17
  40. package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
  41. package/plugins/cms/linkWorkflowToEntry.js +2 -31
  42. package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
  43. package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
  44. package/plugins/cms/notifications/changeRequestNotification.js +31 -0
  45. package/plugins/cms/notifications/changeRequestNotification.js.map +1 -0
  46. package/plugins/cms/notifications/commentNotification.d.ts +1 -0
  47. package/plugins/cms/notifications/commentNotification.js +31 -0
  48. package/plugins/cms/notifications/commentNotification.js.map +1 -0
  49. package/plugins/cms/notifications/contentReviewNotification.d.ts +1 -0
  50. package/plugins/cms/notifications/contentReviewNotification.js +31 -0
  51. package/plugins/cms/notifications/contentReviewNotification.js.map +1 -0
  52. package/plugins/cms/notifications/contentUrl.d.ts +8 -0
  53. package/plugins/cms/notifications/contentUrl.js +53 -0
  54. package/plugins/cms/notifications/contentUrl.js.map +1 -0
  55. package/plugins/cms/triggerContentReview.js +0 -14
  56. package/plugins/cms/triggerContentReview.js.map +1 -1
  57. package/plugins/cms/updateContentReviewStatus.js +0 -18
  58. package/plugins/cms/updateContentReviewStatus.js.map +1 -1
  59. package/plugins/cms/utils.js +2 -47
  60. package/plugins/cms/utils.js.map +1 -1
  61. package/plugins/context.js +0 -31
  62. package/plugins/context.js.map +1 -1
  63. package/plugins/graphql/changeRequest.gql.js +1 -8
  64. package/plugins/graphql/changeRequest.gql.js.map +1 -1
  65. package/plugins/graphql/comment.gql.js +1 -8
  66. package/plugins/graphql/comment.gql.js.map +1 -1
  67. package/plugins/graphql/contentReview.gql.js +1 -20
  68. package/plugins/graphql/contentReview.gql.js.map +1 -1
  69. package/plugins/graphql/reviewer.gql.js +3 -8
  70. package/plugins/graphql/reviewer.gql.js.map +1 -1
  71. package/plugins/graphql/workflow.gql.js +1 -8
  72. package/plugins/graphql/workflow.gql.js.map +1 -1
  73. package/plugins/graphql.js +1 -16
  74. package/plugins/graphql.js.map +1 -1
  75. package/plugins/hooks/createReviewerFromIdentity.js +26 -15
  76. package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
  77. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +1 -9
  78. package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
  79. package/plugins/hooks/deleteCommentsAfterChangeRequest.js +1 -8
  80. package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
  81. package/plugins/hooks/index.js +2 -13
  82. package/plugins/hooks/index.js.map +1 -1
  83. package/plugins/hooks/initializeContentReviewSteps.js +2 -15
  84. package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
  85. package/plugins/hooks/initializeNotifications.d.ts +2 -0
  86. package/plugins/hooks/initializeNotifications.js +15 -0
  87. package/plugins/hooks/initializeNotifications.js.map +1 -0
  88. package/plugins/hooks/listContentReviews.d.ts +1 -1
  89. package/plugins/hooks/listContentReviews.js +9 -33
  90. package/plugins/hooks/listContentReviews.js.map +1 -1
  91. package/plugins/hooks/notifications/appUrl.d.ts +2 -0
  92. package/plugins/hooks/notifications/appUrl.js +18 -0
  93. package/plugins/hooks/notifications/appUrl.js.map +1 -0
  94. package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
  95. package/plugins/hooks/notifications/changeRequestAfterCreate.js +116 -0
  96. package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -0
  97. package/plugins/hooks/notifications/changeRequestUrl.d.ts +8 -0
  98. package/plugins/hooks/notifications/changeRequestUrl.js +27 -0
  99. package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -0
  100. package/plugins/hooks/notifications/commentAfterCreate.d.ts +2 -0
  101. package/plugins/hooks/notifications/commentAfterCreate.js +127 -0
  102. package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -0
  103. package/plugins/hooks/notifications/commentUrl.d.ts +8 -0
  104. package/plugins/hooks/notifications/commentUrl.js +27 -0
  105. package/plugins/hooks/notifications/commentUrl.js.map +1 -0
  106. package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +2 -0
  107. package/plugins/hooks/notifications/contentReviewAfterCreate.js +99 -0
  108. package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -0
  109. package/plugins/hooks/notifications/contentReviewUrl.d.ts +7 -0
  110. package/plugins/hooks/notifications/contentReviewUrl.js +26 -0
  111. package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -0
  112. package/plugins/hooks/notifications/contentUrl.d.ts +7 -0
  113. package/plugins/hooks/notifications/contentUrl.js +24 -0
  114. package/plugins/hooks/notifications/contentUrl.js.map +1 -0
  115. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
  116. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +21 -0
  117. package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -0
  118. package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +11 -0
  119. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +21 -0
  120. package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -0
  121. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +11 -0
  122. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +21 -0
  123. package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -0
  124. package/plugins/hooks/notifications/reviewers.d.ts +15 -0
  125. package/plugins/hooks/notifications/reviewers.js +44 -0
  126. package/plugins/hooks/notifications/reviewers.js.map +1 -0
  127. package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +2 -0
  128. package/plugins/hooks/notifications/sendChangeRequestNotification.js +41 -0
  129. package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -0
  130. package/plugins/hooks/notifications/sendCommentNotification.d.ts +2 -0
  131. package/plugins/hooks/notifications/sendCommentNotification.js +41 -0
  132. package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -0
  133. package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +2 -0
  134. package/plugins/hooks/notifications/sendContentReviewNotification.js +41 -0
  135. package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
  136. package/plugins/hooks/updatePendingChangeRequests.js +0 -8
  137. package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
  138. package/plugins/hooks/updateTotalComments.js +0 -9
  139. package/plugins/hooks/updateTotalComments.js.map +1 -1
  140. package/plugins/hooks/validateChangeRequest.js +25 -16
  141. package/plugins/hooks/validateChangeRequest.js.map +1 -1
  142. package/plugins/hooks/validateComment.js +11 -12
  143. package/plugins/hooks/validateComment.js.map +1 -1
  144. package/plugins/hooks/validateContentReview.js +0 -6
  145. package/plugins/hooks/validateContentReview.js.map +1 -1
  146. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +0 -15
  147. package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
  148. package/plugins/pageBuilder/apwContentPagePlugins.js +0 -4
  149. package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
  150. package/plugins/pageBuilder/extendPbPageSettingsSchema.js +1 -6
  151. package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
  152. package/plugins/pageBuilder/index.js +5 -8
  153. package/plugins/pageBuilder/index.js.map +1 -1
  154. package/plugins/pageBuilder/linkContentReviewToPage.js +0 -16
  155. package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
  156. package/plugins/pageBuilder/linkWorkflowToPage.js +1 -31
  157. package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
  158. package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +1 -0
  159. package/plugins/pageBuilder/notifications/changeRequestNotification.js +31 -0
  160. package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -0
  161. package/plugins/pageBuilder/notifications/commentNotification.d.ts +1 -0
  162. package/plugins/pageBuilder/notifications/commentNotification.js +31 -0
  163. package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -0
  164. package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +1 -0
  165. package/plugins/pageBuilder/notifications/contentReviewNotification.js +31 -0
  166. package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -0
  167. package/plugins/pageBuilder/notifications/contentUrl.d.ts +1 -0
  168. package/plugins/pageBuilder/notifications/contentUrl.js +47 -0
  169. package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -0
  170. package/plugins/pageBuilder/triggerContentReview.js +0 -11
  171. package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
  172. package/plugins/pageBuilder/updateContentReviewStatus.js +0 -12
  173. package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
  174. package/plugins/pageBuilder/utils.js +1 -35
  175. package/plugins/pageBuilder/utils.js.map +1 -1
  176. package/plugins/utils.d.ts +0 -1
  177. package/plugins/utils.js +1 -50
  178. package/plugins/utils.js.map +1 -1
  179. package/scheduler/createScheduleActionMethods.js +1 -20
  180. package/scheduler/createScheduleActionMethods.js.map +1 -1
  181. package/scheduler/handlers/executeAction/index.js +9 -33
  182. package/scheduler/handlers/executeAction/index.js.map +1 -1
  183. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +0 -5
  184. package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
  185. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +0 -21
  186. package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
  187. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +4 -27
  188. package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
  189. package/scheduler/handlers/executeAction/security.js +0 -11
  190. package/scheduler/handlers/executeAction/security.js.map +1 -1
  191. package/scheduler/handlers/scheduleAction/index.js +5 -25
  192. package/scheduler/handlers/scheduleAction/index.js.map +1 -1
  193. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +2 -23
  194. package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
  195. package/scheduler/handlers/utils.js +3 -40
  196. package/scheduler/handlers/utils.js.map +1 -1
  197. package/scheduler/index.js +0 -3
  198. package/scheduler/index.js.map +1 -1
  199. package/scheduler/types.js +0 -6
  200. package/scheduler/types.js.map +1 -1
  201. package/storageOperations/changeRequestStorageOperations.js +0 -19
  202. package/storageOperations/changeRequestStorageOperations.js.map +1 -1
  203. package/storageOperations/commentStorageOperations.js +0 -21
  204. package/storageOperations/commentStorageOperations.js.map +1 -1
  205. package/storageOperations/contentReviewStorageOperations.js +0 -17
  206. package/storageOperations/contentReviewStorageOperations.js.map +1 -1
  207. package/storageOperations/index.js +0 -14
  208. package/storageOperations/index.js.map +1 -1
  209. package/storageOperations/models/changeRequest.model.js +0 -9
  210. package/storageOperations/models/changeRequest.model.js.map +1 -1
  211. package/storageOperations/models/comment.model.js +0 -8
  212. package/storageOperations/models/comment.model.js.map +1 -1
  213. package/storageOperations/models/contentModelPluginFactory.js +0 -5
  214. package/storageOperations/models/contentModelPluginFactory.js.map +1 -1
  215. package/storageOperations/models/contentReview.model.js +0 -26
  216. package/storageOperations/models/contentReview.model.js.map +1 -1
  217. package/storageOperations/models/index.js +2 -24
  218. package/storageOperations/models/index.js.map +1 -1
  219. package/storageOperations/models/reviewer.model.js +17 -9
  220. package/storageOperations/models/reviewer.model.js.map +1 -1
  221. package/storageOperations/models/utils.js +0 -4
  222. package/storageOperations/models/utils.js.map +1 -1
  223. package/storageOperations/models/workflow.model.js +0 -23
  224. package/storageOperations/models/workflow.model.js.map +1 -1
  225. package/storageOperations/reviewerStorageOperations.js +11 -20
  226. package/storageOperations/reviewerStorageOperations.js.map +1 -1
  227. package/storageOperations/workflowStorageOperations.js +0 -19
  228. package/storageOperations/workflowStorageOperations.js.map +1 -1
  229. package/types.d.ts +21 -9
  230. package/types.js +0 -14
  231. package/types.js.map +1 -1
  232. package/utils/contentApwSettingsPlugin.js +0 -6
  233. package/utils/contentApwSettingsPlugin.js.map +1 -1
  234. package/utils/errors.js +0 -17
  235. package/utils/errors.js.map +1 -1
  236. package/utils/fieldResolver.js +2 -12
  237. package/utils/fieldResolver.js.map +1 -1
  238. package/utils/resolve.js +0 -3
  239. package/utils/resolve.js.map +1 -1
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.validateContentReview = void 0;
9
-
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
9
  const validateContentReview = ({
13
10
  apw
14
11
  }) => {
@@ -21,11 +18,9 @@ const validateContentReview = ({
21
18
  /**
22
19
  * Check whether a contentReview already exists for provided content.
23
20
  */
24
-
25
21
  const {
26
22
  contentReviewId
27
23
  } = await apw.contentReview.isReviewRequired(content);
28
-
29
24
  if (contentReviewId) {
30
25
  throw new _error.default(`A peer review for this content has been already requested.`, "REVIEW_ALREADY_EXIST", {
31
26
  contentReviewId,
@@ -34,5 +29,4 @@ const validateContentReview = ({
34
29
  }
35
30
  });
36
31
  };
37
-
38
32
  exports.validateContentReview = validateContentReview;
@@ -1 +1 @@
1
- {"version":3,"names":["validateContentReview","apw","contentReview","onContentReviewBeforeCreate","subscribe","input","content","contentReviewId","isReviewRequired","WebinyError"],"sources":["validateContentReview.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { LifeCycleHookCallbackParams } from \"~/types\";\n\nexport const validateContentReview = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({ input }) => {\n const { content } = input;\n /**\n * Check whether a contentReview already exists for provided content.\n */\n const { contentReviewId } = await apw.contentReview.isReviewRequired(content);\n if (contentReviewId) {\n throw new WebinyError(\n `A peer review for this content has been already requested.`,\n \"REVIEW_ALREADY_EXIST\",\n {\n contentReviewId,\n content\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AAGO,MAAMA,qBAAqB,GAAG,CAAC;EAAEC;AAAF,CAAD,KAAuD;EACxFA,GAAG,CAACC,aAAJ,CAAkBC,2BAAlB,CAA8CC,SAA9C,CAAwD,OAAO;IAAEC;EAAF,CAAP,KAAqB;IACzE,MAAM;MAAEC;IAAF,IAAcD,KAApB;IACA;AACR;AACA;;IACQ,MAAM;MAAEE;IAAF,IAAsB,MAAMN,GAAG,CAACC,aAAJ,CAAkBM,gBAAlB,CAAmCF,OAAnC,CAAlC;;IACA,IAAIC,eAAJ,EAAqB;MACjB,MAAM,IAAIE,cAAJ,CACD,4DADC,EAEF,sBAFE,EAGF;QACIF,eADJ;QAEID;MAFJ,CAHE,CAAN;IAQH;EACJ,CAhBD;AAiBH,CAlBM"}
1
+ {"version":3,"names":["validateContentReview","apw","contentReview","onContentReviewBeforeCreate","subscribe","input","content","contentReviewId","isReviewRequired","WebinyError"],"sources":["validateContentReview.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { LifeCycleHookCallbackParams } from \"~/types\";\n\nexport const validateContentReview = ({ apw }: Pick<LifeCycleHookCallbackParams, \"apw\">) => {\n apw.contentReview.onContentReviewBeforeCreate.subscribe(async ({ input }) => {\n const { content } = input;\n /**\n * Check whether a contentReview already exists for provided content.\n */\n const { contentReviewId } = await apw.contentReview.isReviewRequired(content);\n if (contentReviewId) {\n throw new WebinyError(\n `A peer review for this content has been already requested.`,\n \"REVIEW_ALREADY_EXIST\",\n {\n contentReviewId,\n content\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;AAAA;AAGO,MAAMA,qBAAqB,GAAG,CAAC;EAAEC;AAA8C,CAAC,KAAK;EACxFA,GAAG,CAACC,aAAa,CAACC,2BAA2B,CAACC,SAAS,CAAC,OAAO;IAAEC;EAAM,CAAC,KAAK;IACzE,MAAM;MAAEC;IAAQ,CAAC,GAAGD,KAAK;IACzB;AACR;AACA;IACQ,MAAM;MAAEE;IAAgB,CAAC,GAAG,MAAMN,GAAG,CAACC,aAAa,CAACM,gBAAgB,CAACF,OAAO,CAAC;IAC7E,IAAIC,eAAe,EAAE;MACjB,MAAM,IAAIE,cAAW,CAChB,4DAA2D,EAC5D,sBAAsB,EACtB;QACIF,eAAe;QACfD;MACJ,CAAC,CACJ;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,51 +1,36 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.PageApwSettingsGetterPlugin = void 0;
9
-
10
8
  var _ContentApwSettingsPlugin = require("../../ContentApwSettingsPlugin");
11
-
12
9
  var _types = require("../../types");
13
-
14
10
  var _set = _interopRequireDefault(require("lodash/set"));
15
-
16
11
  class PageApwSettingsGetterPlugin extends _ContentApwSettingsPlugin.ContentApwSettingsPlugin {
17
12
  canUse(type) {
18
13
  return type === _types.ApwContentTypes.PAGE;
19
14
  }
20
-
21
15
  setWorkflowId(page, id) {
22
16
  page.settings = (0, _set.default)(page.settings || {}, "apw.workflowId", id);
23
17
  }
24
-
25
18
  getWorkflowId(page) {
26
19
  var _page$settings$apw;
27
-
28
20
  if (!page.settings) {
29
21
  return null;
30
22
  }
31
-
32
23
  return ((_page$settings$apw = page.settings.apw) === null || _page$settings$apw === void 0 ? void 0 : _page$settings$apw.workflowId) || null;
33
24
  }
34
-
35
25
  setContentReviewId(page, id) {
36
26
  page.settings = (0, _set.default)(page.settings || {}, "apw.contentReviewId", id);
37
27
  }
38
-
39
28
  getContentReviewId(page) {
40
29
  var _page$settings$apw2;
41
-
42
30
  if (!page.settings) {
43
31
  return null;
44
32
  }
45
-
46
33
  return (_page$settings$apw2 = page.settings.apw) === null || _page$settings$apw2 === void 0 ? void 0 : _page$settings$apw2.contentReviewId;
47
34
  }
48
-
49
35
  }
50
-
51
36
  exports.PageApwSettingsGetterPlugin = PageApwSettingsGetterPlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["PageApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","PAGE","setWorkflowId","page","id","settings","set","getWorkflowId","apw","workflowId","setContentReviewId","getContentReviewId","contentReviewId"],"sources":["PageApwSettingsGetterPlugin.ts"],"sourcesContent":["import { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { ApwContentTypes, PageWithWorkflow } from \"~/types\";\nimport set from \"lodash/set\";\n\nexport class PageApwSettingsGetterPlugin extends ContentApwSettingsPlugin {\n public override canUse(type: ApwContentTypes): boolean {\n return type === ApwContentTypes.PAGE;\n }\n\n public override setWorkflowId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.workflowId\", id);\n }\n\n public override getWorkflowId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.workflowId || null;\n }\n\n public override setContentReviewId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.contentReviewId\", id);\n }\n\n public override getContentReviewId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.contentReviewId;\n }\n}\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEO,MAAMA,2BAAN,SAA0CC,kDAA1C,CAAmE;EACtDC,MAAM,CAACC,IAAD,EAAiC;IACnD,OAAOA,IAAI,KAAKC,sBAAA,CAAgBC,IAAhC;EACH;;EAEeC,aAAa,CAACC,IAAD,EAAyBC,EAAzB,EAA4C;IACrED,IAAI,CAACE,QAAL,GAAgB,IAAAC,YAAA,EAAIH,IAAI,CAACE,QAAL,IAAiB,EAArB,EAAyB,gBAAzB,EAA2CD,EAA3C,CAAhB;EACH;;EAEeG,aAAa,CAACJ,IAAD,EAAwC;IAAA;;IACjE,IAAI,CAACA,IAAI,CAACE,QAAV,EAAoB;MAChB,OAAO,IAAP;IACH;;IACD,OAAO,uBAAAF,IAAI,CAACE,QAAL,CAAcG,GAAd,0EAAmBC,UAAnB,KAAiC,IAAxC;EACH;;EAEeC,kBAAkB,CAACP,IAAD,EAAyBC,EAAzB,EAA4C;IAC1ED,IAAI,CAACE,QAAL,GAAgB,IAAAC,YAAA,EAAIH,IAAI,CAACE,QAAL,IAAiB,EAArB,EAAyB,qBAAzB,EAAgDD,EAAhD,CAAhB;EACH;;EAEeO,kBAAkB,CAACR,IAAD,EAAwC;IAAA;;IACtE,IAAI,CAACA,IAAI,CAACE,QAAV,EAAoB;MAChB,OAAO,IAAP;IACH;;IACD,8BAAOF,IAAI,CAACE,QAAL,CAAcG,GAArB,wDAAO,oBAAmBI,eAA1B;EACH;;AAzBqE"}
1
+ {"version":3,"names":["PageApwSettingsGetterPlugin","ContentApwSettingsPlugin","canUse","type","ApwContentTypes","PAGE","setWorkflowId","page","id","settings","set","getWorkflowId","apw","workflowId","setContentReviewId","getContentReviewId","contentReviewId"],"sources":["PageApwSettingsGetterPlugin.ts"],"sourcesContent":["import { ContentApwSettingsPlugin } from \"~/ContentApwSettingsPlugin\";\nimport { ApwContentTypes, PageWithWorkflow } from \"~/types\";\nimport set from \"lodash/set\";\n\nexport class PageApwSettingsGetterPlugin extends ContentApwSettingsPlugin {\n public override canUse(type: ApwContentTypes): boolean {\n return type === ApwContentTypes.PAGE;\n }\n\n public override setWorkflowId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.workflowId\", id);\n }\n\n public override getWorkflowId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.workflowId || null;\n }\n\n public override setContentReviewId(page: PageWithWorkflow, id: string | null) {\n page.settings = set(page.settings || {}, \"apw.contentReviewId\", id);\n }\n\n public override getContentReviewId(page: PageWithWorkflow): string | null {\n if (!page.settings) {\n return null;\n }\n return page.settings.apw?.contentReviewId;\n }\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAEO,MAAMA,2BAA2B,SAASC,kDAAwB,CAAC;EACtDC,MAAM,CAACC,IAAqB,EAAW;IACnD,OAAOA,IAAI,KAAKC,sBAAe,CAACC,IAAI;EACxC;EAEgBC,aAAa,CAACC,IAAsB,EAAEC,EAAiB,EAAE;IACrED,IAAI,CAACE,QAAQ,GAAG,IAAAC,YAAG,EAACH,IAAI,CAACE,QAAQ,IAAI,CAAC,CAAC,EAAE,gBAAgB,EAAED,EAAE,CAAC;EAClE;EAEgBG,aAAa,CAACJ,IAAsB,EAAiB;IAAA;IACjE,IAAI,CAACA,IAAI,CAACE,QAAQ,EAAE;MAChB,OAAO,IAAI;IACf;IACA,OAAO,uBAAAF,IAAI,CAACE,QAAQ,CAACG,GAAG,uDAAjB,mBAAmBC,UAAU,KAAI,IAAI;EAChD;EAEgBC,kBAAkB,CAACP,IAAsB,EAAEC,EAAiB,EAAE;IAC1ED,IAAI,CAACE,QAAQ,GAAG,IAAAC,YAAG,EAACH,IAAI,CAACE,QAAQ,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAED,EAAE,CAAC;EACvE;EAEgBO,kBAAkB,CAACR,IAAsB,EAAiB;IAAA;IACtE,IAAI,CAACA,IAAI,CAACE,QAAQ,EAAE;MAChB,OAAO,IAAI;IACf;IACA,8BAAOF,IAAI,CAACE,QAAQ,CAACG,GAAG,wDAAjB,oBAAmBI,eAAe;EAC7C;AACJ;AAAC"}
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.apwContentPagePlugins = void 0;
7
-
8
7
  var _api = require("@webiny/api");
9
-
10
8
  var _types = require("../../types");
11
-
12
9
  const apwContentPagePlugins = () => new _api.ContextPlugin(async context => {
13
10
  const {
14
11
  apw,
@@ -26,5 +23,4 @@ const apwContentPagePlugins = () => new _api.ContextPlugin(async context => {
26
23
  return true;
27
24
  });
28
25
  });
29
-
30
26
  exports.apwContentPagePlugins = apwContentPagePlugins;
@@ -1 +1 @@
1
- {"version":3,"names":["apwContentPagePlugins","ContextPlugin","context","apw","pageBuilder","addContentGetter","ApwContentTypes","PAGE","id","getPage","addContentPublisher","publishPage","addContentUnPublisher","unpublishPage"],"sources":["apwContentPagePlugins.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { ApwContentTypes, ApwContext, PageWithWorkflow } from \"~/types\";\n\nexport const apwContentPagePlugins = () =>\n new ContextPlugin<ApwContext>(async context => {\n const { apw, pageBuilder } = context;\n\n apw.addContentGetter(ApwContentTypes.PAGE, async id => {\n return pageBuilder.getPage<PageWithWorkflow>(id);\n });\n\n apw.addContentPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.publishPage<PageWithWorkflow>(id);\n return true;\n });\n\n apw.addContentUnPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.unpublishPage<PageWithWorkflow>(id);\n return true;\n });\n });\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEO,MAAMA,qBAAqB,GAAG,MACjC,IAAIC,kBAAJ,CAA8B,MAAMC,OAAN,IAAiB;EAC3C,MAAM;IAAEC,GAAF;IAAOC;EAAP,IAAuBF,OAA7B;EAEAC,GAAG,CAACE,gBAAJ,CAAqBC,sBAAA,CAAgBC,IAArC,EAA2C,MAAMC,EAAN,IAAY;IACnD,OAAOJ,WAAW,CAACK,OAAZ,CAAsCD,EAAtC,CAAP;EACH,CAFD;EAIAL,GAAG,CAACO,mBAAJ,CAAwBJ,sBAAA,CAAgBC,IAAxC,EAA8C,MAAMC,EAAN,IAAY;IACtD,MAAMJ,WAAW,CAACO,WAAZ,CAA0CH,EAA1C,CAAN;IACA,OAAO,IAAP;EACH,CAHD;EAKAL,GAAG,CAACS,qBAAJ,CAA0BN,sBAAA,CAAgBC,IAA1C,EAAgD,MAAMC,EAAN,IAAY;IACxD,MAAMJ,WAAW,CAACS,aAAZ,CAA4CL,EAA5C,CAAN;IACA,OAAO,IAAP;EACH,CAHD;AAIH,CAhBD,CADG"}
1
+ {"version":3,"names":["apwContentPagePlugins","ContextPlugin","context","apw","pageBuilder","addContentGetter","ApwContentTypes","PAGE","id","getPage","addContentPublisher","publishPage","addContentUnPublisher","unpublishPage"],"sources":["apwContentPagePlugins.ts"],"sourcesContent":["import { ContextPlugin } from \"@webiny/api\";\nimport { ApwContentTypes, ApwContext, PageWithWorkflow } from \"~/types\";\n\nexport const apwContentPagePlugins = () =>\n new ContextPlugin<ApwContext>(async context => {\n const { apw, pageBuilder } = context;\n\n apw.addContentGetter(ApwContentTypes.PAGE, async id => {\n return pageBuilder.getPage<PageWithWorkflow>(id);\n });\n\n apw.addContentPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.publishPage<PageWithWorkflow>(id);\n return true;\n });\n\n apw.addContentUnPublisher(ApwContentTypes.PAGE, async id => {\n await pageBuilder.unpublishPage<PageWithWorkflow>(id);\n return true;\n });\n });\n"],"mappings":";;;;;;AAAA;AACA;AAEO,MAAMA,qBAAqB,GAAG,MACjC,IAAIC,kBAAa,CAAa,MAAMC,OAAO,IAAI;EAC3C,MAAM;IAAEC,GAAG;IAAEC;EAAY,CAAC,GAAGF,OAAO;EAEpCC,GAAG,CAACE,gBAAgB,CAACC,sBAAe,CAACC,IAAI,EAAE,MAAMC,EAAE,IAAI;IACnD,OAAOJ,WAAW,CAACK,OAAO,CAAmBD,EAAE,CAAC;EACpD,CAAC,CAAC;EAEFL,GAAG,CAACO,mBAAmB,CAACJ,sBAAe,CAACC,IAAI,EAAE,MAAMC,EAAE,IAAI;IACtD,MAAMJ,WAAW,CAACO,WAAW,CAAmBH,EAAE,CAAC;IACnD,OAAO,IAAI;EACf,CAAC,CAAC;EAEFL,GAAG,CAACS,qBAAqB,CAACN,sBAAe,CAACC,IAAI,EAAE,MAAMC,EAAE,IAAI;IACxD,MAAMJ,WAAW,CAACS,aAAa,CAAmBL,EAAE,CAAC;IACrD,OAAO,IAAI;EACf,CAAC,CAAC;AACN,CAAC,CAAC;AAAC"}
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.extendPbPageSettingsSchema = void 0;
7
-
8
7
  var _plugins = require("@webiny/handler-graphql/plugins");
9
-
10
8
  const extendPbPageSettingsSchema = () => new _plugins.GraphQLSchemaPlugin({
11
- typeDefs:
12
- /* GraphQL */
13
- `
9
+ typeDefs: /* GraphQL */`
14
10
  type PbApwPageSettings {
15
11
  workflowId: ID
16
12
  contentReviewId: ID
@@ -21,5 +17,4 @@ const extendPbPageSettingsSchema = () => new _plugins.GraphQLSchemaPlugin({
21
17
  }
22
18
  `
23
19
  });
24
-
25
20
  exports.extendPbPageSettingsSchema = extendPbPageSettingsSchema;
@@ -1 +1 @@
1
- {"version":3,"names":["extendPbPageSettingsSchema","GraphQLSchemaPlugin","typeDefs"],"sources":["extendPbPageSettingsSchema.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ApwContext } from \"~/types\";\n\nexport const extendPbPageSettingsSchema = () =>\n new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type PbApwPageSettings {\n workflowId: ID\n contentReviewId: ID\n }\n\n extend type PbPageSettings {\n apw: PbApwPageSettings\n }\n `\n });\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,0BAA0B,GAAG,MACtC,IAAIC,4BAAJ,CAAoC;EAChCC,QAAQ;EAAE;EAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVwC,CAApC,CADG"}
1
+ {"version":3,"names":["extendPbPageSettingsSchema","GraphQLSchemaPlugin","typeDefs"],"sources":["extendPbPageSettingsSchema.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { ApwContext } from \"~/types\";\n\nexport const extendPbPageSettingsSchema = () =>\n new GraphQLSchemaPlugin<ApwContext>({\n typeDefs: /* GraphQL */ `\n type PbApwPageSettings {\n workflowId: ID\n contentReviewId: ID\n }\n\n extend type PbPageSettings {\n apw: PbApwPageSettings\n }\n `\n });\n"],"mappings":";;;;;;AAAA;AAGO,MAAMA,0BAA0B,GAAG,MACtC,IAAIC,4BAAmB,CAAa;EAChCC,QAAQ,EAAE,aAAe;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACI,CAAC,CAAC;AAAC"}
@@ -4,17 +4,15 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.apwPageBuilderHooks = void 0;
7
-
8
7
  var _triggerContentReview = require("./triggerContentReview");
9
-
10
8
  var _linkContentReviewToPage = require("./linkContentReviewToPage");
11
-
12
9
  var _updateContentReviewStatus = require("./updateContentReviewStatus");
13
-
14
10
  var _linkWorkflowToPage = require("./linkWorkflowToPage");
15
-
16
11
  var _PageApwSettingsGetterPlugin = require("./PageApwSettingsGetterPlugin");
17
-
12
+ var _commentNotification = require("./notifications/commentNotification");
13
+ var _contentUrl = require("./notifications/contentUrl");
14
+ var _changeRequestNotification = require("./notifications/changeRequestNotification");
15
+ var _contentReviewNotification = require("./notifications/contentReviewNotification");
18
16
  const apwPageBuilderHooks = params => {
19
17
  const {
20
18
  pageBuilder,
@@ -22,7 +20,7 @@ const apwPageBuilderHooks = params => {
22
20
  security,
23
21
  plugins
24
22
  } = params;
25
- plugins.register(new _PageApwSettingsGetterPlugin.PageApwSettingsGetterPlugin());
23
+ plugins.register([new _PageApwSettingsGetterPlugin.PageApwSettingsGetterPlugin(), (0, _commentNotification.createCommentNotification)(), (0, _changeRequestNotification.createChangeRequestNotification)(), (0, _contentUrl.createContentUrlPlugin)(), (0, _contentReviewNotification.createContentReviewNotification)()]);
26
24
  (0, _triggerContentReview.triggerContentReview)({
27
25
  apw,
28
26
  pageBuilder
@@ -41,5 +39,4 @@ const apwPageBuilderHooks = params => {
41
39
  pageBuilder
42
40
  });
43
41
  };
44
-
45
42
  exports.apwPageBuilderHooks = apwPageBuilderHooks;
@@ -1 +1 @@
1
- {"version":3,"names":["apwPageBuilderHooks","params","pageBuilder","apw","security","plugins","register","PageApwSettingsGetterPlugin","triggerContentReview","linkContentReviewToPage","updateContentReviewStatus","linkWorkflowToPage"],"sources":["index.ts"],"sourcesContent":["import { Security } from \"@webiny/api-security/types\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { AdvancedPublishingWorkflow } from \"~/types\";\nimport { triggerContentReview } from \"./triggerContentReview\";\nimport { linkContentReviewToPage } from \"./linkContentReviewToPage\";\nimport { updateContentReviewStatus } from \"./updateContentReviewStatus\";\nimport { linkWorkflowToPage } from \"./linkWorkflowToPage\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { PageApwSettingsGetterPlugin } from \"~/plugins/pageBuilder/PageApwSettingsGetterPlugin\";\n\nexport interface ApwPageBuilderPluginsParams {\n pageBuilder: PageBuilderContextObject;\n apw: AdvancedPublishingWorkflow;\n security: Security;\n plugins: PluginsContainer;\n}\n\nexport const apwPageBuilderHooks = (params: ApwPageBuilderPluginsParams) => {\n const { pageBuilder, apw, security, plugins } = params;\n\n plugins.register(new PageApwSettingsGetterPlugin());\n\n triggerContentReview({\n apw,\n pageBuilder\n });\n linkContentReviewToPage({\n apw,\n pageBuilder\n });\n updateContentReviewStatus({\n apw,\n pageBuilder,\n security\n });\n linkWorkflowToPage({\n apw,\n pageBuilder\n });\n};\n"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AAEA;;AASO,MAAMA,mBAAmB,GAAIC,MAAD,IAAyC;EACxE,MAAM;IAAEC,WAAF;IAAeC,GAAf;IAAoBC,QAApB;IAA8BC;EAA9B,IAA0CJ,MAAhD;EAEAI,OAAO,CAACC,QAAR,CAAiB,IAAIC,wDAAJ,EAAjB;EAEA,IAAAC,0CAAA,EAAqB;IACjBL,GADiB;IAEjBD;EAFiB,CAArB;EAIA,IAAAO,gDAAA,EAAwB;IACpBN,GADoB;IAEpBD;EAFoB,CAAxB;EAIA,IAAAQ,oDAAA,EAA0B;IACtBP,GADsB;IAEtBD,WAFsB;IAGtBE;EAHsB,CAA1B;EAKA,IAAAO,sCAAA,EAAmB;IACfR,GADe;IAEfD;EAFe,CAAnB;AAIH,CAtBM"}
1
+ {"version":3,"names":["apwPageBuilderHooks","params","pageBuilder","apw","security","plugins","register","PageApwSettingsGetterPlugin","createCommentNotification","createChangeRequestNotification","createContentUrlPlugin","createContentReviewNotification","triggerContentReview","linkContentReviewToPage","updateContentReviewStatus","linkWorkflowToPage"],"sources":["index.ts"],"sourcesContent":["import { Security } from \"@webiny/api-security/types\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\nimport { AdvancedPublishingWorkflow } from \"~/types\";\nimport { triggerContentReview } from \"./triggerContentReview\";\nimport { linkContentReviewToPage } from \"./linkContentReviewToPage\";\nimport { updateContentReviewStatus } from \"./updateContentReviewStatus\";\nimport { linkWorkflowToPage } from \"./linkWorkflowToPage\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { PageApwSettingsGetterPlugin } from \"~/plugins/pageBuilder/PageApwSettingsGetterPlugin\";\nimport { createCommentNotification } from \"./notifications/commentNotification\";\nimport { createContentUrlPlugin } from \"./notifications/contentUrl\";\nimport { createChangeRequestNotification } from \"./notifications/changeRequestNotification\";\nimport { createContentReviewNotification } from \"./notifications/contentReviewNotification\";\n\nexport interface ApwPageBuilderPluginsParams {\n pageBuilder: PageBuilderContextObject;\n apw: AdvancedPublishingWorkflow;\n security: Security;\n plugins: PluginsContainer;\n}\n\nexport const apwPageBuilderHooks = (params: ApwPageBuilderPluginsParams) => {\n const { pageBuilder, apw, security, plugins } = params;\n\n plugins.register([\n new PageApwSettingsGetterPlugin(),\n createCommentNotification(),\n createChangeRequestNotification(),\n createContentUrlPlugin(),\n createContentReviewNotification()\n ]);\n\n triggerContentReview({\n apw,\n pageBuilder\n });\n linkContentReviewToPage({\n apw,\n pageBuilder\n });\n updateContentReviewStatus({\n apw,\n pageBuilder,\n security\n });\n linkWorkflowToPage({\n apw,\n pageBuilder\n });\n};\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AASO,MAAMA,mBAAmB,GAAIC,MAAmC,IAAK;EACxE,MAAM;IAAEC,WAAW;IAAEC,GAAG;IAAEC,QAAQ;IAAEC;EAAQ,CAAC,GAAGJ,MAAM;EAEtDI,OAAO,CAACC,QAAQ,CAAC,CACb,IAAIC,wDAA2B,EAAE,EACjC,IAAAC,8CAAyB,GAAE,EAC3B,IAAAC,0DAA+B,GAAE,EACjC,IAAAC,kCAAsB,GAAE,EACxB,IAAAC,0DAA+B,GAAE,CACpC,CAAC;EAEF,IAAAC,0CAAoB,EAAC;IACjBT,GAAG;IACHD;EACJ,CAAC,CAAC;EACF,IAAAW,gDAAuB,EAAC;IACpBV,GAAG;IACHD;EACJ,CAAC,CAAC;EACF,IAAAY,oDAAyB,EAAC;IACtBX,GAAG;IACHD,WAAW;IACXE;EACJ,CAAC,CAAC;EACF,IAAAW,sCAAkB,EAAC;IACfZ,GAAG;IACHD;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.linkContentReviewToPage = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
10
  var _types = require("../../types");
15
-
16
11
  var _utils = require("./utils");
17
-
18
12
  const linkContentReviewToPage = params => {
19
13
  const {
20
14
  apw,
@@ -26,11 +20,9 @@ const linkContentReviewToPage = params => {
26
20
  const {
27
21
  content
28
22
  } = contentReview;
29
-
30
23
  if (content.type !== _types.ApwContentTypes.PAGE) {
31
24
  return;
32
25
  }
33
-
34
26
  await (0, _utils.updatePageSettings)({
35
27
  getPage: pageBuilder.getPage,
36
28
  updatePage: pageBuilder.updatePage,
@@ -50,11 +42,9 @@ const linkContentReviewToPage = params => {
50
42
  const {
51
43
  content
52
44
  } = contentReview;
53
-
54
45
  if (content.type !== _types.ApwContentTypes.PAGE) {
55
46
  return;
56
47
  }
57
-
58
48
  await (0, _utils.updatePageSettings)({
59
49
  getPage: pageBuilder.getPage,
60
50
  updatePage: pageBuilder.updatePage,
@@ -72,15 +62,11 @@ const linkContentReviewToPage = params => {
72
62
  page
73
63
  }) => {
74
64
  var _page$settings, _page$settings$apw;
75
-
76
65
  const contentReviewId = (_page$settings = page.settings) === null || _page$settings === void 0 ? void 0 : (_page$settings$apw = _page$settings.apw) === null || _page$settings$apw === void 0 ? void 0 : _page$settings$apw.contentReviewId;
77
-
78
66
  if (!contentReviewId) {
79
67
  return;
80
68
  }
81
-
82
69
  let contentReview;
83
-
84
70
  try {
85
71
  contentReview = await apw.contentReview.get(contentReviewId);
86
72
  } catch (ex) {
@@ -92,7 +78,6 @@ const linkContentReviewToPage = params => {
92
78
  throw ex;
93
79
  }
94
80
  }
95
-
96
81
  if (contentReview) {
97
82
  throw new _error.default(`Cannot delete the page because a peer review has been requested. Please delete the review first.`, "CANNOT_DELETE_REVIEW_EXIST", {
98
83
  contentReviewId,
@@ -101,5 +86,4 @@ const linkContentReviewToPage = params => {
101
86
  }
102
87
  });
103
88
  };
104
-
105
89
  exports.linkContentReviewToPage = linkContentReviewToPage;
@@ -1 +1 @@
1
- {"version":3,"names":["linkContentReviewToPage","params","apw","pageBuilder","contentReview","onContentReviewAfterCreate","subscribe","content","type","ApwContentTypes","PAGE","updatePageSettings","getPage","updatePage","uniquePageId","id","getNewSettings","settings","contentReviewId","onContentReviewAfterDelete","onPageBeforeDelete","page","get","ex","code","Error"],"sources":["linkContentReviewToPage.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport { AdvancedPublishingWorkflow, ApwContentTypes } from \"~/types\";\nimport { updatePageSettings } from \"./utils\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\n\ninterface LinkContentReviewToPageParams {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n}\n\nexport const linkContentReviewToPage = (params: LinkContentReviewToPageParams) => {\n const { apw, pageBuilder } = params;\n\n apw.contentReview.onContentReviewAfterCreate.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n\n if (content.type !== ApwContentTypes.PAGE) {\n return;\n }\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: content.id,\n getNewSettings: settings => {\n return {\n ...settings,\n apw: {\n ...(settings.apw || {}),\n contentReviewId: contentReview.id\n }\n };\n }\n });\n });\n\n apw.contentReview.onContentReviewAfterDelete.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n\n if (content.type !== ApwContentTypes.PAGE) {\n return;\n }\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: content.id,\n getNewSettings: settings => {\n return {\n ...settings,\n apw: {\n ...(settings.apw || {}),\n contentReviewId: null\n }\n };\n }\n });\n });\n\n pageBuilder.onPageBeforeDelete.subscribe(async ({ page }) => {\n const contentReviewId = page.settings?.apw?.contentReviewId;\n if (!contentReviewId) {\n return;\n }\n\n let contentReview;\n try {\n contentReview = await apw.contentReview.get(contentReviewId);\n } catch (ex) {\n /**\n * We're handling the case whereby \"contentReviewId\" is still linked to page;\n * even when the contentReview entry has been deleted. In that case, we'll allow page deletion.\n */\n if (ex.code !== \"NOT_FOUND\") {\n throw ex;\n }\n }\n\n if (contentReview) {\n throw new Error(\n `Cannot delete the page because a peer review has been requested. Please delete the review first.`,\n \"CANNOT_DELETE_REVIEW_EXIST\",\n {\n contentReviewId,\n page\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AAQO,MAAMA,uBAAuB,GAAIC,MAAD,IAA2C;EAC9E,MAAM;IAAEC,GAAF;IAA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MH,eAAe,qBAAGG,IAAI,CAACJ,QAAR,yEAAG,eAAef,GAAlB,uDAAG,mBAAoBgB,eAA5C;;IACA,IAAI,CAACA,eAAL,EAAsB;MAClB;IACH;;IAED,IAAId,aAAJ;;IACA,IAAI;MACAA,aAAa,GAAG,MAAMF,GAAG,CAACE,aAAJ,CAAkBkB,GAAlB,CAAsBJ,eAAtB,CAAtB;IACH,CAFD,CAEE,OAAOK,EAAP,EAAW;MACT;AACZ;AACA;AACA;MACY,IAAIA,EAAE,CAACC,IAAH,KAAY,WAAhB,EAA6B;QACzB,MAAMD,EAAN;MACH;IACJ;;IAED,IAAInB,aAAJ,EAAmB;MACf,MAAM,IAAIqB,cAAJ,CACD,kGADC,EAEF,4BAFE,EAGF;QACIP,eADJ;QAEIG;MAFJ,CAHE,CAAN;IAQH;EACJ,CA7BD;AA8BH,CA7EM"}
1
+ {"version":3,"names":["linkContentReviewToPage","params","apw","pageBuilder","contentReview","onContentReviewAfterCreate","subscribe","content","type","ApwContentTypes","PAGE","updatePageSettings","getPage","updatePage","uniquePageId","id","getNewSettings","settings","contentReviewId","onContentReviewAfterDelete","onPageBeforeDelete","page","get","ex","code","Error"],"sources":["linkContentReviewToPage.ts"],"sourcesContent":["import Error from \"@webiny/error\";\nimport { AdvancedPublishingWorkflow, ApwContentTypes } from \"~/types\";\nimport { updatePageSettings } from \"./utils\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\n\ninterface LinkContentReviewToPageParams {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n}\n\nexport const linkContentReviewToPage = (params: LinkContentReviewToPageParams) => {\n const { apw, pageBuilder } = params;\n\n apw.contentReview.onContentReviewAfterCreate.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n\n if (content.type !== ApwContentTypes.PAGE) {\n return;\n }\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: content.id,\n getNewSettings: settings => {\n return {\n ...settings,\n apw: {\n ...(settings.apw || {}),\n contentReviewId: contentReview.id\n }\n };\n }\n });\n });\n\n apw.contentReview.onContentReviewAfterDelete.subscribe(async ({ contentReview }) => {\n const { content } = contentReview;\n\n if (content.type !== ApwContentTypes.PAGE) {\n return;\n }\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: content.id,\n getNewSettings: settings => {\n return {\n ...settings,\n apw: {\n ...(settings.apw || {}),\n contentReviewId: null\n }\n };\n }\n });\n });\n\n pageBuilder.onPageBeforeDelete.subscribe(async ({ page }) => {\n const contentReviewId = page.settings?.apw?.contentReviewId;\n if (!contentReviewId) {\n return;\n }\n\n let contentReview;\n try {\n contentReview = await apw.contentReview.get(contentReviewId);\n } catch (ex) {\n /**\n * We're handling the case whereby \"contentReviewId\" is still linked to page;\n * even when the contentReview entry has been deleted. In that case, we'll allow page deletion.\n */\n if (ex.code !== \"NOT_FOUND\") {\n throw ex;\n }\n }\n\n if (contentReview) {\n throw new Error(\n `Cannot delete the page because a peer review has been requested. Please delete the review first.`,\n \"CANNOT_DELETE_REVIEW_EXIST\",\n {\n contentReviewId,\n page\n }\n );\n }\n });\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AAQO,MAAMA,uBAAuB,GAAIC,MAAqC,IAAK;EAC9E,MAAM;IAAEC,GAAG;IAAEC;EAAY,CAAC,GAAGF,MAAM;EAEnCC,GAAG,CAACE,aAAa,CAACC,0BAA0B,CAACC,SAAS,CAAC,OAAO;IAAEF;EAAc,CAAC,KAAK;IAChF,MAAM;MAAEG;IAAQ,CAAC,GAAGH,aAAa;IAEjC,IAAIG,OAAO,CAACC,IAAI,KAAKC,sBAAe,CAACC,IAAI,EAAE;MACvC;IACJ;IACA,MAAM,IAAAC,yBAAkB,EAAC;MACrBC,OAAO,EAAET,WAAW,CAACS,OAAO;MAC5BC,UAAU,EAAEV,WAAW,CAACU,UAAU;MAClCC,YAAY,EAAEP,OAAO,C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a,EAAE;MACf,MAAM,IAAIqB,cAAK,CACV,kGAAiG,EAClG,4BAA4B,EAC5B;QACIP,eAAe;QACfG;MACJ,CAAC,CACJ;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.linkWorkflowToPage = void 0;
9
-
10
8
  var _get = _interopRequireDefault(require("lodash/get"));
11
-
12
9
  var _set = _interopRequireDefault(require("lodash/set"));
13
-
14
10
  var _types = require("../../types");
15
-
16
11
  var _utils = require("./utils");
17
-
18
12
  const linkWorkflowToPage = params => {
19
13
  const {
20
14
  apw,
@@ -37,28 +31,22 @@ const linkWorkflowToPage = params => {
37
31
  * If the previous revision(original) already had the "contentReviewId",
38
32
  * we need to unlink it so that new "contentReview" can be request for the new revision.
39
33
  */
40
-
41
34
  const previousContentReviewId = (0, _get.default)(original, "settings.apw.contentReviewId");
42
-
43
35
  if (previousContentReviewId) {
44
36
  page.settings.apw.contentReviewId = null;
45
37
  }
38
+
46
39
  /**
47
40
  * If the previous revision(original) already had the "workflowId",
48
41
  * we don't need to do anything we'll just let it be copied over.
49
42
  */
50
-
51
-
52
43
  const previousWorkflowId = (0, _get.default)(original, "settings.apw.workflowId");
53
-
54
44
  if (previousWorkflowId) {
55
45
  return;
56
46
  }
57
47
  /**
58
48
  * Lookup and assign "workflowId".
59
49
  */
60
-
61
-
62
50
  await (0, _utils.assignWorkflowToPage)({
63
51
  listWorkflow: apw.workflow.list,
64
52
  page
@@ -76,7 +64,6 @@ const linkWorkflowToPage = params => {
76
64
  * It can happen because we run modal validation in "onBeforePageUpdate" event,
77
65
  * which doesn't have the "apw" property.
78
66
  */
79
-
80
67
  if (prevApwWorkflowId && !currentApwWorkflowId) {
81
68
  page.settings.apw = original.settings.apw;
82
69
  }
@@ -84,12 +71,9 @@ const linkWorkflowToPage = params => {
84
71
  * If there is a linked "contentReview" for this page and the page "title" has changed.
85
72
  * Let's update the "title" field in "contentReview".
86
73
  */
87
-
88
-
89
74
  const linkedContentReviewId = (0, _get.default)(page, "settings.apw.contentReviewId");
90
75
  const prevTitle = (0, _get.default)(original, "title");
91
76
  const newTitle = (0, _get.default)(page, "title");
92
-
93
77
  if (linkedContentReviewId && prevTitle !== newTitle) {
94
78
  await apw.contentReview.update(linkedContentReviewId, {
95
79
  title: newTitle
@@ -99,28 +83,22 @@ const linkWorkflowToPage = params => {
99
83
  /**
100
84
  * Link created workflow to associated pages.
101
85
  */
102
-
103
86
  apw.workflow.onWorkflowAfterCreate.subscribe(async ({
104
87
  workflow
105
88
  }) => {
106
89
  const {
107
90
  scope
108
91
  } = workflow;
109
-
110
92
  if (workflow.app !== _types.ApwWorkflowApplications.PB) {
111
93
  return;
112
94
  }
113
95
  /**
114
96
  * If the workflow has pages in it's scope, we'll link that workflow for each of those pages.
115
97
  */
116
-
117
-
118
98
  if ((0, _utils.hasPages)(workflow) === false) {
119
99
  return;
120
100
  }
121
-
122
101
  const pages = (0, _get.default)(scope, "data.pages");
123
-
124
102
  for (const pid of pages) {
125
103
  await (0, _utils.updatePageSettings)({
126
104
  getPage: pageBuilder.getPage,
@@ -135,7 +113,6 @@ const linkWorkflowToPage = params => {
135
113
  /**
136
114
  * Link updated workflow to associated pages.
137
115
  */
138
-
139
116
  apw.workflow.onWorkflowAfterUpdate.subscribe(async ({
140
117
  workflow,
141
118
  original
@@ -143,11 +120,9 @@ const linkWorkflowToPage = params => {
143
120
  const {
144
121
  scope
145
122
  } = workflow;
146
-
147
123
  if (workflow.app !== _types.ApwWorkflowApplications.PB) {
148
124
  return;
149
125
  }
150
-
151
126
  const {
152
127
  scope: prevScope
153
128
  } = original;
@@ -155,18 +130,15 @@ const linkWorkflowToPage = params => {
155
130
  * If the workflow has pages in it's scope and there is a change in that page list,
156
131
  * we'll update the workflow link for corresponding pages.
157
132
  */
158
-
159
133
  if ((0, _utils.hasPages)(workflow) === false || (0, _utils.shouldUpdatePages)(scope, prevScope) === false) {
160
134
  return;
161
135
  }
162
-
163
136
  const previousPages = (0, _get.default)(prevScope, "data.pages", []);
164
137
  const currentPages = (0, _get.default)(scope, "data.pages", []);
165
138
  const {
166
139
  removedPages,
167
140
  addedPages
168
141
  } = (0, _utils.getPagesDiff)(currentPages, previousPages);
169
-
170
142
  for (const pid of addedPages) {
171
143
  await (0, _utils.updatePageSettings)({
172
144
  getPage: pageBuilder.getPage,
@@ -177,7 +149,6 @@ const linkWorkflowToPage = params => {
177
149
  }
178
150
  });
179
151
  }
180
-
181
152
  for (const pid of removedPages) {
182
153
  await (0, _utils.updatePageSettings)({
183
154
  getPage: pageBuilder.getPage,
@@ -190,5 +161,4 @@ const linkWorkflowToPage = params => {
190
161
  }
191
162
  });
192
163
  };
193
-
194
164
  exports.linkWorkflowToPage = linkWorkflowToPage;
@@ -1 +1 @@
1
- {"version":3,"names":["linkWorkflowToPage","params","apw","pageBuilder","onPageBeforeCreate","subscribe","page","assignWorkflowToPage","listWorkflow","workflow","list","onPageBeforeCreateFrom","original","previousContentReviewId","get","settings","contentReviewId","previousWorkflowId","onPageBeforeUpdate","prevApwWorkflowId","currentApwWorkflowId","linkedContentReviewId","prevTitle","newTitle","contentReview","update","title","onWorkflowAfterCreate","scope","app","ApwWorkflowApplications","PB","hasPages","pages","pid","updatePageSettings","getPage","updatePage","uniquePageId","getNewSettings","set","id","onWorkflowAfterUpdate","prevScope","shouldUpdatePages","previousPages","currentPages","removedPages","addedPages","getPagesDiff"],"sources":["linkWorkflowToPage.ts"],"sourcesContent":["import get from \"lodash/get\";\nimport set from \"lodash/set\";\nimport {\n ApwWorkflowApplications,\n ApwOnPageBeforeCreateTopicParams,\n ApwOnPageBeforeCreateFromTopicParams,\n ApwOnPageBeforeUpdateTopicParams,\n AdvancedPublishingWorkflow\n} from \"~/types\";\nimport {\n getPagesDiff,\n hasPages,\n updatePageSettings,\n shouldUpdatePages,\n assignWorkflowToPage\n} from \"./utils\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\n\ninterface LinkWorkflowToPageParams {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n}\n\nexport const linkWorkflowToPage = (params: LinkWorkflowToPageParams) => {\n const { apw, pageBuilder } = params;\n\n pageBuilder.onPageBeforeCreate.subscribe<ApwOnPageBeforeCreateTopicParams>(async ({ page }) => {\n await assignWorkflowToPage({ listWorkflow: apw.workflow.list, page });\n });\n pageBuilder.onPageBeforeCreateFrom.subscribe<ApwOnPageBeforeCreateFromTopicParams>(\n async params => {\n const { page, original } = params;\n /**\n * If the previous revision(original) already had the \"contentReviewId\",\n * we need to unlink it so that new \"contentReview\" can be request for the new revision.\n */\n const previousContentReviewId = get(original, \"settings.apw.contentReviewId\");\n if (previousContentReviewId) {\n page.settings.apw.contentReviewId = null;\n }\n\n /**\n * If the previous revision(original) already had the \"workflowId\",\n * we don't need to do anything we'll just let it be copied over.\n */\n const previousWorkflowId = get(original, \"settings.apw.workflowId\");\n if (previousWorkflowId) {\n return;\n }\n /**\n * Lookup and assign \"workflowId\".\n */\n await assignWorkflowToPage({ listWorkflow: apw.workflow.list, page });\n }\n );\n pageBuilder.onPageBeforeUpdate.subscribe<ApwOnPageBeforeUpdateTopicParams>(async params => {\n const { page, original } = params;\n const prevApwWorkflowId = get(original, \"settings.apw\");\n const currentApwWorkflowId = get(page, \"settings.apw\");\n /**\n * Make sure the apw property doesn't get lost between updates.\n * It can happen because we run modal validation in \"onBeforePageUpdate\" event,\n * which doesn't have the \"apw\" property.\n */\n if (prevApwWorkflowId && !currentApwWorkflowId) {\n page.settings.apw = original.settings.apw;\n }\n /*\n * If there is a linked \"contentReview\" for this page and the page \"title\" has changed.\n * Let's update the \"title\" field in \"contentReview\".\n */\n const linkedContentReviewId = get(page, \"settings.apw.contentReviewId\");\n const prevTitle = get(original, \"title\");\n const newTitle = get(page, \"title\");\n\n if (linkedContentReviewId && prevTitle !== newTitle) {\n await apw.contentReview.update(linkedContentReviewId, { title: newTitle });\n }\n });\n /**\n * Link created workflow to associated pages.\n */\n apw.workflow.onWorkflowAfterCreate.subscribe(async ({ workflow }) => {\n const { scope } = workflow;\n if (workflow.app !== ApwWorkflowApplications.PB) {\n return;\n }\n /**\n * If the workflow has pages in it's scope, we'll link that workflow for each of those pages.\n */\n if (hasPages(workflow) === false) {\n return;\n }\n const pages = get(scope, \"data.pages\");\n\n for (const pid of pages) {\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: pid,\n getNewSettings: settings => {\n return set(settings, \"apw.workflowId\", workflow.id);\n }\n });\n }\n });\n /**\n * Link updated workflow to associated pages.\n */\n apw.workflow.onWorkflowAfterUpdate.subscribe(async ({ workflow, original }) => {\n const { scope } = workflow;\n if (workflow.app !== ApwWorkflowApplications.PB) {\n return;\n }\n const { scope: prevScope } = original;\n /**\n * If the workflow has pages in it's scope and there is a change in that page list,\n * we'll update the workflow link for corresponding pages.\n */\n if (hasPages(workflow) === false || shouldUpdatePages(scope, prevScope) === false) {\n return;\n }\n\n const previousPages = get(prevScope, \"data.pages\", []);\n const currentPages = get(scope, \"data.pages\", []);\n\n const { removedPages, addedPages } = getPagesDiff(currentPages, previousPages);\n for (const pid of addedPages) {\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: pid,\n getNewSettings: settings => {\n return set(settings, \"apw.workflowId\", workflow.id);\n }\n });\n }\n for (const pid of removedPages) {\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: pid,\n getNewSettings: settings => {\n return set(settings, \"apw.workflowId\", null);\n }\n });\n }\n });\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAOA;;AAcO,MAAMA,kBAAkB,GAAIC,MAAD,IAAsC;EACpE,MAAM;IA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AAEjC,WAAW,CAACiC,OADA;QAErBC,UAAU,EAAElC,WAAW,CAACkC,UAFH;QAGrBC,YAAY,EAAEJ,GAHO;QAIrBK,cAAc,EAAExB,QAAQ,IAAI;UACxB,OAAO,IAAAyB,YAAA,EAAIzB,QAAJ,EAAc,gBAAd,EAAgC,IAAhC,CAAP;QACH;MANoB,CAAnB,CAAN;IAQH;EACJ,CAtCD;AAuCH,CA7HM"}
1
+ {"version":3,"names":["linkWorkflowToPage","params","apw","pageBuilder","onPageBeforeCreate","subscribe","page","assignWorkflowToPage","listWorkflow","workflow","list","onPageBeforeCreateFrom","original","previousContentReviewId","get","settings","contentReviewId","previousWorkflowId","onPageBeforeUpdate","prevApwWorkflowId","currentApwWorkflowId","linkedContentReviewId","prevTitle","newTitle","contentReview","update","title","onWorkflowAfterCreate","scope","app","ApwWorkflowApplications","PB","hasPages","pages","pid","updatePageSettings","getPage","updatePage","uniquePageId","getNewSettings","set","id","onWorkflowAfterUpdate","prevScope","shouldUpdatePages","previousPages","currentPages","removedPages","addedPages","getPagesDiff"],"sources":["linkWorkflowToPage.ts"],"sourcesContent":["import get from \"lodash/get\";\nimport set from \"lodash/set\";\nimport {\n ApwWorkflowApplications,\n ApwOnPageBeforeCreateTopicParams,\n ApwOnPageBeforeCreateFromTopicParams,\n ApwOnPageBeforeUpdateTopicParams,\n AdvancedPublishingWorkflow\n} from \"~/types\";\nimport {\n getPagesDiff,\n hasPages,\n updatePageSettings,\n shouldUpdatePages,\n assignWorkflowToPage\n} from \"./utils\";\nimport { PageBuilderContextObject } from \"@webiny/api-page-builder/graphql/types\";\n\ninterface LinkWorkflowToPageParams {\n apw: AdvancedPublishingWorkflow;\n pageBuilder: PageBuilderContextObject;\n}\n\nexport const linkWorkflowToPage = (params: LinkWorkflowToPageParams) => {\n const { apw, pageBuilder } = params;\n\n pageBuilder.onPageBeforeCreate.subscribe<ApwOnPageBeforeCreateTopicParams>(async ({ page }) => {\n await assignWorkflowToPage({ listWorkflow: apw.workflow.list, page });\n });\n pageBuilder.onPageBeforeCreateFrom.subscribe<ApwOnPageBeforeCreateFromTopicParams>(\n async params => {\n const { page, original } = params;\n /**\n * If the previous revision(original) already had the \"contentReviewId\",\n * we need to unlink it so that new \"contentReview\" can be request for the new revision.\n */\n const previousContentReviewId = get(original, \"settings.apw.contentReviewId\");\n if (previousContentReviewId) {\n page.settings.apw.contentReviewId = null;\n }\n\n /**\n * If the previous revision(original) already had the \"workflowId\",\n * we don't need to do anything we'll just let it be copied over.\n */\n const previousWorkflowId = get(original, \"settings.apw.workflowId\");\n if (previousWorkflowId) {\n return;\n }\n /**\n * Lookup and assign \"workflowId\".\n */\n await assignWorkflowToPage({ listWorkflow: apw.workflow.list, page });\n }\n );\n pageBuilder.onPageBeforeUpdate.subscribe<ApwOnPageBeforeUpdateTopicParams>(async params => {\n const { page, original } = params;\n const prevApwWorkflowId = get(original, \"settings.apw\");\n const currentApwWorkflowId = get(page, \"settings.apw\");\n /**\n * Make sure the apw property doesn't get lost between updates.\n * It can happen because we run modal validation in \"onBeforePageUpdate\" event,\n * which doesn't have the \"apw\" property.\n */\n if (prevApwWorkflowId && !currentApwWorkflowId) {\n page.settings.apw = original.settings.apw;\n }\n /*\n * If there is a linked \"contentReview\" for this page and the page \"title\" has changed.\n * Let's update the \"title\" field in \"contentReview\".\n */\n const linkedContentReviewId = get(page, \"settings.apw.contentReviewId\");\n const prevTitle = get(original, \"title\");\n const newTitle = get(page, \"title\");\n\n if (linkedContentReviewId && prevTitle !== newTitle) {\n await apw.contentReview.update(linkedContentReviewId, { title: newTitle });\n }\n });\n /**\n * Link created workflow to associated pages.\n */\n apw.workflow.onWorkflowAfterCreate.subscribe(async ({ workflow }) => {\n const { scope } = workflow;\n if (workflow.app !== ApwWorkflowApplications.PB) {\n return;\n }\n /**\n * If the workflow has pages in it's scope, we'll link that workflow for each of those pages.\n */\n if (hasPages(workflow) === false) {\n return;\n }\n const pages = get(scope, \"data.pages\") as unknown as string[];\n\n for (const pid of pages) {\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: pid,\n getNewSettings: settings => {\n return set(settings, \"apw.workflowId\", workflow.id);\n }\n });\n }\n });\n /**\n * Link updated workflow to associated pages.\n */\n apw.workflow.onWorkflowAfterUpdate.subscribe(async ({ workflow, original }) => {\n const { scope } = workflow;\n if (workflow.app !== ApwWorkflowApplications.PB) {\n return;\n }\n const { scope: prevScope } = original;\n /**\n * If the workflow has pages in it's scope and there is a change in that page list,\n * we'll update the workflow link for corresponding pages.\n */\n if (hasPages(workflow) === false || shouldUpdatePages(scope, prevScope) === false) {\n return;\n }\n\n const previousPages = get(prevScope, \"data.pages\", []);\n const currentPages = get(scope, \"data.pages\", []);\n\n const { removedPages, addedPages } = getPagesDiff(currentPages, previousPages);\n for (const pid of addedPages) {\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: pid,\n getNewSettings: settings => {\n return set(settings, \"apw.workflowId\", workflow.id);\n }\n });\n }\n for (const pid of removedPages) {\n await updatePageSettings({\n getPage: pageBuilder.getPage,\n updatePage: pageBuilder.updatePage,\n uniquePageId: pid,\n getNewSettings: settings => {\n return set(settings, \"apw.workflowId\", null);\n }\n });\n }\n });\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAOA;AAcO,MAAMA,kBAAkB,GAAIC,MAAgC,IAAK;EACpE,MAAM;IAAEC,GAAG;IAAEC;EAAY,CAAC,GAAGF,MAAM;EAEnCE,WAAW,CAACC,kBAAkB,CAACC,SAAS,CAAmC,OAAO;IAAEC;EAAK,CAAC,KAAK;IAC3F,MAAM,IAAAC,2BAAoB,EAAC;MAAEC,YAAY,EAAEN,GAAG,CAACO,QAAQ,CAACC,IAAI;MAAEJ;IAAK,CAAC,CAAC;EACzE,CAAC,CAAC;EACFH,WAAW,CAACQ,sBAAsB,CAACN,SAAS,CACxC,MAAMJ,MAAM,IAAI;IACZ,MAAM;MAAEK,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IAAI,IAAAoB,eAAQ,EAACvB,QAAQ,CAAC,KAAK,KAAK,IAAI,IAAAmC,wBAAiB,EAAChB,KAAK,EAAEe,SAAS,CAAC,KAAK,KAAK,EAAE;MAC/E;IACJ;IAEA,MAAME,aAAa,GAAG,IAAA/B,YAAG,EAAC6B,SAAS,EAAE,YAAY,EAAE,EAAE,CAAC;IACtD,MAAMG,YAAY,GAAG,IAAAhC,YAAG,EAACc,KAAK,EAAE,YAAY,EAAE,EAAE,CAAC;IAEjD,MAAM;MAAEmB,YAAY;MAAEC;IAAW,CAAC,GAAG,IAAAC,mBAAY,EAACH,YAAY,EAAED,aAAa,CAAC;IAC9E,KAAK,MAAMX,GAAG,IAAIc,UAAU,EAAE;MAC1B,MAAM,IAAAb,yBAAkB,EAAC;QACrBC,OAAO,EAAEjC,WAAW,CAACiC,OAAO;QAC5BC,UAAU,EAAElC,WAAW,CAACkC,UAAU;QAClCC,YAAY,EAAEJ,GAAG;QACjBK,cAAc,EAAExB,QAAQ,IAAI;UACxB,OAAO,IAAAyB,YAAG,EAACzB,QAAQ,EAAE,gBAAgB,EAAEN,QAAQ,CAACgC,EAAE,CAAC;QACvD;MACJ,CAAC,CAAC;IACN;IACA,KAAK,MAAMP,GAAG,IAAIa,YAAY,EAAE;MAC5B,MAAM,IAAAZ,yBAAkB,EAAC;QACrBC,OAAO,EAAEjC,WAAW,CAACiC,OAAO;QAC5BC,UAAU,EAAElC,WAAW,CAACkC,UAAU;QAClCC,YAAY,EAAEJ,GAAG;QACjBK,cAAc,EAAExB,QAAQ,IAAI;UACxB,OAAO,IAAAyB,YAAG,EAACzB,QAAQ,EAAE,gBAAgB,EAAE,IAAI,CAAC;QAChD;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -0,0 +1 @@
1
+ export declare const createChangeRequestNotification: () => import("../../../ApwChangeRequestNotification").ApwChangeRequestNotification;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createChangeRequestNotification = void 0;
7
+ var _types = require("../../../types");
8
+ var _ApwChangeRequestNotification = require("../../../ApwChangeRequestNotification");
9
+ const createChangeRequestNotification = () => {
10
+ const plugin = (0, _ApwChangeRequestNotification.createApwChangeRequestNotification)(_types.ApwContentTypes.PAGE, params => {
11
+ const {
12
+ changeRequestUrl,
13
+ contentUrl
14
+ } = params;
15
+ return {
16
+ text: `
17
+ Hi,<br /><br />
18
+
19
+ You have received a <a href="${changeRequestUrl}">change request</a>, for <a href="${contentUrl}">this</a> page.<br /><br />
20
+
21
+ Here are the full URLs:<br /><br />
22
+
23
+ Change Request: ${changeRequestUrl}<br />
24
+ Page: ${contentUrl}
25
+ `
26
+ };
27
+ });
28
+ plugin.name = `${plugin.type}.${_types.ApwContentTypes.PAGE}.default`;
29
+ return plugin;
30
+ };
31
+ exports.createChangeRequestNotification = createChangeRequestNotification;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createChangeRequestNotification","plugin","createApwChangeRequestNotification","ApwContentTypes","PAGE","params","changeRequestUrl","contentUrl","text","name","type"],"sources":["changeRequestNotification.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { createApwChangeRequestNotification } from \"~/ApwChangeRequestNotification\";\n\nexport const createChangeRequestNotification = () => {\n const plugin = createApwChangeRequestNotification(ApwContentTypes.PAGE, params => {\n const { changeRequestUrl, contentUrl } = params;\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${changeRequestUrl}\">change request</a>, for <a href=\"${contentUrl}\">this</a> page.<br /><br />\n \n Here are the full URLs:<br /><br />\n \n Change Request: ${changeRequestUrl}<br />\n Page: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.PAGE}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;AAAA;AACA;AAEO,MAAMA,+BAA+B,GAAG,MAAM;EACjD,MAAMC,MAAM,GAAG,IAAAC,gEAAkC,EAACC,sBAAe,CAACC,IAAI,EAAEC,MAAM,IAAI;IAC9E,MAAM;MAAEC,gBAAgB;MAAEC;IAAW,CAAC,GAAGF,MAAM;IAC/C,OAAO;MACHG,IAAI,EAAG;AACnB;AACA;AACA,+CAA+CF,gBAAiB,sCAAqCC,UAAW;AAChH;AACA;AACA;AACA,kCAAkCD,gBAAiB;AACnD,wBAAwBC,UAAW;AACnC;IACQ,CAAC;EACL,CAAC,CAAC;EAEFN,MAAM,CAACQ,IAAI,GAAI,GAAER,MAAM,CAACS,IAAK,IAAGP,sBAAe,CAACC,IAAK,UAAS;EAE9D,OAAOH,MAAM;AACjB,CAAC;AAAC"}
@@ -0,0 +1 @@
1
+ export declare const createCommentNotification: () => import("../../../ApwCommentNotification").ApwCommentNotification;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCommentNotification = void 0;
7
+ var _ApwCommentNotification = require("../../../ApwCommentNotification");
8
+ var _types = require("../../../types");
9
+ const createCommentNotification = () => {
10
+ const plugin = (0, _ApwCommentNotification.createApwCommentNotification)(_types.ApwContentTypes.PAGE, params => {
11
+ const {
12
+ commentUrl,
13
+ contentUrl
14
+ } = params;
15
+ return {
16
+ text: `
17
+ Hi,<br /><br />
18
+
19
+ You have received a <a href="${commentUrl}">comment</a>, on a change request, for <a href="${contentUrl}">this</a> page.<br /><br />
20
+
21
+ Here are the full URLs:<br /><br />
22
+
23
+ Comment: ${commentUrl}<br />
24
+ Page: ${contentUrl}
25
+ `
26
+ };
27
+ });
28
+ plugin.name = `${plugin.type}.${_types.ApwContentTypes.PAGE}.default`;
29
+ return plugin;
30
+ };
31
+ exports.createCommentNotification = createCommentNotification;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createCommentNotification","plugin","createApwCommentNotification","ApwContentTypes","PAGE","params","commentUrl","contentUrl","text","name","type"],"sources":["commentNotification.ts"],"sourcesContent":["import { createApwCommentNotification } from \"~/ApwCommentNotification\";\nimport { ApwContentTypes } from \"~/types\";\n\nexport const createCommentNotification = () => {\n const plugin = createApwCommentNotification(ApwContentTypes.PAGE, params => {\n const { commentUrl, contentUrl } = params;\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${commentUrl}\">comment</a>, on a change request, for <a href=\"${contentUrl}\">this</a> page.<br /><br />\n \n Here are the full URLs:<br /><br />\n \n Comment: ${commentUrl}<br />\n Page: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.PAGE}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;AAAA;AACA;AAEO,MAAMA,yBAAyB,GAAG,MAAM;EAC3C,MAAMC,MAAM,GAAG,IAAAC,oDAA4B,EAACC,sBAAe,CAACC,IAAI,EAAEC,MAAM,IAAI;IACxE,MAAM;MAAEC,UAAU;MAAEC;IAAW,CAAC,GAAGF,MAAM;IACzC,OAAO;MACHG,IAAI,EAAG;AACnB;AACA;AACA,+CAA+CF,UAAW,oDAAmDC,UAAW;AACxH;AACA;AACA;AACA,2BAA2BD,UAAW;AACtC,wBAAwBC,UAAW;AACnC;IACQ,CAAC;EACL,CAAC,CAAC;EAEFN,MAAM,CAACQ,IAAI,GAAI,GAAER,MAAM,CAACS,IAAK,IAAGP,sBAAe,CAACC,IAAK,UAAS;EAE9D,OAAOH,MAAM;AACjB,CAAC;AAAC"}
@@ -0,0 +1 @@
1
+ export declare const createContentReviewNotification: () => import("../../../ApwContentReviewNotification").ApwContentReviewNotification;