@jetthai/cuora 1.0.151 → 1.0.152-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,6 +2,10 @@
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-1](https://github.com/jetthai/cuora-module/compare/v1.0.152...v1.0.152-1) (2022-08-02)
6
+
7
+ ### [1.0.152](https://github.com/jetthai/cuora-module/compare/v1.0.151...v1.0.152) (2022-07-27)
8
+
5
9
  ### [1.0.151](https://github.com/jetthai/cuora-module/compare/v1.0.150...v1.0.151) (2022-07-27)
6
10
 
7
11
  ### [1.0.150](https://github.com/jetthai/cuora-module/compare/v1.0.149...v1.0.150) (2022-07-27)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.151",
3
+ "version": "1.0.152-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, ...rest }) => ({
14
+ register: ({ channel = 'official', subchannel = 'pwa', reCaptchaToken, dt, ...rest }) => ({
15
15
  url: `register?channel=${channel}&subchannel=${subchannel}`,
16
16
  method: 'post',
17
- params: rest,
17
+ params: { dt, ...rest },
18
18
  isPublic: true,
19
19
  headers: { 'x-access-captcha': reCaptchaToken },
20
20
  }),
@@ -4,9 +4,10 @@ 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'
7
8
 
8
9
  export default function (request) {
9
- const { clientId, sentry, defaultChannel, defaultSubchannel } = request.config
10
+ const { clientId, fpToken, sentry, defaultChannel, defaultSubchannel } = request.config
10
11
  const tokenKey = `cuora_${clientId}`
11
12
  const userKey = `cuora_tempuser`
12
13
  const accountPhoneKey = 'account_phone'
@@ -288,17 +289,28 @@ export default function (request) {
288
289
  }),
289
290
  redirectTo3Party: async (context, event) => {
290
291
  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
+ { channel: cookies.get('channel'), subchannel: cookies.get('subchannel') },
297
+ { channel: defaultChannel, subchannel: defaultSubchannel },
298
+ { channel: channel, subchannel: subchannel },
299
+ { url: window.location.href },
300
+ ]
301
+ sentry.captureMessage(JSON.stringify(messages))
302
+
291
303
  const redirectURL = urljoin(
292
304
  request.config.fullURL,
293
305
  'login?' +
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
- })
306
+ qs.stringify({
307
+ provider,
308
+ redirectURI: `${window.location.protocol}//${window.location.host}`,
309
+ channel: cookies.get('channel') || channel || defaultChannel || 'official',
310
+ subchannel: cookies.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
311
+ // dt,
312
+ platform: 'pwa',
313
+ })
302
314
  )
303
315
  window.location.href = redirectURL
304
316
  },
@@ -16,7 +16,7 @@ export default function (request) {
16
16
  currentCategory: 'direct',
17
17
  currentMethod: null,
18
18
  amount: null,
19
- result: null
19
+ result: null,
20
20
  },
