@jetthai/cuora 1.1.447-dev.0 → 1.1.447-dev.2

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.
@@ -22,6 +22,12 @@
22
22
 
23
23
  **File**: `src/index.js`
24
24
 
25
+ - **Token injection**: Request interceptor auto-injects `Bearer {token}`
26
+ - **API versioning**: `supportVersion2List` array defines endpoints requiring conversion, auto-converts V1 camelCase paths to V2 kebab-case
27
+ - **Maintenance detection**: `ERR_F108` error triggers `isBlocked` flag, blocking subsequent non-config requests
28
+ - **Custom serialization**: Avoids double-encoding for `q` parameter
29
+ - **Request cancellation**: Opt-in via the `customToken` second argument of `send()`; requests carry **no** CancelToken by default (axios <0.22 never unsubscribes cancel handlers — a shared long-lived token accumulates one handler per request and causes overnight OOM, TI-15555)
30
+
25
31
  ```js
26
32
  import api from './api/index.js'
27
33
  import machine from './machine/index.js'
package/AGENTS.md CHANGED
@@ -22,6 +22,12 @@
22
22
 
23
23
  **File**: `src/index.js`
24
24
 
25
+ - **Token injection**: Request interceptor auto-injects `Bearer {token}`
26
+ - **API versioning**: `supportVersion2List` array defines endpoints requiring conversion, auto-converts V1 camelCase paths to V2 kebab-case
27
+ - **Maintenance detection**: `ERR_F108` error triggers `isBlocked` flag, blocking subsequent non-config requests
28
+ - **Custom serialization**: Avoids double-encoding for `q` parameter
29
+ - **Request cancellation**: Opt-in via the `customToken` second argument of `send()`; requests carry **no** CancelToken by default (axios <0.22 never unsubscribes cancel handlers — a shared long-lived token accumulates one handler per request and causes overnight OOM, TI-15555)
30
+
25
31
  ```js
26
32
  import api from './api/index.js'
27
33
  import machine from './machine/index.js'
@@ -84,6 +84,12 @@
84
84
 
85
85
  **檔案**:`src/index.js`
86
86
 
87
+ - **Token 注入**:請求攔截器自動注入 `Bearer {token}`
88
+ - **API 版本控制**:`supportVersion2List` 陣列定義需轉換的端點,自動將 V1 camelCase 路徑轉為 V2 kebab-case
89
+ - **維護模式偵測**:`ERR_F108` 錯誤觸發 `isBlocked` 旗標,阻擋後續非設定請求
90
+ - **自訂序列化**:針對 `q` 參數避免雙重編碼
91
+ - **請求取消**:透過 `send()` 第二參數 `customToken` 選擇性啟用;預設**不**附加 CancelToken(axios <0.22 的取消 handler 永不退訂——共用長壽命 token 會隨請求數累積 handler,導致掛機過夜 OOM,TI-15555)
92
+
87
93
  ```js
88
94
  import api from './api/index.js'
89
95
  import machine from './machine/index.js'
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.447-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.447-dev.1...v1.1.447-dev.2) (2026-07-17)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **request:** send() 預設不再附加共用 CancelToken,杜絕取消 handler 累積(TI-15555) ([fb14330](https://github.com/jetthai/cuora-module/commit/fb1433087668559c8cb7f1f515c59a8caaa26351))
11
+
12
+ ### [1.1.447-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.447-dev.0...v1.1.447-dev.1) (2026-07-16)
13
+
5
14
  ### [1.1.447-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.447...v1.1.447-dev.0) (2026-07-14)
6
15
 
7
16
  ### [1.1.444-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.444...v1.1.444-dev.2) (2026-06-24)
package/CLAUDE.md CHANGED
@@ -22,6 +22,12 @@
22
22
 
23
23
  **File**: `src/index.js`
24
24
 
25
+ - **Token injection**: Request interceptor auto-injects `Bearer {token}`
26
+ - **API versioning**: `supportVersion2List` array defines endpoints requiring conversion, auto-converts V1 camelCase paths to V2 kebab-case
27
+ - **Maintenance detection**: `ERR_F108` error triggers `isBlocked` flag, blocking subsequent non-config requests
28
+ - **Custom serialization**: Avoids double-encoding for `q` parameter
29
+ - **Request cancellation**: Opt-in via the `customToken` second argument of `send()`; requests carry **no** CancelToken by default (axios <0.22 never unsubscribes cancel handlers — a shared long-lived token accumulates one handler per request and causes overnight OOM, TI-15555)
30
+
25
31
  ```js
