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 / HelpCenter / tours / page-creator.js

page-creator.js in Extendify 3.2.1, at src/HelpCenter/tours/page-creator.js

131 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { waitUntilExists } from '@help-center/lib/tour-helpers';
2 import { hasPageCreatorEnabled } from '@help-center/lib/utils';
3 import { __, isRTL } from '@wordpress/i18n';
4
5 export default {
6 id: 'page-creator-tour',
7 title: __('AI Page Generator', 'extendify-local'),
8 settings: {
9 allowOverflow: true,
10 hideDotsNav: true,
11 startFrom: [
12 hasPageCreatorEnabled
13 ? `${window.extSharedData.adminUrl}post-new.php?post_type=page&ext-page-creator-close=1`
14 : `${window.extSharedData.adminUrl}post-new.php?post_type=page&ext-close=1`,
15 `${window.extSharedData.adminUrl}post-new.php?post_type=page`,
16 ],
17 },
18 onStart: async () => {
19 // Wait for gutenberg to be ready
20 await waitUntilExists('#extendify-page-creator-btn [role="button"]');
21
22 // Close sidebar if open
23 document
24 .querySelector(`[aria-label="${__('Settings')}"].is-pressed`)
25 ?.click();
26 },
27 steps: [
28 {
29 title: __('AI Page Generator', 'extendify-local'),
30 text: __(
31 'Press here to get started with your AI Page Generator.',
32 'extendify-local',
33 ),
34 attachTo: {
35 element: '#extendify-page-creator-btn [role="button"]',
36 offset: {
37 marginTop: 0,
38 marginLeft: isRTL() ? -15 : 15,
39 },
40 position: {
41 x: isRTL() ? 'left' : 'right',
42 y: 'top',
43 },
44 hook: isRTL() ? 'top right' : 'top left',
45 },
46 events: {
47 beforeAttach: async () => {
48 await waitUntilExists('#extendify-page-creator-btn [role="button"]');
49 },
50 },
51 },
52 {
53 title: __('Page description', 'extendify-local'),
54 text: __(
55 'Write a description of the page you want to create. Be as detailed as you like. We will create a page based on this description.',
56 'extendify-local',
57 ),
58 attachTo: {
59 element: '#extendify-page-creator-page-description',
60 position: {
61 x: isRTL() ? 'left' : 'right',
62 y: 'top',
63 },
64 hook: isRTL() ? 'top right' : 'top left',
65 },
66 options: {
67 allowPointerEvents: true,
68 },
69 events: {
70 beforeAttach: async () => {
71 // Open the Extendify library panel
72 dispatchEvent(new CustomEvent('extendify::open-page-creator'));
73
74 return await waitUntilExists(
75 '#extendify-page-creator-page-description',
76 );
77 },
78 },
79 },
80 {
81 title: __('Site description', 'extendify-local'),
82 text: __(
83 'If needed, update your site description here. We use this to add additional context about your website.',
84 'extendify-local',
85 ),
86 attachTo: {
87 element: '#extendify-page-creator-site-description',
88 offset: {
89 marginTop: -15,
90 marginLeft: 0,
91 },
92 position: {
93 x: isRTL() ? 'left' : 'right',
94 y: 'top',
95 },
96 hook: isRTL() ? 'bottom left' : 'bottom right',
97 },
98 events: {
99 beforeAttach: async () => {
100 await waitUntilExists('#extendify-page-creator-site-description');
101 },
102 },
103 },
104 {
105 title: __('Generate your page', 'extendify-local'),
106 text: __(
107 'When ready, press here to generate your page.',
108 'extendify-local',
109 ),
110 attachTo: {
111 element: '#extendify-page-creator-generate-btn',
112 offset: {
113 marginTop: -15,
114 marginLeft: 0,
115 },
116 position: {
117 x: isRTL() ? 'left' : 'right',
118 y: 'top',
119 },
120 hook: isRTL() ? 'bottom left' : 'bottom right',
121 },
122 events: {
123 beforeAttach: () => {},
124 },
125 options: {
126 hideBackButton: true,
127 },
128 },
129 ],
130 };
131