@jetthai/cuora 1.1.128-dev-2 → 1.1.128

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +0 -424
  2. package/package.json +1 -1
  3. package/src/api/activity.js +0 -28
  4. package/src/api/auth.js +0 -6
  5. package/src/api/common.js +1 -2
  6. package/src/api/game.js +4 -5
  7. package/src/api/mailbox.js +5 -9
  8. package/src/api/payment.js +8 -103
  9. package/src/api/user.js +0 -2
  10. package/src/machine/activity/activity.js +16 -56
  11. package/src/machine/activity/activity_cash.js +14 -78
  12. package/src/machine/activity/diamond_shop_activity_cash.js +92 -57
  13. package/src/machine/activity/diamond_shop_activity_vn.js +89 -54
  14. package/src/machine/activity/fafafa_activity.js +1 -8
  15. package/src/machine/activity/friend_invite_friends_activity.js +1 -3
  16. package/src/machine/activity/index.js +0 -6
  17. package/src/machine/activity/roulette_activity_v2.js +2 -11
  18. package/src/machine/activity/sign_in_activity.js +13 -20
  19. package/src/machine/auth.js +5 -54
  20. package/src/machine/bank_binding.js +12 -112
  21. package/src/machine/bank_binding_amb.js +1 -6
  22. package/src/machine/common.js +24 -92
  23. package/src/machine/deposit/amb.js +3 -5
  24. package/src/machine/deposit/crypto.js +10 -14
  25. package/src/machine/deposit/crypto_button.js +5 -9
  26. package/src/machine/deposit/crypto_cash.js +5 -2
  27. package/src/machine/deposit/direct.js +15 -2
  28. package/src/machine/deposit/direct_cash.js +26 -6
  29. package/src/machine/deposit/float.js +3 -5
  30. package/src/machine/deposit/index.js +0 -14
  31. package/src/machine/deposit/loadcard_cash.js +27 -6
  32. package/src/machine/deposit/loadcard_vn.js +13 -2
  33. package/src/machine/deposit/manual_cash.js +38 -89
  34. package/src/machine/deposit/manual_vn.js +53 -99
  35. package/src/machine/deposit/qrcode_cash.js +23 -12
  36. package/src/machine/deposit/qrcode_v2.js +14 -3
  37. package/src/machine/deposit/usdt_cash.js +2 -0
  38. package/src/machine/deposit/vpay.js +3 -5
  39. package/src/machine/game_search_cash.js +12 -137
  40. package/src/machine/game_search_v2.js +4 -4
  41. package/src/machine/game_v2_1.js +7 -131
  42. package/src/machine/inbox.js +34 -259
  43. package/src/machine/index.js +0 -6
  44. package/src/machine/leaderboard.js +8 -31
  45. package/src/machine/reward_cash.js +1 -1
  46. package/src/machine/side_v2.js +1 -1
  47. package/src/machine/user_sign_up.js +7 -71
  48. package/src/machine/withdraw/index.js +0 -6
  49. package/src/machine/withdraw/withdraw_crypto.js +66 -1
  50. package/src/machine/withdraw/withdraw_manual_cash.js +14 -44
  51. package/src/machine/withdraw/withdraw_vn.js +7 -42
  52. package/src/machine/withdraw/withdraw_vn2.js +37 -64
  53. package/src/util/constant.js +0 -18
  54. package/src/util/deviceToken.js +2 -2
  55. package/src/machine/activity/cash_rain_activity.js +0 -153
  56. package/src/machine/activity/instant_rebate_activity.js +0 -214
  57. package/src/machine/activity/vip_card_activity.js +0 -140
  58. package/src/machine/deposit/crypto_bank.js +0 -317
  59. package/src/machine/deposit/crypto_bank_cash.js +0 -280
  60. package/src/machine/deposit/crypto_qrcode.js +0 -147
  61. package/src/machine/deposit/crypto_qrcode_cash.js +0 -131
  62. package/src/machine/deposit/crypto_way.js +0 -220
  63. package/src/machine/deposit/crypto_way_cash.js +0 -242
  64. package/src/machine/deposit/krway.js +0 -151
  65. package/src/machine/game_info.js +0 -57
  66. package/src/machine/honor_board_cash.js +0 -63
  67. package/src/machine/user_photo.js +0 -65
  68. package/src/machine/withdraw/withdraw_crypto2.js +0 -540
  69. package/src/machine/withdraw/withdraw_krway.js +0 -207
  70. package/src/machine/withdraw/withdraw_manual.js +0 -595
