@jetthai/cuora 1.0.64 → 1.0.66-sabai-2

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/.husky/pre-commit +4 -0
  2. package/.prettierignore +1 -0
  3. package/CHANGELOG.md +644 -0
  4. package/README.md +6 -0
  5. package/dist/bundle.mjs +27623 -0
  6. package/package.json +13 -11
  7. package/rollup.config.js +12 -0
  8. package/src/api/activity.js +10 -3
  9. package/src/api/auth.js +47 -5
  10. package/src/api/game.js +64 -2
  11. package/src/api/index.js +9 -9
  12. package/src/api/payment.js +91 -7
  13. package/src/api/user.js +18 -0
  14. package/src/index.js +7 -5
  15. package/src/lib/fingerprint.js +5779 -0
  16. package/src/machine/activity/activity.js +97 -10
  17. package/src/machine/activity/affiliate_invite_friends_activity.js +216 -0
  18. package/src/machine/activity/continue_deposit_activity.js +2 -2
  19. package/src/machine/activity/deposit_activity.js +1 -1
  20. package/src/machine/activity/{diamond_shop_activity.js → diamond_shop_activity_fc.js} +33 -5
  21. package/src/machine/activity/{diamond_shop_activity_single_exchange.js → diamond_shop_activity_vn.js} +66 -21
  22. package/src/machine/activity/fafafa_activity.js +5 -3
  23. package/src/machine/activity/index.js +24 -10
  24. package/src/machine/activity/invite_friends_activity.js +3 -8
  25. package/src/machine/activity/mini_game_activity.js +68 -0
  26. package/src/machine/activity/ranking_activity.js +40 -46
  27. package/src/machine/activity/return_bonus_activity.js +6 -4
  28. package/src/machine/activity/roulette_activity_v2.js +81 -0
  29. package/src/machine/activity/sign_in_activity.js +149 -0
  30. package/src/machine/activity/specify_bets_activity.js +2 -2
  31. package/src/machine/activity/specify_turnover_activity.js +113 -0
  32. package/src/machine/activity/time_bomb_activity.js +80 -0
  33. package/src/machine/auth.js +234 -79
  34. package/src/machine/auth_otp_v2.js +177 -0
  35. package/src/machine/{auth_otp.js → auth_otp_v3.js} +80 -17
  36. package/src/machine/bank_binding.js +120 -0
  37. package/src/machine/bank_binding_amb.js +140 -0
  38. package/src/machine/bonus.js +75 -0
  39. package/src/machine/common.js +80 -17
  40. package/src/machine/deposit/amb.js +90 -0
  41. package/src/machine/deposit/crypto.js +267 -0
  42. package/src/machine/deposit/crypto_button.js +449 -0
  43. package/src/machine/{deposit.js → deposit/deposit_fc.js} +27 -15
  44. package/src/machine/deposit/direct.js +246 -0
  45. package/src/machine/deposit/float.js +295 -0
  46. package/src/machine/deposit/index.js +25 -0
  47. package/src/machine/deposit/loadcard_vn.js +390 -0
  48. package/src/machine/deposit/manual_vn.js +382 -0
  49. package/src/machine/deposit/qrcode_v2.js +451 -0
  50. package/src/machine/deposit/usdt.js +144 -0
  51. package/src/machine/deposit/vpay.js +292 -0
  52. package/src/machine/error.js +1 -1
  53. package/src/machine/game.js +17 -10
  54. package/src/machine/game_favorite.js +2 -2
  55. package/src/machine/game_favorite_v2.js +119 -0
  56. package/src/machine/game_hot_new.js +1 -1
  57. package/src/machine/game_search.js +3 -7
  58. package/src/machine/game_search_v2.js +379 -0
  59. package/src/machine/game_v2.js +381 -0
  60. package/src/machine/game_v2_1.js +442 -0
  61. package/src/machine/inbox.js +5 -6
  62. package/src/machine/index.js +58 -23
  63. package/src/machine/leaderboard.js +108 -0
  64. package/src/machine/merge.js +2 -2
  65. package/src/machine/payment_data.js +6 -5
  66. package/src/machine/promotions.js +170 -0
  67. package/src/machine/reward.js +85 -4
  68. package/src/machine/reward_fc.js +97 -0
  69. package/src/machine/roulette_v2.js +271 -0
  70. package/src/machine/setting.js +5 -2
  71. package/src/machine/side.js +34 -27
  72. package/src/machine/side_v2.js +200 -0
  73. package/src/machine/user_info.js +1 -1
  74. package/src/machine/user_reset_password.js +2 -2
  75. package/src/machine/user_sign_up.js +111 -56
  76. package/src/machine/vip_table.js +50 -0
  77. package/src/machine/welcome.js +6 -8
  78. package/src/machine/withdraw_amb.js +373 -0
  79. package/src/machine/withdraw_crypto.js +560 -0
  80. package/src/machine/withdraw_fc.js +251 -0
  81. package/src/machine/withdraw_vn.js +495 -0
  82. package/src/request/config.js +7 -1
  83. package/src/request/request.js +11 -15
  84. package/src/util/constant.js +2 -0
  85. package/src/util/deviceToken.js +33 -0
  86. package/src/util/index.js +6 -0
  87. package/src/util/storage.js +28 -0
  88. package/dist/index.js +0 -2
  89. package/dist/index.js.LICENSE.txt +0 -30
  90. package/src/machine/withdraw.js +0 -380
  91. package/src/request/cookie.js +0 -52
  92. package/webpack.config.js +0 -33
