-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21793 from Yoast/21769-new-general-page-local-seo…
…-notice-still-visible Hide Local notice when site representation is completed via the FTC
- Loading branch information
Showing
5 changed files
with
77 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { createSlice } from "@reduxjs/toolkit"; | ||
import { get } from "lodash"; | ||
|
||
export const FTC_NAME = "firstTimeConfiguration"; | ||
|
||
const slice = createSlice( { | ||
name: FTC_NAME, | ||
initialState: { resolvedNotices: [] }, | ||
reducers: { | ||
/** | ||
* @param {Object} state The state of the slice. | ||
* @param {string} noticeID The ID of the notice to resolve. | ||
* @returns {void} | ||
*/ | ||
resolveNotice( state, { payload: noticeID } ) { | ||
if ( ! state.resolvedNotices.includes( noticeID ) ) { | ||
state.resolvedNotices.push( noticeID ); | ||
} | ||
}, | ||
/** | ||
* @param {Object} state The state of the slice. | ||
* @param {string} noticeID The ID of the notice to unresolve. | ||
* @returns {void} | ||
*/ | ||
unresolveNotice( state, { payload: noticeID } ) { | ||
state.resolvedNotices = state.resolvedNotices.filter( ( id ) => id !== noticeID ); | ||
}, | ||
}, | ||
} ); | ||
|
||
/** | ||
* @returns {Object} The initial state. | ||
*/ | ||
export const getInitialFirstTimeConfigurationState = slice.getInitialState; | ||
|
||
export const firstTimeConfigurationSelectors = { | ||
selectResolvedNotices: state => get( state, `${ FTC_NAME }.resolvedNotices`, [] ), | ||
}; | ||
|
||
export const firstTimeConfigurationActions = slice.actions; | ||
|
||
export const firstTimeConfigurationReducer = slice.reducer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters