@jetthai/cuora 1.1.487 → 1.1.488-dev.1

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.
Files changed (114) hide show
  1. package/.claude/commands/sync-ai-prompts.md +88 -1
  2. package/.claude/settings.local.json +3 -1
  3. package/.github/copilot-instructions.md +17 -6
  4. package/.husky/post-checkout +3 -3
  5. package/.husky/pre-push +1 -1
  6. package/.prettierignore +2 -1
  7. package/AGENTS.md +17 -6
  8. package/AI_PROMPT_SOURCE.md +17 -6
  9. package/CHANGELOG.md +422 -23
  10. package/CLAUDE.md +17 -6
  11. package/GEMINI.md +17 -6
  12. package/e2e/feature-map.md +19 -0
  13. package/package.json +1 -1
  14. package/prepare-for-pr/JT-1776243420.md +85 -0
  15. package/prepare-for-pr/TI-16026/STATE.md +18 -0
  16. package/prepare-for-pr/TI-16026/after-prepare-authorization.md +3 -0
  17. package/prepare-for-pr/TI-16026/analysis.md +38 -0
  18. package/prepare-for-pr/TI-16026/answer-analyze-01.md +1 -0
  19. package/prepare-for-pr/TI-16026/answer-commit-01.md +2 -0
  20. package/prepare-for-pr/TI-16026/answer-commit-02.md +1 -0
  21. package/prepare-for-pr/TI-16026/bundle.json +18 -0
  22. package/prepare-for-pr/TI-16026/checklist.md +196 -0
  23. package/prepare-for-pr/TI-16026/checklist.unit-test-original.md +39 -0
  24. package/prepare-for-pr/TI-16026/claude-after-model +1 -0
  25. package/prepare-for-pr/TI-16026/claude-commit-session +1 -0
  26. package/prepare-for-pr/TI-16026/claude-harvest-session +1 -0
  27. package/prepare-for-pr/TI-16026/claude-hops/01-analyze.err +1 -0
  28. package/prepare-for-pr/TI-16026/claude-hops/01-analyze.out +2 -0
  29. package/prepare-for-pr/TI-16026/claude-hops/02-analyze.err +1 -0
  30. package/prepare-for-pr/TI-16026/claude-hops/02-analyze.out +4 -0
  31. package/prepare-for-pr/TI-16026/claude-hops/03-dev.err +1 -0
  32. package/prepare-for-pr/TI-16026/claude-hops/03-dev.out +4 -0
  33. package/prepare-for-pr/TI-16026/claude-hops/04-dev.err +1 -0
  34. package/prepare-for-pr/TI-16026/claude-hops/04-dev.out +4 -0
  35. package/prepare-for-pr/TI-16026/claude-hops/05-dev.err +1 -0
  36. package/prepare-for-pr/TI-16026/claude-hops/05-dev.out +3 -0
  37. package/prepare-for-pr/TI-16026/claude-hops/06-after.err +1 -0
  38. package/prepare-for-pr/TI-16026/claude-hops/06-after.out +2 -0
  39. package/prepare-for-pr/TI-16026/claude-hops/07-commit.err +1 -0
  40. package/prepare-for-pr/TI-16026/claude-hops/07-commit.out +2 -0
  41. package/prepare-for-pr/TI-16026/claude-hops/08-commit.err +1 -0
  42. package/prepare-for-pr/TI-16026/claude-hops/08-commit.out +2 -0
  43. package/prepare-for-pr/TI-16026/claude-hops/09-commit.err +1 -0
  44. package/prepare-for-pr/TI-16026/claude-hops/09-commit.out +8 -0
  45. package/prepare-for-pr/TI-16026/claude-hops/10-harvest.err +1 -0
  46. package/prepare-for-pr/TI-16026/claude-hops/10-harvest.out +3 -0
  47. package/prepare-for-pr/TI-16026/claude-hops/11-harvest.err +1 -0
  48. package/prepare-for-pr/TI-16026/claude-hops/11-harvest.out +3 -0
  49. package/prepare-for-pr/TI-16026/commit-note.md +5 -0
  50. package/prepare-for-pr/TI-16026/evidence-index.json +215 -0
  51. package/prepare-for-pr/TI-16026/feature-map.before.md +61 -0
  52. package/prepare-for-pr/TI-16026/harvest-redaction.json +34 -0
  53. package/prepare-for-pr/TI-16026/harvest-redaction.out +37 -0
  54. package/prepare-for-pr/TI-16026/harvest.md +46 -0
  55. package/prepare-for-pr/TI-16026/lessons.md +5 -0
  56. package/prepare-for-pr/TI-16026/note-harvest-redaction.md +1 -0
  57. package/prepare-for-pr/TI-16026/open-questions.md +6 -0
  58. package/prepare-for-pr/TI-16026/publish.md +32 -0
  59. package/prepare-for-pr/TI-16026/review-convergence-response.md +3 -0
  60. package/prepare-for-pr/TI-16026/review-input/scope.md +18 -0
  61. package/prepare-for-pr/TI-16026/review-log.md +57 -0
  62. package/prepare-for-pr/TI-16026/review-notes.md +97 -0
  63. package/prepare-for-pr/TI-16026/review-response-r1.md +7 -0
  64. package/prepare-for-pr/TI-16026/self-test-report.md +67 -0
  65. package/prepare-for-pr/TI-16026/spec-proposal.md +34 -0
  66. package/prepare-for-pr/TI-16026/spec-snapshot.md +291 -0
  67. package/prepare-for-pr/TI-16026/state-log.md +57 -0
  68. package/prepare-for-pr/TI-16026/user-messages/01.md +12 -0
  69. package/prepare-for-pr/TI-16026/user-messages/02.md +20 -0
  70. package/prepare-for-pr/TI-16026/user-messages/03.md +1 -0
  71. package/prepare-for-pr/TI-16026/user-messages/04.md +1 -0
  72. package/prepare-for-pr/TI-16026/user-messages/05.md +1 -0
  73. package/prepare-for-pr/TI-16026/user-messages/06.md +1 -0
  74. package/prepare-for-pr/TI-16026/user-messages/07.md +1 -0
  75. package/prepare-for-pr/TI-16026/user-messages/08.md +1 -0
  76. package/prepare-for-pr/TI-16026/user-messages/09.md +1 -0
  77. package/prepare-for-pr/TI-16026/user-messages/10.md +1 -0
  78. package/prepare-for-pr/TI-16026/user-messages/11.md +1 -0
  79. package/prepare-for-pr/TI-16026/user-messages/12.md +1 -0
  80. package/prepare-for-pr/TI-16026/user-messages/13.md +1 -0
  81. package/prepare-for-pr/TI-16026/user-messages/14.md +1 -0
  82. package/prepare-for-pr/TI-16026/user-messages/15.md +1 -0
  83. package/prepare-for-pr/TI-16026/user-messages/16.md +1 -0
  84. package/prepare-for-pr/TI-16026/user-messages/17.md +1 -0
  85. package/prepare-for-pr/TI-16026/user-messages/18.md +10 -0
  86. package/prepare-for-pr/TI-16026/user-messages/19.md +1 -0
  87. package/prepare-for-pr/TI-16026/user-messages/20.md +1 -0
  88. package/prepare-for-pr/TI-16026/user-messages/21.md +1 -0
  89. package/prepare-for-pr/TI-16026/user-messages/22.md +1 -0
  90. package/prepare-for-pr/TI-16026/user-messages/23.md +8 -0
  91. package/prepare-for-pr/TI-16026/user-messages/24.md +24 -0
  92. package/prepare-for-pr/TI-16026/user-question.md +24 -0
  93. package/prepare-for-pr/TI-16026/verify/metrics-check.json +13 -0
  94. package/prepare-for-pr/TI-16026/verify/redaction.json +38 -0
  95. package/prepare-for-pr/TI-16026/verify/row-closure.json +45 -0
  96. package/prepare-for-pr/TI-16026/verify/s04-ws-capture.md +23 -0
  97. package/prepare-for-pr/TI-16026/verify-after.md +23 -0
  98. package/prepare-for-pr/TI-16026/verify.json +80 -0
  99. package/prepare-for-pr/TI-16026.md +408 -0
  100. package/scripts/auto-version.js +1 -0
  101. package/scripts/branch-auto-npm-publish.js +9 -2
  102. package/src/api/payment.js +1 -0
  103. package/src/machine/auth.js +36 -33
  104. package/src/machine/game_v2_1.js +15 -0
  105. package/src/machine/reward_cash.js +2 -2
  106. package/src/machine/user_sign_up.js +3 -0
  107. package/src/machine/withdraw/withdraw_manual_cash.js +17 -7
  108. package/src/request/request.js +103 -4
  109. package/src/util/constant.js +6 -0
  110. package/src/util/tokenStore.js +44 -0
  111. package/test/auth_self_timeout.test.js +171 -0
  112. package/test/request_self.test.js +288 -0
  113. package/test/withdraw_manual_cash.test.js +149 -0
  114. package/tests/session.test.mjs +177 -0