@@ -1,220 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import padStart from 'lodash/padStart.js'
3
- import payment from '@jetthai/cuora/src/api/payment.js'
4
- import common from '../../api/common.js'
5
-
6
- export default function (request) {
7
- const { appSecret } = request.config
8
- return createMachine(
9
- {
10
- id: 'crypto_way',
11
- initial: 'loading',
12
- context: {
13
- paymentDetails: [],
14
-
15
- cryptos: [],
16
- sourceAddress: '',
17
-
18
- amount: null,
19
- selectedCrypto: null,
20
-
21
- currentCategory: 'cryptoWay',
22
- currentPayment: null,
23
-
24
- calculation: null,
25
- result: null,
26
-
27
- // use for wallet mode 4
28
- promotion: null,
29
- },
30
- states: {
31
- loading: {
32
- invoke: {
33
- src: 'fetchPayments',
34
- onDone: {
35
- target: 'loaded',
36
- actions: 'setPayment',
37
- },
38
- onError: {
39
- target: '#crypto_way.fail',
40
- },
41
- },
42
- },
43
- loaded: {
44
- always: [{ target: 'debouncing', cond: 'isCalculable' }],
45
- },
46
- debouncing: {
47
- after: {
48
- 1000: {
49
- target: 'calculating',
50
- },
51
- },
52
- },
53
- calculating: {
54
- invoke: {
55
- src: 'fetchCalculation',
56
- onDone: {
57
- target: 'calculated',
58
- actions: 'setCalculation',
59
- },
60
- onError: {
61
- target: 'loaded',
62
- },
63
- },
64
- },
65
- calculated: {
66
- on: {
67
- SUBMIT: [
68
- {
69
- target: 'pending',
70
- },
71
- {
72
- target: 'submitting',
73
- cond: 'isSubmittable',
74
- },
75
- ],
76
- },
77
- },
78
- pending: {
79
- on: {
80
- SUBMIT: {
81
- target: 'submitting',
82
- cond: 'isSubmittable',
83
- },
84
- },
85
- },
86
- submitting: {
87
- invoke: {
88
- src: 'submitDeposit',
89
- onDone: {
90
- target: 'submitted',
91
- actions: 'setResult',
92
- },
93
- onError: {
94
- target: 'loaded',
95
- },
96
- },
97
- },
98
- submitted: {},
99
- fail: {},
100
- },
101
- on: {
102
- SET_CRYPTO: {
103
- target: '.loaded',
104
- actions: 'setCrypto',
105
- },
106
- SET_ADDRESS: {
107
- actions: 'setAddress',
108
- },
109
- SET_AMOUNT: {
110
- target: '.loaded',
111
- actions: ['setAmount', 'clearCalculation'],
112
- },
113
- CALCULATE: {
114
- target: '.debouncing',
115
- actions: 'clearCalculation',
116
- },
117
- SET_PROMOTION: {
118
- actions: 'setPromotion',
119
- },
120
- },
121
- },
122
- {
123
- actions: {
124
- setPayment: assign((context, event) => {
125
- const payments = event.data.filter((item) => item.category === context.currentCategory)
126
- const cryptos = payments?.map((value, i) => {
127
- return {
128
- ...value,
129
- label: value?.cryptoOptional[0],
130
- network: value?.networkName[0],
131
- icon: value?.channel,
132
- }
133
- })
134
- return {
135
- cryptos,
136
- selectedCrypto: cryptos[0],
137
- currentPayment: cryptos[0],
138
- }
139
- }),
140
- setCrypto: assign((context, event) => {
141
- const { cryptos } = context
142
- const selectedCrypto = cryptos.find((crypto) => crypto.label === event.data.label)
143
- return {
144
- selectedCrypto: selectedCrypto,
145
- amount: null,
146
- calculation: null,
147
- }
148
- }),
149
- setAmount: assign((context, event) => {
150
- return {
151
- amount: event.data,
152
- }
153
- }),
154
- setAddress: assign((context, event) => {
155
- return {
156
- sourceAddress: event.data,
157
- }
158
- }),
159
- setCalculation: assign((context, event) => {
160
- return {
161
- calculation: event.data,
162
- }
163
- }),
164
- clearCalculation: assign((context, event) => {
165
- return {
166
- calculation: null,
167
- }
168
- }),
169
- setResult: assign((context, event) => {
170
- return {
171
- result: event.data,
172
- }
173
- }),
174
- setPromotion: assign((context, event) => {
175
- const promotion = event.data
176
- return {
177
- promotion,
178
- }
179
- }),
180
- },
181
- guards: {
182
- isCalculable: (context, event) => {
183
- const { selectedCrypto, amount } = context
184
- return selectedCrypto && amount && selectedCrypto?.minimum <= +amount && +amount <= selectedCrypto?.maximum
185
- },
186
- isSubmittable: (context, event) => {
187
- const { selectedCrypto, amount } = context
188
- return selectedCrypto && amount
189
- },
190
- },
191
- services: {
192
- fetchPayments: async (context, event) => {
193
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
194
- },
195
- fetchCalculation: async (context, event) => {
196
- const { selectedCrypto, amount, promotion } = context
197
- return await request.send(
198
- payment.getCryptoDepositExpectedResult({
199
- method: selectedCrypto.method,
200
- amount,
201
- cryptoCurrency: selectedCrypto.channel,
202
- promotionsNo: promotion?.activityNo,
203
- })
204
- )
205
- },
206
- submitDeposit: async (context, event) => {
207
- const { selectedCrypto, amount } = context
208
- return await request.send(
209
- payment.submitDepositTransactionCrypto({
210
- method: selectedCrypto.method,
211
- amount: amount,
212
- cryptoCurrency: selectedCrypto.channel,
213
- cryptoNetwork: selectedCrypto.network,
214
- })
215
- )
216
- },
217
- },
218
- }
219
- )
220
- }
@@ -1,242 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '@jetthai/cuora/src/api/payment.js'
3
- import { max } from '../../util/index.js'
4
-
5
- export default function (request, context) {
6
- const { paymentDetail = [], promotion, selectedAmount } = context || {}
7
- return createMachine(
8
- {
9
- id: 'crypto_way_cash',
10
- initial: 'loading',
11
- context: {
12
- paymentDetail,
13
- promotion,
14
- selectedAmount,
15
-
16
- cryptos: [],
17
- sourceAddress: '',
18
- options: [],
19
-
20
- selectedCrypto: null,
21
-
22
- currentCategory: 'cryptoWay',
23
-
24
- calculation: null,
25
- result: null,
26
- ttl: 0,
27
- },
28
- states: {
29
- loading: {
30
- always: [
31
- {
32
- target: 'debouncing',
33
- actions: 'setInitData',
34
- },
35
- ],
36
- },
37
- loaded: {},
38
- debouncing: {
39
- entry: 'clearCalculation',
40
- after: {
41
- 1000: [
42
- {
43
- target: 'calculating',
44
- cond: 'isCalculable',
45
- },
46
- {
47
- target: 'loaded',
48
- },
49
- ],
50
- },
51
- },
52
- calculating: {
53
- invoke: {
54
- src: 'fetchCalculation',
55
- onDone: {
56
- target: 'calculated',
57
- actions: 'setCalculation',
58
- },
59
- onError: {
60
- target: 'calculated',
61
- },
62
- },
63
- },
64
- calculated: {
65
- on: {
66
- SUBMIT: [
67
- {
68
- target: 'submitting',
69
- cond: 'isSubmittable',
70
- },
71
- ],
72
- },
73
- },
74
- submitting: {
75
- invoke: {
76
- src: 'submitDeposit',
77
- onDone: {
78
- target: 'submitted',
79
- actions: ['setResult', 'setTtl'],
80
- },
81
- onError: {
82
- target: 'calculated',
83
- },
84
- },
85
- },
86
- submitted: {
87
- after: {
88
- 1000: {
89
- target: 'submitted',
90
- actions: 'decreaseTtl',
91
- cond: (context) => context.ttl > 0,
92
- },
93
- },
94
- },
95
- },
96
- on: {
97
- SET_PROMOTION: {
98
- target: '.debouncing',
99
- actions: 'setPromotion',
100
- internal: false,
101
- },
102
- SET_CRYPTO: {
103
- target: '.debouncing',
104
- actions: 'setCrypto',
105
- internal: false,
106
- },
107
- SET_ADDRESS: {
108
- actions: 'setAddress',
109
- internal: false,
110
- },
111
- SET_AMOUNT: {
112
- target: '.debouncing',
113
- actions: 'setAmount',
114
- internal: false,
115
- },
116
- INPUT_AMOUNT: {
117
- target: '.debouncing',
118
- actions: 'inputAmount',
119
- internal: false,
120
- },
121
- },
122
- },
123
- {
124
- actions: {
125
- setInitData: assign((context, event) => {
126
- const { paymentDetail } = context
127
- const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
128
- const cryptos = payments.map((payment) => ({
129
- ...payment,
130
- label: payment.cryptoOptional?.[0],
131
- network: payment.networkName?.[0],
132
- value: payment.method,
133
- icon: payment.channel,
134
- }))
135
-
136
- return {
137
- cryptos,
138
- selectedCrypto: cryptos[0],
139
- options: cryptos[0].optional,
140
- }
141
- }),
142
- setCrypto: assign((context, event) => {
143
- const { cryptos } = context
144
- const selectedCrypto = cryptos.find((crypto) => crypto.label === event.data.label)
145
- return {
146
- selectedCrypto: selectedCrypto,
147
- selectedAmount: null,
148
- calculation: null,
149
- options: selectedCrypto.optional,
150
- }
151
- }),
152
- setAmount: assign((context, event) => {
153
- // 現金網可自由填額度,grandTotalEnable 欄位感覺不再需要?
154
- if (context.selectedCrypto?.grandTotalEnable === 1) {
155
- return { selectedAmount: parseFloat(context.selectedAmount || 0) + parseFloat(event.data) }
156
- } else {
157
- return { selectedAmount: event.data }
158
- }
159
- }),
160
- inputAmount: assign((context, event) => {
161
- return { selectedAmount: event.data }
162
- }),
163
- setAddress: assign((context, event) => {
164
- return {
165
- sourceAddress: event.data,
166
- }
167
- }),
168
- setCalculation: assign((context, event) => {
169
- return {
170
- calculation: event.data,
171
- }
172
- }),
173
- clearCalculation: assign((context, event) => {
174
- return {
175
- calculation: null,
176
- }
177
- }),
178
- setResult: assign((context, event) => {
179
- return {
180
- result: event.data,
181
- }
182
- }),
183
- setPromotion: assign((context, event) => {
184
- const { selectedCrypto, selectedAmount } = context
185
- const promotion = event.data
186
- return {
187
- promotion,
188
- selectedAmount: max(promotion.minimumAmount, selectedCrypto.minimum, selectedAmount, 0),
189
- calculation: null,
190
- }
191
- }),
192
- setTtl: assign((context, event) => {
193
- const { cdtime } = event.data
194
- return {
195
- ttl: cdtime,
196
- }
197
- }),
198
- decreaseTtl: assign((context, evnet) => {
199
- return {
200
- ttl: Math.max(context.ttl - 1000, 0),
201
- }
202
- }),
203
- },
204
- guards: {
205
- isCalculable: (context, event) => {
206
- const { selectedCrypto, selectedAmount } = context
207
- return selectedCrypto && selectedAmount && selectedCrypto.minimum <= +selectedAmount && +selectedAmount <= selectedCrypto.maximum
208
- },
209
- isSubmittable: (context, event) => {
210
- const { selectedCrypto, selectedAmount, calculation } = context
211
- return selectedCrypto && selectedAmount && calculation
212
- },
213
- },
214
- services: {
215
- fetchCalculation: async (context, event) => {
216
- const { selectedCrypto, selectedAmount, promotion } = context
217
- return await request.send(
218
- payment.getCryptoDepositExpectedResult({
219
- method: selectedCrypto.method,
220
- amount: selectedAmount,
221
- cryptoCurrency: selectedCrypto.channel,
222
- promotionsNo: promotion?.promotionsNo,
223
- })
224
- )
225
- },
226
- submitDeposit: async (context, event) => {
227
- const { selectedCrypto, selectedAmount, sourceAddress, promotion } = context
228
- return await request.send(
229
- payment.submitDepositTransactionCrypto({
230
- method: selectedCrypto.method,
231
- amount: selectedAmount,
232
- cryptoCurrency: selectedCrypto.channel,
233
- cryptoNetwork: selectedCrypto.network,
234
- sourceAddress: sourceAddress,
235
- promotionsNo: promotion?.promotionsNo,
236
- })
237
- )
238
- },
239
- },
240
- }
241
- )
242
- }
@@ -1,151 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '../../api/payment.js'
3
- import mailbox from '../../api/mailbox.js'
4
-
5
- export default function (request) {
6
- return createMachine(
7
- {
8
- id: 'krway',
9
- initial: 'loading',
10
- context: {
11
- currentCategory: 'krway',
12
- paymentDetail: [],
13
- currentPayment: null,
14
- options: [],
15
- amount: null,
16
- processing: null,
17
- },
18
- states: {
19
- loading: {
20
- invoke: {
21
- src: 'fetchPaymentDetail',
22
- onDone: {
23
- target: 'checking',
24
- actions: 'setPaymentDetail',
25
- },
26
- onError: {
27
- target: 'fail',
28
- },
29
- },
30
- },
31
- checking: {
32
- always: [
33
- {
34
- target: 'processing',
35
- cond: 'isProcessing',
36
- },
37
- {
38
- target: 'idle',
39
- },
40
- ],
41
- },
42
- processing: {},
43
- idle: {},
44
- inquiring: {
45
- invoke: {
46
- src: 'accountInquiry',
47
- onDone: {
48
- target: 'inquired',
49
- },
50
- onError: {
51
- target: 'idle',
52
- },
53
- },
54
- },
55
- inquired: {
56
- after: {
57
- 0: {
58
- target: 'idle',
59
- },
60
- },
61
- },
62
- submitting: {
63
- invoke: {
64
- src: 'submitDeposit',
65
- onDone: {
66
- target: 'submitted',
67
- actions: 'setProcessing',
68
- },
69
- onError: {
70
- target: 'fail',
71
- },
72
- },
73
- },
74
- submitted: {},
75
- fail: {},
76
- },
77
- on: {
78
- INQUIRY_ACCOUNT: {
79
- target: 'inquiring',
80
- },
81
- ADD_AMOUNT: {
82
- actions: 'addAmount',
83
- },
84
- SET_AMOUNT: {
85
- actions: 'setAmount',
86
- },
87
- CLEAR_AMOUNT: {
88
- actions: 'clearAmount',
89
- },
90
- SUBMIT: {
91
- target: 'submitting',
92
- },
93
- },
94
- },
95
- {
96
- actions: {
97
- setPaymentDetail: assign((context, event) => {
98
- const paymentDetail = event.data
99
- const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
100
- const currentPayment = payments[0]
101
- const options = currentPayment.optional || []
102
-
103
- return {
104
- currentPayment,
105
- options,
106
- processing: currentPayment.processing?.[0],
107
- }
108
- }),
109
- addAmount: assign((context, event) => {
110
- return {
111
- amount: parseFloat(`${context.amount || 0}`) + parseFloat(`${event.data}`),
112
- }
113
- }),
114
- setAmount: assign((context, event) => {
115
- return { amount: parseFloat(`${event.data}`) }
116
- }),
117
- clearAmount: assign((context, event) => {
118
- return { amount: null }
119
- }),
120
- setProcessing: assign((context, event) => {
121
- return {
122
- processing: event.data,
123
- }
124
- }),
125
- },
126
- guards: {
127
- isProcessing: (context, event) => {
128
- return context.processing
129
- },
130
- },
131
- services: {
132
- fetchPaymentDetail: async (context, event) => {
133
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
134
- },
135
- accountInquiry: async (context, event) => {
136
- const { from, title, content } = event.data
137
- return await request.send(mailbox.sendMessage({ type: 'CUSTOMER', category: 'DEPOSIT', from, to: 'SYSTEM', title, content }))
138
- },
139
- submitDeposit: async (context, event) => {
140
- const { currentPayment, amount } = context
141
- return await request.send(
142
- payment.submitDepositTransaction({
143
- method: currentPayment.method,
144
- amount,
145
- })
146
- )
147
- },
148
- },
149
- }
150
- )
151
- }
@@ -1,57 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import game from '../api/game.js'
3
-
4
- export default function (request, context) {
5
- const { appSecret } = request.config
6
- const { gameCode } = context
7
- return createMachine(
8
- {
9
- id: 'game_info',
10
- initial: 'fetching',
11
- context: {
12
- gameInfo: {},
13
- },
14
- states: {
15
- fetching: {
16
- invoke: {
17
- src: 'fetchGameInfo',
18
- onDone: {
19
- target: 'idle',
20
- actions: 'setGameInfo',
21
- },
22
- onError: {
23
- target: 'idle',
24
- },
25
- },
26
- },
27
- idle: {
28
- // on: {
29
- // SET_GAME_CODE: {
30
- // actions: 'setGameCode',
31
- // },
32
- // },
33
- },
34
- },
35
- },
36
- {
37
- actions: {
38
- setGameInfo: assign((context, event) => {
39
- return {
40
- gameInfo: event.data.data,
41
- }
42
- }),
43
- // setGameCode: assign((context, event) => {
44
- // return {
45
- // gameCode: event.data.data,
46
- // }
47
- // }),
48
- },
49
- services: {
50
- // 取得遊戲資訊
51
- fetchGameInfo: async (context, event) => {
52
- return await request.send(game.getGameInfo({ appSecret, gameCode }))
53
- },
54
- },
55
- }
56
- )
57
- }