/** * The current site visitor's consent policy settings. * * An object containing the consent policy cookie settings, by type, of the site visitor currently viewing the site. */ export interface Policy { /** * Consent for mandatory cookies for Wix websites, such as for security cookies. Wix places these cookies on the site visitor's device. These cookies don't require site visitor consent. Always `true`. */ essential: boolean; /** * Consent for cookies placed on the site visitor's device that "remember" their user settings to improve user experience. For example, an indication that the user dismissed a popup. Default: `true`. */ functional: boolean; /** * Consent for cookies used for analytics, such as Wix analytics, Google Analytics, Yandex Metrica, and so on. Default: `true`. */ analytics: boolean; /** * Consent for cookies used for advertising purposes. This includes 3rd-party scripts and pixels that may potentially place advertising cookies on the device. For example, Twitter page view and Facebook Pixel. Default: `true`. */ advertising: boolean; /** * Consent for a site visitor's personal data to be transferred to a 3rd party. For example, Google Analytics, Facebook Pixel, and FullStory. Default: `true`. */ dataToThirdParty: boolean; } /** * The complete details of the current site visitor's consent policy. * * An object containing all the details about the consent policy of the site visitor currently viewing the site. */ export interface PolicyDetails { /** * Whether the current consent policy is the default one you set. If `true`, either the site visitor hasn't set a policy, or you've reset it to its default settings. */ defaultPolicy?: boolean; /** * An object representing the site visitor's current consent policy. */ policy: Policy; /** * The date the consent policy was set, if a cookie defining the current policy exists in the browser. Otherwise, it's undefined. */ createdDate?: Date; } /** * The Consent Policy API manages site visitor cookie preferences and 3rd-party data transfers for GDPR and CCPA compliance. * * >**Note:** The APIs in `wix-window-frontend.ConsentPolicy` can only be used in frontend code. * * The consent policy helps you comply with [GDPR](https://support.wix.com/en/article/preparing-your-wix-site-for-the-gdpr) and [CCPA](https://support.wix.com/en/article/preparing-your-wix-site-for-ccpa) regulations, and allows site visitors to * control their information. * * Set up the site consent policy and cookie consent banners in * a site's [Privacy Center](https://www.wix.com/my-account/site-selector/?buttonText=Open%20Privacy%20Center&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Fcookie-consent-settings-app?referralInfo=corvid-docs). * * To use the ConsentPolicy API, import `{ consentPolicy }` from the `wix-window-frontend` module: * * ```javascript * import { consentPolicy } from 'wix-window-frontend'; * ``` */ export interface ConsentPolicy { /** * 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. * */ 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 */ resetPolicy(): boolean | undefined; /** * Sets the current site visitor's consent policy * regarding allowed cookies and data transfer to 3rd parties, * such as for GDPR or CCPA purposes. * * You can use the `onConsentPolicyChanged()` event to listen for * changes made when a site visitor changes their consent policy with `setConsentPolicy()`. Handle * the policy change accordingly in the event. * 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. * @requiredField policy */ setConsentPolicy(policy: Policy, successCallback?: SetConsentPolicySuccessCallback, errorCallback?: SetConsentPolicyErrorCallback): Promise; } /** * Success callback for setConsentPolicy */ export type SetConsentPolicySuccessCallback = (policyDetails: PolicyDetails) => void; /** * Error callback for setConsentPolicy */ export type SetConsentPolicyErrorCallback = (errorData: string) => void; /** * Event object for consent policy changes */ export interface ConsentPolicyChangedEvent { /** * Whether the current consent policy is the default one */ defaultPolicy: boolean; /** * The current consent policy settings */ policy: Policy; } /** * Handler function type for consent policy changes */ export type ConsentPolicyChangedHandler = (event: ConsentPolicyChangedEvent) => void; /** * Window object extension for Wix Consent Policy Manager */ declare global { interface Window { consentPolicyManager?: { /** * Gets the current policy for the current user, returns PolicyDetails */ getCurrentConsentPolicy(): PolicyDetails; /** * Sets a new consent policy for the user using callbacks */ setConsentPolicy(newPolicy: Policy, successCallback?: SetConsentPolicySuccessCallback, errorCallback?: SetConsentPolicyErrorCallback): Promise; /** * Reset policy to default */ resetPolicy(): boolean; }; } } //# sourceMappingURL=types.d.ts.map