@jetthai/cuora 1.1.432 → 1.1.434-dev.0
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/.claude/commands/auto-git-flow.md +5 -12
- package/.claude/commands/commit-push.md +15 -4
- package/.claude/commands/create-branch.md +142 -0
- package/.claude/commands/sync-ai-prompts.md +88 -1
- package/.claude/settings.local.json +3 -1
- package/.github/copilot-instructions.md +551 -399
- package/.husky/pre-push +11 -2
- package/.prettierignore +2 -1
- package/AGENTS.md +551 -399
- package/AI_PROMPT_SOURCE.md +726 -130
- package/CHANGELOG.md +158 -8
- package/CLAUDE.md +551 -399
- package/GEMINI.md +551 -399
- package/README.md +35 -107
- package/package.json +1 -1
- package/prepare-for-pr/JT-1776243420.md +85 -0
- package/scripts/auto-version.js +1 -0
- package/scripts/check-version.sh +36 -0
- package/scripts/clean-tags.sh +48 -60
- package/src/api/activity.js +5 -0
- package/src/machine/auth.js +21 -1
- package/src/machine/deposit/crypto_bank_cash.js +1 -0
- package/src/machine/deposit/crypto_way_cash.js +1 -0
- package/src/machine/game_v2_1.js +14 -8
- package/src/machine/user_sign_up.js +2 -1
- package/src/machine/websocket.js +0 -8
package/README.md
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
# @jetthai/cuora
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ESM JavaScript 函式庫,透過 XState v4 狀態機整合 API 呼叫與業務邏輯,服務於線上遊戲平台。處理認證、支付(存款/提款)、遊戲管理、活動及即時 WebSocket 通訊。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- **進入點**:`./src/index.js`
|
|
7
|
-
- **無建置步驟**:無 Webpack/Rollup/TypeScript,無測試框架,無 Linter
|
|
8
|
-
- **程式碼格式化**:Prettier(不加分號、單引號、2 空格縮排、150 字元行寬、ES5 尾隨逗號)
|
|
9
|
-
- **Pre-commit Hook**:Husky 執行 `npm run format && git add .`
|
|
5
|
+
設計用於 Nuxt.js 客戶端應用程式(`ssr: false`)。
|
|
10
6
|
|
|
11
7
|
## Installation
|
|
12
8
|
|
|
@@ -34,18 +30,6 @@ export default {
|
|
|
34
30
|
import { api, machine, Request, Config, util, constant, storage } from '@jetthai/cuora'
|
|
35
31
|
```
|
|
36
32
|
|
|
37
|
-
### 模組匯出
|
|
38
|
-
|
|
39
|
-
| 匯出名稱 | 說明 |
|
|
40
|
-
| ---------- | ------------------------------------------------------- |
|
|
41
|
-
| `api` | 11 個 API 模組的聚合物件 |
|
|
42
|
-
| `machine` | 91 個 XState 狀態機工廠函式的聚合物件 |
|
|
43
|
-
| `Request` | Axios 封裝類別(攔截器、Token、版本控制) |
|
|
44
|
-
| `Config` | 設定類別(apiURL、clientId、appSecret 等) |
|
|
45
|
-
| `util` | 工具函式(`getDeviceToken`、`getDeviceTokenWithRetry`) |
|
|
46
|
-
| `constant` | 遊戲類型常數(16 種遊戲類型) |
|
|
47
|
-
| `storage` | localStorage 封裝(支援 TTL/過期) |
|
|
48
|
-
|
|
49
33
|
### Config
|
|
50
34
|
|
|
51
35
|
初始化 API 設定:
|
|
@@ -142,30 +126,30 @@ constant.LIVE
|
|
|
142
126
|
constant.SPORT
|
|
143
127
|
```
|
|
144
128
|
|
|
145
|
-
## Dependencies
|
|
146
|
-
|
|
147
|
-
| 套件 | 版本 | 角色 | 使用位置 |
|
|
148
|
-
| ------------------ | ---------- | ---------------------------------------------------------------------------------- | ---------------------- |
|
|
149
|
-
| `xstate` | `^4.25.0` | 狀態機核心框架 | 所有 `machine/` 檔案 |
|
|
150
|
-
| `socket.io-client` | `^4.8.3` | WebSocket 即時通訊 | `machine/websocket.js` |
|
|
151
|
-
| `lodash` | `^4.17.21` | 工具函式(`pickBy`、`uniqBy`、`findLastIndex`、`padStart`、`toNumber`、`isEqual`) | 分散於 12 個檔案 |
|
|
152
|
-
| `ua-parser-js` | `^0.7.34` | 使用者代理解析(行動裝置偵測) | `machine/common.js` |
|
|
153
|
-
| `url-join` | `^4.0.1` | URL 路徑安全組合 | `request/config.js` |
|
|
154
|
-
| `universal-cookie` | `^4.0.4` | Cookie 操作 | `machine/common.js` |
|
|
155
|
-
|
|
156
129
|
## Architecture
|
|
157
130
|
|
|
158
131
|
```
|
|
159
132
|
src/
|
|
160
133
|
├── index.js # 進入點
|
|
161
134
|
├── api/ # API 請求描述物件
|
|
135
|
+
│ ├── auth.js
|
|
136
|
+
│ ├── account.js
|
|
137
|
+
│ ├── activity.js
|
|
138
|
+
│ ├── common.js
|
|
139
|
+
│ ├── form.js
|
|
140
|
+
│ ├── game.js
|
|
141
|
+
│ ├── mailbox.js
|
|
142
|
+
│ ├── otp.js
|
|
143
|
+
│ ├── payment.js
|
|
144
|
+
│ ├── ranking.js
|
|
145
|
+
│ └── user.js
|
|
162
146
|
├── machine/ # XState v4 狀態機
|
|
163
147
|
│ ├── auth.js # 登入/註冊流程
|
|
164
148
|
│ ├── common.js # 網站設定、UA、聯盟行銷
|
|
165
149
|
│ ├── websocket.js # Socket.IO 即時通訊
|
|
166
|
-
│ ├── deposit/ # 存款狀態機
|
|
167
|
-
│ ├── withdraw/ # 提款狀態機
|
|
168
|
-
│ └── activity/ # 活動狀態機
|
|
150
|
+
│ ├── deposit/ # 存款狀態機 (22+)
|
|
151
|
+
│ ├── withdraw/ # 提款狀態機 (4)
|
|
152
|
+
│ └── activity/ # 活動狀態機 (24+)
|
|
169
153
|
├── request/
|
|
170
154
|
│ ├── config.js # Config 設定類別
|
|
171
155
|
│ └── request.js # Axios 封裝 + 攔截器
|
|
@@ -196,88 +180,32 @@ npm run release:qa
|
|
|
196
180
|
|
|
197
181
|
程式碼風格由 Prettier 管理(無分號、單引號、尾隨逗號 ES5、2 空格縮排、150 字元行寬),Husky pre-commit hook 會在每次提交時自動格式化。
|
|
198
182
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
### 分支策略
|
|
202
|
-
|
|
203
|
-
| 分支 | 用途 | 版本格式 |
|
|
204
|
-
| -------- | -------- | -------------------------- |
|
|
205
|
-
| `master` | 正式發佈 | `x.y.z`(如 `1.1.430`) |
|
|
206
|
-
| `dev` | 開發測試 | `{master_version}-dev.{N}` |
|
|
207
|
-
| `qa` | QA 測試 | `{master_version}-qa.{N}` |
|
|
208
|
-
|
|
209
|
-
### 腳本權責分離
|
|
210
|
-
|
|
211
|
-
dev/qa 分支的自動版本發佈由三個腳本各司其職:
|
|
183
|
+
### dev / qa 分支版本發佈
|
|
212
184
|
|
|
213
|
-
|
|
214
|
-
| ------------------------------------ | --------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
215
|
-
| `scripts/auto-version.sh` | **流程控制**(Shell) | pre-push hook 入口。依序呼叫版號計算 → standard-version → push + publish,最後 `exit 1` 中止原始 push |
|
|
216
|
-
| `scripts/auto-version.js` | **版號計算**(ESM) | 純計算邏輯。讀取 master 版本、比對當前版本與 git log 歷史(historyMax 防倒退),stdout 輸出新版號 |
|
|
217
|
-
| `scripts/branch-auto-npm-publish.js` | **推送與發佈**(ESM) | 執行 `git push --follow-tags` 推送至遠端,再 `npm publish --tag {branch}` 發佈至 npm registry |
|
|
218
|
-
|
|
219
|
-
### dev / qa 分支自動版本流程
|
|
220
|
-
|
|
221
|
-
當開發者在 `dev` 或 `qa` 分支執行 `git push` 時,Husky `pre-push` hook 觸發以下流程:
|
|
185
|
+
在 `dev` 或 `qa` 分支執行 `git push` 時,Husky `pre-push` hook 會自動觸發三階段流程:
|
|
222
186
|
|
|
223
187
|
```
|
|
224
|
-
git push
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
│ └─ sh scripts/auto-version.sh "$1" # 流程入口(傳入 remote name)
|
|
229
|
-
│
|
|
230
|
-
├─ auto-version.sh 流程控制
|
|
231
|
-
│ │
|
|
232
|
-
│ ├─ ① node scripts/auto-version.js ← 版號計算
|
|
233
|
-
│ │ ├─ git show origin/master:package.json → 取得 master version(如 1.1.430)
|
|
234
|
-
│ │ │ └─ fallback: git show master:package.json
|
|
235
|
-
│ │ ├─ 讀取當前 package.json version
|
|
236
|
-
│ │ ├─ 從 currentVersion 推算下一編號
|
|
237
|
-
│ │ ├─ 掃描 git log 最近 50 筆 commit(historyMax 防倒退)
|
|
238
|
-
│ │ └─ stdout 輸出新版號(如 1.1.430-dev.3)
|
|
239
|
-
│ │ └─ 若版號無變更 → 靜默退出,auto-version.sh 跳過後續步驟
|
|
240
|
-
│ │
|
|
241
|
-
│ ├─ ② npx standard-version --release-as {version}
|
|
242
|
-
│ │ └─ 更新 CHANGELOG.md + 建立 commit + 建立 git tag
|
|
243
|
-
│ │
|
|
244
|
-
│ ├─ ③ node scripts/branch-auto-npm-publish.js ← 推送與發佈
|
|
245
|
-
│ │ ├─ git push --follow-tags origin dev
|
|
246
|
-
│ │ └─ npm publish --tag dev
|
|
247
|
-
│ │
|
|
248
|
-
│ └─ exit 1(中止原始 push,因為 script 已完成推送)
|
|
249
|
-
│
|
|
250
|
-
└─ 終端顯示 push 失敗,但實際發佈已成功(以 Released x.x.x 訊息為準)
|
|
188
|
+
git push → auto-version.sh(流程控制)
|
|
189
|
+
├─ ① auto-version.js → 計算版號(含 historyMax 防倒退)
|
|
190
|
+
├─ ② standard-version → 更新 CHANGELOG + commit + tag
|
|
191
|
+
└─ ③ branch-auto-npm-publish.js → git push + npm publish
|
|
251
192
|
```
|
|
252
193
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
**基本遞增**:
|
|
256
|
-
|
|
257
|
-
- master 為 `1.1.430` → dev 第一次 push:`1.1.430-dev.0`
|
|
258
|
-
- 再次 push:`1.1.430-dev.1`、`1.1.430-dev.2`、...
|
|
259
|
-
- master 升版至 `1.1.431` → dev 重置為 `1.1.431-dev.0`
|
|
260
|
-
- qa 分支同理:`1.1.430-qa.0`、`1.1.430-qa.1`、...
|
|
194
|
+
**腳本權責:**
|
|
261
195
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
currentVersion = "1.0.9-dev.20" ← merge 後被覆蓋
|
|
268
|
-
git log 發現歷史有 "1.1.430-dev.4"
|
|
269
|
-
→ historyMax = 4, nextNum = 5
|
|
270
|
-
→ 新版號 = "1.1.430-dev.5"(而非從 0 重新開始)
|
|
271
|
-
```
|
|
196
|
+
| 腳本 | 職責 | 說明 |
|
|
197
|
+
| ------------------------------------ | ---------- | --------------------------------------------------------- |
|
|
198
|
+
| `scripts/auto-version.sh` | 流程控制 | pre-push 入口,串接版號計算 → standard-version → 發佈 |
|
|
199
|
+
| `scripts/auto-version.js` | 版號計算 | 讀取 master 版本 + 掃描 git log 防倒退,stdout 輸出新版號 |
|
|
200
|
+
| `scripts/branch-auto-npm-publish.js` | 推送與發佈 | `git push --follow-tags` + `npm publish --tag {branch}` |
|
|
272
201
|
|
|
273
|
-
|
|
202
|
+
**版本號規則:**
|
|
274
203
|
|
|
275
|
-
|
|
|
276
|
-
|
|
|
277
|
-
|
|
|
278
|
-
|
|
|
279
|
-
|
|
|
280
|
-
|
|
|
281
|
-
| `post-merge` | `.husky/post-merge` | (保留,目前無額外操作) |
|
|
204
|
+
| 情境 | 範例 |
|
|
205
|
+
| ------------------------------------ | ------------------------------------- |
|
|
206
|
+
| master 為 `1.1.425`,dev 第一次 push | `1.1.425-dev.0` |
|
|
207
|
+
| dev 再次 push | `1.1.425-dev.1`、`1.1.425-dev.2`、... |
|
|
208
|
+
| master 升版至 `1.1.426` 後 | dev 重置為 `1.1.426-dev.0` |
|
|
209
|
+
| qa 分支 | `1.1.425-qa.0`、`1.1.425-qa.1`、... |
|
|
282
210
|
|
|
283
211
|
> **注意**:`pre-push` hook 完成推送後會以 `exit 1` 中止原始 push(因為已推送完成),終端會顯示 push 失敗訊息,但實際發佈已成功。以 `Released x.x.x on {branch}` 訊息為準。
|
package/package.json
CHANGED
|
@@ -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)
|
package/scripts/auto-version.js
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
|
|
3
|
+
# 檢查 package.json 的 version 是否符合 X.Y.Z 規範
|
|
4
|
+
# 不符合則回退到 master 上最近一個符合規範的 tag (vX.Y.Z) 對應版號,並自動 commit
|
|
5
|
+
# 找不到合規 tag 則 exit 1 中止流程
|
|
6
|
+
|
|
7
|
+
PATTERN="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
|
|
8
|
+
TAG_PATTERN="^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$"
|
|
9
|
+
|
|
10
|
+
CURRENT_VERSION=$(node -p "require('./package.json').version")
|
|
11
|
+
|
|
12
|
+
if echo "$CURRENT_VERSION" | grep -Eq "$PATTERN"; then
|
|
13
|
+
echo "Version $CURRENT_VERSION is valid, skipping."
|
|
14
|
+
exit 0
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
echo "Invalid version detected: $CURRENT_VERSION"
|
|
18
|
+
|
|
19
|
+
# 從 HEAD 可達的 tag 中,依 commit 時間找最近一個符合 vX.Y.Z 的 tag
|
|
20
|
+
LATEST_TAG=$(git tag -l 'v*' --merged HEAD --sort=-committerdate | grep -E "$TAG_PATTERN" | head -1)
|
|
21
|
+
|
|
22
|
+
if [ -z "$LATEST_TAG" ]; then
|
|
23
|
+
echo "ERROR: No valid vX.Y.Z tag found on current history. Aborting." >&2
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
FALLBACK_VERSION=${LATEST_TAG#v}
|
|
28
|
+
echo "Reverting version to latest valid tag: $LATEST_TAG ($FALLBACK_VERSION)"
|
|
29
|
+
|
|
30
|
+
npm pkg set version="$FALLBACK_VERSION"
|
|
31
|
+
|
|
32
|
+
git add package.json
|
|
33
|
+
git commit --no-verify -m "chore: revert invalid version to $FALLBACK_VERSION"
|
|
34
|
+
|
|
35
|
+
echo "Version reverted and committed. Re-run your push."
|
|
36
|
+
exit 1
|
package/scripts/clean-tags.sh
CHANGED
|
@@ -1,71 +1,59 @@
|
|
|
1
1
|
#!/usr/bin/env sh
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
3
|
+
# 刪除不符合規範格式的本地與遠端 tag
|
|
4
|
+
# 規範格式:v1.2.3(例如 v0.1.0、v1.12.123)
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
# 1.
|
|
8
|
-
# 2.
|
|
9
|
-
# 3.
|
|
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
|
-
|
|
12
|
+
# 確保遠端 ref 為最新,避免本地 master 落後造成誤判
|
|
13
|
+
git fetch origin --prune --tags
|
|
14
14
|
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
-
|
|
51
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
package/src/api/activity.js
CHANGED
|
@@ -120,4 +120,9 @@ export default {
|
|
|
120
120
|
method: 'post',
|
|
121
121
|
params: { startDate, endDate, appSecret },
|
|
122
122
|
}),
|
|
123
|
+
getMissionHistory: ({ activityNo, appSecret }) => ({
|
|
124
|
+
url: 'activities/mission-history',
|
|
125
|
+
method: 'get',
|
|
126
|
+
params: { activityNo, appSecret },
|
|
127
|
+
}),
|
|
123
128
|
}
|
package/src/machine/auth.js
CHANGED
|
@@ -476,6 +476,9 @@ export default function (request) {
|
|
|
476
476
|
|
|
477
477
|
const affiliateCode = storage.get('ac')
|
|
478
478
|
const nickname = storage.get('nk')
|
|
479
|
+
const phone = storage.get('tp_phone')
|
|
480
|
+
const countryCode = storage.get('tp_countryCode')
|
|
481
|
+
const email = storage.get('tp_email')
|
|
479
482
|
const messages = {
|
|
480
483
|
url: window.location.href,
|
|
481
484
|
channelOrders: [
|
|
@@ -486,7 +489,8 @@ export default function (request) {
|
|
|
486
489
|
affiliateCode,
|
|
487
490
|
nickname,
|
|
488
491
|
}
|
|
489
|
-
|
|
492
|
+
|
|
493
|
+
sentry?.captureMessage(`[Auth] RedirectTo3Party Data: ${JSON.stringify(messages)}`, { level: 'info' })
|
|
490
494
|
|
|
491
495
|
const referralObj = {}
|
|
492
496
|
if (![undefined, 'undefined', null, 'null'].includes(affiliateCode)) {
|
|
@@ -497,9 +501,25 @@ export default function (request) {
|
|
|
497
501
|
referralObj.nick_name = nickname
|
|
498
502
|
}
|
|
499
503
|
|
|
504
|
+
if (![undefined, 'undefined', null, 'null'].includes(phone)) {
|
|
505
|
+
referralObj.phone = phone
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
if (![undefined, 'undefined', null, 'null'].includes(countryCode)) {
|
|
509
|
+
referralObj.countryCode = countryCode
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
if (![undefined, 'undefined', null, 'null'].includes(email)) {
|
|
513
|
+
referralObj.email = email
|
|
514
|
+
}
|
|
515
|
+
|
|
500
516
|
referralObj.channel = storage.get('channel') || defaultChannel || channel
|
|
501
517
|
referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel
|
|
502
518
|
|
|
519
|
+
storage.remove('tp_phone')
|
|
520
|
+
storage.remove('tp_countryCode')
|
|
521
|
+
storage.remove('tp_email')
|
|
522
|
+
|
|
503
523
|
const fullURL = request.config.fullURL
|
|
504
524
|
|
|
505
525
|
const redirectURL = urljoin(
|
|
@@ -164,6 +164,7 @@ export default function (request, context) {
|
|
|
164
164
|
selectedCrypto: defaultCrypto[0],
|
|
165
165
|
selectedAddress: defaultAddresses[0],
|
|
166
166
|
options: cryptoBank.optional,
|
|
167
|
+
selectedAmount: max(context.promotion?.minimumAmount, defaultCrypto[0]?.minimum, context.selectedAmount, 0),
|
|
167
168
|
}
|
|
168
169
|
}),
|
|
169
170
|
setCrypto: assign((context, event) => {
|
|
@@ -153,6 +153,7 @@ export default function (request, context) {
|
|
|
153
153
|
cryptos,
|
|
154
154
|
selectedCrypto: defaultCrypto,
|
|
155
155
|
options: defaultCrypto?.optional || [],
|
|
156
|
+
selectedAmount: max(context.promotion?.minimumAmount, defaultCrypto?.minimum, context.selectedAmount, 0),
|
|
156
157
|
}
|
|
157
158
|
}),
|
|
158
159
|
setCrypto: assign((context, event) => {
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -53,6 +53,7 @@ export default function (request) {
|
|
|
53
53
|
gameWalletType: null,
|
|
54
54
|
switchGame: null,
|
|
55
55
|
isPlaying: false,
|
|
56
|
+
entry: null,
|
|
56
57
|
},
|
|
57
58
|
states: {
|
|
58
59
|
flow: {
|
|
@@ -85,15 +86,15 @@ export default function (request) {
|
|
|
85
86
|
},
|
|
86
87
|
ENTER_GAME: {
|
|
87
88
|
target: 'connecting',
|
|
88
|
-
actions: ['setGameInfo', 'setLang', 'setWalletType'],
|
|
89
|
+
actions: ['setGameInfo', 'setLang', 'setEntry', 'setWalletType'],
|
|
89
90
|
},
|
|
90
91
|
DEMO_GAME: {
|
|
91
92
|
target: 'demoGame',
|
|
92
|
-
actions: ['setGameInfo', 'setLang', 'setSite'],
|
|
93
|
+
actions: ['setGameInfo', 'setLang', 'setEntry', 'setSite'],
|
|
93
94
|
},
|
|
94
95
|
MENU_ENTER_GAME: {
|
|
95
96
|
target: 'connecting',
|
|
96
|
-
actions: ['setGameInfo', 'setLang', 'setWalletType'],
|
|
97
|
+
actions: ['setGameInfo', 'setLang', 'setEntry', 'setWalletType'],
|
|
97
98
|
},
|
|
98
99
|
UPDATE: {
|
|
99
100
|
target: 'updating',
|
|
@@ -226,14 +227,14 @@ export default function (request) {
|
|
|
226
227
|
},
|
|
227
228
|
MENU_ENTER_GAME: {
|
|
228
229
|
target: 'connectSwitching',
|
|
229
|
-
actions: ['setSwitch', 'setLang', 'setWalletType'],
|
|
230
|
+
actions: ['setSwitch', 'setLang', 'setEntry', 'setWalletType'],
|
|
230
231
|
},
|
|
231
232
|
ENTER_GAME_PAUSE: {
|
|
232
233
|
actions: ['setIsPlaying', 'resetContent', 'resetSHA'],
|
|
233
234
|
},
|
|
234
235
|
ENTER_GAME: {
|
|
235
236
|
target: 'connecting',
|
|
236
|
-
actions: ['setGameInfo', 'setLang', 'setWalletType'],
|
|
237
|
+
actions: ['setGameInfo', 'setLang', 'setEntry', 'setWalletType'],
|
|
237
238
|
},
|
|
238
239
|
},
|
|
239
240
|
},
|
|
@@ -247,7 +248,7 @@ export default function (request) {
|
|
|
247
248
|
},
|
|
248
249
|
ENTER_GAME: {
|
|
249
250
|
target: 'connecting',
|
|
250
|
-
actions: ['setGameInfo', 'setLang', 'setWalletType'],
|
|
251
|
+
actions: ['setGameInfo', 'setLang', 'setEntry', 'setWalletType'],
|
|
251
252
|
},
|
|
252
253
|
},
|
|
253
254
|
},
|
|
@@ -474,6 +475,9 @@ export default function (request) {
|
|
|
474
475
|
const lang = event.data.locale.replace('-', '_')
|
|
475
476
|
return { lang }
|
|
476
477
|
}),
|
|
478
|
+
setEntry: assign((context, event) => {
|
|
479
|
+
return { entry: event?.data?.entrySource }
|
|
480
|
+
}),
|
|
477
481
|
setSite: assign((context, event) => {
|
|
478
482
|
const site = event.data.site
|
|
479
483
|
return { site }
|
|
@@ -646,7 +650,7 @@ export default function (request) {
|
|
|
646
650
|
return
|
|
647
651
|
}
|
|
648
652
|
const returnProviders = ['RSG', 'KP', 'EPICWIN', 'AMBSLOT', 'SEXY_VENUS', 'SEXY_SEXYBCRT', 'PG', 'NPG']
|
|
649
|
-
const { lang, isMobile, walletType } = context
|
|
653
|
+
const { lang, entry, isMobile, walletType } = context
|
|
650
654
|
const { gameTypeId, mappingId } = context.game
|
|
651
655
|
const params = {
|
|
652
656
|
provider_id: providerId,
|
|
@@ -656,6 +660,7 @@ export default function (request) {
|
|
|
656
660
|
is_demo: false,
|
|
657
661
|
is_mobile: isMobile === 'mobile' ? 'y' : null,
|
|
658
662
|
lang,
|
|
663
|
+
entry_source: entry || 'Other',
|
|
659
664
|
selected_wallet_type: walletType || null, // 統一 undefined → null,確保後端收到一致的值
|
|
660
665
|
return_url: returnProviders.includes(providerId)
|
|
661
666
|
? `${window.location.origin}${context.base}return`
|
|
@@ -665,7 +670,7 @@ export default function (request) {
|
|
|
665
670
|
return { type, gameToken, gameHtml, gameURL: redirect_url, gameWalletType: wallet_type }
|
|
666
671
|
},
|
|
667
672
|
demoGame: async (context, event) => {
|
|
668
|
-
const { lang, site, isMobile, game } = context
|
|
673
|
+
const { lang, entry, site, isMobile, game } = context
|
|
669
674
|
const { providerId, gameId, gameTypeId, mappingId } = context.game
|
|
670
675
|
const params = {
|
|
671
676
|
site,
|
|
@@ -675,6 +680,7 @@ export default function (request) {
|
|
|
675
680
|
mapping_id: mappingId,
|
|
676
681
|
is_mobile: isMobile === 'mobile' ? 'y' : null,
|
|
677
682
|
lang,
|
|
683
|
+
entry_source: entry || 'Other',
|
|
678
684
|
appSecret,
|
|
679
685
|
}
|
|
680
686
|
const { type, redirect_url, gameToken, gameHtml, is_demo } = await request.send(api.demoGame(params))
|
|
@@ -216,7 +216,8 @@ export default function (request) {
|
|
|
216
216
|
],
|
|
217
217
|
affiliateCode,
|
|
218
218
|
}
|
|
219
|
-
|
|
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)) {
|
package/src/machine/websocket.js
CHANGED
|
@@ -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: 連線成功
|