@jetthai/cuora 1.0.200 → 1.0.202
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 +22 -0
- package/dist/bundle.mjs +413 -2429
- package/package.json +2 -2
- package/src/api/auth.js +2 -2
- package/src/api/user.js +3 -0
- package/src/machine/activity/affiliate_invite_friends_activity.js +181 -0
- package/src/machine/activity/index.js +2 -0
- package/src/machine/activity/invite_friends_activity.js +1 -6
- package/src/machine/auth.js +5 -1
- package/src/machine/reward.js +7 -4
- package/src/machine/user_sign_up.js +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jetthai/cuora",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.202",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"standard-version": "^9.3.1"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@fingerprintjs/fingerprintjs-pro": "^3.
|
|
26
|
+
"@fingerprintjs/fingerprintjs-pro": "^3.8.0",
|
|
27
27
|
"lodash": "^4.17.21",
|
|
28
28
|
"ua-parser-js": "^0.7.28",
|
|
29
29
|
"universal-cookie": "^4.0.4",
|
package/src/api/auth.js
CHANGED
|
@@ -30,8 +30,8 @@ export default {
|
|
|
30
30
|
},
|
|
31
31
|
isPublic: true,
|
|
32
32
|
}),
|
|
33
|
-
register: ({ channel = 'official', subchannel = 'pwa', reCaptchaToken, dt, ...rest }) => ({
|
|
34
|
-
url: `register?channel=${channel}&subchannel=${subchannel}`,
|
|
33
|
+
register: ({ channel = 'official', subchannel = 'pwa', affiliate = null, reCaptchaToken, dt, ...rest }) => ({
|
|
34
|
+
url: `register?channel=${channel}&subchannel=${subchannel}${affiliate ? `&affiliate=${affiliate}` : ''}`,
|
|
35
35
|
method: 'post',
|
|
36
36
|
params: { dt, ...rest },
|
|
37
37
|
isPublic: true,
|
package/src/api/user.js
CHANGED
|
@@ -10,6 +10,9 @@ 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
|
+
getAffiliateHome: () => ({ url: 'affiliate/home', method: 'get' }),
|
|
14
|
+
getAffiliateDashboard: () => ({ url: 'affiliate/dashboard', method: 'get' }),
|
|
15
|
+
getAffiliateDashboardList: ({ level, page, row }) => ({ url: 'affiliate/dashboard/list', method: 'post', params: { level, page, row } }),
|
|
13
16
|
postAffiliate: ({ affiliateCode }) => ({ url: 'affiliate', method: 'post', params: { affiliateCode } }),
|
|
14
17
|
passwordRecovery: (recoveryData) => ({ url: 'recovery', method: 'post', params: recoveryData, isPublic: true }),
|
|
15
18
|
passwordAbandon: ({ number }) => ({ url: 'recovery/abandon', method: 'post', params: { number }, isPublic: true }),
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import user from '../../api/user.js'
|
|
3
|
+
import api from '../../api/activity.js'
|
|
4
|
+
|
|
5
|
+
export default function (request) {
|
|
6
|
+
const { appSecret } = request.config
|
|
7
|
+
return createMachine(
|
|
8
|
+
{
|
|
9
|
+
id: 'affiliate_invite_friends_activity',
|
|
10
|
+
context: {
|
|
11
|
+
activityNo: null,
|
|
12
|
+
bindingCode: null,
|
|
13
|
+
uidSite: null,
|
|
14
|
+
receiveNo: null,
|
|
15
|
+
affiliateCode: '',
|
|
16
|
+
commission: 0,
|
|
17
|
+
downLine: 0,
|
|
18
|
+
activeDownLine: 0,
|
|
19
|
+
levelTable: [],
|
|
20
|
+
pastTable: [],
|
|
21
|
+
levelDownLine: {},
|
|
22
|
+
currentLevel: 1,
|
|
23
|
+
page: 1
|
|
24
|
+
},
|
|
25
|
+
initial: 'fetching1',
|
|
26
|
+
states: {
|
|
27
|
+
fetching1: {
|
|
28
|
+
invoke: {
|
|
29
|
+
src: 'fetchAffiliateCode',
|
|
30
|
+
onDone: {
|
|
31
|
+
target: 'fetching2',
|
|
32
|
+
actions: 'setAffiliateCode',
|
|
33
|
+
},
|
|
34
|
+
onError: {
|
|
35
|
+
target: 'fetching2',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
fetching2: {
|
|
40
|
+
invoke: {
|
|
41
|
+
src: 'fetchAffiliateData',
|
|
42
|
+
onDone: {
|
|
43
|
+
target: 'idle',
|
|
44
|
+
actions: 'setInitialData',
|
|
45
|
+
},
|
|
46
|
+
onError: {
|
|
47
|
+
target: 'fail',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
idle: {
|
|
52
|
+
on: {
|
|
53
|
+
BIND_AFFILIATE_CODE: {
|
|
54
|
+
target: 'binding',
|
|
55
|
+
actions: ['setBindingCode', 'setUidSite', 'setActivityNo'],
|
|
56
|
+
},
|
|
57
|
+
SELECT_LEVEL: {
|
|
58
|
+
target: 'fetchingList',
|
|
59
|
+
actions: 'setLevelSearch'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
binding: {
|
|
64
|
+
invoke: {
|
|
65
|
+
src: 'postAffiliate',
|
|
66
|
+
onDone: {
|
|
67
|
+
target: 'awarding',
|
|
68
|
+
},
|
|
69
|
+
onError: {
|
|
70
|
+
target: 'fail',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
awarding: {
|
|
75
|
+
invoke: {
|
|
76
|
+
src: 'awardPrize',
|
|
77
|
+
onDone: {
|
|
78
|
+
target: 'bound',
|
|
79
|
+
},
|
|
80
|
+
onError: {
|
|
81
|
+
target: 'fail',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
bound: {
|
|
86
|
+
after: {
|
|
87
|
+
0: {
|
|
88
|
+
target: 'idle',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
fetchingList: {
|
|
93
|
+
invoke: {
|
|
94
|
+
src: 'fetchLevelDownLineList',
|
|
95
|
+
onDone: {
|
|
96
|
+
target: 'idle',
|
|
97
|
+
actions: 'setLevelDownLineList'
|
|
98
|
+
},
|
|
99
|
+
onError: {
|
|
100
|
+
target: 'idle',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
fail: {},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
actions: {
|
|
109
|
+
setAffiliateCode: assign((context, event) => {
|
|
110
|
+
const { affiliateCode = '' } = event.data || {}
|
|
111
|
+
return {
|
|
112
|
+
affiliateCode
|
|
113
|
+
}
|
|
114
|
+
}),
|
|
115
|
+
setInitialData: assign((context, event) => {
|
|
116
|
+
const { commission = 0, downLine = 0, activeDownLine = 0 } = event.data[1] || {}
|
|
117
|
+
const { levelTable = [], pastTable = [] } = event.data[2] || {}
|
|
118
|
+
return {
|
|
119
|
+
commission,
|
|
120
|
+
downLine,
|
|
121
|
+
activeDownLine,
|
|
122
|
+
levelTable,
|
|
123
|
+
pastTable
|
|
124
|
+
}
|
|
125
|
+
}),
|
|
126
|
+
setBindingCode: assign((context, event) => {
|
|
127
|
+
return {
|
|
128
|
+
bindingCode: event.data.bindingCode,
|
|
129
|
+
}
|
|
130
|
+
}),
|
|
131
|
+
setActivityNo: assign((context, event) => {
|
|
132
|
+
return {
|
|
133
|
+
activityNo: event.data.activityNo,
|
|
134
|
+
}
|
|
135
|
+
}),
|
|
136
|
+
setUidSite: assign((context, event) => {
|
|
137
|
+
return {
|
|
138
|
+
uidSite: event.data.uidSite,
|
|
139
|
+
}
|
|
140
|
+
}),
|
|
141
|
+
setLevelSearch: assign((context, event) => {
|
|
142
|
+
const { level, page } = event.data
|
|
143
|
+
console.log('Module:', level, page)
|
|
144
|
+
return {
|
|
145
|
+
currentLevel: level,
|
|
146
|
+
page
|
|
147
|
+
}
|
|
148
|
+
}),
|
|
149
|
+
setLevelDownLineList: assign((context, event) => {
|
|
150
|
+
return {
|
|
151
|
+
levelDownLine: event.data
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
},
|
|
155
|
+
services: {
|
|
156
|
+
fetchAffiliateCode: async () => {
|
|
157
|
+
return await request.send(user.getAffiliate())
|
|
158
|
+
},
|
|
159
|
+
fetchAffiliateData: async (context, event) => {
|
|
160
|
+
const affiliateHomeAPI = request.send(user.getAffiliateHome())
|
|
161
|
+
const affiliateDashboard = request.send(user.getAffiliateDashboard())
|
|
162
|
+
const [affiliateHomeData, affiliateDashboardData] = await Promise.all([affiliateHomeAPI, affiliateDashboard])
|
|
163
|
+
return [affiliateHomeData, affiliateDashboardData]
|
|
164
|
+
},
|
|
165
|
+
postAffiliate: async (context, event) => {
|
|
166
|
+
return await request.send(user.postAffiliate({ affiliateCode: context.bindingCode }))
|
|
167
|
+
},
|
|
168
|
+
awardPrize: async (context, event) => {
|
|
169
|
+
const { activityNo, uidSite, bindingCode } = context
|
|
170
|
+
const { data } = await request.send(api.sentAward({ activityNo, uidSite, affiliateCode: bindingCode, appSecret }))
|
|
171
|
+
return data
|
|
172
|
+
},
|
|
173
|
+
fetchLevelDownLineList: async (context, event) => {
|
|
174
|
+
const { currentLevel, page } = context
|
|
175
|
+
console.log('API:', currentLevel, page)
|
|
176
|
+
return await request.send(user.getAffiliateDashboardList({ level: currentLevel, page, row: 10 }))
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
}
|
|
@@ -4,6 +4,7 @@ import diamond_shop_activity_fc from './diamond_shop_activity_fc.js'
|
|
|
4
4
|
import diamond_shop_activity_vn from './diamond_shop_activity_vn.js'
|
|
5
5
|
import fafafa_activity from './fafafa_activity.js'
|
|
6
6
|
import invite_friends_activity from './invite_friends_activity.js'
|
|
7
|
+
import affiliate_invite_friends_activity from './affiliate_invite_friends_activity.js'
|
|
7
8
|
import ranking_activity from './ranking_activity.js'
|
|
8
9
|
import return_bonus_activity from './return_bonus_activity.js'
|
|
9
10
|
import specify_bets_activity from './specify_bets_activity.js'
|
|
@@ -20,6 +21,7 @@ export default {
|
|
|
20
21
|
diamond_shop_activity_vn,
|
|
21
22
|
fafafa_activity,
|
|
22
23
|
invite_friends_activity,
|
|
24
|
+
affiliate_invite_friends_activity,
|
|
23
25
|
ranking_activity,
|
|
24
26
|
return_bonus_activity,
|
|
25
27
|
specify_bets_activity,
|
|
@@ -111,9 +111,4 @@ export default function (request) {
|
|
|
111
111
|
},
|
|
112
112
|
}
|
|
113
113
|
)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// activityNo: "1627572510449"
|
|
117
|
-
// affiliateCode: "363022150296"
|
|
118
|
-
// appSecret: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NjM0MzI0NzZ9.ofBZV-ecs8C04MkXi0zGk6w2Ltpu_MCuOUpwPUfnz7o"
|
|
119
|
-
// uidSite: "fkkuez6qcck9qn83lu@FK"
|
|
114
|
+
}
|
package/src/machine/auth.js
CHANGED
|
@@ -35,6 +35,7 @@ export default function (request) {
|
|
|
35
35
|
userInfo: {},
|
|
36
36
|
redirectURL: null,
|
|
37
37
|
reCaptchaToken: null,
|
|
38
|
+
affiliate: null
|
|
38
39
|
},
|
|
39
40
|
states: {
|
|
40
41
|
idle: {
|
|
@@ -312,10 +313,11 @@ export default function (request) {
|
|
|
312
313
|
return { token }
|
|
313
314
|
}),
|
|
314
315
|
redirectTo3Party: async (context, event) => {
|
|
315
|
-
const { provider, channel, subchannel } = event.data
|
|
316
|
+
const { provider, channel, subchannel, affiliate } = event.data
|
|
316
317
|
|
|
317
318
|
const dt = await getDeviceToken({ fpToken, sentry, apiURL: request.config.apiURL })
|
|
318
319
|
sentry.setTag('dt', dt)
|
|
320
|
+
|
|
319
321
|
const messages = {
|
|
320
322
|
url: window.location.href,
|
|
321
323
|
list: [
|
|
@@ -336,8 +338,10 @@ export default function (request) {
|
|
|
336
338
|
subchannel: storage.get('subchannel') || subchannel || defaultSubchannel || 'pwa',
|
|
337
339
|
// dt,
|
|
338
340
|
platform: 'pwa',
|
|
341
|
+
affiliate
|
|
339
342
|
}).toString()
|
|
340
343
|
)
|
|
344
|
+
|
|
341
345
|
window.location.href = redirectURL
|
|
342
346
|
},
|
|
343
347
|
setUserInfo: assign((context, event) => {
|
package/src/machine/reward.js
CHANGED
|
@@ -10,7 +10,8 @@ export default function (request) {
|
|
|
10
10
|
context: {
|
|
11
11
|
otherRewardList: [],
|
|
12
12
|
pointsRewardList: [],
|
|
13
|
-
|
|
13
|
+
rewardList: [],
|
|
14
|
+
callback: () => { },
|
|
14
15
|
},
|
|
15
16
|
states: {
|
|
16
17
|
timer: {
|
|
@@ -89,11 +90,12 @@ export default function (request) {
|
|
|
89
90
|
return {
|
|
90
91
|
otherRewardList: event.data[0]?.data || [],
|
|
91
92
|
pointsRewardList: event.data[1]?.data || [],
|
|
93
|
+
rewardList: event.data[2]?.data || [],
|
|
92
94
|
}
|
|
93
95
|
}),
|
|
94
96
|
setCallback: assign((context, event) => {
|
|
95
97
|
return {
|
|
96
|
-
callback: event.data?.callback || (() => {}),
|
|
98
|
+
callback: event.data?.callback || (() => { }),
|
|
97
99
|
}
|
|
98
100
|
}),
|
|
99
101
|
doCallback: (context, event) => {
|
|
@@ -102,10 +104,11 @@ export default function (request) {
|
|
|
102
104
|
},
|
|
103
105
|
services: {
|
|
104
106
|
fetchRewardList: async (context, event) => {
|
|
107
|
+
const getRewardAPI = request.send(activity.getRewardList({ count: 30, appSecret }))
|
|
105
108
|
const getPointsRewardAPI = request.send(activity.getRewardList({ rewardType: 'POINTS', count: 30, appSecret }))
|
|
106
109
|
const getOtherRewardAPI = request.send(activity.getRewardList({ rewardType: 'CASH,FREE', count: 30, appSecret }))
|
|
107
|
-
const [otherRewardList, pointsRewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI])
|
|
108
|
-
return [otherRewardList, pointsRewardList]
|
|
110
|
+
const [otherRewardList, pointsRewardList, rewardList] = await Promise.all([getOtherRewardAPI, getPointsRewardAPI, getRewardAPI])
|
|
111
|
+
return [otherRewardList, pointsRewardList, rewardList]
|
|
109
112
|
},
|
|
110
113
|
receiveReward: async (context, event) => {
|
|
111
114
|
const { activityNo, receiveNo, attended } = event.data
|
|
@@ -15,6 +15,7 @@ export default function (request) {
|
|
|
15
15
|
channel: null,
|
|
16
16
|
subchannel: null,
|
|
17
17
|
signUpData: {},
|
|
18
|
+
affiliate: null,
|
|
18
19
|
reCaptchaToken: null,
|
|
19
20
|
registrationData: {
|
|
20
21
|
account: null,
|
|
@@ -29,11 +30,11 @@ export default function (request) {
|
|
|
29
30
|
on: {
|
|
30
31
|
SIGN_UP_PHONE: {
|
|
31
32
|
target: 'authentication',
|
|
32
|
-
actions: ['setReCaptchaToken', 'setSignUpPhone'],
|
|
33
|
+
actions: ['setReCaptchaToken', 'setAffiliate', 'setSignUpPhone'],
|
|
33
34
|
},
|
|
34
35
|
SIGN_UP_EMAIL: {
|
|
35
36
|
target: 'authentication',
|
|
36
|
-
actions: ['setReCaptchaToken', 'setSignUpEmail'],
|
|
37
|
+
actions: ['setReCaptchaToken', 'setAffiliate', 'setSignUpEmail'],
|
|
37
38
|
},
|
|
38
39
|
},
|
|
39
40
|
},
|
|
@@ -60,6 +61,12 @@ export default function (request) {
|
|
|
60
61
|
reCaptchaToken,
|
|
61
62
|
}
|
|
62
63
|
}),
|
|
64
|
+
setAffiliate: assign((context, event) => {
|
|
65
|
+
const { affiliate } = event.data
|
|
66
|
+
return {
|
|
67
|
+
affiliate,
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
63
70
|
setSignUpPhone: assign((context, event) => {
|
|
64
71
|
const { countryCode, phone, password, channel, subchannel } = event.data
|
|
65
72
|
return {
|
|
@@ -121,6 +128,7 @@ export default function (request) {
|
|
|
121
128
|
subchannel: storage.get('subchannel') || defaultSubchannel || subchannel,
|
|
122
129
|
dt,
|
|
123
130
|
reCaptchaToken: context.reCaptchaToken,
|
|
131
|
+
affiliate: context.affiliate
|
|
124
132
|
})
|
|
125
133
|
)
|
|
126
134
|
},
|