@jetthai/cuora 1.0.111-3 → 1.0.112

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 CHANGED
@@ -2,11 +2,7 @@
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.0.111-3](https://github.com/jetthai/cuora-module/compare/v1.0.111-2...v1.0.111-3) (2022-04-29)
6
-
7
- ### [1.0.111-2](https://github.com/jetthai/cuora-module/compare/v1.0.111-1...v1.0.111-2) (2022-04-28)
8
-
9
- ### [1.0.111-1](https://github.com/jetthai/cuora-module/compare/v1.0.111...v1.0.111-1) (2022-04-27)
5
+ ### [1.0.112](https://github.com/jetthai/cuora-module/compare/v1.0.111...v1.0.112) (2022-04-25)
10
6
 
11
7
  ### [1.0.111](https://github.com/jetthai/cuora-module/compare/v1.0.110...v1.0.111) (2022-04-20)
12
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.111-3",
3
+ "version": "1.0.112",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
package/src/api/auth.js CHANGED
@@ -1,7 +1,8 @@
1
1
  export default {
2
- guestLogin: () => ({
2
+ guestLogin: ({ dt }) => ({
3
3
  url: 'guestLogin',
4
4
  method: 'post',
5
+ params: { dt },
5
6
  isPublic: true,
6
7
  }),
7
8
  login: ({ username, password, provider, countryCode, phone, email, dt }) => ({
@@ -264,7 +264,7 @@ export default function (request) {
264
264
  }),
265
265
  redirectTo3Party: async (context, event) => {
266
266
  const { provider, channel, subchannel } = event.data
267
- const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL })
267
+ // const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL })
268
268
  const redirectURL = urljoin(
269
269
  request.config.fullURL,
270
270
  'login?' +
@@ -273,14 +273,13 @@ export default function (request) {
273
273
  redirectURI: `${window.location.protocol}//${window.location.host}`,
274
274
  channel: cookies.get('channel') || channel || 'official',
275
275
  subchannel: cookies.get('subchannel') || subchannel || 'pwa',
276
- dt,
276
+ // dt,
277
277
  platform: 'pwa',
278
278
  })
279
279
  )
280
280
  window.location.href = redirectURL
281
281
  },
282
282
  setUserInfo: assign((context, event) => {
283
- sentry.setUser({ id: event.data.uid_site })
284
283
  return {
285
284
  userInfo: event.data,
286
285
  }
@@ -32,8 +32,10 @@ export default function (request) {
32
32
  broadcastList: null,
33
33
  mailBoxInfo: null,
34
34
  promotions: [],
35
- currentBroadcast: null,
36
- sentBroadcastList: [],
35
+ emergencyBroadcast: null,
36
+ normalBroadcast: null,
37
+ sentEmergencyBroadcastList: [],
38
+ sentNormalBroadcastList: []
37
39
  },
38
40
  states: {
39
41
  config: {
@@ -166,20 +168,34 @@ export default function (request) {
166
168
  return { announcementList, broadcastList, mailBoxInfo, promotions }
167
169
  }),
168
170
  setBroadcast: assign((context, event) => {
169
- const { broadcastList, sentBroadcastList, currentBroadcast } = context
170
- let sentList = sentBroadcastList
171
- if (currentBroadcast) {
172
- sentList = [...sentBroadcastList, currentBroadcast]
171
+ const { broadcastList, sentEmergencyBroadcastList, emergencyBroadcast, sentNormalBroadcastList, normalBroadcast } = context
172
+ let sentEmergencyList = sentEmergencyBroadcastList
173
+ let sentNormalList = sentNormalBroadcastList
174
+ if (emergencyBroadcast) {
175
+ sentEmergencyList = [...sentEmergencyBroadcastList, emergencyBroadcast]
173
176
  }
174
- const nextBroadcast = broadcastList?.broadcasts?.find((broadcast) => {
175
- return broadcast.type === '1' && !sentList.some((item) => item.broadcast_id === broadcast.broadcast_id)
177
+ if (normalBroadcast) {
178
+ sentNormalList = [...sentNormalBroadcastList, normalBroadcast]
179
+ }
180
+ const nextEmergencyBroadcast = broadcastList?.broadcasts?.find((broadcast) => {
181
+ return broadcast.type === '1' && !sentEmergencyList.some((item) => item.broadcast_id === broadcast.broadcast_id)
182
+ })
183
+ const nextNormalBroadcast = broadcastList?.broadcasts?.find((broadcast) => {
184
+ return broadcast.type === '0' && !sentNormalList.some((item) => item.broadcast_id === broadcast.broadcast_id)
176
185
  })
177
- return { currentBroadcast: nextBroadcast, sentBroadcastList: sentList }
186
+ return {
187
+ emergencyBroadcast: nextEmergencyBroadcast,
188
+ sentEmergencyBroadcastList: sentEmergencyList,
189
+ normalBroadcast: nextNormalBroadcast,
190
+ sentNormalBroadcastList: sentNormalList
191
+ }
178
192
  }),
179
193
  resetBroadcast: assign((context, event) => {
180
194
  return {
181
- currentBroadcast: null,
182
- sentBroadcastList: [],
195
+ emergencyBroadcast: null,
196
+ sentEmergencyBroadcastList: [],
197
+ normalBroadcast: null,
198
+ sentNormalBroadcastList: []
183
199
  }
184
200
  }),
185
201
  },