21
21
  states: {
22
22
  loading: {
@@ -51,7 +51,7 @@ export default function (request) {
51
51
  loaded: {
52
52
  on: {
53
53
  SELECT_DIRECT: {
54
- actions: ['setDirect', 'reset']
54
+ actions: ['setDirect', 'reset'],
55
55
  },
56
56
  SELECT_BANK: {
57
57
  actions: 'setSelectedBank',
@@ -142,7 +142,7 @@ export default function (request) {
142
142
  }),
143
143
  setAmount: assign((context, event) => {
144
144
  return {
145
- amount: event.data
145
+ amount: event.data,
146
146
  }
147
147
  }),
148
148
  setCalculation: assign((context, event) => {
@@ -200,7 +200,7 @@ export default function (request) {
200
200
  payment.submitDepositTransactionBank({
201
201
  method: currentMethod,
202
202
  amount,
203
- applyerBankCode: selectedBank.bankCode
203
+ applyerBankCode: selectedBank.bankCode,
204
204
  })
205
205
  )
206
206
  },
@@ -2,6 +2,7 @@ import { createMachine, assign } from 'xstate'
2
2
  import Cookies from 'universal-cookie'
3
3
  import auth from '../api/auth'
4
4
  import { getDeviceToken } from '../util/deviceToken'
5
+
5
6
  const cookies = new Cookies()
6
7
 
7
8
  export default function (request) {
@@ -15,7 +16,14 @@ export default function (request) {
15
16
  channel: null,
16
17
  subchannel: null,
17
18
  signUpData: {},
18
- reCaptchaToken: null
19
+ reCaptchaToken: null,
20
+ registrationData: {
21
+ account: null,
22
+ currency: null,
23
+ site: null,
24
+ strategy: null,
25
+ uid: null,
26
+ },
19
27
  },
20
28
  states: {
21
29
  idle: {
@@ -35,6 +43,7 @@ export default function (request) {
35
43
  src: 'authenticate',
36
44
  onDone: {
37
45
  target: 'authenticated',
46
+ actions: 'setRegistrationData',
38
47
  },
39
48
  onError: {
40
49
  target: 'idle',
@@ -49,7 +58,7 @@ export default function (request) {
49
58
  setReCaptchaToken: assign((context, event) => {
50
59
  const { reCaptchaToken } = event.data
51
60
  return {
52
- reCaptchaToken
61
+ reCaptchaToken,
53
62
  }
54
63
  }),
55
64
  setSignUpPhone: assign((context, event) => {
@@ -77,19 +86,40 @@ export default function (request) {
77
86
  subchannel,
78
87
  }
79
88
  }),
89
+ setRegistrationData: assign((context, event) => {
90
+ const { account, currency, site, strategy, uid } = event.data
91
+ return {
92
+ registrationData: {
93
+ account,
94
+ currency,
95
+ site,
96
+ strategy,
97
+ uid,
98
+ },
99
+ }
100
+ }),
80
101
  },
81
102
  services: {
82
103
  authenticate: async (context, event) => {
83
104
  const { channel, subchannel, signUpData } = context
84
105
  const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL })
85
106
 
107
+ sentry.setTag('dt', dt)
108
+ const messages = [
109
+ { channel: cookies.get('channel'), subchannel: cookies.get('subchannel') },
110
+ { channel: defaultChannel, subchannel: defaultSubchannel },
111
+ { channel: channel, subchannel: subchannel },
112
+ { url: window.location.href },
113
+ ]
114
+ sentry.captureMessage(JSON.stringify(messages))
115
+
86
116
  return await request.send(
87
117
  auth.register({
88
118
  ...signUpData,
89
119
  channel: cookies.get('channel') || defaultChannel || channel,
90
120
  subchannel: cookies.get('subchannel') || defaultSubchannel || subchannel,
91
121
  dt,
92
- reCaptchaToken: context.reCaptchaToken
122
+ reCaptchaToken: context.reCaptchaToken,
93
123
  })
94
124
  )
95
125
  },
@@ -13,7 +13,7 @@ export default function (request) {
13
13
  cashbackOthers: [],
14
14
  cashbackSlot: [],
15
15
  cashbackFishing: [],
16
- upgradeReward: []
16
+ upgradeReward: [],
17
17
  },
18
18
  states: {
19
19
  fetching: {
@@ -26,23 +26,23 @@ export default function (request) {
26
26
  onError: {
27
27
  target: 'fail',
28
28
  },
29
- }
29
+ },
30
30
  },
31
31
  completed: {},
32
- fail: {}
33
- }
32
+ fail: {},
33
+ },
34
34
  },
35
35
  {
36
36
  actions: {
37
37
  setVipTable: assign((context, event) => {
38
38
  const vipTable = event.data
39
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 => {
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
46
  return {
47
47
  reward: item.upgradeReward,
48
48
  type: item.rewardType,
@@ -57,7 +57,7 @@ export default function (request) {
57
57
  cashbackOthers,
58
58
  cashbackSlot,
59
59
  cashbackFishing,
60
- upgradeReward
60
+ upgradeReward,
61
61
  }
62
62
  }),
63
63
  },
@@ -65,14 +65,14 @@ export default function (request) {
65
65
  fetchVipTable: async (context, event) => {
66
66
  const { viptable = {} } = await request.send(activity.getVipTable())
67
67
  const { data = [] } = viptable
68
- data.map(item => {
68
+ data.map((item) => {
69
69
  item.title = item.title.toLowerCase()
70
70
  return item
71
71
  })
72
72
 
73
73
  return data
74
74
  },
75
- }
75
+ },
76
76
  }
77
77
  )
78
- }
78
+ }