@jetthai/cuora 1.0.152-2 → 1.0.153-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.
package/CHANGELOG.md CHANGED
@@ -2,9 +2,15 @@
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.0.152-2](https://github.com/jetthai/cuora-module/compare/v1.0.152-1...v1.0.152-2) (2022-08-02)
5
+ ### [1.0.153-1](https://github.com/jetthai/cuora-module/compare/v1.0.153...v1.0.153-1) (2022-07-28)
6
6
 
7
- ### [1.0.152-1](https://github.com/jetthai/cuora-module/compare/v1.0.152...v1.0.152-1) (2022-08-02)
7
+ ### [1.0.153](https://github.com/jetthai/cuora-module/compare/v1.0.149-2...v1.0.153) (2022-07-28)
8
+
9
+ ### [1.0.152](https://github.com/jetthai/cuora-module/compare/v1.0.149-1...v1.0.152) (2022-07-27)
10
+
11
+ ### [1.0.151](https://github.com/jetthai/cuora-module/compare/v1.0.150...v1.0.151) (2022-07-27)
12
+
13
+ ### [1.0.150](https://github.com/jetthai/cuora-module/compare/v1.0.149...v1.0.150) (2022-07-27)
8
14
 
9
15
  ### [1.0.152](https://github.com/jetthai/cuora-module/compare/v1.0.151...v1.0.152) (2022-07-27)
10
16
 
@@ -12,6 +18,10 @@ All notable changes to this project will be documented in this file. See [standa
12
18
 
13
19
  ### [1.0.150](https://github.com/jetthai/cuora-module/compare/v1.0.149...v1.0.150) (2022-07-27)
14
20
 
21
+ ### [1.0.149-2](https://github.com/jetthai/cuora-module/compare/v1.0.149-1...v1.0.149-2) (2022-07-28)
22
+
23
+ ### [1.0.149-1](https://github.com/jetthai/cuora-module/compare/v1.0.149...v1.0.149-1) (2022-07-27)
24
+
15
25
  ### [1.0.149](https://github.com/jetthai/cuora-module/compare/v1.0.148...v1.0.149) (2022-07-26)
16
26
 
17
27
  ### [1.0.148](https://github.com/jetthai/cuora-module/compare/v1.0.147...v1.0.148) (2022-07-26)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.152-2",
3
+ "version": "1.0.153-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
package/src/api/auth.js CHANGED
@@ -11,10 +11,10 @@ export default {
11
11
  isPublic: true,
12
12
  headers: { 'x-access-captcha': reCaptchaToken },
13
13
  }),
14
- register: ({ channel = 'official', subchannel = 'pwa', reCaptchaToken, dt, ...rest }) => ({
14
+ register: ({ channel = 'official', subchannel = 'pwa', reCaptchaToken, ...rest }) => ({
15
15
  url: `register?channel=${channel}&subchannel=${subchannel}`,
16
16
  method: 'post',
17
- params: { dt, ...rest },
17
+ params: rest,
18
18
  isPublic: true,
19
19
  headers: { 'x-access-captcha': reCaptchaToken },
20
20
  }),
@@ -4,10 +4,9 @@ import qs from 'qs'
4
4
  import { assign, createMachine } from 'xstate'
5
5
  import auth from '../api/auth'
6
6
  import user from '../api/user'
7
- import { getDeviceToken } from '../util/deviceToken'
8
7
 
9
8
  export default function (request) {
10
- const { clientId, fpToken, sentry, defaultChannel, defaultSubchannel } = request.config
9
+ const { clientId, sentry, defaultChannel, defaultSubchannel } = request.config
11
10
  const tokenKey = `cuora_${clientId}`
12
11
  const userKey = `cuora_tempuser`
13
12
  const accountPhoneKey = 'account_phone'
@@ -289,30 +288,17 @@ export default function (request) {
289
288
  }),
290
289
  redirectTo3Party: async (context, event) => {
291
290
  const { provider, channel, subchannel } = event.data
292
-
293
- const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL })
294
- sentry.setTag('dt', dt)
295
- const messages = {
296
- url: window.location.href,
297
- list: [
298
- { channel: cookies.get('channel'), subchannel: cookies.get('subchannel') },
299
- { channel: defaultChannel, subchannel: defaultSubchannel },
300
- { channel: channel, subchannel: subchannel },
301
- ],
302
- }
303
- sentry.captureMessage(JSON.stringify(messages))
304
-
305
291
  const redirectURL = urljoin(
306
292
  request.config.fullURL,
307
293
  'login?' +
308
- qs.stringify({
309
- provider,
310
- redirectURI: `${window.location.protocol}//${window.location.host}`,
311
- channel: cookies.get('channel') || channel || defaultChannel || 'official',
312
- subchannel: cookies.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
313
- // dt,
314
- platform: 'pwa',
315
- })
294
+ qs.stringify({
295
+ provider,
296
+ redirectURI: `${window.location.protocol}//${window.location.host}`,
297
+ channel: cookies.get('channel') || channel || defaultChannel || 'official',
298
+ subchannel: cookies.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
299
+ // dt,
300
+ platform: 'pwa',
301
+ })
316
302
  )
317
303
  window.location.href = redirectURL
318
304
  },
@@ -16,7 +16,7 @@ export default function (request) {
16
16
  states: {
17
17
  fetching: {
18
18
  invoke: {
19
- src: 'fetchBanks',
19
+ src: 'fetchInitData',
20
20
  onDone: {
21
21
  target: 'idle',
22
22
  actions: 'setBanks',
@@ -79,8 +79,9 @@ export default function (request) {
79
79
  {
80
80
  actions: {
81
81
  setBanks: assign((context, event) => {
82
- const bankList = event.data || []
82
+ const { bankList = [], paymentInfo = {} } = event.data
83
83
  return {
84
+ holderName: paymentInfo.bankInfo[0]?.holderName,
84
85
  bankList,
85
86
  bank: bankList[0],
86
87
  }
@@ -93,10 +94,14 @@ export default function (request) {
93
94
  },
94
95
  },
95
96
  services: {
96
- fetchBanks: async (context, event) => {
97
+ fetchInitData: async (context, event) => {
97
98
  const paymentDetail = await request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' }))
98
99
  const method = paymentDetail.find((payment) => payment.category === 'manual').method
99
- return await request.send(payment.getBankList(method))
100
+ const [bankList, paymentInfo] = await Promise.all([
101
+ request.send(payment.getBankList(method)),
102
+ request.send(payment.getPaymentInfo())
103
+ ])
104
+ return { bankList, paymentInfo }
100
105
  },
101
106
  updatePaymentInfo: async (context, event) => {
102
107
  const { bank, branch, accountNumber, holderName } = context
@@ -104,17 +104,6 @@ export default function (request) {
104
104
  const { channel, subchannel, signUpData } = context
105
105
  const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL })
106
106
 
107
- sentry.setTag('dt', dt)
108
- const messages = {
109
- url: window.location.href,
110
- list: [
111
- { channel: cookies.get('channel'), subchannel: cookies.get('subchannel') },
112
- { channel: defaultChannel, subchannel: defaultSubchannel },
113
- { channel: channel, subchannel: subchannel },
114
- ],
115
- }
116
- sentry.captureMessage(JSON.stringify(messages))
117
-
118
107
  return await request.send(
119
108
  auth.register({
120
109
  ...signUpData,
@@ -7,13 +7,6 @@ export default function (request) {
7
7
  initial: 'fetching',
8
8
  context: {
9
9
  vipTable: [],
10
- filterVipTable: [],
11
- fasterWithdraw: [],
12
- fasterReward: [],
13
- cashbackOthers: [],
14
- cashbackSlot: [],
15
- cashbackFishing: [],
16
- upgradeReward: []
17
10
  },
18
11
  states: {
19
12
  fetching: {
@@ -36,29 +29,8 @@ export default function (request) {
36
29
  actions: {
37
30
  setVipTable: assign((context, event) => {
38
31
  const vipTable = event.data
39
- const filterVipTable = vipTable.filter((item) => item.title !== 'rookie' && item.title !== 'guest')
40
- const fasterWithdraw = filterVipTable.map(item => item.fasterWithdraw)
41
- const fasterReward = filterVipTable.map(item => item.fasterReward)
42
- const cashbackOthers = filterVipTable.map(item => item.cashbackOther)
43
- const cashbackSlot = filterVipTable.map(item => item.cashbackSlot)
44
- const cashbackFishing = filterVipTable.map(item => item.cashbackFishing)
45
- const upgradeReward = filterVipTable.map(item => {
46
- return {
47
- reward: item.upgradeReward,
48
- type: item.rewardType,
49
- }
50
- })
51
32
 
52
- return {
53
- vipTable,
54
- filterVipTable,
55
- fasterWithdraw,
56
- fasterReward,
57
- cashbackOthers,
58
- cashbackSlot,
59
- cashbackFishing,
60
- upgradeReward
61
- }
33
+ return { vipTable }
62
34
  }),
63
35
  },
64
36
  services: {