/** * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except * in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import { type ConsentPurposeDataV2 as ConsentPurposeData } from '@asgardeo/browser'; import { FC, ReactNode } from 'react'; /** * Backward-compatible consent purpose type exported by @asgardeo/react. * * Some consumers import this name directly; keep it as an alias to the v2 model. */ export type ConsentPurpose = ConsentPurposeData; /** * Render props exposed by Consent when using the render-prop pattern. */ export interface ConsentRenderProps { /** Current form values - used to read optional checkbox state. */ formValues: Record; /** Callback invoked when a user toggles an optional attribute. */ onInputChange: (name: string, value: string) => void; /** The resolved list of consent purposes parsed from `consentData`. */ purposes: ConsentPurposeData[]; } /** * Props for the Consent component. */ export interface ConsentProps { /** * Render-props callback. When provided, the default consent UI is replaced with * whatever JSX the callback returns. The parsed `purposes` list is injected so * consumers do not need to re-parse `consentData` themselves. * * @example * ```tsx * * {({ purposes, formValues, onInputChange, t }) => ( *
* {purposes.map(p => )} *
* )} *
* ``` */ children?: (props: ConsentRenderProps) => ReactNode; /** * The raw JSON string returned by the backend in `additionalData.consentPrompt`. */ consentData?: string | ConsentPurposeData[] | { purposes: ConsentPurposeData[]; }; /** * Current form values - used to read optional checkbox state. */ formValues: Record; /** * Callback invoked when a user toggles an optional attribute. */ onInputChange: (name: string, value: string) => void; } /** * Consent component renders the list of purposes and their associated attributes (essential and optional) * based on the data provided by the backend. It allows users to toggle optional attributes while essential * attributes are displayed as read-only. */ declare const Consent: FC; export default Consent; //# sourceMappingURL=Consent.d.ts.map