@jetthai/cuora 1.0.307-dev-2 → 1.1.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +4 -853
  2. package/README.md +0 -6
  3. package/dist/bundle.mjs +18461 -0
  4. package/package.json +9 -6
  5. package/rollup.config.js +16 -0
  6. package/src/api/activity.js +2 -43
  7. package/src/api/auth.js +7 -22
  8. package/src/api/common.js +1 -3
  9. package/src/api/game.js +7 -20
  10. package/src/api/mailbox.js +5 -9
  11. package/src/api/payment.js +19 -167
  12. package/src/api/user.js +0 -7
  13. package/src/machine/activity/activity.js +26 -111
  14. package/src/machine/activity/{friend_invite_friends_activity.js → affiliate_invite_friends_activity.js} +41 -70
  15. package/src/machine/activity/continue_deposit_activity.js +2 -11
  16. package/src/machine/activity/deposit_activity.js +4 -13
  17. package/src/machine/activity/diamond_shop_activity_vn.js +89 -54
  18. package/src/machine/activity/fafafa_activity.js +19 -34
  19. package/src/machine/activity/index.js +4 -22
  20. package/src/machine/activity/invite_friends_activity.js +14 -14
  21. package/src/machine/activity/ranking_activity.js +2 -11
  22. package/src/machine/activity/sign_in_activity.js +14 -21
  23. package/src/machine/activity/specify_bets_activity.js +3 -25
  24. package/src/machine/activity/specify_turnover_activity.js +3 -25
  25. package/src/machine/activity/time_bomb_activity.js +2 -11
  26. package/src/machine/auth.js +25 -141
  27. package/src/machine/auth_otp.js +201 -0
  28. package/src/machine/auth_otp_v2.js +4 -10
  29. package/src/machine/auth_otp_v3.js +3 -11
  30. package/src/machine/bank_binding.js +12 -112
  31. package/src/machine/common.js +30 -110
  32. package/src/machine/deposit/crypto.js +29 -50
  33. package/src/machine/deposit/crypto_button.js +39 -174
  34. package/src/machine/deposit/deposit_fc.js +5 -8
  35. package/src/machine/deposit/direct.js +16 -111
  36. package/src/machine/deposit/index.js +2 -43
  37. package/src/machine/deposit/loadcard_vn.js +43 -191
  38. package/src/machine/deposit/manual_vn.js +60 -182
  39. package/src/machine/deposit/qrcode_v2.js +52 -285
  40. package/src/machine/deposit/qrcode_vn.js +206 -0
  41. package/src/machine/game.js +285 -0
  42. package/src/machine/game_favorite.js +123 -0
  43. package/src/machine/game_favorite_v2.js +28 -74
  44. package/src/machine/game_search.js +244 -0
  45. package/src/machine/game_search_v2.js +24 -64
  46. package/src/machine/game_v2.js +356 -0
  47. package/src/machine/inbox.js +34 -259
  48. package/src/machine/index.js +17 -26
  49. package/src/machine/leaderboard.js +8 -31
  50. package/src/machine/reward.js +7 -74
  51. package/src/machine/setting.js +2 -5
  52. package/src/machine/side_v2.js +28 -33
  53. package/src/machine/user_sign_up.js +21 -112
  54. package/src/machine/{withdraw/withdraw_crypto.js → withdraw_crypto.js} +69 -220
  55. package/src/machine/{withdraw/withdraw_fc.js → withdraw_fc.js} +2 -2
  56. package/src/machine/{withdraw/withdraw_amb.js → withdraw_vn.js} +78 -146
  57. package/src/request/request.js +5 -10
  58. package/src/util/constant.js +1 -19
  59. package/src/util/deviceToken.js +8 -18
  60. package/src/util/index.js +1 -2
  61. package/src/util/storage.js +22 -22
  62. package/.husky/pre-commit +0 -4
  63. package/.prettierignore +0 -1
  64. package/src/lib/fingerprint.js +0 -9779
  65. package/src/machine/activity/activity_cash.js +0 -159
  66. package/src/machine/activity/cash_rain_activity.js +0 -153
  67. package/src/machine/activity/diamond_shop_activity_cash.js +0 -179
  68. package/src/machine/activity/instant_rebate_activity.js +0 -195
  69. package/src/machine/activity/jackpot.js +0 -74
  70. package/src/machine/activity/otp_verified_activity.js +0 -74
  71. package/src/machine/activity/roulette_activity_v2.js +0 -90
  72. package/src/machine/activity/sign_in_monthly_activity.js +0 -65
  73. package/src/machine/activity/vip_card_activity.js +0 -140
  74. package/src/machine/bank_binding_amb.js +0 -145
  75. package/src/machine/deposit/amb.js +0 -92
  76. package/src/machine/deposit/crypto_bank.js +0 -317
  77. package/src/machine/deposit/crypto_bank_cash.js +0 -287
  78. package/src/machine/deposit/crypto_cash.js +0 -255
  79. package/src/machine/deposit/crypto_qrcode.js +0 -148
  80. package/src/machine/deposit/crypto_qrcode_cash.js +0 -131
  81. package/src/machine/deposit/crypto_way.js +0 -239
  82. package/src/machine/deposit/crypto_way_cash.js +0 -256
  83. package/src/machine/deposit/direct_cash.js +0 -217
  84. package/src/machine/deposit/float.js +0 -366
  85. package/src/machine/deposit/krway.js +0 -151
  86. package/src/machine/deposit/loadcard_cash.js +0 -207
  87. package/src/machine/deposit/manual_cash.js +0 -356
  88. package/src/machine/deposit/qrcode_cash.js +0 -217
  89. package/src/machine/deposit/usdt.js +0 -144
  90. package/src/machine/deposit/usdt_cash.js +0 -138
  91. package/src/machine/deposit/vpay.js +0 -359
  92. package/src/machine/game_info.js +0 -57
  93. package/src/machine/game_search_cash.js +0 -390
  94. package/src/machine/game_v2_1.js +0 -662
  95. package/src/machine/honor_board.js +0 -118
  96. package/src/machine/honor_board_cash.js +0 -89
  97. package/src/machine/navbar.js +0 -57
  98. package/src/machine/promotions.js +0 -171
  99. package/src/machine/reward_cash.js +0 -219
  100. package/src/machine/roulette_v2.js +0 -276
  101. package/src/machine/side_cash.js +0 -110
  102. package/src/machine/user_photo.js +0 -65
  103. package/src/machine/withdraw/index.js +0 -23
  104. package/src/machine/withdraw/withdraw_crypto2.js +0 -540
  105. package/src/machine/withdraw/withdraw_crypto_cash.js +0 -319
  106. package/src/machine/withdraw/withdraw_krway.js +0 -220
  107. package/src/machine/withdraw/withdraw_manual.js +0 -610
  108. package/src/machine/withdraw/withdraw_manual_cash.js +0 -303
  109. package/src/machine/withdraw/withdraw_vn.js +0 -546
  110. package/src/machine/withdraw/withdraw_vn2.js +0 -561
  111. package/src/util/math.js +0 -4