package/GEMINI.md CHANGED
@@ -144,7 +144,7 @@ State machines **do not directly reference each other**; they communicate indire
144
144
  | `ERR_F108` | System under maintenance (**dual interception**: `request.js` sets `isBlocked` to block subsequent non-config requests; `error.js` routes to logout) |
145
145
  | `ERR_A103` | Missing auth token |
146
146
  | `ERR_A104` / `ERR_A113` / `ERR_A201` / `ERR_A204` | Auth invalidation / logout class |
147
- | `ERR_A108` | OTP auth related |
147
+ | `ERR_A108` | Token expired (`send()` renews via `/self` first, and only on success resends the original request once; see item 15 of 2.9) |
148
148
  | `ERR_F106` | OTP verification failed |
149
149
  | `ERR_G106` | Insufficient balance (→ deposit state) |
150
150
  | `ERR_G124` / `ERR_G125` | Free game settlement / forfeit |
@@ -161,16 +161,25 @@ This section explains how each module actually operates, its non-obvious behavio
161
161
 
162
162
  ### 2.1 Authentication & Token Lifecycle
163
163
 
164
- **Token survival strategy**: the token TTL is only 5 minutes (`maxAge: 300`), kept alive by continuous `fetchUserInfo` polling. On each successful poll, `extendToken` rewrites storage and resets the TTL. **Tokens are never auto-renewed** — if `fetchUserInfo` fails, the token expires naturally and the session terminates on its own.
164
+ **Token survival strategy**: the token TTL is only 5 minutes (`maxAge: 300`), kept alive by continuous `fetchUserInfo` polling. On each successful poll, `extendToken` rewrites the cookie and resets the TTL. **Tokens are never auto-renewed** — if `fetchUserInfo` fails, the token expires naturally and the session terminates on its own.
165
165
 
166
166
  ```
167
167
  Token 5min TTL → fetchUserInfo success → extendToken resets TTL → poll again
168
168
  fetchUserInfo failure → leaving state → logout
169
169
  ```
170
170
 
171
- - **Storage location**: localStorage, key `cuora_{clientId}` (a contract shared with the downstream frontends)
171
+ **`/self` single-flight and its dedicated timeout** (`request.js`, TI-16263): for `GET self` (`_isSelfRead`: non-public, url is `'self'` after stripping the query) `send()` shares one in-flight promise keyed by `[channel, token, url, params, headers, silent]` — shared only when all of them are identical; a different identity or different params each get their own request. `channel` is a classification field on the descriptor (never sent to the backend): `polling` (`pollUserInfo` in `auth.js`, used by `inline.fetching` / `login.fetching`), `freeGame` (the downstream wait after claiming a free game), and `standalone` by default (every other entry); the three channels each send their own request and never share or skip one another; calls passing their own `customToken` are not shared. Every `/self` read has a `SELF_REQUEST_TIMEOUT_MS` deadline (15 seconds, `util/constant.js`); when it expires the request is cancelled and rejects with `{ code: 'ERR_998', endpoint, isTimeout: true }`.
172
+
173
+ - **Single-flight must be paired with a timeout**: without one, a `/self` that never answers permanently stops the polling that shares it. Do the same when adding single-flight to another endpoint.
174
+ - **The read timeout must not be switched to axios's `timeout`**: `ECONNABORTED` gets re-sent by the downstream axios-retry; a cancelled error carries no `config` and is not retried. `POST self` (`_isSelfWrite`) is deliberately the opposite: each attempt gets 15 seconds and is retried per the downstream's existing settings, so it uses axios's `timeout` plus `'axios-retry': { shouldResetTimeout: true }`; when the retries are exhausted and it still times out, the error becomes `{ code: 'ERR_998', isTimeout: true }` and does not reach `errorHandler`.
175
+ - **A successful `GET /self` extends the token**: on a successful read (all three channels count), `_extendToken` resets the token's TTL to 5 minutes (only while the token sent is still the current one). While the main polling keeps timing out, a single successful read from another channel keeps the TTL from logging the user out. A successful `POST self` does **not** extend it: the backend renews the token only on `GET /self`.
176
+ - **A `/self` timeout never logs out**: the `isSelfTimeout` guard in `auth.js` only accepts `event.data.isTimeout === true`, and a timeout re-sends instead — `authenticated` → `userInfoRetrying`, `tokenAuthenticated` re-enters itself, `inline.fetching` / `login.checkDeviceTokenDone` / `login.fetching` → `pending` (wait for the next tick). A plain `ERR_998` (a network error that fails immediately) and authentication failures still go to `leaving`. Only once the token's 5-minute TTL has expired does `send()` return `ERR_A103` and the flow naturally reaches `leaving`.
177
+ - **`userInfoRetrying` is an externally visible state**: when the first `/self` after login times out, the machine stays here re-sending and moves to `otpChecking` on success. It deliberately does not re-enter `authenticated` — downstream fires one-off side effects on `state.matches('authenticated')` (saving credentials, registration conversion tracking), and re-entering would fire them again. Downstream code that enumerates auth states (loading checks, etc.) must treat it as a continuation of `authenticated`.
178
+
179
+ - **Storage location**: a cookie named `cuora_{clientId}`, with no `Domain` attribute (not shared across subdomains), `SameSite=Lax`, plus `Secure` under https. It is read and written only through `Request`'s `getToken()` / `setToken()` / `extendToken()` / `removeToken()` (implemented in `util/tokenStore.js`); **downstream frontends must not read or write this cookie themselves, and must no longer use `storage.get('cuora_{clientId}')` to determine login state** — `storage` is still localStorage, and the token no longer lives there. When `Request` is constructed, it clears any leftover same-named value from localStorage rather than reusing the old token
180
+ - **Unreadable in cross-site iframes**: a `SameSite=Lax` cookie cannot be read or written inside a cross-site iframe (e.g. a Mini App embedded in Telegram Web), so login state cannot be maintained in that context; this is an accepted limitation
172
181
  - **Injection**: the request interceptor automatically adds `Authorization: Bearer {token}`
