@jetthai/cuora 1.1.470-dev.2 → 1.1.471-dev.0

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.
@@ -192,7 +192,7 @@ Token 5min TTL → fetchUserInfo success → extendToken resets TTL → poll aga
192
192
 
193
193
  **OTP flow**: after a successful login it enters `otpChecking`, and only proceeds to `loginSuccess` after an `OTP_VERIFIED` or `OTP_SKIP` event.
194
194
 
195
- **Account persistence**: the most recently used login account is stored in localStorage (31-day TTL) for form auto-fill. **Token expiration does not affect the account record.**
195
+ **Account persistence**: the most recently used login account is stored in localStorage (31-day TTL) for form auto-fill. **Token expiration does not affect the account record.** However, `pruneRememberedAccounts`, which runs after `fetchSiteConfig` succeeds, **compares against `siteConfig.loginMethods` and clears the leftover account for any disabled login method** (`phone` clears the country code along with it) — fetching configuration, an apparently read-only action, carries the side effect of deleting from localStorage. The purpose is to prevent downstream frontends from back-filling a stale value into an input whose type has since changed after the backend disables a login method. When `loginMethods` is missing entirely, nothing is cleared, to avoid wiping everything by mistake.
196
196
 
197
197
  ### 2.2 Canonical Deposit Pattern
198
198
 
package/AGENTS.md CHANGED
@@ -192,7 +192,7 @@ Token 5min TTL → fetchUserInfo success → extendToken resets TTL → poll aga
192
192
 
193
193
  **OTP flow**: after a successful login it enters `otpChecking`, and only proceeds to `loginSuccess` after an `OTP_VERIFIED` or `OTP_SKIP` event.
194
194
 
195
- **Account persistence**: the most recently used login account is stored in localStorage (31-day TTL) for form auto-fill. **Token expiration does not affect the account record.**
195
+ **Account persistence**: the most recently used login account is stored in localStorage (31-day TTL) for form auto-fill. **Token expiration does not affect the account record.** However, `pruneRememberedAccounts`, which runs after `fetchSiteConfig` succeeds, **compares against `siteConfig.loginMethods` and clears the leftover account for any disabled login method** (`phone` clears the country code along with it) — fetching configuration, an apparently read-only action, carries the side effect of deleting from localStorage. The purpose is to prevent downstream frontends from back-filling a stale value into an input whose type has since changed after the backend disables a login method. When `loginMethods` is missing entirely, nothing is cleared, to avoid wiping everything by mistake.
196
196
 
197
197
  ### 2.2 Canonical Deposit Pattern
198
198
 
@@ -190,7 +190,7 @@ Token 5min TTL → fetchUserInfo 成功 → extendToken 重設 TTL → 再次輪
190
190
 
191
191
  **OTP 流程**:登入成功後進入 `otpChecking`,等待 `OTP_VERIFIED` 或 `OTP_SKIP` 事件才進入 `loginSuccess`。
192
192
 
193
- **帳號持久化**:最後使用的登入帳號存 localStorage(31 天 TTL)供表單自動填入。**Token 過期不影響帳號記錄。**
193
+ **帳號持久化**:最後使用的登入帳號存 localStorage(31 天 TTL)供表單自動填入。**Token 過期不影響帳號記錄。**但 `fetchSiteConfig` 成功後的 `pruneRememberedAccounts` 會**比對 `siteConfig.loginMethods` 清掉已停用登入方式的殘留帳號**(`phone` 連同國碼一起刪)——拉設定這個看似唯讀的動作帶有刪 localStorage 的副作用,目的是避免後台關掉某種登入方式後,下游把舊值回填進已改型別的輸入框。`loginMethods` 整包缺失時不清除,以免誤刪全部。
194
194
 
195
195
  ### 2.2 存款流程模式(Canonical Deposit Pattern)
196
196
 
package/CHANGELOG.md CHANGED
@@ -2,11 +2,16 @@
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.471-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.470-dev.2...v1.1.471-dev.0) (2026-09-23)
6
+
7
+ ### [1.1.470](https://github.com/jetthai/cuora-module/compare/v1.1.469...v1.1.470) (2026-09-14)
8
+
9
+ ### [1.1.469](https://github.com/jetthai/cuora-module/compare/v1.1.468...v1.1.469) (2026-09-13)
10
+
5
11
  ### [1.1.470-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.470-dev.1...v1.1.470-dev.2) (2026-09-17)
