@trii/components 2.0.45 → 2.0.48

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.
Files changed (32) hide show
  1. package/dist/cjs/index.js +512 -124
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/ContactInfoPopup/ContactInfoPopup.d.ts +3 -2
  4. package/dist/cjs/types/components/EditContactModal/EditContactModal.d.ts +3 -2
  5. package/dist/cjs/types/components/EditContactModal/components/TagsEditor/TagsEditor.d.ts +3 -1
  6. package/dist/cjs/types/components/EditContactModal/context/EditContactApiContext.d.ts +10 -0
  7. package/dist/cjs/types/components/EditContactModal/hooks/useEditBusiness/useEditBusiness.d.ts +1 -1
  8. package/dist/cjs/types/components/EditContactModal/hooks/useEditContact/useEditContact.d.ts +1 -1
  9. package/dist/cjs/types/components/EditContactModal/hooks/useModalCloseHandler.d.ts +1 -1
  10. package/dist/cjs/types/components/EditContactModal/hooks/useTagsEditorController.d.ts +3 -0
  11. package/dist/cjs/types/components/EditContactModal/layout/Section.d.ts +1 -1
  12. package/dist/cjs/types/components/EditContactModal/services/api.d.ts +14 -6
  13. package/dist/cjs/types/i18n/config.d.ts +2 -0
  14. package/dist/cjs/types/i18n/index.d.ts +2 -0
  15. package/dist/cjs/types/index.d.ts +1 -0
  16. package/dist/esm/index.js +510 -122
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/types/components/ContactInfoPopup/ContactInfoPopup.d.ts +3 -2
  19. package/dist/esm/types/components/EditContactModal/EditContactModal.d.ts +3 -2
  20. package/dist/esm/types/components/EditContactModal/components/TagsEditor/TagsEditor.d.ts +3 -1
  21. package/dist/esm/types/components/EditContactModal/context/EditContactApiContext.d.ts +10 -0
  22. package/dist/esm/types/components/EditContactModal/hooks/useEditBusiness/useEditBusiness.d.ts +1 -1
  23. package/dist/esm/types/components/EditContactModal/hooks/useEditContact/useEditContact.d.ts +1 -1
  24. package/dist/esm/types/components/EditContactModal/hooks/useModalCloseHandler.d.ts +1 -1
  25. package/dist/esm/types/components/EditContactModal/hooks/useTagsEditorController.d.ts +3 -0
  26. package/dist/esm/types/components/EditContactModal/layout/Section.d.ts +1 -1
  27. package/dist/esm/types/components/EditContactModal/services/api.d.ts +14 -6
  28. package/dist/esm/types/i18n/config.d.ts +2 -0
  29. package/dist/esm/types/i18n/index.d.ts +2 -0
  30. package/dist/esm/types/index.d.ts +1 -0
  31. package/dist/index.d.ts +5 -4
  32. package/package.json +5 -2
@@ -1,14 +1,15 @@
1
1
  import { IBusiness, IContact } from '@trii/types/dist/Contacts';
2
2
  import { SxProps, Theme } from '@mui/material';
3
+ import '../../i18n/config';
3
4
  export interface ContactInfoPopupProps {
4
5
  open: boolean;
5
6
  anchorEl: HTMLElement | null;
6
7
  onClose: () => void;
7
- t?: (key: string) => string;
8
+ language?: 'en' | 'es';
8
9
  contactData?: IContact | IBusiness;
9
10
  avatarImgUrl?: string;
10
11
  sx?: SxProps<Theme>;
11
12
  navigate: (path: string) => void;
12
13
  }
13
- declare const ContactInfoPopup: ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, t, }: ContactInfoPopupProps) => import("react/jsx-runtime").JSX.Element;
14
+ declare const ContactInfoPopup: ({ open, anchorEl, onClose, contactData, avatarImgUrl, navigate, language, }: ContactInfoPopupProps) => import("react/jsx-runtime").JSX.Element;
14
15
  export default ContactInfoPopup;
@@ -1,13 +1,14 @@
1
1
  import { SxProps, Theme } from '@mui/material';
2
+ import '../../i18n/config';
2
3
  export interface Props {
3
4
  open: boolean;
4
5
  onClose: () => void;
5
6
  baseUrl?: string;
6
7
  spaceId?: string;
7
8
  contactId?: string;
8
- t: (key: string) => string;
9
+ language?: 'en' | 'es';
9
10
  sx?: SxProps<Theme>;
10
11
  navigate: (path: string) => void;
11
12
  }
