@jetthai/cuora 1.1.431 → 1.1.433

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.
@@ -1,71 +1,59 @@
1
1
  #!/usr/bin/env sh
2
2
 
3
- # 清理不符合規範的 git tag(本地 + 遠端)
4
- # 合規格式:v1.2.3(例如 v0.1.0、v1.12.123)
3
+ # 刪除不符合規範格式的本地與遠端 tag
4
+ # 規範格式:v1.2.3(例如 v0.1.0、v1.12.123)
5
5
  #
6
- # 刪除規則(符合任一條件即刪除):
7
- # 1. 當前分支為 dev 或 qa
8
- # 2. 該 tag 所指向的 commit 不屬於任何分支(孤立 commit)
9
- # 3. 該 tag 所指向的 commit 已被合併進 master
6
+ # 不符合規範 tag 的刪除規則:
7
+ # 1. commit 不屬於任何分支 → 刪除(remote + local)
8
+ # 2. commit 存在於 origin/master → 刪除(remote + local)
9
+ # 3. commit 在其他分支上 → 跳過保留
10
10
  PATTERN="^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
11
11
 
12
- # 取得當前分支名稱
13
- BRANCH=$(git rev-parse --abbrev-ref HEAD)
12
+ # 確保遠端 ref 為最新,避免本地 master 落後造成誤判
13
+ git fetch origin --prune --tags
14
14
 
15
- # 取得最新的 tag(依建立時間排序),無論格式是否合規都會保留
16
- LATEST_TAG=$(git tag -l --sort=-creatordate | head -n 1)
17
-
18
- # 篩選出所有不符合合規格式的 tag
19
- TAGS=$(git tag -l | grep -vE "$PATTERN")
20
-
21
- # 若沒有不合規的 tag,直接結束
22
- if [ -z "$TAGS" ]; then
23
- echo "No non-compliant tags found."
24
- exit 0
25
- fi
26
-
27
- echo "Latest tag (preserved): $LATEST_TAG"
28
-
29
- # 逐一檢查每個不合規的 tag
30
- for TAG in $TAGS; do
31
- # 最新的 tag 一律跳過,避免誤刪正在使用的版本
32
- if [ "$TAG" = "$LATEST_TAG" ]; then
33
- echo "Skipping tag $TAG (latest tag)"
34
- continue
15
+ # 刪除遠端 tag;若遠端本來就不存在則視為成功,其他失敗回傳非零並輸出錯誤訊息
16
+ delete_remote_tag() {
17
+ TAG=$1
18
+ ERR=$(git push origin --no-verify --delete "$TAG" 2>&1)
19
+ STATUS=$?
20
+ if [ $STATUS -eq 0 ]; then
21
+ return 0
35
22
  fi
36
-
37
- SHOULD_DELETE=false
38
- REASON=""
39
-
40
- # 規則 1:當前在 dev 或 qa 分支,直接刪除所有不合規 tag
41
- if [ "$BRANCH" = "dev" ] || [ "$BRANCH" = "qa" ]; then
42
- SHOULD_DELETE=true
43
- REASON="on $BRANCH branch"
23
+ # 遠端本來就沒有此 tag → 視為成功
24
+ case "$ERR" in
25
+ *"remote ref does not exist"*|*"unable to delete"*"remote ref does not exist"*)
26
+ return 0
27
+ ;;
28
+ esac
29
+ echo " ⚠ 遠端 tag $TAG 刪除失敗,跳過本地刪除:$ERR" >&2
30
+ return 1
31
+ }
32
+
33
+ # 安全刪除:先刪遠端,遠端成功才刪本地
34
+ safe_delete_tag() {
35
+ TAG=$1
36
+ REASON=$2
37
+ echo "刪除 tag $TAG($REASON)"
38
+ if delete_remote_tag "$TAG"; then
39
+ git tag -d "$TAG"
44
40
  fi
41
+ }
45
42
 