26
32
  import api from './api/index.js'
27
33
  import machine from './machine/index.js'
package/GEMINI.md CHANGED
@@ -22,6 +22,12 @@
22
22
 
23
23
  **File**: `src/index.js`
24
24
 
25
+ - **Token injection**: Request interceptor auto-injects `Bearer {token}`
26
+ - **API versioning**: `supportVersion2List` array defines endpoints requiring conversion, auto-converts V1 camelCase paths to V2 kebab-case
27
+ - **Maintenance detection**: `ERR_F108` error triggers `isBlocked` flag, blocking subsequent non-config requests
28
+ - **Custom serialization**: Avoids double-encoding for `q` parameter
29
+ - **Request cancellation**: Opt-in via the `customToken` second argument of `send()`; requests carry **no** CancelToken by default (axios <0.22 never unsubscribes cancel handlers — a shared long-lived token accumulates one handler per request and causes overnight OOM, TI-15555)
30
+
25
31
  ```js
26
32
  import api from './api/index.js'
27
33
  import machine from './machine/index.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.447-dev.0",
3
+ "version": "1.1.447-dev.2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/user.js CHANGED
@@ -66,4 +66,16 @@ export default {
66
66
  getUserPhotoList: () => ({ url: 'getAllAvatar', method: 'get' }),
67
67
  updateUserPhoto: (data) => ({ url: 'updateUserAvatar', method: 'post', params: data }),
68
68
  getUserProfile: () => ({ url: 'user-info/get-profile', method: 'get' }),
69
+ subscribeStatus: ({ fingerprintId, domain }) => ({
70
+ url: 'notification-subscription/status',
71
+ method: 'post',
72
+ params: { fingerprintId, domain },
73
+ isPublic: true,
74
+ }),
75
+ subscribeUpdate: ({ fingerprintId, domain, action = 'subscribe' }) => ({
76
+ url: 'notification-subscription/update',
77
+ method: 'post',
78
+ params: { fingerprintId, domain, action },
79
+ isPublic: true,
80
+ }),
69
81
  }
@@ -251,7 +251,10 @@ export default class Request {
251
251
 
252
252
  async send(req, customToken) {
253
253
  try {
254
- const cancelToken = customToken || this.source.token
254
+ // axios <0.22 對 cancelToken.promise 註冊的取消 handler 永不退訂(xhr.js 無 unsubscribe),
255
+ // 預設掛長壽命共用 token 會使 handler 隨請求數線性累積(掛機過夜 OOM,TI-15555)。
256
+ // 故預設不掛 cancelToken,僅呼叫端明確傳入 customToken(自行管理其生命週期)時才附加。
257
+ const cancelToken = customToken
255
258
  // ERR_A103 No token provided 改由後端回傳:不再於送出前自行 throw,
256
259
  // 無 token 的非 public 請求一律送後端,由後端判定並回 A103(前台再屏蔽/登出)。
257
260
  const requestConfig = this._createConfig(req, cancelToken)
@@ -280,6 +283,8 @@ export default class Request {
280
283
  }
281
284
  }
282
285
 
286
+ // 注意:send() 已不再預設附加 this.source.token(見 send 內註解),
287
+ // sourceUpdate 僅對「呼叫端明確以 this.source.token 為 customToken」的請求有效;保留以維持 API 相容。
283
288
  sourceUpdate() {
284
289
  this.source.cancel('Requests Cancelled')
285
290
  this.source = this.axios.CancelToken.source()
@@ -1,85 +0,0 @@
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)