@jetthai/cuora 1.1.438-dev.0 → 1.1.439-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/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
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.439-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.439-dev.0...v1.1.439-dev.1) (2026-05-27)
6
+
7
+
8
+ ### Features
9
+
10
+ * **withdraw:** 現金站手動出款新增雙錢包出款規則閘門 ([1dc6073](https://github.com/jetthai/cuora-module/commit/1dc6073a0df10012ffbcc55d7a85996304f514ff))
11
+
12
+ ### [1.1.439](https://github.com/jetthai/cuora-module/compare/v1.1.438-dev.0...v1.1.439) (2026-05-20)
13
+
14
+ ### [1.1.439-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.438-dev.0...v1.1.439-dev.0) (2026-05-26)
15
+
5
16
  ### [1.1.438-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.438...v1.1.438-dev.0) (2026-05-19)
6
17
 
7
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.438-dev.0",
3
+ "version": "1.1.439-dev.1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -3,12 +3,11 @@ import { assign, createMachine } from 'xstate'
3
3
  import auth from '../api/auth.js'
4
4
  import user from '../api/user.js'
5
5
  import storage from '../util/storage.js'
6
- import { getDeviceTokenWithRetry } from '../util/deviceToken.js'
7
6
  import common from '../api/common.js'
8
7
  import pickBy from 'lodash/pickBy.js'
9
8
 
10
9
  export default function (request) {
11
- const { appSecret, clientId, fpToken, sentry, defaultChannel, defaultSubchannel } = request.config
10
+ const { appSecret, clientId, sentry, defaultChannel, defaultSubchannel } = request.config
12
11
  const tokenKey = `cuora_${clientId}`
13
12
  const userKey = `cuora_tempuser`
14
13
  const phoneCountryCode = 'phone_countrycode'
@@ -468,12 +467,7 @@ export default function (request) {
468
467
  const { provider, channel, subchannel, fc } = event.data
469
468
  const deviceTokenEnable = context.siteConfig?.dtVerify
470
469
 
471
- const dt = await getDeviceTokenWithRetry({
472
- fpToken,
473
- sentry,
474
- hosts: request.hosts,
475
- enable: deviceTokenEnable,
476
- })
470
+ const dt = deviceTokenEnable ? await request.config.getDt?.() : undefined
477
471
 
478
472
  const affiliateCode = storage.get('ac')
479
473
  const nickname = storage.get('nk')
@@ -575,7 +569,7 @@ export default function (request) {
575
569
  if (deviceTokenEnable) {
576
570
  const { exist } = await request.send(user.checkDt())
577
571
  if (!exist) {
578
- const dt = await getDeviceTokenWithRetry({ fpToken, sentry, hosts: request.hosts, enable: deviceTokenEnable })
572
+ const dt = await request.config.getDt?.()
579
573
  // 確定有dt再取得updateDt
580
574
  if (dt) {
581
575
  await request.send(user.updateDt({ dt }))
@@ -1,10 +1,9 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import auth from '../api/auth.js'
3
- import { getDeviceTokenWithRetry } from '../util/deviceToken.js'
4
3
  import storage from '../util/storage.js'
5
4
 
6
5
  export default function (request) {
7
- const { fpToken, sentry, defaultChannel, defaultSubchannel } = request.config
6
+ const { sentry, defaultChannel, defaultSubchannel } = request.config
8
7
  return createMachine(
9
8
  {
10
9
  id: 'user_sign_up',
@@ -204,7 +203,7 @@ export default function (request) {
204
203
  services: {
205
204
  authenticate: async (context, event) => {
206
205
  const { channel, subchannel, signUpData, deviceTokenEnable } = context
207
- const dt = await getDeviceTokenWithRetry({ fpToken, sentry, hosts: request.hosts, enable: deviceTokenEnable })
206
+ const dt = deviceTokenEnable ? await request.config.getDt?.() : undefined
208
207
 
209
208
  const affiliateCode = storage.get('ac') || signUpData?.affiliateCode
210
209
  const messages = {
@@ -3,13 +3,14 @@ import payment from '../../api/payment.js'
3
3
  import user from '../../api/user.js'
4
4
 
5
5
  export default function (request, context) {
6
- const { paymentDetail = [] } = context || {}
6
+ const { paymentDetail = [], doubleWalletWithdrawLimitCheck = '0' } = context || {}
7
7
  return createMachine(
8
8
  {
9
9
  id: 'withdraw_manual_cash',
10
10
  initial: 'loading',
11
11
  context: {
12
12
  paymentDetail,
13
+ doubleWalletWithdrawLimitCheck,
13
14
  currentPayment: null,
14
15
  banks: [],
15
16
  paymentInfo: null,
@@ -234,11 +235,38 @@ export default function (request, context) {
234
235
  },
235
236
  },
236
237
  services: {
238
+ // 雙錢包出款規則閘門(對齊 client-pwa-ssr useWithdrawManual.initialize 流程):
239
+ // - '0':只抓 CASH withdrawRule
240
+ // - '1':只抓 ACTIVITY withdrawRule(不論達標與否,CASH 規則不參與閘門,省一次 API)
241
+ // - '2' + ACTIVITY 不可提:略過 CASH withdrawRule(少一次 API)
242
+ // - '2' + ACTIVITY 達標:續抓 CASH withdrawRule 作為最終出款依據
237
243
  fetchInitData: async (context, event) => {
238
- const { paymentDetail = [] } = context
244
+ const { paymentDetail = [], doubleWalletWithdrawLimitCheck = '0' } = context
239
245
  const currentPayment = paymentDetail.find((element) => element.category === 'manual' && element.transferType === 'withdraw')
240
246
 
241
- const [paymentInfo, withdrawRule, orders] = await Promise.all([
247
+ let prefetchedRule = null
248
+ if (doubleWalletWithdrawLimitCheck === '2' || doubleWalletWithdrawLimitCheck === '1') {
249
+ const activityRule = await request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'ACTIVITY' }))
250
+ // '1' 模式僅看 ACTIVITY,'2' 模式 ACTIVITY 不可提則 CASH 不參與閘門 — 兩種情況都用 activityRule 為依據
251
+ if (doubleWalletWithdrawLimitCheck === '1' || activityRule?.enableWithdraw !== true) {
252
+ prefetchedRule = activityRule
253
+ }
254
+ }
255
+
256
+ if (prefetchedRule) {
257
+ const [paymentInfo, orders] = await Promise.all([
258
+ request.send(payment.getBindingPaymentInfo()),
259
+ request.send(payment.getPendingOrder({ transferType: 'WITHDRAW' })),
260
+ ])
261
+ return {
262
+ currentPayment,
263
+ paymentInfo,
264
+ withdrawRule: prefetchedRule,
265
+ processing: orders[0],
266
+ }
267
+ }
268
+
269
+ const [paymentInfo, cashRule, orders] = await Promise.all([
242
270
  request.send(payment.getBindingPaymentInfo()),
243
271
  request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' })),
244
272
  request.send(payment.getPendingOrder({ transferType: 'WITHDRAW' })),
@@ -247,7 +275,7 @@ export default function (request, context) {
247
275
  return {
248
276
  currentPayment,
249
277
  paymentInfo,
250
- withdrawRule,
278
+ withdrawRule: cashRule,
251
279
  processing: orders[0],
252
280
  }
253
281
  },
@@ -16,6 +16,7 @@ export default class Config {
16
16
  defaultSubchannel,
17
17
  socketURL,
18
18
  bucketName,
19
+ getDt,
19
20
  }) {
20
21
  this.apiURL = apiURL
21
22
  this.apiVersion = apiVersion
@@ -30,6 +31,7 @@ export default class Config {
30
31
  this.defaultSubchannel = defaultSubchannel
31
32
  this.socketURL = socketURL
32
33
  this.bucketName = bucketName
34
+ this.getDt = getDt
33
35
  }
34
36
 
35
37
  setApiURL(url) {
package/src/util/index.js CHANGED
@@ -1,7 +1,6 @@
1
- import { getDeviceToken, getDeviceTokenWithRetry } from './deviceToken.js'
2
1
  import storage from './storage.js'
3
2
  import * as constant from './constant.js'
4
3
  import { max } from './math.js'
5
4
 
6
- export default { getDeviceToken, getDeviceTokenWithRetry }
5
+ export default {}
7
6
  export { constant, storage, max }