@jetthai/cuora 1.0.150 → 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 +6 -0
- package/package.json +1 -1
- package/src/api/activity.js +1 -0
- package/src/api/auth.js +2 -2
- package/src/api/user.js +0 -1
- package/src/machine/auth.js +13 -1
- package/src/machine/user_sign_up.js +30 -0
- package/src/machine/vip_table.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
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
|
+
|
|
9
|
+
### [1.0.151](https://github.com/jetthai/cuora-module/compare/v1.0.150...v1.0.151) (2022-07-27)
|
|
10
|
+
|
|
5
11
|
### [1.0.150](https://github.com/jetthai/cuora-module/compare/v1.0.149...v1.0.150) (2022-07-27)
|
|
6
12
|
|
|
7
13
|
### [1.0.149](https://github.com/jetthai/cuora-module/compare/v1.0.148...v1.0.149) (2022-07-26)
|
package/package.json
CHANGED
package/src/api/activity.js
CHANGED
|
@@ -48,4 +48,5 @@ export default {
|
|
|
48
48
|
getRewardList: ({ rewardType, count, appSecret }) => ({ url: 'activities/rewards', method: 'get', params: { rewardType, count, appSecret } }),
|
|
49
49
|
exchange: (data) => ({ url: 'activities/exchange', method: 'post', params: data }),
|
|
50
50
|
collect: (data) => ({ url: 'activities/collect', method: 'post', params: data }),
|
|
51
|
+
getVipTable: () => ({ url: 'activities/viptable', method: 'get' }),
|
|
51
52
|
}
|
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
|
}),
|
package/src/api/user.js
CHANGED
|
@@ -10,7 +10,6 @@ export default {
|
|
|
10
10
|
setPreference: ({ defaultCategory }) => ({ url: 'settings/preference', method: 'post', params: { defaultCategory } }),
|
|
11
11
|
resetOtp: ({ requestId, number }) => ({ url: 'reset', method: 'post', params: { requestId, number } }),
|
|
12
12
|
getAffiliate: () => ({ url: 'affiliate', method: 'get' }),
|
|
13
|
-
getVipTable: () => ({ url: 'viptable', method: 'get' }),
|
|
14
13
|
postAffiliate: ({ affiliateCode }) => ({ url: 'affiliate', method: 'post', params: { affiliateCode } }),
|
|
15
14
|
passwordRecovery: (recoveryData) => ({ url: 'recovery', method: 'post', params: recoveryData, isPublic: true }),
|
|
16
15
|
passwordAbandon: ({ number }) => ({ url: 'recovery/abandon', method: 'post', params: { number }, isPublic: true }),
|
package/src/machine/auth.js
CHANGED
|
@@ -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,6 +289,17 @@ 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?' +
|
|
@@ -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) {
|
|
@@ -16,6 +17,13 @@ export default function (request) {
|
|
|
16
17
|
subchannel: null,
|
|
17
18
|
signUpData: {},
|
|
18
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',
|
|
@@ -77,12 +86,33 @@ 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,
|
package/src/machine/vip_table.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createMachine, assign } from 'xstate'
|
|
2
|
-
import
|
|
2
|
+
import activity from '../api/activity'
|
|
3
3
|
export default function (request) {
|
|
4
4
|
return createMachine(
|
|
5
5
|
{
|
|
@@ -63,7 +63,7 @@ export default function (request) {
|
|
|
63
63
|
},
|
|
64
64
|
services: {
|
|
65
65
|
fetchVipTable: async (context, event) => {
|
|
66
|
-
const { viptable = {} } = await request.send(
|
|
66
|
+
const { viptable = {} } = await request.send(activity.getVipTable())
|
|
67
67
|
const { data = [] } = viptable
|
|
68
68
|
data.map((item) => {
|
|
69
69
|
item.title = item.title.toLowerCase()
|