Add personalizationTags state to custom editor

[MAILPOET-6354]
This commit is contained in:
Jan Lysý
2024-11-29 18:17:21 +01:00
committed by Aschepikov
parent 7f2f9ff7ca
commit 1d11502e93
5 changed files with 29 additions and 0 deletions

View File

@ -38,6 +38,15 @@ export function togglePreviewModal( isOpen: boolean ) {
} as const; } as const;
} }
export function togglePersonalizationTagsModal( isOpen: boolean ) {
return {
type: 'CHANGE_PERSONALIZATION_TAGS_STATE',
state: { isModalOpened: isOpen } as Partial<
State[ 'personalizationTags' ]
>,
} as const;
}
export function updateSendPreviewEmail( toEmail: string ) { export function updateSendPreviewEmail( toEmail: string ) {
return { return {
type: 'CHANGE_PREVIEW_STATE', type: 'CHANGE_PREVIEW_STATE',

View File

@ -38,5 +38,8 @@ export function getInitialState(): State {
isSendingPreviewEmail: false, isSendingPreviewEmail: false,
sendingPreviewStatus: null, sendingPreviewStatus: null,
}, },
personalizationTags: {
isModalOpened: false,
},
}; };
} }

View File

@ -7,6 +7,14 @@ export function reducer( state: State, action ): State {
...state, ...state,
preview: { ...state.preview, ...action.state }, preview: { ...state.preview, ...action.state },
}; };
case 'CHANGE_PERSONALIZATION_TAGS_STATE':
return {
...state,
personalizationTags: {
...state.personalizationTags,
...action.state,
},
};
case 'TOGGLE_SETTINGS_SIDEBAR_ACTIVE_TAB': case 'TOGGLE_SETTINGS_SIDEBAR_ACTIVE_TAB':
return { return {
...state, ...state,

View File

@ -280,6 +280,12 @@ export function getPreviewState( state: State ): State[ 'preview' ] {
return state.preview; return state.preview;
} }
export function getPersonalizationTagsState(
state: State
): State[ 'personalizationTags' ] {
return state.personalizationTags;
}
export const getDeviceType = createRegistrySelector( export const getDeviceType = createRegistrySelector(
( select ) => () => ( select ) => () =>
// @ts-expect-error getDeviceType is missing in types. // @ts-expect-error getDeviceType is missing in types.

View File

@ -193,6 +193,9 @@ export type State = {
isSendingPreviewEmail: boolean; isSendingPreviewEmail: boolean;
sendingPreviewStatus: SendingPreviewStatus | null; sendingPreviewStatus: SendingPreviewStatus | null;
}; };
personalizationTags: {
isModalOpened: boolean;
};
}; };
export type MailPoetEmailData = { export type MailPoetEmailData = {