????JFIF??x?x????'
Server IP : 104.21.64.1 / Your IP : 216.73.216.145 Web Server : LiteSpeed System : Linux premium151.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : tempvsty ( 647) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/tempvsty/./pontiacques.org/wp-content/plugins/give/src/Campaigns/resources/ |
Upload File : |
import {useEntityRecord} from '@wordpress/core-data'; import {Campaign} from '@givewp/campaigns/admin/components/types'; import type {GiveCampaignOptions} from '@givewp/campaigns/types'; import apiFetch from '@wordpress/api-fetch'; declare const window: { GiveCampaignOptions: GiveCampaignOptions; } & Window; /** * @since 4.0.0 */ export function useCampaignEntityRecord(campaignId?: number) { const urlParams = new URLSearchParams(window.location.search); const { record: campaign, hasResolved, save, edit, }: { record: Campaign; hasResolved: boolean; save: () => any; edit: (data: Campaign | Partial<Campaign>) => void; } = useEntityRecord('givewp', 'campaign', campaignId ?? urlParams.get('id')); return {campaign, hasResolved, save, edit}; } /** * @since 4.0.0 */ export function getCampaignOptionsWindowData(): GiveCampaignOptions { return window.GiveCampaignOptions; } export function handleTooltipDismiss(id: string) { return apiFetch({ url: window.GiveCampaignOptions.adminUrl + '/admin-ajax.php?action=' + id, method: 'POST', }) } /** * @since 4.0.0 */ export function amountFormatter(currency: Intl.NumberFormatOptions['currency'], options?: Intl.NumberFormatOptions): Intl.NumberFormat { return new Intl.NumberFormat(navigator.language, { style: 'currency', currency: currency, ...options }); } /** * @since 4.0.0 */ export async function updateUserNoticeOptions(metaKey: string){ try { const currentUser = await apiFetch( { path: '/wp/v2/users/me' } ); // @ts-ignore const currentUserId = currentUser?.id; return await wp.data.dispatch('core').saveEntityRecord('root', 'user', { id: currentUserId, meta: { [metaKey]: true } }); } catch (error) { console.error('Error updating user meta:', error); } } /** * @since 4.0.0 */ export async function createCampaignPage(campaignId: number) { try { const response = await apiFetch({ path: `/givewp/v3/campaigns/${campaignId}/page`, method: 'POST' }); return response as { id: number, }; } catch (error) { console.error('Error creating Campaign page:', error); } }