12
- declare const EditContactModal: ({ open, onClose, baseUrl, spaceId, contactId, sx, t, navigate, }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ declare const EditContactModal: ({ open, onClose, baseUrl, spaceId, contactId, sx, language, navigate, }: Props) => import("react/jsx-runtime").JSX.Element;
13
14
  export default EditContactModal;
@@ -6,6 +6,8 @@ type TagsEditorProps = {
6
6
  onBack: () => void;
7
7
  onSave: () => void;
8
8
  isSaving: boolean;
9
+ onCreateNew: (name: string) => void;
10
+ isCreatingNew: boolean;
9
11
  };
10
- declare const TagsEditor: ({ value, options, onChange, onBack, onSave, isSaving }: TagsEditorProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const TagsEditor: ({ value, options, onChange, onBack, onSave, isSaving, onCreateNew, isCreatingNew, }: TagsEditorProps) => import("react/jsx-runtime").JSX.Element;
11
13
  export default TagsEditor;
@@ -3,6 +3,11 @@ export declare const EditContactApiProvider: import("react").Provider<{
3
3
  fetchLabels: ({ signal }?: {
4
4
  signal?: AbortSignal | undefined;
5
5
  }) => Promise<import("@trii/types/dist/Contacts").ILabel[]>;
6
+ createLabel: ({ name, signal }: {
7
+ signal?: AbortSignal | undefined;
8
+ } & {
9
+ name: string;
10
+ }) => Promise<import("@trii/types/dist/Contacts").ILabel>;
6
11
  fetchContact: ({ contactId, signal }: {
7
12
  signal?: AbortSignal | undefined;
8
13
  } & {
@@ -83,6 +88,11 @@ export declare const useEditContactApi: () => {
83
88
  fetchLabels: ({ signal }?: {
84
89
  signal?: AbortSignal | undefined;
85
90
  }) => Promise<import("@trii/types/dist/Contacts").ILabel[]>;
91
+ createLabel: ({ name, signal }: {
92
+ signal?: AbortSignal | undefined;
93
+ } & {
94
+ name: string;
95
+ }) => Promise<import("@trii/types/dist/Contacts").ILabel>;
86
96
  fetchContact: ({ contactId, signal }: {
87
97
  signal?: AbortSignal | undefined;
88
98
  } & {
@@ -6,5 +6,5 @@ type UseEditBusinessArgs = {
6
6
  baseUrl?: string;
7
7
  spaceId?: string;
8
8
  };
9
- declare const useEditBusiness: ({ business, customContactFields, baseUrl, spaceId }: UseEditBusinessArgs) => UseEditBusiness;
9
+ declare const useEditBusiness: ({ business, customContactFields, baseUrl, spaceId, }: UseEditBusinessArgs) => UseEditBusiness;
10
10
  export default useEditBusiness;
@@ -6,5 +6,5 @@ type UseEditContactArgs = {
6
6
  baseUrl?: string;
7
7
  spaceId?: string;
8
8
  };
9
- declare const useEditContact: ({ contact, customContactFields, baseUrl, spaceId }: UseEditContactArgs) => UseEditContact;
9
+ declare const useEditContact: ({ contact, customContactFields, baseUrl, spaceId, }: UseEditContactArgs) => UseEditContact;
10
10
  export default useEditContact;
@@ -2,5 +2,5 @@ type Reason = 'backdropClick' | 'escapeKeyDown';
2
2
  type UseModalCloseHandlerArgs = {
3
3
  onClose: () => void;
4
4
  };
5
- export declare const useModalCloseHandler: ({ onClose }: UseModalCloseHandlerArgs) => (event: unknown, reason?: Reason) => void;
5
+ export declare const useModalCloseHandler: ({ onClose }: UseModalCloseHandlerArgs) => (_event: unknown, reason?: Reason) => void;
6
6
  export {};
@@ -16,7 +16,10 @@ type UseTagsEditorControllerReturn = {
16
16
  setView: (view: 'main' | 'tags') => void;
17
17
  draftLabels: ILabel[];
18
18
  setDraftLabels: (labels: ILabel[]) => void;
19
+ labelsOptions: ILabel[];
19
20
  isSaving: boolean;
21
+ isCreatingLabel: boolean;
22
+ handleCreateLabel: (name: string) => Promise<void>;
20
23
  handleSaveTags: () => Promise<void>;
21
24
  };
22
25
  export declare const useTagsEditorController: ({ open, baseUrl, spaceId, contactData, contactType, labels, selectedTags, onTagsUpdated, }: UseTagsEditorControllerArgs) => UseTagsEditorControllerReturn;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from "react";
1
+ import { ReactNode } from 'react';
2
2
  type SectionProps = {
3
3
  title: string;
4
4
  children: ReactNode;
@@ -15,12 +15,16 @@ type FetchContactArgs = ApiArgs & {
15
15
  contactId: string;
16
16
  };
17
17
  type FetchLabelsArgs = ApiArgs;
18
+ type CreateLabelArgs = ApiArgs & {
19
+ name: string;
20
+ };
18
21
  export declare function fetchLabels({ baseUrl, spaceId, signal }: FetchLabelsArgs): Promise<ILabel[]>;
22
+ export declare function createLabel({ baseUrl, spaceId, name, signal }: CreateLabelArgs): Promise<ILabel>;
19
23
  export declare function fetchContact({ baseUrl, spaceId, contactId, signal }: FetchContactArgs): Promise<IContact | IBusiness>;
20
24
  type FetchContactFieldsArgs = ApiArgs & {
21
25
  forType: 'contact' | 'business';
22
26
  };
23
- export declare function fetchContactFields({ baseUrl, spaceId, forType, signal }: FetchContactFieldsArgs): Promise<IContactField[]>;
27
+ export declare function fetchContactFields({ baseUrl, spaceId, forType, signal, }: FetchContactFieldsArgs): Promise<IContactField[]>;
24
28
  type UpdateEntityArgs = ApiArgs & {
25
29
  entityType: 'contact' | 'business';
26
30
  entityId: string;
@@ -28,7 +32,7 @@ type UpdateEntityArgs = ApiArgs & {
28
32
  tags: IContactTag[];
29
33
  };
30
34
  };
31
- export declare function updateEntity({ baseUrl, spaceId, entityType, entityId, body, signal }: UpdateEntityArgs): Promise<IContact | IBusiness>;
35
+ export declare function updateEntity({ baseUrl, spaceId, entityType, entityId, body, signal, }: UpdateEntityArgs): Promise<IContact | IBusiness>;
32
36
  type DeleteContactAddressData = {
33
37
  contactId: string;
34
38
  contactAddressId: string;
@@ -66,9 +70,9 @@ type UpdateContactAddressArgs = ApiArgs & {
66
70
  data: UpdateContactAddressData;
67
71
  };
68
72
  export declare function deleteAddress({ baseUrl, spaceId, data, signal }: DeleteContactAddressArgs): Promise<unknown>;
69
- export declare function checkContactAddress({ baseUrl, spaceId, data, signal }: CheckContactAddressArgs): Promise<ResultContactAddressCheck>;
73
+ export declare function checkContactAddress({ baseUrl, spaceId, data, signal, }: CheckContactAddressArgs): Promise<ResultContactAddressCheck>;
70
74
  export declare function setContactAddress({ baseUrl, spaceId, data, signal }: SetContactAddressArgs): Promise<IContactAddress>;
71
- export declare function updateContactAddress({ baseUrl, spaceId, data, signal }: UpdateContactAddressArgs): Promise<IContactAddress>;
75
+ export declare function updateContactAddress({ baseUrl, spaceId, data, signal, }: UpdateContactAddressArgs): Promise<IContactAddress>;
72
76
  type FetchUserTriiArgs = ApiArgs;
73
77
  export declare function fetchUserTrii({ baseUrl, spaceId, signal }: FetchUserTriiArgs): Promise<UserTrii>;
74
78
  type FetchUsersArgs = ApiArgs;
@@ -76,18 +80,21 @@ export declare function fetchUsers({ baseUrl, spaceId, signal }: FetchUsersArgs)
76
80
  type FetchUserTriiByIdArgs = ApiArgs & {
77
81
  userId: string;
78
82
  };
79
- export declare function fetchUserTriiById({ baseUrl, spaceId, signal, userId }: FetchUserTriiByIdArgs): Promise<UserTrii>;
83
+ export declare function fetchUserTriiById({ baseUrl, spaceId, signal, userId, }: FetchUserTriiByIdArgs): Promise<UserTrii>;
80
84
  type UploadAvatarArgs = ApiArgs & {
81
85
  contactId: string;
82
86
  file: File;
83
87
  };
84
- export declare function uploadAvatar({ baseUrl, spaceId, contactId, file, signal }: UploadAvatarArgs): Promise<string>;
88
+ export declare function uploadAvatar({ baseUrl, spaceId, contactId, file, signal, }: UploadAvatarArgs): Promise<string>;
85
89
  type FetchContactBoundArgs = WithSignal & {
86
90
  contactId: string;
87
91
  };
88
92
  type FetchContactFieldsBoundArgs = WithSignal & {
89
93
  forType: 'contact' | 'business';
90
94
  };
95
+ type CreateLabelBoundArgs = WithSignal & {
96
+ name: string;
97
+ };
91
98
  type UpdateEntityBoundArgs = WithSignal & {
92
99
  entityType: 'contact' | 'business';
93
100
  entityId: string;
@@ -116,6 +123,7 @@ type UpdateContactAddressBoundArgs = WithSignal & {
116
123
  };
117
124
  export declare const createEditContactApi: (baseUrl: string, spaceId: string) => {
118
125
  fetchLabels: ({ signal }?: WithSignal) => Promise<ILabel[]>;
126
+ createLabel: ({ name, signal }: CreateLabelBoundArgs) => Promise<ILabel>;
119
127
  fetchContact: ({ contactId, signal }: FetchContactBoundArgs) => Promise<IContact | IBusiness>;
120
128
  fetchContactFields: ({ forType, signal }: FetchContactFieldsBoundArgs) => Promise<IContactField[]>;
121
129
  updateEntity: ({ entityType, entityId, body, signal }: UpdateEntityBoundArgs) => Promise<IContact | IBusiness>;
@@ -0,0 +1,2 @@
1
+ import i18n from 'i18next';
2
+ export default i18n;
@@ -0,0 +1,2 @@
1
+ export { default as i18n } from './config';
2
+ export { useTranslation } from 'react-i18next';
@@ -1 +1,2 @@
1
1
  export * from './components';
2
+ export { i18n } from './i18n';