@jetthai/cuora 1.1.149 → 1.1.151
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 +4 -0
- package/package.json +1 -1
- package/src/api/common.js +1 -1
- package/src/machine/common.js +31 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.151](https://github.com/jetthai/cuora-module/compare/v1.1.150...v1.1.151) (2023-07-31)
|
|
6
|
+
|
|
7
|
+
### [1.1.150](https://github.com/jetthai/cuora-module/compare/v1.1.149...v1.1.150) (2023-07-31)
|
|
8
|
+
|
|
5
9
|
### [1.1.149](https://github.com/jetthai/cuora-module/compare/v1.1.148...v1.1.149) (2023-07-31)
|
|
6
10
|
|
|
7
11
|
### [1.1.148](https://github.com/jetthai/cuora-module/compare/v1.1.143-1...v1.1.148) (2023-07-25)
|
package/package.json
CHANGED
package/src/api/common.js
CHANGED
|
@@ -2,5 +2,5 @@ export default {
|
|
|
2
2
|
getConfig: ({ appSecret }) => ({ url: 'getConfig', method: 'get', params: { appSecret }, isPublic: true }),
|
|
3
3
|
feeds: ({ appSecret }) => ({ url: 'feeds', method: 'get', params: { appSecret }, isPublic: true }),
|
|
4
4
|
broadcast: () => ({ url: 'broadcast', method: 'get', isPublic: true }),
|
|
5
|
-
getAnnouncements: () => ({ url: 'getAnnouncements', method: 'get', isPublic: true }),
|
|
5
|
+
getAnnouncements: ({ appSecret }) => ({ url: 'getAnnouncements', params: { appSecret }, method: 'get', isPublic: true }),
|
|
6
6
|
}
|
package/src/machine/common.js
CHANGED
|
@@ -94,6 +94,30 @@ export default function (request) {
|
|
|
94
94
|
},
|
|
95
95
|
},
|
|
96
96
|
},
|
|
97
|
+
getAnnouncements: {
|
|
98
|
+
initial: 'updating',
|
|
99
|
+
states: {
|
|
100
|
+
updating: {
|
|
101
|
+
invoke: {
|
|
102
|
+
src: 'fetchAnnouncements',
|
|
103
|
+
onDone: {
|
|
104
|
+
target: 'idle',
|
|
105
|
+
actions: 'setAnnouncements',
|
|
106
|
+
},
|
|
107
|
+
onError: {
|
|
108
|
+
target: 'idle',
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
idle: {
|
|
113
|
+
on: {
|
|
114
|
+
FETCH_ANNOUNCEMENTS: {
|
|
115
|
+
target: 'updating',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
97
121
|
broadcast: {
|
|
98
122
|
initial: 'idle',
|
|
99
123
|
states: {
|
|
@@ -199,6 +223,10 @@ export default function (request) {
|
|
|
199
223
|
}
|
|
200
224
|
}
|
|
201
225
|
}),
|
|
226
|
+
setAnnouncements: assign((context, event) => {
|
|
227
|
+
const { data } = event.data
|
|
228
|
+
return { announcementList: data }
|
|
229
|
+
}),
|
|
202
230
|
setFeeds: assign((context, event) => {
|
|
203
231
|
const { announcementList, broadcastList, mailBoxInfo } = event.data
|
|
204
232
|
const promotions = announcementList?.announcements?.filter?.((item) => item.category === 3) || []
|
|
@@ -244,6 +272,9 @@ export default function (request) {
|
|
|
244
272
|
fetchFeeds: async (context, event) => {
|
|
245
273
|
return await request.send(api.feeds({ appSecret }))
|
|
246
274
|
},
|
|
275
|
+
fetchAnnouncements: async (context, event) => {
|
|
276
|
+
return await request.send(api.getAnnouncements({ appSecret }))
|
|
277
|
+
},
|
|
247
278
|
},
|
|
248
279
|
}
|
|
249
280
|
)
|