6
12
 
7
13
  ### [1.1.470-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.470-dev.0...v1.1.470-dev.1) (2026-09-17)
8
14
 
9
-
10
15
  ### Features
11
16
 
12
17
  * **payment:** 恢復 setBonusSetting API ([ba1118d](https://github.com/jetthai/cuora-module/commit/ba1118dabbdd6ae5ca2b68ddf281c8dd6d67a59d))
package/CLAUDE.md CHANGED
@@ -192,7 +192,7 @@ Token 5min TTL → fetchUserInfo success → extendToken resets TTL → poll aga
192
192
 
193
193
  **OTP flow**: after a successful login it enters `otpChecking`, and only proceeds to `loginSuccess` after an `OTP_VERIFIED` or `OTP_SKIP` event.
194
194
 
195
- **Account persistence**: the most recently used login account is stored in localStorage (31-day TTL) for form auto-fill. **Token expiration does not affect the account record.**
195
+ **Account persistence**: the most recently used login account is stored in localStorage (31-day TTL) for form auto-fill. **Token expiration does not affect the account record.** However, `pruneRememberedAccounts`, which runs after `fetchSiteConfig` succeeds, **compares against `siteConfig.loginMethods` and clears the leftover account for any disabled login method** (`phone` clears the country code along with it) — fetching configuration, an apparently read-only action, carries the side effect of deleting from localStorage. The purpose is to prevent downstream frontends from back-filling a stale value into an input whose type has since changed after the backend disables a login method. When `loginMethods` is missing entirely, nothing is cleared, to avoid wiping everything by mistake.
196
196
 
197
197
  ### 2.2 Canonical Deposit Pattern
198
198
 
package/GEMINI.md CHANGED
@@ -192,7 +192,7 @@ Token 5min TTL → fetchUserInfo success → extendToken resets TTL → poll aga
192
192
 
193
193
  **OTP flow**: after a successful login it enters `otpChecking`, and only proceeds to `loginSuccess` after an `OTP_VERIFIED` or `OTP_SKIP` event.
194
194
 
195
- **Account persistence**: the most recently used login account is stored in localStorage (31-day TTL) for form auto-fill. **Token expiration does not affect the account record.**
195
+ **Account persistence**: the most recently used login account is stored in localStorage (31-day TTL) for form auto-fill. **Token expiration does not affect the account record.** However, `pruneRememberedAccounts`, which runs after `fetchSiteConfig` succeeds, **compares against `siteConfig.loginMethods` and clears the leftover account for any disabled login method** (`phone` clears the country code along with it) — fetching configuration, an apparently read-only action, carries the side effect of deleting from localStorage. The purpose is to prevent downstream frontends from back-filling a stale value into an input whose type has since changed after the backend disables a login method. When `loginMethods` is missing entirely, nothing is cleared, to avoid wiping everything by mistake.
196
196
 
197
197
  ### 2.2 Canonical Deposit Pattern
198
198
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.470-dev.2",
3
+ "version": "1.1.471-dev.0",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -18,10 +18,11 @@ export default {
18
18
  params: { appSecret },
19
19
  isPublic: true,
20
20
  }),
21
- getActivityDetail: ({ activityNo, appSecret }) => ({
21
+ getActivityDetail: ({ activityNo, appSecret, silent = false }) => ({
22
22
  url: 'activities',
23
23
  method: 'get',
24
24
  params: { activityNo, appSecret },
25
+ silent,
25
26
  }),
26
27
  postPromoCode: (promoCode) => ({
27
28
  url: 'activities/promo',
@@ -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'],
29
+ actions: ['setActivityList', 'setTournamentList', 'setPromotionList', '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: {
@@ -98,7 +101,7 @@ export default function (request) {
98
101
  }
99
102
  }),
100
103
  setProgressSummary: assign((context, event) => {
101
- const { progressSummary } = event.data
104
+ const { progressSummary } = event.data || {}
102
105
  return {
103
106
  progressSummary: progressSummary || null,
104
107
  }
@@ -125,11 +128,22 @@ export default function (request) {
125
128
  }
126
129
  }),
127
130
  setActivityDetailList: assign((context, event) => {
131
+ if (!event.data) return {}
128
132
  const { activityDetailList } = event.data
129
133
  return {
130
134
  activityDetailList: activityDetailList.map((item) => item.data),
131
135
  }
132
136
  }),
137
+ setListAuthKey: assign((context, event) => {
138
+ const listAuthKey = event.data.authKey || null
139
+ // 身分變回訪客時一併清空明細(例如登出後的 REFRESH):
140
+ // guard 會讓訪客身分直接跳過 fetchingDetailList,若不在這裡清空,
141
+ // activityDetailList 會殘留登出前的會員資料,導致輪盤/紅包雨顯示錯誤身分的結果。
142
+ return {
143
+ listAuthKey,
144
+ ...(listAuthKey ? {} : { activityDetailList: [] }),
145
+ }
146
+ }),
133
147
  resetActivities: assign((context, event) => {
134
148
  return {
135
149
  isPlaying: true,
@@ -143,7 +157,8 @@ export default function (request) {
143
157
  },
144
158
  guards: {
145
159
  needFetchingDetail: (context, event) => {
146
- const { activityList = [], detailNeededActivityTypes } = context
160
+ const { activityList = [], detailNeededActivityTypes, listAuthKey } = context
161
+ if (!listAuthKey) return false
147
162
  return activityList.filter((activity) => detailNeededActivityTypes.includes(activity.activityType)).length > 0
148
163
  },
149
164
  isInGame: (context, event) => {
@@ -161,7 +176,8 @@ export default function (request) {
161
176
  },
162
177
  services: {
163
178
  fetchList: async (context, event) => {
164
- const hasToken = request.getToken()
179
+ const authKey = request.getToken() || null
180
+ const hasToken = !!authKey
165
181
 
166
182
  const [{ data }, promotionList] = await Promise.all([
167
183
  hasToken ? request.send(activity.getActivityList({ appSecret })) : request.send(activity.getAllActivityList({ appSecret })),
@@ -171,11 +187,16 @@ export default function (request) {
171
187
  return {
172
188
  activityList: data,
173
189
  promotionList,
190
+ authKey,
174
191
  }
175
192
  },
176
193
  fetchActivityDetailList: async (context, event) => {
194
+ const { listAuthKey } = context
177
195
  await new Promise((resolve) => setTimeout(resolve, 1000)) // delay 1 second
178
- const hasToken = request.getToken()
196
+
197
+ // 抓清單時是訪客,或這 1 秒內身分換過(?x= 登入落地)→ 不發,等 REFRESH 用正確身分重抓
198
+ if (!listAuthKey || request.getToken() !== listAuthKey) return null
199
+
179
200
  const siteConfig = window?.$nuxt?.$store?.state?.siteConfig
180
201
  const isProgressEnable = siteConfig?.frontendActivityProgressEnable
181
202
 
@@ -183,14 +204,12 @@ export default function (request) {
183
204
  const filteredActivityList = activityList.filter((activity) => detailNeededActivityTypes.includes(activity.activityType))
184
205
 
185
206
  const [activityDetailList, progressSummaryRes] = await Promise.all([
186
- hasToken
187
- ? Promise.all(
188
- filteredActivityList.map((item) => {
189
- return request.send(activity.getActivityDetail({ activityNo: item.activityNo, appSecret }))
190
- })
191
- )
192
- : Promise.resolve([]),
193
- hasToken && isProgressEnable ? request.send(activity.getProgressSummary({ appSecret })).catch(() => null) : Promise.resolve(null),
207
+ Promise.all(
208
+ filteredActivityList.map((item) => {
209
+ return request.send(activity.getActivityDetail({ activityNo: item.activityNo, appSecret, silent: true }))
210
+ })
211
+ ),
212
+ isProgressEnable ? request.send(activity.getProgressSummary({ appSecret })).catch(() => null) : Promise.resolve(null),
194
213
  ])
195
214
 
196
215
  return {
@@ -261,7 +261,7 @@ export default class Request {
261
261
  throw error
262
262
  }
263
263
  if (error.code !== 'ERR_800') {
264
- if (error.code) {
264
+ if (error.code && !req.silent) {
265
265
  this.errorHandler && this.errorHandler(error)
266
266
  }
267
267
  throw error