@jetthai/cuora 1.1.449 → 1.1.451-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.
- package/.claude/commands/auto-git-flow.md +5 -12
- package/.claude/commands/commit-push.md +15 -4
- package/.claude/commands/sync-ai-prompts.md +88 -1
- package/.claude/settings.local.json +3 -1
- package/.github/copilot-instructions.md +553 -395
- package/.husky/post-checkout +3 -3
- package/.husky/pre-push +1 -1
- package/.prettierignore +2 -1
- package/AGENTS.md +553 -395
- package/AI_PROMPT_SOURCE.md +664 -126
- package/CHANGELOG.md +275 -26
- package/CLAUDE.md +553 -395
- package/GEMINI.md +553 -395
- package/README.md +40 -137
- package/package.json +1 -1
- package/prepare-for-pr/JT-1776243420.md +85 -0
- package/scripts/auto-version.js +1 -0
- package/src/api/payment.js +1 -1
- package/src/api/user.js +12 -0
- package/src/machine/auth.js +3 -1
- package/src/machine/auth_otp_v3.js +11 -4
- package/src/machine/deposit/crypto_bank_cash.js +8 -4
- package/src/machine/deposit/crypto_way_cash.js +6 -2
- package/src/machine/deposit/direct_cash.js +8 -0
- package/src/machine/deposit/loadcard_cash.js +9 -5
- package/src/machine/deposit/manual_cash.js +11 -1
- package/src/machine/deposit/qrcode_cash.js +7 -4
- package/src/machine/deposit/virtual_bank_cash.js +7 -1
- package/src/machine/user_sign_up.js +39 -4
- package/src/request/request.js +3 -1
package/README.md
CHANGED
|
@@ -1,34 +1,8 @@
|
|
|
1
1
|
# @jetthai/cuora
|
|
2
2
|
|
|
3
|
-
|
|
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 .`
|
|
10
|
-
|
|
11
|
-
## 目錄
|
|
12
|
-
|
|
13
|
-
- [Installation](#installation)
|
|
14
|
-
- [Setup](#setup)
|
|
15
|
-
- [Usage](#usage)
|
|
16
|
-
- [模組匯出](#模組匯出)
|
|
17
|
-
- [Config](#config)
|
|
18
|
-
- [Request](#request)
|
|
19
|
-
- [API](#api)
|
|
20
|
-
- [Machine](#machine)
|
|
21
|
-
- [Utilities](#utilities)
|
|
22
|
-
- [Dependencies](#dependencies)
|
|
23
|
-
- [Architecture](#architecture)
|
|
24
|
-
- [Development](#development)
|
|
25
|
-
- [Git 分支版本發佈流程](#git-分支版本發佈流程)
|
|
26
|
-
- [分支策略](#分支策略)
|
|
27
|
-
- [腳本權責分離](#腳本權責分離)
|
|
28
|
-
- [dev / qa 分支自動版本流程](#dev--qa-分支自動版本流程)
|
|
29
|
-
- [版號計算規則](#版號計算規則)
|
|
30
|
-
- [Husky Hooks 總覽](#husky-hooks-總覽)
|
|
31
|
-
- [License](#license)
|
|
3
|
+
ESM JavaScript 函式庫,透過 XState v4 狀態機整合 API 呼叫與業務邏輯,服務於線上遊戲平台。處理認證、支付(存款/提款)、遊戲管理、活動及即時 WebSocket 通訊。
|
|
4
|
+
|
|
5
|
+
設計用於 Nuxt.js 客戶端應用程式(`ssr: false`)。
|
|
32
6
|
|
|
33
7
|
## Installation
|
|
34
8
|
|
|
@@ -56,18 +30,6 @@ export default {
|
|
|
56
30
|
import { api, machine, Request, Config, util, constant, storage } from '@jetthai/cuora'
|
|
57
31
|
```
|
|
58
32
|
|
|
59
|
-
### 模組匯出
|
|
60
|
-
|
|
61
|
-
| 匯出名稱 | 說明 |
|
|
62
|
-
| ---------- | ------------------------------------------------------- |
|
|
63
|
-
| `api` | 11 個 API 模組的聚合物件 |
|
|
64
|
-
| `machine` | 91 個 XState 狀態機工廠函式的聚合物件 |
|
|
65
|
-
| `Request` | Axios 封裝類別(攔截器、Token、版本控制) |
|
|
66
|
-
| `Config` | 設定類別(apiURL、clientId、appSecret 等) |
|
|
67
|
-
| `util` | 工具函式(`getDeviceToken`、`getDeviceTokenWithRetry`) |
|
|
68
|
-
| `constant` | 遊戲類型常數(16 種遊戲類型) |
|
|
69
|
-
| `storage` | localStorage 封裝(支援 TTL/過期) |
|
|
70
|
-
|
|
71
33
|
### Config
|
|
72
34
|
|
|
73
35
|
初始化 API 設定:
|
|
@@ -158,35 +120,36 @@ storage.set('key', value, ttl)
|
|
|
158
120
|
storage.get('key')
|
|
159
121
|
|
|
160
122
|
// 遊戲類型常數
|
|
161
|
-
constant.
|
|
162
|
-
constant.
|
|
163
|
-
constant.
|
|
123
|
+
constant.SLOT
|
|
124
|
+
constant.FISH
|
|
125
|
+
constant.LIVE
|
|
126
|
+
constant.SPORT
|
|
164
127
|
```
|
|
165
128
|
|
|
166
|
-
## Dependencies
|
|
167
|
-
|
|
168
|
-
| 套件 | 版本 | 角色 | 使用位置 |
|
|
169
|
-
| ------------------ | ---------- | ---------------------------------------------------------------------------------- | ---------------------- |
|
|
170
|
-
| `xstate` | `^4.25.0` | 狀態機核心框架 | 所有 `machine/` 檔案 |
|
|
171
|
-
| `socket.io-client` | `^4.8.3` | WebSocket 即時通訊 | `machine/websocket.js` |
|
|
172
|
-
| `lodash` | `^4.17.21` | 工具函式(`pickBy`、`uniqBy`、`findLastIndex`、`padStart`、`toNumber`、`isEqual`) | 分散於 12 個檔案 |
|
|
173
|
-
| `ua-parser-js` | `^0.7.34` | 使用者代理解析(行動裝置偵測) | `machine/common.js` |
|
|
174
|
-
| `url-join` | `^4.0.1` | URL 路徑安全組合 | `request/config.js` |
|
|
175
|
-
| `universal-cookie` | `^4.0.4` | Cookie 操作 | `machine/common.js` |
|
|
176
|
-
|
|
177
129
|
## Architecture
|
|
178
130
|
|
|
179
131
|
```
|
|
180
132
|
src/
|
|
181
133
|
├── index.js # 進入點
|
|
182
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
|
|
183
146
|
├── machine/ # XState v4 狀態機
|
|
184
147
|
│ ├── auth.js # 登入/註冊流程
|
|
185
148
|
│ ├── common.js # 網站設定、UA、聯盟行銷
|
|
186
149
|
│ ├── websocket.js # Socket.IO 即時通訊
|
|
187
|
-
│ ├── deposit/ # 存款狀態機
|
|
188
|
-
│ ├── withdraw/ # 提款狀態機
|
|
189
|
-
│ └── activity/ # 活動狀態機
|
|
150
|
+
│ ├── deposit/ # 存款狀態機 (22+)
|
|
151
|
+
│ ├── withdraw/ # 提款狀態機 (4)
|
|
152
|
+
│ └── activity/ # 活動狀態機 (24+)
|
|
190
153
|
├── request/
|
|
191
154
|
│ ├── config.js # Config 設定類別
|
|
192
155
|
│ └── request.js # Axios 封裝 + 攔截器
|
|
@@ -217,92 +180,32 @@ npm run release:qa
|
|
|
217
180
|
|
|
218
181
|
程式碼風格由 Prettier 管理(無分號、單引號、尾隨逗號 ES5、2 空格縮排、150 字元行寬),Husky pre-commit hook 會在每次提交時自動格式化。
|
|
219
182
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
### 分支策略
|
|
223
|
-
|
|
224
|
-
| 分支 | 用途 | 版本格式 |
|
|
225
|
-
| -------- | -------- | -------------------------- |
|
|
226
|
-
| `master` | 正式發佈 | `x.y.z`(如 `1.1.430`) |
|
|
227
|
-
| `dev` | 開發測試 | `{master_version}-dev.{N}` |
|
|
228
|
-
| `qa` | QA 測試 | `{master_version}-qa.{N}` |
|
|
229
|
-
|
|
230
|
-
### 腳本權責分離
|
|
231
|
-
|
|
232
|
-
dev/qa 分支的自動版本發佈由三個腳本各司其職:
|
|
233
|
-
|
|
234
|
-
| 腳本 | 職責 | 說明 |
|
|
235
|
-
| ------------------------------------ | --------------------- | ----------------------------------------------------------------------------------------------------- |
|
|
236
|
-
| `scripts/auto-version.sh` | **流程控制**(Shell) | pre-push hook 入口。依序呼叫版號計算 → standard-version → push + publish,最後 `exit 1` 中止原始 push |
|
|
237
|
-
| `scripts/auto-version.js` | **版號計算**(ESM) | 純計算邏輯。讀取 master 版本、比對當前版本與 git log 歷史(historyMax 防倒退),stdout 輸出新版號 |
|
|
238
|
-
| `scripts/branch-auto-npm-publish.js` | **推送與發佈**(ESM) | 執行 `git push --follow-tags` 推送至遠端,再 `npm publish --tag {branch}` 發佈至 npm registry |
|
|
183
|
+
### dev / qa 分支版本發佈
|
|
239
184
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
當開發者在 `dev` 或 `qa` 分支執行 `git push` 時,Husky `pre-push` hook 觸發以下流程:
|
|
185
|
+
在 `dev` 或 `qa` 分支執行 `git push` 時,Husky `pre-push` hook 會自動觸發三階段流程:
|
|
243
186
|
|
|
244
187
|
```
|
|
245
|
-
git push
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
│ └─ sh scripts/auto-version.sh "$1" # 流程入口(傳入 remote name)
|
|
250
|
-
│
|
|
251
|
-
├─ auto-version.sh 流程控制
|
|
252
|
-
│ │
|
|
253
|
-
│ ├─ ① node scripts/auto-version.js ← 版號計算
|
|
254
|
-
│ │ ├─ git show origin/master:package.json → 取得 master version(如 1.1.430)
|
|
255
|
-
│ │ │ └─ fallback: git show master:package.json
|
|
256
|
-
│ │ ├─ 讀取當前 package.json version
|
|
257
|
-
│ │ ├─ 從 currentVersion 推算下一編號
|
|
258
|
-
│ │ ├─ 掃描 git log 最近 50 筆 commit(historyMax 防倒退)
|
|
259
|
-
│ │ └─ stdout 輸出新版號(如 1.1.430-dev.3)
|
|
260
|
-
│ │ └─ 若版號無變更 → 靜默退出,auto-version.sh 跳過後續步驟
|
|
261
|
-
│ │
|
|
262
|
-
│ ├─ ② npx standard-version --release-as {version}
|
|
263
|
-
│ │ └─ 更新 CHANGELOG.md + 建立 commit + 建立 git tag
|
|
264
|
-
│ │
|
|
265
|
-
│ ├─ ③ node scripts/branch-auto-npm-publish.js ← 推送與發佈
|
|
266
|
-
│ │ ├─ git push --follow-tags origin dev
|
|
267
|
-
│ │ └─ npm publish --tag dev
|
|
268
|
-
│ │
|
|
269
|
-
│ └─ exit 1(中止原始 push,因為 script 已完成推送)
|
|
270
|
-
│
|
|
271
|
-
└─ 終端顯示 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
|
|
272
192
|
```
|
|
273
193
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
**基本遞增**:
|
|
277
|
-
|
|
278
|
-
- master 為 `1.1.430` → dev 第一次 push:`1.1.430-dev.0`
|
|
279
|
-
- 再次 push:`1.1.430-dev.1`、`1.1.430-dev.2`、...
|
|
280
|
-
- master 升版至 `1.1.431` → dev 重置為 `1.1.431-dev.0`
|
|
281
|
-
- qa 分支同理:`1.1.430-qa.0`、`1.1.430-qa.1`、...
|
|
194
|
+
**腳本權責:**
|
|
282
195
|
|
|
283
|
-
|
|
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}` |
|
|
284
201
|
|
|
285
|
-
|
|
202
|
+
**版本號規則:**
|
|
286
203
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
### Husky Hooks 總覽
|
|
295
|
-
|
|
296
|
-
| Hook | 檔案 | 說明 |
|
|
297
|
-
| --------------- | ---------------------- | ---------------------------------------------------- |
|
|
298
|
-
| `pre-commit` | `.husky/pre-commit` | 執行 `npm run format && git add .`(Prettier) |
|
|
299
|
-
| `pre-push` | `.husky/pre-push` | dev/qa 分支自動版本發佈(`scripts/auto-version.sh`) |
|
|
300
|
-
| `post-checkout` | `.husky/post-checkout` | dev/qa/hotfix 分支自動 `git pull --rebase` |
|
|
301
|
-
| `post-commit` | `.husky/post-commit` | (保留,目前無額外操作) |
|
|
302
|
-
| `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`、... |
|
|
303
210
|
|
|
304
211
|
> **注意**:`pre-push` hook 完成推送後會以 `exit 1` 中止原始 push(因為已推送完成),終端會顯示 push 失敗訊息,但實際發佈已成功。以 `Released x.x.x on {branch}` 訊息為準。
|
|
305
|
-
|
|
306
|
-
## License
|
|
307
|
-
|
|
308
|
-
ISC
|
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
package/src/api/payment.js
CHANGED
|
@@ -58,7 +58,7 @@ export default {
|
|
|
58
58
|
}),
|
|
59
59
|
getBankList: (paymentMethod) => ({ url: `payment/v2/${paymentMethod}/getBankList`, method: 'get' }),
|
|
60
60
|
getBindingBankList: ({ appSecret }) => ({ url: 'payment/v2/getBindingBankList', method: 'get', params: { appSecret }, isPublic: true }),
|
|
61
|
-
getBindingPaymentList: ({ appSecret }) => ({ url: 'payment/v2/getBindingPaymentList', method: 'get', params: { appSecret }
|
|
61
|
+
getBindingPaymentList: ({ appSecret }) => ({ url: 'payment/v2/getBindingPaymentList', method: 'get', params: { appSecret } }),
|
|
62
62
|
getWithdrawBankList: () => ({ url: 'payment/v2/getWithdrawBankList', method: 'get' }),
|
|
63
63
|
makeTransaction: ({ type, payload, paymentMethod }) => ({
|
|
64
64
|
url: `payment/v2/${paymentMethod}/transaction`,
|
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
|
}
|
package/src/machine/auth.js
CHANGED
|
@@ -525,7 +525,9 @@ export default function (request) {
|
|
|
525
525
|
window.location.href = redirectURL
|
|
526
526
|
},
|
|
527
527
|
setUserInfo: assign((context, event) => {
|
|
528
|
-
|
|
528
|
+
if (event.data?.uid_site) {
|
|
529
|
+
sentry?.setUser({ id: event.data.uid_site })
|
|
530
|
+
}
|
|
529
531
|
return {
|
|
530
532
|
userInfo: event.data,
|
|
531
533
|
}
|
|
@@ -217,18 +217,25 @@ export default function (request) {
|
|
|
217
217
|
},
|
|
218
218
|
guards: {
|
|
219
219
|
isVerified: (context, event) => {
|
|
220
|
-
|
|
220
|
+
const { strategy, userInfo } = context
|
|
221
|
+
if (strategy === 'phone') return !!userInfo?.phone_verification_status
|
|
222
|
+
if (strategy === 'email') return !!userInfo?.email_verification_status
|
|
223
|
+
return false
|
|
221
224
|
},
|
|
222
225
|
isNotVerified: (context, event) => {
|
|
223
|
-
|
|
226
|
+
const { strategy, userInfo } = context
|
|
227
|
+
if (!userInfo) return false
|
|
228
|
+
if (strategy === 'phone') return !userInfo.phone_verification_status
|
|
229
|
+
if (strategy === 'email') return !userInfo.email_verification_status
|
|
230
|
+
return false
|
|
224
231
|
},
|
|
225
232
|
isPhoneNotVerified: (context, event) => {
|
|
226
233
|
const { strategy, userInfo } = context
|
|
227
|
-
return strategy === 'phone' && userInfo && userInfo.
|
|
234
|
+
return strategy === 'phone' && !!userInfo && !userInfo.phone_verification_status && !userInfo.phone
|
|
228
235
|
},
|
|
229
236
|
isEmailNotVerified: (context, event) => {
|
|
230
237
|
const { strategy, userInfo } = context
|
|
231
|
-
return strategy === 'email' && userInfo && userInfo.
|
|
238
|
+
return strategy === 'email' && !!userInfo && !userInfo.email_verification_status && !userInfo.email
|
|
232
239
|
},
|
|
233
240
|
hasNoPhone: (context, event) => {
|
|
234
241
|
const { error } = context
|
|
@@ -98,6 +98,7 @@ export default function (request, context) {
|
|
|
98
98
|
target: '.debouncing',
|
|
99
99
|
actions: 'setPromotion',
|
|
100
100
|
internal: false,
|
|
101
|
+
cond: 'isPromotionChanged',
|
|
101
102
|
},
|
|
102
103
|
SET_CRYPTO: {
|
|
103
104
|
target: '.debouncing',
|
|
@@ -164,7 +165,7 @@ export default function (request, context) {
|
|
|
164
165
|
selectedCrypto: defaultCrypto[0],
|
|
165
166
|
selectedAddress: defaultAddresses[0],
|
|
166
167
|
options: cryptoBank.optional,
|
|
167
|
-
selectedAmount: max(context.promotion?.minimumAmount, defaultCrypto[0]?.minimum
|
|
168
|
+
selectedAmount: max(context.promotion?.minimumAmount, cryptoBank?.minimum, defaultCrypto[0]?.minimum, context.selectedAmount, 0),
|
|
168
169
|
}
|
|
169
170
|
}),
|
|
170
171
|
setCrypto: assign((context, event) => {
|
|
@@ -183,7 +184,7 @@ export default function (request, context) {
|
|
|
183
184
|
addresses,
|
|
184
185
|
selectedCrypto: selectedCrypto,
|
|
185
186
|
selectedAddress: addresses[0],
|
|
186
|
-
selectedAmount: max(context.promotion?.minimumAmount,
|
|
187
|
+
selectedAmount: max(context.promotion?.minimumAmount, cryptoBank?.minimum, selectedCrypto?.minimum, 0),
|
|
187
188
|
calculation: null,
|
|
188
189
|
options: cryptoBank.optional,
|
|
189
190
|
}
|
|
@@ -231,11 +232,11 @@ export default function (request, context) {
|
|
|
231
232
|
}
|
|
232
233
|
}),
|
|
233
234
|
setPromotion: assign((context, event) => {
|
|
234
|
-
const { cryptoBank,
|
|
235
|
+
const { cryptoBank, selectedCrypto } = context
|
|
235
236
|
const promotion = event.data
|
|
236
237
|
return {
|
|
237
238
|
promotion,
|
|
238
|
-
selectedAmount: max(promotion
|
|
239
|
+
selectedAmount: max(promotion?.minimumAmount, cryptoBank?.minimum, selectedCrypto?.minimum, 0),
|
|
239
240
|
calculation: null,
|
|
240
241
|
}
|
|
241
242
|
}),
|
|
@@ -251,6 +252,9 @@ export default function (request, context) {
|
|
|
251
252
|
}),
|
|
252
253
|
},
|
|
253
254
|
guards: {
|
|
255
|
+
isPromotionChanged: (context, event) => {
|
|
256
|
+
return event.data?.promotionsNo !== context.promotion?.promotionsNo
|
|
257
|
+
},
|
|
254
258
|
isCalculable: (context, event) => {
|
|
255
259
|
const { selectedCrypto, selectedAddress, selectedAmount } = context
|
|
256
260
|
return (
|
|
@@ -104,6 +104,7 @@ export default function (request, context) {
|
|
|
104
104
|
target: '.debouncing',
|
|
105
105
|
actions: 'setPromotion',
|
|
106
106
|
internal: false,
|
|
107
|
+
cond: 'isPromotionChanged',
|
|
107
108
|
},
|
|
108
109
|
SET_CRYPTO: {
|
|
109
110
|
target: '.debouncing',
|
|
@@ -210,11 +211,11 @@ export default function (request, context) {
|
|
|
210
211
|
}
|
|
211
212
|
}),
|
|
212
213
|
setPromotion: assign((context, event) => {
|
|
213
|
-
const { selectedCrypto
|
|
214
|
+
const { selectedCrypto } = context
|
|
214
215
|
const promotion = event.data
|
|
215
216
|
return {
|
|
216
217
|
promotion,
|
|
217
|
-
selectedAmount: max(promotion
|
|
218
|
+
selectedAmount: max(promotion?.minimumAmount, selectedCrypto?.minimum, 0),
|
|
218
219
|
calculation: null,
|
|
219
220
|
}
|
|
220
221
|
}),
|
|
@@ -231,6 +232,9 @@ export default function (request, context) {
|
|
|
231
232
|
}),
|
|
232
233
|
},
|
|
233
234
|
guards: {
|
|
235
|
+
isPromotionChanged: (context, event) => {
|
|
236
|
+
return event.data?.promotionsNo !== context.promotion?.promotionsNo
|
|
237
|
+
},
|
|
234
238
|
isCalculable: (context, event) => {
|
|
235
239
|
const { selectedCrypto, selectedAmount } = context
|
|
236
240
|
return selectedCrypto && selectedAmount && selectedCrypto.minimum <= +selectedAmount && +selectedAmount <= selectedCrypto.maximum
|
|
@@ -88,6 +88,7 @@ export default function (request, context) {
|
|
|
88
88
|
target: '.loading',
|
|
89
89
|
actions: 'setPromotion',
|
|
90
90
|
internal: false,
|
|
91
|
+
cond: 'isPromotionChanged',
|
|
91
92
|
},
|
|
92
93
|
SELECT_DIRECT: {
|
|
93
94
|
target: '.loading',
|
|
@@ -131,6 +132,8 @@ export default function (request, context) {
|
|
|
131
132
|
setDirect: assign((context, event) => {
|
|
132
133
|
return {
|
|
133
134
|
selectedDirect: event.data,
|
|
135
|
+
selectedAmount: max(context.promotion?.minimumAmount, event.data?.minimum, 0),
|
|
136
|
+
calculation: null,
|
|
134
137
|
}
|
|
135
138
|
}),
|
|
136
139
|
setUserBank: assign((context, event) => {
|
|
@@ -169,10 +172,15 @@ export default function (request, context) {
|
|
|
169
172
|
setPromotion: assign((context, event) => {
|
|
170
173
|
return {
|
|
171
174
|
promotion: event.data,
|
|
175
|
+
selectedAmount: max(event.data?.minimumAmount, context.selectedDirect?.minimum, 0),
|
|
176
|
+
calculation: null,
|
|
172
177
|
}
|
|
173
178
|
}),
|
|
174
179
|
},
|
|
175
180
|
guards: {
|
|
181
|
+
isPromotionChanged: (context, event) => {
|
|
182
|
+
return event.data?.promotionsNo !== context.promotion?.promotionsNo
|
|
183
|
+
},
|
|
176
184
|
isCalculable: (context, event) => {
|
|
177
185
|
const {
|
|
178
186
|
selectedAmount,
|
|
@@ -96,6 +96,7 @@ export default function (request, context) {
|
|
|
96
96
|
target: '.debouncing',
|
|
97
97
|
actions: 'setPromotion',
|
|
98
98
|
internal: false,
|
|
99
|
+
cond: 'isPromotionChanged',
|
|
99
100
|
},
|
|
100
101
|
SELECT_LOADCARD: {
|
|
101
102
|
target: '.debouncing',
|
|
@@ -124,7 +125,6 @@ export default function (request, context) {
|
|
|
124
125
|
}
|
|
125
126
|
}),
|
|
126
127
|
setPromotion: assign((context, event) => {
|
|
127
|
-
const { selectedAmount } = context
|
|
128
128
|
const promotion = event.data
|
|
129
129
|
const loadcards = context.loadcards
|
|
130
130
|
const selectedLoadcard = loadcards[0]
|
|
@@ -133,17 +133,17 @@ export default function (request, context) {
|
|
|
133
133
|
loadcards,
|
|
134
134
|
selectedLoadcard,
|
|
135
135
|
options: selectedLoadcard?.optional,
|
|
136
|
-
selectedAmount: max(promotion
|
|
136
|
+
selectedAmount: max(promotion?.minimumAmount, selectedLoadcard?.minimum, 0),
|
|
137
137
|
calculation: null,
|
|
138
138
|
}
|
|
139
139
|
}),
|
|
140
140
|
setLoadcard: assign((context, event) => {
|
|
141
|
-
const { promotion
|
|
141
|
+
const { promotion } = context
|
|
142
142
|
const selectedLoadcard = event.data
|
|
143
143
|
return {
|
|
144
144
|
selectedLoadcard,
|
|
145
145
|
options: selectedLoadcard.optional,
|
|
146
|
-
selectedAmount: max(promotion
|
|
146
|
+
selectedAmount: max(promotion?.minimumAmount, selectedLoadcard?.minimum, 0),
|
|
147
147
|
calculation: null,
|
|
148
148
|
}
|
|
149
149
|
}),
|
|
@@ -184,7 +184,11 @@ export default function (request, context) {
|
|
|
184
184
|
}
|
|
185
185
|
}),
|
|
186
186
|
},
|
|
187
|
-
guards: {
|
|
187
|
+
guards: {
|
|
188
|
+
isPromotionChanged: (context, event) => {
|
|
189
|
+
return event.data?.promotionsNo !== context.promotion?.promotionsNo
|
|
190
|
+
},
|
|
191
|
+
},
|
|
188
192
|
services: {
|
|
189
193
|
fetchCalculation: async (context, event) => {
|
|
190
194
|
const { selectedLoadcard, selectedAmount, promotion } = context
|
|
@@ -134,6 +134,7 @@ export default function (request, context) {
|
|
|
134
134
|
target: 'debouncing',
|
|
135
135
|
actions: 'setPromotion',
|
|
136
136
|
internal: false,
|
|
137
|
+
cond: 'isPromotionChanged',
|
|
137
138
|
},
|
|
138
139
|
INPUT_AMOUNT: {
|
|
139
140
|
target: 'debouncing',
|
|
@@ -141,7 +142,9 @@ export default function (request, context) {
|
|
|
141
142
|
internal: false,
|
|
142
143
|
},
|
|
143
144
|
SELECT_HOUSE_BANK: {
|
|
145
|
+
target: 'debouncing',
|
|
144
146
|
actions: 'setHouseBank',
|
|
147
|
+
internal: false,
|
|
145
148
|
},
|
|
146
149
|
},
|
|
147
150
|
},
|
|
@@ -180,7 +183,7 @@ export default function (request, context) {
|
|
|
180
183
|
method: currentPayment.method,
|
|
181
184
|
processing,
|
|
182
185
|
houseBanks,
|
|
183
|
-
selectedAmount: max(promotion?.minimumAmount, currentPayment?.minimum, selectedAmount, 0),
|
|
186
|
+
selectedAmount: max(context.promotion?.minimumAmount, currentPayment?.minimum, houseBanks[0]?.minimum, context.selectedAmount, 0),
|
|
184
187
|
selectedHouseBank: houseBanks[0],
|
|
185
188
|
userBanks,
|
|
186
189
|
selectedUserBank: userBanks[0],
|
|
@@ -194,6 +197,8 @@ export default function (request, context) {
|
|
|
194
197
|
setHouseBank: assign((context, event) => {
|
|
195
198
|
return {
|
|
196
199
|
selectedHouseBank: event.data,
|
|
200
|
+
selectedAmount: max(context.promotion?.minimumAmount, context.currentPayment?.minimum, event.data?.minimum, 0),
|
|
201
|
+
calculation: null,
|
|
197
202
|
}
|
|
198
203
|
}),
|
|
199
204
|
inputAmount: assign((context, event) => {
|
|
@@ -276,10 +281,15 @@ export default function (request, context) {
|
|
|
276
281
|
setPromotion: assign((context, event) => {
|
|
277
282
|
return {
|
|
278
283
|
promotion: event.data,
|
|
284
|
+
selectedAmount: max(event.data?.minimumAmount, context.currentPayment?.minimum, context.selectedHouseBank?.minimum, 0),
|
|
285
|
+
calculation: null,
|
|
279
286
|
}
|
|
280
287
|
}),
|
|
281
288
|
},
|
|
282
289
|
guards: {
|
|
290
|
+
isPromotionChanged: (context, event) => {
|
|
291
|
+
return event.data?.promotionsNo !== context.promotion?.promotionsNo
|
|
292
|
+
},
|
|
283
293
|
isCalculable: (context, event) => {
|
|
284
294
|
const {
|
|
285
295
|
selectedAmount,
|
|
@@ -102,6 +102,7 @@ export default function (request, context) {
|
|
|
102
102
|
target: '.debouncing',
|
|
103
103
|
actions: 'setPromotion',
|
|
104
104
|
internal: false,
|
|
105
|
+
cond: 'isPromotionChanged',
|
|
105
106
|
},
|
|
106
107
|
SELECT_QRCODE: {
|
|
107
108
|
target: '.debouncing',
|
|
@@ -135,7 +136,6 @@ export default function (request, context) {
|
|
|
135
136
|
}
|
|
136
137
|
}),
|
|
137
138
|
setPromotion: assign((context, event) => {
|
|
138
|
-
const { selectedAmount } = context
|
|
139
139
|
const promotion = event.data
|
|
140
140
|
const qrcodes = context.qrcodes
|
|
141
141
|
const selectedQrcode = qrcodes[0]
|
|
@@ -144,17 +144,17 @@ export default function (request, context) {
|
|
|
144
144
|
qrcodes,
|
|
145
145
|
selectedQrcode,
|
|
146
146
|
options: selectedQrcode?.optional,
|
|
147
|
-
selectedAmount: max(promotion
|
|
147
|
+
selectedAmount: max(promotion?.minimumAmount, selectedQrcode?.minimum, 0),
|
|
148
148
|
calculation: null,
|
|
149
149
|
}
|
|
150
150
|
}),
|
|
151
151
|
setQrcode: assign((context, event) => {
|
|
152
|
-
const { promotion
|
|
152
|
+
const { promotion } = context
|
|
153
153
|
const selectedQrcode = event.data
|
|
154
154
|
return {
|
|
155
155
|
selectedQrcode,
|
|
156
156
|
options: selectedQrcode.optional,
|
|
157
|
-
selectedAmount: max(promotion
|
|
157
|
+
selectedAmount: max(promotion?.minimumAmount, selectedQrcode?.minimum, 0),
|
|
158
158
|
calculation: null,
|
|
159
159
|
}
|
|
160
160
|
}),
|
|
@@ -194,6 +194,9 @@ export default function (request, context) {
|
|
|
194
194
|
}),
|
|
195
195
|
},
|
|
196
196
|
guards: {
|
|
197
|
+
isPromotionChanged: (context, event) => {
|
|
198
|
+
return event.data?.promotionsNo !== context.promotion?.promotionsNo
|
|
199
|
+
},
|
|
197
200
|
hasQrcodeMethods: (context, event) => {
|
|
198
201
|
return context.paymentDetail?.filter((element) => element.category === context.currentCategory).length > 0
|
|
199
202
|
},
|