@jetthai/cuora 1.1.96-signin-5 → 1.1.97

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.
package/CHANGELOG.md CHANGED
@@ -2,21 +2,7 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ### [1.1.96-signin-5](https://github.com/jetthai/cuora-module/compare/v1.1.96-signin-4...v1.1.96-signin-5) (2023-05-31)
6
-
7
- ### [1.1.96-signin-4](https://github.com/jetthai/cuora-module/compare/v1.1.112...v1.1.96-signin-4) (2023-05-31)
8
-
9
- ### [1.1.96-signin-3](https://github.com/jetthai/cuora-module/compare/v1.1.104...v1.1.96-signin-3) (2023-05-26)
10
-
11
- ### [1.1.96-signin-2](https://github.com/jetthai/cuora-module/compare/v1.1.97...v1.1.96-signin-2) (2023-05-17)
12
-
13
- ### [1.1.96-signin-1](https://github.com/jetthai/cuora-module/compare/v1.1.96...v1.1.96-signin-1) (2023-05-15)
14
-
15
- ### [1.1.96-signin-3](https://github.com/jetthai/cuora-module/compare/v1.1.96-signin-2...v1.1.96-signin-3) (2023-05-26)
16
-
17
- ### [1.1.96-signin-2](https://github.com/jetthai/cuora-module/compare/v1.1.96-signin-1...v1.1.96-signin-2) (2023-05-17)
18
-
19
- ### [1.1.96-signin-1](https://github.com/jetthai/cuora-module/compare/v1.1.96...v1.1.96-signin-1) (2023-05-15)
5
+ ### [1.1.97](https://github.com/jetthai/cuora-module/compare/v1.1.96...v1.1.97) (2023-05-16)
20
6
 
21
7
  ### [1.1.96](https://github.com/jetthai/cuora-module/compare/v1.1.95...v1.1.96) (2023-05-15)
22
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.96-signin-5",
3
+ "version": "1.1.97",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/game.js CHANGED
@@ -9,7 +9,7 @@ export default {
9
9
  playGame: (params) => ({ url: 'game/play', method: 'get', params }),
10
10
  logoutGame: ({ uid_site, provider_id }) => ({ url: 'game/logout', method: 'get', params: { uid_site, provider_id } }),
11
11
 
12
- getGameTags: ({ q, lang }) => ({ url: 'game/search', method: 'get', params: { q, lang } }),
12
+ getGameTags: ({ q }) => ({ url: 'game/search', method: 'get', params: { q } }),
13
13
  getGameSearchHome: () => ({ url: 'game/search/home', method: 'get' }),
14
14
  getGameSearchList: ({ id, index, q, click, clickDefault }) => ({
15
15
  url: 'game/search/list',
@@ -146,5 +146,4 @@ export default {
146
146
  method: 'post',
147
147
  params: { promotionsNo },
148
148
  }),
149
- getPendingOrder: ({ transferType }) => ({ url: 'payment/v2/pendingOrder', method: 'post', params: { transferType } }),
150
149
  }
@@ -138,6 +138,9 @@ export default function (request, context) {
138
138
  }),
139
139
  },
