# extendify/trunk/src/Agent/workflows/settings/update-site-visibility.js

Extendify, version trunk. 49 lines.

- Page: https://pluginprobe.com/plugins/extendify/trunk/code/src/Agent/workflows/settings/update-site-visibility.js
- Raw: https://pluginprobe.com/plugins/extendify/trunk/raw/src/Agent/workflows/settings/update-site-visibility.js
- Modified: 2026-09-16T19:34:02+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/trunk/code/src/Agent/workflows/settings/update-site-visibility.js#L10-L20`.

```javascript
import { UpdateSiteVisibilityConfirm } from '@agent/workflows/settings/components/UpdateSiteVisibilityConfirm';
import { __ } from '@wordpress/i18n';

const { abilities, agentContext } = window.extAgentData;

// A clicked suggestion skips the backend, so its reply must be written here.
const unpublishExample = {
	text: __('Unpublish my site', 'extendify-local'),
	agentResponse: {
		// translators: Shown when the user clicks the "Unpublish my site" suggestion, above a confirm card.
		reply: __('Ready to take your site back offline?', 'extendify-local'),
		whenFinishedTool: {
			id: 'update-site-visibility',
			labels: {
				// translators: Success notice — the site is now hidden. Not "publishing was canceled".
				confirm: __('Unpublished the site', 'extendify-local'),
				cancel: __('Canceled unpublishing the site', 'extendify-local'),
			},
		},
	},
};

const publishExample = {
	text: __('Publish my site', 'extendify-local'),
	agentResponse: {
		// translators: Shown when the user clicks the "Publish my site" suggestion, above a confirm card.
		reply: __('Ready to make your site live?', 'extendify-local'),
		whenFinishedTool: {
			id: 'update-site-visibility',
			labels: {
				confirm: __('Published the site', 'extendify-local'),
				// translators: Neutral notice — the user backed out, so the site is still hidden.
				cancel: __('Canceled publishing the site', 'extendify-local'),
			},
		},
	},
};

// A hidden site stays eligible with the flag off, or it can never go live.
const inScope = () =>
	Boolean(agentContext?.comingSoonEnabled) || !agentContext?.sitePublished;

export default {
	available: () => Boolean(abilities?.canEditSettings) && inScope(),
	id: 'update-site-visibility',
	whenFinished: { component: UpdateSiteVisibilityConfirm },
	example: agentContext?.sitePublished ? unpublishExample : publishExample,
};

```
