@trii/components 2.0.23 → 2.0.25
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 +3732 -3859
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/ContactInfoPopup/components/Header/Header.d.ts +1 -1
- package/dist/cjs/types/components/ContactInfoPopup/components/MembersSection/MembersSection.d.ts +2 -1
- package/dist/cjs/types/components/ContactInfoPopup/components/MembersSection/components/MemberItem/MemberItem.d.ts +5 -2
- package/dist/cjs/types/components/EditContactModal/EditContactModal.d.ts +11 -0
- package/dist/cjs/types/components/EditContactModal/components/Header/Header.d.ts +7 -0
- package/dist/cjs/types/components/EditContactModal/components/Labels/Labels.d.ts +16 -0
- package/dist/cjs/types/components/EditContactModal/components/Labels/components/LabelModal/LabelModal.d.ts +9 -0
- package/dist/cjs/types/components/EditContactModal/components/Labels/components/LabelModal/components/Label/Label.d.ts +6 -0
- package/dist/cjs/types/components/EditContactModal/components/Labels/components/LabelModal/components/Label/index.d.ts +1 -0
- package/dist/cjs/types/components/EditContactModal/components/Labels/components/LabelModal/components/index.d.ts +1 -0
- package/dist/cjs/types/components/EditContactModal/components/Labels/components/LabelModal/index.d.ts +1 -0
- package/dist/cjs/types/components/EditContactModal/components/Labels/components/TagSelect/TagSelect.d.ts +2 -0
- package/dist/cjs/types/components/EditContactModal/components/Labels/components/TagSelect/index.d.ts +1 -0
- package/dist/cjs/types/components/EditContactModal/components/Labels/components/TagSelect/style.d.ts +7 -0
- package/dist/cjs/types/components/EditContactModal/components/Labels/components/index.d.ts +2 -0
- package/dist/cjs/types/components/EditContactModal/hooks/useEditContactModalController.d.ts +26 -0
- package/dist/cjs/types/components/EditContactModal/index.d.ts +1 -0
- package/dist/cjs/types/components/EditContactModal/services/api.d.ts +15 -0
- package/dist/cjs/types/components/EditContactModal/services/http.d.ts +15 -0
- package/dist/cjs/types/components/EditContactModal/types/is-business.typeguard.d.ts +7 -0
- package/dist/cjs/types/components/EditContactModal/types/is-contact.typeguard.d.ts +7 -0
- package/dist/cjs/types/components/index.d.ts +0 -1
- package/dist/cjs/types/hooks/useMultipleSelect.d.ts +20 -0
- package/dist/esm/index.js +3734 -3860
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/ContactInfoPopup/components/Header/Header.d.ts +1 -1
- package/dist/esm/types/components/ContactInfoPopup/components/MembersSection/MembersSection.d.ts +2 -1
- package/dist/esm/types/components/ContactInfoPopup/components/MembersSection/components/MemberItem/MemberItem.d.ts +5 -2
- package/dist/esm/types/components/EditContactModal/EditContactModal.d.ts +11 -0
- package/dist/esm/types/components/EditContactModal/components/Header/Header.d.ts +7 -0
- package/dist/esm/types/components/EditContactModal/components/Labels/Labels.d.ts +16 -0
- package/dist/esm/types/components/EditContactModal/components/Labels/components/LabelModal/LabelModal.d.ts +9 -0
- package/dist/esm/types/components/EditContactModal/components/Labels/components/LabelModal/components/Label/Label.d.ts +6 -0
- package/dist/esm/types/components/EditContactModal/components/Labels/components/LabelModal/components/Label/index.d.ts +1 -0
- package/dist/esm/types/components/EditContactModal/components/Labels/components/LabelModal/components/index.d.ts +1 -0
- package/dist/esm/types/components/EditContactModal/components/Labels/components/LabelModal/index.d.ts +1 -0
- package/dist/esm/types/components/EditContactModal/components/Labels/components/TagSelect/TagSelect.d.ts +2 -0
- package/dist/esm/types/components/EditContactModal/components/Labels/components/TagSelect/index.d.ts +1 -0
- package/dist/esm/types/components/EditContactModal/components/Labels/components/TagSelect/style.d.ts +7 -0
- package/dist/esm/types/components/EditContactModal/components/Labels/components/index.d.ts +2 -0
- package/dist/esm/types/components/EditContactModal/hooks/useEditContactModalController.d.ts +26 -0
- package/dist/esm/types/components/EditContactModal/index.d.ts +1 -0
- package/dist/esm/types/components/EditContactModal/services/api.d.ts +15 -0
- package/dist/esm/types/components/EditContactModal/services/http.d.ts +15 -0
- package/dist/esm/types/components/EditContactModal/types/is-business.typeguard.d.ts +7 -0
- package/dist/esm/types/components/EditContactModal/types/is-contact.typeguard.d.ts +7 -0
- package/dist/esm/types/components/index.d.ts +0 -1
- package/dist/esm/types/hooks/useMultipleSelect.d.ts +20 -0
- package/dist/index.d.ts +1 -9
- package/package.json +3 -2
|
@@ -8,5 +8,5 @@ type HeaderProps = {
|
|
|
8
8
|
onClose: () => void;
|
|
9
9
|
isBusiness?: boolean;
|
|
10
10
|
};
|
|
11
|
-
declare const Header: ({ imgUrl, name, contactId, navigate, isLoading, onError, onClose, isBusiness }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const Header: ({ imgUrl, name, contactId, navigate, isLoading, onError, onClose, isBusiness, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export default Header;
|
package/dist/esm/types/components/ContactInfoPopup/components/MembersSection/MembersSection.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { IBusiness } from '@trii/types/dist/Contacts';
|
|
|
2
2
|
interface MembersSectionProps {
|
|
3
3
|
contactData?: IBusiness;
|
|
4
4
|
title: string;
|
|
5
|
+
navigate: (path: string) => void;
|
|
5
6
|
}
|
|
6
|
-
declare const MembersSection: ({ contactData, title }: MembersSectionProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
declare const MembersSection: ({ contactData, title, navigate }: MembersSectionProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
8
|
export default MembersSection;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
type MemberItemProps = {
|
|
2
2
|
name: string;
|
|
3
|
-
|
|
3
|
+
memberId: string;
|
|
4
|
+
navigate: (path: string) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const MemberItem: ({ name, memberId, navigate }: MemberItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
7
|
export default MemberItem;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SxProps, Theme } from '@mui/material';
|
|
2
|
+
export interface ContactInfoPopupProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
contactId?: string;
|
|
7
|
+
t?: (key: string) => string;
|
|
8
|
+
sx?: SxProps<Theme>;
|
|
9
|
+
}
|
|
10
|
+
declare const EditContactModal: ({ open, onClose, baseUrl, contactId, sx, }: ContactInfoPopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default EditContactModal;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ILabel } from '@trii/types/dist/Conversations';
|
|
2
|
+
import { IBusiness, IContact } from '@trii/types/dist/Contacts';
|
|
3
|
+
import { ItemWithId } from '../../../../hooks/useMultipleSelect';
|
|
4
|
+
interface LabelsProps {
|
|
5
|
+
labels: ILabel[];
|
|
6
|
+
contact: IContact | IBusiness;
|
|
7
|
+
currentTags?: ItemWithId[];
|
|
8
|
+
onSave: (tags: Array<{
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
}>) => Promise<unknown> | unknown;
|
|
12
|
+
t: (key: string) => string;
|
|
13
|
+
titleKey: string;
|
|
14
|
+
}
|
|
15
|
+
declare const LabelsEditor: ({ labels, onSave, currentTags, t, titleKey }: LabelsProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default LabelsEditor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ILabel } from '@trii/types/dist/Conversations';
|
|
2
|
+
interface Props {
|
|
3
|
+
labels: ILabel[];
|
|
4
|
+
open: boolean;
|
|
5
|
+
handleClose: () => void;
|
|
6
|
+
t: (key: string) => string;
|
|
7
|
+
}
|
|
8
|
+
declare const LabelModal: ({ labels, open, handleClose, t }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default LabelModal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Label";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Label } from "./Label";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './LabelModal';
|
package/dist/esm/types/components/EditContactModal/components/Labels/components/TagSelect/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './TagSelect';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IBusiness, IContact } from '@trii/types/dist/Contacts/contacts';
|
|
2
|
+
export type UseEditContactModalControllerArgs = {
|
|
3
|
+
open: boolean;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
contactId?: string;
|
|
6
|
+
initialContactData?: IContact | IBusiness;
|
|
7
|
+
};
|
|
8
|
+
type ControllerState = {
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
error: unknown;
|
|
11
|
+
contactData: IContact | IBusiness | null;
|
|
12
|
+
};
|
|
13
|
+
export declare function useEditContactModalController({ open, baseUrl, contactId, }: UseEditContactModalControllerArgs): {
|
|
14
|
+
state: ControllerState;
|
|
15
|
+
selectors: {
|
|
16
|
+
isBusiness: boolean;
|
|
17
|
+
isContact: boolean;
|
|
18
|
+
contactType: "business" | "contact" | "unknown";
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
21
|
+
actions: {
|
|
22
|
+
setContactData: (contactData?: IContact | IBusiness) => void;
|
|
23
|
+
clearError: () => void;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './EditContactModal';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IBusiness, IContact } from '@trii/types/dist/Contacts/contacts';
|
|
2
|
+
type FetchContactArgs = {
|
|
3
|
+
baseUrl: string;
|
|
4
|
+
contactId: string;
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
};
|
|
7
|
+
export declare function fetchContact({ baseUrl, contactId, signal }: FetchContactArgs): Promise<IContact | IBusiness>;
|
|
8
|
+
type UpdateContactArgs = {
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
contactId: string;
|
|
11
|
+
patch: Partial<IContact> | Partial<IBusiness>;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
};
|
|
14
|
+
export declare function updateContact({ baseUrl, contactId, patch, signal }: UpdateContactArgs): Promise<IContact | IBusiness>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
2
|
+
export declare class ApiError extends Error {
|
|
3
|
+
status: number;
|
|
4
|
+
body: unknown;
|
|
5
|
+
constructor(message: string, status: number, body: unknown);
|
|
6
|
+
}
|
|
7
|
+
type RequestJsonArgs = {
|
|
8
|
+
url: string;
|
|
9
|
+
method?: HttpMethod;
|
|
10
|
+
headers?: HeadersInit;
|
|
11
|
+
body?: unknown;
|
|
12
|
+
signal?: AbortSignal;
|
|
13
|
+
};
|
|
14
|
+
export declare function requestJson<T>({ url, method, headers, body, signal, }: RequestJsonArgs): Promise<T>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IBusiness } from '@trii/types/dist/Contacts/contacts';
|
|
2
|
+
/**
|
|
3
|
+
* Type guard to check if an object is an IBusiness
|
|
4
|
+
* @param obj The object to check
|
|
5
|
+
* @returns True if the object is an IBusiness
|
|
6
|
+
*/
|
|
7
|
+
export declare function isBusiness(obj: any): obj is IBusiness;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IContact } from '@trii/types/dist/Contacts/contacts';
|
|
2
|
+
/**
|
|
3
|
+
* Type guard to check if an object is an IContact
|
|
4
|
+
* @param obj The object to check
|
|
5
|
+
* @returns True if the object is an IContact
|
|
6
|
+
*/
|
|
7
|
+
export declare function isContact(obj: any): obj is IContact;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ItemWithId {
|
|
2
|
+
id: string;
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
type InitialStateType<T> = T extends (infer U)[] ? U extends ItemWithId ? T : never : never;
|
|
6
|
+
interface Props<T extends ItemWithId[]> {
|
|
7
|
+
initialState?: InitialStateType<T>;
|
|
8
|
+
}
|
|
9
|
+
export type UseMultipleSelectReturnType<T> = {
|
|
10
|
+
attributes: {
|
|
11
|
+
value: T;
|
|
12
|
+
onChange: (event: any, newValue: T) => void;
|
|
13
|
+
};
|
|
14
|
+
actions: {
|
|
15
|
+
addValue: (newValue: any) => void;
|
|
16
|
+
setValue: (newValue: T) => void;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const useMultipleSelect: <T extends ItemWithId[]>({ initialState, }?: Props<T>) => UseMultipleSelectReturnType<T>;
|
|
20
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -2,14 +2,6 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { IContact, IBusiness } from '@trii/types/dist/Contacts';
|
|
3
3
|
import { SxProps, Theme } from '@mui/material';
|
|
4
4
|
|
|
5
|
-
interface TestBoxProps {
|
|
6
|
-
/**
|
|
7
|
-
* Color of the box background
|
|
8
|
-
*/
|
|
9
|
-
bgColor?: 'red' | 'blue' | 'green';
|
|
10
|
-
}
|
|
11
|
-
declare const TestBox: ({ bgColor }: TestBoxProps) => react_jsx_runtime.JSX.Element;
|
|
12
|
-
|
|
13
5
|
interface ContactInfoPopupProps {
|
|
14
6
|
open: boolean;
|
|
15
7
|
anchorEl: HTMLElement | null;
|
|
@@ -22,4 +14,4 @@ interface ContactInfoPopupProps {
|
|
|
22
14
|
}
|
|
23
15
|
declare const ContactInfoPopup: ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, t, }: ContactInfoPopupProps) => react_jsx_runtime.JSX.Element;
|
|
24
16
|
|
|
25
|
-
export { ContactInfoPopup
|
|
17
|
+
export { ContactInfoPopup };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trii/components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.25",
|
|
4
4
|
"description": "Trii components package",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
"@fontsource/material-icons": "^5.0.18",
|
|
55
55
|
"@fontsource/roboto": "^5.0.13",
|
|
56
56
|
"@mui/icons-material": "^5.15.15",
|
|
57
|
-
"@mui/
|
|
57
|
+
"@mui/lab": "^5.0.0-alpha.176",
|
|
58
|
+
"@mui/material": "^5.18.0",
|
|
58
59
|
"@rollup/plugin-commonjs": "^25.0.4",
|
|
59
60
|
"@rollup/plugin-node-resolve": "^15.2.1",
|
|
60
61
|
"@rollup/plugin-typescript": "^11.1.4",
|