@@ -1,380 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import api from '../api/payment'
3
- import findLastIndex from 'lodash/findLastIndex'
4
-
5
- export default function (request) {
6
- return createMachine(
7
- {
8
- id: 'withdraw',
9
- initial: 'idle',
10
- context: {
11
- isTurnoverMode: false,
12
- siteConfig: null,
13
- userInfo: null,
14
- crypto: null,
15
- networks: [],
16
- currentNetwork: null,
17
- currentAddress: '',
18
- withdrawMethods: [],
19
- withdrawRuleName: null,
20
- withdrawRules: [],
21
- withdrawLimit: null,
22
- withdrawAmount: null,
23
- withdrawDistance: null,
24
- tutorialUrls: [],
25
- balance: null,
26
- charge: null,
27
- },
28
- states: {
29
- idle: {
30
- on: {
31
- PRESET: {
32
- target: 'preparing',
33
- actions: ['setSiteConfig', 'setUserInfo', 'preset'],
34
- },
35
- },
36
- },
37
- preparing: {
38
- invoke: {
39
- src: 'fetchPaymentConfig',
40
- onDone: {
41
- target: 'mode',
42
- actions: 'setCrypto',
43
- },
44
- onError: {
45
- target: 'fail',
46
- },
47
- },
48
- },
49
- fail: {},
50
- mode: {
51
- always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
52
- },
53
- free: {
54
- initial: 'preparing',
55
- states: {
56
- preparing: {
57
- invoke: {
58
- src: 'fetchWithdrawRules',
59
- onDone: {
60
- target: 'checking',
61
- actions: 'updateWithdrawCondition',
62
- },
63
- onError: {
64
- target: 'notConvertible',
65
- },
66
- },
67
- },
68
- checking: {
69
- entry: 'recalculateDistance',
70
- always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
71
- },
72
- notConvertible: {},
73
- convertible: {
74
- initial: 'operation',
75
- states: {
76
- operation: {
77
- on: {
78
- SUBMIT: {
79
- target: '#withdraw.free.converting',
80
- },
81
- },
82
- },
83
- calculating: {
84
- entry: 'resetCharge',
85
- invoke: {
86
- src: 'fetchCalculation',
87
- onDone: {
88
- target: 'operation',
89
- actions: 'setCalculatedResult',
90
- },
91
- onError: {
92
- target: 'operation',
93
- },
94
- },
95
- },
96
- },
97
- on: {
98
- SET_NETWORK: {
99
- actions: 'setNetwork',
100
- },
101
- SET_ADDRESS: {
102
- actions: 'setAddress',
103
- },
104
- CALCULATE: {
105
- target: '.calculating',
106
- cond: 'isCalculable',
107
- },
108
- },
109
- },
110
- converting: {
111
- invoke: {
112
- src: 'submitWithdrawFree',
113
- onDone: {
114
- target: 'converted',
115
- },
116
- onError: {
117
- target: 'convertible.operation',
118
- },
119
- },
120
- },
121
- converted: {},
122
- },
123
- },
124
- cash: {
125
- initial: 'checking',
126
- states: {
127
- checking: {
128
- entry: 'recalculateDistance',
129
- always: [
130
- { target: 'disable', cond: 'isWithdrawDisable' },
131
- { target: 'transferable', cond: 'isTransferable' },
132
- { target: 'notTransferable' },
133
- ],
134
- },
135
- disable: {},
136
- notTransferable: {},
137
- transferable: {
138
- entry: 'setBalanceToWithdrawAmount',
139
- initial: 'operation',
140
- states: {
141
- operation: {
142
- on: {
143
- SUBMIT: {
144
- target: '#withdraw.cash.transferring',
145
- },
146
- },
147
- },
148
- calculating: {
149
- entry: 'resetCharge',
150
- invoke: {
151
- src: 'fetchCalculation',
152
- onDone: {
153
- target: 'operation',
154
- actions: 'setCalculatedResult',
155
- },
156
- onError: {
157
- target: 'operation',
158
- },
159
- },
160
- },
161
- },
162
- on: {
163
- SET_NETWORK: {
164
- actions: 'setNetwork',
165
- },
166
- SET_ADDRESS: {
167
- actions: 'setAddress',
168
- },
169
- CALCULATE: {
170
- target: '.calculating',
171
- cond: 'isCalculable',
172
- },
173
- },
174
- },
175
- transferring: {
176
- invoke: {
177
- src: 'submitWithdraw',
178
- onDone: {
179
- target: 'transferred',
180
- },
181
- onError: {
182
- target: 'transferable.operation',
183
- },
184
- },
185
- },
186
- transferred: {},
187
- },
188
- },
189
- },
190
- },
191
- {
192
- actions: {
193
- setUserInfo: assign((context, event) => {
194
- return {
195
- userInfo: event.data.userInfo,
196
- }
197
- }),
198
- setSiteConfig: assign((context, event) => {
199
- return {
200
- siteConfig: event.data.siteConfig,
201
- }
202
- }),
203
- preset: assign((context, event) => {
204
- const { userInfo, siteConfig } = event.data
205
- const { withdraw_rule, withdraw_limit } = userInfo || {}
206
- const balance = parseFloat(userInfo?.balance)
207
- const methods = siteConfig?.paymentMethods?.withdraw || []
208
- let withdrawLimit
209
- if (methods.includes('amb')) {
210
- withdrawLimit = (withdraw_limit + balance) * -1
211
- } else {
212
- withdrawLimit = withdraw_limit * -1
213
- }
214
- return {
215
- balance,
216
- withdrawRuleName: withdraw_rule,
217
- withdrawLimit,
218
- }
219
- }),
220
- updateWithdrawCondition: assign((context, event) => {
221
- const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
222
- const tutorialUrls = event.data.adUrl.map((item) => item.url)
223
-
224
- const { balance, withdrawLimit } = context
225
- const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
226
-
227
- let distance = 0,
228
- limit = 0,
229
- amount = 0
230
-
231
- if (lastMatchedIndex > -1) {
232
- rules[lastMatchedIndex].match = true
233
- amount = rules[lastMatchedIndex].maxWithdrawAmount
234
- limit = rules[lastMatchedIndex].greaterEqualThen
235
- } else if (withdrawLimit) {
236
- const diff = withdrawLimit - balance
237
- limit = withdrawLimit
238
- if (diff <= 0) {
239
- amount = balance
240
- } else {
241
- distance = diff
242
- }
243
- } else if (rules.length > 0) {
244
- limit = rules[0]?.greaterEqualThen || 0
245
- distance = Math.max(limit - balance, 0)
246
- } else {
247
- amount = balance
248
- }
249
-
250
- return {
251
- withdrawDistance: distance,
252
- withdrawAmount: amount,
253
- withdrawLimit: limit,
254
- withdrawRules: rules,
255
- tutorialUrls,
256
- }
257
- }),
258
- setBalanceToWithdrawAmount: assign((context, event) => {
259
- return {
260
- withdrawAmount: context.balance,
261
- }
262
- }),
263
- setCrypto: assign((context, event) => {
264
- const method = event.data?.[0]
265
- return {
266
- crypto: method,
267
- networks:
268
- method?.optional.map((value, i) => {
269
- return {
270
- label: method?.originalItem?.[i],
271
- value,
272
- }
273
- }) || [],
274
- }
275
- }),
276
- setNetwork: assign((context, event) => {
277
- return {
278
- currentNetwork: event.data,
279
- }
280
- }),
281
- setAddress: assign((context, event) => {
282
- return {
283
- currentAddress: event.data,
284
- }
285
- }),
286
- setCalculatedResult: assign((context, event) => {
287
- return {
288
- charge: event.data.charge,
289
- }
290
- }),
291
- resetCharge: assign((context, event) => {
292
- return {
293
- charge: null,
294
- }
295
- }),
296
- recalculateDistance: assign((context, event) => {
297
- const { balance, withdrawLimit, crypto } = context
298
- const limit = Math.max(withdrawLimit, crypto?.minimum)
299
- const distance = Math.max(limit - balance, 0)
300
- return {
301
- withdrawDistance: distance,
302
- withdrawLimit: limit,
303
- }
304
- }),
305
- },
306
- guards: {
307
- isFree: (context, event) => {
308
- return context.userInfo?.withdraw_policy === 'FREE'
309
- },
310
- isWithdrawDisable: (context, event) => {
311
- const { siteConfig } = context
312
- const methods = siteConfig?.paymentMethods?.withdraw || []
313
- return methods.length === 0
314
- },
315
- isConvertible: (context, event) => {
316
- const { balance, withdrawDistance } = context
317
- return balance > 0 && withdrawDistance === 0
318
- },
319
- isTransferable: (context, event) => {
320
- const { balance, withdrawLimit, withdrawDistance, isTurnoverMode } = context
321
- if (balance === 0) {
322
- return false
323
- }
324
- if (isTurnoverMode) {
325
- // not used in funnycash
326
- return withdrawLimit === 0
327
- } else {
328
- return withdrawDistance === 0
329
- }
330
- },
331
- isCalculable: (context, event) => {
332
- const { currentNetwork, balance } = context
333
- return currentNetwork && balance
334
- },
335
- },
336
- services: {
337
- fetchWithdrawRules: async (context, event) => {
338
- return await request.send(api.getCurrentWithdrawRule())
339
- },
340
- fetchPaymentConfig: async (context, event) => {
341
- return await request.send(api.getPaymentDetail({ transferType: 'WITHDRAW' }))
342
- },
343
- submitWithdraw: async (context, event) => {
344
- const { crypto, currentNetwork, currentAddress, withdrawAmount } = context
345
- const method = crypto.method
346
- return await request.send(
347
- api.submitWithdrawTransaction({
348
- method,
349
- amount: withdrawAmount,
350
- cryptoCurrency: crypto.channel,
351
- cryptoNetwork: currentNetwork.value,
352
- targetAddress: currentAddress,
353
- })
354
- )
355
- },
356
- submitWithdrawFree: async (context, event) => {
357
- const { currentNetwork, currentAddress } = context
358
- return await request.send(
359
- api.convertFreeCredit({
360
- exchangeType: 1,
361
- cryptoNetwork: currentNetwork.value,
362
- targetAddress: currentAddress,
363
- })
364
- )
365
- },
366
- fetchCalculation: async (context, event) => {
367
- const { crypto, currentNetwork, withdrawAmount } = context
368
- const method = crypto.method
369
- return await request.send(
370
- api.getWithdrawExpectedResult({
371
- method,
372
- amount: withdrawAmount,
373
- cryptoNetwork: currentNetwork.value,
374
- })
375
- )
376
- },
377
- },
378
- }
379
- )
380
- }
@@ -1,52 +0,0 @@
1
- import Cookies from 'universal-cookie'
2
-
3
- export default class Cookie {
4
- constructor(tokenKey) {
5
- this.cookies = new Cookies()
6
- this.tokenKey = tokenKey
7
- }
8
-
9
- setToken(token) {
10
- this.cookies.set(this.tokenKey, token, {
11
- path: '/',
12
- maxAge: 300,
13
- })
14
- }
15
-
16
- prolongToken() {
17
- const token = this.getToken()
18
- if (token) {
19
- this.setToken(token)
20
- }
21
- }
22
-
23
- getToken() {
24
- return this.cookies.get(this.tokenKey)
25
- }
26
-
27
- removeToken() {
28
- this.cookies.remove(this.tokenKey, {
29
- path: '/',
30
- maxAge: 300,
31
- })
32
- }
33
-
34
- setUser(user) {
35
- this.cookies.set('cuora_tempuser', user, {
36
- path: '/',
37
- maxAge: 60 * 60 * 24,
38
- })
39
- }
40
-
41
- getUser() {
42
- return this.cookies.get('cuora_tempuser')
43
- }
44
-
45
- set(name, value, options) {
46
- this.cookies.set(name, value, options)
47
- }
48
-
49
- get(name, options) {
50
- return this.cookies.get(name, options)
51
- }
52
- }
package/webpack.config.js DELETED
@@ -1,33 +0,0 @@
1
- const path = require('path')
2
-
3
- module.exports = {
4
- mode: 'production',
5
- entry: {
6
- main: './src/index.js',
7
- },
8
- output: {
9
- filename: 'index.js',
10
- path: path.resolve(__dirname, 'dist'),
11
- clean: true,
12
- library: {
13
- type: 'module',
14
- },
15
- },
16
- experiments: {
17
- outputModule: true,
18
- },
19
- module: {
20
- rules: [
21
- {
22
- test: /\.m?js$/,
23
- exclude: /node_modules/,
24
- use: {
25
- loader: 'babel-loader',
26
- options: {
27
- presets: [['@babel/preset-env', { targets: 'defaults' }]],
28
- },
29
- },
30
- },
31
- ],
32
- },
33
- }