@trii/components 3.1.12 → 3.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +41 -41
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +41 -41
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +93 -2
- package/dist/types/components/ContactMessageMedia/index.d.ts +12 -0
- package/dist/types/components/ContactSidebar/ChatDetailsSidebar.d.ts +3 -1
- package/dist/types/components/ContactSidebar/components/PanelView/components/ContactData/components/Properties/Properties.d.ts +8 -1
- package/dist/types/components/ContactSidebar/components/PanelView/components/ContactMedia/ContactMedia.d.ts +5 -0
- package/dist/types/components/ContactSidebar/context/MediaEnvironmentContext.d.ts +10 -0
- package/dist/types/components/ContactSidebar/context/SidebarEntityContext.d.ts +1 -0
- package/dist/types/components/ContactSidebar/context/SidebarIdentityContext.d.ts +1 -0
- package/dist/types/components/ContactSidebar/context/SidebarPropsContext.d.ts +8 -1
- package/dist/types/components/ContactSidebar/hooks/useContactMedia.d.ts +3 -0
- package/dist/types/components/EditContactModal/shared/EntityCustomFieldLabel/EntityCustomFieldLabel.d.ts +2 -1
- package/dist/types/components/HighlightedContactFields.d.ts +12 -0
- package/dist/types/components/index.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import { IContact, IBusiness, IContactAddress, IIntegrationButton } from '@trii/types/dist/Contacts';
|
|
3
|
+
import { IContact, IBusiness, IContactAddress, IIntegrationButton, IContactField, Property } from '@trii/types/dist/Contacts';
|
|
4
4
|
import { Spaces } from '@trii/types';
|
|
5
5
|
import { SxProps, Theme } from '@mui/material';
|
|
6
6
|
import { IContact as IContact$1, IBusiness as IBusiness$1 } from '@trii/types/dist/Contacts/contacts';
|
|
@@ -572,6 +572,23 @@ declare class PanelErrorBoundary extends Component<PanelErrorBoundaryProps, Pane
|
|
|
572
572
|
render(): ReactNode;
|
|
573
573
|
}
|
|
574
574
|
|
|
575
|
+
/**
|
|
576
|
+
* Contrato de entrada del sidebar (docs/CONTRATO_CHATDETAILSSIDEBAR.md).
|
|
577
|
+
* El container del host resuelve estos valores desde Redux; el árbol interno
|
|
578
|
+
* los consume desde acá en lugar de tocar el store del host. Al migrar el
|
|
579
|
+
* sidebar a @trii/components, este context viaja con él tal cual.
|
|
580
|
+
*/
|
|
581
|
+
interface SidebarApiConfig {
|
|
582
|
+
/** Raíz de la API (ej: https://agent-api.trii.app/api/v1), sin servicio ni spaceId. */
|
|
583
|
+
baseUrl: string;
|
|
584
|
+
spaceId: string;
|
|
585
|
+
}
|
|
586
|
+
/** When supplied, the host owns loading and supplies the entity through props. */
|
|
587
|
+
interface SidebarEntityLoad {
|
|
588
|
+
status: 'idle' | 'loading' | 'succeeded' | 'rejected';
|
|
589
|
+
error?: string | null;
|
|
590
|
+
retry: () => Promise<void> | void;
|
|
591
|
+
}
|
|
575
592
|
/**
|
|
576
593
|
* Integración con un inbox de chat. Es opcional: sin ella el sidebar funciona
|
|
577
594
|
* en "modo ficha" (sin GroupData, sin abrir conversaciones, sin iniciar una
|
|
@@ -591,6 +608,53 @@ interface SidebarChatIntegration {
|
|
|
591
608
|
/** El usuario salió del grupo: el host cierra/limpia la conversación. */
|
|
592
609
|
onGroupLeft: (conversationId: string) => void;
|
|
593
610
|
}
|
|
611
|
+
interface SidebarProps {
|
|
612
|
+
api: SidebarApiConfig;
|
|
613
|
+
contactId: string | null;
|
|
614
|
+
entityType: 'contact' | 'business';
|
|
615
|
+
/**
|
|
616
|
+
* false cuando el host no pasó `chat`: los callbacks de abajo son no-ops y la
|
|
617
|
+
* UI que depende del inbox se deshabilita.
|
|
618
|
+
*/
|
|
619
|
+
hasChatIntegration: boolean;
|
|
620
|
+
/**
|
|
621
|
+
* Ficha ya resuelta por el host, si la tiene: solo siembra el estado inicial
|
|
622
|
+
* para que no parpadee. Con entityLoad es la entidad controlada; sin él se refetchea.
|
|
623
|
+
*/
|
|
624
|
+
initialEntity?: IContact | IBusiness | null;
|
|
625
|
+
entityLoad?: SidebarEntityLoad;
|
|
626
|
+
/** Conversación seleccionada en el host, si hay (tab conversaciones, GroupData). */
|
|
627
|
+
conversation: IConversation | null;
|
|
628
|
+
/** Para el EditContactModal embebido (búsqueda de direcciones). */
|
|
629
|
+
googleMapsApiKey?: string;
|
|
630
|
+
/**
|
|
631
|
+
* Navegación del anfitrión. Sin ella se usa window.location.assign: los
|
|
632
|
+
* destinos son rutas de otro microfront, no internas del sidebar.
|
|
633
|
+
*/
|
|
634
|
+
navigate?: (path: string) => void;
|
|
635
|
+
/** Ticket que se está viendo en el host: el tab Tickets lo lista marcado y sin click. */
|
|
636
|
+
currentTicketId?: string;
|
|
637
|
+
/**
|
|
638
|
+
* Abrir un ticket del contacto. Sin ella el tab Tickets navega a
|
|
639
|
+
* /a/tickets/detail/{id} con `navigate` (o window.location.assign).
|
|
640
|
+
*/
|
|
641
|
+
onOpenTicket?: (ticketId: string) => void;
|
|
642
|
+
/** Abrir/cambiar a una conversación del contacto en el inbox. */
|
|
643
|
+
onOpenConversation: (conversation: IConversation) => Promise<void> | void;
|
|
644
|
+
/** Navegar/scrollear a un mensaje en el body del chat. */
|
|
645
|
+
onNavigateToMessage: (messageId: string) => void;
|
|
646
|
+
/**
|
|
647
|
+
* El contacto/empresa cambió (edición, convert, etc.): el host sincroniza su
|
|
648
|
+
* estado. Es no-op si el host no la pasó.
|
|
649
|
+
*/
|
|
650
|
+
onEntityUpdated: (entity: IContact | IBusiness) => void;
|
|
651
|
+
/** La conversación cambió (grupo WA editado): el host sincroniza Redux + Dexie. */
|
|
652
|
+
onConversationUpdated: (conversation: IConversation) => void;
|
|
653
|
+
/** El usuario salió del grupo: el host cierra/limpia la conversación. */
|
|
654
|
+
onGroupLeft: (conversationId: string) => void;
|
|
655
|
+
/** "Chatear por este canal/dirección": arma el composer del host. */
|
|
656
|
+
onStartConversation: (target: StartConversationTarget) => void;
|
|
657
|
+
}
|
|
594
658
|
interface StartConversationTarget {
|
|
595
659
|
channelType: ChannelType;
|
|
596
660
|
addressId: string;
|
|
@@ -599,6 +663,8 @@ interface StartConversationTarget {
|
|
|
599
663
|
}
|
|
600
664
|
|
|
601
665
|
interface ChatDetailsSidebarBaseProps {
|
|
666
|
+
/** Controlled loading: entity/initialEntity updates are consumed without an automatic fetch. */
|
|
667
|
+
entityLoad?: SidebarProps['entityLoad'];
|
|
602
668
|
/** Raíz de la API (ej: https://agent-api.trii.app/api/v1), sin servicio ni spaceId. */
|
|
603
669
|
baseUrl: string;
|
|
604
670
|
spaceId: string;
|
|
@@ -710,6 +776,31 @@ declare const DEFAULT_LIGHT_ICON_COLOR = "#334155";
|
|
|
710
776
|
declare const DEFAULT_DARK_ICON_COLOR = "#e2e8f0";
|
|
711
777
|
declare function resolveButtonIconColor(colors: ButtonIconColors, mode: "light" | "dark"): string | undefined;
|
|
712
778
|
|
|
779
|
+
interface HighlightedContactFieldsProps {
|
|
780
|
+
fields: IContactField[];
|
|
781
|
+
properties: Property[];
|
|
782
|
+
user?: {
|
|
783
|
+
dateFormat?: string;
|
|
784
|
+
timeFormat?: string;
|
|
785
|
+
} | null;
|
|
786
|
+
title?: string;
|
|
787
|
+
}
|
|
788
|
+
/** Shared read-only highlights for contact/company records and conversation sidebars. */
|
|
789
|
+
declare function HighlightedContactFields({ fields, properties, user, title, }: HighlightedContactFieldsProps): react_jsx_runtime.JSX.Element;
|
|
790
|
+
|
|
791
|
+
interface ContactMessageMediaProps {
|
|
792
|
+
baseUrl: string;
|
|
793
|
+
spaceId: string;
|
|
794
|
+
/** Contact ID, not a business ID. Choose a linked contact for business histories. */
|
|
795
|
+
contactId: string;
|
|
796
|
+
resolveMediaUrl: (url: string) => Promise<string>;
|
|
797
|
+
language?: string;
|
|
798
|
+
dateFormat?: string;
|
|
799
|
+
timeFormat?: string;
|
|
800
|
+
height?: number | string;
|
|
801
|
+
}
|
|
802
|
+
declare function ContactMessageMedia(props: ContactMessageMediaProps): react_jsx_runtime.JSX.Element;
|
|
803
|
+
|
|
713
804
|
declare const i18nInstance: i18next.i18n;
|
|
714
805
|
|
|
715
806
|
/**
|
|
@@ -887,4 +978,4 @@ declare const darkBlue: Theme;
|
|
|
887
978
|
/** @deprecated Use darkTheme. */
|
|
888
979
|
declare const darkBlack: Theme;
|
|
889
980
|
|
|
890
|
-
export { AsyncContent, type AsyncContentProps, type AsyncData, type AsyncState, type AsyncStatus, BUTTON_ICONS, BUTTON_ICON_CATEGORIES, type ButtonIconCategory, type ButtonIconColors, type ButtonIconDefinition, type Calendar, type Contact, ContactInfoPopup, ChatDetailsSidebar as ContactSidebar, type ChatDetailsSidebarProps as ContactSidebarProps, DEFAULT_BUTTON_ICON, DEFAULT_DARK_ICON_COLOR, DEFAULT_LIGHT_ICON_COLOR, EditContactModal, type EditContactModalProps, type EditContactMode, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, type EventData, EventsDialog, type EventsDialogProps, IntegrationButtonIcon, type IntegrationButtonIconProps, type IsEmptyFn, type ItemType, type LegacyThemeName, type ModalMode, MuiComponentsConfig, type MuiComponentsConfigOptions, type Notification, PanelErrorBoundary, type PanelErrorBoundaryProps, type ResolvedTheme, type SidebarChatIntegration, type StartConversationTarget, THEME_PREFERENCES, type TaskData, type ThemeName, type ThemePreference, type ThemeRootState, type ThemeState, type UseAsyncDataResult, asyncIdle, asyncRequestFailed, asyncRequestStarted, asyncRequestSucceeded, darkBlack, darkBlue, darkTheme, defaultIsEmpty, deriveAsyncState, findButtonIcon, getErrorMessage, i18nInstance as i18n, isStale, isValidThemeName, lightAmber, lightBlue, lightBlueIndigo, lightBrown, lightGray, lightGreen, lightLime, lightOrange, lightPink, lightPurple, lightRed, lightTeal, lightTheme, lightYellow, normalizeIconSearch, normalizeThemePreference, observeThemePreference, resolveButtonIconColor, resolveThemePreference, selectDarkTheme, selectTheme, selectThemePreference, selectThemeToggleStatus, selectedDarkTheme, selectedTheme, systemThemeChanged, _default as themeReducer, toggleModeTheme, toggleTheme, updateTheme, useAsyncData };
|
|
981
|
+
export { AsyncContent, type AsyncContentProps, type AsyncData, type AsyncState, type AsyncStatus, BUTTON_ICONS, BUTTON_ICON_CATEGORIES, type ButtonIconCategory, type ButtonIconColors, type ButtonIconDefinition, type Calendar, type Contact, ContactInfoPopup, ContactMessageMedia, type ContactMessageMediaProps, ChatDetailsSidebar as ContactSidebar, type ChatDetailsSidebarProps as ContactSidebarProps, DEFAULT_BUTTON_ICON, DEFAULT_DARK_ICON_COLOR, DEFAULT_LIGHT_ICON_COLOR, EditContactModal, type EditContactModalProps, type EditContactMode, EmptyState, type EmptyStateProps, ErrorState, type ErrorStateProps, type EventData, EventsDialog, type EventsDialogProps, HighlightedContactFields, type HighlightedContactFieldsProps, IntegrationButtonIcon, type IntegrationButtonIconProps, type IsEmptyFn, type ItemType, type LegacyThemeName, type ModalMode, MuiComponentsConfig, type MuiComponentsConfigOptions, type Notification, PanelErrorBoundary, type PanelErrorBoundaryProps, type ResolvedTheme, type SidebarChatIntegration, type StartConversationTarget, THEME_PREFERENCES, type TaskData, type ThemeName, type ThemePreference, type ThemeRootState, type ThemeState, type UseAsyncDataResult, asyncIdle, asyncRequestFailed, asyncRequestStarted, asyncRequestSucceeded, darkBlack, darkBlue, darkTheme, defaultIsEmpty, deriveAsyncState, findButtonIcon, getErrorMessage, i18nInstance as i18n, isStale, isValidThemeName, lightAmber, lightBlue, lightBlueIndigo, lightBrown, lightGray, lightGreen, lightLime, lightOrange, lightPink, lightPurple, lightRed, lightTeal, lightTheme, lightYellow, normalizeIconSearch, normalizeThemePreference, observeThemePreference, resolveButtonIconColor, resolveThemePreference, selectDarkTheme, selectTheme, selectThemePreference, selectThemeToggleStatus, selectedDarkTheme, selectedTheme, systemThemeChanged, _default as themeReducer, toggleModeTheme, toggleTheme, updateTheme, useAsyncData };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ContactMessageMediaProps {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
spaceId: string;
|
|
4
|
+
/** Contact ID, not a business ID. Choose a linked contact for business histories. */
|
|
5
|
+
contactId: string;
|
|
6
|
+
resolveMediaUrl: (url: string) => Promise<string>;
|
|
7
|
+
language?: string;
|
|
8
|
+
dateFormat?: string;
|
|
9
|
+
timeFormat?: string;
|
|
10
|
+
height?: number | string;
|
|
11
|
+
}
|
|
12
|
+
export default function ContactMessageMedia(props: ContactMessageMediaProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { SidebarChatIntegration, StartConversationTarget } from './context/SidebarPropsContext';
|
|
1
|
+
import { SidebarChatIntegration, SidebarProps, StartConversationTarget } from './context/SidebarPropsContext';
|
|
2
2
|
import { IContact, IBusiness } from '@trii/types/dist/Contacts';
|
|
3
3
|
interface ChatDetailsSidebarBaseProps {
|
|
4
|
+
/** Controlled loading: entity/initialEntity updates are consumed without an automatic fetch. */
|
|
5
|
+
entityLoad?: SidebarProps['entityLoad'];
|
|
4
6
|
/** Raíz de la API (ej: https://agent-api.trii.app/api/v1), sin servicio ni spaceId. */
|
|
5
7
|
baseUrl: string;
|
|
6
8
|
spaceId: string;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { Property } from '@trii/types/dist/Contacts';
|
|
1
|
+
import { Property, IContactField } from '@trii/types/dist/Contacts';
|
|
2
2
|
interface Props {
|
|
3
3
|
properties: Property[];
|
|
4
4
|
compact?: boolean;
|
|
5
5
|
}
|
|
6
6
|
declare const Properties: ({ properties, compact }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function PropertyValues({ properties, compact, fields: customContactFields, user, }: Props & {
|
|
8
|
+
fields: IContactField[];
|
|
9
|
+
user?: {
|
|
10
|
+
dateFormat?: string;
|
|
11
|
+
timeFormat?: string;
|
|
12
|
+
} | null;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
14
|
export default Properties;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { MediaResource } from '../../../../context/SidebarDataContext';
|
|
3
|
+
export declare function MediaPanel({ media, expanded }: {
|
|
4
|
+
media: MediaResource;
|
|
5
|
+
expanded?: boolean;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
2
7
|
declare const ContactMedia: React.ForwardRefExoticComponent<{
|
|
3
8
|
contactId: string;
|
|
4
9
|
defaultExpanded?: boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface MediaEnvironment {
|
|
3
|
+
resolveMediaUrl: (url: string) => Promise<string>;
|
|
4
|
+
currentUser?: {
|
|
5
|
+
dateFormat?: string;
|
|
6
|
+
timeFormat?: string;
|
|
7
|
+
} | null;
|
|
8
|
+
}
|
|
9
|
+
export declare const MediaEnvironmentContext: import("react").Context<MediaEnvironment>;
|
|
10
|
+
export declare function useMediaEnvironment(): MediaEnvironment;
|
|
@@ -5,6 +5,7 @@ import { IBusiness, IContact } from '@trii/types/dist/Contacts';
|
|
|
5
5
|
* (contactInfo, showSkeleton, contactInfoError, onRetryContactInfo); ahora el
|
|
6
6
|
* sidebar la fetchea con el contactId + entityType del contrato. El host puede
|
|
7
7
|
* sembrarla con initialEntity para que no haya parpadeo cuando ya la tiene.
|
|
8
|
+
* Con entityLoad, el host controla la ficha, su carga y los reintentos.
|
|
8
9
|
*/
|
|
9
10
|
export type EntityStatus = 'idle' | 'loading' | 'succeeded' | 'rejected';
|
|
10
11
|
export interface SidebarEntityValue {
|
|
@@ -36,5 +36,6 @@ export declare const SidebarIdentityProvider: ({ children, }: {
|
|
|
36
36
|
children: ReactNode;
|
|
37
37
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
38
38
|
export declare function useSidebarIdentity(): SidebarIdentityValue;
|
|
39
|
+
export declare function useOptionalSidebarIdentity(): SidebarIdentityValue;
|
|
39
40
|
/** Solo para tests: descarta la identidad cacheada entre casos. */
|
|
40
41
|
export declare function __resetIdentityCache(): void;
|
|
@@ -13,6 +13,12 @@ export interface SidebarApiConfig {
|
|
|
13
13
|
baseUrl: string;
|
|
14
14
|
spaceId: string;
|
|
15
15
|
}
|
|
16
|
+
/** When supplied, the host owns loading and supplies the entity through props. */
|
|
17
|
+
export interface SidebarEntityLoad {
|
|
18
|
+
status: 'idle' | 'loading' | 'succeeded' | 'rejected';
|
|
19
|
+
error?: string | null;
|
|
20
|
+
retry: () => Promise<void> | void;
|
|
21
|
+
}
|
|
16
22
|
/**
|
|
17
23
|
* Integración con un inbox de chat. Es opcional: sin ella el sidebar funciona
|
|
18
24
|
* en "modo ficha" (sin GroupData, sin abrir conversaciones, sin iniciar una
|
|
@@ -43,9 +49,10 @@ export interface SidebarProps {
|
|
|
43
49
|
hasChatIntegration: boolean;
|
|
44
50
|
/**
|
|
45
51
|
* Ficha ya resuelta por el host, si la tiene: solo siembra el estado inicial
|
|
46
|
-
* para que no parpadee.
|
|
52
|
+
* para que no parpadee. Con entityLoad es la entidad controlada; sin él se refetchea.
|
|
47
53
|
*/
|
|
48
54
|
initialEntity?: IContact | IBusiness | null;
|
|
55
|
+
entityLoad?: SidebarEntityLoad;
|
|
49
56
|
/** Conversación seleccionada en el host, si hay (tab conversaciones, GroupData). */
|
|
50
57
|
conversation: IConversation | null;
|
|
51
58
|
/** Para el EditContactModal embebido (búsqueda de direcciones). */
|
|
@@ -13,6 +13,7 @@ type Props = {
|
|
|
13
13
|
baseUrl?: string;
|
|
14
14
|
spaceId?: string;
|
|
15
15
|
onEntityUpdated?: (entity: unknown) => void;
|
|
16
|
+
onEditingChange?: (editing: boolean) => void;
|
|
16
17
|
};
|
|
17
|
-
declare const EntityCustomFieldLabel: ({ property, entity, entityType, entityId, customContactFields, userTrii, baseUrl, spaceId, onEntityUpdated, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare const EntityCustomFieldLabel: ({ property, entity, entityType, entityId, customContactFields, userTrii, baseUrl, spaceId, onEntityUpdated, onEditingChange, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export default EntityCustomFieldLabel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IContactField, Property } from '@trii/types/dist/Contacts';
|
|
2
|
+
export interface HighlightedContactFieldsProps {
|
|
3
|
+
fields: IContactField[];
|
|
4
|
+
properties: Property[];
|
|
5
|
+
user?: {
|
|
6
|
+
dateFormat?: string;
|
|
7
|
+
timeFormat?: string;
|
|
8
|
+
} | null;
|
|
9
|
+
title?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Shared read-only highlights for contact/company records and conversation sidebars. */
|
|
12
|
+
export default function HighlightedContactFields({ fields, properties, user, title, }: HighlightedContactFieldsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -15,3 +15,7 @@ export type { PanelErrorBoundaryProps } from './PanelErrorBoundary';
|
|
|
15
15
|
export { default as ContactSidebar } from './ContactSidebar';
|
|
16
16
|
export type { ContactSidebarProps, SidebarChatIntegration, StartConversationTarget, } from './ContactSidebar';
|
|
17
17
|
export * from './IntegrationButtonIcon';
|
|
18
|
+
export { default as HighlightedContactFields } from './HighlightedContactFields';
|
|
19
|
+
export type { HighlightedContactFieldsProps } from './HighlightedContactFields';
|
|
20
|
+
export { default as ContactMessageMedia } from './ContactMessageMedia';
|
|
21
|
+
export type { ContactMessageMediaProps } from './ContactMessageMedia';
|