@jetthai/cuora 1.1.439-dev.1 → 1.1.439-dev.3

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,15 @@
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.439-dev.3](https://github.com/jetthai/cuora-module/compare/v1.1.439-dev.2...v1.1.439-dev.3) (2026-05-29)
6
+
7
+ ### [1.1.439-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.439-dev.1...v1.1.439-dev.2) (2026-05-27)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * **withdraw:** 現金站雙錢包出款閘門改用 truthy 比較 enableWithdraw ([833764d](https://github.com/jetthai/cuora-module/commit/833764da303bca6935d8af43fd4c446f7ba2e5c2))
13
+
5
14
  ### [1.1.439-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.439-dev.0...v1.1.439-dev.1) (2026-05-27)
6
15
 
7
16
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.439-dev.1",
3
+ "version": "1.1.439-dev.3",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -0,0 +1,85 @@
1
+ # JT-1776243420: Third-Party Register Carry Phone / Email Payload
2
+
3
+ ## Key Changes
4
+
5
+ 1. Extended third-party redirect payload assembly to read `tp_phone`, `tp_countryCode`, and `tp_email` from storage.
6
+ 2. Preserved existing affiliate code / nickname behavior and appended new fields only when values are valid.
7
+ 3. Cleans the temporary third-party storage keys after composing the redirect query.
8
+
9
+ ---
10
+
11
+ ## Key Findings
12
+
13
+ ### Strengths
14
+
15
+ 1. The change is tightly scoped to the third-party auth redirect builder in `src/machine/auth.js:477-520`.
16
+ 2. Existing affiliate code and nickname logic remains unchanged while phone / email are additive only.
17
+ 3. Temporary keys are removed after payload composition, reducing leakage into later unrelated auth flows.
18
+
19
+ ---
20
+
21
+ ### Behavior Observed
22
+
23
+ 1. Static review confirms `phone`, `countryCode`, and `email` are appended only when storage values are not `undefined` / `null`.
24
+ 2. Channel and subchannel fallback logic stays intact after the new fields are added.
25
+ 3. No unrelated file changes were present in this repo for the review scope.
26
+
27
+ ---
28
+
29
+ ## 🔧 Change Type
30
+
31
+ - [ ] 🐛 Bug fix
32
+ - [x] ✨ New feature
33
+ - [ ] 💄 Style
34
+ - [ ] ♻️ Refactor
35
+ - [ ] ⚡ Performance
36
+ - [ ] 🔧 Chore
37
+
38
+ ---
39
+
40
+ ## 📱 Impact Scope
41
+
42
+ - Third-party register / login redirect query assembly in cuora shared auth machine.
43
+ - Downstream PWA clients that store `tp_phone`, `tp_countryCode`, and `tp_email` before `LOGIN_3PARTY`.
44
+
45
+ ---
46
+
47
+ ## Test Completion Status
48
+
49
+ | Item | Validation Tested | Status |
50
+ | -------------------------- | --------------------------------------------------------------------- | ------- |
51
+ | Diff hygiene | `git diff --check` in `cuora-module` | PASS |
52
+ | Shared auth payload review | Reviewed `src/machine/auth.js:477-520` against ticket intent | PASS |
53
+ | Runtime redirect execution | Not run in this repo directly; validated through client repos instead | NOT RUN |
54
+
55
+ ---
56
+
57
+ ## 📋 Spec Validation (Aligned with review-playbook)
58
+
59
+ | Spec Item | Evidence (File/Line/Result) | Status |
60
+ | ------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ------ |
61
+ | Third-party flow can carry phone when client stored it | `src/machine/auth.js:479-520` reads `tp_phone` / `tp_countryCode` and appends them to `referralObj` | PASS |
62
+ | Third-party flow can carry email when client stored it | `src/machine/auth.js:481-520` reads `tp_email` and appends it to `referralObj` | PASS |
63
+ | Affiliate code and nickname keep original logic | `src/machine/auth.js:477-500` keeps `ac` / `nick_name` handling unchanged | PASS |
64
+ | Temporary third-party data does not leak into later unrelated flows | `src/machine/auth.js:518-520` removes the temporary storage keys after composing the redirect URL | PASS |
65
+
66
+ ---
67
+
68
+ ## 📋 Standards Checklist (Summary)
69
+
70
+ | Category | Result | Notes |
71
+ | ---------------------- | ------- | --------------------------------------------------------------------------- |
72
+ | Memory Safety | PASS | Simple storage reads and object assembly only. |
73
+ | Rendering Performance | PASS | No rendering code touched. |
74
+ | Network Requests | PASS | Existing redirect flow only; no extra requests added. |
75
+ | Bundle Optimization | PASS | No new imports or heavy logic added. |
76
+ | Code Quality | PASS | Scope is narrow and branch contains only the required file change. |
77
+ | Vue / Nuxt Standards | NOT RUN | Shared module; not a Vue / Nuxt surface. |
78
+ | SSR Security Standards | PASS | Query parameters are assembled from existing client-side storage path only. |
79
+ | Project Conventions | PASS | Matches existing storage-guard pattern used for affiliate / nickname. |
80
+
81
+ ## Conclusion
82
+
83
+ This repo’s shared auth-machine change matches the ticket intent and is internally consistent. Runtime behavior was not executed in `cuora-module` directly, but both client repos now pass the new storage keys into this shared payload path.
84
+
85
+ **Overall Result:** PASS (PARTIAL)
@@ -1,19 +1,27 @@
1
1
  import { createMachine, assign } from 'xstate'
2
2
  import ranking from '../api/ranking.js'
3
3
 
4
+ const ROUND_LIMIT = { DAILY: 56, WEEKLY: 8, MONTHLY: 2, ALL: 2 }
5
+ const ONE_DAY_MS = 24 * 60 * 60 * 1000
6
+
7
+ // 後端每個 cycle 只回傳「當前回合」一筆,前台依當前回合往前回填歷史回合
8
+ // 回合長度 = 當期長度(endDate - beginDate)+ 1 天,回合之間連續無間隔
9
+ function expandPeriodOption(option, cycle) {
10
+ if (!option) return []
11
+ const { round, beginDate, endDate } = option
12
+ const step = endDate - beginDate + ONE_DAY_MS
13
+ const count = Math.min(ROUND_LIMIT[cycle] || round, round)
14
+ // 降冪排列,當前回合在最前
15
+ return Array.from({ length: count }, (_, i) => ({
16
+ round: round - i,
17
+ beginDate: beginDate - i * step,
18
+ endDate: endDate - i * step,
19
+ }))
20
+ }
21
+
4
22
  export default function (request) {
5
23
  const { appSecret } = request.config
6
24
  const cycleMapping = ['DAILY', 'WEEKLY', 'MONTHLY']
7
- const limit = { DAILY: 56, WEEKLY: 8, MONTHLY: 2, ALL: 2 }
8
-
9
- function roundProcess(rounds, cycles) {
10
- const roundArrays = rounds.map((round) => Array.from({ length: round }, (_, i) => i + 1))
11
- return roundArrays.reduce((acc, roundArray, index) => {
12
- const max = limit[cycles[index]] || rounds[index] // 若沒限制則取全部
13
- acc[cycles[index]] = roundArray.reverse().slice(0, max)
14
- return acc
15
- }, {})
16
- }
17
25
 
18
26
  function transGameData(item) {
19
27
  if (!item) return {}
@@ -30,7 +38,6 @@ export default function (request) {
30
38
  site: '',
31
39
  activityNo: '',
32
40
  // api options 回傳的資料
33
- currentRound: [],
34
41
  cycle: '',
35
42
  round: 0,
36
43
  rule: '',
@@ -42,7 +49,7 @@ export default function (request) {
42
49
  gameRanking: [],
43
50
  topRanking: [],
44
51
  settleStatus: false,
45
- // 前端這邊用的選單資料 { cycle, round }
52
+ // 前端這邊用的選單資料 { cycle: [string], round: { [cycle]: [{ round, beginDate, endDate }] } }
46
53
  options: {},
47
54
  },
48
55
  states: {
@@ -156,31 +163,41 @@ export default function (request) {
156
163
  setRankingOptions: assign((context, event) => {
157
164
  const isChampion = event.data?.rule === 'CHAMPION'
158
165
  const cycle = event.data?.cycle
159
- const currentRound = event.data?.currentRound || []
160
- // 取得結算週期選單列表
161
- const cycleOptions = isChampion ? cycleMapping.slice(0, currentRound.length) : [cycle]
162
- const roundOptions = roundProcess(currentRound, cycleOptions)
166
+ const periodOptions = event.data?.periodOptions || []
167
+ // 每個 cycle 對應一筆「當前回合」
168
+ const optionByCycle = periodOptions.reduce((acc, option) => {
169
+ acc[option.cycle] = option
170
+ return acc
171
+ }, {})
172
+ // 依照 cycleMapping 順序取出有資料的 cycle
173
+ const cycleOptions = isChampion ? cycleMapping.filter((c) => optionByCycle[c]) : [cycle]
174
+ // 將每個 cycle 的當前回合往前回填為完整回合列表 { [cycle]: [{ round, beginDate, endDate }] }
175
+ const roundOptions = cycleOptions.reduce((acc, c) => {
176
+ acc[c] = expandPeriodOption(optionByCycle[c], c)
177
+ return acc
178
+ }, {})
163
179
  // 如果是冠軍龍虎月結算,則加入全部選項
164
180
  if (cycle === 'MONTHLY' && isChampion) {
165
181
  cycleOptions.push('ALL')
166
- roundOptions.ALL = roundOptions.MONTHLY
182
+ roundOptions.ALL = expandPeriodOption(optionByCycle.MONTHLY, 'ALL')
167
183
  }
184
+ // 初始 cycle 與 round
185
+ const initialCycle = isChampion ? 'DAILY' : cycle
186
+ const initialRound = roundOptions[initialCycle]?.[0]?.round
168
187
  return {
169
188
  ...event.data,
170
189
  options: { cycle: cycleOptions, round: roundOptions },
171
- // 初始固定顯示 DAILY
172
- cycle: isChampion ? 'DAILY' : cycle,
173
- round: currentRound[0],
190
+ cycle: initialCycle,
191
+ round: initialRound,
174
192
  }
175
193
  }),
176
194
  setOptions: assign((context, event) => {
177
- const { cycle, round } = context
195
+ const { cycle, round, options } = context
178
196
  // 處理變更 cycle,如果沒有輸入或沒有變更就不更新
179
197
  if (event.data?.cycle && cycle !== event.data?.cycle) {
180
- const { currentRound } = context
181
- const cycleForRound = event.data?.cycle === 'ALL' ? 'MONTHLY' : event.data?.cycle
182
- const cycleIndex = cycleMapping.indexOf(cycleForRound)
183
- return { cycle: event.data?.cycle, round: currentRound[cycleIndex] }
198
+ const newCycle = event.data?.cycle
199
+ const newRound = options?.round?.[newCycle]?.[0]?.round
200
+ return { cycle: newCycle, round: newRound }
184
201
  }
185
202
  if (event.data?.round && round !== event.data?.round) {
186
203
  return { round: event.data?.round }
@@ -247,8 +247,9 @@ export default function (request, context) {
247
247
  let prefetchedRule = null
248
248
  if (doubleWalletWithdrawLimitCheck === '2' || doubleWalletWithdrawLimitCheck === '1') {
249
249
  const activityRule = await request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'ACTIVITY' }))
250
- // '1' 模式僅看 ACTIVITY,'2' 模式 ACTIVITY 不可提則 CASH 不參與閘門 — 兩種情況都用 activityRule 為依據
251
- if (doubleWalletWithdrawLimitCheck === '1' || activityRule?.enableWithdraw !== true) {
250
+ // '1' 模式僅看 ACTIVITY,'2' 模式 ACTIVITY 不可提則 CASH 不參與閘門 — 兩種情況都用 activityRule 為依據。
251
+ // enableWithdraw 用 truthy 比較對齊 client-pwa-ssr useWithdrawManual(!enableWithdraw.value),避免 backend 回傳非 boolean truthy 值(如 1)時誤判。
252
+ if (doubleWalletWithdrawLimitCheck === '1' || !activityRule?.enableWithdraw) {
252
253
  prefetchedRule = activityRule
253
254
  }
254
255
  }