173
- - **TTL**: token 300 seconds, account info 31 days, cookie data 7 days
182
+ - **TTL**: token 300 seconds (`TOKEN_MAX_AGE`; on expiry the browser removes the cookie), account info 31 days, cookie data 7 days
174
183
 
175
184
  **Token revocation & foreground gate** (`request.js`): `revokeToken(token)` and `beginTokenGate(promise, timeoutMs = 3000)` are public `Request` methods with **no caller inside this package** — the downstream frontends call them on logout-class errors and when the app returns to the foreground; changing their signatures or semantics is a public-interface change.
176
185
 
@@ -281,6 +290,7 @@ There are only 4 guards: `hasNoBank` (`REFRESH` only reloads when no account is
281
290
  - **Parallel architecture** (`game_v2_1.js`): `flow` (UI interaction and game loading) and `timer` (auto-update every 20 seconds) run simultaneously
282
291
  - **Static-data fallback**: when logged out, `staticData` is used, slicing 20 entries per page from cache with **no API call**
283
292
  - **Game-switching mechanism**: when switching to another game while in one, `connectSwitching` disconnects the old game first, then `connecting` connects to the new one
293
+ - **Two ways to leave a game**: `EXIT_GAME` goes through `disconnect`, which calls `game/logout`; `ABANDON_GAME` returns straight to `idle` and clears the game URL, **without calling `game/logout`**. The latter is only for when "the session has been replaced (re-login) and the game page must be left" — logging the old session out of the game no longer serves any purpose. Once `ABANDON_GAME` has been sent, the `EXIT_GAME` that is still sent as usual when the page unloads is not handled in `idle`
284
294
  - **Provider-specific behavior**: some providers use `${origin}${base}return` as the returnURL, while the rest use `window.location.href` (with the query string stripped). The allowlist is `returnProviders` in `game_v2_1.js`
285
295
  - **Response mapping**: backend `redirect_url` → `gameURL`, `wallet_type` → `gameWalletType`; some games return embedded `gameHtml` instead of a URL
286
296
 
@@ -382,14 +392,14 @@ A `CONNECT_ERROR` / `DISCONNECT` sent in by downstream itself, without `internal
382
392
  8. Custom paramsSerializer: special encoding for the q parameter (avoids double-encoding)
383
393
  9. axios.request(config)
384
394
  10. Response interceptor: response.data.error present → reject; Network Error / 404 → ERR_998 + Sentry
385
- 11. Error handling (in order): cancellation → reject ERR_800 (never reaches errorHandler); token-carrying requests get a non-enumerable requestToken attached to the error; ERR_F108 → isBlocked + errorHandler; stale-identity error → thrown directly (see item 14 of 2.9); ERR_998 → thrown directly; everything else → errorHandler (skipped when the descriptor carries silent: true, still thrown); non-cancellation error whose code is already ERR_800 → resolves undefined
395
+ 11. Error handling (in order): cancellation → reject ERR_800 (never reaches errorHandler); ERR_A108 → renew via /self first, and only on success resend the original request once (see item 15 of 2.9); token-carrying requests get a non-enumerable requestToken attached to the error; ERR_F108 → isBlocked + errorHandler; stale-identity error → thrown directly (see item 14 of 2.9); ERR_998 → thrown directly; everything else → errorHandler (skipped when the descriptor carries silent: true, still thrown); non-cancellation error whose code is already ERR_800 → resolves undefined
386
396
  ```
387
397
 
388
398
  **V1→V2 conversion**: `supportVersion2List` supports dynamic paths (e.g. `payment/v2/:paymentType/transaction`, where `:param` is replaced by `[^/]+`); special paths are hard-coded in `specifyingPath`, and the rest are auto-converted via `/([a-z])([A-Z])/g`. **When adding an endpoint that needs V2 conversion, it must be added to the list manually.**
389
399
 
390
400
  ### 2.9 Critical Design Constraints & Gotchas
391
401
 
392
- 1. **Token extension only happens when `fetchUserInfo` succeeds**: tokens are never auto-renewed and depend on successful polling. API failure → the session terminates.
402
+ 1. **Token extension only happens when `/self` succeeds**: tokens are never auto-renewed and depend on a successful `/self` (polling, a read from any other entry, or `POST self`). API failure → the session terminates. The only exception is the 15-second `/self` timeout — no logout, it re-sends instead (see 2.1).
393
403
  2. **A leading slash changes routing**: `/payment/v2/...` (the withdrawal OTP endpoints) **deliberately** bypasses `url-join`'s baseURL composition and starts from the API root. Regular endpoints should not have a leading slash.
394
404
  3. **`register` mixes parameter passing**: `channel`/`subchannel`/`ac`/`fc` are appended to the URL query string while the rest go in the body. **This is the only endpoint using this pattern.**
395
405
  4. **OTP endpoints marked `isPublic`**: the withdrawal OTP `acknowledge`/`reset` endpoints are `isPublic: true` even though the operations are sensitive — this is because the token may already have expired during the OTP flow, and is **not a security oversight**.
@@ -403,6 +413,7 @@ A `CONNECT_ERROR` / `DISCONNECT` sent in by downstream itself, without `internal
403
413
  12. **`silent: true` only skips errorHandler**: the error is still thrown to the caller's `onError`, and `ERR_F108` is still routed as usual; but every other error code — **including logout-class codes such as `ERR_A104`, and `ERR_G106` insufficient balance** — never reaches the error machine. Use it only for background requests whose session invalidation is already covered by `fetchUserInfo` polling; never add it to user-initiated requests.
404
414
  13. **`send()` does not guarantee an object, and `assign()` must never throw**: non-config requests during maintenance (`isBlocked`) and non-cancellation errors that already carry `code: 'ERR_800'` make `send()` **resolve `undefined`** (they never reach `onError`); a 200 response with a non-JSON body resolves a string, so destructuring `{ data }` yields `undefined`. Cancellations (`customToken` cancellation, `revokeToken` revocation), by contrast, reject with `ERR_800` and **do reach `onError`** — they never resolve `undefined`. When an `assign()` throws, XState v4 clears the event queue and the state is not updated — the machine stays in the current invoke state and `after`-based polling stops until an external event (e.g. `REFRESH`) moves it out. **Validate response shapes inside the service and `throw` there (reject → `onError`)**; every assign in `onDone` must handle every value the service can resolve, including deliberate `return null` early exits.
405
415
  14. **Late errors from a stale identity never reach errorHandler**: when the token a request was sent with differs from the current token (and a current token exists), the error is only thrown to the caller's `onError` and not forwarded to errorHandler — so a late logout-class error from an old session can't log out a newly logged-in identity. When there is no current token (TTL expired or already cleared), routing is unchanged so that `ERR_A204`-style popups aren't swallowed; the `ERR_F108` check comes before this one and still routes as usual.
416
+ 15. **`ERR_A108` is resent only once, and only after asking `/self`**: when a token-carrying non-public request receives `ERR_A108`, `send()` first sends a single `silent` `/self`; only if that succeeds and the token has not changed is the original request resent, once. `/self` itself, an already-resent request, and a request whose identity changed during the renewal are never resent; if the renewal fails or the resent request still gets `ERR_A108`, the original error follows the existing routing into errorHandler. **Never turn this into a retry loop** — a failed `/self` means the session has really ended, and downstream relies on this error to log out.
406
417
 
407
418
  ---
408
419
 
@@ -0,0 +1,19 @@
1
+ # Feature map — cuora-module
2
+
3
+ Hints, not facts: verify any line you rely on with this task's own check.
4
+ Each line ends with (observed YYYY-MM-DD <TASK-id>) = the last task that confirmed it.
5
+
6
+ ## Repo-wide
7
+
8
+ - SDK with no UI and no `e2e/review-playbook.md`: no browser captures; evidence is `node --test test/*.test.js` (no `test` script in `package.json`) plus code review (observed 2026-11-17 TI-16026)
9
+ - Commit hook runs `npm run format` (`prettier --write .`) even with `HUSKY=0`, so ignored `prepare-for-pr/` files (review reports included) get reformatted → re-check a protected report before relying on it (observed 2026-11-17 TI-16026)
10
+ - Claude's `Bash(git commit:*)` allow pattern does not match an env-prefixed `HUSKY=0 git commit` → allow the prefixed form explicitly (observed 2026-11-17 TI-16026)
11
+ - `NPM_TOKEN_WRITE` set but `npm whoami` returned E401 → run `npm whoami` before starting a release flow (observed 2026-11-17 TI-16026)
12
+
13
+ ## withdraw_manual_cash machine
14
+
15
+ - Entry: `src/machine/withdraw/withdraw_manual_cash.js`; unit test pattern in `test/auth_otp_v3.test.js` (`node:test`, `interpret`, stubbed `request.send` keyed by `descriptor.url`) (observed 2026-11-17 TI-16026)
16
+ - Preconditions: context `doubleWalletWithdrawLimitCheck: '0'` and a `paymentDetail` entry `{ category: 'manual', transferType: 'withdraw', minimum, maximum, method }`; stub URLs come from `src/api/payment.js` (observed 2026-11-17 TI-16026)
17
+ - Selectors: `loading.onError` — `src/machine/withdraw/withdraw_manual_cash.js:40`; `submitted.on.REFRESH` — `:100`; root `REFRESH` with `hasNoBank` — `:159` (observed 2026-11-17 TI-16026)
18
+ - States: `submitted` with a pending order is reached via `loading` → `checking` → `isProcessing` guard; REFRESH there is unconditional because the state-level handler wins over the root one (observed 2026-11-17 TI-16026)
19
+ - Gotchas: a failed REFRESH inside `submitted` must return to `submitted` (guard `isProcessing`), not `loaded`, or the user leaves Pending; `setInitData` resets `selectedUserBank` to `userBanks[0]` and leaves OTP fields stale (observed 2026-11-17 TI-16026)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.487",
3
+ "version": "1.1.488-dev.1",
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)
@@ -0,0 +1,18 @@
1
+ phase: done
2
+ caller: codex
3
+ round: none
4
+ pendingCaptureIds: none
5
+ deliveryRef: null
6
+ guardHash: status=" M src/machine/withdraw/withdraw_manual_cash.js | ?? test/withdraw_manual_cash.test.js"; tracked diff sha256=013984d028fdf138d1240c9fc4d4ba247a310d8c0595ef2c1da759ea44720c09; untracked test/withdraw_manual_cash.test.js sha256=fecacc81d718bc118f791d125768c0ee0204d89b9d3762d0ca15c45725c29268
7
+ claudeSessions: analyze=94FC61FD-8DD5-41F5-B1F5-C3E6C55E71A9 before=none dev=00904264-E71A-4E07-8723-3F15A8D7B64C after=FC2E4263-D2A2-4BCF-8BE7-EDDA430DA18F
8
+ blockedOn: none
9
+ updatedAt: 2026-11-18T17:22:00+08:00
10
+
11
+ ## Current
12
+
13
+ - Committed 219a415070e8c9ee23615b60a9942d6c4dc1b02c on feat/stone/JT-1791856380-ws-refresh: `src/machine/withdraw/withdraw_manual_cash.js` + `test/withdraw_manual_cash.test.js` only (2 files, +156/-4). `git status --porcelain` clean after the commit.
14
+ - Hook finding: with `HUSKY=0` the pre-commit hook still ran `npm run format` (`prettier --write .`), so the globally ignored files under `prepare-for-pr/` (including the protected review report `prepare-for-pr/TI-16026.md` and `prepare-for-pr/JT-1776243420.md`) were probably rewritten by prettier. Content changes, if any, are formatting only; Codex should check the review report before relying on it.
15
+ - Harvest completed successfully on 2026-11-18 (`NEXT: harvested`). The wrapper redaction check passed using a temporary ignored symlink to the existing client-pwa-cash test-account config; the symlink was removed immediately after the hop. The current `e2e/feature-map.md` contains the harvested repo knowledge. The user declined the shared call-claude permission-pattern proposal; recorded verbatim in `harvest.md`, and no proposal was applied.
16
+ - Codex did not push, merge or publish. The user later confirmed the cuora dev package was published and installed in cash. The earlier `npm whoami` E401 is historical; no registry operation was performed in this turn.
17
+ - Authorization in force: the user approved the commit and shared-dev release flow, then reported that cuora was published and installed. This resumed turn only verified the installed version and wrote local evidence; no publish or push occurred.
18
+ - User approved the one-time no-UI exception verbatim: 「採一次性例外:報告列出 22/22 測試與獨立 review,明列截圖檢查不適用」. `self-test-report.md`, `evidence-index.json`, `verify.json`, and row-closure/redaction reports now record the unit-test proof and screenshot-check exception; top-level verification result is `ok`.
@@ -0,0 +1,3 @@
1
+ The user reported the publish-token setup complete after receiving the requested NPM_TOKEN_WRITE setup instructions. Their exact authorization was: 「A,不過修改後需要 publish cash 才有辦法驗證,而且 publish token 有改,有需要 publish 再叫我,或是先給我指令,我更新之後你就可以直接走到底」. Codex gave the token setup instructions and the user replied 「完成」.
2
+
3
+ Interpret this as authorization to complete the remaining task flow, including the feature commit, the repository's documented merge/push to the shared dev branch, and publishing the dev package, after verifying the publishing account. Do not ask for redundant permission at the publish gate. Do not expose the token. This cuora SDK is in the user's choice A mode: local delivery with unit-test/review proof and no UI captures or Notion self-test page. The visible UI evidence will be collected in client-pwa-cash.
@@ -0,0 +1,38 @@
1
+ # Analysis — TI-16026 (cuora-module)
2
+
3
+ Mode: user choice A (2026-11-17, `open-questions.md` Q1). No BEFORE/AFTER captures in this repo; proof is unit tests (`checklist.md`) plus Codex review. Size: 4 items, 0 captures.
4
+
5
+ ## Change
6
+
7
+ `src/machine/withdraw/withdraw_manual_cash.js`
8
+
9
+ - `submitted: {}` (line 99) gets its own handler: `on: { REFRESH: { target: 'loading', internal: false } }`.
10
+ - State-level `on` takes precedence over the root `on.REFRESH` (line 156, `cond: 'hasNoBank'`), so in `submitted` the refresh is unconditional; everywhere else the root rule is unchanged.
11
+ - `loading` re-runs `fetchInitData` (rule gate + `getBindingPaymentInfo` + `getPendingOrder({ transferType: 'WITHDRAW' })`) → `setInitData` → `checking`: `isProcessing` → `submitted` (with the new `processing`), else `loaded` (the withdraw form). This is exactly spec flow step 3.
12
+ - Nothing else in the machine changes. `websocket.js` needs no change (`open-questions.md`).
13
+
14
+ Alternatives rejected:
15
+
16
+ - Removing `cond: 'hasNoBank'` from the root REFRESH: would let REFRESH reset `loaded` / `calculated` / `otp` too — changes behavior the spec does not ask for, and downstream may already send REFRESH elsewhere expecting a no-op.
17
+ - A new event name (e.g. `PAYMENT_UPDATED`): the spec names `REFRESH`; cash's L4 sends `REFRESH`.
18
+ - Doing the applyId match inside the machine: spec L4 puts the match in client-pwa-cash; the machine has no socket input.
19
+
20
+ ## Unit test
21
+
22
+ New `test/withdraw_manual_cash.test.js`, same pattern as `test/auth_otp_v3.test.js` (`node:test`, `interpret`, stubbed `request.send` keyed by `descriptor.url`, `waitForState`). Run: `node --test test/withdraw_manual_cash.test.js` (no `test` script in `package.json`; do not add one — scope). Read the URLs the stub must answer from `src/api/payment.js` (`getBindingPaymentInfo`, `getDoubleWalletWithdrawRule`, `getPendingOrder`); use context `doubleWalletWithdrawLimitCheck: '0'` and a `paymentDetail` entry `{ category: 'manual', transferType: 'withdraw', minimum, maximum, method }`.
23
+
24
+ ## Constraints and risks
25
+
26
+ - Public-interface impact: additive only (a new accepted event in one state). No export, signature or context-field change. Downstream: client-pwa-cash must send `REFRESH` (its own bundle); client-pwa-ssr does not use this machine.
27
+ - `loading.onError → loaded` (line 39-41) is silent: if the refresh request fails, the user sees the form even if the order is still pending. Pre-existing behavior for the first load; not changed here (scope). Mention in the change description.
28
+ - `setInitData` reads `paymentInfo.bankList` inside `assign` (line 170-171): if `send()` resolves `undefined` (maintenance), the assign throws (CLAUDE.md §2.9 item 13). Pre-existing, same on first load; not changed.
29
+ - Context kept across the refresh: `selectedAmount`, `selectedUserBank` is reset by `setInitData` to `userBanks[0]`, OTP fields stay stale. Harmless for the form (`isSubmittable` only runs after `SET_AMOUNT`), but note it for cash review.
30
+ - Formatting: `.prettierrc`; the pre-commit hook runs `npm run format && git add .` — note `git add .` would also stage `prepare-for-pr/` if it is not ignored; check `.gitignore` before the commit step.
31
+
32
+ ## Delivery
33
+
34
+ Cash cannot verify until a cuora version with this change is published (user, Q1). Publish plan and the command for the user: `publish.md`.
35
+
36
+ ## Feature map lines used
37
+
38
+ None (no `e2e/feature-map.md` in this repo).
@@ -0,0 +1 @@
1
+ A,不過修改後需要 publish cash 才有辦法驗證,而且 publish token 有改,有需要 publish 再叫我,或是先給我指令,我更新之後你就可以直接走到底
@@ -0,0 +1,2 @@
1
+ A,不過修改後需要 publish cash 才有辦法驗證,而且 publish token 有改,有需要 publish 再叫我,或是先給我指令,我更新之後你就可以直接走到底
2
+ 完成
@@ -0,0 +1 @@
1
+ A:允許 Claude CLI 提交
@@ -0,0 +1,18 @@
1
+ {
2
+ "formatVersion": 2,
3
+ "taskId": "TI-16026",
4
+ "title": "[優化][前台] 存出款 Pending 畫面依 WebSocket 即時刷新狀態",
5
+ "spec": { "source": "notion", "ref": "https://app.notion.com/p/3f8b399ad8b5801d81e9fb0675e50907", "externalId": "TI-16026" },
6
+ "delivery": { "target": "local", "ref": null },
7
+ "repo": "cuora-module",
8
+ "adapter": "none",
9
+ "branch": "feat/stone/JT-1791856380-ws-refresh",
10
+ "baseCommit": "c9186b6b3f424d74a9fe1363e64b17eb63809b58",
11
+ "submodules": {},
12
+ "runtime": [],
13
+ "viewports": [],
14
+ "locales": [],
15
+ "dataSource": "none: SDK without UI; proved by node:test unit tests with a stubbed request (user choice A, 2026-11-17). Screen evidence lives in the client-pwa-cash and client-pwa-ssr TI-16026 bundles. The user approved a one-time exception for screenshot-only checks on 2026-11-18.",
16
+ "createdBy": "claude /ui-baseline-codex",
17
+ "createdAt": "2026-11-17T00:00:00+08:00"
18
+ }
@@ -0,0 +1,196 @@
1
+ # Checklist — TI-16026 (cuora-module)
2
+
3
+ Mode: SDK unit-test proof (user choice A, 2026-11-17). The package has no UI adapter or screen, so this bundle intentionally has no BEFORE/AFTER captures. One-time exception approved by the user on 2026-11-18: screenshot-only checks are listed as not applicable in `self-test-report.md`; unit tests and independent code review remain the evidence for this repo. Screen evidence is in the client-pwa-cash and client-pwa-ssr TI-16026 bundles.
4
+
5
+ Cascade sweep: skipped — the diff changes an XState machine and unit tests only; it adds no CSS, class, style, DOM or stacking code.
6
+
7
+ ## Spec trace
8
+
9
+ | Spec ref | Location | Spec content | IDs |
10
+ | -------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | -------------- |
11
+ | B01 | 正文 › 現行問題說明 <https://app.notion.com/p/3f8b399ad8b5801d81e9fb0675e50907> | 出款被拒後仍停留於 Pending 的問題背景 | U1 |
12
+ | B02 | 正文 › 優化內容 › 流程 1–2 <https://app.notion.com/p/3f8b399ad8b5801d81e9fb0675e50907> | payment-info 推送及訂單 ID 比對;ticket 將 consumer matching 指派給 client-pwa-cash | U6 |
13
+ | B03 | 正文 › 優化內容 › 流程 3 <https://app.notion.com/p/3f8b399ad8b5801d81e9fb0675e50907> | 重抓提款狀態;無 pending order 回到表單,有 pending order 則更新 | U1, U2, U3 |
14
+ | B04 | 正文 › 前端需調整 › @jetthai/cuora bullet 1 <https://app.notion.com/p/3f8b399ad8b5801d81e9fb0675e50907> | submitted 接受 REFRESH 並重新進入 loading | U1, U2, U3, U4 |
15
+ | B05 | 正文 › 前端需調整 › @jetthai/cuora bullet 2 <https://app.notion.com/p/3f8b399ad8b5801d81e9fb0675e50907> | payment-info 的 windowType 條件 | U5 |
16
+ | B06 | 正文 › 前端需調整 › client-pwa-cash <https://app.notion.com/p/3f8b399ad8b5801d81e9fb0675e50907> | socket event 與 strict ID match 由 cash consumer 實作 | U6 |
17
+ | B07 | 正文 › 翻譯 <https://app.notion.com/p/3f8b399ad8b5801d81e9fb0675e50907> | 翻譯表為空,沒有新增文案 | — |
18
+
19
+ ## Items
20
+
21
+ ### U1 — submitted 收到 REFRESH 後重新載入提款狀態
22
+
23
+ - origin: spec
24
+ - spec ref: B01, B03, B04
25
+ - kind: CHANGE
26
+ - states:
27
+ - submitted-refresh — proof: measure
28
+ - frame: —
29
+ - showcase: —
30
+ - captures: —
31
+ - recipes: —
32
+ - expected: 從 submitted 傳入 REFRESH 後進入 loading,並再次呼叫 getPendingOrder。
33
+ - test command: `node --test test/withdraw_manual_cash.test.js`
34
+ - evidence: `test/withdraw_manual_cash.test.js`;完整結果見 `verify-after.md`。
35
+ - D01: N/A — SDK machine 無畫面或 layout,見 `src/machine/withdraw/withdraw_manual_cash.js`。
36
+ - D02: N/A — SDK machine 不使用 viewport 或 orientation。
37
+ - D03: N/A — SDK machine 不繪製文字或方向樣式。
38
+ - D04: N/A — acceptance 不涉及顯示文字長度。
39
+ - D05: N/A — diff 不涉及字型或文字排版。
40
+ - D06: N/A — diff 不涉及畫面幾何尺寸。
41
+ - D07: N/A — diff 不涉及畫面 overflow。
42
+ - D08: applies — unit test stubs the second pending-order request.
43
+ - D09: applies — test asserts submitted → loading and the second request.
44
+ - D10: N/A — public factory and entry point are unchanged; `src/machine/withdraw/index.js`.
45
+ - D11: N/A — spec accepts no visual or shared-copy side effect.
46
+ - D12: N/A — unchanged root REFRESH behavior is separately covered by U4.
47
+ - D13: N/A — acceptance defines no data-type variants.
48
+ - result:
49
+ - r1: PASS — test asserts the state and request-count transition.
50
+
51
+ ### U2 — 刷新回應沒有 pending order 時回到提款表單狀態
52
+
53
+ - origin: spec
54
+ - spec ref: B03, B04
55
+ - kind: CHANGE
56
+ - states:
57
+ - empty-pending-order — proof: measure
58
+ - frame: —
59
+ - showcase: —
60
+ - captures: —
61
+ - recipes: —
62
+ - expected: 第二次 getPendingOrder 回傳空陣列後進入 loaded,processing 為 undefined。
63
+ - test command: `node --test test/withdraw_manual_cash.test.js`
64
+ - evidence: `test/withdraw_manual_cash.test.js`;完整結果見 `verify-after.md`。
65
+ - D01: N/A — SDK machine 無畫面或 layout,見 `src/machine/withdraw/withdraw_manual_cash.js`。
66
+ - D02: N/A — SDK machine 不使用 viewport 或 orientation。
67
+ - D03: N/A — SDK machine 不繪製文字或方向樣式。
68
+ - D04: N/A — acceptance 不涉及顯示文字長度。
69
+ - D05: N/A — diff 不涉及字型或文字排版。
70
+ - D06: N/A — diff 不涉及畫面幾何尺寸。
71
+ - D07: N/A — diff 不涉及畫面 overflow。
72
+ - D08: applies — test returns an empty pending-order list from the local request stub.
73
+ - D09: applies — test asserts checking → loaded and cleared processing.
74
+ - D10: N/A — public factory and entry point are unchanged; `src/machine/withdraw/index.js`.
75
+ - D11: N/A — spec accepts no visual or shared-copy side effect.
76
+ - D12: N/A — unchanged root REFRESH behavior is separately covered by U4.
77
+ - D13: N/A — acceptance defines no data-type variants.
78
+ - result:
79
+ - r1: PASS — empty-order response clears the pending order and returns to loaded.
80
+
81
+ ### U3 — 刷新回應仍有 pending order 時更新目前訂單
82
+
83
+ - origin: spec
84
+ - spec ref: B03, B04
85
+ - kind: CHANGE
86
+ - states:
87
+ - replacement-pending-order — proof: measure
88
+ - frame: —
89
+ - showcase: —
90
+ - captures: —
91
+ - recipes: —
92
+ - expected: 第二次 getPendingOrder 回傳另一筆訂單後仍為 submitted,processing 指向新訂單。
93
+ - test command: `node --test test/withdraw_manual_cash.test.js`
94
+ - evidence: `test/withdraw_manual_cash.test.js`;完整結果見 `verify-after.md`。
95
+ - D01: N/A — SDK machine 無畫面或 layout,見 `src/machine/withdraw/withdraw_manual_cash.js`。
96
+ - D02: N/A — SDK machine 不使用 viewport 或 orientation。
97
+ - D03: N/A — SDK machine 不繪製文字或方向樣式。
98
+ - D04: N/A — acceptance 不涉及顯示文字長度。
99
+ - D05: N/A — diff 不涉及字型或文字排版。
100
+ - D06: N/A — diff 不涉及畫面幾何尺寸。
101
+ - D07: N/A — diff 不涉及畫面 overflow。
102
+ - D08: applies — test returns a distinct second pending order from the local request stub.
103
+ - D09: applies — test asserts submitted remains active with the new processing object.
104
+ - D10: N/A — public factory and entry point are unchanged; `src/machine/withdraw/index.js`.
105
+ - D11: N/A — spec accepts no visual or shared-copy side effect.
106
+ - D12: N/A — unchanged root REFRESH behavior is separately covered by U4.
107
+ - D13: N/A — acceptance defines no data-type variants.
108
+ - result:
109
+ - r1: PASS — the new pending order replaces the original processing object.
110
+
111
+ ### U4 — submitted 以外的 REFRESH 保留既有 bank 條件
112
+
113
+ - origin: ripple
114
+ - spec ref: B04
115
+ - via: `src/machine/withdraw/withdraw_manual_cash.js:159-160` — root REFRESH handler remains guarded by hasNoBank; the submitted-local handler does not replace it elsewhere.
116
+ - kind: SAME
117
+ - states:
118
+ - loaded-with-bound-bank — proof: measure
119
+ - frame: —
120
+ - showcase: —
121
+ - captures: —
122
+ - recipes: —
123
+ - expected: loaded 且已有綁定 bank 時,REFRESH 不會觸發第二次 getPendingOrder,state 保持 loaded。
124
+ - test command: `node --test test/withdraw_manual_cash.test.js`
125
+ - evidence: `test/withdraw_manual_cash.test.js`;完整結果見 `verify-after.md`。
126
+ - D01: N/A — SDK machine 無畫面或 layout,見 `src/machine/withdraw/withdraw_manual_cash.js`。
127
+ - D02: N/A — SDK machine 不使用 viewport 或 orientation。
128
+ - D03: N/A — SDK machine 不繪製文字或方向樣式。
129
+ - D04: N/A — acceptance 不涉及顯示文字長度。
130
+ - D05: N/A — diff 不涉及字型或文字排版。
131
+ - D06: N/A — diff 不涉及畫面幾何尺寸。
132
+ - D07: N/A — diff 不涉及畫面 overflow。
133
+ - D08: applies — test uses a bound bank and asserts no extra request.
134
+ - D09: applies — test asserts the loaded state ignores REFRESH.
135
+ - D10: N/A — public factory and entry point are unchanged; `src/machine/withdraw/index.js`.
136
+ - D11: N/A — spec accepts no visual or shared-copy side effect.
137
+ - D12: applies — this is the unchanged neighboring branch protected by the new submitted handler.
138
+ - D13: N/A — acceptance defines no data-type variants.
139
+ - result:
140
+ - r1: PASS — loaded with a bound bank remains loaded and does not issue another request.
141
+
142
+ ### U5 — payment-info 不因 windowType 而被丟棄
143
+
144
+ - origin: spec
145
+ - spec ref: B05
146
+ - kind: CHANGE
147
+ - states: —
148
+ - frame: —
149
+ - showcase: —
150
+ - captures: —
151
+ - recipes: —
152
+ - expected: payment-info event is forwarded without a toast-only windowType gate.
153
+ - evidence: `src/machine/websocket.js:296-302` already forwards payment-info at the base commit; review-log.md independently confirms no windowType condition in this path.
154
+ - D01: N/A — this is an SDK event-forwarding path with no UI layout.
155
+ - D02: N/A — event forwarding does not depend on viewport or orientation.
156
+ - D03: N/A — event forwarding does not depend on locale direction.
157
+ - D04: N/A — acceptance does not vary by text length.
158
+ - D05: N/A — no typography code is involved.
159
+ - D06: N/A — no geometry code is involved.
160
+ - D07: N/A — no overflow code is involved.
161
+ - D08: N/A — the criterion is event forwarding, not a value range.
162
+ - D09: N/A — the current code already satisfies this criterion at the base commit.
163
+ - D10: N/A — the websocket event export path is shared and unchanged; `src/machine/websocket.js:296-302`.
164
+ - D11: N/A — no side effect is specified.
165
+ - D12: N/A — the criterion is already met at the base commit.
166
+ - D13: N/A — no data-type variants are specified.
167
+ - result:
168
+ - r1: N/A — current base code already forwards payment-info without a windowType filter.
169
+
170
+ ### U6 — socket-to-order matching stays in client-pwa-cash
171
+
172
+ - origin: spec
173
+ - spec ref: B02, B06
174
+ - kind: CHANGE
175
+ - states: —
176
+ - frame: —
177
+ - showcase: —
178
+ - captures: —
179
+ - recipes: —
180
+ - expected: cash owns the socket order-ID match and sends REFRESH to this SDK machine only for its matching pending order.
181
+ - evidence: the ticket assigns socket subscription / strict ID matching to client-pwa-cash; see the corresponding cash and SSR self-test pages in `self-test-report.md`.
182
+ - D01: N/A — the consumer matching logic is outside this SDK package, as assigned in B06.
183
+ - D02: N/A — the consumer's viewport handling is outside this SDK package.
184
+ - D03: N/A — the consumer's locale handling is outside this SDK package.
185
+ - D04: N/A — text length is outside the SDK machine contract.
186
+ - D05: N/A — typography is outside the SDK machine contract.
187
+ - D06: N/A — geometry is outside the SDK machine contract.
188
+ - D07: N/A — overflow is outside the SDK machine contract.
189
+ - D08: N/A — event payload value matching is implemented by the cash consumer, as assigned in B06.
190
+ - D09: N/A — the SDK receives REFRESH; the socket-to-order decision belongs to the consumer.
191
+ - D10: N/A — no second SDK entry point is specified.
192
+ - D11: N/A — no side effect is specified.
193
+ - D12: N/A — no neighboring UI variant exists in this SDK package.
194
+ - D13: N/A — no data-type variants are specified for this package.
195
+ - result:
196
+ - r1: N/A — the spec assigns socket-to-order matching to client-pwa-cash; this package provides the REFRESH transition.
@@ -0,0 +1,39 @@
1
+ # Checklist — TI-16026 (cuora-module)
2
+
3
+ Mode: unit-test proof (user choice A). No captures, no showcase, no frame. Cascade sweep: skipped — the diff is one XState transition in `src/machine/withdraw/withdraw_manual_cash.js`; no CSS, class, style, DOM or stacking code exists in this repo.
4
+
5
+ ## Spec trace
6
+
7
+ | Spec row | Location | Items |
8
+ | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------- |
9
+ | 現行問題說明 › 問題描述 / 原因分析 | notion https://app.notion.com/p/3f8b399ad8b5801d81e9fb0675e50907 § 現行問題說明 | — (no acceptance statement; cause 2 is fixed by U1) |
10
+ | 優化內容 › 流程 1–2 (socket push, applyId match) | notion … § 優化內容 › 流程 | — (client-pwa-cash) |
11
+ | 優化內容 › 流程 3「重新抓取狀態…無處理中訂單則回到出款表單,有則更新畫面」 | notion … § 優化內容 › 流程 step 3 | U1, U2, U3 |
12
+ | 前端需調整 › cuora「`submitted` 需可接受 `REFRESH` 回到 `loading`」 | notion … § 前端需調整 › @jetthai/cuora bullet 1 | U1, U4 |
13
+ | 前端需調整 › cuora「`websocket.js`…放寬此條件」 | notion … § 前端需調整 › @jetthai/cuora bullet 2 | — (already satisfied: `src/machine/websocket.js:296-302`) |
14
+ | 前端需調整 › client-pwa-cash | notion … § 前端需調整 › client-pwa-cash | — (client-pwa-cash) |
15
+ | 翻譯 | notion … § 翻譯 | — (empty) |
16
+
17
+ ## Items
18
+
19
+ - U1 — `submitted` + `REFRESH` re-runs loading
20
+ - origin: spec
21
+ - proof: measure (unit test)
22
+ - expected: from `submitted`, sending `REFRESH` enters `loading` and calls `getPendingOrder` a second time.
23
+ - files: src/machine/withdraw/withdraw_manual_cash.js, test/withdraw_manual_cash.test.js
24
+ - result: unit pass — `node --test test/withdraw_manual_cash.test.js`, 2026-11-17
25
+ - U2 — refresh with no pending order returns to the form
26
+ - origin: spec
27
+ - proof: measure
28
+ - expected: second `getPendingOrder` returns `[]` → state `loaded`, `context.processing` is `undefined`.
29
+ - result: unit pass — `node --test test/withdraw_manual_cash.test.js`, 2026-11-17
30
+ - U3 — refresh with an order still pending updates it
31
+ - origin: spec
32
+ - proof: measure
33
+ - expected: second `getPendingOrder` returns a different order object → state `submitted`, `context.processing` equals the new object (distinct `applyId` from the first).
34
+ - result: unit pass — `node --test test/withdraw_manual_cash.test.js`, 2026-11-17
35
+ - U4 — REFRESH elsewhere unchanged
36
+ - origin: ripple, via: root `on.REFRESH` `cond: 'hasNoBank'` (`withdraw_manual_cash.js:156`)
37
+ - proof: measure
38
+ - expected: in `loaded` with a bound bank, `REFRESH` is ignored (no new `getPendingOrder` call, state stays `loaded`).
39
+ - result: unit pass — `node --test test/withdraw_manual_cash.test.js`, 2026-11-17
@@ -0,0 +1 @@
1
+ sonnet medium
@@ -0,0 +1 @@
1
+ 5B674676-0F2B-458D-9F34-0F31F96DB57C
@@ -0,0 +1 @@
1
+ DEF3BB30-4448-4945-BBF8-8BEFC1747D43
@@ -0,0 +1 @@
1
+ Ignoring 17 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/agentstone/Desktop/workspace/JT/cuora-module"].hasTrustDialogAccepted: true in /Users/agentstone/.claude.json.
@@ -0,0 +1,2 @@
1
+ BLOCKED-ON-USER: cuora-module is a UI-less SDK with no e2e/review-playbook.md; should it skip the screenshot flow (unit test + review, screen evidence from client-pwa-cash), get a playbook first, or be folded into the client-pwa-cash bundle?
2
+ prepare-for-pr/TI-16026/user-question.md
@@ -0,0 +1 @@
1
+ Ignoring 17 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/agentstone/Desktop/workspace/JT/cuora-module"].hasTrustDialogAccepted: true in /Users/agentstone/.claude.json.
@@ -0,0 +1,4 @@
1
+ NEXT: implement
2
+ prepare-for-pr/TI-16026/analysis.md
3
+ prepare-for-pr/TI-16026/checklist.md
4
+ prepare-for-pr/TI-16026/publish.md
@@ -0,0 +1 @@
1
+ Ignoring 17 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/agentstone/Desktop/workspace/JT/cuora-module"].hasTrustDialogAccepted: true in /Users/agentstone/.claude.json.
@@ -0,0 +1,4 @@
1
+ NEXT: review
2
+ prepare-for-pr/TI-16026/review-input/scope.md
3
+ prepare-for-pr/TI-16026/STATE.md
4
+ test/withdraw_manual_cash.test.js
@@ -0,0 +1 @@
1
+ Ignoring 17 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/agentstone/Desktop/workspace/JT/cuora-module"].hasTrustDialogAccepted: true in /Users/agentstone/.claude.json.
@@ -0,0 +1,4 @@
1
+ NEXT: review
2
+ prepare-for-pr/TI-16026/review-log.md
3
+ src/machine/withdraw/withdraw_manual_cash.js
4
+ test/withdraw_manual_cash.test.js
@@ -0,0 +1 @@
1
+ Ignoring 17 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/agentstone/Desktop/workspace/JT/cuora-module"].hasTrustDialogAccepted: true in /Users/agentstone/.claude.json.
@@ -0,0 +1,3 @@
1
+ NEXT: prepare after
2
+ prepare-for-pr/TI-16026/review-log.md
3
+ prepare-for-pr/TI-16026/STATE.md
@@ -0,0 +1 @@
1
+ Ignoring 17 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/agentstone/Desktop/workspace/JT/cuora-module"].hasTrustDialogAccepted: true in /Users/agentstone/.claude.json.
@@ -0,0 +1,2 @@
1
+ NEXT: deliver
2
+ prepare-for-pr/TI-16026/verify-after.md
@@ -0,0 +1 @@
1
+ Ignoring 17 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/agentstone/Desktop/workspace/JT/cuora-module"].hasTrustDialogAccepted: true in /Users/agentstone/.claude.json.
@@ -0,0 +1,2 @@
1
+ BLOCKED-ON-USER: the commit was denied by the permission layer (`HUSKY=0 git commit` needs approval), so nothing was committed; allow `git add`/`git commit` for this repo and resume.
2
+ prepare-for-pr/TI-16026/user-question.md
@@ -0,0 +1 @@
1
+ Ignoring 17 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/agentstone/Desktop/workspace/JT/cuora-module"].hasTrustDialogAccepted: true in /Users/agentstone/.claude.json.