140
140
  guards: {
141
+ hasActivityNo: (context, event) => {
142
+ return context.activityNo
143
+ },
141
144
  isAwardable: (context, event) => {
142
145
  return context.activityDetail?.receiveStatus === 2
143
146
  },
@@ -1,5 +1,3 @@
1
- import activity from './activity.js'
2
- import activity_cash from './activity_cash.js'
3
1
  import continue_deposit_activity from './continue_deposit_activity.js'
4
2
  import deposit_activity from './deposit_activity.js'
5
3
  import diamond_shop_activity_fc from './diamond_shop_activity_fc.js'
@@ -16,12 +14,10 @@ import sign_in_activity from './sign_in_activity.js'
16
14
  import time_bomb_activity from './time_bomb_activity.js'
17
15
  import mini_game_activity from './mini_game_activity.js'
18
16
  import roulette_activity_v2 from './roulette_activity_v2.js'
19
- import sign_in_monthly_activity from './sign_in_monthly_activity.js'
17
+ import activity from './activity.js'
20
18
  import otp_verified_activity from './otp_verified_activity.js'
21
19
 
22
20
  export default {
23
- activity,
24
- activity_cash,
25
21
  continue_deposit_activity,
26
22
  deposit_activity,
27
23
  diamond_shop_activity_fc,
@@ -38,6 +34,6 @@ export default {
38
34
  time_bomb_activity,
39
35
  mini_game_activity,
40
36
  roulette_activity_v2,
41
- sign_in_monthly_activity,
37
+ activity,
42
38
  otp_verified_activity,
43
39
  }
@@ -4,11 +4,11 @@ import auth from '../api/auth.js'
4
4
  import user from '../api/user.js'
5
5
  import storage from '../util/storage.js'
6
6
  import { getDeviceToken } from '../util/deviceToken.js'
7
- import common from '../api/common.js'
8
- import pickBy from 'lodash/pickBy.js'
7
+
8
+ // const urljoin = require('url-join')
9
9
 
10
10
  export default function (request) {
11
- const { appSecret, clientId, fpToken, sentry, defaultChannel, defaultSubchannel } = request.config
11
+ const { clientId, fpToken, sentry, defaultChannel, defaultSubchannel } = request.config
12
12
  const tokenKey = `cuora_${clientId}`
13
13
  const userKey = `cuora_tempuser`
14
14
  const phoneCountryCode = 'phone_countrycode'
@@ -18,12 +18,11 @@ export default function (request) {
18
18
  return createMachine(
19
19
  {
20
20
  id: 'auth',
21
- initial: 'fetchingConfig',
21
+ initial: 'idle',
22
22
  context: {
23
23
  base: '',
24
24
  token: null,
25
25
  tick: 2000,
26
- siteConfig: {},
27
26
  isPlaying: false,
28
27
  loginData: {
29
28
  provider: '',
@@ -40,18 +39,6 @@ export default function (request) {
40
39
  fc: null,
41
40
  },
42
41
  states: {
43
- fetchingConfig: {
44
- invoke: {
45
- src: 'fetchSiteConfig',
46
- onDone: {
47
- target: 'idle',
48
- actions: 'setSiteConfig',
49
- },
50
- onError: {
51
- target: 'idle',
52
- },
53
- },
54
- },
55
42
  idle: {
56
43
  entry: 'fetchToken',
57
44
  always: [{ target: 'authenticated', cond: 'hasToken' }],
@@ -140,19 +127,8 @@ export default function (request) {
140
127
  },
141
128
  },
142
129
  login: {
143
- initial: 'deviceTokenChecking',
130
+ initial: 'fetching',
144
131
  states: {
145
- deviceTokenChecking: {
146
- invoke: {
147
- src: 'checkDeviceToken',
148
- onDone: {
149
- target: 'fetching',
150
- },
151
- onError: {
152
- target: 'fetching',
153
- },
154
- },
155
- },
156
132
  fetching: {
157
133
  invoke: {
158
134
  src: 'fetchUserInfo',
@@ -201,7 +177,7 @@ export default function (request) {
201
177
  },
202
178
  on: {
203
179
  LOGIN_TOKEN: {
204
- target: '.fetchingConfig',
180
+ target: 'idle',
205
181
  actions: 'setToken',
206
182
  },
207
183
  CLEAR: {
@@ -252,12 +228,6 @@ export default function (request) {
252
228
  },
253
229
  },
254
230
  actions: {
255
- setSiteConfig: assign((context, event) => {
256
- const { loginMethods = {}, registerMethods = {} } = event.data
257
- return {
258
- siteConfig: { ...event.data, loginMethods: pickBy(loginMethods), registerMethods: pickBy(registerMethods) },
259
- }
260
- }),
261
231
  setReCaptchaToken: assign((context, event) => {
262
232
  const { reCaptchaToken } = event.data
263
233
  return {
@@ -352,14 +322,13 @@ export default function (request) {
352
322
  }),
353
323
  redirectTo3Party: async (context, event) => {
354
324
  const { provider, channel, subchannel, fc } = event.data
355
- const deviceTokenEnable = context.siteConfig?.dtVerify === '1'
356
325
 
357
- await getDeviceToken({
326
+ const dt = await getDeviceToken({
358
327
  fpToken,
359
328
  sentry,
360
329
  hosts: request.hosts,
361
- enable: deviceTokenEnable,
362
330
  })
331
+ sentry.setTag('dt', dt)
363
332
 
364
333
  const affiliateCode = storage.get('ac')
365
334
  const messages = {
@@ -388,6 +357,7 @@ export default function (request) {
388
357
  provider,
389
358
  redirectURI: `${window.location.protocol}//${window.location.host}${context.base}`,
390
359
  ...referralObj,
360
+ // dt,
391
361
  platform: 'pwa',
392
362
  fc,
393
363
  }).toString()
@@ -427,20 +397,6 @@ export default function (request) {
427
397
  fetchUserInfo: async (context, event) => {
428
398
  return await request.send(user.getUserInfo())
429
399
  },
430
- checkDeviceToken: async (context, event) => {
431
- const deviceTokenEnable = context.siteConfig?.dtVerify === '1'
432
- if (deviceTokenEnable) {
433
- const { exist } = await request.send(user.checkDt())
434
- if (!exist) {
435
- const dt = await getDeviceToken({ fpToken, sentry, hosts: request.hosts, enable: deviceTokenEnable })
436
- await request.send(user.updateDt({ dt }))
437
- }
438
- }
439
- },
440
- fetchSiteConfig: async (context, event) => {
441
- const { config } = await request.send(common.getConfig({ appSecret }))
442
- return JSON.parse(window.atob(config))
443
- },
444
400
  },
445
401
  }
446
402
  )
@@ -16,7 +16,6 @@ export default function (request, context) {
16
16
  cryptos: [],
17
17
  networks: [],
18
18
  sourceAddress: '',
19
- options: [],
20
19
 
21
20
  selectedCrypto: null,
22
21
  selectedNetwork: null,
@@ -139,7 +138,6 @@ export default function (request, context) {
139
138
  networks: defaultNetworks,
140
139
  selectedCrypto: cryptos[0],
141
140
  selectedNetwork: defaultNetworks[0],
142
- options: cryptos[0].optional,
143
141
  }
144
142
  }),
145
143
  setCrypto: assign((context, event) => {
@@ -159,18 +157,14 @@ export default function (request, context) {
159
157
  selectedNetwork: networks[0],
160
158
  selectedAmount: null,
161
159
  calculation: null,
162
- options: selectedCrypto.optional,
163
160
  }
164
161
  }),
165
162
  setNetwork: assign((context, event) => {
166
163
  return { selectedNetwork: event.data }
167
164
  }),
168
165
  setAmount: assign((context, event) => {
169
- // 現金網可自由填額度,grandTotalEnable 欄位感覺不再需要?
170
- if (context.selectedCrypto?.grandTotalEnable === 1) {
171
- return { selectedAmount: parseFloat(context.selectedAmount || 0) + parseFloat(event.data) }
172
- } else {
173
- return { selectedAmount: event.data }
166
+ return {
167
+ selectedAmount: event.data,
174
168
  }
175
169
  }),
176
170
  setAddress: assign((context, event) => {
@@ -55,11 +55,38 @@ export default function (request, context) {
55
55
  },
56
56
  ],
57
57
  },
58
- loaded: {},
58
+ loaded: {
59
+ on: {
60
+ SET_PROMOTION: {
61
+ target: 'debouncing',
62
+ actions: 'setPromotion',
63
+ },
64
+ SELECT_HOUSE_BANK: {
65
+ actions: 'setHouseBank',
66
+ },
67
+ INPUT_AMOUNT: {
68
+ target: 'debouncing',
69
+ actions: 'inputAmount',
70
+ },
71
+ },
72
+ },
59
73
  debouncing: {
60
74
  after: {
61
75
  1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'loaded' }],
62
76
  },
77
+ on: {
78
+ SET_PROMOTION: {
79
+ target: 'debouncing',
80
+ actions: 'setPromotion',
81
+ },
82
+ SELECT_HOUSE_BANK: {
83
+ actions: 'setHouseBank',
84
+ },
85
+ INPUT_AMOUNT: {
86
+ target: 'debouncing',
87
+ actions: 'inputAmount',
88
+ },
89
+ },
63
90
  },
64
91
  calculating: {
65
92
  invoke: {
@@ -75,6 +102,17 @@ export default function (request, context) {
75
102
  },
76
103
  calculated: {
77
104
  on: {
105
+ SET_PROMOTION: {
106
+ target: 'debouncing',
107
+ actions: 'setPromotion',
108
+ },
109
+ SELECT_HOUSE_BANK: {
110
+ actions: 'setHouseBank',
111
+ },
112
+ INPUT_AMOUNT: {
113
+ target: 'debouncing',
114
+ actions: 'inputAmount',
115
+ },
78
116
  SELECT_USER_BANK: {
79
117
  actions: 'setUserBank',
80
118
  },
@@ -112,24 +150,14 @@ export default function (request, context) {
112
150
  },
113
151
  on: {
114
152
  SET_PROMOTION: {
115
- target: 'debouncing',
116
153
  actions: 'setPromotion',
117
- internal: false,
118
- },
119
- INPUT_AMOUNT: {
120
- target: 'debouncing',
121
- actions: 'inputAmount',
122
- internal: false,
123
- },
124
- SELECT_HOUSE_BANK: {
125
- actions: 'setHouseBank',
126
154
  },
127
155
  },
128
156
  },
129
157
  {
130
158
  actions: {
131
159
  setInitData: assign((context, event) => {
132
- const { currentPayment, banks, paymentInfo, processing } = event.data
160
+ const { currentPayment, banks, paymentInfo } = event.data
133
161
  const playerBanks = paymentInfo?.bankInfo || []
134
162
 
135
163
  const houseBanks = currentPayment.banks.map((bank) => {
@@ -149,7 +177,7 @@ export default function (request, context) {
149
177
  return {
150
178
  currentPayment,
151
179
  method: currentPayment.method,
152
- processing,
180
+ processing: currentPayment.processing?.[0],
153
181
  houseBanks,
154
182
  selectedHouseBank: houseBanks[0],
155
183
  userBanks,
@@ -248,17 +276,15 @@ export default function (request, context) {
248
276
  (element) => element.category === context.currentCategory && element.transferType === 'deposit'
249
277
  )
250
278
 
251
- const [banks, paymentInfo, orders] = await Promise.all([
279
+ const [banks, paymentInfo] = await Promise.all([
252
280
  request.send(payment.getBankList(currentPayment.method)),
253
281
  request.send(payment.getPaymentInfo()),
254
- request.send(payment.getPendingOrder({ transferType: 'DEPOSIT' })),
255
282
  ])
256
283
 
257
284
  return {
258
285
  currentPayment,
259
286
  banks,
260
287
  paymentInfo,
261
- processing: orders[0],
262
288
  }
263
289
  },
264
290
  fetchCalculation: async (context, event) => {
@@ -267,7 +293,7 @@ export default function (request, context) {
267
293
  payment.getDepositExpectedResult({
268
294
  method,
269
295
  amount: selectedAmount,
270
- promotionsNo: promotion?.promotionsNo,
296
+ promotionsNo: promotion?.activityNo,
271
297
  })
272
298
  )
273
299
  },
@@ -285,7 +311,7 @@ export default function (request, context) {
285
311
  applyerHolderName: userAccountName,
286
312
  depositTime,
287
313
  receipt,
288
- promotionsNo: promotion?.promotionsNo,
314
+ promotionsNo: promotion?.activityNo,
289
315
  })
290
316
  )
291
317
  },
@@ -7,23 +7,9 @@ export default function (request) {
7
7
  id: 'favorite',
8
8
  initial: 'fetching',
9
9
  context: {
10
- auth: false,
11
10
  list: [],
12
11
  },
13
12
  states: {
14
- idle: {},
15
- checking: {
16
- always: [
17
- {
18
- target: 'fetching',
19
- cond: 'hasAuth',
20
- },
21
- {
22
- target: 'idle',
23
- actions: 'clearList',
24
- },
25
- ],
26
- },
27
13
  fetching: {
28
14
  invoke: {
29
15
  src: 'fetchList',
@@ -31,7 +17,7 @@ export default function (request) {
31
17
  actions: 'setList',
32
18
  },
33
19
  onError: {
34
- actions: 'clearList',
20
+ actions: assign({ list: [] }),
35
21
  },
36
22
  },
37
23
  },
@@ -82,13 +68,6 @@ export default function (request) {
82
68
  actions: 'removeFromList',
83
69
  cond: 'isExist',
84
70
  },
85
- SET_AUTH: [
86
- {
87
- target: 'checking',
88
- actions: 'setAuth',
89
- cond: 'isAuthChanged',
90
- },
91
- ],
92
71
  },
93
72
  },
94
73
  {
@@ -98,11 +77,6 @@ export default function (request) {
98
77
  list: event.data,
99
78
  }
100
79
  }),
101
- clearList: assign((context, event) => {
102
- return {
103
- list: [],
104
- }
105
- }),
106
80
  addToList: assign((context, event) => {
107
81
  return {
108
82
  list: [...context.list, event.data],
@@ -113,17 +87,10 @@ export default function (request) {
113
87
  list: context.list.filter((item) => item.gameCode !== event.data.gameCode),
114
88
  }
115
89
  }),
116
- setAuth: assign((context, event) => {
117
- return {
118
- auth: !!event.data,
119
- }
120
- }),
121
90
  },
122
91
  guards: {
123
92
  isExist: (context, event) => context.list.some((item) => item.gameCode === event.data.gameCode),
124
93
  isNotExist: (context, event) => !context.list.some((item) => item.gameCode === event.data.gameCode),
125
- isAuthChanged: (context, event) => context.auth !== !!event.data,
126
- hasAuth: (context, event) => context.auth,
127
94
  },
128
95
  services: {
129
96
  add: async (context, event) => {
@@ -25,7 +25,6 @@ export default function (request) {
25
25
  isRecentlyGame: null,
26
26
  isRecentlySearch: null,
27
27
  gameCode: null,
28
- lang: 'en_US',
29
28
  },
30
29
  states: {
31
30
  preset: {
@@ -126,7 +125,7 @@ export default function (request) {
126
125
  ],
127
126
  SET_KEYWORD: {
128
127
  target: 'debouncing',
129
- actions: ['setKeyword', 'setLang'],
128
+ actions: 'setKeyword',
130
129
  },
131
130
  STOP_SEARCH: {
132
131
  target: '#game_search_v2.idle',
@@ -138,7 +137,7 @@ export default function (request) {
138
137
  on: {
139
138
  SET_KEYWORD: {
140
139
  target: 'debouncing',
141
- actions: ['setKeyword', 'setLang'],
140
+ actions: 'setKeyword',
142
141
  },
143
142
  },
144
143
  after: {
@@ -276,12 +275,7 @@ export default function (request) {
276
275
  }),
277
276
  setKeyword: assign((context, event) => {
278
277
  return {
279
- keyword: event.data.keyword,
280
- }
281
- }),
282
- setLang: assign((context, event) => {
283
- return {
284
- lang: event.data.lang,
278
+ keyword: event.data,
285
279
  }
286
280
  }),
287
281
  clearKeywords: assign((context, event) => {
@@ -332,8 +326,8 @@ export default function (request) {
332
326
  },
333
327
  services: {
334
328
  fetchTags: async (context, event) => {
335
- const { keyword, lang } = context
336
- const { result } = await request.send(game.getGameTags({ q: keyword, lang }))
329
+ const { keyword } = context
330
+ const { result } = await request.send(game.getGameTags({ q: keyword }))
337
331
  return result
338
332
  },
339
333
  fetchInitialData: async (context, event) => {
@@ -342,15 +336,7 @@ export default function (request) {
342
336
  },
343
337
  fetchGames: async (context, event) => {
344
338
  const { tagId, tagIndex, keyword, click, clickDefault } = context
345
- const { traceId, result } = await request.send(
346
- game.getGameSearchList({
347
- id: tagId,
348
- index: tagIndex,
349
- q: keyword,
350
- click,
351
- clickDefault,
352
- })
353
- )
339
+ const { traceId, result } = await request.send(game.getGameSearchList({ id: tagId, index: tagIndex, q: keyword, click, clickDefault }))
354
340
  return { traceId, result }
355
341
  },
356
342
  sendTrace: async (context, event) => {
@@ -23,6 +23,11 @@ import user_sign_up from './user_sign_up.js'
23
23
  import user_reset_password from './user_reset_password.js'
24
24
  import bank_binding from './bank_binding.js'
25
25
  import bank_binding_amb from './bank_binding_amb.js'
26
+ import withdraw_fc from './withdraw_fc.js'
27
+ import withdraw_vn from './withdraw_vn.js'
28
+ import withdraw_vn2 from './withdraw_vn2.js'
29
+ import withdraw_crypto from './withdraw_crypto.js'
30
+ import withdraw_amb from './withdraw_amb.js'
26
31
  import withdraw from './withdraw/index.js'
27
32
  import deposit from './deposit/index.js'
28
33
  import bonus from './bonus.js'
@@ -38,6 +43,7 @@ export default {
38
43
  auth,
39
44
  welcome,
40
45
  common,
46
+ deposit,
41
47
  error,
42
48
  game_favorite_v2,
43
49
  game_search,
@@ -59,6 +65,11 @@ export default {
59
65
  user_reset_password,
60
66
  bank_binding,
61
67
  bank_binding_amb,
68
+ withdraw_fc,
69
+ withdraw_vn,
70
+ withdraw_vn2,
71
+ withdraw_crypto,
72
+ withdraw_amb,
62
73
  ...deposit,
63
74
  bonus,
64
75
  leaderboard,
@@ -67,5 +78,5 @@ export default {
67
78
  vip_table,
68
79
  promotions,
69
80
  roulette_v2,
70
- ...withdraw,
81
+ withdraw,
71
82
  }
@@ -9,7 +9,7 @@ export default function (request) {
9
9
  id: 'reward_cash',
10
10
  type: 'parallel',
11
11
  context: {
12
- auth: false,
12
+ hasAuth: false,
13
13
  otherRewardList: [],
14
14
  pointsRewardList: [],
15
15
  rewardList: [],
@@ -27,7 +27,7 @@ export default function (request) {
27
27
  {
28
28
  target: 'loading',
29
29
  cond: (context, event) => {
30
- return context.auth
30
+ return context.hasAuth
31
31
  },
32
32
  },
33
33
  ],
@@ -137,7 +137,8 @@ export default function (request) {
137
137
  target: '.timer.checking',
138
138
  actions: 'setAuth',
139
139
  cond: (context, event) => {
140
- return context.auth !== !!event.data
140
+ console.log(context.hasAuth, event.data)
141
+ return context.hasAuth !== event.data
141
142
  },
142
143
  },
143
144
  },
@@ -145,7 +146,7 @@ export default function (request) {
145
146
  {
146
147
  actions: {
147
148
  setAuth: assign((context, event) => {
148
- return { auth: !!event.data }
149
+ return { hasAuth: event.data }
149
150
  }),
150
151
  setRewardList: assign((context, event) => {
151
152
  return {
@@ -23,7 +23,6 @@ export default function (request) {
23
23
  strategy: null,
24
24
  uid: null,
25
25
  },
26
- deviceTokenEnable: true,
27
26
  },
28
27
  states: {
29
28
  idle: {
@@ -52,11 +51,6 @@ export default function (request) {
52
51
  },
53
52
  authenticated: {},
54
53
  },
55
- on: {
56
- SET_DEVICE_TOKEN_ENABLE: {
57
- actions: 'setDeviceTokenEnable',
58
- },
59
- },
60
54
  },
61
55
  {
62
56
  actions: {
@@ -111,16 +105,12 @@ export default function (request) {
111
105
  },
112
106
  }
113
107
  }),
114
- setDeviceTokenEnable: assign((context, event) => {
115
- return {
116
- deviceTokenEnable: event.data,
117
- }
118
- }),
119
108
  },
120
109
  services: {
121
110
  authenticate: async (context, event) => {
122
- const { channel, subchannel, signUpData, deviceTokenEnable } = context
123
- const dt = await getDeviceToken({ fpToken, sentry, hosts: request.hosts, enable: deviceTokenEnable })
111
+ const { channel, subchannel, signUpData } = context
112
+ const dt = await getDeviceToken({ fpToken, sentry, hosts: request.hosts })
113
+ sentry.setTag('dt', dt)
124
114
 
125
115
  const affiliateCode = storage.get('ac')
126
116
  const messages = {
@@ -7,7 +7,7 @@ export default function (request, context) {
7
7
  const { paymentDetail = [] } = context || {}
8
8
  return createMachine(
9
9
  {
10
- id: 'withdraw_crypto_cash',
10
+ id: 'crypto_cash',
11
11
  initial: 'loading',
12
12
  context: {
13
13
  paymentDetail,
@@ -29,10 +29,10 @@ export default function (request, context) {
29
29
  states: {
30
30
  loading: {
31
31
  invoke: {
32
- src: 'fetchInitData',
32
+ src: 'fetchWithdrawRule',
33
33
  onDone: {
34
34
  target: 'checking',
35
- actions: 'setInitData',
35
+ actions: ['setWithdrawRule', 'setInitData'],
36
36
  },
37
37
  onError: {
38
38
  target: 'loaded',
@@ -126,7 +126,7 @@ export default function (request, context) {
126
126
  src: 'acknowledge',
127
127
  onDone: [
128
128
  {
129
- target: '#withdraw_crypto_cash.submitted',
129
+ target: '#crypto_cash.submitted',
130
130
  },
131
131
  ],
132
132
  onError: {
@@ -169,7 +169,6 @@ export default function (request, context) {
169
169
  {
170
170
  actions: {
171
171
  setInitData: assign((context, event) => {
172
- const { withdrawRule, processing } = event.data
173
172
  const { paymentDetail } = context
174
173
  const selectedCrypto = paymentDetail.find((item) => item.transferType === 'withdraw' && item.category === 'crypto')
175
174
  const networks = (selectedCrypto?.networkName || []).map((value, i) => {
@@ -180,12 +179,18 @@ export default function (request, context) {
180
179
  }
181
180
  })
182
181
 
182
+ console.log('paymentDetail', selectedCrypto.processing)
183
+
183
184
  return {
184
- withdrawRule,
185
185
  selectedCrypto,
186
186
  networks,
187
187
  selectedNetwork: networks[0],
188
- processing,
188
+ processing: selectedCrypto.processing?.[0],
189
+ }
190
+ }),
191
+ setWithdrawRule: assign((context, event) => {
192
+ return {
193
+ withdrawRule: event.data,
189
194
  }
190
195
  }),
191
196
  setNetwork: assign((context, event) => {
@@ -267,17 +272,6 @@ export default function (request, context) {
267
272
  },
268
273
  },
269
274
  services: {
270
- fetchInitData: async (context, event) => {
271
- const [withdrawRule, orders] = await Promise.all([
272
- request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' })),
273
- request.send(payment.getPendingOrder({ transferType: 'WITHDRAW' })),
274
- ])
275
-
276
- return {
277
- withdrawRule,
278
- processing: orders[0],
279
- }
280
- },
281
275
  fetchWithdrawRule: async (context, event) => {
282
276
  return await request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' }))
283
277
  },
@@ -1,17 +1,4 @@
1
- import withdraw_fc from './withdraw_fc.js'
2
- import withdraw_vn from './withdraw_vn.js'
3
- import withdraw_vn2 from './withdraw_vn2.js'
4
- import withdraw_crypto from './withdraw_crypto.js'
5
- import withdraw_amb from './withdraw_amb.js'
6
- import withdraw_crypto_cash from './withdraw_crypto_cash.js'
7
- import withdraw_manual_cash from './withdraw_manual_cash.js'
1
+ import crypto_cash from './crypto_cash.js'
2
+ import manual_cash from './manual_cash.js'
8
3
 
9
- export default {
10
- withdraw_fc,
11
- withdraw_vn,
12
- withdraw_vn2,
13
- withdraw_crypto,
14
- withdraw_amb,
15
- withdraw_crypto_cash,
16
- withdraw_manual_cash,
17
- }
4
+ export default { crypto_cash, manual_cash }
@@ -6,7 +6,7 @@ export default function (request, context) {
6
6
  const { paymentDetail = [] } = context || {}
7
7
  return createMachine(
8
8
  {
9
- id: 'withdraw_manual_cash',
9
+ id: 'manual_cash',
10
10
  initial: 'loading',
11
11
  context: {
12
12
  paymentDetail,
@@ -139,7 +139,6 @@ export default function (request, context) {
139
139
  },
140
140
  },
141
141
  on: {
142
- REFRESH: { target: 'loading', internal: false, cond: 'hasNoBank' },
143
142
  SET_AMOUNT: {
144
143
  target: 'debouncing',
145
144
  actions: 'setAmount',
@@ -153,7 +152,7 @@ export default function (request, context) {
153
152
  {
154
153
  actions: {
155
154
  setInitData: assign((context, event) => {
156
- const { currentPayment, banks, paymentInfo, withdrawRule, processing } = event.data
155
+ const { currentPayment, banks, paymentInfo, withdrawRule } = event.data
157
156
 
158
157
  const userBanks = (paymentInfo?.bankInfo || []).map((bank) => {
159
158
  bank.displayText = `${bank.bankCode} ${bank.accountNumber.slice(-5)}`
@@ -163,7 +162,7 @@ export default function (request, context) {
163
162
 
164
163
  return {
165
164
  currentPayment,
166
- processing,
165
+ processing: currentPayment.processing?.[0],
167
166
  banks,
168
167
  paymentInfo,
169
168
  withdrawRule,
@@ -211,9 +210,6 @@ export default function (request, context) {
211
210
  }),
212
211
  },
213
212
  guards: {
214
- hasNoBank: (context, event) => {
215
- return !context.userBanks.length
216
- },
217
213
  isProcessing: (context, event) => {
218
214
  return context.processing
219
215
  },
@@ -229,11 +225,10 @@ export default function (request, context) {
229
225
  fetchInitData: async (context, event) => {
230
226
  const currentPayment = context.paymentDetail.find((element) => element.category === 'manual' && element.transferType === 'withdraw')
231
227
 
232
- const [banks, paymentInfo, withdrawRule, orders] = await Promise.all([
228
+ const [banks, paymentInfo, withdrawRule] = await Promise.all([
233
229
  request.send(payment.getBankList(currentPayment.method)),
234
230
  request.send(payment.getPaymentInfo()),
235
231
  request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' })),
236
- request.send(payment.getPendingOrder({ transferType: 'WITHDRAW' })),
237
232
  ])
238
233
 
239
234
  return {
@@ -241,12 +236,11 @@ export default function (request, context) {
241
236
  banks,
242
237
  paymentInfo,
243
238
  withdrawRule,
244
- processing: orders[0],
245
239
  }
246
240
  },
247
241
  submitWithdraw: async (context, event) => {
248
242
  const { currentPayment, selectedUserBank, selectedAmount } = context
249
- const branchTemp = ['GCASH', 'PAYM', 'PIX'].includes(selectedUserBank.bankCode) ? '' : selectedUserBank.branch
243
+ const branchTemp = ['GCASH', 'PAYM'].includes(selectedUserBank.bankCode) ? '' : selectedUserBank.branch
250
244
  return await request.send(
251
245
  payment.submitWithdrawTransactionVN({
252
246
  method: currentPayment.method,
@@ -1,8 +1,8 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import findLastIndex from 'lodash/findLastIndex.js'
3
- import payment from '../../api/payment.js'
4
- import common from '../../api/common.js'
5
- import user from '../../api/user.js'
3
+ import payment from '../api/payment.js'
4
+ import common from '../api/common.js'
5
+ import user from '../api/user.js'
6
6
 
7
7
  export default function (request) {
8
8
  const { appSecret } = request.config
@@ -1,9 +1,9 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import findLastIndex from 'lodash/findLastIndex.js'
3
- import payment from '../../api/payment.js'
4
- import common from '../../api/common.js'
5
- import user from '../../api/user.js'
6
- import api from '../../api/payment.js'
3
+ import payment from '../api/payment.js'
4
+ import common from '../api/common.js'
5
+ import user from '../api/user.js'
6
+ import api from '../api/payment.js'
7
7
 
8
8
  export default function (request) {
9
9
  const { appSecret } = request.config
@@ -1,5 +1,5 @@
1
1
  import { assign, createMachine } from 'xstate'
2
- import api from '../../api/payment.js'
2
+ import api from '../api/payment.js'
3
3
 
4
4
  export default function (request) {
5
5
  return createMachine(
@@ -1,8 +1,8 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import findLastIndex from 'lodash/findLastIndex.js'
3
- import payment from '../../api/payment.js'
4
- import common from '../../api/common.js'
5
- import user from '../../api/user.js'
3
+ import payment from '../api/payment.js'
4
+ import common from '../api/common.js'
5
+ import user from '../api/user.js'
6
6
 
7
7
  export default function (request) {
8
8
  const { appSecret } = request.config
@@ -461,7 +461,7 @@ export default function (request) {
461
461
  submitWithdraw: async (context, event) => {
462
462
  const { bank, amount } = context
463
463
  const { method } = context.paymentDetail[0]
464
- const branchTemp = ['GCASH', 'PAYM', 'PIX'].includes(bank.bankCode) ? '' : bank.branch
464
+ const branchTemp = ['GCASH', 'PAYM'].includes(bank.bankCode) ? '' : bank.branch
465
465
  return await request.send(
466
466
  payment.submitWithdrawTransactionVN({
467
467
  method,
@@ -1,7 +1,7 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import findLastIndex from 'lodash/findLastIndex.js'
3
- import payment from '../../api/payment.js'
4
- import user from '../../api/user.js'
3
+ import payment from '../api/payment.js'
4
+ import user from '../api/user.js'
5
5
 
6
6
  export default function (request) {
7
7
  const { appSecret } = request.config
@@ -484,7 +484,7 @@ export default function (request) {
484
484
  submitWithdraw: async (context, event) => {
485
485
  const { bank, amount } = context
486
486
  const { method } = context.paymentDetail[0]
487
- const branchTemp = ['GCASH', 'PAYM', 'PIX'].includes(bank.bankCode) ? '' : bank.branch
487
+ const branchTemp = ['GCASH', 'PAYM'].includes(bank.bankCode) ? '' : bank.branch
488
488
  return await request.send(
489
489
  payment.submitWithdrawTransactionVN({
490
490
  method,
@@ -1,20 +1,18 @@
1
+ // import FingerprintJS from '@fingerprintjs/fingerprintjs-pro'
1
2
  import uniqBy from 'lodash/uniqBy'
2
3
  import { load } from '../lib/fingerprint.js'
3
4
 
4
5
  const reg = /fnapi\d*/
6
+ // const reg = /(?<=https:\/\/)\w+(?=(\.\w+\.\w+))/
5
7
 
6
- const getDeviceToken = async ({ fpToken, sentry, hosts, enable = true }) => {
7
- if (!enable) {
8
- return
9
- }
10
-
8
+ const getDeviceToken = async ({ fpToken, sentry, hosts }) => {
11
9
  let dt, endpoints
12
10
  try {
13
11
  endpoints = uniqBy(
14
12
  hosts.map((host) => host.replace(reg, 'fp')),
15
13
  (url) => url
16
14
  )
17
-
15
+ // const fp = await FingerprintJS.load({ apiKey: fpToken, endpoint: endpoints })
18
16
  const fp = await load({ endpoint: endpoints })
19
17
  const result = await fp.get({ timeout: 30000 })
20
18
  dt = result.visitorId
@@ -24,7 +22,6 @@ const getDeviceToken = async ({ fpToken, sentry, hosts, enable = true }) => {
24
22
  }
25
23
 
26
24
  console.log('[Device Token]', `${dt} from ${endpoints}`)
27
- sentry?.setTag('dt', dt)
28
25
  } catch (error) {
29
26
  console.error('[Device Token]', `${dt} from ${endpoints}`, error)
30
27
  sentry?.captureException(error)
@@ -1,67 +0,0 @@
1
- import { createMachine, assign } from 'xstate'
2
- import api from '../../api/activity.js'
3
-
4
- export default function (request) {
5
- const { appSecret } = request.config
6
- return createMachine(
7
- {
8
- id: 'activity',
9
- initial: 'fetchingActivityList',
10
- context: {
11
- tick: 2000,
12
- activityList: [],
13
- activityMap: {},
14
- tournamentList: [],
15
- refs: {},
16
- },
17
- states: {
18
- fetchingActivityList: {
19
- invoke: {
20
- src: 'fetchActivityList',
21
- onDone: {
22
- target: 'pending',
23
- actions: ['setActivityList', 'setTournamentList'],
24
- },
25
- onError: {
26
- target: 'pending',
27
- },
28
- },
29
- },
30
- pending: {
31
- after: {
32
- TIMEOUT: {
33
- target: 'fetchingActivityList',
34
- },
35
- },
36
- },
37
- },
38
- },
39
- {
40
- actions: {
41
- setTournamentList: assign((context, event) => {
42
- const tournamentList = event.data.filter((item) => item.tournament === 1)
43
- return {
44
- tournamentList,
45
- }
46
- }),
47
- setActivityList: assign((context, event) => {
48
- return {
49
- activityList: event.data,
50
- }
51
- }),
52
- },
53
- delays: {
54
- TIMEOUT: (context, event) => {
55
- const { tick } = context
56
- return tick * 10
57
- },
58
- },
59
- services: {
60
- fetchActivityList: async (context, event) => {
61
- const { data } = await request.send(api.getActivityList({ appSecret }))
62
- return data
63
- },
64
- },
65
- }
66
- )
67
- }
@@ -1,65 +0,0 @@
1
- import { assign, createMachine } from 'xstate'
2
- import api from '@jetthai/cuora/src/api/activity'
3
-
4
- export default function (request) {
5
- const { appSecret } = request.config
6
- return createMachine(
7
- {
8
- id: 'sign_in_monthly',
9
- context: {
10
- activityNo: null,
11
- activityDetail: null,
12
- receiveStatus: 0,
13
- rewardsCalendar: [],
14
- },
15
- initial: 'idle',
16
- states: {
17
- idle: {
18
- on: {
19
- SET_ACTIVITY_NO: {
20
- target: 'fetching',
21
- actions: 'setActivityNo',
22
- },
23
- },
24
- },
25
- fetching: {
26
- invoke: {
27
- src: 'fetchActivityDetail',
28
- onDone: {
29
- target: 'loaded',
30
- actions: 'setInitData',
31
- },
32
- onError: {
33
- target: 'loaded',
34
- },
35
- },
36
- },
37
- loaded: {},
38
- },
39
- },
40
- {
41
- actions: {
42
- setActivityNo: assign((context, event) => {
43
- return {
44
- activityNo: event.data,
45
- }
46
- }),
47
- setInitData: assign((context, event) => {
48
- const { rewardsCalendar = [], receiveStatus = 0 } = event.data || {}
49
- return {
50
- activityDetail: event.data,
51
- rewardsCalendar,
52
- receiveStatus,
53
- }
54
- }),
55
- },
56
- services: {
57
- fetchActivityDetail: async (context, event) => {
58
- const { activityNo } = context
59
- const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
60
- return data
61
- },
62
- },
63
- }
64
- )
65
- }