46
- # 規則 2:該 tag 的 commit 不屬於任何分支(孤立的 commit)
47
- if [ "$SHOULD_DELETE" = false ]; then
48
- BRANCHES=$(git branch -a --contains "$TAG" 2>/dev/null)
43
+ TAGS=$(git tag -l | grep -vE "$PATTERN")
44
+ if [ -n "$TAGS" ]; then
45
+ echo "檢查不符合規範的 tag"
46
+ for TAG in $TAGS; do
47
+ TAG_COMMIT=$(git rev-list -n 1 "$TAG" 2>/dev/null)
48
+ BRANCHES=$(git branch -a --contains "$TAG_COMMIT" 2>/dev/null)
49
49
  if [ -z "$BRANCHES" ]; then
50
- SHOULD_DELETE=true
51
- REASON="not on any branch"
50
+ safe_delete_tag "$TAG" "commit 不屬於任何分支"
51
+ elif git merge-base --is-ancestor "$TAG_COMMIT" origin/master 2>/dev/null; then
52
+ safe_delete_tag "$TAG" "commit 存在於 origin/master"
53
+ else
54
+ echo "跳過 tag $TAG(commit 在其他分支上)"
52
55
  fi
53
- fi
54
-
55
- # 規則 3:該 tag 的 commit 已合併進 master(代表該 tag 已無保留必要)
56
- if [ "$SHOULD_DELETE" = false ]; then
57
- if git merge-base --is-ancestor "$TAG" master 2>/dev/null; then
58
- SHOULD_DELETE=true
59
- REASON="merged into master"
60
- fi
61
- fi
62
-
63
- # 執行刪除:先刪遠端再刪本地,遠端刪除失敗不中斷流程
64
- if [ "$SHOULD_DELETE" = true ]; then
65
- echo "Deleting tag $TAG ($REASON)"
66
- git push origin --delete "$TAG" --no-verify 2>/dev/null || true
67
- git tag -d "$TAG"
68
- else
69
- echo "Keeping tag $TAG"
70
- fi
71
- done
56
+ done
57
+ else
58
+ echo "未發現不符合規範的 tag"
59
+ fi
@@ -486,7 +486,8 @@ export default function (request) {
486
486
  affiliateCode,
487
487
  nickname,
488
488
  }
489
- sentry?.captureMessage(JSON.stringify(messages))
489
+
490
+ sentry?.captureMessage(`[Auth] RedirectTo3Party Data: ${JSON.stringify(messages)}`, { level: 'info' })
490
491
 
491
492
  const referralObj = {}
492
493
  if (![undefined, 'undefined', null, 'null'].includes(affiliateCode)) {
@@ -56,8 +56,9 @@ export default function (request, context) {
56
56
  target: 'calculated',
57
57
  actions: 'setCalculation',
58
58
  },
59
+ // 計算失敗回到 loaded,避免進入 calculated 造成 UI 與 state 不一致
59
60
  onError: {
60
- target: 'calculated',
61
+ target: 'loaded',
61
62
  },
62
63
  },
63
64
  },
