@jetthai/cuora 1.1.333-dev-8 → 1.1.334

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.
@@ -33,7 +33,6 @@ export default function (request) {
33
33
  email: null,
34
34
  username: null,
35
35
  password: null,
36
- additionalUserInfo: null,
37
36
  },
38
37
  countryAbbr: null,
39
38
  userInfo: {},
@@ -272,10 +271,6 @@ export default function (request) {
272
271
  LOGIN_APP: {
273
272
  target: '.authenticationApp',
274
273
  },
275
- LOGIN_TELEGRAM: {
276
- target: '.authentication',
277
- actions: 'setLoginTelegram',
278
- },
279
274
  SET_PLAY: {
280
275
  actions: 'setPlay',
281
276
  },
@@ -358,17 +353,6 @@ export default function (request) {
358
353
  },
359
354
  }
360
355
  }),
361
- setLoginTelegram: assign((context, event) => {
362
- const { loginType, additionalUserInfo, isSignature } = event.data
363
- return {
364
- loginData: {
365
- provider: 'telegram',
366
- loginType,
367
- additionalUserInfo,
368
- isSignature,
369
- },
370
- }
371
- }),
372
356
  fetchToken: assign((context, event) => {
373
357
  const token = storage.get(tokenKey)
374
358
  return {
@@ -22,8 +22,6 @@ import crypto_way from './crypto_way.js'
22
22
  import crypto_bank_cash from './crypto_bank_cash.js'
23
23
  import crypto_qrcode_cash from './crypto_qrcode_cash.js'
24
24
  import crypto_way_cash from './crypto_way_cash.js'
25
- import virtual_bank_vn from './virtual_bank_vn.js'
26
- import virtual_bank_cash from './virtual_bank_cash.js'
27
25
 
28
26
  export default {
29
27
  manual_vn,
@@ -50,6 +48,4 @@ export default {
50
48
  crypto_bank_cash,
51
49
  crypto_qrcode_cash,
52
50
  crypto_way_cash,
53
- virtual_bank_vn,
54
- virtual_bank_cash,
55
51
  }
@@ -26,16 +26,12 @@ export default function () {
26
26
  { target: 'logout', cond: 'isLogout' },
27
27
  { target: 'deposit', cond: 'isNoBalance' },
28
28
  { target: 'unfinishedGame', cond: 'isUnfinishedGame', actions: 'setUnfinishedGame' },
29
- { target: 'freeGameSettle', cond: 'isFreeGameSettle' },
30
- { target: 'freeGameGiveUp', cond: 'isFreeGameGiveUp' },
31
29
  // { target: 'hall' },
32
30
  ],
33
31
  },
34
32
  logout: {},
35
33
  deposit: {},
36
34
  unfinishedGame: {},
37
- freeGameSettle: {},
38
- freeGameGiveUp: {},
39
35
  // hall: {},
40
36
  },
41
37
  },
@@ -69,12 +65,6 @@ export default function () {
69
65
  isUnfinishedGame: (context, event) => {
70
66
  return context.error.extend?.includes?.('unfinished_')
71
67
  },
72
- isFreeGameSettle: (context, event) => {
73
- return context.error.code === 'ERR_G124'
74
- },
75
- isFreeGameGiveUp: (context, event) => {
76
- return context.error.code === 'ERR_G125'
77
- },
78
68
  },
79
69
  services: {},
80
70
  }
