| 1 |
import { UpdateSearchIndexingConfirm } from '@agent/workflows/settings/components/UpdateSearchIndexingConfirm'; |
| 2 |
import { __ } from '@wordpress/i18n'; |
| 3 |
|
| 4 |
const { abilities, agentContext } = window.extAgentData; |
| 5 |
|
| 6 |
const enableExample = { |
| 7 |
text: __('Enable search engine indexing', 'extendify-local'), |
| 8 |
agentResponse: { |
| 9 |
// translators: Shown when the user clicks the "Enable search engine indexing" suggestion, above a confirm card. |
| 10 |
reply: __('Ready to let search engines find your site?', 'extendify-local'), |
| 11 |
whenFinishedTool: { |
| 12 |
id: 'update-search-indexing', |
| 13 |
inputs: { indexing: 'enabled' }, |
| 14 |
labels: { |
| 15 |
confirm: __('Enabled search engine indexing', 'extendify-local'), |
| 16 |
// translators: Neutral notice — the user backed out, so search engines are still discouraged. |
| 17 |
cancel: __( |
| 18 |
'Canceled enabling search engine indexing', |
| 19 |
'extendify-local', |
| 20 |
), |
| 21 |
}, |
| 22 |
}, |
| 23 |
}, |
| 24 |
}; |
| 25 |
|
| 26 |
const disableExample = { |
| 27 |
text: __('Stop search engines indexing my site', 'extendify-local'), |
| 28 |
agentResponse: { |
| 29 |
// translators: Shown when the user clicks the "Stop search engines indexing my site" suggestion, above a confirm card. |
| 30 |
reply: __( |
| 31 |
'Ready to ask search engines not to index your site?', |
| 32 |
'extendify-local', |
| 33 |
), |
| 34 |
whenFinishedTool: { |
| 35 |
id: 'update-search-indexing', |
| 36 |
inputs: { indexing: 'disabled' }, |
| 37 |
labels: { |
| 38 |
confirm: __( |
| 39 |
'Asked search engines not to index the site', |
| 40 |
'extendify-local', |
| 41 |
), |
| 42 |
cancel: __( |
| 43 |
'Canceled discouraging search engine indexing', |
| 44 |
'extendify-local', |
| 45 |
), |
| 46 |
}, |
| 47 |
}, |
| 48 |
}, |
| 49 |
}; |
| 50 |
|
| 51 |
// A blocked site stays eligible with the flag off, or it can never be indexed. |
| 52 |
const inScope = () => |
| 53 |
Boolean(agentContext?.searchEngineBlockEnabled) || |
| 54 |
Boolean(agentContext?.searchEnginesBlocked); |
| 55 |
|
| 56 |
export default { |
| 57 |
available: () => Boolean(abilities?.canEditSettings) && inScope(), |
| 58 |
id: 'update-search-indexing', |
| 59 |
whenFinished: { component: UpdateSearchIndexingConfirm }, |
| 60 |
example: agentContext?.searchEnginesBlocked ? enableExample : disableExample, |
| 61 |
}; |
| 62 |
|