| 1 |
import { domainOffer } from '@agent/lib/domain-suggestion'; |
| 2 |
import { useDomainActivities } from '@agent/state/domain-activities'; |
| 3 |
import { __ } from '@wordpress/i18n'; |
| 4 |
|
| 5 |
const record = ({ tracking }, action) => |
| 6 |
useDomainActivities.getState().setDomainActivity({ ...tracking, action }); |
| 7 |
|
| 8 |
export default { |
| 9 |
id: 'register-domain', |
| 10 |
follows: '*', |
| 11 |
statuses: ['completed', 'canceled'], |
| 12 |
data: domainOffer, |
| 13 |
// Under 0.1 so a taken card scoring 1 or more still wins. |
| 14 |
score: ({ data }) => (data ? 0.05 : 0), |
| 15 |
content: ({ message, url }) => ({ |
| 16 |
title: message, |
| 17 |
// translators: Body of a card in the AI Agent chat that offers to register a domain name for the website. |
| 18 |
body: __( |
| 19 |
'Your own domain makes your site easier to find and remember.', |
| 20 |
'extendify-local', |
| 21 |
), |
| 22 |
action: { |
| 23 |
// translators: Button on a card in the AI Agent chat that opens a domain registrar in a new tab. |
| 24 |
label: __('Register this domain', 'extendify-local'), |
| 25 |
url, |
| 26 |
}, |
| 27 |
}), |
| 28 |
onView: (data) => record(data, 'viewed'), |
| 29 |
onClick: (data) => record(data, 'clicked'), |
| 30 |
}; |
| 31 |
|