Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: notices.js
/******/ (() => { // webpackBootstrap
[0] Fix | Delete
/******/ "use strict";
[1] Fix | Delete
/******/ // The require scope
[2] Fix | Delete
/******/ var __webpack_require__ = {};
[3] Fix | Delete
/******/
[4] Fix | Delete
/************************************************************************/
[5] Fix | Delete
/******/ /* webpack/runtime/define property getters */
[6] Fix | Delete
/******/ (() => {
[7] Fix | Delete
/******/ // define getter functions for harmony exports
[8] Fix | Delete
/******/ __webpack_require__.d = (exports, definition) => {
[9] Fix | Delete
/******/ for(var key in definition) {
[10] Fix | Delete
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
[11] Fix | Delete
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
[12] Fix | Delete
/******/ }
[13] Fix | Delete
/******/ }
[14] Fix | Delete
/******/ };
[15] Fix | Delete
/******/ })();
[16] Fix | Delete
/******/
[17] Fix | Delete
/******/ /* webpack/runtime/hasOwnProperty shorthand */
[18] Fix | Delete
/******/ (() => {
[19] Fix | Delete
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
[20] Fix | Delete
/******/ })();
[21] Fix | Delete
/******/
[22] Fix | Delete
/******/ /* webpack/runtime/make namespace object */
[23] Fix | Delete
/******/ (() => {
[24] Fix | Delete
/******/ // define __esModule on exports
[25] Fix | Delete
/******/ __webpack_require__.r = (exports) => {
[26] Fix | Delete
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
[27] Fix | Delete
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
[28] Fix | Delete
/******/ }
[29] Fix | Delete
/******/ Object.defineProperty(exports, '__esModule', { value: true });
[30] Fix | Delete
/******/ };
[31] Fix | Delete
/******/ })();
[32] Fix | Delete
/******/
[33] Fix | Delete
/************************************************************************/
[34] Fix | Delete
var __webpack_exports__ = {};
[35] Fix | Delete
// ESM COMPAT FLAG
[36] Fix | Delete
__webpack_require__.r(__webpack_exports__);
[37] Fix | Delete
[38] Fix | Delete
// EXPORTS
[39] Fix | Delete
__webpack_require__.d(__webpack_exports__, {
[40] Fix | Delete
store: () => (/* reexport */ store)
[41] Fix | Delete
});
[42] Fix | Delete
[43] Fix | Delete
// NAMESPACE OBJECT: ./node_modules/@wordpress/notices/build-module/store/actions.js
[44] Fix | Delete
var actions_namespaceObject = {};
[45] Fix | Delete
__webpack_require__.r(actions_namespaceObject);
[46] Fix | Delete
__webpack_require__.d(actions_namespaceObject, {
[47] Fix | Delete
createErrorNotice: () => (createErrorNotice),
[48] Fix | Delete
createInfoNotice: () => (createInfoNotice),
[49] Fix | Delete
createNotice: () => (createNotice),
[50] Fix | Delete
createSuccessNotice: () => (createSuccessNotice),
[51] Fix | Delete
createWarningNotice: () => (createWarningNotice),
[52] Fix | Delete
removeAllNotices: () => (removeAllNotices),
[53] Fix | Delete
removeNotice: () => (removeNotice),
[54] Fix | Delete
removeNotices: () => (removeNotices)
[55] Fix | Delete
});
[56] Fix | Delete
[57] Fix | Delete
// NAMESPACE OBJECT: ./node_modules/@wordpress/notices/build-module/store/selectors.js
[58] Fix | Delete
var selectors_namespaceObject = {};
[59] Fix | Delete
__webpack_require__.r(selectors_namespaceObject);
[60] Fix | Delete
__webpack_require__.d(selectors_namespaceObject, {
[61] Fix | Delete
getNotices: () => (getNotices)
[62] Fix | Delete
});
[63] Fix | Delete
[64] Fix | Delete
;// CONCATENATED MODULE: external ["wp","data"]
[65] Fix | Delete
const external_wp_data_namespaceObject = window["wp"]["data"];
[66] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/utils/on-sub-key.js
[67] Fix | Delete
/**
[68] Fix | Delete
* Higher-order reducer creator which creates a combined reducer object, keyed
[69] Fix | Delete
* by a property on the action object.
[70] Fix | Delete
*
[71] Fix | Delete
* @param {string} actionProperty Action property by which to key object.
[72] Fix | Delete
*
[73] Fix | Delete
* @return {Function} Higher-order reducer.
[74] Fix | Delete
*/
[75] Fix | Delete
const onSubKey = actionProperty => reducer => (state = {}, action) => {
[76] Fix | Delete
// Retrieve subkey from action. Do not track if undefined; useful for cases
[77] Fix | Delete
// where reducer is scoped by action shape.
[78] Fix | Delete
const key = action[actionProperty];
[79] Fix | Delete
if (key === undefined) {
[80] Fix | Delete
return state;
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
// Avoid updating state if unchanged. Note that this also accounts for a
[84] Fix | Delete
// reducer which returns undefined on a key which is not yet tracked.
[85] Fix | Delete
const nextKeyState = reducer(state[key], action);
[86] Fix | Delete
if (nextKeyState === state[key]) {
[87] Fix | Delete
return state;
[88] Fix | Delete
}
[89] Fix | Delete
return {
[90] Fix | Delete
...state,
[91] Fix | Delete
[key]: nextKeyState
[92] Fix | Delete
};
[93] Fix | Delete
};
[94] Fix | Delete
/* harmony default export */ const on_sub_key = (onSubKey);
[95] Fix | Delete
[96] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/reducer.js
[97] Fix | Delete
/**
[98] Fix | Delete
* Internal dependencies
[99] Fix | Delete
*/
[100] Fix | Delete
[101] Fix | Delete
[102] Fix | Delete
/**
[103] Fix | Delete
* Reducer returning the next notices state. The notices state is an object
[104] Fix | Delete
* where each key is a context, its value an array of notice objects.
[105] Fix | Delete
*
[106] Fix | Delete
* @param {Object} state Current state.
[107] Fix | Delete
* @param {Object} action Dispatched action.
[108] Fix | Delete
*
[109] Fix | Delete
* @return {Object} Updated state.
[110] Fix | Delete
*/
[111] Fix | Delete
const notices = on_sub_key('context')((state = [], action) => {
[112] Fix | Delete
switch (action.type) {
[113] Fix | Delete
case 'CREATE_NOTICE':
[114] Fix | Delete
// Avoid duplicates on ID.
[115] Fix | Delete
return [...state.filter(({
[116] Fix | Delete
id
[117] Fix | Delete
}) => id !== action.notice.id), action.notice];
[118] Fix | Delete
case 'REMOVE_NOTICE':
[119] Fix | Delete
return state.filter(({
[120] Fix | Delete
id
[121] Fix | Delete
}) => id !== action.id);
[122] Fix | Delete
case 'REMOVE_NOTICES':
[123] Fix | Delete
return state.filter(({
[124] Fix | Delete
id
[125] Fix | Delete
}) => !action.ids.includes(id));
[126] Fix | Delete
case 'REMOVE_ALL_NOTICES':
[127] Fix | Delete
return state.filter(({
[128] Fix | Delete
type
[129] Fix | Delete
}) => type !== action.noticeType);
[130] Fix | Delete
}
[131] Fix | Delete
return state;
[132] Fix | Delete
});
[133] Fix | Delete
/* harmony default export */ const reducer = (notices);
[134] Fix | Delete
[135] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/constants.js
[136] Fix | Delete
/**
[137] Fix | Delete
* Default context to use for notice grouping when not otherwise specified. Its
[138] Fix | Delete
* specific value doesn't hold much meaning, but it must be reasonably unique
[139] Fix | Delete
* and, more importantly, referenced consistently in the store implementation.
[140] Fix | Delete
*
[141] Fix | Delete
* @type {string}
[142] Fix | Delete
*/
[143] Fix | Delete
const DEFAULT_CONTEXT = 'global';
[144] Fix | Delete
[145] Fix | Delete
/**
[146] Fix | Delete
* Default notice status.
[147] Fix | Delete
*
[148] Fix | Delete
* @type {string}
[149] Fix | Delete
*/
[150] Fix | Delete
const DEFAULT_STATUS = 'info';
[151] Fix | Delete
[152] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/notices/build-module/store/actions.js
[153] Fix | Delete
/**
[154] Fix | Delete
* Internal dependencies
[155] Fix | Delete
*/
[156] Fix | Delete
[157] Fix | Delete
[158] Fix | Delete
/**
[159] Fix | Delete
* @typedef {Object} WPNoticeAction Object describing a user action option associated with a notice.
[160] Fix | Delete
*
[161] Fix | Delete
* @property {string} label Message to use as action label.
[162] Fix | Delete
* @property {?string} url Optional URL of resource if action incurs
[163] Fix | Delete
* browser navigation.
[164] Fix | Delete
* @property {?Function} onClick Optional function to invoke when action is
[165] Fix | Delete
* triggered by user.
[166] Fix | Delete
*/
[167] Fix | Delete
[168] Fix | Delete
let uniqueId = 0;
[169] Fix | Delete
[170] Fix | Delete
/**
[171] Fix | Delete
* Returns an action object used in signalling that a notice is to be created.
[172] Fix | Delete
*
[173] Fix | Delete
* @param {string|undefined} status Notice status ("info" if undefined is passed).
[174] Fix | Delete
* @param {string} content Notice message.
[175] Fix | Delete
* @param {Object} [options] Notice options.
[176] Fix | Delete
* @param {string} [options.context='global'] Context under which to
[177] Fix | Delete
* group notice.
[178] Fix | Delete
* @param {string} [options.id] Identifier for notice.
[179] Fix | Delete
* Automatically assigned
[180] Fix | Delete
* if not specified.
[181] Fix | Delete
* @param {boolean} [options.isDismissible=true] Whether the notice can
[182] Fix | Delete
* be dismissed by user.
[183] Fix | Delete
* @param {string} [options.type='default'] Type of notice, one of
[184] Fix | Delete
* `default`, or `snackbar`.
[185] Fix | Delete
* @param {boolean} [options.speak=true] Whether the notice
[186] Fix | Delete
* content should be
[187] Fix | Delete
* announced to screen
[188] Fix | Delete
* readers.
[189] Fix | Delete
* @param {Array<WPNoticeAction>} [options.actions] User actions to be
[190] Fix | Delete
* presented with notice.
[191] Fix | Delete
* @param {string} [options.icon] An icon displayed with the notice.
[192] Fix | Delete
* Only used when type is set to `snackbar`.
[193] Fix | Delete
* @param {boolean} [options.explicitDismiss] Whether the notice includes
[194] Fix | Delete
* an explicit dismiss button and
[195] Fix | Delete
* can't be dismissed by clicking
[196] Fix | Delete
* the body of the notice. Only applies
[197] Fix | Delete
* when type is set to `snackbar`.
[198] Fix | Delete
* @param {Function} [options.onDismiss] Called when the notice is dismissed.
[199] Fix | Delete
*
[200] Fix | Delete
* @example
[201] Fix | Delete
* ```js
[202] Fix | Delete
* import { __ } from '@wordpress/i18n';
[203] Fix | Delete
* import { useDispatch } from '@wordpress/data';
[204] Fix | Delete
* import { store as noticesStore } from '@wordpress/notices';
[205] Fix | Delete
* import { Button } from '@wordpress/components';
[206] Fix | Delete
*
[207] Fix | Delete
* const ExampleComponent = () => {
[208] Fix | Delete
* const { createNotice } = useDispatch( noticesStore );
[209] Fix | Delete
* return (
[210] Fix | Delete
* <Button
[211] Fix | Delete
* onClick={ () => createNotice( 'success', __( 'Notice message' ) ) }
[212] Fix | Delete
* >
[213] Fix | Delete
* { __( 'Generate a success notice!' ) }
[214] Fix | Delete
* </Button>
[215] Fix | Delete
* );
[216] Fix | Delete
* };
[217] Fix | Delete
* ```
[218] Fix | Delete
*
[219] Fix | Delete
* @return {Object} Action object.
[220] Fix | Delete
*/
[221] Fix | Delete
function createNotice(status = DEFAULT_STATUS, content, options = {}) {
[222] Fix | Delete
const {
[223] Fix | Delete
speak = true,
[224] Fix | Delete
isDismissible = true,
[225] Fix | Delete
context = DEFAULT_CONTEXT,
[226] Fix | Delete
id = `${context}${++uniqueId}`,
[227] Fix | Delete
actions = [],
[228] Fix | Delete
type = 'default',
[229] Fix | Delete
__unstableHTML,
[230] Fix | Delete
icon = null,
[231] Fix | Delete
explicitDismiss = false,
[232] Fix | Delete
onDismiss
[233] Fix | Delete
} = options;
[234] Fix | Delete
[235] Fix | Delete
// The supported value shape of content is currently limited to plain text
[236] Fix | Delete
// strings. To avoid setting expectation that e.g. a React Element could be
[237] Fix | Delete
// supported, cast to a string.
[238] Fix | Delete
content = String(content);
[239] Fix | Delete
return {
[240] Fix | Delete
type: 'CREATE_NOTICE',
[241] Fix | Delete
context,
[242] Fix | Delete
notice: {
[243] Fix | Delete
id,
[244] Fix | Delete
status,
[245] Fix | Delete
content,
[246] Fix | Delete
spokenMessage: speak ? content : null,
[247] Fix | Delete
__unstableHTML,
[248] Fix | Delete
isDismissible,
[249] Fix | Delete
actions,
[250] Fix | Delete
type,
[251] Fix | Delete
icon,
[252] Fix | Delete
explicitDismiss,
[253] Fix | Delete
onDismiss
[254] Fix | Delete
}
[255] Fix | Delete
};
[256] Fix | Delete
}
[257] Fix | Delete
[258] Fix | Delete
/**
[259] Fix | Delete
* Returns an action object used in signalling that a success notice is to be
[260] Fix | Delete
* created. Refer to `createNotice` for options documentation.
[261] Fix | Delete
*
[262] Fix | Delete
* @see createNotice
[263] Fix | Delete
*
[264] Fix | Delete
* @param {string} content Notice message.
[265] Fix | Delete
* @param {Object} [options] Optional notice options.
[266] Fix | Delete
*
[267] Fix | Delete
* @example
[268] Fix | Delete
* ```js
[269] Fix | Delete
* import { __ } from '@wordpress/i18n';
[270] Fix | Delete
* import { useDispatch } from '@wordpress/data';
[271] Fix | Delete
* import { store as noticesStore } from '@wordpress/notices';
[272] Fix | Delete
* import { Button } from '@wordpress/components';
[273] Fix | Delete
*
[274] Fix | Delete
* const ExampleComponent = () => {
[275] Fix | Delete
* const { createSuccessNotice } = useDispatch( noticesStore );
[276] Fix | Delete
* return (
[277] Fix | Delete
* <Button
[278] Fix | Delete
* onClick={ () =>
[279] Fix | Delete
* createSuccessNotice( __( 'Success!' ), {
[280] Fix | Delete
* type: 'snackbar',
[281] Fix | Delete
* icon: '🔥',
[282] Fix | Delete
* } )
[283] Fix | Delete
* }
[284] Fix | Delete
* >
[285] Fix | Delete
* { __( 'Generate a snackbar success notice!' ) }
[286] Fix | Delete
* </Button>
[287] Fix | Delete
* );
[288] Fix | Delete
* };
[289] Fix | Delete
* ```
[290] Fix | Delete
*
[291] Fix | Delete
* @return {Object} Action object.
[292] Fix | Delete
*/
[293] Fix | Delete
function createSuccessNotice(content, options) {
[294] Fix | Delete
return createNotice('success', content, options);
[295] Fix | Delete
}
[296] Fix | Delete
[297] Fix | Delete
/**
[298] Fix | Delete
* Returns an action object used in signalling that an info notice is to be
[299] Fix | Delete
* created. Refer to `createNotice` for options documentation.
[300] Fix | Delete
*
[301] Fix | Delete
* @see createNotice
[302] Fix | Delete
*
[303] Fix | Delete
* @param {string} content Notice message.
[304] Fix | Delete
* @param {Object} [options] Optional notice options.
[305] Fix | Delete
*
[306] Fix | Delete
* @example
[307] Fix | Delete
* ```js
[308] Fix | Delete
* import { __ } from '@wordpress/i18n';
[309] Fix | Delete
* import { useDispatch } from '@wordpress/data';
[310] Fix | Delete
* import { store as noticesStore } from '@wordpress/notices';
[311] Fix | Delete
* import { Button } from '@wordpress/components';
[312] Fix | Delete
*
[313] Fix | Delete
* const ExampleComponent = () => {
[314] Fix | Delete
* const { createInfoNotice } = useDispatch( noticesStore );
[315] Fix | Delete
* return (
[316] Fix | Delete
* <Button
[317] Fix | Delete
* onClick={ () =>
[318] Fix | Delete
* createInfoNotice( __( 'Something happened!' ), {
[319] Fix | Delete
* isDismissible: false,
[320] Fix | Delete
* } )
[321] Fix | Delete
* }
[322] Fix | Delete
* >
[323] Fix | Delete
* { __( 'Generate a notice that cannot be dismissed.' ) }
[324] Fix | Delete
* </Button>
[325] Fix | Delete
* );
[326] Fix | Delete
* };
[327] Fix | Delete
*```
[328] Fix | Delete
*
[329] Fix | Delete
* @return {Object} Action object.
[330] Fix | Delete
*/
[331] Fix | Delete
function createInfoNotice(content, options) {
[332] Fix | Delete
return createNotice('info', content, options);
[333] Fix | Delete
}
[334] Fix | Delete
[335] Fix | Delete
/**
[336] Fix | Delete
* Returns an action object used in signalling that an error notice is to be
[337] Fix | Delete
* created. Refer to `createNotice` for options documentation.
[338] Fix | Delete
*
[339] Fix | Delete
* @see createNotice
[340] Fix | Delete
*
[341] Fix | Delete
* @param {string} content Notice message.
[342] Fix | Delete
* @param {Object} [options] Optional notice options.
[343] Fix | Delete
*
[344] Fix | Delete
* @example
[345] Fix | Delete
* ```js
[346] Fix | Delete
* import { __ } from '@wordpress/i18n';
[347] Fix | Delete
* import { useDispatch } from '@wordpress/data';
[348] Fix | Delete
* import { store as noticesStore } from '@wordpress/notices';
[349] Fix | Delete
* import { Button } from '@wordpress/components';
[350] Fix | Delete
*
[351] Fix | Delete
* const ExampleComponent = () => {
[352] Fix | Delete
* const { createErrorNotice } = useDispatch( noticesStore );
[353] Fix | Delete
* return (
[354] Fix | Delete
* <Button
[355] Fix | Delete
* onClick={ () =>
[356] Fix | Delete
* createErrorNotice( __( 'An error occurred!' ), {
[357] Fix | Delete
* type: 'snackbar',
[358] Fix | Delete
* explicitDismiss: true,
[359] Fix | Delete
* } )
[360] Fix | Delete
* }
[361] Fix | Delete
* >
[362] Fix | Delete
* { __(
[363] Fix | Delete
* 'Generate an snackbar error notice with explicit dismiss button.'
[364] Fix | Delete
* ) }
[365] Fix | Delete
* </Button>
[366] Fix | Delete
* );
[367] Fix | Delete
* };
[368] Fix | Delete
* ```
[369] Fix | Delete
*
[370] Fix | Delete
* @return {Object} Action object.
[371] Fix | Delete
*/
[372] Fix | Delete
function createErrorNotice(content, options) {
[373] Fix | Delete
return createNotice('error', content, options);
[374] Fix | Delete
}
[375] Fix | Delete
[376] Fix | Delete
/**
[377] Fix | Delete
* Returns an action object used in signalling that a warning notice is to be
[378] Fix | Delete
* created. Refer to `createNotice` for options documentation.
[379] Fix | Delete
*
[380] Fix | Delete
* @see createNotice
[381] Fix | Delete
*
[382] Fix | Delete
* @param {string} content Notice message.
[383] Fix | Delete
* @param {Object} [options] Optional notice options.
[384] Fix | Delete
*
[385] Fix | Delete
* @example
[386] Fix | Delete
* ```js
[387] Fix | Delete
* import { __ } from '@wordpress/i18n';
[388] Fix | Delete
* import { useDispatch } from '@wordpress/data';
[389] Fix | Delete
* import { store as noticesStore } from '@wordpress/notices';
[390] Fix | Delete
* import { Button } from '@wordpress/components';
[391] Fix | Delete
*
[392] Fix | Delete
* const ExampleComponent = () => {
[393] Fix | Delete
* const { createWarningNotice, createInfoNotice } = useDispatch( noticesStore );
[394] Fix | Delete
* return (
[395] Fix | Delete
* <Button
[396] Fix | Delete
* onClick={ () =>
[397] Fix | Delete
* createWarningNotice( __( 'Warning!' ), {
[398] Fix | Delete
* onDismiss: () => {
[399] Fix | Delete
* createInfoNotice(
[400] Fix | Delete
* __( 'The warning has been dismissed!' )
[401] Fix | Delete
* );
[402] Fix | Delete
* },
[403] Fix | Delete
* } )
[404] Fix | Delete
* }
[405] Fix | Delete
* >
[406] Fix | Delete
* { __( 'Generates a warning notice with onDismiss callback' ) }
[407] Fix | Delete
* </Button>
[408] Fix | Delete
* );
[409] Fix | Delete
* };
[410] Fix | Delete
* ```
[411] Fix | Delete
*
[412] Fix | Delete
* @return {Object} Action object.
[413] Fix | Delete
*/
[414] Fix | Delete
function createWarningNotice(content, options) {
[415] Fix | Delete
return createNotice('warning', content, options);
[416] Fix | Delete
}
[417] Fix | Delete
[418] Fix | Delete
/**
[419] Fix | Delete
* Returns an action object used in signalling that a notice is to be removed.
[420] Fix | Delete
*
[421] Fix | Delete
* @param {string} id Notice unique identifier.
[422] Fix | Delete
* @param {string} [context='global'] Optional context (grouping) in which the notice is
[423] Fix | Delete
* intended to appear. Defaults to default context.
[424] Fix | Delete
*
[425] Fix | Delete
* @example
[426] Fix | Delete
* ```js
[427] Fix | Delete
* import { __ } from '@wordpress/i18n';
[428] Fix | Delete
* import { useDispatch } from '@wordpress/data';
[429] Fix | Delete
* import { store as noticesStore } from '@wordpress/notices';
[430] Fix | Delete
* import { Button } from '@wordpress/components';
[431] Fix | Delete
*
[432] Fix | Delete
* const ExampleComponent = () => {
[433] Fix | Delete
* const notices = useSelect( ( select ) => select( noticesStore ).getNotices() );
[434] Fix | Delete
* const { createWarningNotice, removeNotice } = useDispatch( noticesStore );
[435] Fix | Delete
*
[436] Fix | Delete
* return (
[437] Fix | Delete
* <>
[438] Fix | Delete
* <Button
[439] Fix | Delete
* onClick={ () =>
[440] Fix | Delete
* createWarningNotice( __( 'Warning!' ), {
[441] Fix | Delete
* isDismissible: false,
[442] Fix | Delete
* } )
[443] Fix | Delete
* }
[444] Fix | Delete
* >
[445] Fix | Delete
* { __( 'Generate a notice' ) }
[446] Fix | Delete
* </Button>
[447] Fix | Delete
* { notices.length > 0 && (
[448] Fix | Delete
* <Button onClick={ () => removeNotice( notices[ 0 ].id ) }>
[449] Fix | Delete
* { __( 'Remove the notice' ) }
[450] Fix | Delete
* </Button>
[451] Fix | Delete
* ) }
[452] Fix | Delete
* </>
[453] Fix | Delete
* );
[454] Fix | Delete
*};
[455] Fix | Delete
* ```
[456] Fix | Delete
*
[457] Fix | Delete
* @return {Object} Action object.
[458] Fix | Delete
*/
[459] Fix | Delete
function removeNotice(id, context = DEFAULT_CONTEXT) {
[460] Fix | Delete
return {
[461] Fix | Delete
type: 'REMOVE_NOTICE',
[462] Fix | Delete
id,
[463] Fix | Delete
context
[464] Fix | Delete
};
[465] Fix | Delete
}
[466] Fix | Delete
[467] Fix | Delete
/**
[468] Fix | Delete
* Removes all notices from a given context. Defaults to the default context.
[469] Fix | Delete
*
[470] Fix | Delete
* @param {string} noticeType The context to remove all notices from.
[471] Fix | Delete
* @param {string} context The context to remove all notices from.
[472] Fix | Delete
*
[473] Fix | Delete
* @example
[474] Fix | Delete
* ```js
[475] Fix | Delete
* import { __ } from '@wordpress/i18n';
[476] Fix | Delete
* import { useDispatch, useSelect } from '@wordpress/data';
[477] Fix | Delete
* import { store as noticesStore } from '@wordpress/notices';
[478] Fix | Delete
* import { Button } from '@wordpress/components';
[479] Fix | Delete
*
[480] Fix | Delete
* export const ExampleComponent = () => {
[481] Fix | Delete
* const notices = useSelect( ( select ) =>
[482] Fix | Delete
* select( noticesStore ).getNotices()
[483] Fix | Delete
* );
[484] Fix | Delete
* const { removeAllNotices } = useDispatch( noticesStore );
[485] Fix | Delete
* return (
[486] Fix | Delete
* <>
[487] Fix | Delete
* <ul>
[488] Fix | Delete
* { notices.map( ( notice ) => (
[489] Fix | Delete
* <li key={ notice.id }>{ notice.content }</li>
[490] Fix | Delete
* ) ) }
[491] Fix | Delete
* </ul>
[492] Fix | Delete
* <Button
[493] Fix | Delete
* onClick={ () =>
[494] Fix | Delete
* removeAllNotices()
[495] Fix | Delete
* }
[496] Fix | Delete
* >
[497] Fix | Delete
* { __( 'Clear all notices', 'woo-gutenberg-products-block' ) }
[498] Fix | Delete
* </Button>
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function