PluginProbe
Extendify / 3.1.6
Extendify v3.1.6
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 / canvas / components / demo-form-workflow.js

demo-form-workflow.js in Extendify 3.1.6, at src/Agent/workflows/canvas/components/demo-form-workflow.js

57 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { canvasView } from '@agent/lib/canvas-views';
2 import { DemoForm } from '@agent/workflows/canvas/components/DemoForm';
3 import {
4 nextDemoFormStep,
5 updateDemoForm,
6 } from '@agent/workflows/canvas/components/demo-form-tools';
7 import { __ } from '@wordpress/i18n';
8
9 // Views that dim the chat can't deliver on an offer to help fill the form.
10 const reply = (canvas) =>
11 canvasView(canvas)?.assist
12 ? // translators: The agent has just opened a three-step form the user fills in.
13 __(
14 "I've opened the demo form for you to fill out. There are three steps. Feel free to ask me any questions or if you need help filling it out.",
15 'extendify-local',
16 )
17 : // translators: The agent has just opened a three-step form the user fills in.
18 __(
19 "I've opened the demo form for you to fill out. There are three steps.",
20 'extendify-local',
21 );
22
23 export const demoFormWorkflow = ({ id, canvas, icon, text }) => ({
24 // Nothing to save, so partners never see it.
25 available: () => Boolean(window.extSharedData.devbuild),
26 id,
27 icon,
28 abilities: [
29 'extendify/site-info',
30 'extendify/content-list',
31 'extendify/content-search',
32 'extendify/content-read',
33 'extendify/options',
34 'extendify/taxonomies',
35 'extendify/media',
36 'extendify/navigation',
37 'extendify/theme-settings',
38 updateDemoForm,
39 nextDemoFormStep,
40 ],
41 whenFinished: { component: DemoForm, canvas },
42 example: {
43 text,
44 agentResponse: {
45 reply: reply(canvas),
46 // The three share a tool id: one form, and only assisted reaches the backend.
47 whenFinishedTool: {
48 id: 'demo-form',
49 labels: {
50 confirm: __('Submitted the demo form', 'extendify-local'),
51 cancel: __('Closed the demo form', 'extendify-local'),
52 },
53 },
54 },
55 },
56 });
57