@@ -167,8 +168,10 @@ export default function (request, context) {
167
168
  setAmount: assign((context, event) => {
168
169
  // 現金網可自由填額度,grandTotalEnable 欄位感覺不再需要?
169
170
  if (context.selectedCrypto?.grandTotalEnable === 1) {
171
+ // 累加模式:用 Math.max 確保累加結果不低於 0
172
+ const result = preciseAdd(`${parseFloat(context.selectedAmount || 0)}`, `${parseFloat(event.data || '0')}`)
170
173
  return {
171
- selectedAmount: preciseAdd(`${parseFloat(context.selectedAmount || 0)}`, `${parseFloat(event.data)}`),
174
+ selectedAmount: Math.max(result, 0),
172
175
  }
173
176
  } else {
174
177
  return { selectedAmount: event.data }
@@ -231,9 +234,17 @@ export default function (request, context) {
231
234
  const { selectedCrypto, selectedAmount } = context
232
235
  return selectedCrypto && selectedAmount && selectedCrypto.minimum <= +selectedAmount && +selectedAmount <= selectedCrypto.maximum
233
236
  },
237
+ // 提交前最後一道 guard:重新驗證 amount 的合法性(與 isCalculable 同等嚴格)
234
238
  isSubmittable: (context, event) => {
235
239
  const { selectedCrypto, selectedAmount, calculation } = context
236
- return selectedCrypto && selectedAmount && calculation
240
+ return (
241
+ selectedCrypto &&
242
+ selectedAmount &&
243
+ +selectedAmount > 0 &&
244
+ selectedCrypto.minimum <= +selectedAmount &&
245
+ +selectedAmount <= selectedCrypto.maximum &&
246
+ calculation
247
+ )
237
248
  },
238
249
  },
239
250
  services: {
@@ -250,10 +261,15 @@ export default function (request, context) {
250
261
  },
251
262
  submitDeposit: async (context, event) => {
252
263
  const { selectedCrypto, selectedAmount, sourceAddress, promotion } = context
264
+ // 防禦性檢查:將 amount 轉為數字型別,並驗證範圍合法性,避免非法金額送出 API
265
+ const amount = +selectedAmount
266
+ if (!amount || amount <= 0 || amount < selectedCrypto.minimum || amount > selectedCrypto.maximum) {
267
+ throw new Error('INVALID_AMOUNT')
268
+ }
253
269
  return await request.send(
254
270
  payment.submitDepositTransactionCrypto({
255
271
  method: selectedCrypto.method,
256
- amount: selectedAmount,
272
+ amount: amount,
257
273
  cryptoCurrency: selectedCrypto.channel,
258
274
  cryptoNetwork: selectedCrypto.networkCode,
259
275
  sourceAddress: sourceAddress,
@@ -465,8 +465,10 @@ export default function (request) {
465
465
  const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name, gameName } = context.switchGame
466
466
  return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name, gameName } }
467
467
  }),
468
+ // 頁面刷新或深層連結時,event.data.walletType 可能為 undefined/null
469
+ // 使用 ?? 確保不會覆蓋 context 中已有的 walletType,避免後端收到 selectedWalletType=null
468
470
  setWalletType: assign((context, event) => {
469
- return { walletType: event.data.walletType }
471
+ return { walletType: event.data.walletType ?? context.walletType }
470
472
  }),
471
473
  setLang: assign((context, event) => {
472
474
  const lang = event.data.locale.replace('-', '_')
@@ -638,9 +640,9 @@ export default function (request) {
638
640
  }
639
641
  },
640
642
  connectGame: async (context, event) => {
641
- // [防呆] 確保有 providerId 和 gameId
643
+ // [防呆] 確保有 providerId 和 gameId(含字串 "null"/"undefined" 檢查)
642
644
  const { providerId, gameId } = context.game || {}
643
- if (!providerId || !gameId) {
645
+ if (!providerId || !gameId || providerId === 'null' || providerId === 'undefined' || gameId === 'null' || gameId === 'undefined') {
644
646
  return
645
647
  }
646
648
  const returnProviders = ['RSG', 'KP', 'EPICWIN', 'AMBSLOT', 'SEXY_VENUS', 'SEXY_SEXYBCRT', 'PG', 'NPG']
@@ -654,7 +656,7 @@ export default function (request) {
654
656
  is_demo: false,
655
657
  is_mobile: isMobile === 'mobile' ? 'y' : null,
656
658
  lang,
657
- selected_wallet_type: walletType,
659
+ selected_wallet_type: walletType || null, // 統一 undefined → null,確保後端收到一致的值
658
660
  return_url: returnProviders.includes(providerId)
659
661
  ? `${window.location.origin}${context.base}return`
660
662
  : window.location.href?.split('?')?.[0], // For providers to return.
@@ -216,7 +216,8 @@ export default function (request) {
216
216
  ],
217
217
  affiliateCode,
218
218
  }
219
- sentry.captureMessage(JSON.stringify(messages))
219
+
220
+ sentry?.captureMessage(`[SignUp] Authenticate Data: ${JSON.stringify(messages)}`, { level: 'info' })
220
221
 
221
222
  const referralObj = {}
222
223
  if (![undefined, 'undefined', null, 'null'].includes(affiliateCode)) {
@@ -124,14 +124,6 @@ export default function (request) {
124
124
  }),
125
125
  setConnectError: assign((context, event) => {
126
126
  const error = event.data
127
- const { analytics, connectError } = context
128
- if (connectError === null) {
129
- sentry?.captureException(`[socket] connectError ${error}`)
130
- analytics?.push({
131
- event: 'connect_error',
132
- message: error,
133
- })
134
- }
135
127
  return {
136
128
  connectError: error,
137
129
  connectStatus: 0, // 0: 未連線, 1: 連線中, 2: 連線成功