@jetthai/cuora 1.0.66-sabai-2 → 1.0.67

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 (92) hide show
  1. package/CHANGELOG.md +0 -638
  2. package/README.md +0 -6
  3. package/dist/index.js +2 -0
  4. package/dist/index.js.LICENSE.txt +30 -0
  5. package/package.json +11 -13
  6. package/src/api/activity.js +3 -10
  7. package/src/api/auth.js +5 -47
  8. package/src/api/game.js +2 -64
  9. package/src/api/index.js +8 -8
  10. package/src/api/payment.js +7 -86
  11. package/src/api/user.js +0 -18
  12. package/src/index.js +5 -7
  13. package/src/machine/activity/activity.js +10 -97
  14. package/src/machine/activity/continue_deposit_activity.js +1 -1
  15. package/src/machine/activity/deposit_activity.js +1 -1
  16. package/src/machine/activity/{diamond_shop_activity_fc.js → diamond_shop_activity.js} +5 -33
  17. package/src/machine/activity/{diamond_shop_activity_vn.js → diamond_shop_activity_single_exchange.js} +21 -66
  18. package/src/machine/activity/fafafa_activity.js +2 -4
  19. package/src/machine/activity/index.js +10 -24
  20. package/src/machine/activity/invite_friends_activity.js +8 -3
  21. package/src/machine/activity/ranking_activity.js +46 -40
  22. package/src/machine/activity/return_bonus_activity.js +3 -5
  23. package/src/machine/activity/specify_bets_activity.js +1 -1
  24. package/src/machine/auth.js +79 -234
  25. package/src/machine/{auth_otp_v3.js → auth_otp.js} +17 -80
  26. package/src/machine/bank_binding.js +14 -15
  27. package/src/machine/common.js +17 -80
  28. package/src/machine/{deposit/deposit_fc.js → deposit.js} +15 -27
  29. package/src/machine/error.js +1 -1
  30. package/src/machine/game.js +10 -17
  31. package/src/machine/game_favorite.js +2 -2
  32. package/src/machine/game_hot_new.js +1 -1
  33. package/src/machine/game_search.js +7 -3
  34. package/src/machine/inbox.js +6 -5
  35. package/src/machine/index.js +25 -56
  36. package/src/machine/merge.js +2 -2
  37. package/src/machine/payment_data.js +5 -6
  38. package/src/machine/reward.js +3 -84
  39. package/src/machine/setting.js +2 -5
  40. package/src/machine/side.js +27 -34
  41. package/src/machine/user_info.js +1 -1
  42. package/src/machine/user_reset_password.js +2 -2
  43. package/src/machine/user_sign_up.js +56 -111
  44. package/src/machine/welcome.js +8 -6
  45. package/src/machine/withdraw.js +380 -0
  46. package/src/machine/withdraw_vn.js +65 -248
  47. package/src/request/config.js +1 -7
  48. package/src/request/cookie.js +52 -0
  49. package/src/request/request.js +15 -11
  50. package/webpack.config.js +33 -0
  51. package/.husky/pre-commit +0 -4
  52. package/.prettierignore +0 -1
  53. package/dist/bundle.mjs +0 -27623
  54. package/rollup.config.js +0 -12
  55. package/src/lib/fingerprint.js +0 -5779
  56. package/src/machine/activity/affiliate_invite_friends_activity.js +0 -216
  57. package/src/machine/activity/mini_game_activity.js +0 -68
  58. package/src/machine/activity/roulette_activity_v2.js +0 -81
  59. package/src/machine/activity/sign_in_activity.js +0 -149
  60. package/src/machine/activity/specify_turnover_activity.js +0 -113
  61. package/src/machine/activity/time_bomb_activity.js +0 -80
  62. package/src/machine/auth_otp_v2.js +0 -177
  63. package/src/machine/bank_binding_amb.js +0 -140
  64. package/src/machine/bonus.js +0 -75
  65. package/src/machine/deposit/amb.js +0 -90
  66. package/src/machine/deposit/crypto.js +0 -267
  67. package/src/machine/deposit/crypto_button.js +0 -449
  68. package/src/machine/deposit/direct.js +0 -246
  69. package/src/machine/deposit/float.js +0 -295
  70. package/src/machine/deposit/index.js +0 -25
  71. package/src/machine/deposit/loadcard_vn.js +0 -390
  72. package/src/machine/deposit/manual_vn.js +0 -382
  73. package/src/machine/deposit/qrcode_v2.js +0 -451
  74. package/src/machine/deposit/usdt.js +0 -144
  75. package/src/machine/deposit/vpay.js +0 -292
  76. package/src/machine/game_favorite_v2.js +0 -119
  77. package/src/machine/game_search_v2.js +0 -379
  78. package/src/machine/game_v2.js +0 -381
  79. package/src/machine/game_v2_1.js +0 -442
  80. package/src/machine/leaderboard.js +0 -108
  81. package/src/machine/promotions.js +0 -170
  82. package/src/machine/reward_fc.js +0 -97
  83. package/src/machine/roulette_v2.js +0 -271
  84. package/src/machine/side_v2.js +0 -200
  85. package/src/machine/vip_table.js +0 -50
  86. package/src/machine/withdraw_amb.js +0 -373
  87. package/src/machine/withdraw_crypto.js +0 -560
  88. package/src/machine/withdraw_fc.js +0 -251
  89. package/src/util/constant.js +0 -2
  90. package/src/util/deviceToken.js +0 -33
  91. package/src/util/index.js +0 -6
  92. package/src/util/storage.js +0 -28
