@jetthai/cuora 1.1.453 → 1.1.454-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/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 +269 -32
- 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/user.js +12 -0
- package/src/machine/deposit/crypto_bank_cash.js +4 -5
- package/src/machine/deposit/crypto_way_cash.js +4 -5
- package/src/machine/deposit/direct_cash.js +7 -3
- package/src/machine/deposit/loadcard_cash.js +7 -8
- package/src/machine/deposit/manual_cash.js +8 -2
- package/src/machine/deposit/qrcode_cash.js +5 -7
- package/src/machine/deposit/virtual_bank_cash.js +5 -2
- package/src/machine/user_sign_up.js +3 -0
- package/src/request/request.js +3 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../../api/payment.js'
|
|
3
|
-
import { max } from '../../util'
|
|
4
3
|
|
|
5
4
|
export default function (request, context) {
|
|
6
5
|
const { paymentDetail = [], promotion, selectedAmount } = context || {}
|
|
@@ -102,6 +101,7 @@ export default function (request, context) {
|
|
|
102
101
|
target: '.debouncing',
|
|
103
102
|
actions: 'setPromotion',
|
|
104
103
|
internal: false,
|
|
104
|
+
cond: 'isPromotionChanged',
|
|
105
105
|
},
|
|
106
106
|
SELECT_QRCODE: {
|
|
107
107
|
target: '.debouncing',
|
|
@@ -123,7 +123,7 @@ export default function (request, context) {
|
|
|
123
123
|
{
|
|
124
124
|
actions: {
|
|
125
125
|
setInitData: assign((context, event) => {
|
|
126
|
-
const { paymentDetail
|
|
126
|
+
const { paymentDetail } = context
|
|
127
127
|
const qrcodes = paymentDetail.filter((element) => element.category === context.currentCategory && element.transferType === 'deposit')
|
|
128
128
|
const selectedQrcode = qrcodes[0]
|
|
129
129
|
return {
|
|
@@ -131,11 +131,9 @@ export default function (request, context) {
|
|
|
131
131
|
qrcodes,
|
|
132
132
|
selectedQrcode,
|
|
133
133
|
options: selectedQrcode?.optional,
|
|
134
|
-
selectedAmount: max(promotion?.minimumAmount, selectedQrcode?.minimum, selectedAmount, 0),
|
|
135
134
|
}
|
|
136
135
|
}),
|
|
137
136
|
setPromotion: assign((context, event) => {
|
|
138
|
-
const { selectedAmount } = context
|
|
139
137
|
const promotion = event.data
|
|
140
138
|
const qrcodes = context.qrcodes
|
|
141
139
|
const selectedQrcode = qrcodes[0]
|
|
@@ -144,17 +142,14 @@ export default function (request, context) {
|
|
|
144
142
|
qrcodes,
|
|
145
143
|
selectedQrcode,
|
|
146
144
|
options: selectedQrcode?.optional,
|
|
147
|
-
selectedAmount: max(promotion.minimumAmount, selectedQrcode?.minimum, selectedAmount, 0),
|
|
148
145
|
calculation: null,
|
|
149
146
|
}
|
|
150
147
|
}),
|
|
151
148
|
setQrcode: assign((context, event) => {
|
|
152
|
-
const { promotion, selectedAmount } = context
|
|
153
149
|
const selectedQrcode = event.data
|
|
154
150
|
return {
|
|
155
151
|
selectedQrcode,
|
|
156
152
|
options: selectedQrcode.optional,
|
|
157
|
-
selectedAmount: max(promotion.minimumAmount, selectedAmount, 0),
|
|
158
153
|
calculation: null,
|
|
159
154
|
}
|
|
160
155
|
}),
|
|
@@ -194,6 +189,9 @@ export default function (request, context) {
|
|
|
194
189
|
}),
|
|
195
190
|
},
|
|
196
191
|
guards: {
|
|
192
|
+
isPromotionChanged: (context, event) => {
|
|
193
|
+
return event.data?.promotionsNo !== context.promotion?.promotionsNo
|
|
194
|
+
},
|
|
197
195
|
hasQrcodeMethods: (context, event) => {
|
|
198
196
|
return context.paymentDetail?.filter((element) => element.category === context.currentCategory).length > 0
|
|
199
197
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '@jetthai/cuora/src/api/payment.js'
|
|
3
|
-
import { max } from '@jetthai/cuora/src/util/index.js'
|
|
4
3
|
|
|
5
4
|
export default function (request, context) {
|
|
6
5
|
const { appSecret } = request.config
|
|
@@ -99,6 +98,7 @@ export default function (request, context) {
|
|
|
99
98
|
target: 'debouncing',
|
|
100
99
|
actions: 'setPromotion',
|
|
101
100
|
internal: false,
|
|
101
|
+
cond: 'isPromotionChanged',
|
|
102
102
|
},
|
|
103
103
|
INPUT_AMOUNT: {
|
|
104
104
|
target: 'debouncing',
|
|
@@ -120,7 +120,6 @@ export default function (request, context) {
|
|
|
120
120
|
currentPayment,
|
|
121
121
|
method: currentPayment.method,
|
|
122
122
|
processing,
|
|
123
|
-
selectedAmount: max(promotion?.minimumAmount, currentPayment?.minimum, selectedAmount, 0),
|
|
124
123
|
virtualBanks,
|
|
125
124
|
}
|
|
126
125
|
}),
|
|
@@ -158,10 +157,14 @@ export default function (request, context) {
|
|
|
158
157
|
setPromotion: assign((context, event) => {
|
|
159
158
|
return {
|
|
160
159
|
promotion: event.data,
|
|
160
|
+
calculation: null,
|
|
161
161
|
}
|
|
162
162
|
}),
|
|
163
163
|
},
|
|
164
164
|
guards: {
|
|
165
|
+
isPromotionChanged: (context, event) => {
|
|
166
|
+
return event.data?.promotionsNo !== context.promotion?.promotionsNo
|
|
167
|
+
},
|
|
165
168
|
isCalculable: (context, event) => {
|
|
166
169
|
const {
|
|
167
170
|
selectedAmount,
|
|
@@ -104,6 +104,7 @@ export default function (request) {
|
|
|
104
104
|
return {
|
|
105
105
|
signUpData: {
|
|
106
106
|
provider: 'local',
|
|
107
|
+
birthday,
|
|
107
108
|
...pickBindData(event.data),
|
|
108
109
|
birthday,
|
|
109
110
|
email,
|
|
@@ -127,6 +128,7 @@ export default function (request) {
|
|
|
127
128
|
return {
|
|
128
129
|
signUpData: {
|
|
129
130
|
provider: 'phone',
|
|
131
|
+
birthday,
|
|
130
132
|
...pickBindData(event.data),
|
|
131
133
|
birthday,
|
|
132
134
|
email,
|
|
@@ -149,6 +151,7 @@ export default function (request) {
|
|
|
149
151
|
return {
|
|
150
152
|
signUpData: {
|
|
151
153
|
provider: 'email',
|
|
154
|
+
birthday,
|
|
152
155
|
...pickBindData(event.data),
|
|
153
156
|
birthday,
|
|
154
157
|
email,
|
package/src/request/request.js
CHANGED
|
@@ -254,7 +254,7 @@ export default class Request {
|
|
|
254
254
|
// reject → onError → leaving → 乾淨登出,且一樣不送網路 → 洪水照止
|
|
255
255
|
if (!req.isPublic && !this.getToken()) return Promise.reject({ code: 'ERR_A103' })
|
|
256
256
|
|
|
257
|
-
const cancelToken = customToken
|
|
257
|
+
const cancelToken = customToken
|
|
258
258
|
|
|
259
259
|
// ERR_A103 No token provided 改由後端回傳:不再於送出前自行 throw,
|
|
260
260
|
const requestConfig = this._createConfig(req, cancelToken)
|
|
@@ -283,6 +283,8 @@ export default class Request {
|
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
// 注意:send() 已不再預設附加 this.source.token(見 send 內註解),
|
|
287
|
+
// sourceUpdate 僅對「呼叫端明確以 this.source.token 為 customToken」的請求有效;保留以維持 API 相容。
|
|
286
288
|
sourceUpdate() {
|
|
287
289
|
this.source.cancel('Requests Cancelled')
|
|
288
290
|
this.source = this.axios.CancelToken.source()
|