@adens/openwa 0.1.4 → 0.1.6

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 (141) hide show
  1. package/adens-openwa-0.1.5.tgz +0 -0
  2. package/package.json +3 -1
  3. package/server/index.js +30 -12
  4. package/web/.next/BUILD_ID +1 -0
  5. package/web/.next/build-manifest.json +43 -0
  6. package/web/.next/cache/.previewinfo +1 -0
  7. package/web/.next/cache/.rscinfo +1 -0
  8. package/web/.next/cache/webpack/client-production/0.pack +0 -0
  9. package/web/.next/cache/webpack/client-production/1.pack +0 -0
  10. package/web/.next/cache/webpack/client-production/10.pack +0 -0
  11. package/web/.next/cache/webpack/client-production/11.pack +0 -0
  12. package/web/.next/cache/webpack/client-production/12.pack +0 -0
  13. package/web/.next/cache/webpack/client-production/13.pack +0 -0
  14. package/web/.next/cache/webpack/client-production/14.pack +0 -0
  15. package/web/.next/cache/webpack/client-production/15.pack +0 -0
  16. package/web/.next/cache/webpack/client-production/16.pack +0 -0
  17. package/web/.next/cache/webpack/client-production/17.pack +0 -0
  18. package/web/.next/cache/webpack/client-production/18.pack +0 -0
  19. package/web/.next/cache/webpack/client-production/19.pack +0 -0
  20. package/web/.next/cache/webpack/client-production/2.pack +0 -0
  21. package/web/.next/cache/webpack/client-production/20.pack +0 -0
  22. package/web/.next/cache/webpack/client-production/21.pack +0 -0
  23. package/web/.next/cache/webpack/client-production/22.pack +0 -0
  24. package/web/.next/cache/webpack/client-production/23.pack +0 -0
  25. package/web/.next/cache/webpack/client-production/24.pack +0 -0
  26. package/web/.next/cache/webpack/client-production/25.pack +0 -0
  27. package/web/.next/cache/webpack/client-production/26.pack +0 -0
  28. package/web/.next/cache/webpack/client-production/27.pack +0 -0
  29. package/web/.next/cache/webpack/client-production/3.pack +0 -0
  30. package/web/.next/cache/webpack/client-production/4.pack +0 -0
  31. package/web/.next/cache/webpack/client-production/5.pack +0 -0
  32. package/web/.next/cache/webpack/client-production/6.pack +0 -0
  33. package/web/.next/cache/webpack/client-production/7.pack +0 -0
  34. package/web/.next/cache/webpack/client-production/8.pack +0 -0
  35. package/web/.next/cache/webpack/client-production/9.pack +0 -0
  36. package/web/.next/cache/webpack/client-production/index.pack +0 -0
  37. package/web/.next/cache/webpack/client-production/index.pack.old +0 -0
  38. package/web/.next/cache/webpack/edge-server-production/0.pack +0 -0
  39. package/web/.next/cache/webpack/edge-server-production/index.pack +0 -0
  40. package/web/.next/cache/webpack/edge-server-production/index.pack.old +0 -0
  41. package/web/.next/cache/webpack/server-production/0.pack +0 -0
  42. package/web/.next/cache/webpack/server-production/1.pack +0 -0
  43. package/web/.next/cache/webpack/server-production/10.pack +0 -0
  44. package/web/.next/cache/webpack/server-production/11.pack +0 -0
  45. package/web/.next/cache/webpack/server-production/12.pack +0 -0
  46. package/web/.next/cache/webpack/server-production/13.pack +0 -0
  47. package/web/.next/cache/webpack/server-production/14.pack +0 -0
  48. package/web/.next/cache/webpack/server-production/15.pack +0 -0
  49. package/web/.next/cache/webpack/server-production/16.pack +0 -0
  50. package/web/.next/cache/webpack/server-production/17.pack +0 -0
  51. package/web/.next/cache/webpack/server-production/18.pack +0 -0
  52. package/web/.next/cache/webpack/server-production/19.pack +0 -0
  53. package/web/.next/cache/webpack/server-production/2.pack +0 -0
  54. package/web/.next/cache/webpack/server-production/20.pack +0 -0
  55. package/web/.next/cache/webpack/server-production/3.pack +0 -0
  56. package/web/.next/cache/webpack/server-production/4.pack +0 -0
  57. package/web/.next/cache/webpack/server-production/5.pack +0 -0
  58. package/web/.next/cache/webpack/server-production/6.pack +0 -0
  59. package/web/.next/cache/webpack/server-production/7.pack +0 -0
  60. package/web/.next/cache/webpack/server-production/8.pack +0 -0
  61. package/web/.next/cache/webpack/server-production/9.pack +0 -0
  62. package/web/.next/cache/webpack/server-production/index.pack +0 -0
  63. package/web/.next/cache/webpack/server-production/index.pack.old +0 -0
  64. package/web/.next/diagnostics/build-diagnostics.json +6 -0
  65. package/web/.next/diagnostics/framework.json +1 -0
  66. package/web/.next/dynamic-css-manifest.json +1 -0
  67. package/web/.next/export-marker.json +6 -0
  68. package/web/.next/images-manifest.json +58 -0
  69. package/web/.next/next-minimal-server.js.nft.json +1 -0
  70. package/web/.next/next-server.js.nft.json +1 -0
  71. package/web/.next/package.json +1 -0
  72. package/web/.next/prerender-manifest.json +11 -0
  73. package/web/.next/react-loadable-manifest.json +14 -0
  74. package/web/.next/required-server-files.json +343 -0
  75. package/web/.next/routes-manifest.json +79 -0
  76. package/web/.next/server/chunks/276.js +19 -0
  77. package/web/.next/server/chunks/508.js +1 -0
  78. package/web/.next/server/chunks/891.js +6 -0
  79. package/web/.next/server/dynamic-css-manifest.js +1 -0
  80. package/web/.next/server/functions-config-manifest.json +4 -0
  81. package/web/.next/server/interception-route-rewrite-manifest.js +1 -0
  82. package/web/.next/server/middleware-build-manifest.js +1 -0
  83. package/web/.next/server/middleware-manifest.json +6 -0
  84. package/web/.next/server/middleware-react-loadable-manifest.js +1 -0
  85. package/web/.next/server/next-font-manifest.js +1 -0
  86. package/web/.next/server/next-font-manifest.json +1 -0
  87. package/web/.next/server/pages/404.html +1 -0
  88. package/web/.next/server/pages/500.html +1 -0
  89. package/web/.next/server/pages/_app.js +1 -0
  90. package/web/.next/server/pages/_app.js.nft.json +1 -0
  91. package/web/.next/server/pages/_document.js +1 -0
  92. package/web/.next/server/pages/_document.js.nft.json +1 -0
  93. package/web/.next/server/pages/_error.js +1 -0
  94. package/web/.next/server/pages/_error.js.nft.json +1 -0
  95. package/web/.next/server/pages/dashboard.html +1 -0
  96. package/web/.next/server/pages/dashboard.js.nft.json +1 -0
  97. package/web/.next/server/pages/index.html +1 -0
  98. package/web/.next/server/pages/index.js.nft.json +1 -0
  99. package/web/.next/server/pages-manifest.json +8 -0
  100. package/web/.next/server/webpack-runtime.js +1 -0
  101. package/web/.next/static/FqMH7OdKFqTxzPemOh9_6/_buildManifest.js +1 -0
  102. package/web/.next/static/FqMH7OdKFqTxzPemOh9_6/_ssgManifest.js +1 -0
  103. package/web/.next/static/chunks/112-1bb8aeaa7c3fd57f.js +1 -0
  104. package/web/.next/static/chunks/131.2b0db2ec21a47401.js +1 -0
  105. package/web/.next/static/chunks/1d0474cf-ced9eb4c00bbcd99.js +1 -0
  106. package/web/.next/static/chunks/750.caaf5a9ddd46b267.js +1 -0
  107. package/web/.next/static/chunks/framework-9ad035430eed8b2b.js +1 -0
  108. package/web/.next/static/chunks/main-a5ca0156a62da1bd.js +1 -0
  109. package/web/.next/static/chunks/pages/_app-37894446f6ae5afe.js +1 -0
  110. package/web/.next/static/chunks/pages/_error-8e5b843ec9d413fc.js +1 -0
  111. package/web/.next/static/chunks/pages/dashboard-ce0d55d3fea9e308.js +1 -0
  112. package/web/.next/static/chunks/pages/index-8d94234d8de13682.js +1 -0
  113. package/web/.next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
  114. package/web/.next/static/chunks/webpack-ea849f90a4c65253.js +1 -0
  115. package/web/.next/static/css/de4e0852dfebd52f.css +3 -0
  116. package/web/.next/trace +2 -0
  117. package/web/.next/types/routes.d.ts +62 -0
  118. package/web/.next/types/validator.ts +16 -0
  119. package/web/components/AppHead.js +0 -14
  120. package/web/components/AuthCard.js +0 -170
  121. package/web/components/BrandLogo.js +0 -11
  122. package/web/components/ChatWindow.js +0 -875
  123. package/web/components/ChatWindow.js.tmp +0 -0
  124. package/web/components/ContactList.js +0 -97
  125. package/web/components/ContactsPanel.js +0 -90
  126. package/web/components/EmojiPicker.js +0 -108
  127. package/web/components/MediaPreviewModal.js +0 -146
  128. package/web/components/MessageActionMenu.js +0 -155
  129. package/web/components/SessionSidebar.js +0 -167
  130. package/web/components/SettingsModal.js +0 -266
  131. package/web/components/Skeletons.js +0 -73
  132. package/web/jsconfig.json +0 -10
  133. package/web/lib/api.js +0 -33
  134. package/web/lib/socket.js +0 -9
  135. package/web/pages/_app.js +0 -5
  136. package/web/pages/dashboard.js +0 -541
  137. package/web/pages/index.js +0 -62
  138. package/web/postcss.config.js +0 -10
  139. package/web/store/useAppStore.js +0 -209
  140. package/web/styles/globals.css +0 -52
  141. package/web/tailwind.config.js +0 -36
