UNPKG

@hhgtech/hhg-components

Version:
89 lines (88 loc) 3.06 kB
/// <reference types="node" /> import React, { ReactNode } from 'react'; import type { Role, LocaleType } from "../interfaces/types"; export type UserInfo = { name?: string; url?: string; phone?: string; area_code?: string; username?: string; avatar?: string; email?: string; phone_verified?: boolean; birthday?: string; gender?: number; id?: number; total_bookmark?: number; bookmarks?: Array<string | number>; postCount?: number; role?: Role; commentCount?: number; communities_interacted?: number; partnerId?: string; first_time_bookmark?: boolean; provider?: string; _togetherUserId?: string; subscription?: number; phone_verified_at?: string; verify_phone_code?: string; }; export type PushNotificationPayloadType = { message: string; type: 'success' | 'danger' | 'info' | 'warning'; title?: string; displayIcon?: string; }; export type TogetherComponentGlobalContextType = { data: { locale?: LocaleType; userInfo?: UserInfo; togetherUserId?: number; env?: { isMarryBaby?: boolean; togetherBasePath?: string; publicSSO?: string; togetherBaseApiUrl?: string; subotApiUrl?: string; leadApiUrl?: string; discoverBaseApiUrl?: string; discoverBaseProdApiUrl?: string; marryBabyApiUrl?: string; marryBabyProdApiUrl?: string; careBaseApiUrl?: string; premiumBaseApiUrl?: string; chatbotAiUrl?: string; }; router?: { asPath?: string; basePath?: string; query?: NodeJS.Dict<string | string[]>; }; }; action: { pushNotifications?: (payload: PushNotificationPayloadType) => void; sanitizeFunction?: (h: string) => string; }; formatMessage: (descriptor: { id?: string; description?: string; defaultMessage?: string; }, values?: any, opts?: any) => string; }; export declare const DefaultComponentGlobalContextData: TogetherComponentGlobalContextType['data']; export declare const TogetherComponentGlobalContext: React.Context<TogetherComponentGlobalContextType>; export declare let GlobalData: TogetherComponentGlobalContextType['data']; export type Props = { userInfo?: UserInfo; locale?: LocaleType; children?: ReactNode; translation?: { [key: string]: string; }; router?: any; pushNotifications?: (payload: PushNotificationPayloadType) => void; sanitizeFunction?: (h: string) => string; env?: TogetherComponentGlobalContextType['data']['env']; formatMessage?: TogetherComponentGlobalContextType['formatMessage']; }; export declare const TogetherComponentGlobalContextProvider: ({ locale, children, userInfo, router, env, sanitizeFunction, pushNotifications, formatMessage, }: Props) => React.JSX.Element;