REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.36 KB
Close
/home/nshryvcy/radiantskinclinics.org/wp-content/plugins/extendify_old/src/Shared/api/DataApi.js
Text
Base64
import { AI_HOST, INSIGHTS_HOST } from '@constants'; import { reqDataBasics } from '@shared/lib/data'; import { useImageGenerationStore } from '@shared/state/generate-images'; import apiFetch from '@wordpress/api-fetch'; import { __ } from '@wordpress/i18n'; export const generateImage = async (imageData, signal) => { const response = await fetch(`${AI_HOST}/api/draft/image`, { method: 'POST', mode: 'cors', headers: { 'Content-Type': 'application/json' }, signal: signal, body: JSON.stringify({ ...imageData, globalState: useImageGenerationStore.getState(), ...reqDataBasics, }), }); const body = await response.json(); const imageCredits = { remaining: response.headers.get('x-ratelimit-remaining'), total: response.headers.get('x-ratelimit-limit'), refresh: response.headers.get('x-ratelimit-reset'), }; if (!response.ok) { if (body.status && body.status === 'content-policy-violation') { throw { message: __( 'Your request was rejected as a result of our safety system. Your prompt may contain text that is not allowed by our safety system.', 'extendify-local', ), imageCredits, }; } throw { message: __('Service temporarily unavailable', 'extendify-local'), imageCredits, }; } return { images: body, imageCredits, id: response.headers.get('x-request-id'), }; }; export const recordPluginActivity = async ({ slug, source }) => { try { const res = await fetch(`${INSIGHTS_HOST}/api/v1/plugin-install`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Extendify': 'true' }, body: JSON.stringify({ ...reqDataBasics, slug, source, siteCreatedAt: window.extSharedData?.siteCreatedAt, }), }); // this should not break the app. if (!res.ok) { console.error('Bad response from server'); return null; } return await res.json(); } catch (error) { console.error('Error sending plugin installation notification:', error); return null; } }; export const pingServer = async () => await apiFetch({ path: '/extendify/v1/shared/ping' }); export const getPartnerPlugins = async (key) => { const plugins = await apiFetch({ path: '/extendify/v1/shared/partner-plugins', }); if (!Object.keys(plugins?.data ?? {}).length) { throw new Error('Could not get plugins'); } if (key && plugins.data?.[key]) { return plugins.data[key]; } return plugins.data; };
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 2
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
__tests__
DIR
-
drwxr-xr-x
2026-04-28 02:40:02
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
DataApi.js
2.36 KB
lrw-r--r--
2026-03-05 22:57:38
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
wp.js
2.99 KB
lrw-r--r--
2026-02-19 03:27:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).