@jetthai/cuora 1.1.245 → 1.1.246
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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/src/machine/inbox.js +24 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.246](https://github.com/jetthai/cuora-module/compare/v1.1.245...v1.1.246) (2024-04-12)
|
|
6
|
+
|
|
5
7
|
### [1.1.245](https://github.com/jetthai/cuora-module/compare/v1.1.244...v1.1.245) (2024-04-11)
|
|
6
8
|
|
|
7
9
|
### [1.1.244](https://github.com/jetthai/cuora-module/compare/v1.1.243...v1.1.244) (2024-04-09)
|
package/package.json
CHANGED
package/src/machine/inbox.js
CHANGED
|
@@ -9,11 +9,11 @@ const messageState = {
|
|
|
9
9
|
initial: 'hidden',
|
|
10
10
|
states: {
|
|
11
11
|
hidden: {},
|
|
12
|
-
|
|
12
|
+
deleting: {
|
|
13
13
|
invoke: {
|
|
14
14
|
src: 'deleteMessages',
|
|
15
15
|
onDone: {
|
|
16
|
-
target: '
|
|
16
|
+
target: 'deleted',
|
|
17
17
|
actions: 'removeMessage',
|
|
18
18
|
},
|
|
19
19
|
onError: {
|
|
@@ -21,7 +21,9 @@ const messageState = {
|
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
|
-
|
|
24
|
+
deleted: {
|
|
25
|
+
entry: ['cancelSelectMessages', 'hideMessage'],
|
|
26
|
+
},
|
|
25
27
|
shown: {
|
|
26
28
|
on: {
|
|
27
29
|
HIDE_MESSAGE: {
|
|
@@ -56,7 +58,7 @@ const messageState = {
|
|
|
56
58
|
actions: ['selectMessages', 'setDelectMessages'],
|
|
57
59
|
},
|
|
58
60
|
DELETE_MESSAGES: {
|
|
59
|
-
target: '.
|
|
61
|
+
target: '.deleting',
|
|
60
62
|
},
|
|
61
63
|
},
|
|
62
64
|
},
|
|
@@ -235,6 +237,9 @@ export default function (request) {
|
|
|
235
237
|
target: '.sending',
|
|
236
238
|
cond: 'isSendable',
|
|
237
239
|
},
|
|
240
|
+
CANCEL_SELECT: {
|
|
241
|
+
actions: 'cancelSelectMessages',
|
|
242
|
+
},
|
|
238
243
|
CLEAR: {
|
|
239
244
|
actions: 'hideMessage',
|
|
240
245
|
},
|
|
@@ -287,7 +292,12 @@ export default function (request) {
|
|
|
287
292
|
setTabs: assign((context, event) => {
|
|
288
293
|
let { currentTab } = context
|
|
289
294
|
if (!currentTab) {
|
|
290
|
-
|
|
295
|
+
const customerTab = event.data?.find((tab) => tab === 'CUSTOMER')
|
|
296
|
+
if (!!customerTab) {
|
|
297
|
+
currentTab = 'CUSTOMER'
|
|
298
|
+
} else {
|
|
299
|
+
currentTab = event.data?.[0]
|
|
300
|
+
}
|
|
291
301
|
}
|
|
292
302
|
return {
|
|
293
303
|
tabs: event.data,
|
|
@@ -310,6 +320,15 @@ export default function (request) {
|
|
|
310
320
|
inbox[currentTab].data = data
|
|
311
321
|
return { inbox }
|
|
312
322
|
}),
|
|
323
|
+
cancelSelectMessages: assign((context, event) => {
|
|
324
|
+
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
325
|
+
const data = inbox[currentTab].data.map((item) => {
|
|
326
|
+
item.isSelected = false
|
|
327
|
+
return item
|
|
328
|
+
})
|
|
329
|
+
inbox[currentTab].data = data
|
|
330
|
+
return { inbox, selectedDeleteMessages: null }
|
|
331
|
+
}),
|
|
313
332
|
setDelectMessages: assign((context, event) => {
|
|
314
333
|
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
315
334
|
const selectedMessages = inbox[currentTab].data?.filter((item) => item.isSelected)
|