@jetthai/cuora 1.1.444-dev.0 → 1.1.444-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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
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.444-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.444-dev.1...v1.1.444-dev.2) (2026-06-24)
6
+
7
+ ### [1.1.444-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.444-dev.0...v1.1.444-dev.1) (2026-06-24)
8
+
5
9
  ### [1.1.444-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.444-dev-1...v1.1.444-dev.0) (2026-06-24)
6
10
 
7
11
  ### [1.1.444-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.444...v1.1.444-dev-1) (2026-06-24)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.444-dev.0",
3
+ "version": "1.1.444-dev.2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -6,7 +6,8 @@
6
6
  # 不符合規範 tag 的刪除規則:
7
7
  # 1. commit 不屬於任何分支 → 刪除(remote + local)
8
8
  # 2. commit 存在於 origin/master → 刪除(remote + local)
9
- # 3. commit 在其他分支上 → 跳過保留
9
+ # 3. commit 在 dev 或 qa 分支上 → 僅保留版本最新的一個,其餘刪除
10
+ # 4. commit 在其他分支上 → 跳過保留
10
11
  PATTERN="^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
11
12
 
12
13
  # 確保遠端 ref 為最新,避免本地 master 落後造成誤判
@@ -40,9 +41,27 @@ safe_delete_tag() {
40
41
  fi
41
42
  }
42
43
 
44
+ # 判斷 commit 是否位於 dev 或 qa 分支(含對應遠端分支)
45
+ is_on_dev_or_qa() {
46
+ git branch -a --contains "$1" 2>/dev/null \
47
+ | sed 's/^[* ]*//' \
48
+ | grep -qE '^(remotes/origin/)?(dev|qa)$'
49
+ }
50
+
43
51
  TAGS=$(git tag -l | grep -vE "$PATTERN")
44
52
  if [ -n "$TAGS" ]; then
45
53
  echo "檢查不符合規範的 tag"
54
+
55
+ # 先找出所有 commit 在 dev/qa 且未進 master 的 tag,版本最新的一個予以保留
56
+ KEEP_DEVQA_TAG=$(
57
+ for TAG in $TAGS; do
58
+ TAG_COMMIT=$(git rev-list -n 1 "$TAG" 2>/dev/null)
59
+ [ -z "$TAG_COMMIT" ] && continue
60
+ git merge-base --is-ancestor "$TAG_COMMIT" origin/master 2>/dev/null && continue
61
+ is_on_dev_or_qa "$TAG_COMMIT" && echo "$TAG"
62
+ done | sort -V | tail -n 1
63
+ )
64
+
46
65
  for TAG in $TAGS; do
47
66
  TAG_COMMIT=$(git rev-list -n 1 "$TAG" 2>/dev/null)
48
67
  BRANCHES=$(git branch -a --contains "$TAG_COMMIT" 2>/dev/null)
@@ -50,6 +69,12 @@ if [ -n "$TAGS" ]; then
50
69
  safe_delete_tag "$TAG" "commit 不屬於任何分支"
51
70
  elif git merge-base --is-ancestor "$TAG_COMMIT" origin/master 2>/dev/null; then
52
71
  safe_delete_tag "$TAG" "commit 存在於 origin/master"
72
+ elif is_on_dev_or_qa "$TAG_COMMIT"; then
73
+ if [ "$TAG" = "$KEEP_DEVQA_TAG" ]; then
74
+ echo "保留 tag $TAG(dev/qa 最新的一個)"
75
+ else
76
+ safe_delete_tag "$TAG" "dev/qa 僅保留最新的一個 tag"
77
+ fi
53
78
  else
54
79
  echo "跳過 tag $TAG(commit 在其他分支上)"
55
80
  fi
package/src/api/common.js CHANGED
@@ -2,7 +2,7 @@ export default {
2
2
  getConfig: ({ appSecret }) => ({ url: 'getConfig', method: 'get', params: { appSecret }, isPublic: true }),
3
3
  getLayoutConfig: ({ appSecret }) => ({ url: 'getQuickLayout', method: 'get', params: { appSecret }, isPublic: true }),
4
4
  feeds: ({ appSecret }) => ({ url: 'feeds', method: 'get', params: { appSecret }, isPublic: true }),
5
- broadcast: () => ({ url: 'broadcast', method: 'get', params: { appSecret }, isPublic: true }),
5
+ broadcast: ({ appSecret }) => ({ url: 'broadcast', method: 'get', params: { appSecret }, isPublic: true }),
6
6
  getAnnouncements: ({ appSecret }) => ({ url: 'getAnnouncements', params: { appSecret }, method: 'get', isPublic: true }),
7
7
  getNavbar: ({ appSecret } = {}) => ({ url: 'getNavbarSetting', params: { appSecret }, method: 'get', isPublic: true }),
8
8
  getDefaultAffiliateCode: ({ appSecret }) => ({ url: 'getAffiliateCode', params: { appSecret }, method: 'get', isPublic: true }),
@@ -252,8 +252,8 @@ export default class Request {
252
252
  async send(req, customToken) {
253
253
  try {
254
254
  const cancelToken = customToken || this.source.token
255
- this._checkToken(req)
256
-
255
+ // ERR_A103 No token provided 改由後端回傳:不再於送出前自行 throw,
256
+ // 無 token 的非 public 請求一律送後端,由後端判定並回 A103(前台再屏蔽/登出)。
257
257
  const requestConfig = this._createConfig(req, cancelToken)
258
258
  const configUrls = ['getConfig', 'get-config']
259
259
  if (this.isBlocked && !configUrls.includes(requestConfig.url)) {
@@ -363,12 +363,6 @@ export default class Request {
363
363
  return queryString ? `${convertedPath}?${queryString}` : convertedPath
364
364
  }
365
365
 
366
- _checkToken(req) {
367
- if (!req.isPublic && !this.getToken()) {
368
- throw { code: 'ERR_A103', url: req.url }
369
- }
370
- }
371
-
372
366
  getToken() {
373
367
  return storage.get(this.key)
374
368
  }