agx-chat-web 1.2.0 → 1.2.2
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/README.md +49 -49
- package/package.json +91 -91
- package/src/__tests__/app/Messenger/classes/slaCalculations.spec.ts +122 -122
- package/src/app/ChatProvider/ChatProvider.tsx +20 -20
- package/src/app/Messenger/classes/slaCalculations.ts +197 -197
- package/src/app/Messenger/components/ChatButton/ChatButton.tsx +64 -64
- package/src/app/Messenger/components/ChatTabs/ChatTabs.less +18 -18
- package/src/app/Messenger/components/ChatTabs/ChatTabs.tsx +32 -32
- package/src/app/Messenger/components/DocMessage/DocMessage.less +71 -71
- package/src/app/Messenger/components/DocMessage/DocMessage.tsx +50 -50
- package/src/app/Messenger/components/ImagesContainer/ImagesContainer.less +79 -79
- package/src/app/Messenger/components/ImagesContainer/ImagesContainer.tsx +51 -51
- package/src/app/Messenger/components/IncomingMessage/IncomingMessage.tsx +170 -170
- package/src/app/Messenger/components/InfiniteScroll/InfiniteScroll.tsx +80 -80
- package/src/app/Messenger/components/InputFile/InputFile.tsx +147 -147
- package/src/app/Messenger/components/InputFile/inputFile.less +59 -59
- package/src/app/Messenger/components/MessageBallon/MessageBalloon.tsx +100 -100
- package/src/app/Messenger/components/MessengerAvatar/MessengerAvatar.tsx +29 -29
- package/src/app/Messenger/components/MessengerThemeWrapper/MessengerThemeWrapper.tsx +62 -62
- package/src/app/Messenger/components/RenderFileIcon/RenderFileIcon.tsx +40 -40
- package/src/app/Messenger/components/SearchInput/SearchInput.less +45 -45
- package/src/app/Messenger/components/SearchInput/SearchInput.tsx +77 -77
- package/src/app/Messenger/components/Select/Select.less +22 -22
- package/src/app/Messenger/components/Select/Select.tsx +56 -56
- package/src/app/Messenger/components/SendMessageForm/SendMessageForm.tsx +254 -254
- package/src/app/Messenger/components/SenderMessages/SenderMessages.tsx +91 -91
- package/src/app/Messenger/components/SystemMessage/SystemMessage.tsx +25 -25
- package/src/app/Messenger/components/TextArea/TextArea.tsx +35 -35
- package/src/app/Messenger/components/TextArea/Textarea.less +22 -22
- package/src/app/Messenger/components/Tooltip/Tooltip.less +27 -27
- package/src/app/Messenger/components/Tooltip/Tooltip.tsx +17 -17
- package/src/app/Messenger/hooks/useConversations.tsx +143 -143
- package/src/app/Messenger/hooks/useMessages.tsx +49 -49
- package/src/app/Messenger/hooks/useThemes.tsx +14 -14
- package/src/app/Messenger/icons/AttachFileIcon.tsx +20 -20
- package/src/app/Messenger/icons/CSVFileIcon.tsx +26 -26
- package/src/app/Messenger/icons/CloseIcon.tsx +20 -20
- package/src/app/Messenger/icons/DOCFileIcon.tsx +54 -54
- package/src/app/Messenger/icons/DownloadMinimalistIcon.tsx +37 -37
- package/src/app/Messenger/icons/EmptyIcon.tsx +20 -20
- package/src/app/Messenger/icons/MP4FileIcon.tsx +26 -26
- package/src/app/Messenger/icons/MessageIcon.tsx +27 -27
- package/src/app/Messenger/icons/PDFFileIcon.tsx +54 -54
- package/src/app/Messenger/icons/ReadIcon.tsx +18 -18
- package/src/app/Messenger/icons/SearchIcon.tsx +20 -20
- package/src/app/Messenger/icons/TimerIcon.tsx +18 -18
- package/src/app/Messenger/icons/TrashIcon.tsx +21 -21
- package/src/app/Messenger/views/Messenger.less +623 -623
- package/src/app/Messenger/views/MessengerList.tsx +170 -170
- package/src/app/Messenger/views/MessengerListItem.tsx +178 -178
- package/src/app/Messenger/views/MessengerMessages.tsx +414 -414
- package/src/app/Messenger/views/NewFormChat.tsx +145 -145
- package/src/app/i18n/index.ts +36 -36
- package/src/app/i18n/locales/en.json +64 -64
- package/src/app/i18n/locales/pt.json +64 -64
- package/src/assets/right-arrow.svg +9 -9
- package/src/index.ts +23 -23
- package/src/react-app-env.d.ts +19 -19
- package/src/setupTests.ts +5 -5
- package/src/styles/abstracts/animations.less +8 -8
- package/src/styles/abstracts/mixins.less +5 -5
- package/src/styles/abstracts/variables.less +31 -31
- package/src/styles/base/base.less +6 -6
- package/src/styles/index.less +5 -5
- package/src/types.ts +174 -174
- package/dist/agx-chat.esm.js +0 -2
- package/dist/agx-chat.esm.js.map +0 -1
- package/dist/agx-chat.min.js +0 -2
- package/dist/agx-chat.min.js.map +0 -1
- package/dist/esm/__tests__/app/Messenger/classes/slaCalculations.spec.d.ts +0 -1
- package/dist/esm/__tests__/app/Messenger/classes/slaCalculations.spec.js +0 -46
- package/dist/esm/__tests__/app/Messenger/classes/slaCalculations.spec.js.map +0 -1
- package/dist/esm/app/Messenger/classes/slaCalculations.d.ts +0 -30
- package/dist/esm/app/Messenger/classes/slaCalculations.js +0 -144
- package/dist/esm/app/Messenger/classes/slaCalculations.js.map +0 -1
- package/dist/esm/app/Messenger/components/ChatButton/ChatButton.d.ts +0 -14
- package/dist/esm/app/Messenger/components/ChatButton/ChatButton.js +0 -31
- package/dist/esm/app/Messenger/components/ChatButton/ChatButton.js.map +0 -1
- package/dist/esm/app/Messenger/components/ChatTabs/ChatTabs.d.ts +0 -10
- package/dist/esm/app/Messenger/components/ChatTabs/ChatTabs.js +0 -15
- package/dist/esm/app/Messenger/components/ChatTabs/ChatTabs.js.map +0 -1
- package/dist/esm/app/Messenger/components/DocMessage/DocMessage.d.ts +0 -5
- package/dist/esm/app/Messenger/components/DocMessage/DocMessage.js +0 -35
- package/dist/esm/app/Messenger/components/DocMessage/DocMessage.js.map +0 -1
- package/dist/esm/app/Messenger/components/ImagesContainer/ImagesContainer.d.ts +0 -4
- package/dist/esm/app/Messenger/components/ImagesContainer/ImagesContainer.js +0 -39
- package/dist/esm/app/Messenger/components/ImagesContainer/ImagesContainer.js.map +0 -1
- package/dist/esm/app/Messenger/components/IncomingMessage/IncomingMessage.d.ts +0 -7
- package/dist/esm/app/Messenger/components/IncomingMessage/IncomingMessage.js +0 -49
- package/dist/esm/app/Messenger/components/IncomingMessage/IncomingMessage.js.map +0 -1
- package/dist/esm/app/Messenger/components/InfiniteScroll/InfiniteScroll.d.ts +0 -13
- package/dist/esm/app/Messenger/components/InfiniteScroll/InfiniteScroll.js +0 -43
- package/dist/esm/app/Messenger/components/InfiniteScroll/InfiniteScroll.js.map +0 -1
- package/dist/esm/app/Messenger/components/InputFile/InputFile.d.ts +0 -11
- package/dist/esm/app/Messenger/components/InputFile/InputFile.js +0 -72
- package/dist/esm/app/Messenger/components/InputFile/InputFile.js.map +0 -1
- package/dist/esm/app/Messenger/components/MessageBallon/MessageBalloon.d.ts +0 -9
- package/dist/esm/app/Messenger/components/MessageBallon/MessageBalloon.js +0 -34
- package/dist/esm/app/Messenger/components/MessageBallon/MessageBalloon.js.map +0 -1
- package/dist/esm/app/Messenger/components/MessengerAvatar/MessengerAvatar.d.ts +0 -4
- package/dist/esm/app/Messenger/components/MessengerAvatar/MessengerAvatar.js +0 -13
- package/dist/esm/app/Messenger/components/MessengerAvatar/MessengerAvatar.js.map +0 -1
- package/dist/esm/app/Messenger/components/MessengerThemeWrapper/MessengerThemeWrapper.d.ts +0 -41
- package/dist/esm/app/Messenger/components/MessengerThemeWrapper/MessengerThemeWrapper.js +0 -40
- package/dist/esm/app/Messenger/components/MessengerThemeWrapper/MessengerThemeWrapper.js.map +0 -1
- package/dist/esm/app/Messenger/components/RenderFileIcon/RenderFileIcon.d.ts +0 -6
- package/dist/esm/app/Messenger/components/RenderFileIcon/RenderFileIcon.js +0 -21
- package/dist/esm/app/Messenger/components/RenderFileIcon/RenderFileIcon.js.map +0 -1
- package/dist/esm/app/Messenger/components/SearchInput/SearchInput.d.ts +0 -11
- package/dist/esm/app/Messenger/components/SearchInput/SearchInput.js +0 -33
- package/dist/esm/app/Messenger/components/SearchInput/SearchInput.js.map +0 -1
- package/dist/esm/app/Messenger/components/Select/Select.d.ts +0 -14
- package/dist/esm/app/Messenger/components/Select/Select.js +0 -16
- package/dist/esm/app/Messenger/components/Select/Select.js.map +0 -1
- package/dist/esm/app/Messenger/components/SendMessageForm/SendMessageForm.d.ts +0 -13
- package/dist/esm/app/Messenger/components/SendMessageForm/SendMessageForm.js +0 -119
- package/dist/esm/app/Messenger/components/SendMessageForm/SendMessageForm.js.map +0 -1
- package/dist/esm/app/Messenger/components/SenderMessages/SenderMessages.d.ts +0 -4
- package/dist/esm/app/Messenger/components/SenderMessages/SenderMessages.js +0 -40
- package/dist/esm/app/Messenger/components/SenderMessages/SenderMessages.js.map +0 -1
- package/dist/esm/app/Messenger/components/SystemMessage/SystemMessage.d.ts +0 -4
- package/dist/esm/app/Messenger/components/SystemMessage/SystemMessage.js +0 -14
- package/dist/esm/app/Messenger/components/SystemMessage/SystemMessage.js.map +0 -1
- package/dist/esm/app/Messenger/components/TextArea/TextArea.d.ts +0 -9
- package/dist/esm/app/Messenger/components/TextArea/TextArea.js +0 -14
- package/dist/esm/app/Messenger/components/TextArea/TextArea.js.map +0 -1
- package/dist/esm/app/Messenger/components/Tooltip/Tooltip.d.ts +0 -7
- package/dist/esm/app/Messenger/components/Tooltip/Tooltip.js +0 -9
- package/dist/esm/app/Messenger/components/Tooltip/Tooltip.js.map +0 -1
- package/dist/esm/app/Messenger/hooks/useConversations.d.ts +0 -21
- package/dist/esm/app/Messenger/hooks/useConversations.js +0 -105
- package/dist/esm/app/Messenger/hooks/useConversations.js.map +0 -1
- package/dist/esm/app/Messenger/hooks/useMessages.d.ts +0 -9
- package/dist/esm/app/Messenger/hooks/useMessages.js +0 -37
- package/dist/esm/app/Messenger/hooks/useMessages.js.map +0 -1
- package/dist/esm/app/Messenger/hooks/useThemes.d.ts +0 -32
- package/dist/esm/app/Messenger/hooks/useThemes.js +0 -11
- package/dist/esm/app/Messenger/hooks/useThemes.js.map +0 -1
- package/dist/esm/app/Messenger/icons/AttachFileIcon.d.ts +0 -4
- package/dist/esm/app/Messenger/icons/AttachFileIcon.js +0 -10
- package/dist/esm/app/Messenger/icons/AttachFileIcon.js.map +0 -1
- package/dist/esm/app/Messenger/icons/CloseIcon.d.ts +0 -2
- package/dist/esm/app/Messenger/icons/CloseIcon.js +0 -9
- package/dist/esm/app/Messenger/icons/CloseIcon.js.map +0 -1
- package/dist/esm/app/Messenger/icons/DOCFileIcon.d.ts +0 -4
- package/dist/esm/app/Messenger/icons/DOCFileIcon.js +0 -18
- package/dist/esm/app/Messenger/icons/DOCFileIcon.js.map +0 -1
- package/dist/esm/app/Messenger/icons/DownloadMinimalistIcon.d.ts +0 -7
- package/dist/esm/app/Messenger/icons/DownloadMinimalistIcon.js +0 -12
- package/dist/esm/app/Messenger/icons/DownloadMinimalistIcon.js.map +0 -1
- package/dist/esm/app/Messenger/icons/EmptyIcon.d.ts +0 -2
- package/dist/esm/app/Messenger/icons/EmptyIcon.js +0 -8
- package/dist/esm/app/Messenger/icons/EmptyIcon.js.map +0 -1
- package/dist/esm/app/Messenger/icons/MessageIcon.d.ts +0 -6
- package/dist/esm/app/Messenger/icons/MessageIcon.js +0 -12
- package/dist/esm/app/Messenger/icons/MessageIcon.js.map +0 -1
- package/dist/esm/app/Messenger/icons/PDFFileIcon.d.ts +0 -4
- package/dist/esm/app/Messenger/icons/PDFFileIcon.js +0 -18
- package/dist/esm/app/Messenger/icons/PDFFileIcon.js.map +0 -1
- package/dist/esm/app/Messenger/icons/ReadIcon.d.ts +0 -4
- package/dist/esm/app/Messenger/icons/ReadIcon.js +0 -7
- package/dist/esm/app/Messenger/icons/ReadIcon.js.map +0 -1
- package/dist/esm/app/Messenger/icons/SearchIcon.d.ts +0 -2
- package/dist/esm/app/Messenger/icons/SearchIcon.js +0 -8
- package/dist/esm/app/Messenger/icons/SearchIcon.js.map +0 -1
- package/dist/esm/app/Messenger/icons/TimerIcon.d.ts +0 -4
- package/dist/esm/app/Messenger/icons/TimerIcon.js +0 -7
- package/dist/esm/app/Messenger/icons/TimerIcon.js.map +0 -1
- package/dist/esm/app/Messenger/icons/TrashIcon.d.ts +0 -6
- package/dist/esm/app/Messenger/icons/TrashIcon.js +0 -7
- package/dist/esm/app/Messenger/icons/TrashIcon.js.map +0 -1
- package/dist/esm/app/Messenger/views/MessengerList.d.ts +0 -40
- package/dist/esm/app/Messenger/views/MessengerList.js +0 -46
- package/dist/esm/app/Messenger/views/MessengerList.js.map +0 -1
- package/dist/esm/app/Messenger/views/MessengerListItem.d.ts +0 -12
- package/dist/esm/app/Messenger/views/MessengerListItem.js +0 -99
- package/dist/esm/app/Messenger/views/MessengerListItem.js.map +0 -1
- package/dist/esm/app/Messenger/views/MessengerMessages.d.ts +0 -35
- package/dist/esm/app/Messenger/views/MessengerMessages.js +0 -181
- package/dist/esm/app/Messenger/views/MessengerMessages.js.map +0 -1
- package/dist/esm/app/Messenger/views/NewFormChat.d.ts +0 -13
- package/dist/esm/app/Messenger/views/NewFormChat.js +0 -68
- package/dist/esm/app/Messenger/views/NewFormChat.js.map +0 -1
- package/dist/esm/app/i18n/index.d.ts +0 -3
- package/dist/esm/app/i18n/index.js +0 -31
- package/dist/esm/app/i18n/index.js.map +0 -1
- package/dist/esm/app/i18n/locales/index.d.ts +0 -6
- package/dist/esm/app/i18n/locales/index.js +0 -7
- package/dist/esm/app/i18n/locales/index.js.map +0 -1
- package/dist/esm/index.d.ts +0 -10
- package/dist/esm/index.js +0 -11
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/setupTests.d.ts +0 -1
- package/dist/esm/setupTests.js +0 -6
- package/dist/esm/setupTests.js.map +0 -1
- package/dist/esm/types.d.ts +0 -140
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
Generic Chat implementation for AGX Software applications.
|
|
2
|
-
|
|
3
|
-
## Links
|
|
4
|
-
|
|
5
|
-
NPM link:
|
|
6
|
-
https://www.npmjs.com/package/agx-chat-web
|
|
7
|
-
|
|
8
|
-
https://betterprogramming.pub/how-to-create-and-publish-react-typescript-npm-package-with-demo-and-automated-build-80c40ec28aca#48c1
|
|
9
|
-
|
|
10
|
-
## Deploy
|
|
11
|
-
|
|
12
|
-
Steps to make a new version:
|
|
13
|
-
|
|
14
|
-
- change the version in package.json
|
|
15
|
-
- npm login (using a package maintainer account)
|
|
16
|
-
- yarn deploy
|
|
17
|
-
|
|
18
|
-
## Running the project locally for feature development
|
|
19
|
-
|
|
20
|
-
To run the project locally and add new features, follow these steps:
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
### Step 1: Familiarize yourself with `yarn link`
|
|
25
|
-
Before proceeding, review the documentation for `yarn link` to understand how it works:
|
|
26
|
-
[yarn link Documentation](https://classic.yarnpkg.com/lang/en/docs/cli/link/)
|
|
27
|
-
|
|
28
|
-
### Step 2: Build and link the project
|
|
29
|
-
1. Navigate to the root directory of this project
|
|
30
|
-
2. Run the following commands:
|
|
31
|
-
```bash
|
|
32
|
-
yarn build
|
|
33
|
-
yarn link
|
|
34
|
-
```
|
|
35
|
-
3. After running yarn link, you will see a message similar to this:
|
|
36
|
-
You can now run `yarn link "agx-chat-web"` in the projects where you no longer want to use this package.
|
|
37
|
-
|
|
38
|
-
### Step 3: Link the project to your application
|
|
39
|
-
1. Navigate to the root directory of your application (e.g., ~/projects/line-web)
|
|
40
|
-
2. Run the following commands:
|
|
41
|
-
```bash
|
|
42
|
-
yarn link "agx-chat-web"
|
|
43
|
-
yarn install --force
|
|
44
|
-
```
|
|
45
|
-
3. Once the linking process is complete, you can start your application. It will now use the locally linked agx-chat-web package for development.
|
|
46
|
-
4. When you change the code in the chat application, you can run the following command to update the linked version:
|
|
47
|
-
```bash
|
|
48
|
-
yarn deploy-dev
|
|
49
|
-
```
|
|
1
|
+
Generic Chat implementation for AGX Software applications.
|
|
2
|
+
|
|
3
|
+
## Links
|
|
4
|
+
|
|
5
|
+
NPM link:
|
|
6
|
+
https://www.npmjs.com/package/agx-chat-web
|
|
7
|
+
|
|
8
|
+
https://betterprogramming.pub/how-to-create-and-publish-react-typescript-npm-package-with-demo-and-automated-build-80c40ec28aca#48c1
|
|
9
|
+
|
|
10
|
+
## Deploy
|
|
11
|
+
|
|
12
|
+
Steps to make a new version:
|
|
13
|
+
|
|
14
|
+
- change the version in package.json
|
|
15
|
+
- npm login (using a package maintainer account)
|
|
16
|
+
- yarn deploy
|
|
17
|
+
|
|
18
|
+
## Running the project locally for feature development
|
|
19
|
+
|
|
20
|
+
To run the project locally and add new features, follow these steps:
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
### Step 1: Familiarize yourself with `yarn link`
|
|
25
|
+
Before proceeding, review the documentation for `yarn link` to understand how it works:
|
|
26
|
+
[yarn link Documentation](https://classic.yarnpkg.com/lang/en/docs/cli/link/)
|
|
27
|
+
|
|
28
|
+
### Step 2: Build and link the project
|
|
29
|
+
1. Navigate to the root directory of this project
|
|
30
|
+
2. Run the following commands:
|
|
31
|
+
```bash
|
|
32
|
+
yarn build
|
|
33
|
+
yarn link
|
|
34
|
+
```
|
|
35
|
+
3. After running yarn link, you will see a message similar to this:
|
|
36
|
+
You can now run `yarn link "agx-chat-web"` in the projects where you no longer want to use this package.
|
|
37
|
+
|
|
38
|
+
### Step 3: Link the project to your application
|
|
39
|
+
1. Navigate to the root directory of your application (e.g., ~/projects/line-web)
|
|
40
|
+
2. Run the following commands:
|
|
41
|
+
```bash
|
|
42
|
+
yarn link "agx-chat-web"
|
|
43
|
+
yarn install --force
|
|
44
|
+
```
|
|
45
|
+
3. Once the linking process is complete, you can start your application. It will now use the locally linked agx-chat-web package for development.
|
|
46
|
+
4. When you change the code in the chat application, you can run the following command to update the linked version:
|
|
47
|
+
```bash
|
|
48
|
+
yarn deploy-dev
|
|
49
|
+
```
|
package/package.json
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "agx-chat-web",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "Chat application using React and less",
|
|
5
|
-
"module": "./dist/agx-chat.esm.js",
|
|
6
|
-
"author": {
|
|
7
|
-
"name": "Jeiel Alves",
|
|
8
|
-
"email": "jeiel.oliveira@agxsoftware.com"
|
|
9
|
-
},
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"main": "./dist/agx-chat.
|
|
12
|
-
"types": "./dist/esm/index.d.ts",
|
|
13
|
-
"files": [
|
|
14
|
-
"dist",
|
|
15
|
-
"src/**/*"
|
|
16
|
-
],
|
|
17
|
-
"repository": "git@github.com:AGX-Software/chat-web.git",
|
|
18
|
-
"peerDependencies": {
|
|
19
|
-
"dayjs": "^1.11.9",
|
|
20
|
-
"i18next": "^24.2.0",
|
|
21
|
-
"react": "^18.0.0",
|
|
22
|
-
"react-dom": "^18.0.0",
|
|
23
|
-
"react-i18next": "^15.2.0",
|
|
24
|
-
"react-simple-image-viewer": "^1.2.2"
|
|
25
|
-
},
|
|
26
|
-
"scripts": {
|
|
27
|
-
"clean": "shx rm -rf dist",
|
|
28
|
-
"build": "yarn clean && tsc && webpack",
|
|
29
|
-
"build-dev": "tsc && webpack",
|
|
30
|
-
"lint": "eslint \"{**/*,*}.{js,ts,jsx,tsx}\"",
|
|
31
|
-
"test": "jest --config jestconfig.json",
|
|
32
|
-
"deploy": "yarn build && npm publish",
|
|
33
|
-
"format": "prettier --write src/",
|
|
34
|
-
"prepare": "husky install"
|
|
35
|
-
},
|
|
36
|
-
"jest": {
|
|
37
|
-
"preset": "ts-jest",
|
|
38
|
-
"testEnvironment": "node",
|
|
39
|
-
"setupFilesAfterEnv": [
|
|
40
|
-
"./jestconfig.json"
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
"devDependencies": {
|
|
44
|
-
"@testing-library/react": "^13.4.0",
|
|
45
|
-
"@types/jest": "^29.2.5",
|
|
46
|
-
"@types/react": "^19.1.12",
|
|
47
|
-
"@types/react-dom": "^19.1.9",
|
|
48
|
-
"css-loader": "^6.7.3",
|
|
49
|
-
"dayjs": "^1.11.9",
|
|
50
|
-
"eslint": "^9.34.0",
|
|
51
|
-
"eslint-plugin-only-warn": "^1.1.0",
|
|
52
|
-
"eslint-plugin-react": "^7.31.11",
|
|
53
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
54
|
-
"husky": "^9.1.7",
|
|
55
|
-
"jest": "^29.3.1",
|
|
56
|
-
"jest-canvas-mock": "^2.4.0",
|
|
57
|
-
"jest-environment-jsdom": "^29.3.1",
|
|
58
|
-
"less": "^4.1.3",
|
|
59
|
-
"less-loader": "^11.1.0",
|
|
60
|
-
"lint-staged": "^16.1.5",
|
|
61
|
-
"prettier": "^3.6.2",
|
|
62
|
-
"react-simple-image-viewer": "^1.2.2",
|
|
63
|
-
"shx": "^0.3.4",
|
|
64
|
-
"style-loader": "^3.3.1",
|
|
65
|
-
"svg-url-loader": "^8.0.0",
|
|
66
|
-
"terser-webpack-plugin": "^5.3.6",
|
|
67
|
-
"ts-jest": "^29.1.1",
|
|
68
|
-
"ts-loader": "^9.4.2",
|
|
69
|
-
"typescript": "^5.9.2",
|
|
70
|
-
"typescript-eslint": "^8.40.0",
|
|
71
|
-
"uglifyjs-webpack-plugin": "^2.2.0",
|
|
72
|
-
"webpack": "^5.75.0",
|
|
73
|
-
"webpack-cli": "^5.0.1"
|
|
74
|
-
},
|
|
75
|
-
"exports": {
|
|
76
|
-
".": {
|
|
77
|
-
"import": "./dist/agx-chat.esm.js",
|
|
78
|
-
"require": "./dist/agx-chat.umd.js",
|
|
79
|
-
"default": "./dist/agx-chat.umd.js"
|
|
80
|
-
},
|
|
81
|
-
"./package.json": "./package.json"
|
|
82
|
-
},
|
|
83
|
-
"lint-staged": {
|
|
84
|
-
"*.{ts,tsx}": "eslint --cache --fix --max-warnings 0 --no-warn-ignored",
|
|
85
|
-
"*.{ts,tsx,js,jsx,json,css,scss,md}": "prettier --write"
|
|
86
|
-
},
|
|
87
|
-
"dependencies": {
|
|
88
|
-
"@types/i18next": "^13.0.0",
|
|
89
|
-
"@types/react-i18next": "^8.1.0"
|
|
90
|
-
}
|
|
91
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "agx-chat-web",
|
|
3
|
+
"version": "1.2.2",
|
|
4
|
+
"description": "Chat application using React and less",
|
|
5
|
+
"module": "./dist/agx-chat.esm.js",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Jeiel Alves",
|
|
8
|
+
"email": "jeiel.oliveira@agxsoftware.com"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"main": "./dist/agx-chat.umd.js",
|
|
12
|
+
"types": "./dist/esm/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"src/**/*"
|
|
16
|
+
],
|
|
17
|
+
"repository": "git@github.com:AGX-Software/chat-web.git",
|
|
18
|
+
"peerDependencies": {
|
|
19
|
+
"dayjs": "^1.11.9",
|
|
20
|
+
"i18next": "^24.2.0",
|
|
21
|
+
"react": "^18.0.0",
|
|
22
|
+
"react-dom": "^18.0.0",
|
|
23
|
+
"react-i18next": "^15.2.0",
|
|
24
|
+
"react-simple-image-viewer": "^1.2.2"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"clean": "shx rm -rf dist",
|
|
28
|
+
"build": "yarn clean && tsc && webpack",
|
|
29
|
+
"build-dev": "tsc && webpack",
|
|
30
|
+
"lint": "eslint \"{**/*,*}.{js,ts,jsx,tsx}\"",
|
|
31
|
+
"test": "jest --config jestconfig.json",
|
|
32
|
+
"deploy": "yarn build && npm publish",
|
|
33
|
+
"format": "prettier --write src/",
|
|
34
|
+
"prepare": "husky install"
|
|
35
|
+
},
|
|
36
|
+
"jest": {
|
|
37
|
+
"preset": "ts-jest",
|
|
38
|
+
"testEnvironment": "node",
|
|
39
|
+
"setupFilesAfterEnv": [
|
|
40
|
+
"./jestconfig.json"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@testing-library/react": "^13.4.0",
|
|
45
|
+
"@types/jest": "^29.2.5",
|
|
46
|
+
"@types/react": "^19.1.12",
|
|
47
|
+
"@types/react-dom": "^19.1.9",
|
|
48
|
+
"css-loader": "^6.7.3",
|
|
49
|
+
"dayjs": "^1.11.9",
|
|
50
|
+
"eslint": "^9.34.0",
|
|
51
|
+
"eslint-plugin-only-warn": "^1.1.0",
|
|
52
|
+
"eslint-plugin-react": "^7.31.11",
|
|
53
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
54
|
+
"husky": "^9.1.7",
|
|
55
|
+
"jest": "^29.3.1",
|
|
56
|
+
"jest-canvas-mock": "^2.4.0",
|
|
57
|
+
"jest-environment-jsdom": "^29.3.1",
|
|
58
|
+
"less": "^4.1.3",
|
|
59
|
+
"less-loader": "^11.1.0",
|
|
60
|
+
"lint-staged": "^16.1.5",
|
|
61
|
+
"prettier": "^3.6.2",
|
|
62
|
+
"react-simple-image-viewer": "^1.2.2",
|
|
63
|
+
"shx": "^0.3.4",
|
|
64
|
+
"style-loader": "^3.3.1",
|
|
65
|
+
"svg-url-loader": "^8.0.0",
|
|
66
|
+
"terser-webpack-plugin": "^5.3.6",
|
|
67
|
+
"ts-jest": "^29.1.1",
|
|
68
|
+
"ts-loader": "^9.4.2",
|
|
69
|
+
"typescript": "^5.9.2",
|
|
70
|
+
"typescript-eslint": "^8.40.0",
|
|
71
|
+
"uglifyjs-webpack-plugin": "^2.2.0",
|
|
72
|
+
"webpack": "^5.75.0",
|
|
73
|
+
"webpack-cli": "^5.0.1"
|
|
74
|
+
},
|
|
75
|
+
"exports": {
|
|
76
|
+
".": {
|
|
77
|
+
"import": "./dist/agx-chat.esm.js",
|
|
78
|
+
"require": "./dist/agx-chat.umd.js",
|
|
79
|
+
"default": "./dist/agx-chat.umd.js"
|
|
80
|
+
},
|
|
81
|
+
"./package.json": "./package.json"
|
|
82
|
+
},
|
|
83
|
+
"lint-staged": {
|
|
84
|
+
"*.{ts,tsx}": "eslint --cache --fix --max-warnings 0 --no-warn-ignored",
|
|
85
|
+
"*.{ts,tsx,js,jsx,json,css,scss,md}": "prettier --write"
|
|
86
|
+
},
|
|
87
|
+
"dependencies": {
|
|
88
|
+
"@types/i18next": "^13.0.0",
|
|
89
|
+
"@types/react-i18next": "^8.1.0"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
import { describe, expect, it } from '@jest/globals'
|
|
2
|
-
import {
|
|
3
|
-
SlaDates,
|
|
4
|
-
timeAsDayjs,
|
|
5
|
-
} from '../../../../app/Messenger/classes/slaCalculations'
|
|
6
|
-
const workingHours = { start: 9, end: 18 }
|
|
7
|
-
|
|
8
|
-
describe('slaCalculations class', () => {
|
|
9
|
-
it('Should return true seconds in working hour', () => {
|
|
10
|
-
const sla = new SlaDates(1300)
|
|
11
|
-
|
|
12
|
-
expect(
|
|
13
|
-
sla.canUpdateClock(
|
|
14
|
-
timeAsDayjs('2023-07-21T10:19:29.224+00:00', { applyTimezone: false })
|
|
15
|
-
)
|
|
16
|
-
).toBeTruthy()
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
it('Should return false seconds from canUpdateClock', () => {
|
|
20
|
-
const sla = new SlaDates(1300)
|
|
21
|
-
|
|
22
|
-
expect(
|
|
23
|
-
sla.canUpdateClock(
|
|
24
|
-
timeAsDayjs('2023-07-21T20:19:29.224+00:00', { applyTimezone: false })
|
|
25
|
-
)
|
|
26
|
-
).toBeFalsy()
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
it('Should return false in holiday', () => {
|
|
30
|
-
const sla = new SlaDates(1300)
|
|
31
|
-
|
|
32
|
-
expect(
|
|
33
|
-
sla.canUpdateClock(
|
|
34
|
-
timeAsDayjs('2023-10-12T10:19:29.224+00:00', { applyTimezone: false })
|
|
35
|
-
)
|
|
36
|
-
).toBeFalsy()
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('Should return 3600 seconds diffence', () => {
|
|
40
|
-
const sla = new SlaDates(3600)
|
|
41
|
-
|
|
42
|
-
expect(
|
|
43
|
-
sla.getDifferenceInSeconds(
|
|
44
|
-
timeAsDayjs('2023-07-19T09:19:29.224+00:00', { applyTimezone: false }),
|
|
45
|
-
timeAsDayjs('2023-07-19T10:19:29.224+00:00', { applyTimezone: false }),
|
|
46
|
-
workingHours
|
|
47
|
-
)
|
|
48
|
-
).toBe(3600)
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
it('Should return 7200 seconds diffence', () => {
|
|
52
|
-
const sla = new SlaDates(3600)
|
|
53
|
-
|
|
54
|
-
expect(
|
|
55
|
-
sla.getDifferenceInSeconds(
|
|
56
|
-
timeAsDayjs('2023-10-12T09:19:29.224+00:00', { applyTimezone: false }),
|
|
57
|
-
timeAsDayjs('2023-10-12T11:19:29.224+00:00', { applyTimezone: false }),
|
|
58
|
-
workingHours
|
|
59
|
-
)
|
|
60
|
-
).toBe(0)
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it('Should return 7200 seconds diffence', () => {
|
|
64
|
-
const sla = new SlaDates(3600)
|
|
65
|
-
|
|
66
|
-
expect(
|
|
67
|
-
sla.getDifferenceInSeconds(
|
|
68
|
-
timeAsDayjs('2023-07-21T17:00:00.000+00:00', { applyTimezone: false }),
|
|
69
|
-
timeAsDayjs('2023-07-24T10:00:00.000+00:00', { applyTimezone: false }),
|
|
70
|
-
workingHours
|
|
71
|
-
)
|
|
72
|
-
).toBe(7200)
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
it('Should return 64800 seconds diffence', () => {
|
|
76
|
-
const sla = new SlaDates(3600)
|
|
77
|
-
|
|
78
|
-
expect(
|
|
79
|
-
sla.getDifferenceInSeconds(
|
|
80
|
-
timeAsDayjs('2023-07-21T09:00:00.000+00:00', { applyTimezone: false }),
|
|
81
|
-
timeAsDayjs('2023-07-24T18:00:00.000+00:00', { applyTimezone: false }),
|
|
82
|
-
workingHours
|
|
83
|
-
)
|
|
84
|
-
).toBe(64800)
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
it('Should return 43200 seconds diffence', () => {
|
|
88
|
-
const sla = new SlaDates(3600)
|
|
89
|
-
|
|
90
|
-
expect(
|
|
91
|
-
sla.getDifferenceInSeconds(
|
|
92
|
-
timeAsDayjs('2023-07-21T09:00:00.000+00:00', { applyTimezone: false }),
|
|
93
|
-
timeAsDayjs('2023-07-24T12:00:00.000+00:00', { applyTimezone: false }),
|
|
94
|
-
workingHours
|
|
95
|
-
)
|
|
96
|
-
).toBe(43200)
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
it('Should return 1800 seconds diffence', () => {
|
|
100
|
-
const sla = new SlaDates(3600)
|
|
101
|
-
|
|
102
|
-
expect(
|
|
103
|
-
sla.getDifferenceInSeconds(
|
|
104
|
-
timeAsDayjs('2023-07-24T07:00:00.000+00:00', { applyTimezone: false }),
|
|
105
|
-
timeAsDayjs('2023-07-24T09:30:00.000+00:00', { applyTimezone: false }),
|
|
106
|
-
workingHours
|
|
107
|
-
)
|
|
108
|
-
).toBe(1800)
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
it('Should return 3600 seconds diffence', () => {
|
|
112
|
-
const sla = new SlaDates(3600)
|
|
113
|
-
|
|
114
|
-
expect(
|
|
115
|
-
sla.getDifferenceInSeconds(
|
|
116
|
-
timeAsDayjs('2023-07-24T22:00:00.000+00:00', { applyTimezone: false }),
|
|
117
|
-
timeAsDayjs('2023-07-25T10:00:00.000+00:00', { applyTimezone: false }),
|
|
118
|
-
workingHours
|
|
119
|
-
)
|
|
120
|
-
).toBe(3600)
|
|
121
|
-
})
|
|
122
|
-
})
|
|
1
|
+
import { describe, expect, it } from '@jest/globals'
|
|
2
|
+
import {
|
|
3
|
+
SlaDates,
|
|
4
|
+
timeAsDayjs,
|
|
5
|
+
} from '../../../../app/Messenger/classes/slaCalculations'
|
|
6
|
+
const workingHours = { start: 9, end: 18 }
|
|
7
|
+
|
|
8
|
+
describe('slaCalculations class', () => {
|
|
9
|
+
it('Should return true seconds in working hour', () => {
|
|
10
|
+
const sla = new SlaDates(1300)
|
|
11
|
+
|
|
12
|
+
expect(
|
|
13
|
+
sla.canUpdateClock(
|
|
14
|
+
timeAsDayjs('2023-07-21T10:19:29.224+00:00', { applyTimezone: false })
|
|
15
|
+
)
|
|
16
|
+
).toBeTruthy()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('Should return false seconds from canUpdateClock', () => {
|
|
20
|
+
const sla = new SlaDates(1300)
|
|
21
|
+
|
|
22
|
+
expect(
|
|
23
|
+
sla.canUpdateClock(
|
|
24
|
+
timeAsDayjs('2023-07-21T20:19:29.224+00:00', { applyTimezone: false })
|
|
25
|
+
)
|
|
26
|
+
).toBeFalsy()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('Should return false in holiday', () => {
|
|
30
|
+
const sla = new SlaDates(1300)
|
|
31
|
+
|
|
32
|
+
expect(
|
|
33
|
+
sla.canUpdateClock(
|
|
34
|
+
timeAsDayjs('2023-10-12T10:19:29.224+00:00', { applyTimezone: false })
|
|
35
|
+
)
|
|
36
|
+
).toBeFalsy()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('Should return 3600 seconds diffence', () => {
|
|
40
|
+
const sla = new SlaDates(3600)
|
|
41
|
+
|
|
42
|
+
expect(
|
|
43
|
+
sla.getDifferenceInSeconds(
|
|
44
|
+
timeAsDayjs('2023-07-19T09:19:29.224+00:00', { applyTimezone: false }),
|
|
45
|
+
timeAsDayjs('2023-07-19T10:19:29.224+00:00', { applyTimezone: false }),
|
|
46
|
+
workingHours
|
|
47
|
+
)
|
|
48
|
+
).toBe(3600)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('Should return 7200 seconds diffence', () => {
|
|
52
|
+
const sla = new SlaDates(3600)
|
|
53
|
+
|
|
54
|
+
expect(
|
|
55
|
+
sla.getDifferenceInSeconds(
|
|
56
|
+
timeAsDayjs('2023-10-12T09:19:29.224+00:00', { applyTimezone: false }),
|
|
57
|
+
timeAsDayjs('2023-10-12T11:19:29.224+00:00', { applyTimezone: false }),
|
|
58
|
+
workingHours
|
|
59
|
+
)
|
|
60
|
+
).toBe(0)
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('Should return 7200 seconds diffence', () => {
|
|
64
|
+
const sla = new SlaDates(3600)
|
|
65
|
+
|
|
66
|
+
expect(
|
|
67
|
+
sla.getDifferenceInSeconds(
|
|
68
|
+
timeAsDayjs('2023-07-21T17:00:00.000+00:00', { applyTimezone: false }),
|
|
69
|
+
timeAsDayjs('2023-07-24T10:00:00.000+00:00', { applyTimezone: false }),
|
|
70
|
+
workingHours
|
|
71
|
+
)
|
|
72
|
+
).toBe(7200)
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('Should return 64800 seconds diffence', () => {
|
|
76
|
+
const sla = new SlaDates(3600)
|
|
77
|
+
|
|
78
|
+
expect(
|
|
79
|
+
sla.getDifferenceInSeconds(
|
|
80
|
+
timeAsDayjs('2023-07-21T09:00:00.000+00:00', { applyTimezone: false }),
|
|
81
|
+
timeAsDayjs('2023-07-24T18:00:00.000+00:00', { applyTimezone: false }),
|
|
82
|
+
workingHours
|
|
83
|
+
)
|
|
84
|
+
).toBe(64800)
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
it('Should return 43200 seconds diffence', () => {
|
|
88
|
+
const sla = new SlaDates(3600)
|
|
89
|
+
|
|
90
|
+
expect(
|
|
91
|
+
sla.getDifferenceInSeconds(
|
|
92
|
+
timeAsDayjs('2023-07-21T09:00:00.000+00:00', { applyTimezone: false }),
|
|
93
|
+
timeAsDayjs('2023-07-24T12:00:00.000+00:00', { applyTimezone: false }),
|
|
94
|
+
workingHours
|
|
95
|
+
)
|
|
96
|
+
).toBe(43200)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('Should return 1800 seconds diffence', () => {
|
|
100
|
+
const sla = new SlaDates(3600)
|
|
101
|
+
|
|
102
|
+
expect(
|
|
103
|
+
sla.getDifferenceInSeconds(
|
|
104
|
+
timeAsDayjs('2023-07-24T07:00:00.000+00:00', { applyTimezone: false }),
|
|
105
|
+
timeAsDayjs('2023-07-24T09:30:00.000+00:00', { applyTimezone: false }),
|
|
106
|
+
workingHours
|
|
107
|
+
)
|
|
108
|
+
).toBe(1800)
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('Should return 3600 seconds diffence', () => {
|
|
112
|
+
const sla = new SlaDates(3600)
|
|
113
|
+
|
|
114
|
+
expect(
|
|
115
|
+
sla.getDifferenceInSeconds(
|
|
116
|
+
timeAsDayjs('2023-07-24T22:00:00.000+00:00', { applyTimezone: false }),
|
|
117
|
+
timeAsDayjs('2023-07-25T10:00:00.000+00:00', { applyTimezone: false }),
|
|
118
|
+
workingHours
|
|
119
|
+
)
|
|
120
|
+
).toBe(3600)
|
|
121
|
+
})
|
|
122
|
+
})
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import React, { ReactNode, useEffect } from 'react'
|
|
2
|
-
import { I18nextProvider } from 'react-i18next'
|
|
3
|
-
import defaultI18n from '../i18n'
|
|
4
|
-
|
|
5
|
-
interface ChatProviderProps {
|
|
6
|
-
children: ReactNode
|
|
7
|
-
locale?: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function ChatProvider ({ children, locale }: ChatProviderProps) {
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
if (locale) {
|
|
13
|
-
defaultI18n.changeLanguage(locale)
|
|
14
|
-
}
|
|
15
|
-
}, [locale])
|
|
16
|
-
|
|
17
|
-
return <I18nextProvider i18n={defaultI18n}>{children}</I18nextProvider>
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default ChatProvider
|
|
1
|
+
import React, { ReactNode, useEffect } from 'react'
|
|
2
|
+
import { I18nextProvider } from 'react-i18next'
|
|
3
|
+
import defaultI18n from '../i18n'
|
|
4
|
+
|
|
5
|
+
interface ChatProviderProps {
|
|
6
|
+
children: ReactNode
|
|
7
|
+
locale?: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function ChatProvider ({ children, locale }: ChatProviderProps) {
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (locale) {
|
|
13
|
+
defaultI18n.changeLanguage(locale)
|
|
14
|
+
}
|
|
15
|
+
}, [locale])
|
|
16
|
+
|
|
17
|
+
return <I18nextProvider i18n={defaultI18n}>{children}</I18nextProvider>
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default ChatProvider
|