@jetthai/cuora 1.1.472 → 1.1.473

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,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.473](https://github.com/jetthai/cuora-module/compare/v1.1.472...v1.1.473) (2026-10-05)
6
+
5
7
  ### [1.1.472](https://github.com/jetthai/cuora-module/compare/v1.1.471...v1.1.472) (2026-09-24)
6
8
 
7
9
  ### [1.1.471](https://github.com/jetthai/cuora-module/compare/v1.1.470...v1.1.471) (2026-09-23)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.472",
3
+ "version": "1.1.473",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -24,10 +24,11 @@ export default {
24
24
  params: { activityNo, appSecret },
25
25
  isPublic: true,
26
26
  }),
27
- getActivityDetail: ({ activityNo, appSecret }) => ({
27
+ getActivityDetail: ({ activityNo, appSecret, silent = false }) => ({
28
28
  url: 'activities',
29
29
  method: 'get',
30
30
  params: { activityNo, appSecret },
31
+ silent,
31
32
  }),
32
33
  getActivityRanking: ({ appSecret }) => ({
33
34
  url: 'activities/activity/ranking',
@@ -18,6 +18,7 @@ export default function (request) {
18
18
  detailNeededActivityTypes: [4, 29, 34],
19
19
  activityDetailList: [],
20
20
  isPlaying: false,
21
+ listAuthKey: null,
21
22
  },
22
23
  states: {
23
24
  fetchingList: {
@@ -25,7 +26,7 @@ export default function (request) {
25
26
  src: 'fetchList',
26
27
  onDone: {
27
28
  target: 'checking',
28
- actions: ['setActivityList', 'setTournamentList', 'setPromotionList', 'setProgressSummary'],
29
+ actions: ['setActivityList', 'setTournamentList', 'setPromotionList', 'setProgressSummary', 'setListAuthKey'],
29
30
  },
30
31
  onError: {
31
32
  target: 'pending',
@@ -58,16 +59,18 @@ export default function (request) {
58
59
  SET_UNREAD: {
59
60
  actions: 'setUnread',
60
61
  },
61
- REFRESH: {
62
- target: '#activity.fetchingList',
63
- actions: 'leaveGame',
64
- },
65
62
  RESET_ACTIVITIES: {
66
63
  actions: 'resetActivities',
67
64
  },
68
65
  },
69
66
  },
70
67
  },
68
+ on: {
69
+ REFRESH: {
70
+ target: '#activity.fetchingList',
71
+ actions: 'leaveGame',
72
+ },
73
+ },
71
74
  },
72
75
  {
73
76
  actions: {
@@ -125,10 +128,21 @@ export default function (request) {
125
128
  }
126
129
  }),
127
130
  setActivityDetailList: assign((context, event) => {
131
+ if (!event.data) return {}
128
132
  return {
129
133
  activityDetailList: event.data.map((item) => item.data),
130
134
  }
131
135
  }),
136
+ setListAuthKey: assign((context, event) => {
137
+ const listAuthKey = event.data.authKey || null
138
+ // 身分變回訪客時一併清空明細(例如登出後的 REFRESH):
139
+ // guard 會讓訪客身分直接跳過 fetchingDetailList,若不在這裡清空,
140
+ // activityDetailList 會殘留登出前的會員資料,導致輪盤/紅包雨顯示錯誤身分的結果。
141
+ return {
142
+ listAuthKey,
143
+ ...(listAuthKey ? {} : { activityDetailList: [] }),
144
+ }
145
+ }),
132
146
  resetActivities: assign((context, event) => {
133
147
  return {
134
148
  isPlaying: true,
@@ -142,7 +156,8 @@ export default function (request) {
142
156
  },
143
157
  guards: {
144
158
  needFetchingDetail: (context, event) => {
145
- const { activityList = [], detailNeededActivityTypes } = context
159
+ const { activityList = [], detailNeededActivityTypes, listAuthKey } = context
160
+ if (!listAuthKey) return false
146
161
  return activityList.filter((activity) => detailNeededActivityTypes.includes(activity.activityType)).length > 0
147
162
  },
148
163
  isInGame: (context, event) => {
@@ -160,7 +175,8 @@ export default function (request) {
160
175
  },
161
176
  services: {
162
177
  fetchList: async (context, event) => {
163
- const hasToken = request.getToken()
178
+ const authKey = request.getToken() || null
179
+ const hasToken = !!authKey
164
180
  const siteConfig = window?.$nuxt?.$store?.state?.siteConfig
165
181
  const isProgressEnable = siteConfig?.frontendActivityProgressEnable
166
182
 
@@ -174,21 +190,23 @@ export default function (request) {
174
190
  activityList: data,
175
191
  promotionList,
176
192
  progressSummary: progressSummaryRes?.data || null,
193
+ authKey,
177
194
  }
178
195
  },
179
196
  fetchActivityDetailList: async (context, event) => {
197
+ const { listAuthKey } = context
180
198
  await new Promise((resolve) => setTimeout(resolve, 1000)) // delay 1 second
181
- const hasToken = request.getToken()
199
+
200
+ // 抓清單時是訪客,或這 1 秒內身分換過(?x= 登入落地)→ 不發,等 REFRESH 用正確身分重抓
201
+ if (!listAuthKey || request.getToken() !== listAuthKey) return null
182
202
 
183
203
  const { activityList = [], detailNeededActivityTypes } = context
184
204
  const filteredActivityList = activityList.filter((activity) => detailNeededActivityTypes.includes(activity.activityType))
185
- return hasToken
186
- ? await Promise.all(
187
- filteredActivityList.map((item) => {
188
- return request.send(activity.getActivityDetail({ activityNo: item.activityNo, appSecret }))
189
- })
190
- )
191
- : []
205
+ return await Promise.all(
206
+ filteredActivityList.map((item) => {
207
+ return request.send(activity.getActivityDetail({ activityNo: item.activityNo, appSecret, silent: true }))
208
+ })
209
+ )
192
210
  },
193
211
  },
194
212
  }
@@ -277,7 +277,7 @@ export default class Request {
277
277
  throw error
278
278
  }
279
279
  if (error.code !== 'ERR_800') {
280
- if (error.code) {
280
+ if (error.code && !req.silent) {
281
281
  this.errorHandler && this.errorHandler(error)
282
282
  }
283
283
  throw error