import type { Policy, PolicyDetails, SetConsentPolicySuccessCallback, SetConsentPolicyErrorCallback, ConsentPolicyChangedHandler } from "./types.js"; /** * Gets the site visitor's consent policy regarding allowed cookies and 3rd-party data transfers for GDPR or CCPA compliance. * * Retrieves the site visitor's consent policy details, including which cookies are allowed and whether data transfer to 3rd parties is permitted. * * @returns The current consent policy details, or undefined if not available * * @example Get a member's consent policy * ```typescript * import { consentPolicyManager } from '@wix/site'; * * const policyDetails = consentPolicyManager.getCurrentConsentPolicy(); * const policy = policyDetails.policy; * * ``` */ export declare function getCurrentConsentPolicy(): PolicyDetails | undefined; /** * Removes the current policy from the site visitor's browser * and resets the site visitor's consent policy to the default policy for the site. * * @returns boolean indicating if the consent policy was successfully reset, or undefined if not available * * @example Reset the current consent policy * ```typescript * import { consentPolicyManager } from '@wix/site'; * * const success = consentPolicyManager.resetPolicy(); * ``` */ export declare function resetConsentPolicy(): boolean | undefined; /** * Triggered when a site visitor's consent policy was changed using setConsentPolicy() or reset using resetConsentPolicy(). * * Use the onConsentPolicyChanged() method for code you want to run after the site visitor's current consent policy was changed. * * @param handler - The function to run when the consent policy changes * * @requiredField handler * * @returns A cleanup function that removes the event listener when called, or undefined if not available * * @example * ```typescript * import { consentPolicyManager } from '@wix/site'; * * const cleanup = consentPolicyManager.onConsentPolicyChanged((event) => { * const policy = event.policy; * console.log(event); * }); * * // Full event object: * // { * // "defaultPolicy": false, * // "policy": { * // "functional": false, * // "analytics": true, * // "advertising": false, * // "dataToThirdParty": false, * // "essential": true * // } * // } * * // To remove the listener later: * // if (cleanup) { * // cleanup(); * // } * ``` */ export declare function onConsentPolicyChanged(handler: ConsentPolicyChangedHandler): undefined | EventListener; /** * Sets the current site visitor's consent policy * regarding allowed cookies and data transfer to 3rd parties, * such as for GDPR or CCPA purposes. * * Changes to the consent policy take affect after the page is refreshed. * * @param policy - An object representing the cookies of the site visitor's consent policy. * @param successCallback - Optional callback function called on success with PolicyDetails * @param errorCallback - Optional callback function called on error with error message * * @requiredField policy * * @returns Promise that resolves with the updated PolicyDetails when the consent policy is successfully set, or undefined if not available * * @example Set a member's consent policy * ```typescript * import { consentPolicyManager } from '@wix/site'; * * const policy = { * essential: true, * functional: true, * analytics: true, * advertising: false, * dataToThirdParty: false, * }; * * const successCallback = (policyDetails: PolicyDetails) => { * console.log(policyDetails); * }; * * const errorCallback = (error: string) => { * console.log(error); * }; * * const policyDetails = await consentPolicyManager.setConsentPolicy(policy, successCallback, errorCallback); * console.log(policyDetails); * ``` */ export declare function setConsentPolicy(policy: Policy, successCallback?: SetConsentPolicySuccessCallback, errorCallback?: SetConsentPolicyErrorCallback): Promise; //# sourceMappingURL=consent-policy.d.ts.map