@@ -1,209 +0,0 @@
1
- import { create } from "zustand";
2
-
3
- function readToken() {
4
- if (typeof window === "undefined") {
5
- return null;
6
- }
7
-
8
- return window.localStorage.getItem("openwa-token");
9
- }
10
-
11
- function writeToken(token) {
12
- if (typeof window === "undefined") {
13
- return;
14
- }
15
-
16
- if (token) {
17
- window.localStorage.setItem("openwa-token", token);
18
- return;
19
- }
20
-
21
- window.localStorage.removeItem("openwa-token");
22
- }
23
-
24
- function recentChatTimestamp(chat) {
25
- return chat?.contact?.lastMessageAt || chat?.lastMessage?.createdAt || null;
26
- }
27
-
28
- function sortChats(chats) {
29
- return [...chats].sort((left, right) => {
30
- const leftRecent = recentChatTimestamp(left);
31
- const rightRecent = recentChatTimestamp(right);
32
-
33
- if (leftRecent && rightRecent) {
34
- return new Date(rightRecent) - new Date(leftRecent);
35
- }
36
-
37
- if (rightRecent) {
38
- return 1;
39
- }
40
-
41
- if (leftRecent) {
42
- return -1;
43
- }
44
-
45
- return new Date(right.updatedAt) - new Date(left.updatedAt);
46
- });
47
- }
48
-
49
- export const useAppStore = create((set, get) => ({
50
- token: null,
51
- user: null,
52
- sessions: [],
53
- chats: [],
54
- activeChatId: null,
55
- activeSessionId: null,
56
- messagesByChat: {},
57
- messageMetaByChat: {},
58
- typingByChat: {},
59
- socket: null,
60
- hydrateAuth: () => {
61
- set({ token: readToken() });
62
- },
63
- setAuth: ({ token, user }) => {
64
- writeToken(token);
65
- set({ token, user });
66
- },
67
- logout: () => {
68
- writeToken(null);
69
- get().socket?.close();
70
- set({
71
- token: null,
72
- user: null,
73
- sessions: [],
74
- chats: [],
75
- activeChatId: null,
76
- activeSessionId: null,
77
- messagesByChat: {},
78
- messageMetaByChat: {},
79
- typingByChat: {},
80
- socket: null
81
- });
82
- },
83
- setBootstrapData: (payload) => {
84
- const sortedChats = sortChats(payload.chats || []);
85
- set((state) => ({
86
- user: payload.user,
87
- sessions: payload.sessions || [],
88
- chats: sortedChats,
89
- activeChatId: payload.activeChatId || sortedChats[0]?.id || null,
90
- activeSessionId: state.activeSessionId || null,
91
- messagesByChat: payload.activeChatId
92
- ? {
93
- ...state.messagesByChat,
94
- [payload.activeChatId]: payload.messages || []
95
- }
96
- : state.messagesByChat,
97
- messageMetaByChat: payload.activeChatId
98
- ? {
99
- ...state.messageMetaByChat,
100
- [payload.activeChatId]: {
101
- hasMore: Boolean(payload.hasMoreMessages),
102
- nextBefore: payload.nextBefore || null
103
- }
104
- }
105
- : state.messageMetaByChat
106
- }));
107
- },
108
- setMessages: (chatId, messages, meta = null) => {
109
- set((state) => ({
110
- messagesByChat: {
111
- ...state.messagesByChat,
112
- [chatId]: messages
113
- },
114
- messageMetaByChat: meta
115
- ? {
116
- ...state.messageMetaByChat,
117
- [chatId]: meta
118
- }
119
- : state.messageMetaByChat
120
- }));
121
- },
122
- prependMessages: (chatId, messages, meta) => {
123
- set((state) => ({
124
- messagesByChat: {
125
- ...state.messagesByChat,
126
- [chatId]: [...messages, ...(state.messagesByChat[chatId] || [])]
127
- },
128
- messageMetaByChat: {
129
- ...state.messageMetaByChat,
130
- [chatId]: meta
131
- }
132
- }));
133
- },
134
- setActiveChat: (chatId) => set({ activeChatId: chatId }),
135
- setActiveSession: (sessionId) => set({ activeSessionId: sessionId }),
136
- upsertSession: (session) => {
137
- set((state) => {
138
- const normalizedSession = {
139
- ...session,
140
- id: session.id || session.sessionId
141
- };
142
- const sessions = state.sessions.some((item) => item.id === normalizedSession.id)
143
- ? state.sessions.map((item) => (item.id === normalizedSession.id ? { ...item, ...normalizedSession } : item))
144
- : [normalizedSession, ...state.sessions];
145
-
146
- return {
147
- sessions,
148
- activeSessionId: state.activeSessionId || normalizedSession.id || null
149
- };
150
- });
151
- },
152
- upsertChat: (chat) => {
153
- set((state) => {
154
- const chats = state.chats.some((item) => item.id === chat.id)
155
- ? state.chats.map((item) => (item.id === chat.id ? { ...item, ...chat } : item))
156
- : [chat, ...state.chats];
157
-
158
- return {
159
- chats: sortChats(chats)
160
- };
161
- });
162
- },
163
- addMessage: (message) => {
164
- set((state) => ({
165
- messagesByChat: {
166
- ...state.messagesByChat,
167
- [message.chatId]: [...(state.messagesByChat[message.chatId] || []), message]
168
- }
169
- }));
170
- },
171
- updateMessageStatus: ({ messageId, status }) => {
172
- set((state) => {
173
- const nextMessagesByChat = Object.fromEntries(
174
- Object.entries(state.messagesByChat).map(([chatId, messages]) => [
175
- chatId,
176
- messages.map((message) =>
177
- message.id === messageId
178
- ? {
179
- ...message,
180
- statuses: [...(message.statuses || []), { status, createdAt: new Date().toISOString() }]
181
- }
182
- : message
183
- )
184
- ])
185
- );
186
-
187
- return { messagesByChat: nextMessagesByChat };
188
- });
189
- },
190
- updateMessage: (message) => {
191
- set((state) => ({
192
- messagesByChat: Object.fromEntries(
193
- Object.entries(state.messagesByChat).map(([chatId, messages]) => [
194
- chatId,
195
- messages.map((item) => (item.id === message.id ? { ...item, ...message } : item))
196
- ])
197
- )
198
- }));
199
- },
200
- setTyping: ({ chatId, isTyping, name, userId }) => {
201
- set((state) => ({
202
- typingByChat: {
203
- ...state.typingByChat,
204
- [chatId]: { isTyping, name, userId }
205
- }
206
- }));
207
- },
208
- setSocket: (socket) => set({ socket })
209
- }));
@@ -1,52 +0,0 @@
1
- @tailwind base;
2
- @tailwind components;
3
- @tailwind utilities;
4
-
5
- html,
6
- body,
7
- #__next {
8
- min-height: 100%;
9
- }
10
-
11
- body {
12
- margin: 0;
13
- font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
14
- background: #111b21;
15
- color: #ffffff;
16
- -webkit-font-smoothing: antialiased;
17
- -moz-osx-font-smoothing: grayscale;
18
- }
19
-
20
- * {
21
- box-sizing: border-box;
22
- }
23
-
24
- button,
25
- input,
26
- textarea {
27
- font: inherit;
28
- }
29
-
30
- textarea {
31
- resize: vertical;
32
- }
33
-
34
- input::placeholder,
35
- textarea::placeholder {
36
- color: inherit;
37
- opacity: 0.7;
38
- }
39
-
40
- ::-webkit-scrollbar {
41
- width: 8px;
42
- height: 8px;
43
- }
44
-
45
- ::-webkit-scrollbar-thumb {
46
- background: rgba(255, 255, 255, 0.12);
47
- border-radius: 999px;
48
- }
49
-
50
- ::-webkit-scrollbar-track {
51
- background: transparent;
52
- }
@@ -1,36 +0,0 @@
1
- const path = require("path");
2
-
3
- module.exports = {
4
- content: [
5
- path.join(__dirname, "pages/**/*.{js,jsx}"),
6
- path.join(__dirname, "components/**/*.{js,jsx}"),
7
- path.join(__dirname, "store/**/*.{js,jsx}"),
8
- path.join(__dirname, "lib/**/*.{js,jsx}")
9
- ],
10
- theme: {
11
- extend: {
12
- colors: {
13
- brand: {
14
- 50: "#edfdf7",
15
- 100: "#d2f8e9",
16
- 500: "#25d366",
17
- 600: "#1ea952",
18
- 700: "#167b3c"
19
- },
20
- ink: {
21
- 900: "#111b21",
22
- 800: "#202c33",
23
- 700: "#2a3942",
24
- 500: "#667781",
25
- 200: "#d1d7db",
26
- 100: "#e9edef",
27
- 50: "#f0f2f5"
28
- }
29
- },
30
- boxShadow: {
31
- panel: "0 1px 3px rgba(17, 27, 33, 0.08), 0 8px 24px rgba(17, 27, 33, 0.06)"
32
- }
33
- }
34
- },
35
- plugins: []
36
- };