@webiny/api-apw 0.0.0-unstable.1e66d121db → 0.0.0-unstable.2696f9d9e8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ApwChangeRequestNotification.d.ts +27 -0
- package/ApwChangeRequestNotification.js +28 -0
- package/ApwChangeRequestNotification.js.map +1 -0
- package/ApwCommentNotification.d.ts +27 -0
- package/ApwCommentNotification.js +28 -0
- package/ApwCommentNotification.js.map +1 -0
- package/ApwContentReviewNotification.d.ts +26 -0
- package/ApwContentReviewNotification.js +28 -0
- package/ApwContentReviewNotification.js.map +1 -0
- package/ApwContentUrlPlugin.d.ts +19 -0
- package/ApwContentUrlPlugin.js +28 -0
- package/ApwContentUrlPlugin.js.map +1 -0
- package/ContentApwSettingsPlugin.js +5 -9
- package/ContentApwSettingsPlugin.js.map +1 -1
- package/README.md +3 -3
- package/crud/createChangeRequestMethods.js +7 -12
- package/crud/createChangeRequestMethods.js.map +1 -1
- package/crud/createCommentMethods.js +7 -13
- package/crud/createCommentMethods.js.map +1 -1
- package/crud/createContentReviewMethods.js +83 -111
- package/crud/createContentReviewMethods.js.map +1 -1
- package/crud/createReviewerMethods.js +7 -13
- package/crud/createReviewerMethods.js.map +1 -1
- package/crud/createWorkflowMethods.js +7 -18
- package/crud/createWorkflowMethods.js.map +1 -1
- package/crud/index.js +5 -29
- package/crud/index.js.map +1 -1
- package/crud/utils.js +6 -33
- package/crud/utils.js.map +1 -1
- package/index.d.ts +2 -3
- package/index.js +6 -16
- package/index.js.map +1 -1
- package/package.json +40 -47
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js +4 -19
- package/plugins/cms/CmsEntryApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/cms/apwEntryPlugins.js +8 -13
- package/plugins/cms/apwEntryPlugins.js.map +1 -1
- package/plugins/cms/index.js +7 -10
- package/plugins/cms/index.js.map +1 -1
- package/plugins/cms/linkContentReviewToEntry.js +4 -20
- package/plugins/cms/linkContentReviewToEntry.js.map +1 -1
- package/plugins/cms/linkWorkflowToEntry.js +17 -45
- package/plugins/cms/linkWorkflowToEntry.js.map +1 -1
- package/plugins/cms/notifications/changeRequestNotification.d.ts +1 -0
- package/plugins/cms/notifications/changeRequestNotification.js +33 -0
- package/plugins/cms/notifications/changeRequestNotification.js.map +1 -0
- package/plugins/cms/notifications/commentNotification.d.ts +1 -0
- package/plugins/cms/notifications/commentNotification.js +33 -0
- package/plugins/cms/notifications/commentNotification.js.map +1 -0
- package/plugins/cms/notifications/contentReviewNotification.d.ts +1 -0
- package/plugins/cms/notifications/contentReviewNotification.js +33 -0
- package/plugins/cms/notifications/contentReviewNotification.js.map +1 -0
- package/plugins/cms/notifications/contentUrl.d.ts +8 -0
- package/plugins/cms/notifications/contentUrl.js +55 -0
- package/plugins/cms/notifications/contentUrl.js.map +1 -0
- package/plugins/cms/triggerContentReview.js +5 -18
- package/plugins/cms/triggerContentReview.js.map +1 -1
- package/plugins/cms/updateContentReviewStatus.js +14 -30
- package/plugins/cms/updateContentReviewStatus.js.map +1 -1
- package/plugins/cms/utils.d.ts +3 -2
- package/plugins/cms/utils.js +23 -60
- package/plugins/cms/utils.js.map +1 -1
- package/plugins/context.d.ts +0 -1
- package/plugins/context.js +2 -45
- package/plugins/context.js.map +1 -1
- package/plugins/graphql/changeRequest.gql.js +16 -19
- package/plugins/graphql/changeRequest.gql.js.map +1 -1
- package/plugins/graphql/comment.gql.js +41 -42
- package/plugins/graphql/comment.gql.js.map +1 -1
- package/plugins/graphql/contentReview.gql.js +25 -34
- package/plugins/graphql/contentReview.gql.js.map +1 -1
- package/plugins/graphql/reviewer.gql.js +17 -19
- package/plugins/graphql/reviewer.gql.js.map +1 -1
- package/plugins/graphql/utils.d.ts +2 -0
- package/plugins/graphql/utils.js +12 -0
- package/plugins/graphql/utils.js.map +1 -0
- package/plugins/graphql/workflow.gql.js +15 -19
- package/plugins/graphql/workflow.gql.js.map +1 -1
- package/plugins/graphql.js +5 -18
- package/plugins/graphql.js.map +1 -1
- package/plugins/hooks/createReviewerFromIdentity.js +28 -15
- package/plugins/hooks/createReviewerFromIdentity.js.map +1 -1
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js +3 -9
- package/plugins/hooks/deleteChangeRequestsAfterContentReview.js.map +1 -1
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js +3 -8
- package/plugins/hooks/deleteCommentsAfterChangeRequest.js.map +1 -1
- package/plugins/hooks/index.js +4 -13
- package/plugins/hooks/index.js.map +1 -1
- package/plugins/hooks/initializeContentReviewSteps.js +15 -20
- package/plugins/hooks/initializeContentReviewSteps.js.map +1 -1
- package/plugins/hooks/initializeNotifications.d.ts +2 -0
- package/plugins/hooks/initializeNotifications.js +17 -0
- package/plugins/hooks/initializeNotifications.js.map +1 -0
- package/plugins/hooks/listContentReviews.d.ts +1 -1
- package/plugins/hooks/listContentReviews.js +11 -33
- package/plugins/hooks/listContentReviews.js.map +1 -1
- package/plugins/hooks/notifications/appUrl.d.ts +2 -0
- package/plugins/hooks/notifications/appUrl.js +20 -0
- package/plugins/hooks/notifications/appUrl.js.map +1 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js +113 -0
- package/plugins/hooks/notifications/changeRequestAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/changeRequestUrl.d.ts +8 -0
- package/plugins/hooks/notifications/changeRequestUrl.js +29 -0
- package/plugins/hooks/notifications/changeRequestUrl.js.map +1 -0
- package/plugins/hooks/notifications/commentAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/commentAfterCreate.js +124 -0
- package/plugins/hooks/notifications/commentAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/commentUrl.d.ts +8 -0
- package/plugins/hooks/notifications/commentUrl.js +29 -0
- package/plugins/hooks/notifications/commentUrl.js.map +1 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.d.ts +2 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.js +96 -0
- package/plugins/hooks/notifications/contentReviewAfterCreate.js.map +1 -0
- package/plugins/hooks/notifications/contentReviewUrl.d.ts +7 -0
- package/plugins/hooks/notifications/contentReviewUrl.js +28 -0
- package/plugins/hooks/notifications/contentReviewUrl.js.map +1 -0
- package/plugins/hooks/notifications/contentUrl.d.ts +7 -0
- package/plugins/hooks/notifications/contentUrl.js +26 -0
- package/plugins/hooks/notifications/contentUrl.js.map +1 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js +23 -0
- package/plugins/hooks/notifications/lastChangeRequestNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js +23 -0
- package/plugins/hooks/notifications/lastCommentNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.d.ts +11 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js +23 -0
- package/plugins/hooks/notifications/lastContentReviewNotificationPlugin.js.map +1 -0
- package/plugins/hooks/notifications/reviewers.d.ts +15 -0
- package/plugins/hooks/notifications/reviewers.js +47 -0
- package/plugins/hooks/notifications/reviewers.js.map +1 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js +43 -0
- package/plugins/hooks/notifications/sendChangeRequestNotification.js.map +1 -0
- package/plugins/hooks/notifications/sendCommentNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendCommentNotification.js +43 -0
- package/plugins/hooks/notifications/sendCommentNotification.js.map +1 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.d.ts +2 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js +43 -0
- package/plugins/hooks/notifications/sendContentReviewNotification.js.map +1 -0
- package/plugins/hooks/updatePendingChangeRequests.js +7 -13
- package/plugins/hooks/updatePendingChangeRequests.js.map +1 -1
- package/plugins/hooks/updateTotalComments.js +21 -23
- package/plugins/hooks/updateTotalComments.js.map +1 -1
- package/plugins/hooks/validateChangeRequest.js +27 -16
- package/plugins/hooks/validateChangeRequest.js.map +1 -1
- package/plugins/hooks/validateComment.js +13 -12
- package/plugins/hooks/validateComment.js.map +1 -1
- package/plugins/hooks/validateContentReview.js +2 -6
- package/plugins/hooks/validateContentReview.js.map +1 -1
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js +4 -19
- package/plugins/pageBuilder/PageApwSettingsGetterPlugin.js.map +1 -1
- package/plugins/pageBuilder/apwContentPagePlugins.js +2 -4
- package/plugins/pageBuilder/apwContentPagePlugins.js.map +1 -1
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js +3 -6
- package/plugins/pageBuilder/extendPbPageSettingsSchema.js.map +1 -1
- package/plugins/pageBuilder/index.js +7 -8
- package/plugins/pageBuilder/index.js.map +1 -1
- package/plugins/pageBuilder/linkContentReviewToPage.js +15 -27
- package/plugins/pageBuilder/linkContentReviewToPage.js.map +1 -1
- package/plugins/pageBuilder/linkWorkflowToPage.js +3 -31
- package/plugins/pageBuilder/linkWorkflowToPage.js.map +1 -1
- package/plugins/pageBuilder/notifications/changeRequestNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js +33 -0
- package/plugins/pageBuilder/notifications/changeRequestNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/commentNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/commentNotification.js +33 -0
- package/plugins/pageBuilder/notifications/commentNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.d.ts +1 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js +33 -0
- package/plugins/pageBuilder/notifications/contentReviewNotification.js.map +1 -0
- package/plugins/pageBuilder/notifications/contentUrl.d.ts +1 -0
- package/plugins/pageBuilder/notifications/contentUrl.js +49 -0
- package/plugins/pageBuilder/notifications/contentUrl.js.map +1 -0
- package/plugins/pageBuilder/triggerContentReview.js +2 -11
- package/plugins/pageBuilder/triggerContentReview.js.map +1 -1
- package/plugins/pageBuilder/updateContentReviewStatus.js +10 -17
- package/plugins/pageBuilder/updateContentReviewStatus.js.map +1 -1
- package/plugins/pageBuilder/utils.d.ts +2 -2
- package/plugins/pageBuilder/utils.js +3 -35
- package/plugins/pageBuilder/utils.js.map +1 -1
- package/plugins/utils.d.ts +1 -2
- package/plugins/utils.js +6 -52
- package/plugins/utils.js.map +1 -1
- package/scheduler/createScheduleActionMethods.js +45 -50
- package/scheduler/createScheduleActionMethods.js.map +1 -1
- package/scheduler/handlers/executeAction/index.d.ts +1 -1
- package/scheduler/handlers/executeAction/index.js +47 -40
- package/scheduler/handlers/executeAction/index.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.d.ts +6 -0
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js +19 -9
- package/scheduler/handlers/executeAction/plugins/ApplicationGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.d.ts +2 -3
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js +11 -28
- package/scheduler/handlers/executeAction/plugins/HeadlessCMSGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.d.ts +2 -2
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js +10 -92
- package/scheduler/handlers/executeAction/plugins/PageBuilderGraphQL.js.map +1 -1
- package/scheduler/handlers/executeAction/security.js +2 -11
- package/scheduler/handlers/executeAction/security.js.map +1 -1
- package/scheduler/handlers/scheduleAction/index.d.ts +1 -1
- package/scheduler/handlers/scheduleAction/index.js +24 -37
- package/scheduler/handlers/scheduleAction/index.js.map +1 -1
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js +20 -36
- package/scheduler/handlers/scheduleAction/scheduleAction.utils.js.map +1 -1
- package/scheduler/handlers/utils.d.ts +2 -4
- package/scheduler/handlers/utils.js +8 -47
- package/scheduler/handlers/utils.js.map +1 -1
- package/scheduler/index.js +2 -3
- package/scheduler/index.js.map +1 -1
- package/scheduler/types.d.ts +12 -28
- package/scheduler/types.js +13 -22
- package/scheduler/types.js.map +1 -1
- package/storageOperations/changeRequestStorageOperations.js +59 -45
- package/storageOperations/changeRequestStorageOperations.js.map +1 -1
- package/storageOperations/commentStorageOperations.js +35 -50
- package/storageOperations/commentStorageOperations.js.map +1 -1
- package/storageOperations/contentReviewStorageOperations.d.ts +1 -1
- package/storageOperations/contentReviewStorageOperations.js +34 -43
- package/storageOperations/contentReviewStorageOperations.js.map +1 -1
- package/storageOperations/index.d.ts +1 -7
- package/storageOperations/index.js +10 -29
- package/storageOperations/index.js.map +1 -1
- package/storageOperations/models/changeRequest.model.d.ts +1 -2
- package/storageOperations/models/changeRequest.model.js +6 -15
- package/storageOperations/models/changeRequest.model.js.map +1 -1
- package/storageOperations/models/comment.model.d.ts +1 -2
- package/storageOperations/models/comment.model.js +6 -14
- package/storageOperations/models/comment.model.js.map +1 -1
- package/storageOperations/models/contentReview.model.d.ts +1 -2
- package/storageOperations/models/contentReview.model.js +13 -37
- package/storageOperations/models/contentReview.model.js.map +1 -1
- package/storageOperations/models/index.js +6 -50
- package/storageOperations/models/index.js.map +1 -1
- package/storageOperations/models/reviewer.model.d.ts +1 -2
- package/storageOperations/models/reviewer.model.js +22 -14
- package/storageOperations/models/reviewer.model.js.map +1 -1
- package/storageOperations/models/utils.js +2 -4
- package/storageOperations/models/utils.js.map +1 -1
- package/storageOperations/models/workflow.model.d.ts +1 -2
- package/storageOperations/models/workflow.model.js +19 -42
- package/storageOperations/models/workflow.model.js.map +1 -1
- package/storageOperations/reviewerStorageOperations.d.ts +1 -1
- package/storageOperations/reviewerStorageOperations.js +34 -40
- package/storageOperations/reviewerStorageOperations.js.map +1 -1
- package/storageOperations/types.js +3 -1
- package/storageOperations/workflowStorageOperations.js +40 -47
- package/storageOperations/workflowStorageOperations.js.map +1 -1
- package/types.d.ts +39 -25
- package/types.js +126 -42
- package/types.js.map +1 -1
- package/utils/contentApwSettingsPlugin.js +2 -6
- package/utils/contentApwSettingsPlugin.js.map +1 -1
- package/utils/errors.js +2 -17
- package/utils/errors.js.map +1 -1
- package/utils/fieldResolver.js +8 -18
- package/utils/fieldResolver.js.map +1 -1
- package/utils/pickEntryFieldValues.d.ts +3 -0
- package/utils/pickEntryFieldValues.js +31 -0
- package/utils/pickEntryFieldValues.js.map +1 -0
- package/utils/resolve.d.ts +1 -1
- package/utils/resolve.js +2 -3
- package/utils/resolve.js.map +1 -1
- package/storageOperations/models/contentModelPluginFactory.d.ts +0 -15
- package/storageOperations/models/contentModelPluginFactory.js +0 -28
- package/storageOperations/models/contentModelPluginFactory.js.map +0 -1
@@ -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,6 @@ const apwPageBuilderHooks = params => {
|
|
41
39
|
pageBuilder
|
42
40
|
});
|
43
41
|
};
|
42
|
+
exports.apwPageBuilderHooks = apwPageBuilderHooks;
|
44
43
|
|
45
|
-
|
44
|
+
//# sourceMappingURL=index.js.map
|
@@ -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":"
|
1
|
+
{"version":3,"names":["_triggerContentReview","require","_linkContentReviewToPage","_updateContentReviewStatus","_linkWorkflowToPage","_PageApwSettingsGetterPlugin","_commentNotification","_contentUrl","_changeRequestNotification","_contentReviewNotification","apwPageBuilderHooks","params","pageBuilder","apw","security","plugins","register","PageApwSettingsGetterPlugin","createCommentNotification","createChangeRequestNotification","createContentUrlPlugin","createContentReviewNotification","triggerContentReview","linkContentReviewToPage","updateContentReviewStatus","linkWorkflowToPage","exports"],"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,IAAAA,qBAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AACA,IAAAE,0BAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAEA,IAAAI,4BAAA,GAAAJ,OAAA;AACA,IAAAK,oBAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,0BAAA,GAAAP,OAAA;AACA,IAAAQ,0BAAA,GAAAR,OAAA;AASO,MAAMS,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,CAAC,CAAC,EACjC,IAAAC,8CAAyB,EAAC,CAAC,EAC3B,IAAAC,0DAA+B,EAAC,CAAC,EACjC,IAAAC,kCAAsB,EAAC,CAAC,EACxB,IAAAC,0DAA+B,EAAC,CAAC,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;AAACc,OAAA,CAAAhB,mBAAA,GAAAA,mBAAA"}
|
@@ -1,20 +1,13 @@
|
|
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
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
11
|
-
|
12
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
13
|
-
|
14
9
|
var _types = require("../../types");
|
15
|
-
|
16
10
|
var _utils = require("./utils");
|
17
|
-
|
18
11
|
const linkContentReviewToPage = params => {
|
19
12
|
const {
|
20
13
|
apw,
|
@@ -26,21 +19,21 @@ const linkContentReviewToPage = params => {
|
|
26
19
|
const {
|
27
20
|
content
|
28
21
|
} = contentReview;
|
29
|
-
|
30
22
|
if (content.type !== _types.ApwContentTypes.PAGE) {
|
31
23
|
return;
|
32
24
|
}
|
33
|
-
|
34
25
|
await (0, _utils.updatePageSettings)({
|
35
26
|
getPage: pageBuilder.getPage,
|
36
27
|
updatePage: pageBuilder.updatePage,
|
37
28
|
uniquePageId: content.id,
|
38
29
|
getNewSettings: settings => {
|
39
|
-
return
|
40
|
-
|
30
|
+
return {
|
31
|
+
...settings,
|
32
|
+
apw: {
|
33
|
+
...(settings.apw || {}),
|
41
34
|
contentReviewId: contentReview.id
|
42
|
-
}
|
43
|
-
}
|
35
|
+
}
|
36
|
+
};
|
44
37
|
}
|
45
38
|
});
|
46
39
|
});
|
@@ -50,37 +43,32 @@ const linkContentReviewToPage = params => {
|
|
50
43
|
const {
|
51
44
|
content
|
52
45
|
} = contentReview;
|
53
|
-
|
54
46
|
if (content.type !== _types.ApwContentTypes.PAGE) {
|
55
47
|
return;
|
56
48
|
}
|
57
|
-
|
58
49
|
await (0, _utils.updatePageSettings)({
|
59
50
|
getPage: pageBuilder.getPage,
|
60
51
|
updatePage: pageBuilder.updatePage,
|
61
52
|
uniquePageId: content.id,
|
62
53
|
getNewSettings: settings => {
|
63
|
-
return
|
64
|
-
|
54
|
+
return {
|
55
|
+
...settings,
|
56
|
+
apw: {
|
57
|
+
...(settings.apw || {}),
|
65
58
|
contentReviewId: null
|
66
|
-
}
|
67
|
-
}
|
59
|
+
}
|
60
|
+
};
|
68
61
|
}
|
69
62
|
});
|
70
63
|
});
|
71
64
|
pageBuilder.onPageBeforeDelete.subscribe(async ({
|
72
65
|
page
|
73
66
|
}) => {
|
74
|
-
|
75
|
-
|
76
|
-
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
|
-
|
67
|
+
const contentReviewId = page.settings?.apw?.contentReviewId;
|
78
68
|
if (!contentReviewId) {
|
79
69
|
return;
|
80
70
|
}
|
81
|
-
|
82
71
|
let contentReview;
|
83
|
-
|
84
72
|
try {
|
85
73
|
contentReview = await apw.contentReview.get(contentReviewId);
|
86
74
|
} catch (ex) {
|
@@ -92,7 +80,6 @@ const linkContentReviewToPage = params => {
|
|
92
80
|
throw ex;
|
93
81
|
}
|
94
82
|
}
|
95
|
-
|
96
83
|
if (contentReview) {
|
97
84
|
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
85
|
contentReviewId,
|
@@ -101,5 +88,6 @@ const linkContentReviewToPage = params => {
|
|
101
88
|
}
|
102
89
|
});
|
103
90
|
};
|
91
|
+
exports.linkContentReviewToPage = linkContentReviewToPage;
|
104
92
|
|
105
|
-
|
93
|
+
//# sourceMappingURL=linkContentReviewToPage.js.map
|
@@ -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":"
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_types","_utils","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","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAQO,MAAMG,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,CAACQ,EAAE;MACxBC,cAAc,EAAEC,QAAQ,IAAI;QACxB,OAAO;UACH,GAAGA,QAAQ;UACXf,GAAG,EAAE;YACD,IAAIe,QAAQ,CAACf,GAAG,IAAI,CAAC,CAAC,CAAC;YACvBgB,eAAe,EAAEd,aAAa,CAACW;UACnC;QACJ,CAAC;MACL;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFb,GAAG,CAACE,aAAa,CAACe,0BAA0B,CAACb,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,CAACQ,EAAE;MACxBC,cAAc,EAAEC,QAAQ,IAAI;QACxB,OAAO;UACH,GAAGA,QAAQ;UACXf,GAAG,EAAE;YACD,IAAIe,QAAQ,CAACf,GAAG,IAAI,CAAC,CAAC,CAAC;YACvBgB,eAAe,EAAE;UACrB;QACJ,CAAC;MACL;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;EAEFf,WAAW,CAACiB,kBAAkB,CAACd,SAAS,CAAC,OAAO;IAAEe;EAAK,CAAC,KAAK;IACzD,MAAMH,eAAe,GAAGG,IAAI,CAACJ,QAAQ,EAAEf,GAAG,EAAEgB,eAAe;IAC3D,IAAI,CAACA,eAAe,EAAE;MAClB;IACJ;IAEA,IAAId,aAAa;IACjB,IAAI;MACAA,aAAa,GAAG,MAAMF,GAAG,CAACE,aAAa,CAACkB,GAAG,CAACJ,eAAe,CAAC;IAChE,CAAC,CAAC,OAAOK,EAAE,EAAE;MACT;AACZ;AACA;AACA;MACY,IAAIA,EAAE,CAACC,IAAI,KAAK,WAAW,EAAE;QACzB,MAAMD,EAAE;MACZ;IACJ;IAEA,IAAInB,aAAa,EAAE;MACf,MAAM,IAAIqB,cAAK,CACV,kGAAiG,EAClG,4BAA4B,EAC5B;QACIP,eAAe;QACfG;MACJ,CACJ,CAAC;IACL;EACJ,CAAC,CAAC;AACN,CAAC;AAACK,OAAA,CAAA1B,uBAAA,GAAAA,uBAAA"}
|
@@ -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,6 @@ const linkWorkflowToPage = params => {
|
|
190
161
|
}
|
191
162
|
});
|
192
163
|
};
|
164
|
+
exports.linkWorkflowToPage = linkWorkflowToPage;
|
193
165
|
|
194
|
-
|
166
|
+
//# sourceMappingURL=linkWorkflowToPage.js.map
|
@@ -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;IAAEC,GAAF;IAAOC;EAAP,IAAuBF,MAA7B;EAEAE,WAAW,CAACC,kBAAZ,CAA+BC,SAA/B,CAA2E,OAAO;IAAEC;EAAF,CAAP,KAAoB;IAC3F,MAAM,IAAAC,2BAAA,EAAqB;MAAEC,YAAY,EAAEN,GAAG,CAACO,QAAJ,CAAaC,IAA7B;MAAmCJ;IAAnC,CAArB,CAAN;EACH,CAFD;EAGAH,WAAW,CAACQ,sBAAZ,CAAmCN,SAAnC,CACI,MAAMJ,MAAN,IAAgB;IACZ,MAAM;MAAEK,IAAF;MAAQM;IAAR,IAAqBX,MAA3B;IACA;AACZ;AACA;AACA;;IACY,MAAMY,uBAAuB,GAAG,IAAAC,YAAA,EAAIF,QAAJ,EAAc,8BAAd,CAAhC;;IACA,IAAIC,uBAAJ,EAA6B;MACzBP,IAAI,CAACS,QAAL,CAAcb,GAAd,CAAkBc,eAAlB,GAAoC,IAApC;IACH;IAED;AACZ;AACA;AACA;;;IACY,MAAMC,kBAAkB,GAAG,IAAAH,YAAA,EAAIF,QAAJ,EAAc,yBAAd,CAA3B;;IACA,IAAIK,kBAAJ,EAAwB;MACpB;IACH;IACD;AACZ;AACA;;;IACY,MAAM,IAAAV,2BAAA,EAAqB;MAAEC,YAAY,EAAEN,GAAG,CAACO,QAAJ,CAAaC,IAA7B;MAAmCJ;IAAnC,CAArB,CAAN;EACH,CAxBL;EA0BAH,WAAW,CAACe,kBAAZ,CAA+Bb,SAA/B,CAA2E,MAAMJ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AAU,EAAElC,WAAW,CAACkC,UAFH;QAGrBC,YAAY,EAAEJ,GAHO;QAIrBK,cAAc,EAAExB,QAAQ,IAAI;UACxB,OAAO,IAAAyB,YAAA,EAAIzB,QAAJ,EAAc,gBAAd,EAAgCN,QAAQ,CAACgC,EAAzC,CAAP;QACH;MANoB,CAAnB,CAAN;IAQH;;IACD,KAAK,MAAMP,GAAX,IAAkBa,YAAlB,EAAgC;MAC5B,MAAM,IAAAZ,yBAAA,EAAmB;QACrBC,OAAO,EAAEjC,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":["_get","_interopRequireDefault","require","_set","_types","_utils","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","exports"],"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,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA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;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;AAACmC,OAAA,CAAAlD,kBAAA,GAAAA,kBAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const createChangeRequestNotification: () => import("../../../ApwChangeRequestNotification").ApwChangeRequestNotification;
|
@@ -0,0 +1,33 @@
|
|
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;
|
32
|
+
|
33
|
+
//# sourceMappingURL=changeRequestNotification.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_types","require","_ApwChangeRequestNotification","createChangeRequestNotification","plugin","createApwChangeRequestNotification","ApwContentTypes","PAGE","params","changeRequestUrl","contentUrl","text","name","type","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,6BAAA,GAAAD,OAAA;AAEO,MAAME,+BAA+B,GAAGA,CAAA,KAAM;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;AAACU,OAAA,CAAAX,+BAAA,GAAAA,+BAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const createCommentNotification: () => import("../../../ApwCommentNotification").ApwCommentNotification;
|
@@ -0,0 +1,33 @@
|
|
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;
|
32
|
+
|
33
|
+
//# sourceMappingURL=commentNotification.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_ApwCommentNotification","require","_types","createCommentNotification","plugin","createApwCommentNotification","ApwContentTypes","PAGE","params","commentUrl","contentUrl","text","name","type","exports"],"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,IAAAA,uBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAEO,MAAME,yBAAyB,GAAGA,CAAA,KAAM;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;AAACU,OAAA,CAAAX,yBAAA,GAAAA,yBAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const createContentReviewNotification: () => import("../../../ApwContentReviewNotification").ApwContentReviewNotification;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createContentReviewNotification = void 0;
|
7
|
+
var _types = require("../../../types");
|
8
|
+
var _ApwContentReviewNotification = require("../../../ApwContentReviewNotification");
|
9
|
+
const createContentReviewNotification = () => {
|
10
|
+
const plugin = (0, _ApwContentReviewNotification.createApwContentReviewNotification)(_types.ApwContentTypes.PAGE, params => {
|
11
|
+
const {
|
12
|
+
contentReviewUrl,
|
13
|
+
contentUrl
|
14
|
+
} = params;
|
15
|
+
return {
|
16
|
+
text: `
|
17
|
+
Hi,<br /><br />
|
18
|
+
|
19
|
+
You have received a <a href="${contentReviewUrl}">content review</a>, for <a href="${contentUrl}">this</a> page.<br /><br />
|
20
|
+
|
21
|
+
Here are the full URLs:<br /><br />
|
22
|
+
|
23
|
+
Content Review: ${contentReviewUrl}<br />
|
24
|
+
Page: ${contentUrl}
|
25
|
+
`
|
26
|
+
};
|
27
|
+
});
|
28
|
+
plugin.name = `${plugin.type}.${_types.ApwContentTypes.PAGE}.default`;
|
29
|
+
return plugin;
|
30
|
+
};
|
31
|
+
exports.createContentReviewNotification = createContentReviewNotification;
|
32
|
+
|
33
|
+
//# sourceMappingURL=contentReviewNotification.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_types","require","_ApwContentReviewNotification","createContentReviewNotification","plugin","createApwContentReviewNotification","ApwContentTypes","PAGE","params","contentReviewUrl","contentUrl","text","name","type","exports"],"sources":["contentReviewNotification.ts"],"sourcesContent":["import { ApwContentTypes } from \"~/types\";\nimport { createApwContentReviewNotification } from \"~/ApwContentReviewNotification\";\n\nexport const createContentReviewNotification = () => {\n const plugin = createApwContentReviewNotification(ApwContentTypes.PAGE, params => {\n const { contentReviewUrl, contentUrl } = params;\n return {\n text: `\n Hi,<br /><br />\n \n You have received a <a href=\"${contentReviewUrl}\">content review</a>, for <a href=\"${contentUrl}\">this</a> page.<br /><br />\n \n Here are the full URLs:<br /><br />\n \n Content Review: ${contentReviewUrl}<br />\n Page: ${contentUrl}\n `\n };\n });\n\n plugin.name = `${plugin.type}.${ApwContentTypes.PAGE}.default`;\n\n return plugin;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,6BAAA,GAAAD,OAAA;AAEO,MAAME,+BAA+B,GAAGA,CAAA,KAAM;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;AAACU,OAAA,CAAAX,+BAAA,GAAAA,+BAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const createContentUrlPlugin: () => import("../../../ApwContentUrlPlugin").ApwContentUrlPlugin;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.createContentUrlPlugin = void 0;
|
7
|
+
var _ApwContentUrlPlugin = require("../../../ApwContentUrlPlugin");
|
8
|
+
var _types = require("../../../types");
|
9
|
+
/**
|
10
|
+
* In this file we create a plugin which in turn creates a content entry url when requested by the code which sends notifications.
|
11
|
+
* Due to multiple content types for the APW, everything needs to be pluginable.
|
12
|
+
*/
|
13
|
+
|
14
|
+
const createPageUrl = params => {
|
15
|
+
/**
|
16
|
+
* All variables must exist for URL to be created.
|
17
|
+
* We go through all vars and throw a log if it does not exist.
|
18
|
+
*/
|
19
|
+
for (const key in params) {
|
20
|
+
if (!!key) {
|
21
|
+
continue;
|
22
|
+
}
|
23
|
+
console.log(`Missing variable "${key}", which we use to create a page URL.`);
|
24
|
+
return null;
|
25
|
+
}
|
26
|
+
const {
|
27
|
+
baseUrl,
|
28
|
+
id
|
29
|
+
} = params;
|
30
|
+
return `${baseUrl}/page-builder/pages?id=${id}`;
|
31
|
+
};
|
32
|
+
const createContentUrlPlugin = () => {
|
33
|
+
return (0, _ApwContentUrlPlugin.createApwContentUrlPlugin)(_types.ApwContentTypes.PAGE, params => {
|
34
|
+
const {
|
35
|
+
baseUrl,
|
36
|
+
contentReview
|
37
|
+
} = params;
|
38
|
+
const {
|
39
|
+
id
|
40
|
+
} = contentReview.content;
|
41
|
+
return createPageUrl({
|
42
|
+
baseUrl,
|
43
|
+
id
|
44
|
+
});
|
45
|
+
});
|
46
|
+
};
|
47
|
+
exports.createContentUrlPlugin = createContentUrlPlugin;
|
48
|
+
|
49
|
+
//# sourceMappingURL=contentUrl.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"names":["_ApwContentUrlPlugin","require","_types","createPageUrl","params","key","console","log","baseUrl","id","createContentUrlPlugin","createApwContentUrlPlugin","ApwContentTypes","PAGE","contentReview","content","exports"],"sources":["contentUrl.ts"],"sourcesContent":["/**\n * In this file we create a plugin which in turn creates a content entry url when requested by the code which sends notifications.\n * Due to multiple content types for the APW, everything needs to be pluginable.\n */\nimport { createApwContentUrlPlugin } from \"~/ApwContentUrlPlugin\";\nimport { ApwContentTypes } from \"~/types\";\n\ninterface CreatePageUrlParams {\n baseUrl?: string;\n id: string;\n}\nconst createPageUrl = (params: CreatePageUrlParams): string | null => {\n /**\n * All variables must exist for URL to be created.\n * We go through all vars and throw a log if it does not exist.\n */\n for (const key in params) {\n if (!!key) {\n continue;\n }\n console.log(`Missing variable \"${key}\", which we use to create a page URL.`);\n return null;\n }\n const { baseUrl, id } = params;\n return `${baseUrl}/page-builder/pages?id=${id}`;\n};\n\nexport const createContentUrlPlugin = () => {\n return createApwContentUrlPlugin(ApwContentTypes.PAGE, params => {\n const { baseUrl, contentReview } = params;\n const { id } = contentReview.content;\n return createPageUrl({\n baseUrl,\n id\n });\n });\n};\n"],"mappings":";;;;;;AAIA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AALA;AACA;AACA;AACA;;AAQA,MAAME,aAAa,GAAIC,MAA2B,IAAoB;EAClE;AACJ;AACA;AACA;EACI,KAAK,MAAMC,GAAG,IAAID,MAAM,EAAE;IACtB,IAAI,CAAC,CAACC,GAAG,EAAE;MACP;IACJ;IACAC,OAAO,CAACC,GAAG,CAAE,qBAAoBF,GAAI,uCAAsC,CAAC;IAC5E,OAAO,IAAI;EACf;EACA,MAAM;IAAEG,OAAO;IAAEC;EAAG,CAAC,GAAGL,MAAM;EAC9B,OAAQ,GAAEI,OAAQ,0BAAyBC,EAAG,EAAC;AACnD,CAAC;AAEM,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EACxC,OAAO,IAAAC,8CAAyB,EAACC,sBAAe,CAACC,IAAI,EAAET,MAAM,IAAI;IAC7D,MAAM;MAAEI,OAAO;MAAEM;IAAc,CAAC,GAAGV,MAAM;IACzC,MAAM;MAAEK;IAAG,CAAC,GAAGK,aAAa,CAACC,OAAO;IACpC,OAAOZ,aAAa,CAAC;MACjBK,OAAO;MACPC;IACJ,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAAN,sBAAA,GAAAA,sBAAA"}
|