import { z } from 'zod'; import * as _accelbyte_sdk_legal from '@accelbyte/sdk-legal'; import { PolicyVersionWithLocalizedVersionObject, RetrievePolicyPublicResponse, RetrievePolicyPublicResponseArray, RetrieveAcceptedAgreementResponse, RetrieveAcceptedAgreementResponseArray, RetrieveLocalizedPolicyVersionPublicResponse } from '@accelbyte/sdk-legal'; import { SingleValue } from 'react-select'; import { marked } from 'marked'; import { AccelbyteSDK, ApiArgs } from '@accelbyte/sdk'; declare type PolicyVersion = PolicyVersionWithLocalizedVersionObject; declare type Policy = RetrievePolicyPublicResponse; declare type PolicyList = RetrievePolicyPublicResponseArray; declare type UserAcceptedPolicy = RetrieveAcceptedAgreementResponse; declare type UserAcceptedPolicyList = RetrieveAcceptedAgreementResponseArray; declare type LocalizedPolicyVersionData = RetrieveLocalizedPolicyVersionPublicResponse; interface PolicyStateHierarchy { [language: string]: { [namespace: string]: { [policyId: string]: LocalizedPolicyWithParentInfo; }; }; } declare const LocalizedPolicyWithParentInfo: z.ZodObject<{ status: z.ZodOptional>; updatedAt: z.ZodOptional>; description: z.ZodOptional>; id: z.ZodString; attachmentChecksum: z.ZodOptional>; attachmentLocation: z.ZodOptional>; attachmentVersionIdentifier: z.ZodOptional>; contentType: z.ZodOptional>; createdAt: z.ZodOptional>; isDefaultSelection: z.ZodBoolean; localeCode: z.ZodString; publishedDate: z.ZodOptional>; parentId: z.ZodString; parentNamespace: z.ZodString; parentCountry: z.ZodString; parentName: z.ZodString; currentActiveLocalizedPolicy: z.ZodOptional>; }, "strip", z.ZodTypeAny, { id: string; parentId: string; parentNamespace: string; parentCountry: string; parentName: string; isDefaultSelection: boolean; localeCode: string; status?: string | null | undefined; updatedAt?: string | null | undefined; description?: string | null | undefined; attachmentChecksum?: string | null | undefined; attachmentLocation?: string | null | undefined; attachmentVersionIdentifier?: string | null | undefined; contentType?: string | null | undefined; createdAt?: string | null | undefined; publishedDate?: string | null | undefined; currentActiveLocalizedPolicy?: unknown; }, { id: string; parentId: string; parentNamespace: string; parentCountry: string; parentName: string; isDefaultSelection: boolean; localeCode: string; status?: string | null | undefined; updatedAt?: string | null | undefined; description?: string | null | undefined; attachmentChecksum?: string | null | undefined; attachmentLocation?: string | null | undefined; attachmentVersionIdentifier?: string | null | undefined; contentType?: string | null | undefined; createdAt?: string | null | undefined; publishedDate?: string | null | undefined; currentActiveLocalizedPolicy?: unknown; }>; interface LocalizedPolicyWithParentInfo extends z.infer { } interface LegalDocumentWidgetProps { htmlString?: string; localizedPolicy?: LocalizedPolicyWithParentInfo; } declare function LegalDocumentWidget({ htmlString, localizedPolicy }: LegalDocumentWidgetProps): JSX.Element; interface LegalDocumentErrorWidgetProps { error?: Error; } declare function LegalDocumentErrorWidget({ error }: LegalDocumentErrorWidgetProps): JSX.Element; interface SelectOption { label: string; value: string; } interface LegalDocumentFilterWidgetProps { countrySelectOptions?: SelectOption[]; countrySelectValue?: SelectOption; languageSelectOptions?: SelectOption[]; languageSelectValue?: SelectOption; onChangeCountry?: (country: SingleValue) => void; onChangeLanguage?: (language: SingleValue) => void; } declare function LegalDocumentFilterWidget({ countrySelectOptions, countrySelectValue, languageSelectOptions, languageSelectValue, onChangeCountry, onChangeLanguage }: LegalDocumentFilterWidgetProps): JSX.Element; declare class NoPolicyDataFound extends Error { constructor(m?: string); } interface LegalDocumentFilterAccordionWidgetProps { groupedPolicies?: PolicyStateHierarchy; localizedPolicy?: LocalizedPolicyWithParentInfo; nsDisplayNames?: Record; onClickPolicy?: (localizedPolicy: LocalizedPolicyWithParentInfo) => void; } declare function LegalDocumentFilterAccordionWidget({ groupedPolicies, localizedPolicy, nsDisplayNames, onClickPolicy }: LegalDocumentFilterAccordionWidgetProps): JSX.Element; interface LegalDocumentFilterPolicyProps { active: boolean; localizedPolicy: LocalizedPolicyWithParentInfo; onClickPolicy?: (localizedPolicy: LocalizedPolicyWithParentInfo) => void; } declare function LegalDocumentFilterPolicy({ active, localizedPolicy, onClickPolicy }: LegalDocumentFilterPolicyProps): JSX.Element; interface LegalDocumentFilterWIthAccordionWidgetProps { localizedPolicy?: LocalizedPolicyWithParentInfo; groupedPolicies?: PolicyStateHierarchy; onClickPolicy?: LegalDocumentFilterAccordionWidgetProps['onClickPolicy']; nsDisplayNames?: LegalDocumentFilterAccordionWidgetProps['nsDisplayNames']; countrySelectOptions?: LegalDocumentFilterWidgetProps['countrySelectOptions']; countrySelectValue?: LegalDocumentFilterWidgetProps['countrySelectValue']; languageSelectOptions?: LegalDocumentFilterWidgetProps['languageSelectOptions']; languageSelectValue?: LegalDocumentFilterWidgetProps['languageSelectValue']; onChangeCountry?: LegalDocumentFilterWidgetProps['onChangeCountry']; onChangeLanguage?: LegalDocumentFilterWidgetProps['onChangeLanguage']; } declare function LegalDocumentFilterWIthAccordionWidget({ localizedPolicy, groupedPolicies, onClickPolicy, countrySelectOptions, countrySelectValue, languageSelectOptions, languageSelectValue, nsDisplayNames, onChangeCountry, onChangeLanguage }: LegalDocumentFilterWIthAccordionWidgetProps): JSX.Element; /*! * Copyright (c) 2023 AccelByte Inc. All Rights Reserved * This is licensed software from AccelByte Inc, for limitations * and restrictions contact your company contract manager. */ interface LegalDocumentNavigationWidgetProps { headings: marked.Tokens.Heading[]; } declare function LegalDocumentNavigationWidget({ headings }: LegalDocumentNavigationWidgetProps): JSX.Element; interface LegalDocumentWIthNavigationWidgetProps { htmlString?: string; localizedPolicy?: LocalizedPolicyWithParentInfo; hideNavigation?: boolean; } declare function LegalDocumentWithNavigationWidget({ htmlString, localizedPolicy, hideNavigation }: LegalDocumentWIthNavigationWidgetProps): JSX.Element; interface LegalPageWidgetProps { htmlString?: string; localizedPolicy?: LocalizedPolicyWithParentInfo; groupedPolicies?: PolicyStateHierarchy; onClickPolicy?: LegalDocumentFilterAccordionWidgetProps['onClickPolicy']; nsDisplayNames?: LegalDocumentFilterAccordionWidgetProps['nsDisplayNames']; countrySelectOptions?: LegalDocumentFilterWidgetProps['countrySelectOptions']; countrySelectValue?: LegalDocumentFilterWidgetProps['countrySelectValue']; languageSelectOptions?: LegalDocumentFilterWidgetProps['languageSelectOptions']; languageSelectValue?: LegalDocumentFilterWidgetProps['languageSelectValue']; onChangeCountry?: LegalDocumentFilterWidgetProps['onChangeCountry']; onChangeLanguage?: LegalDocumentFilterWidgetProps['onChangeLanguage']; error?: Error; } declare function LegalPageWidget({ htmlString, localizedPolicy, groupedPolicies, onClickPolicy, nsDisplayNames, countrySelectOptions, countrySelectValue, languageSelectOptions, languageSelectValue, onChangeCountry, onChangeLanguage, error }: LegalPageWidgetProps): JSX.Element; /*! * Copyright (c) 2023-2024 AccelByte Inc. All Rights Reserved * This is licensed software from AccelByte Inc, for limitations * and restrictions contact your company contract manager. */ declare type LegalPageTitleProps = { isLegacyDoc: boolean; currentActiveLocalizedPolicy: LocalizedPolicyWithParentInfo; onClickPolicy: (localizedPolicy: LocalizedPolicyWithParentInfo) => void; } | { isLegacyDoc?: false; currentActiveLocalizedPolicy?: never; onClickPolicy?: never; }; declare function LegalPageTitleWidget({ isLegacyDoc, currentActiveLocalizedPolicy, onClickPolicy }: LegalPageTitleProps): JSX.Element; interface BaseFetcherProps { sdk: AccelbyteSDK; sdkArgs?: ApiArgs; } interface countryOptionsFetcherProps extends BaseFetcherProps { } declare function countryOptionsFetcher({ sdk }: countryOptionsFetcherProps): Promise<{ label: string; value: string; }[]>; interface languageOptionsFetcherProps extends BaseFetcherProps { /** * This props is for filtering languages based on available language. * For example, after fetching all policies by country, we then can process * this policies using `processPolicyInformation` where all the keys inside * `groupedPolicies` properties is the available languages. * * ``` * const policies = Legal.PoliciesApi(sdk).getPolicyCountry_ByCountryCode(countryCode) * const processedPolicies = processPolicyInformation(policies) * const availableLanguages = Object.keys(processedPolicies.groupedPolicies) * ``` */ availableLanguages?: string[]; } declare function languageOptionsFetcher({ sdk, availableLanguages }: languageOptionsFetcherProps): Promise<{ label: string; value: string; }[]>; declare function legalDocumentFetcher(documentLocation: string): Promise; interface legalPoliciesFetcherProps extends BaseFetcherProps { countryCode: string; localizedPolicyId?: string; localizedPolicyData?: LocalizedPolicyVersionData; visibleOnly?: boolean; alwaysIncludeDefault?: boolean; } declare function legalPoliciesFetcher({ sdk, sdkArgs, countryCode, localizedPolicyId, localizedPolicyData, visibleOnly, alwaysIncludeDefault }: legalPoliciesFetcherProps): Promise<{ policies: _accelbyte_sdk_legal.RetrievePolicyPublicResponseArray; groupedPolicies: PolicyStateHierarchy; activeLocalizedPolicy: LocalizedPolicyWithParentInfo | undefined; firstLanguageCode: string; firstPolicyId: string | undefined; }>; interface LegalwidgetFetcherProps extends BaseFetcherProps { countryCode?: string; localizedPolicyId?: string; languageCode?: string; visibleOnly?: boolean; } declare function legalwidgetFetcher({ sdk, localizedPolicyId, countryCode: cc, languageCode: lc, visibleOnly }: LegalwidgetFetcherProps): Promise<{ policies: _accelbyte_sdk_legal.RetrievePolicyPublicResponseArray; document: string; countryOptions: { label: string; value: string; }[]; languageOptions: { label: string; value: string; }[]; selectedCountry: { label: string; value: string; } | undefined; selectedLanguage: { label: string; value: string; } | undefined; groupedPolicies: PolicyStateHierarchy; activeLocalizedPolicy: LocalizedPolicyWithParentInfo | undefined; }>; interface localizedPolicyFetcherProps extends BaseFetcherProps { localizedPolicyId: string; } declare function localizedPolicyFetcher({ sdk, localizedPolicyId, sdkArgs }: localizedPolicyFetcherProps): Promise<_accelbyte_sdk_legal.RetrieveLocalizedPolicyVersionPublicResponse>; interface namespaceFetcherProps extends BaseFetcherProps { namespaces: string[]; } declare function namespaceDisplayNameFetcher({ sdk, namespaces }: namespaceFetcherProps): Promise>; declare const DOCUMENT_HEADER_PREFIX = "section-"; declare const HEADING_LEVEL_DEPTH_TO_DISPLAY = 2; declare enum contentType { 'html' = "text/html", 'markdown' = "text/markdown" } declare const SUPPORTED_FILE_TYPE: contentType[]; declare function sanitizeHTML(document: string): string | HTMLElement | DocumentFragment; declare function generateHtmlFromMd(document: string): string; declare function generateHeadingFromMd(document: string): { depth: number; type: "heading"; raw: string; text: string; tokens: marked.Token[]; }[]; declare function getSelectedOptions(options: { label: string; value: string; }[], selectedValue?: string): { label: string; value: string; } | undefined; declare enum PolicyStatus { ACTIVE = "ACTIVE", LEGACY = "LEGACY" } declare function processPolicyInformation(policies: PolicyList, localizedPolicyId?: string): { groupedPolicies: PolicyStateHierarchy; activeLocalizedPolicy: LocalizedPolicyWithParentInfo | undefined; }; export { DOCUMENT_HEADER_PREFIX, HEADING_LEVEL_DEPTH_TO_DISPLAY, LegalDocumentErrorWidget, LegalDocumentErrorWidgetProps, LegalDocumentFilterAccordionWidget, LegalDocumentFilterAccordionWidgetProps, LegalDocumentFilterPolicy, LegalDocumentFilterPolicyProps, LegalDocumentFilterWIthAccordionWidget, LegalDocumentFilterWIthAccordionWidgetProps, LegalDocumentFilterWidget, LegalDocumentFilterWidgetProps, LegalDocumentNavigationWidget, LegalDocumentNavigationWidgetProps, LegalDocumentWIthNavigationWidgetProps, LegalDocumentWidget, LegalDocumentWidgetProps, LegalDocumentWithNavigationWidget, LegalPageTitleWidget, LegalPageWidget, LegalPageWidgetProps, LocalizedPolicyVersionData, LocalizedPolicyWithParentInfo, NoPolicyDataFound, Policy, PolicyList, PolicyStateHierarchy, PolicyStatus, PolicyVersion, SUPPORTED_FILE_TYPE, UserAcceptedPolicy, UserAcceptedPolicyList, contentType, countryOptionsFetcher, generateHeadingFromMd, generateHtmlFromMd, getSelectedOptions, languageOptionsFetcher, legalDocumentFetcher, legalPoliciesFetcher, legalwidgetFetcher, localizedPolicyFetcher, namespaceDisplayNameFetcher, processPolicyInformation, sanitizeHTML };