|
1 | 1 | import { createAbstraction } from "@webiny/feature/api"; |
2 | 2 |
|
3 | | -export interface INotificationTypeMessage { |
4 | | - title: string; |
5 | | - body: string; |
6 | | - url: string; |
| 3 | +export interface INotificationMessageTitleParams { |
| 4 | + id: string; |
| 5 | + entryTitle: string; |
7 | 6 | } |
8 | 7 |
|
9 | | -export const NotificationTypeMessageOnRequestReview = createAbstraction<INotificationTypeMessage>( |
10 | | - "WorkflowNotificationTypeMessageOnRequestReview" |
| 8 | +export interface INotificationMessageBodyParams { |
| 9 | + id: string; |
| 10 | + entryTitle: string; |
| 11 | +} |
| 12 | + |
| 13 | +export interface INotificationMessageUrlParams { |
| 14 | + id: string; |
| 15 | + entryTitle: string; |
| 16 | +} |
| 17 | + |
| 18 | +export interface INotificationMessage { |
| 19 | + getTitle(params: INotificationMessageTitleParams): string; |
| 20 | + getBody(params: INotificationMessageBodyParams): string; |
| 21 | + getUrl(params: INotificationMessageUrlParams): string; |
| 22 | +} |
| 23 | + |
| 24 | +export const NotificationReviewRequestMessage = createAbstraction<INotificationMessage>( |
| 25 | + "WorkflowNotificationReviewRequestMessage" |
11 | 26 | ); |
12 | 27 |
|
13 | | -export namespace NotificationTypeMessageOnRequestReview { |
14 | | - export type Interface = INotificationTypeMessage; |
| 28 | +export namespace NotificationReviewRequestMessage { |
| 29 | + export type Interface = INotificationMessage; |
15 | 30 | } |
16 | 31 |
|
17 | | -export const NotificationTypeMessageOnRequestReviewCancel = |
18 | | - createAbstraction<INotificationTypeMessage>( |
19 | | - "WorkflowNotificationTypeMessageOnRequestReviewCancel" |
20 | | - ); |
| 32 | +export const NotificationReviewCancelMessage = createAbstraction<INotificationMessage>( |
| 33 | + "WorkflowNotificationReviewCancelMessage" |
| 34 | +); |
21 | 35 |
|
22 | | -export namespace NotificationTypeMessageOnRequestReviewCancel { |
23 | | - export type Interface = INotificationTypeMessage; |
| 36 | +export namespace NotificationReviewCancelMessage { |
| 37 | + export type Interface = INotificationMessage; |
24 | 38 | } |
25 | 39 |
|
26 | | -export const NotificationTypeMessageOnReviewStepStart = createAbstraction<INotificationTypeMessage>( |
27 | | - "WorkflowNotificationTypeMessageOnReviewStepStart" |
| 40 | +export const NotificationReviewStepStartMessage = createAbstraction<INotificationMessage>( |
| 41 | + "WorkflowNotificationReviewStepStartMessage" |
28 | 42 | ); |
29 | 43 |
|
30 | | -export namespace NotificationTypeMessageOnReviewStepStart { |
31 | | - export type Interface = INotificationTypeMessage; |
| 44 | +export namespace NotificationReviewStepStartMessage { |
| 45 | + export type Interface = INotificationMessage; |
32 | 46 | } |
33 | 47 |
|
34 | | -export const NotificationTypeMessageOnReviewStepApprove = |
35 | | - createAbstraction<INotificationTypeMessage>( |
36 | | - "WorkflowNotificationTypeMessageOnReviewStepApprove" |
37 | | - ); |
| 48 | +export const NotificationReviewStepApproveMessage = createAbstraction<INotificationMessage>( |
| 49 | + "WorkflowNotificationReviewStepApproveMessage" |
| 50 | +); |
38 | 51 |
|
39 | | -export namespace NotificationTypeMessageOnReviewStepApprove { |
40 | | - export type Interface = INotificationTypeMessage; |
| 52 | +export namespace NotificationReviewStepApproveMessage { |
| 53 | + export type Interface = INotificationMessage; |
41 | 54 | } |
42 | 55 |
|
43 | | -export const NotificationTypeMessageOnReviewReject = createAbstraction<INotificationTypeMessage>( |
44 | | - "WorkflowNotificationTypeMessageOnReviewReject" |
| 56 | +export const NotificationReviewRejectMessage = createAbstraction<INotificationMessage>( |
| 57 | + "WorkflowNotificationReviewRejectMessage" |
45 | 58 | ); |
46 | 59 |
|
47 | | -export namespace NotificationTypeMessageOnReviewReject { |
48 | | - export type Interface = INotificationTypeMessage; |
| 60 | +export namespace NotificationReviewRejectMessage { |
| 61 | + export type Interface = INotificationMessage; |
49 | 62 | } |
50 | 63 |
|
51 | | -export const NotificationTypeMessageOnReviewApprove = createAbstraction<INotificationTypeMessage>( |
52 | | - "WorkflowNotificationTypeMessageOnReviewApprove" |
| 64 | +export const NotificationReviewApproveMessage = createAbstraction<INotificationMessage>( |
| 65 | + "WorkflowNotificationReviewApproveMessage" |
53 | 66 | ); |
54 | 67 |
|
55 | | -export namespace NotificationTypeMessageOnReviewApprove { |
56 | | - export type Interface = INotificationTypeMessage; |
| 68 | +export namespace NotificationReviewApproveMessage { |
| 69 | + export type Interface = INotificationMessage; |
57 | 70 | } |
58 | 71 |
|
59 | | -export type INotificationTypes = |
60 | | - | NotificationTypeMessageOnRequestReview.Interface |
61 | | - | NotificationTypeMessageOnRequestReviewCancel.Interface |
62 | | - | NotificationTypeMessageOnReviewStepStart.Interface |
63 | | - | NotificationTypeMessageOnReviewStepApprove.Interface |
64 | | - | NotificationTypeMessageOnReviewReject.Interface |
65 | | - | NotificationTypeMessageOnReviewApprove.Interface; |
| 72 | +export type INotificationMessages = |
| 73 | + | NotificationReviewRequestMessage.Interface |
| 74 | + | NotificationReviewCancelMessage.Interface |
| 75 | + | NotificationReviewStepStartMessage.Interface |
| 76 | + | NotificationReviewStepApproveMessage.Interface |
| 77 | + | NotificationReviewRejectMessage.Interface |
| 78 | + | NotificationReviewApproveMessage.Interface; |
| 79 | + |
66 | 80 |
|
67 | 81 | export interface INotificationTypeMessages { |
68 | 82 | /** |
69 | 83 | * User requests a review for a content. |
70 | 84 | */ |
71 | | - onRequestReview: NotificationTypeMessageOnRequestReview.Interface; |
| 85 | + reviewRequest: NotificationReviewRequestMessage.Interface; |
72 | 86 | /** |
73 | 87 | * User cancels a review for a content. |
74 | 88 | */ |
75 | | - onRequestReviewCancel: NotificationTypeMessageOnRequestReviewCancel.Interface; |
| 89 | + reviewCancel: NotificationReviewCancelMessage.Interface; |
76 | 90 | /** |
77 | 91 | * Reviewer starts a review step. |
78 | 92 | */ |
79 | | - onReviewStepStart: NotificationTypeMessageOnReviewStepStart.Interface; |
| 93 | + reviewStepStart: NotificationReviewStepStartMessage.Interface; |
80 | 94 | /** |
81 | 95 | * Reviewer approves a review step - there are more steps after this one. |
82 | 96 | */ |
83 | | - onReviewStepApprove: NotificationTypeMessageOnReviewStepApprove.Interface; |
| 97 | + reviewStepApprove: NotificationReviewStepApproveMessage.Interface; |
84 | 98 | /** |
85 | 99 | * Reviewer rejects a review - no step specific reject because as soon as step is rejected, whole review is rejected. |
86 | 100 | */ |
87 | | - onReviewReject: NotificationTypeMessageOnReviewReject.Interface; |
| 101 | + reviewReject: NotificationReviewRejectMessage.Interface; |
88 | 102 | /** |
89 | 103 | * Reviewer approves a final review step. |
90 | 104 | */ |
91 | | - onReviewApprove: NotificationTypeMessageOnReviewApprove.Interface; |
| 105 | + reviewApprove: NotificationReviewApproveMessage.Interface; |
92 | 106 | } |
93 | 107 |
|
94 | 108 | export interface INotificationType { |
|
0 commit comments