@@ -1,255 +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_cash',
10
- initial: 'loading',
11
- context: {
12
- paymentDetail,
13
- promotion,
14
- selectedAmount,
15
-
16
- cryptos: [],
17
- networks: [],
18
- sourceAddress: '',
19
- options: [],
20
-
21
- selectedCrypto: null,
22
- selectedNetwork: null,
23
-
24
- currentCategory: 'crypto',
25
-
26
- calculation: null,
27
- result: null,
28
- },
29
- states: {
30
- loading: {
31
- always: [
32
- {
33
- target: 'debouncing',
34
- actions: 'setInitData',
35
- },
36
- ],
37
- },
38
- loaded: {},
39
- debouncing: {
40
- entry: 'clearCalculation',
41
- after: {
42
- 1000: [
43
- {
44
- target: 'calculating',
45
- cond: 'isCalculable',
46
- },
47
- {
48
- target: 'loaded',
49
- },
50
- ],
51
- },
52
- },
53
- calculating: {
54
- invoke: {
55
- src: 'fetchCalculation',
56
- onDone: {
57
- target: 'calculated',
58
- actions: 'setCalculation',
59
- },
60
- onError: {
61
- target: 'calculated',
62
- },
63
- },
64
- },
65
- calculated: {
66
- on: {
67
- SUBMIT: [
68
- {
69
- target: 'submitting',
70
- cond: 'isSubmittable',
71
- },
72
- ],
73
- },
74
- },
75
- submitting: {
76
- invoke: {
77
- src: 'submitDeposit',
78
- onDone: {
79
- target: 'submitted',
80
- actions: 'setResult',
81
- },
82
- onError: {
83
- target: 'loaded',
84
- },
85
- },
86
- },
87
- submitted: {},
88
- },
89
- on: {
90
- SET_PROMOTION: {
91
- target: '.debouncing',
92
- actions: 'setPromotion',
93
- internal: false,
94
- },
95
- SET_CRYPTO: {
96
- target: '.debouncing',
97
- actions: 'setCrypto',
98
- internal: false,
99
- },
100
- SET_NETWORK: {
101
- target: '.debouncing',
102
- actions: 'setNetwork',
103
- internal: false,
104
- },
105
- SET_ADDRESS: {
106
- actions: 'setAddress',
107
- internal: false,
108
- },
109
- SET_AMOUNT: {
110
- target: '.debouncing',
111
- actions: 'setAmount',
112
- internal: false,
113
- },
114
- INPUT_AMOUNT: {
115
- target: '.debouncing',
116
- actions: 'inputAmount',
117
- internal: false,
118
- },
119
- },
120
- },
121
- {
122
- actions: {
123
- setInitData: assign((context, event) => {
124
- const { paymentDetail } = context
125
- const cryptos = paymentDetail
126
- .filter((element) => element.transferType === 'deposit' && element.category === context.currentCategory)
127
- .map((crypto) => ({
128
- ...crypto,
129
- label: crypto.channel,
130
- value: crypto.method,
131
- icon: crypto.channel,
132
- }))
133
- const defaultNetworks = cryptos[0].networkName.map((value, i) => {
134
- return {
135
- label: cryptos[0].networkOptional?.[i],
136
- value,
137
- icon: value,
138
- }
139
- })
140
- return {
141
- cryptos,
142
- networks: defaultNetworks,
143
- selectedCrypto: cryptos[0],
144
- selectedNetwork: defaultNetworks[0],
145
- options: cryptos[0].optional,
146
- }
147
- }),
148
- setCrypto: assign((context, event) => {
149
- const { cryptos } = context
150
- const selectedCrypto = cryptos.find((crypto) => crypto.method === event.data.value)
151
- const networks = selectedCrypto?.networkName.map((value, i) => {
152
- return {
153
- label: selectedCrypto?.networkOptional?.[i],
154
- value,
155
- icon: value,
156
- }
157
- })
158
- return {
159
- networks,
160
- selectedCrypto: selectedCrypto,
161
- selectedNetwork: networks[0],
162
- selectedAmount: null,
163
- calculation: null,
164
- options: selectedCrypto.optional,
165
- }
166
- }),
167
- setNetwork: assign((context, event) => {
168
- return { selectedNetwork: event.data }
169
- }),
170
- setAmount: assign((context, event) => {
171
- // 現金網可自由填額度,grandTotalEnable 欄位感覺不再需要?
172
- if (context.selectedCrypto?.grandTotalEnable === 1) {
173
- return { selectedAmount: parseFloat(context.selectedAmount || 0) + parseFloat(event.data) }
174
- } else {
175
- return { selectedAmount: event.data }
176
- }
177
- }),
178
- inputAmount: assign((context, event) => {
179
- return { selectedAmount: event.data }
180
- }),
181
- setAddress: assign((context, event) => {
182
- return {
183
- sourceAddress: event.data,
184
- }
185
- }),
186
- setCalculation: assign((context, event) => {
187
- return {
188
- calculation: event.data,
189
- }
190
- }),
191
- clearCalculation: assign((context, event) => {
192
- return {
193
- calculation: null,
194
- }
195
- }),
196
- setResult: assign((context, event) => {
197
- return {
198
- result: event.data,
199
- }
200
- }),
201
- setPromotion: assign((context, event) => {
202
- const { selectedCrypto, selectedAmount } = context
203
- const promotion = event.data
204
- return {
205
- promotion,
206
- selectedAmount: max(promotion.minimumAmount, selectedCrypto.minimum, selectedAmount, 0),
207
- calculation: null,
208
- }
209
- }),
210
- },
211
- guards: {
212
- isCalculable: (context, event) => {
213
- const { selectedCrypto, selectedNetwork, selectedAmount } = context
214
- return (
215
- selectedCrypto &&
216
- selectedNetwork &&
217
- selectedAmount &&
218
- selectedCrypto.minimum <= +selectedAmount &&
219
- +selectedAmount <= selectedCrypto.maximum
220
- )
221
- },
222
- isSubmittable: (context, event) => {
223
- const { selectedCrypto, selectedNetwork, selectedAmount } = context
224
- return selectedCrypto && selectedNetwork && selectedAmount
225
- },
226
- },
227
- services: {
228
- fetchCalculation: async (context, event) => {
229
- const { selectedCrypto, selectedAmount, promotion } = context
230
- return await request.send(
231
- payment.getDepositExpectedResult({
232
- method: selectedCrypto.method,
233
- amount: selectedAmount,
234
- cryptoCurrency: selectedCrypto.channel,
235
- promotionsNo: promotion?.promotionsNo,
236
- })
237
- )
238
- },
239
- submitDeposit: async (context, event) => {
240
- const { selectedCrypto, selectedNetwork, calculation, sourceAddress, promotion } = context
241
- return await request.send(
242
- payment.submitDepositTransactionCrypto({
243
- method: selectedCrypto.method,
244
- amount: calculation.actualAmount,
245
- cryptoCurrency: selectedCrypto.channel,
246
- cryptoNetwork: selectedNetwork.value,
247
- sourceAddress: sourceAddress,
248
- promotionsNo: promotion?.promotionsNo,
249
- })
250
- )
251
- },
252
- },
253
- }
254
- )
255
- }
@@ -1,148 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '@jetthai/cuora/src/api/payment.js'
3
-
4
- export default function (request) {
5
- return createMachine(
6
- {
7
- id: 'crypto_qrcode',
8
- initial: 'loading',
9
- context: {
10
- paymentDetails: [],
11
- currentCategory: 'cryptoQrcode',
12
- currentPayment: null,
13
- cryptos: [],
14
- selectedCrypto: null,
15
-
16
- resultMap: {},
17
- result: {
18
- action: '',
19
- cdtime: null,
20
- accountNumber: '', // crypto address
21
- currency: '',
22
- network: '',
23
- name: '',
24
- qrcode: '',
25
- },
26
- },
27
- states: {
28
- loading: {
29
- invoke: {
30
- src: 'fetchPaymentDetail',
31
- onDone: {
32
- target: 'fetching',
33
- actions: 'setInitData',
34
- },
35
- onError: {
36
- target: 'fail',
37
- },
38
- },
39
- },
40
- finding: {
41
- always: [
42
- {
43
- target: 'idle',
44
- actions: 'setResultFromLocal',
45
- cond: 'isFound',
46
- },
47
- {
48
- target: 'fetching',
49
- },
50
- ],
51
- },
52
- fetching: {
53
- invoke: {
54
- src: 'submitDeposit',
55
- onDone: {
56
- target: 'idle',
57
- actions: 'setResult',
58
- },
59
- onError: {
60
- target: 'idle',
61
- },
62
- },
63
- },
64
- idle: {},
65
- fail: {},
66
- },
67
- on: {
68
- SET_CRYPTO: {
69
- target: '.finding',
70
- actions: 'setCrypto',
71
- },
72
- },
73
- },
74
- {
75
- actions: {
76
- setInitData: assign((context, event) => {
77
- const paymentDetail = event.data || []
78
- const payments = paymentDetail.filter((item) => item.transferType === 'deposit' && item.category === context.currentCategory)
79
- const cryptos = payments?.map((value, i) => {
80
- return {
81
- ...value,
82
- label: value?.cryptoOptional[0],
83
- network: value?.networkName[0],
84
- icon: value?.channel,
85
- }
86
- })
87
- return {
88
- cryptos,
89
- selectedCrypto: cryptos[0],
90
- currentPayment: cryptos[0],
91
- }
92
- }),
93
- setCrypto: assign((context, event) => {
94
- const { cryptos } = context
95
- const selectedCrypto = cryptos.find((crypto) => crypto.label === event.data.label)
96
- return { selectedCrypto }
97
- }),
98
- setResultFromLocal: assign((context, event) => {
99
- const { resultMap, selectedCrypto } = context
100
- return { result: resultMap[selectedCrypto.network] }
101
- }),
102
- setResult: assign((context, event) => {
103
- const { resultMap, selectedCrypto } = context
104
- const { action, cdtime, accountNumber, currency, network, name, qrcode, redirect } = event.data
105
- const result = {
106
- action,
107
- cdtime,
108
- accountNumber,
109
- currency,
110
- network,
111
- name,
112
- qrcode,
113
- redirect,
114
- }
115
-
116
- return {
117
- result,
118
- resultMap: {
119
- ...resultMap,
120
- [selectedCrypto.network]: result,
121
- },
122
- }
123
- }),
124
- },
125
- guards: {
126
- isFound: (context, event) => {
127
- const { resultMap, selectedCrypto } = context
128
- return resultMap[selectedCrypto.network]
129
- },
130
- },
131
- services: {
132
- fetchPaymentDetail: async (context, event) => {
133
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
134
- },
135
- submitDeposit: async (context, event) => {
136
- const { currentPayment, selectedCrypto } = context
137
- return await request.send(
138
- payment.submitDepositTransactionCrypto({
139
- method: currentPayment.method,
140
- cryptoCurrency: currentPayment.channel,
141
- cryptoNetwork: selectedCrypto.network,
142
- })
143
- )
144
- },
145
- },
146
- }
147
- )
148
- }
@@ -1,131 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '@jetthai/cuora/src/api/payment.js'
3
-
4
- export default function (request) {
5
- return createMachine(
6
- {
7
- id: 'crypto_qrcode_cash',
8
- initial: 'loading',
9
- context: {
10
- currentCategory: 'cryptoQrcode',
11
- cryptos: [],
12
- selectedCrypto: null,
13
- resultMap: {},
14
- result: {},
15
- },
16
- states: {
17
- loading: {
18
- invoke: {
19
- src: 'fetchPaymentDetail',
20
- onDone: {
21
- target: 'submitting',
22
- actions: 'setInitData',
23
- },
24
- onError: {
25
- target: 'fail',
26
- },
27
- },
28
- },
29
- finding: {
30
- always: [
31
- {
32
- target: 'idle',
33
- actions: 'setResultFromLocal',
34
- cond: 'isFound',
35
- },
36
- {
37
- target: 'submitting',
38
- },
39
- ],
40
- },
41
- submitting: {
42
- invoke: {
43
- src: 'submitDeposit',
44
- onDone: {
45
- target: 'idle',
46
- actions: 'setResult',
47
- },
48
- onError: {
49
- target: 'idle',
50
- },
51
- },
52
- },
53
- idle: {},
54
- fail: {},
55
- },
56
- on: {
57
- SET_CRYPTO: {
58
- target: '.finding',
59
- actions: 'setCrypto',
60
- },
61
- SET_NETWORK: {
62
- target: '.finding',
63
- actions: 'setNetwork',
64
- },
65
- },
66
- },
67
- {
68
- actions: {
69
- setInitData: assign((context, event) => {
70
- const paymentDetail = event.data || []
71
- const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
72
- const cryptos = payments.map((payment) => ({
73
- ...payment,
74
- label: payment.cryptoOptional?.[0],
75
- network: payment.networkName?.[0],
76
- value: payment.method,
77
- icon: payment.channel,
78
- }))
79
-
80
- return {
81
- cryptos,
82
- selectedCrypto: cryptos[0],
83
- }
84
- }),
85
- setCrypto: assign((context, event) => {
86
- const { cryptos } = context
87
- const selectedCrypto = cryptos.find((crypto) => crypto.label === event.data.label)
88
- return { selectedCrypto }
89
- }),
90
- setResultFromLocal: assign((context, event) => {
91
- const { resultMap, selectedCrypto } = context
92
- return { result: resultMap[`${selectedCrypto.channel}_${selectedCrypto.network}`] }
93
- }),
94
- setResult: assign((context, event) => {
95
- const { resultMap, selectedCrypto } = context
96
- const { accountNumber, action, currency, network, qrcode, forexRate, redirect } = event.data
97
- const result = { accountNumber, action, currency, network, qrcode, forexRate, redirect }
98
-
99
- return {
100
- result,
101
- resultMap: {
102
- ...resultMap,
103
- [`${selectedCrypto.channel}_${selectedCrypto.network}`]: result,
104
- },
105
- }
106
- }),
107
- },
108
- guards: {
109
- isFound: (context, event) => {
110
- const { resultMap, selectedCrypto } = context
111
- return resultMap[`${selectedCrypto.channel}_${selectedCrypto.network}`]
112
- },
113
- },
114
- services: {
115
- fetchPaymentDetail: async (context, event) => {
116
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
117
- },
118
- submitDeposit: async (context, event) => {
119
- const { selectedCrypto } = context
120
- return await request.send(
121
- payment.submitDepositTransactionCrypto({
122
- method: selectedCrypto.method,
123
- cryptoCurrency: selectedCrypto.channel,
124
- cryptoNetwork: selectedCrypto.network,
125
- })
126
- )
127
- },
128
- },
129
- }
130
- )
131
- }