PluginProbe
Extendify / 2.2.0
Extendify v2.2.0
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 0.7.0 All 126 releases
extendify / src / PageCreator / api / WPApi.js

WPApi.js in Extendify 2.2.0, at src/PageCreator/api/WPApi.js

63 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import apiFetch from '@wordpress/api-fetch';
2 import { __ } from '@wordpress/i18n';
3 import { addQueryArgs } from '@wordpress/url';
4
5 export const getSiteStyle = async () => {
6 const siteStyles = await apiFetch({
7 method: 'GET',
8 path: addQueryArgs('/extendify/v1/page-creator/settings/get-option', {
9 name: 'extendify_siteStyle',
10 }),
11 });
12
13 if (siteStyles) return siteStyles;
14
15 return { vibe: 'standard' };
16 };
17
18 export const updateOption = async (option, value) =>
19 await apiFetch({
20 path: '/extendify/v1/page-creator/settings/single',
21 method: 'POST',
22 data: { key: option, value },
23 });
24
25 export const processPlaceholders = (patterns) =>
26 apiFetch({
27 path: '/extendify/v1/shared/process-placeholders',
28 method: 'POST',
29 data: { patterns },
30 });
31
32 export const updatePageTitlePattern = (pageTitlePattern) => {
33 const templateContent = `
34 <!-- wp:template-part {"slug":"header","tagName":"header"} /-->
35 <!-- wp:group {"tagName":"main","style":{"spacing":{"margin":{"top":"0px","bottom":"0px"},"blockGap":"0"}}} -->
36 <main class="wp-block-group" style="margin-top:0px;margin-bottom:0px">
37 ${pageTitlePattern}
38 <!-- wp:post-content {"layout":{"type":"constrained"}} /-->
39 </main>
40 <!-- /wp:group -->
41 <!-- wp:template-part {"slug":"footer","tagName":"footer"} /-->
42 `;
43
44 return apiFetch({
45 path: '/wp/v2/templates/extendable/page-with-title',
46 method: 'POST',
47 data: {
48 slug: 'page-with-title',
49 theme: 'extendable',
50 type: 'wp_template',
51 status: 'publish',
52 description: __('Added by Launch', 'extendify-local'),
53 content: templateContent,
54 },
55 });
56 };
57
58 export const getActivePlugins = async () =>
59 await apiFetch({
60 path: '/extendify/v1/launch/active-plugins',
61 method: 'GET',
62 });
63