@@ -1,251 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import api from '../api/payment.js'
3
-
4
- export default function (request) {
5
- return createMachine(
6
- {
7
- id: 'withdraw',
8
- initial: 'loading',
9
- context: {
10
- crypto: null,
11
- networks: [],
12
- currentNetwork: null,
13
- currentAddress: '',
14
- withdrawMethods: [],
15
- withdrawRules: [],
16
- withdrawLimit: null,
17
- withdrawAmount: null,
18
- differAmountLimit: null,
19
- tutorialUrls: [],
20
- enableWithdraw: false,
21
- description: {},
22
- policy: '',
23
- ruleName: '',
24
- balance: null,
25
- charge: null,
26
- isFree: false,
27
- },
28
- states: {
29
- loading: {
30
- invoke: {
31
- src: 'preset',
32
- onDone: {
33
- target: 'checking',
34
- actions: ['setCrypto', 'setWithdrawCondition', 'checkMinimumWithdraw'],
35
- },
36
- onError: {
37
- target: 'fail',
38
- },
39
- },
40
- },
41
- fail: {},
42
- checking: {
43
- always: [{ target: 'transferable', cond: 'isTransferable' }, { target: 'notTransferable' }],
44
- },
45
- notTransferable: {},
46
- transferable: {
47
- initial: 'operation',
48
- states: {
49
- operation: {
50
- on: {
51
- SUBMIT: [
52
- {
53
- target: '#withdraw.exchanging',
54
- cond: 'isFree',
55
- },
56
- {
57
- target: '#withdraw.transferring',
58
- },
59
- ],
60
- },
61
- },
62
- calculating: {
63
- entry: 'resetCharge',
64
- invoke: {
65
- src: 'fetchCalculation',
66
- onDone: {
67
- target: 'operation',
68
- actions: 'setCalculatedResult',
69
- },
70
- onError: {
71
- target: 'operation',
72
- },
73
- },
74
- },
75
- },
76
- on: {
77
- SET_NETWORK: {
78
- actions: 'setNetwork',
79
- },
80
- SET_ADDRESS: {
81
- actions: 'setAddress',
82
- },
83
- CALCULATE: {
84
- target: '.calculating',
85
- cond: 'isCalculable',
86
- },
87
- },
88
- },
89
- exchanging: {
90
- invoke: {
91
- src: 'submitWithdrawFree',
92
- onDone: {
93
- target: 'transferred',
94
- actions: 'setOtp',
95
- },
96
- onError: {
97
- target: 'transferable.operation',
98
- },
99
- },
100
- },
101
- transferring: {
102
- invoke: {
103
- src: 'submitWithdraw',
104
- onDone: {
105
- target: 'transferred',
106
- actions: 'setOtp',
107
- },
108
- onError: {
109
- target: 'transferable.operation',
110
- },
111
- },
112
- },
113
- transferred: {},
114
- },
115
- },
116
- {
117
- actions: {
118
- setWithdrawCondition: assign((context, event) => {
119
- const { adUrl, balance, description, differAmountLimit, enableWithdraw, enableWithdrawAmount, policy, ruleName, rules } =
120
- event.data.withdraw
121
-
122
- return {
123
- differAmountLimit: differAmountLimit,
124
- withdrawAmount: enableWithdrawAmount,
125
- withdrawLimit: enableWithdraw
126
- ? 0
127
- : rules.find((rule) => balance < rule.greaterEqualThen)?.greaterEqualThen || parseFloat(balance) + parseFloat(differAmountLimit),
128
- withdrawRules: rules.filter((rule) => rule.maxWithdrawAmount > 0),
129
- tutorialUrls: adUrl.map((item) => item.url),
130
- enableWithdraw,
131
- description,
132
- policy,
133
- ruleName,
134
- balance,
135
- isFree: policy === 'FREE',
136
- }
137
- }),
138
- setCrypto: assign((context, event) => {
139
- const method = event.data.payment?.[0]
140
- return {
141
- crypto: method,
142
- networks:
143
- method?.networkName?.map?.((value, i) => {
144
- return {
145
- label: method?.networkOptional?.[i],
146
- value,
147
- icon: value,
148
- }
149
- }) || [],
150
- }
151
- }),
152
- setNetwork: assign((context, event) => {
153
- return {
154
- currentNetwork: event.data,
155
- }
156
- }),
157
- setAddress: assign((context, event) => {
158
- return {
159
- currentAddress: event.data,
160
- }
161
- }),
162
- setCalculatedResult: assign((context, event) => {
163
- return {
164
- charge: event.data.charge,
165
- }
166
- }),
167
- resetCharge: assign((context, event) => {
168
- return {
169
- charge: null,
170
- }
171
- }),
172
- checkMinimumWithdraw: assign((context, event) => {
173
- const { balance, withdrawLimit, crypto, isFree } = context
174
- if (!isFree && crypto?.minimum > withdrawLimit) {
175
- const limit = crypto?.minimum
176
- const distance = Math.max(limit - balance, 0)
177
- return {
178
- differAmountLimit: distance,
179
- withdrawLimit: limit,
180
- }
181
- }
182
- }),
183
- setOtp: assign((context, event) => {
184
- const { requestId, status, target, ttl } = event.data
185
- return {
186
- requestId,
187
- status,
188
- target,
189
- ttl,
190
- }
191
- }),
192
- },
193
- guards: {
194
- isFree: (context, event) => {
195
- return context.isFree
196
- },
197
- isTransferable: (context, event) => {
198
- const { enableWithdraw, balance, withdrawLimit } = context
199
- return enableWithdraw && balance >= withdrawLimit
200
- },
201
- isCalculable: (context, event) => {
202
- const { currentNetwork, balance } = context
203
- return currentNetwork && balance
204
- },
205
- },
206
- services: {
207
- preset: async (context, event) => {
208
- const [withdraw, payment] = await Promise.all([
209
- request.send(api.getCurrentWithdrawRule()),
210
- request.send(api.getPaymentDetail({ transferType: 'WITHDRAW' })),
211
- ])
212
- return { withdraw, payment }
213
- },
214
- submitWithdraw: async (context, event) => {
215
- const { crypto, currentNetwork, currentAddress, withdrawAmount } = context
216
- const method = crypto.method
217
- return await request.send(
218
- api.submitWithdrawTransactionCrypto({
219
- method,
220
- amount: withdrawAmount,
221
- cryptoCurrency: crypto.channel,
222
- cryptoNetwork: currentNetwork.value,
223
- targetAddress: currentAddress,
224
- })
225
- )
226
- },
227
- submitWithdrawFree: async (context, event) => {
228
- const { currentNetwork, currentAddress } = context
229
- return await request.send(
230
- api.convertFreeCredit({
231
- exchangeType: 1,
232
- cryptoNetwork: currentNetwork.value,
233
- targetAddress: currentAddress,
234
- })
235
- )
236
- },
237
- fetchCalculation: async (context, event) => {
238
- const { crypto, currentNetwork, withdrawAmount } = context
239
- const method = crypto.method
240
- return await request.send(
241
- api.getWithdrawExpectedResult({
242
- method,
243
- amount: withdrawAmount,
244
- cryptoNetwork: currentNetwork.value,
245
- })
246
- )
247
- },
248
- },
249
- }
250
- )
251
- }
@@ -1,2 +0,0 @@
1
- export const MY_FAVORITE = 'MyFavorite'
2
- export const GAME_SEARCH = 'GameSearch'
@@ -1,33 +0,0 @@
1
- // import FingerprintJS from '@fingerprintjs/fingerprintjs-pro'
2
- import uniqBy from 'lodash/uniqBy'
3
- import { load } from '../lib/fingerprint.js'
4
-
5
- const reg = /fnapi\d*/
6
- // const reg = /(?<=https:\/\/)\w+(?=(\.\w+\.\w+))/
7
-
8
- const getDeviceToken = async ({ fpToken, sentry, hosts }) => {
9
- let dt, endpoints
10
- try {
11
- endpoints = uniqBy(
12
- hosts.map((host) => host.replace(reg, 'fp')),
13
- (url) => url
14
- )
15
- // const fp = await FingerprintJS.load({ apiKey: fpToken, endpoint: endpoints })
16
- const fp = await load({ endpoint: endpoints })
17
- const result = await fp.get({ timeout: 30000 })
18
- dt = result.visitorId
19
-
20
- if (!dt) {
21
- throw new Error('[Device Token] No token from FingerprintJS.')
22
- }
23
-
24
- console.log('[Device Token]', `${dt} from ${endpoints}`)
25
- } catch (error) {
26
- console.error('[Device Token]', `${dt} from ${endpoints}`, error)
27
- sentry?.captureException(error)
28
- } finally {
29
- return dt
30
- }
31
- }
32
-
33
- export { getDeviceToken }
package/src/util/index.js DELETED
@@ -1,6 +0,0 @@
1
- import { getDeviceToken } from './deviceToken.js'
2
- import storage from './storage.js'
3
- import * as constant from './constant.js'
4
-
5
- export default { getDeviceToken }
6
- export { constant, storage }
@@ -1,28 +0,0 @@
1
- export default {
2
- get(name, options) {
3
- const itemStr = localStorage.getItem(name)
4
-
5
- if (!itemStr) {
6
- return null
7
- }
8
-
9
- const item = JSON.parse(itemStr)
10
- if (item.expiry && new Date().getTime() > item.expiry) {
11
- localStorage.removeItem(name)
12
- return null
13
- }
14
-
15
- return item.value
16
- },
17
- set(name, value, options) {
18
- const item = { value }
19
-
20
- if (options?.maxAge) {
21
- item.expiry = new Date().getTime() + options.maxAge * 1000
22
- }
23
- localStorage.setItem(name, JSON.stringify(item))
24
- },
25
- remove(name, options) {
26
- localStorage.removeItem(name)
27
- },
28
- }