PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Agent / workflows / settings / update-site-visibility.js

update-site-visibility.js in Extendify 3.2.1, at src/Agent/workflows/settings/update-site-visibility.js

49 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { UpdateSiteVisibilityConfirm } from '@agent/workflows/settings/components/UpdateSiteVisibilityConfirm';
2 import { __ } from '@wordpress/i18n';
3
4 const { abilities, agentContext } = window.extAgentData;
5
6 // A clicked suggestion skips the backend, so its reply must be written here.
7 const unpublishExample = {
8 text: __('Unpublish my site', 'extendify-local'),
9 agentResponse: {
10 // translators: Shown when the user clicks the "Unpublish my site" suggestion, above a confirm card.
11 reply: __('Ready to take your site back offline?', 'extendify-local'),
12 whenFinishedTool: {
13 id: 'update-site-visibility',
14 labels: {
15 // translators: Success notice — the site is now hidden. Not "publishing was canceled".
16 confirm: __('Unpublished the site', 'extendify-local'),
17 cancel: __('Canceled unpublishing the site', 'extendify-local'),
18 },
19 },
20 },
21 };
22
23 const publishExample = {
24 text: __('Publish my site', 'extendify-local'),
25 agentResponse: {
26 // translators: Shown when the user clicks the "Publish my site" suggestion, above a confirm card.
27 reply: __('Ready to make your site live?', 'extendify-local'),
28 whenFinishedTool: {
29 id: 'update-site-visibility',
30 labels: {
31 confirm: __('Published the site', 'extendify-local'),
32 // translators: Neutral notice — the user backed out, so the site is still hidden.
33 cancel: __('Canceled publishing the site', 'extendify-local'),
34 },
35 },
36 },
37 };
38
39 // A hidden site stays eligible with the flag off, or it can never go live.
40 const inScope = () =>
41 Boolean(agentContext?.comingSoonEnabled) || !agentContext?.sitePublished;
42
43 export default {
44 available: () => Boolean(abilities?.canEditSettings) && inScope(),
45 id: 'update-site-visibility',
46 whenFinished: { component: UpdateSiteVisibilityConfirm },
47 example: agentContext?.sitePublished ? unpublishExample : publishExample,
48 };
49