@jetthai/cuora 1.1.20 → 1.1.22
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 +4 -0
- package/dist/bundle.mjs +132 -84
- package/package.json +1 -1
- package/src/machine/deposit/crypto_button.js +1 -1
- package/src/machine/deposit/loadcard_vn.js +1 -1
- package/src/machine/deposit/qrcode_v2.js +1 -1
- package/src/machine/promotions.js +3 -31
- package/src/machine/reward.js +2 -8
- package/src/machine/withdraw_crypto.js +123 -41
- package/src/machine/withdraw_vn.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.22](https://github.com/jetthai/cuora-module/compare/v1.1.21...v1.1.22) (2023-01-03)
|
|
6
|
+
|
|
7
|
+
### [1.1.21](https://github.com/jetthai/cuora-module/compare/v1.1.20...v1.1.21) (2022-12-30)
|
|
8
|
+
|
|
5
9
|
### [1.1.20](https://github.com/jetthai/cuora-module/compare/v1.1.19...v1.1.20) (2022-12-30)
|
|
6
10
|
|
|
7
11
|
### [1.1.19](https://github.com/jetthai/cuora-module/compare/v1.1.18...v1.1.19) (2022-12-29)
|
package/dist/bundle.mjs
CHANGED
|
@@ -13013,13 +13013,7 @@ function reward (request) {
|
|
|
13013
13013
|
rewardList: [],
|
|
13014
13014
|
activityNo: null,
|
|
13015
13015
|
receiveNo: null,
|
|
13016
|
-
|
|
13017
|
-
originalTurnoverLimit: 0,
|
|
13018
|
-
originalMaxWithdrawAmount: 0,
|
|
13019
|
-
originalLimitGameDetail: [],
|
|
13020
|
-
newTurnoverLimit: 0,
|
|
13021
|
-
newMaxWithdrawAmount: 0,
|
|
13022
|
-
newLimitGameDetail: [],
|
|
13016
|
+
withdrawRule: {},
|
|
13023
13017
|
callback: () => {},
|
|
13024
13018
|
},
|
|
13025
13019
|
states: {
|
|
@@ -13150,7 +13144,7 @@ function reward (request) {
|
|
|
13150
13144
|
},
|
|
13151
13145
|
setWithdrawRulePreview: (context, event) => {
|
|
13152
13146
|
return {
|
|
13153
|
-
|
|
13147
|
+
withdrawRule: event.data,
|
|
13154
13148
|
}
|
|
13155
13149
|
},
|
|
13156
13150
|
},
|
|
@@ -14781,7 +14775,7 @@ function withdraw_vn (request) {
|
|
|
14781
14775
|
bankList: [],
|
|
14782
14776
|
withdrawLimit: null,
|
|
14783
14777
|
targetWithdrawLimit: null,
|
|
14784
|
-
attachmentType: null, // 'withdraw'
|
|
14778
|
+
attachmentType: null, // null | 'withdraw' | 'pool'
|
|
14785
14779
|
maximumWithdrawAmount: 0,
|
|
14786
14780
|
enableWithdrawAmount: 0,
|
|
14787
14781
|
|
|
@@ -15257,6 +15251,8 @@ function withdraw_crypto (request) {
|
|
|
15257
15251
|
maxWithdrawAmount: null,
|
|
15258
15252
|
availableWithdrawAmount: null,
|
|
15259
15253
|
|
|
15254
|
+
attachmentType: null, // null | 'withdraw' | 'pool'
|
|
15255
|
+
|
|
15260
15256
|
networks: [],
|
|
15261
15257
|
selectedNetwork: null,
|
|
15262
15258
|
address: '',
|
|
@@ -15277,7 +15273,7 @@ function withdraw_crypto (request) {
|
|
|
15277
15273
|
src: 'fetchInitData',
|
|
15278
15274
|
onDone: {
|
|
15279
15275
|
target: 'mode',
|
|
15280
|
-
actions: ['setInitData', 'preset'],
|
|
15276
|
+
actions: ['setInitData', 'preset', 'updateWithdrawCondition'],
|
|
15281
15277
|
},
|
|
15282
15278
|
onError: {
|
|
15283
15279
|
target: 'fail',
|
|
@@ -15288,34 +15284,53 @@ function withdraw_crypto (request) {
|
|
|
15288
15284
|
always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
|
|
15289
15285
|
},
|
|
15290
15286
|
free: {
|
|
15291
|
-
initial: '
|
|
15287
|
+
initial: 'checking',
|
|
15292
15288
|
states: {
|
|
15293
|
-
loading: {
|
|
15289
|
+
// loading: {
|
|
15290
|
+
// invoke: {
|
|
15291
|
+
// src: 'fetchWithdrawRules',
|
|
15292
|
+
// onDone: {
|
|
15293
|
+
// target: 'checking',
|
|
15294
|
+
// actions: 'updateWithdrawCondition',
|
|
15295
|
+
// },
|
|
15296
|
+
// onError: {
|
|
15297
|
+
// target: 'notConvertible',
|
|
15298
|
+
// },
|
|
15299
|
+
// },
|
|
15300
|
+
// },
|
|
15301
|
+
checking: {
|
|
15302
|
+
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
15303
|
+
},
|
|
15304
|
+
notConvertible: {
|
|
15305
|
+
on: {
|
|
15306
|
+
GIVE_UP: {
|
|
15307
|
+
target: 'givingUp',
|
|
15308
|
+
},
|
|
15309
|
+
},
|
|
15310
|
+
},
|
|
15311
|
+
givingUp: {
|
|
15294
15312
|
invoke: {
|
|
15295
|
-
src: '
|
|
15313
|
+
src: 'giveUp',
|
|
15296
15314
|
onDone: {
|
|
15297
|
-
target: '
|
|
15298
|
-
actions: 'updateWithdrawCondition',
|
|
15315
|
+
target: 'gaveUp',
|
|
15299
15316
|
},
|
|
15300
15317
|
onError: {
|
|
15301
|
-
target: '
|
|
15318
|
+
target: 'convertible',
|
|
15302
15319
|
},
|
|
15303
15320
|
},
|
|
15304
15321
|
},
|
|
15305
|
-
|
|
15306
|
-
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
15307
|
-
},
|
|
15308
|
-
notConvertible: {},
|
|
15322
|
+
gaveUp: {},
|
|
15309
15323
|
convertible: {
|
|
15310
15324
|
on: {
|
|
15311
15325
|
SUBMIT: {
|
|
15312
15326
|
target: 'converting',
|
|
15327
|
+
actions: 'setAttachmentType',
|
|
15313
15328
|
},
|
|
15314
15329
|
},
|
|
15315
15330
|
},
|
|
15316
15331
|
converting: {
|
|
15317
15332
|
invoke: {
|
|
15318
|
-
src: '
|
|
15333
|
+
src: 'convertFreeCredit',
|
|
15319
15334
|
onDone: [
|
|
15320
15335
|
{
|
|
15321
15336
|
target: '#withdraw_crypto.otp',
|
|
@@ -15331,7 +15346,9 @@ function withdraw_crypto (request) {
|
|
|
15331
15346
|
},
|
|
15332
15347
|
},
|
|
15333
15348
|
},
|
|
15334
|
-
converted: {
|
|
15349
|
+
converted: {
|
|
15350
|
+
always: [{ target: '#withdraw_crypto.cash.withdrawable', cond: 'hasAttachmentType' }],
|
|
15351
|
+
},
|
|
15335
15352
|
},
|
|
15336
15353
|
},
|
|
15337
15354
|
cash: {
|
|
@@ -15365,6 +15382,17 @@ function withdraw_crypto (request) {
|
|
|
15365
15382
|
target: 'submittable',
|
|
15366
15383
|
cond: 'isSubmittable',
|
|
15367
15384
|
},
|
|
15385
|
+
SET_ATTACHMENT_TYPE: {
|
|
15386
|
+
actions: 'setAttachmentType',
|
|
15387
|
+
cond: 'isNewWalletMode',
|
|
15388
|
+
},
|
|
15389
|
+
POOL: {
|
|
15390
|
+
target: 'pooling',
|
|
15391
|
+
cond: (context, event) => {
|
|
15392
|
+
const { amount, attachmentType } = context;
|
|
15393
|
+
return attachmentType === 'pool' && amount > 0
|
|
15394
|
+
},
|
|
15395
|
+
},
|
|
15368
15396
|
},
|
|
15369
15397
|
},
|
|
15370
15398
|
calculating: {
|
|
@@ -15382,9 +15410,18 @@ function withdraw_crypto (request) {
|
|
|
15382
15410
|
},
|
|
15383
15411
|
submittable: {
|
|
15384
15412
|
on: {
|
|
15385
|
-
SUBMIT:
|
|
15386
|
-
|
|
15387
|
-
|
|
15413
|
+
SUBMIT: [
|
|
15414
|
+
{
|
|
15415
|
+
target: 'pooling',
|
|
15416
|
+
cond: (context, event) => {
|
|
15417
|
+
const { amount, attachmentType } = context;
|
|
15418
|
+
return attachmentType === 'pool' && amount > 0
|
|
15419
|
+
},
|
|
15420
|
+
},
|
|
15421
|
+
{
|
|
15422
|
+
target: 'submitting',
|
|
15423
|
+
},
|
|
15424
|
+
],
|
|
15388
15425
|
BACK: {
|
|
15389
15426
|
target: 'withdrawable',
|
|
15390
15427
|
},
|
|
@@ -15409,6 +15446,16 @@ function withdraw_crypto (request) {
|
|
|
15409
15446
|
},
|
|
15410
15447
|
},
|
|
15411
15448
|
submitted: {},
|
|
15449
|
+
pooling: {
|
|
15450
|
+
invoke: {
|
|
15451
|
+
src: 'pool',
|
|
15452
|
+
onDone: { target: 'pooled' },
|
|
15453
|
+
onError: {
|
|
15454
|
+
target: 'withdrawable',
|
|
15455
|
+
},
|
|
15456
|
+
},
|
|
15457
|
+
},
|
|
15458
|
+
pooled: {},
|
|
15412
15459
|
},
|
|
15413
15460
|
},
|
|
15414
15461
|
otp: {
|
|
@@ -15518,34 +15565,46 @@ function withdraw_crypto (request) {
|
|
|
15518
15565
|
balance,
|
|
15519
15566
|
siteConfig,
|
|
15520
15567
|
userInfo,
|
|
15568
|
+
attachmentType: siteConfig.walletMode > 0 ? 'withdraw' : null,
|
|
15521
15569
|
}
|
|
15522
15570
|
}),
|
|
15523
15571
|
updateWithdrawCondition: assign((context, event) => {
|
|
15524
|
-
const
|
|
15525
|
-
|
|
15526
|
-
const { balance, withdrawLimit } = context;
|
|
15527
|
-
const lastMatchedIndex = findLastIndex_1(rules, (rule) => balance >= rule.greaterEqualThen);
|
|
15528
|
-
|
|
15529
|
-
let maxWithdrawAmount = 0,
|
|
15530
|
-
availableWithdrawAmount = 0;
|
|
15531
|
-
|
|
15532
|
-
if (lastMatchedIndex > -1) {
|
|
15533
|
-
rules[lastMatchedIndex].match = true;
|
|
15534
|
-
maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount;
|
|
15535
|
-
|
|
15536
|
-
if (withdrawLimit === 0) {
|
|
15537
|
-
availableWithdrawAmount = Math.min(balance, maxWithdrawAmount);
|
|
15538
|
-
}
|
|
15539
|
-
} else if (rules.length > 0) {
|
|
15540
|
-
maxWithdrawAmount = rules[0].maxWithdrawAmount;
|
|
15541
|
-
} else {
|
|
15542
|
-
maxWithdrawAmount = balance;
|
|
15543
|
-
}
|
|
15572
|
+
const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
|
|
15573
|
+
event.data?.withdrawRule;
|
|
15544
15574
|
|
|
15545
15575
|
return {
|
|
15546
|
-
maxWithdrawAmount,
|
|
15547
|
-
availableWithdrawAmount,
|
|
15576
|
+
// maxWithdrawAmount: maximumWithdrawAmount,
|
|
15577
|
+
// availableWithdrawAmount: enableWithdrawAmount,
|
|
15578
|
+
maximumWithdrawAmount: +maximumWithdrawAmount,
|
|
15579
|
+
enableWithdrawAmount: +enableWithdrawAmount,
|
|
15580
|
+
amount: +enableWithdrawAmount,
|
|
15548
15581
|
}
|
|
15582
|
+
|
|
15583
|
+
// const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
|
|
15584
|
+
//
|
|
15585
|
+
// const { balance, withdrawLimit } = context
|
|
15586
|
+
// const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
|
|
15587
|
+
//
|
|
15588
|
+
// let maxWithdrawAmount = 0,
|
|
15589
|
+
// availableWithdrawAmount = 0
|
|
15590
|
+
//
|
|
15591
|
+
// if (lastMatchedIndex > -1) {
|
|
15592
|
+
// rules[lastMatchedIndex].match = true
|
|
15593
|
+
// maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount
|
|
15594
|
+
//
|
|
15595
|
+
// if (withdrawLimit === 0) {
|
|
15596
|
+
// availableWithdrawAmount = Math.min(balance, maxWithdrawAmount)
|
|
15597
|
+
// }
|
|
15598
|
+
// } else if (rules.length > 0) {
|
|
15599
|
+
// maxWithdrawAmount = rules[0].maxWithdrawAmount
|
|
15600
|
+
// } else {
|
|
15601
|
+
// maxWithdrawAmount = balance
|
|
15602
|
+
// }
|
|
15603
|
+
//
|
|
15604
|
+
// return {
|
|
15605
|
+
// maxWithdrawAmount,
|
|
15606
|
+
// availableWithdrawAmount,
|
|
15607
|
+
// }
|
|
15549
15608
|
}),
|
|
15550
15609
|
setNetwork: assign((context, event) => {
|
|
15551
15610
|
return {
|
|
@@ -15601,11 +15660,19 @@ function withdraw_crypto (request) {
|
|
|
15601
15660
|
target,
|
|
15602
15661
|
}
|
|
15603
15662
|
}),
|
|
15663
|
+
setAttachmentType: assign((context, event) => {
|
|
15664
|
+
return {
|
|
15665
|
+
attachmentType: event.data,
|
|
15666
|
+
}
|
|
15667
|
+
}),
|
|
15604
15668
|
},
|
|
15605
15669
|
guards: {
|
|
15606
15670
|
isFree: (context, event) => {
|
|
15607
15671
|
return context.userInfo?.withdraw_rule !== 'DEFAULT'
|
|
15608
15672
|
},
|
|
15673
|
+
hasAttachmentType: (context, event) => {
|
|
15674
|
+
return ['withdraw', 'pool'].includes(context.attachmentType)
|
|
15675
|
+
},
|
|
15609
15676
|
haveProcessing: (context, event) => {
|
|
15610
15677
|
return (context.paymentDetail?.[0]?.processing || []).length > 0
|
|
15611
15678
|
},
|
|
@@ -15634,16 +15701,18 @@ function withdraw_crypto (request) {
|
|
|
15634
15701
|
isOtpRequired: (context, event) => {
|
|
15635
15702
|
return event.data?.status === 'otp-verifying'
|
|
15636
15703
|
},
|
|
15704
|
+
isNewWalletMode: (context, event) => context.siteConfig.walletMode > 0,
|
|
15637
15705
|
},
|
|
15638
15706
|
services: {
|
|
15639
15707
|
fetchInitData: async (context, event) => {
|
|
15640
|
-
const [{ config }, userInfo, paymentDetail = []] = await Promise.all([
|
|
15708
|
+
const [{ config }, userInfo, paymentDetail = [], withdrawRule] = await Promise.all([
|
|
15641
15709
|
request.send(common$1.getConfig({ appSecret })),
|
|
15642
15710
|
request.send(user.getUserInfo()),
|
|
15643
15711
|
request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' })),
|
|
15712
|
+
request.send(payment.getCurrentWithdrawRule()),
|
|
15644
15713
|
]);
|
|
15645
15714
|
const siteConfig = JSON.parse(window.atob(config));
|
|
15646
|
-
return { siteConfig, userInfo, paymentDetail }
|
|
15715
|
+
return { siteConfig, userInfo, paymentDetail, withdrawRule }
|
|
15647
15716
|
},
|
|
15648
15717
|
fetchPaymentData: async (context, event) => {
|
|
15649
15718
|
const paymentDetail = await request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' }));
|
|
@@ -15664,7 +15733,7 @@ function withdraw_crypto (request) {
|
|
|
15664
15733
|
})
|
|
15665
15734
|
)
|
|
15666
15735
|
},
|
|
15667
|
-
|
|
15736
|
+
convertFreeCredit: async (context, event) => {
|
|
15668
15737
|
return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
|
|
15669
15738
|
},
|
|
15670
15739
|
fetchCalculation: async (context, event) => {
|
|
@@ -15687,6 +15756,13 @@ function withdraw_crypto (request) {
|
|
|
15687
15756
|
const code = event.data;
|
|
15688
15757
|
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
15689
15758
|
},
|
|
15759
|
+
pool: async (context, event) => {
|
|
15760
|
+
const { amount } = context;
|
|
15761
|
+
return await request.send(payment.restore({ amount }))
|
|
15762
|
+
},
|
|
15763
|
+
giveUp: async (context, event) => {
|
|
15764
|
+
return await request.send(payment.giveUp())
|
|
15765
|
+
},
|
|
15690
15766
|
},
|
|
15691
15767
|
}
|
|
15692
15768
|
)
|
|
@@ -16720,7 +16796,7 @@ function loadcard_vn (request) {
|
|
|
16720
16796
|
},
|
|
16721
16797
|
guards: {
|
|
16722
16798
|
isPromotionApplyMode: (context, event) => {
|
|
16723
|
-
return context.siteConfig?.
|
|
16799
|
+
return context.siteConfig?.walletMode === '2'
|
|
16724
16800
|
},
|
|
16725
16801
|
isSubmittable: (context, event) => {
|
|
16726
16802
|
const { cardNumber, serialNumber } = context;
|
|
@@ -17339,7 +17415,7 @@ function qrcode_v2 (request) {
|
|
|
17339
17415
|
},
|
|
17340
17416
|
guards: {
|
|
17341
17417
|
isPromotionApplyMode: (context, event) => {
|
|
17342
|
-
return context.siteConfig?.
|
|
17418
|
+
return context.siteConfig?.walletMode === '2'
|
|
17343
17419
|
},
|
|
17344
17420
|
},
|
|
17345
17421
|
services: {
|
|
@@ -18640,7 +18716,7 @@ function crypto_button (request) {
|
|
|
18640
18716
|
},
|
|
18641
18717
|
guards: {
|
|
18642
18718
|
isPromotionApplyMode: (context, event) => {
|
|
18643
|
-
return context.siteConfig?.
|
|
18719
|
+
return context.siteConfig?.walletMode === '2'
|
|
18644
18720
|
},
|
|
18645
18721
|
isConfirmable: (context, event) => {
|
|
18646
18722
|
const { selectedCrypto, selectedNetwork } = context;
|
|
@@ -20236,36 +20312,8 @@ function promotions (request) {
|
|
|
20236
20312
|
id: 'promotions',
|
|
20237
20313
|
initial: 'loading',
|
|
20238
20314
|
context: {
|
|
20239
|
-
noBonus: {
|
|
20240
|
-
|
|
20241
|
-
title: 'No Bonus',
|
|
20242
|
-
adSmallUrl: [
|
|
20243
|
-
{
|
|
20244
|
-
url: '~/assets/images/deposit/deposit_img_nobonus_normal.png',
|
|
20245
|
-
name: 'No Bonus',
|
|
20246
|
-
},
|
|
20247
|
-
],
|
|
20248
|
-
descrip: 'no_bonus',
|
|
20249
|
-
minimumAmount: 0,
|
|
20250
|
-
turnoverLimitMultiple: 1,
|
|
20251
|
-
promotionDetail: [],
|
|
20252
|
-
withdrawLimitDetail: [
|
|
20253
|
-
{
|
|
20254
|
-
greaterEqualThen: 0,
|
|
20255
|
-
lessEqualThen: -1,
|
|
20256
|
-
maxWithdrawAmount: -1,
|
|
20257
|
-
turnoverLimitMultiple: 1,
|
|
20258
|
-
},
|
|
20259
|
-
],
|
|
20260
|
-
limitGameDetail: [],
|
|
20261
|
-
},
|
|
20262
|
-
turnoverLimitStatus: '',
|
|
20263
|
-
originalTurnoverLimit: 0,
|
|
20264
|
-
originalMaxWithdrawAmount: 0,
|
|
20265
|
-
originalLimitGameDetail: [],
|
|
20266
|
-
newTurnoverLimit: 0,
|
|
20267
|
-
newMaxWithdrawAmount: 0,
|
|
20268
|
-
newLimitGameDetail: [],
|
|
20315
|
+
noBonus: {},
|
|
20316
|
+
withdrawRule: {},
|
|
20269
20317
|
promotionsList: [],
|
|
20270
20318
|
selectedPromo: {},
|
|
20271
20319
|
},
|
|
@@ -20354,7 +20402,7 @@ function promotions (request) {
|
|
|
20354
20402
|
}),
|
|
20355
20403
|
setWithdrawRulePreview: assign((context, event) => {
|
|
20356
20404
|
return {
|
|
20357
|
-
|
|
20405
|
+
withdrawRule: event.data,
|
|
20358
20406
|
}
|
|
20359
20407
|
}),
|
|
20360
20408
|
reset: assign((context, event) => {
|
package/package.json
CHANGED
|
@@ -401,7 +401,7 @@ export default function (request) {
|
|
|
401
401
|
},
|
|
402
402
|
guards: {
|
|
403
403
|
isPromotionApplyMode: (context, event) => {
|
|
404
|
-
return context.siteConfig?.
|
|
404
|
+
return context.siteConfig?.walletMode === '2'
|
|
405
405
|
},
|
|
406
406
|
isConfirmable: (context, event) => {
|
|
407
407
|
const { selectedCrypto, selectedNetwork } = context
|
|
@@ -322,7 +322,7 @@ export default function (request) {
|
|
|
322
322
|
},
|
|
323
323
|
guards: {
|
|
324
324
|
isPromotionApplyMode: (context, event) => {
|
|
325
|
-
return context.siteConfig?.
|
|
325
|
+
return context.siteConfig?.walletMode === '2'
|
|
326
326
|
},
|
|
327
327
|
isSubmittable: (context, event) => {
|
|
328
328
|
const { cardNumber, serialNumber } = context
|
|
@@ -7,36 +7,8 @@ export default function (request) {
|
|
|
7
7
|
id: 'promotions',
|
|
8
8
|
initial: 'loading',
|
|
9
9
|
context: {
|
|
10
|
-
noBonus: {
|
|
11
|
-
|
|
12
|
-
title: 'No Bonus',
|
|
13
|
-
adSmallUrl: [
|
|
14
|
-
{
|
|
15
|
-
url: '~/assets/images/deposit/deposit_img_nobonus_normal.png',
|
|
16
|
-
name: 'No Bonus',
|
|
17
|
-
},
|
|
18
|
-
],
|
|
19
|
-
descrip: 'no_bonus',
|
|
20
|
-
minimumAmount: 0,
|
|
21
|
-
turnoverLimitMultiple: 1,
|
|
22
|
-
promotionDetail: [],
|
|
23
|
-
withdrawLimitDetail: [
|
|
24
|
-
{
|
|
25
|
-
greaterEqualThen: 0,
|
|
26
|
-
lessEqualThen: -1,
|
|
27
|
-
maxWithdrawAmount: -1,
|
|
28
|
-
turnoverLimitMultiple: 1,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
limitGameDetail: [],
|
|
32
|
-
},
|
|
33
|
-
turnoverLimitStatus: '',
|
|
34
|
-
originalTurnoverLimit: 0,
|
|
35
|
-
originalMaxWithdrawAmount: 0,
|
|
36
|
-
originalLimitGameDetail: [],
|
|
37
|
-
newTurnoverLimit: 0,
|
|
38
|
-
newMaxWithdrawAmount: 0,
|
|
39
|
-
newLimitGameDetail: [],
|
|
10
|
+
noBonus: {},
|
|
11
|
+
withdrawRule: {},
|
|
40
12
|
promotionsList: [],
|
|
41
13
|
selectedPromo: {},
|
|
42
14
|
},
|
|
@@ -125,7 +97,7 @@ export default function (request) {
|
|
|
125
97
|
}),
|
|
126
98
|
setWithdrawRulePreview: assign((context, event) => {
|
|
127
99
|
return {
|
|
128
|
-
|
|
100
|
+
withdrawRule: event.data,
|
|
129
101
|
}
|
|
130
102
|
}),
|
|
131
103
|
reset: assign((context, event) => {
|
package/src/machine/reward.js
CHANGED
|
@@ -14,13 +14,7 @@ export default function (request) {
|
|
|
14
14
|
rewardList: [],
|
|
15
15
|
activityNo: null,
|
|
16
16
|
receiveNo: null,
|
|
17
|
-
|
|
18
|
-
originalTurnoverLimit: 0,
|
|
19
|
-
originalMaxWithdrawAmount: 0,
|
|
20
|
-
originalLimitGameDetail: [],
|
|
21
|
-
newTurnoverLimit: 0,
|
|
22
|
-
newMaxWithdrawAmount: 0,
|
|
23
|
-
newLimitGameDetail: [],
|
|
17
|
+
withdrawRule: {},
|
|
24
18
|
callback: () => {},
|
|
25
19
|
},
|
|
26
20
|
states: {
|
|
@@ -151,7 +145,7 @@ export default function (request) {
|
|
|
151
145
|
},
|
|
152
146
|
setWithdrawRulePreview: (context, event) => {
|
|
153
147
|
return {
|
|
154
|
-
|
|
148
|
+
withdrawRule: event.data,
|
|
155
149
|
}
|
|
156
150
|
},
|
|
157
151
|
},
|
|
@@ -25,6 +25,8 @@ export default function (request) {
|
|
|
25
25
|
maxWithdrawAmount: null,
|
|
26
26
|
availableWithdrawAmount: null,
|
|
27
27
|
|
|
28
|
+
attachmentType: null, // null | 'withdraw' | 'pool'
|
|
29
|
+
|
|
28
30
|
networks: [],
|
|
29
31
|
selectedNetwork: null,
|
|
30
32
|
address: '',
|
|
@@ -45,7 +47,7 @@ export default function (request) {
|
|
|
45
47
|
src: 'fetchInitData',
|
|
46
48
|
onDone: {
|
|
47
49
|
target: 'mode',
|
|
48
|
-
actions: ['setInitData', 'preset'],
|
|
50
|
+
actions: ['setInitData', 'preset', 'updateWithdrawCondition'],
|
|
49
51
|
},
|
|
50
52
|
onError: {
|
|
51
53
|
target: 'fail',
|
|
@@ -56,34 +58,53 @@ export default function (request) {
|
|
|
56
58
|
always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
|
|
57
59
|
},
|
|
58
60
|
free: {
|
|
59
|
-
initial: '
|
|
61
|
+
initial: 'checking',
|
|
60
62
|
states: {
|
|
61
|
-
loading: {
|
|
63
|
+
// loading: {
|
|
64
|
+
// invoke: {
|
|
65
|
+
// src: 'fetchWithdrawRules',
|
|
66
|
+
// onDone: {
|
|
67
|
+
// target: 'checking',
|
|
68
|
+
// actions: 'updateWithdrawCondition',
|
|
69
|
+
// },
|
|
70
|
+
// onError: {
|
|
71
|
+
// target: 'notConvertible',
|
|
72
|
+
// },
|
|
73
|
+
// },
|
|
74
|
+
// },
|
|
75
|
+
checking: {
|
|
76
|
+
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
77
|
+
},
|
|
78
|
+
notConvertible: {
|
|
79
|
+
on: {
|
|
80
|
+
GIVE_UP: {
|
|
81
|
+
target: 'givingUp',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
givingUp: {
|
|
62
86
|
invoke: {
|
|
63
|
-
src: '
|
|
87
|
+
src: 'giveUp',
|
|
64
88
|
onDone: {
|
|
65
|
-
target: '
|
|
66
|
-
actions: 'updateWithdrawCondition',
|
|
89
|
+
target: 'gaveUp',
|
|
67
90
|
},
|
|
68
91
|
onError: {
|
|
69
|
-
target: '
|
|
92
|
+
target: 'convertible',
|
|
70
93
|
},
|
|
71
94
|
},
|
|
72
95
|
},
|
|
73
|
-
|
|
74
|
-
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
75
|
-
},
|
|
76
|
-
notConvertible: {},
|
|
96
|
+
gaveUp: {},
|
|
77
97
|
convertible: {
|
|
78
98
|
on: {
|
|
79
99
|
SUBMIT: {
|
|
80
100
|
target: 'converting',
|
|
101
|
+
actions: 'setAttachmentType',
|
|
81
102
|
},
|
|
82
103
|
},
|
|
83
104
|
},
|
|
84
105
|
converting: {
|
|
85
106
|
invoke: {
|
|
86
|
-
src: '
|
|
107
|
+
src: 'convertFreeCredit',
|
|
87
108
|
onDone: [
|
|
88
109
|
{
|
|
89
110
|
target: '#withdraw_crypto.otp',
|
|
@@ -99,7 +120,9 @@ export default function (request) {
|
|
|
99
120
|
},
|
|
100
121
|
},
|
|
101
122
|
},
|
|
102
|
-
converted: {
|
|
123
|
+
converted: {
|
|
124
|
+
always: [{ target: '#withdraw_crypto.cash.withdrawable', cond: 'hasAttachmentType' }],
|
|
125
|
+
},
|
|
103
126
|
},
|
|
104
127
|
},
|
|
105
128
|
cash: {
|
|
@@ -133,6 +156,17 @@ export default function (request) {
|
|
|
133
156
|
target: 'submittable',
|
|
134
157
|
cond: 'isSubmittable',
|
|
135
158
|
},
|
|
159
|
+
SET_ATTACHMENT_TYPE: {
|
|
160
|
+
actions: 'setAttachmentType',
|
|
161
|
+
cond: 'isNewWalletMode',
|
|
162
|
+
},
|
|
163
|
+
POOL: {
|
|
164
|
+
target: 'pooling',
|
|
165
|
+
cond: (context, event) => {
|
|
166
|
+
const { amount, attachmentType } = context
|
|
167
|
+
return attachmentType === 'pool' && amount > 0
|
|
168
|
+
},
|
|
169
|
+
},
|
|
136
170
|
},
|
|
137
171
|
},
|
|
138
172
|
calculating: {
|
|
@@ -150,9 +184,18 @@ export default function (request) {
|
|
|
150
184
|
},
|
|
151
185
|
submittable: {
|
|
152
186
|
on: {
|
|
153
|
-
SUBMIT:
|
|
154
|
-
|
|
155
|
-
|
|
187
|
+
SUBMIT: [
|
|
188
|
+
{
|
|
189
|
+
target: 'pooling',
|
|
190
|
+
cond: (context, event) => {
|
|
191
|
+
const { amount, attachmentType } = context
|
|
192
|
+
return attachmentType === 'pool' && amount > 0
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
target: 'submitting',
|
|
197
|
+
},
|
|
198
|
+
],
|
|
156
199
|
BACK: {
|
|
157
200
|
target: 'withdrawable',
|
|
158
201
|
},
|
|
@@ -177,6 +220,16 @@ export default function (request) {
|
|
|
177
220
|
},
|
|
178
221
|
},
|
|
179
222
|
submitted: {},
|
|
223
|
+
pooling: {
|
|
224
|
+
invoke: {
|
|
225
|
+
src: 'pool',
|
|
226
|
+
onDone: { target: 'pooled' },
|
|
227
|
+
onError: {
|
|
228
|
+
target: 'withdrawable',
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
pooled: {},
|
|
180
233
|
},
|
|
181
234
|
},
|
|
182
235
|
otp: {
|
|
@@ -286,34 +339,46 @@ export default function (request) {
|
|
|
286
339
|
balance,
|
|
287
340
|
siteConfig,
|
|
288
341
|
userInfo,
|
|
342
|
+
attachmentType: siteConfig.walletMode > 0 ? 'withdraw' : null,
|
|
289
343
|
}
|
|
290
344
|
}),
|
|
291
345
|
updateWithdrawCondition: assign((context, event) => {
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
const { balance, withdrawLimit } = context
|
|
295
|
-
const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
|
|
296
|
-
|
|
297
|
-
let maxWithdrawAmount = 0,
|
|
298
|
-
availableWithdrawAmount = 0
|
|
299
|
-
|
|
300
|
-
if (lastMatchedIndex > -1) {
|
|
301
|
-
rules[lastMatchedIndex].match = true
|
|
302
|
-
maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount
|
|
303
|
-
|
|
304
|
-
if (withdrawLimit === 0) {
|
|
305
|
-
availableWithdrawAmount = Math.min(balance, maxWithdrawAmount)
|
|
306
|
-
}
|
|
307
|
-
} else if (rules.length > 0) {
|
|
308
|
-
maxWithdrawAmount = rules[0].maxWithdrawAmount
|
|
309
|
-
} else {
|
|
310
|
-
maxWithdrawAmount = balance
|
|
311
|
-
}
|
|
346
|
+
const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
|
|
347
|
+
event.data?.withdrawRule
|
|
312
348
|
|
|
313
349
|
return {
|
|
314
|
-
maxWithdrawAmount,
|
|
315
|
-
availableWithdrawAmount,
|
|
350
|
+
// maxWithdrawAmount: maximumWithdrawAmount,
|
|
351
|
+
// availableWithdrawAmount: enableWithdrawAmount,
|
|
352
|
+
maximumWithdrawAmount: +maximumWithdrawAmount,
|
|
353
|
+
enableWithdrawAmount: +enableWithdrawAmount,
|
|
354
|
+
amount: +enableWithdrawAmount,
|
|
316
355
|
}
|
|
356
|
+
|
|
357
|
+
// const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
|
|
358
|
+
//
|
|
359
|
+
// const { balance, withdrawLimit } = context
|
|
360
|
+
// const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
|
|
361
|
+
//
|
|
362
|
+
// let maxWithdrawAmount = 0,
|
|
363
|
+
// availableWithdrawAmount = 0
|
|
364
|
+
//
|
|
365
|
+
// if (lastMatchedIndex > -1) {
|
|
366
|
+
// rules[lastMatchedIndex].match = true
|
|
367
|
+
// maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount
|
|
368
|
+
//
|
|
369
|
+
// if (withdrawLimit === 0) {
|
|
370
|
+
// availableWithdrawAmount = Math.min(balance, maxWithdrawAmount)
|
|
371
|
+
// }
|
|
372
|
+
// } else if (rules.length > 0) {
|
|
373
|
+
// maxWithdrawAmount = rules[0].maxWithdrawAmount
|
|
374
|
+
// } else {
|
|
375
|
+
// maxWithdrawAmount = balance
|
|
376
|
+
// }
|
|
377
|
+
//
|
|
378
|
+
// return {
|
|
379
|
+
// maxWithdrawAmount,
|
|
380
|
+
// availableWithdrawAmount,
|
|
381
|
+
// }
|
|
317
382
|
}),
|
|
318
383
|
setNetwork: assign((context, event) => {
|
|
319
384
|
return {
|
|
@@ -369,11 +434,19 @@ export default function (request) {
|
|
|
369
434
|
target,
|
|
370
435
|
}
|
|
371
436
|
}),
|
|
437
|
+
setAttachmentType: assign((context, event) => {
|
|
438
|
+
return {
|
|
439
|
+
attachmentType: event.data,
|
|
440
|
+
}
|
|
441
|
+
}),
|
|
372
442
|
},
|
|
373
443
|
guards: {
|
|
374
444
|
isFree: (context, event) => {
|
|
375
445
|
return context.userInfo?.withdraw_rule !== 'DEFAULT'
|
|
376
446
|
},
|
|
447
|
+
hasAttachmentType: (context, event) => {
|
|
448
|
+
return ['withdraw', 'pool'].includes(context.attachmentType)
|
|
449
|
+
},
|
|
377
450
|
haveProcessing: (context, event) => {
|
|
378
451
|
return (context.paymentDetail?.[0]?.processing || []).length > 0
|
|
379
452
|
},
|
|
@@ -402,16 +475,18 @@ export default function (request) {
|
|
|
402
475
|
isOtpRequired: (context, event) => {
|
|
403
476
|
return event.data?.status === 'otp-verifying'
|
|
404
477
|
},
|
|
478
|
+
isNewWalletMode: (context, event) => context.siteConfig.walletMode > 0,
|
|
405
479
|
},
|
|
406
480
|
services: {
|
|
407
481
|
fetchInitData: async (context, event) => {
|
|
408
|
-
const [{ config }, userInfo, paymentDetail = []] = await Promise.all([
|
|
482
|
+
const [{ config }, userInfo, paymentDetail = [], withdrawRule] = await Promise.all([
|
|
409
483
|
request.send(common.getConfig({ appSecret })),
|
|
410
484
|
request.send(user.getUserInfo()),
|
|
411
485
|
request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' })),
|
|
486
|
+
request.send(payment.getCurrentWithdrawRule()),
|
|
412
487
|
])
|
|
413
488
|
const siteConfig = JSON.parse(window.atob(config))
|
|
414
|
-
return { siteConfig, userInfo, paymentDetail }
|
|
489
|
+
return { siteConfig, userInfo, paymentDetail, withdrawRule }
|
|
415
490
|
},
|
|
416
491
|
fetchPaymentData: async (context, event) => {
|
|
417
492
|
const paymentDetail = await request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' }))
|
|
@@ -432,7 +507,7 @@ export default function (request) {
|
|
|
432
507
|
})
|
|
433
508
|
)
|
|
434
509
|
},
|
|
435
|
-
|
|
510
|
+
convertFreeCredit: async (context, event) => {
|
|
436
511
|
return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
|
|
437
512
|
},
|
|
438
513
|
fetchCalculation: async (context, event) => {
|
|
@@ -455,6 +530,13 @@ export default function (request) {
|
|
|
455
530
|
const code = event.data
|
|
456
531
|
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
457
532
|
},
|
|
533
|
+
pool: async (context, event) => {
|
|
534
|
+
const { amount } = context
|
|
535
|
+
return await request.send(payment.restore({ amount }))
|
|
536
|
+
},
|
|
537
|
+
giveUp: async (context, event) => {
|
|
538
|
+
return await request.send(payment.giveUp())
|
|
539
|
+
},
|
|
458
540
|
},
|
|
459
541
|
}
|
|
460
542
|
)
|
|
@@ -23,7 +23,7 @@ export default function (request) {
|
|
|
23
23
|
bankList: [],
|
|
24
24
|
withdrawLimit: null,
|
|
25
25
|
targetWithdrawLimit: null,
|
|
26
|
-
attachmentType: null, // 'withdraw'
|
|
26
|
+
attachmentType: null, // null | 'withdraw' | 'pool'
|
|
27
27
|
maximumWithdrawAmount: 0,
|
|
28
28
|
enableWithdrawAmount: 0,
|
|
29
29
|
|