@@ -110,6 +110,7 @@ export default class Request {
110
110
 
111
111
  _checkToken(req) {
112
112
  if (!req.isPublic && !this.getToken()) {
113
+ console.error(req)
113
114
  throw { code: 'ERR_A103', url: req.url }
114
115
  }
115
116
  }
@@ -1,5 +1,5 @@
1
1
  import uniqBy from 'lodash/uniqBy'
2
- import { load, defaultEndpoint } from '../lib/fingerprint_v3_11_5.js'
2
+ import { load, defaultEndpoint } from '../lib/fingerprint_v3_11_2.js'
3
3
 
4
4
  const reg = /fnapi\d*/
5
5
 
@@ -23,6 +23,7 @@ const getDeviceToken = async ({ fpToken, sentry, hosts, enable = true }) => {
23
23
  throw new Error('[Device Token] No token from FingerprintJS.')
24
24
  }
25
25
 
26
+ console.log('[Device Token]', `${dt} from ${endpoints}`)
26
27
  sentry?.setTag('dt', dt)
27
28
  } catch (error) {
28
29
  console.error('[Device Token]', `${dt} from ${endpoints}`, error)
@@ -1,201 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '@jetthai/cuora/src/api/payment.js'
3
- import { max } from '@jetthai/cuora/src/util/index.js'
4
-
5
- export default function (request, context) {
6
- const { appSecret } = request.config
7
- const { paymentDetail = [], promotion, selectedAmount, siteConfig = {} } = context || {}
8
-
9
- return createMachine(
10
- {
11
- id: 'virtual_bank_cash',
12
- initial: 'loading',
13
- context: {
14
- siteConfig,
15
- paymentDetail,
16
- promotion,
17
- selectedAmount,
18
-
19
- bindingPaymentList: {},
20
- bindingPaymentInfo: {},
21
- virtualBanks: {},
22
-
23
- depositTime: null,
24
-
25
- currentCategory: 'virtualBank',
26
- method: null,
27
- currentPayment: null,
28
- currentApplyerBank: null,
29
-
30
- calculation: null,
31
- processing: null,
32
- },
33
- states: {
34
- loading: {
35
- invoke: {
36
- src: 'fetchInitData',
37
- onDone: {
38
- target: 'checking',
39
- actions: 'setInitData',
40
- },
41
- },
42
- },
43
- checking: {
44
- always: [
45
- {
46
- target: 'submitted',
47
- cond: 'isProcessing',
48
- },
49
- {
50
- target: 'debouncing',
51
- },
52
- ],
53
- },
54
- loaded: {},
55
- debouncing: {
56
- entry: 'clearCalculation',
57
- after: {
58
- 1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'loaded' }],
59
- },
60
- },
61
- calculating: {
62
- invoke: {
63
- src: 'fetchCalculation',
64
- onDone: {
65
- target: 'calculated',
66
- actions: 'setCalculation',
67
- },
68
- onError: {
69
- target: 'loaded',
70
- },
71
- },
72
- },
73
- calculated: {
74
- on: {
75
- SET_DEPOSIT_TIME: {
76
- actions: 'setDepositTime',
77
- },
78
- SUBMIT: {
79
- target: 'submitting',
80
- },
81
- },
82
- },
83
- submitting: {
84
- invoke: {
85
- src: 'submitDeposit',
86
- onDone: {
87
- target: 'submitted',
88
- actions: 'setProcessing',
89
- },
90
- onError: {
91
- target: 'loaded',
92
- },
93
- },
94
- },
95
- submitted: {},
96
- },
97
- on: {
98
- SET_PROMOTION: {
99
- target: 'debouncing',
100
- actions: 'setPromotion',
101
- internal: false,
102
- },
103
- INPUT_AMOUNT: {
104
- target: 'debouncing',
105
- actions: 'inputAmount',
106
- internal: false,
107
- },
108
- },
109
- },
110
- {
111
- actions: {
112
- setInitData: assign((context, event) => {
113
- const { currentPayment } = event.data
114
-
115
- const processing = currentPayment?.processing?.[0]
116
-
117
- const virtualBanks = currentPayment?.virtualBanks?.[0]
118
-
119
- return {
120
- currentPayment,
121
- method: currentPayment.method,
122
- processing,
123
- selectedAmount: max(promotion?.minimumAmount, currentPayment?.minimum, selectedAmount, 0),
124
- virtualBanks,
125
- }
126
- }),
127
- inputAmount: assign((context, event) => {
128
- return { selectedAmount: event.data }
129
- }),
130
- setCalculation: assign((context, event) => {
131
- return {
132
- calculation: event.data,
133
- }
134
- }),
135
- setProcessing: assign((context, event) => {
136
- return {
137
- processing: event.data,
138
- }
139
- }),
140
- clearCalculation: assign((context, event) => {
141
- return {
142
- calculation: null,
143
- }
144
- }),
145
- setDepositTime: assign((context, event) => {
146
- return {
147
- depositTime: event.data,
148
- }
149
- }),
150
- setPromotion: assign((context, event) => {
151
- return {
152
- promotion: event.data,
153
- }
154
- }),
155
- },
156
- guards: {
157
- isCalculable: (context, event) => {
158
- const {
159
- selectedAmount,
160
- currentPayment: { maximum, minimum },
161
- } = context
162
- return selectedAmount && minimum <= +selectedAmount && +selectedAmount <= maximum
163
- },
164
- isProcessing: (context, event) => {
165
- return context.processing
166
- },
167
- },
168
- services: {
169
- fetchInitData: async (context, event) => {
170
- const { paymentDetail = [] } = context
171
- const currentPayment = paymentDetail.find((element) => element.category === context.currentCategory && element.transferType === 'deposit')
172
-
173
- return {
174
- currentPayment,
175
- }
176
- },
177
- fetchCalculation: async (context, event) => {
178
- const { method, selectedAmount, promotion } = context
179
- return await request.send(
180
- payment.getDepositExpectedResult({
181
- method,
182
- amount: selectedAmount,
183
- promotionsNo: promotion?.promotionsNo,
184
- })
185
- )
186
- },
187
- submitDeposit: async (context, event) => {
188
- const { method, selectedAmount, depositTime, promotion } = context
189
- return await request.send(
190
- payment.submitDepositTransactionBank({
191
- method,
192
- amount: selectedAmount,
193
- depositTime,
194
- promotionsNo: promotion?.promotionsNo,
195
- })
196
- )
197
- },
198
- },
199
- }
200
- )
201
- }
@@ -1,289 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import payment from '../../api/payment.js'
3
-
4
- export default function (request) {
5
- const { appSecret } = request.config
6
-
7
- return createMachine(
8
- {
9
- id: 'virtual_bank',
10
- initial: 'loading',
11
- context: {
12
- siteConfig: null,
13
- paymentDetail: [],
14
- virtualBanks: {},
15
-
16
- amount: null,
17
- depositTime: null,
18
-
19
- currentCategory: 'virtualBank',
20
- method: null,
21
- currentPayment: null,
22
-
23
- calculation: null,
24
- processing: null,
25
-
26
- // use for wallet mode 3
27
- promotion: null,
28
- },
29
- states: {
30
- loading: {
31
- initial: 'init',
32
- states: {
33
- init: {
34
- invoke: {
35
- src: 'fetchPaymentDetail',
36
- onDone: {
37
- target: '#virtual_bank.step1',
38
- actions: 'setInitData',
39
- },
40
- onError: {
41
- target: '#virtual_bank.fail',
42
- },
43
- },
44
- },
45
- },
46
- },
47
- step1: {
48
- initial: 'promotion',
49
- states: {
50
- promotion: {
51
- always: [
52
- {
53
- target: 'idle',
54
- cond: 'isDoubleWalletMode',
55
- },
56
- {
57
- target: 'calculating',
58
- actions: 'setPromotionDefaultAmount',
59
- cond: 'hasMinPromotionDeposit',
60
- },
61
- {
62
- target: 'idle',
63
- },
64
- ],
65
- },
66
- idle: {},
67
- calculating: {
68
- invoke: {
69
- src: 'fetchCalculation',
70
- onDone: {
71
- target: 'idle',
72
- actions: 'setCalculation',
73
- },
74
- onError: {
75
- target: 'idle',
76
- },
77
- },
78
- },
79
- debouncing: {
80
- after: {
81
- 1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'idle' }],
82
- },
83
- },
84
- },
85
- on: {
86
- SET_AMOUNT: {
87
- actions: ['setAmount', 'clearCalculation'],
88
- },
89
- CALCULATE: {
90
- target: '.debouncing',
91
- },
92
- CLEAR_CALCULATION: {
93
- target: '.debouncing',
94
- actions: 'clearCalculation',
95
- },
96
- TRANSACT: {
97
- target: 'checking',
98
- cond: 'isCalculated',
99
- },
100
- },
101
- },
102
- checking: {
103
- always: [
104
- {
105
- target: 'pending',
106
- cond: (context, event) => {
107
- const { siteConfig = {}, calculation, promotion } = context
108
- const { walletMode } = siteConfig
109
- const { promotionsNo, activityNo } = promotion
110
- const isNoBonus = promotionsNo === 'none' || activityNo === 'none'
111
- return walletMode === '4' && !!calculation && !isNoBonus
112
- },
113
- },
114
- {
115
- target: '#virtual_bank.step2',
116
- },
117
- ],
118
- },
119
- pending: {
120
- on: {
121
- CONFIRM: {
122
- target: '#virtual_bank.step2',
123
- },
124
- },
125
- },
126
- step2: {
127
- initial: 'idle',
128
- states: {
129
- idle: {},
130
- calculating: {
131
- invoke: {
132
- src: 'fetchCalculation',
133
- onDone: {
134
- target: 'idle',
135
- actions: 'setCalculation',
136
- },
137
- onError: {
138
- target: 'idle',
139
- },
140
- },
141
- },
142
- debouncing: {
143
- after: {
144
- 1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'idle' }],
145
- },
146
- },
147
- submitting: {
148
- invoke: {
149
- src: 'submitDeposit',
150
- onDone: {
151
- target: '#virtual_bank.submitted',
152
- actions: 'setProcessing',
153
- },
154
- onError: {
155
- target: 'idle',
156
- },
157
- },
158
- },
159
- },
160
- on: {
161
- SET_AMOUNT: {
162
- actions: ['setAmount', 'clearCalculation'],
163
- },
164
- CALCULATE: {
165
- target: '.debouncing',
166
- },
167
- SET_DEPOSIT_TIME: {
168
- actions: 'setDepositTime',
169
- },
170
- CLEAR_CALCULATION: {
171
- target: '.debouncing',
172
- actions: 'clearCalculation',
173
- },
174
- SUBMIT: {
175
- target: '.submitting',
176
- },
177
- },
178
- },
179
- processing: {},
180
- submitted: {},
181
- fail: {},
182
- },
183
- on: {
184
- SET_PROMOTION: {
185
- actions: 'setPromotion',
186
- },
187
- },
188
- },
189
- {
190
- actions: {
191
- setInitData: assign((context, event) => {
192
- const paymentDetail = event.data || []
193
- const currentPayment = paymentDetail.find((element) => element.category === context.currentCategory)
194
- const { method, processing, virtualBanks } = currentPayment || {}
195
-
196
- return {
197
- paymentDetail,
198
- currentPayment,
199
- method,
200
- processing: processing?.[0],
201
- virtualBanks: virtualBanks?.[0],
202
- }
203
- }),
204
- setAmount: assign((context, event) => {
205
- return {
206
- amount: event.data,
207
- }
208
- }),
209
- setCalculation: assign((context, event) => {
210
- return {
211
- calculation: event.data,
212
- }
213
- }),
214
- setProcessing: assign((context, event) => {
215
- return {
216
- processing: event.data,
217
- }
218
- }),
219
- clearCalculation: assign((context, event) => {
220
- return {
221
- calculation: null,
222
- }
223
- }),
224
- setDepositTime: assign((context, event) => {
225
- return {
226
- depositTime: event.data,
227
- }
228
- }),
229
- setPromotion: assign((context, event) => {
230
- return {
231
- promotion: event.data,
232
- }
233
- }),
234
- setPromotionDefaultAmount: assign((context, event) => {
235
- return {
236
- amount: context.promotion.minimumAmount,
237
- }
238
- }),
239
- },
240
- guards: {
241
- isDoubleWalletMode: (context, event) => {
242
- return context.siteConfig?.walletMode === '4'
243
- },
244
- isCalculable: (context, event) => {
245
- const {
246
- amount,
247
- currentPayment: { maximum, minimum },
248
- } = context
249
- return amount && minimum <= +amount && +amount <= maximum
250
- },
251
- isCalculated: (context, event) => {
252
- return context.calculation
253
- },
254
- isProcessing: (context, event) => {
255
- return context.processing
256
- },
257
- hasMinPromotionDeposit: (context, event) => {
258
- return context.promotion?.minimumAmount
259
- },
260
- },
261
- services: {
262
- fetchPaymentDetail: async (context, event) => {
263
- return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
264
- },
265
- fetchCalculation: async (context, event) => {
266
- const { method, amount, promotion } = context
267
- return await request.send(
268
- payment.getDepositExpectedResult({
269
- method,
270
- amount,
271
- promotionsNo: promotion?.activityNo,
272
- })
273
- )
274
- },
275
- submitDeposit: async (context, event) => {
276
- const { method, amount, depositTime, promotion } = context
277
- return await request.send(
278
- payment.submitDepositTransactionBank({
279
- method,
280
- amount,
281
- depositTime,
282
- promotionsNo: promotion?.activityNo,
283
- })
284
- )
285
- },
286
- },
287
- }
288
- )
289
- }