@jetthai/cuora 1.0.65 → 1.0.66-sabai-2
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/.husky/pre-commit +4 -0
- package/.prettierignore +1 -0
- package/CHANGELOG.md +642 -0
- package/README.md +6 -0
- package/dist/bundle.mjs +27623 -0
- package/package.json +13 -11
- package/rollup.config.js +12 -0
- package/src/api/activity.js +10 -3
- package/src/api/auth.js +47 -5
- package/src/api/game.js +64 -2
- package/src/api/index.js +9 -9
- package/src/api/payment.js +91 -7
- package/src/api/user.js +18 -0
- package/src/index.js +7 -5
- package/src/lib/fingerprint.js +5779 -0
- package/src/machine/activity/activity.js +97 -10
- package/src/machine/activity/affiliate_invite_friends_activity.js +216 -0
- package/src/machine/activity/continue_deposit_activity.js +1 -1
- package/src/machine/activity/deposit_activity.js +1 -1
- package/src/machine/activity/{diamond_shop_activity.js → diamond_shop_activity_fc.js} +33 -5
- package/src/machine/activity/{diamond_shop_activity_single_exchange.js → diamond_shop_activity_vn.js} +66 -21
- package/src/machine/activity/fafafa_activity.js +4 -2
- package/src/machine/activity/index.js +24 -10
- package/src/machine/activity/invite_friends_activity.js +3 -8
- package/src/machine/activity/mini_game_activity.js +68 -0
- package/src/machine/activity/ranking_activity.js +40 -46
- package/src/machine/activity/return_bonus_activity.js +5 -3
- package/src/machine/activity/roulette_activity_v2.js +81 -0
- package/src/machine/activity/sign_in_activity.js +149 -0
- package/src/machine/activity/specify_bets_activity.js +1 -1
- package/src/machine/activity/specify_turnover_activity.js +113 -0
- package/src/machine/activity/time_bomb_activity.js +80 -0
- package/src/machine/auth.js +234 -79
- package/src/machine/auth_otp_v2.js +177 -0
- package/src/machine/{auth_otp.js → auth_otp_v3.js} +80 -17
- package/src/machine/bank_binding.js +120 -0
- package/src/machine/bank_binding_amb.js +140 -0
- package/src/machine/bonus.js +75 -0
- package/src/machine/common.js +80 -17
- package/src/machine/deposit/amb.js +90 -0
- package/src/machine/deposit/crypto.js +267 -0
- package/src/machine/deposit/crypto_button.js +449 -0
- package/src/machine/{deposit.js → deposit/deposit_fc.js} +27 -15
- package/src/machine/deposit/direct.js +246 -0
- package/src/machine/deposit/float.js +295 -0
- package/src/machine/deposit/index.js +25 -0
- package/src/machine/deposit/loadcard_vn.js +390 -0
- package/src/machine/deposit/manual_vn.js +382 -0
- package/src/machine/deposit/qrcode_v2.js +451 -0
- package/src/machine/deposit/usdt.js +144 -0
- package/src/machine/deposit/vpay.js +292 -0
- package/src/machine/error.js +1 -1
- package/src/machine/game.js +17 -10
- package/src/machine/game_favorite.js +2 -2
- package/src/machine/game_favorite_v2.js +119 -0
- package/src/machine/game_hot_new.js +1 -1
- package/src/machine/game_search.js +3 -7
- package/src/machine/game_search_v2.js +379 -0
- package/src/machine/game_v2.js +381 -0
- package/src/machine/game_v2_1.js +442 -0
- package/src/machine/inbox.js +5 -6
- package/src/machine/index.js +58 -23
- package/src/machine/leaderboard.js +108 -0
- package/src/machine/merge.js +2 -2
- package/src/machine/payment_data.js +6 -5
- package/src/machine/promotions.js +170 -0
- package/src/machine/reward.js +84 -3
- package/src/machine/reward_fc.js +97 -0
- package/src/machine/roulette_v2.js +271 -0
- package/src/machine/setting.js +5 -2
- package/src/machine/side.js +34 -27
- package/src/machine/side_v2.js +200 -0
- package/src/machine/user_info.js +1 -1
- package/src/machine/user_reset_password.js +2 -2
- package/src/machine/user_sign_up.js +111 -56
- package/src/machine/vip_table.js +50 -0
- package/src/machine/welcome.js +6 -8
- package/src/machine/withdraw_amb.js +373 -0
- package/src/machine/withdraw_crypto.js +560 -0
- package/src/machine/withdraw_fc.js +251 -0
- package/src/machine/withdraw_vn.js +495 -0
- package/src/request/config.js +7 -1
- package/src/request/request.js +11 -15
- package/src/util/constant.js +2 -0
- package/src/util/deviceToken.js +33 -0
- package/src/util/index.js +6 -0
- package/src/util/storage.js +28 -0
- package/dist/index.js +0 -2
- package/dist/index.js.LICENSE.txt +0 -30
- package/src/machine/withdraw.js +0 -380
- package/src/request/cookie.js +0 -52
- package/webpack.config.js +0 -33
package/src/machine/setting.js
CHANGED
|
@@ -6,6 +6,8 @@ export default function () {
|
|
|
6
6
|
id: 'setting',
|
|
7
7
|
initial: 'idle',
|
|
8
8
|
context: {
|
|
9
|
+
musicPlay: true,
|
|
10
|
+
soundPlay: true,
|
|
9
11
|
sound: false,
|
|
10
12
|
music: false,
|
|
11
13
|
locale: 'en-US',
|
|
@@ -22,8 +24,9 @@ export default function () {
|
|
|
22
24
|
},
|
|
23
25
|
{
|
|
24
26
|
actions: {
|
|
25
|
-
fetchSetting: assign(() => {
|
|
26
|
-
const
|
|
27
|
+
fetchSetting: assign((context, event) => {
|
|
28
|
+
const { musicPlay, soundPlay } = context
|
|
29
|
+
const setting = JSON.parse(localStorage.getItem('setting')) || { sound: soundPlay, music: musicPlay }
|
|
27
30
|
return { ...setting }
|
|
28
31
|
}),
|
|
29
32
|
saveSetting: assign((context, event) => {
|
package/src/machine/side.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
|
-
import api from '../api/game'
|
|
2
|
+
import api from '../api/game.js'
|
|
3
3
|
|
|
4
4
|
export default function (request) {
|
|
5
5
|
return createMachine(
|
|
@@ -8,7 +8,7 @@ export default function (request) {
|
|
|
8
8
|
initial: 'preparing',
|
|
9
9
|
context: {
|
|
10
10
|
menu: {},
|
|
11
|
-
|
|
11
|
+
room: null,
|
|
12
12
|
roomHistory: [],
|
|
13
13
|
},
|
|
14
14
|
states: {
|
|
@@ -25,32 +25,31 @@ export default function (request) {
|
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
room: {
|
|
28
|
-
entry: 'resetRoomHistory',
|
|
29
28
|
initial: 'home',
|
|
30
29
|
states: {
|
|
31
30
|
home: {
|
|
32
|
-
entry:
|
|
31
|
+
entry: createSideAction('home'),
|
|
33
32
|
},
|
|
34
33
|
favorite: {
|
|
35
|
-
entry:
|
|
34
|
+
entry: createSideAction('favorite'),
|
|
36
35
|
},
|
|
37
36
|
hot: {
|
|
38
|
-
entry:
|
|
37
|
+
entry: createSideAction('hot'),
|
|
39
38
|
},
|
|
40
39
|
new: {
|
|
41
|
-
entry:
|
|
40
|
+
entry: createSideAction('new'),
|
|
42
41
|
},
|
|
43
42
|
slot: {
|
|
44
|
-
entry:
|
|
43
|
+
entry: createSideAction('slot'),
|
|
45
44
|
},
|
|
46
45
|
fish: {
|
|
47
|
-
entry:
|
|
46
|
+
entry: createSideAction('fish'),
|
|
48
47
|
},
|
|
49
48
|
arcade: {
|
|
50
|
-
entry:
|
|
49
|
+
entry: createSideAction('arcade'),
|
|
51
50
|
},
|
|
52
51
|
table: {
|
|
53
|
-
entry:
|
|
52
|
+
entry: createSideAction('table'),
|
|
54
53
|
},
|
|
55
54
|
search: {},
|
|
56
55
|
history: {
|
|
@@ -61,23 +60,23 @@ export default function (request) {
|
|
|
61
60
|
feature: {
|
|
62
61
|
on: {
|
|
63
62
|
RETURN: { target: 'room.history' },
|
|
64
|
-
CLICK_HOT: { target: 'room.hot' },
|
|
65
|
-
CLICK_NEW: { target: 'room.new' },
|
|
63
|
+
CLICK_HOT: { target: 'room.hot', actions: 'resetRoomHistory' },
|
|
64
|
+
CLICK_NEW: { target: 'room.new', actions: 'resetRoomHistory' },
|
|
66
65
|
},
|
|
67
66
|
},
|
|
68
67
|
category: {
|
|
69
68
|
on: {
|
|
70
69
|
RETURN: { target: 'room.history' },
|
|
71
|
-
CLICK_SLOT: { target: 'room.slot' },
|
|
72
|
-
CLICK_FISH: { target: 'room.fish' },
|
|
73
|
-
CLICK_ARCADE: { target: 'room.arcade' },
|
|
74
|
-
CLICK_TABLE: { target: 'room.table' },
|
|
70
|
+
CLICK_SLOT: { target: 'room.slot', actions: 'resetRoomHistory' },
|
|
71
|
+
CLICK_FISH: { target: 'room.fish', actions: 'resetRoomHistory' },
|
|
72
|
+
CLICK_ARCADE: { target: 'room.arcade', actions: 'resetRoomHistory' },
|
|
73
|
+
CLICK_TABLE: { target: 'room.table', actions: 'resetRoomHistory' },
|
|
75
74
|
},
|
|
76
75
|
},
|
|
77
76
|
},
|
|
78
77
|
on: {
|
|
79
|
-
CLICK_HOME: { target: 'room.home' },
|
|
80
|
-
CLICK_FAVORITE: { target: 'room.favorite' },
|
|
78
|
+
CLICK_HOME: { target: 'room.home', actions: 'resetRoomHistory' },
|
|
79
|
+
CLICK_FAVORITE: { target: 'room.favorite', actions: 'resetRoomHistory' },
|
|
81
80
|
CLICK_FEATURE: { target: 'feature' },
|
|
82
81
|
CLICK_CATEGORY: { target: 'category' },
|
|
83
82
|
CLICK_SEARCH: { target: 'room.search' },
|
|
@@ -104,30 +103,30 @@ export default function (request) {
|
|
|
104
103
|
if (Array.isArray(map[key])) {
|
|
105
104
|
// 若是陣列則依順序決定館別內容
|
|
106
105
|
map[key].some((val) => {
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
menu[key] =
|
|
106
|
+
const category = list.find((item) => item.category === val)
|
|
107
|
+
if (category) {
|
|
108
|
+
menu[key] = category
|
|
110
109
|
return true
|
|
111
110
|
} else {
|
|
112
111
|
return false
|
|
113
112
|
}
|
|
114
113
|
})
|
|
115
114
|
} else {
|
|
116
|
-
menu[key] = list.find((item) => item.category === map[key])
|
|
115
|
+
menu[key] = list.find((item) => item.category === map[key])
|
|
117
116
|
}
|
|
118
117
|
})
|
|
119
118
|
return { menu }
|
|
120
119
|
}),
|
|
121
120
|
forwardRoom: assign((context, event) => {
|
|
122
121
|
return {
|
|
123
|
-
|
|
124
|
-
roomHistory: [...context.roomHistory, context.
|
|
122
|
+
room: event.data,
|
|
123
|
+
roomHistory: [...context.roomHistory, context.room],
|
|
125
124
|
}
|
|
126
125
|
}),
|
|
127
126
|
backwardRoom: assign((context, event) => {
|
|
128
127
|
const { roomHistory } = context
|
|
129
128
|
return {
|
|
130
|
-
|
|
129
|
+
room: roomHistory.slice(-1)[0],
|
|
131
130
|
roomHistory: roomHistory.slice(0, -1),
|
|
132
131
|
}
|
|
133
132
|
}),
|
|
@@ -139,9 +138,17 @@ export default function (request) {
|
|
|
139
138
|
},
|
|
140
139
|
services: {
|
|
141
140
|
getRoomItems: async (context, event) => {
|
|
142
|
-
return await request.send(api.getGameCategory({ id: context.
|
|
141
|
+
return await request.send(api.getGameCategory({ id: context.room?.id }))
|
|
143
142
|
},
|
|
144
143
|
},
|
|
145
144
|
}
|
|
146
145
|
)
|
|
147
146
|
}
|
|
147
|
+
|
|
148
|
+
function createSideAction(name) {
|
|
149
|
+
return assign((context, event) => {
|
|
150
|
+
if (!context.roomHistory.some((item) => item.id === context.menu[name].id)) {
|
|
151
|
+
return { room: context.menu[name] }
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import game from '../api/game.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
return createMachine(
|
|
6
|
+
{
|
|
7
|
+
id: 'side',
|
|
8
|
+
initial: 'loading',
|
|
9
|
+
context: {
|
|
10
|
+
menu: null,
|
|
11
|
+
menuItemStack: [],
|
|
12
|
+
previousMenuItemStack: [],
|
|
13
|
+
historyStack: [],
|
|
14
|
+
defaultMenuItemStack: [],
|
|
15
|
+
},
|
|
16
|
+
states: {
|
|
17
|
+
loading: {
|
|
18
|
+
invoke: {
|
|
19
|
+
src: 'getMenu',
|
|
20
|
+
onDone: {
|
|
21
|
+
target: 'idle',
|
|
22
|
+
actions: ['setMenu', 'setDefaultMenuItemStack'],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
idle: {
|
|
27
|
+
initial: 'pending',
|
|
28
|
+
states: {
|
|
29
|
+
pending: {
|
|
30
|
+
after: {
|
|
31
|
+
20000: [
|
|
32
|
+
{
|
|
33
|
+
target: 'updating',
|
|
34
|
+
cond: 'isInMenu',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
target: 'pending',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
updating: {
|
|
43
|
+
invoke: {
|
|
44
|
+
src: 'fetchUpdateMenu',
|
|
45
|
+
onDone: {
|
|
46
|
+
target: 'pending',
|
|
47
|
+
actions: 'updateMenu',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
on: {
|
|
53
|
+
SELECT: {
|
|
54
|
+
actions: 'setMenuItemStack',
|
|
55
|
+
},
|
|
56
|
+
CANCEL: {
|
|
57
|
+
actions: 'restoreMenuItemStack',
|
|
58
|
+
},
|
|
59
|
+
PUSH: {
|
|
60
|
+
actions: 'pushHistoryStack',
|
|
61
|
+
},
|
|
62
|
+
POP: {
|
|
63
|
+
actions: 'popHistoryStack',
|
|
64
|
+
},
|
|
65
|
+
RESET: {
|
|
66
|
+
actions: 'resetMenuItemStack',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
actions: {
|
|
74
|
+
setMenu: assign((context, event) => {
|
|
75
|
+
const menu = event.data
|
|
76
|
+
addLevelProperty(menu.data, 0)
|
|
77
|
+
return { menu }
|
|
78
|
+
}),
|
|
79
|
+
setDefaultMenuItemStack: assign((context, event) => {
|
|
80
|
+
const menu = event.data
|
|
81
|
+
if (menu.data.length > 0) {
|
|
82
|
+
const menuItemStack = getDefaultItem(menu.data[0])
|
|
83
|
+
return { menuItemStack, defaultMenuItemStack: menuItemStack }
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
setMenuItemStack: assign((context, event) => {
|
|
87
|
+
const { menuItemStack } = context
|
|
88
|
+
const inputItem = event.data
|
|
89
|
+
const isTopItem = inputItem.level ? inputItem.level === 0 : true
|
|
90
|
+
const hasSubMenu = inputItem.sub?.length || 0
|
|
91
|
+
|
|
92
|
+
if (isTopItem) {
|
|
93
|
+
if (hasSubMenu) {
|
|
94
|
+
return {
|
|
95
|
+
previousMenuItemStack: menuItemStack,
|
|
96
|
+
menuItemStack: [event.data],
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
return {
|
|
100
|
+
previousMenuItemStack: [],
|
|
101
|
+
menuItemStack: [event.data],
|
|
102
|
+
historyStack: [],
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} else {
|
|
106
|
+
const slicedStack = menuItemStack.slice(0, inputItem.level)
|
|
107
|
+
return {
|
|
108
|
+
menuItemStack: [...slicedStack, event.data],
|
|
109
|
+
historyStack: [],
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}),
|
|
113
|
+
restoreMenuItemStack: assign((context, event) => {
|
|
114
|
+
const { previousMenuItemStack } = context
|
|
115
|
+
return {
|
|
116
|
+
previousMenuItemStack: [],
|
|
117
|
+
menuItemStack: previousMenuItemStack,
|
|
118
|
+
}
|
|
119
|
+
}),
|
|
120
|
+
updateMenu: assign((context, event) => {
|
|
121
|
+
const menu = event.data
|
|
122
|
+
if (menu.data.length) {
|
|
123
|
+
addLevelProperty(menu.data, 0)
|
|
124
|
+
return { menu, defaultMenuItemStack: getDefaultItem(menu.data[0]) }
|
|
125
|
+
}
|
|
126
|
+
}),
|
|
127
|
+
pushHistoryStack: assign((context, event) => {
|
|
128
|
+
const { menuItemStack, historyStack } = context
|
|
129
|
+
return {
|
|
130
|
+
historyStack: historyStack.concat(menuItemStack.slice(-1)),
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
popHistoryStack: assign((context, event) => {
|
|
134
|
+
const { historyStack } = context
|
|
135
|
+
return {
|
|
136
|
+
historyStack: historyStack.slice(0, -1),
|
|
137
|
+
}
|
|
138
|
+
}),
|
|
139
|
+
resetMenuItemStack: assign((context, event) => {
|
|
140
|
+
const { defaultMenuItemStack } = context
|
|
141
|
+
return { menuItemStack: defaultMenuItemStack }
|
|
142
|
+
}),
|
|
143
|
+
},
|
|
144
|
+
guards: {
|
|
145
|
+
isInMenu: (context, event) => {
|
|
146
|
+
const { menuItemStack, menu } = context
|
|
147
|
+
if (!menuItemStack || menuItemStack.length === 0) return false
|
|
148
|
+
const menuItem = menuItemStack.slice(-1)[0]
|
|
149
|
+
if (!menuItem || !menuItem.categoryId) return false
|
|
150
|
+
return isItemInMenu(menuItem, menu.data)
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
services: {
|
|
154
|
+
getMenu: async (context, event) => {
|
|
155
|
+
return await request.send(game.getListRoot())
|
|
156
|
+
},
|
|
157
|
+
fetchUpdateMenu: async (context, event) => {
|
|
158
|
+
return await request.send(game.getListRoot({ timestamp: context.menu.timestamp }))
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function isItemInMenu(targetItem, menuList) {
|
|
166
|
+
return menuList.reduce((result, currentItem) => {
|
|
167
|
+
if (result) {
|
|
168
|
+
return true
|
|
169
|
+
} else {
|
|
170
|
+
if (currentItem.categoryId === targetItem.categoryId) {
|
|
171
|
+
return true
|
|
172
|
+
} else if (currentItem.sub?.length) {
|
|
173
|
+
return isItemInMenu(targetItem, currentItem.sub)
|
|
174
|
+
} else {
|
|
175
|
+
return false
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, false)
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function getDefaultItem(node) {
|
|
182
|
+
if (node.sub.length > 0) {
|
|
183
|
+
const stack = getDefaultItem(node.sub[0])
|
|
184
|
+
return [node, ...stack]
|
|
185
|
+
} else {
|
|
186
|
+
return [node]
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function addLevelProperty(list, level) {
|
|
191
|
+
const nextLevel = level + 1
|
|
192
|
+
for (let i = 0; i < list.length; i++) {
|
|
193
|
+
list[i].level = level
|
|
194
|
+
|
|
195
|
+
// avoid games in list
|
|
196
|
+
if (!list[i].isGame) {
|
|
197
|
+
addLevelProperty(list[i].sub, nextLevel)
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
package/src/machine/user_info.js
CHANGED
|
@@ -1,91 +1,146 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import auth from '../api/auth'
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import auth from '../api/auth.js'
|
|
3
|
+
import { getDeviceToken } from '../util/deviceToken.js'
|
|
4
|
+
import storage from '../util/storage.js'
|
|
3
5
|
|
|
4
6
|
export default function (request) {
|
|
7
|
+
const { fpToken, sentry, defaultChannel, defaultSubchannel } = request.config
|
|
5
8
|
return createMachine(
|
|
6
9
|
{
|
|
7
10
|
id: 'user_sign_up',
|
|
8
11
|
initial: 'idle',
|
|
9
12
|
context: {
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
provider: null,
|
|
14
|
+
channel: null,
|
|
15
|
+
subchannel: null,
|
|
16
|
+
signUpData: {},
|
|
17
|
+
affiliate: null,
|
|
18
|
+
reCaptchaToken: null,
|
|
19
|
+
registrationData: {
|
|
20
|
+
account: null,
|
|
21
|
+
currency: null,
|
|
22
|
+
site: null,
|
|
23
|
+
strategy: null,
|
|
24
|
+
uid: null,
|
|
25
|
+
},
|
|
12
26
|
},
|
|
13
27
|
states: {
|
|
14
28
|
idle: {
|
|
15
29
|
on: {
|
|
16
|
-
|
|
17
|
-
target: '
|
|
18
|
-
actions: '
|
|
30
|
+
SIGN_UP_PHONE: {
|
|
31
|
+
target: 'authentication',
|
|
32
|
+
actions: ['setReCaptchaToken', 'setAffiliate', 'setSignUpPhone'],
|
|
19
33
|
},
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
on: {
|
|
24
|
-
SIGN_UP: {
|
|
25
|
-
target: 'validating',
|
|
26
|
-
actions: 'setForm',
|
|
34
|
+
SIGN_UP_EMAIL: {
|
|
35
|
+
target: 'authentication',
|
|
36
|
+
actions: ['setReCaptchaToken', 'setAffiliate', 'setSignUpEmail'],
|
|
27
37
|
},
|
|
28
38
|
},
|
|
29
39
|
},
|
|
30
|
-
|
|
31
|
-
on: {
|
|
32
|
-
SIGN_UP: {
|
|
33
|
-
target: 'validating',
|
|
34
|
-
actions: 'setForm',
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
validating: {
|
|
39
|
-
always: [
|
|
40
|
-
{
|
|
41
|
-
target: 'invalidFormat',
|
|
42
|
-
cond: 'isInvalidFormat',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
target: 'shortPassword',
|
|
46
|
-
cond: 'isLessThan6Characters',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
target: 'submitting',
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
submitting: {
|
|
40
|
+
authentication: {
|
|
54
41
|
invoke: {
|
|
55
|
-
src: '
|
|
42
|
+
src: 'authenticate',
|
|
56
43
|
onDone: {
|
|
57
|
-
target: '
|
|
44
|
+
target: 'authenticated',
|
|
45
|
+
actions: 'setRegistrationData',
|
|
58
46
|
},
|
|
59
47
|
onError: {
|
|
60
48
|
target: 'idle',
|
|
61
49
|
},
|
|
62
50
|
},
|
|
63
51
|
},
|
|
64
|
-
|
|
52
|
+
authenticated: {},
|
|
65
53
|
},
|
|
66
54
|
},
|
|
67
55
|
{
|
|
68
56
|
actions: {
|
|
69
|
-
|
|
70
|
-
const {
|
|
57
|
+
setReCaptchaToken: assign((context, event) => {
|
|
58
|
+
const { reCaptchaToken } = event.data
|
|
71
59
|
return {
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
reCaptchaToken,
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
setAffiliate: assign((context, event) => {
|
|
64
|
+
const { affiliate } = event.data
|
|
65
|
+
return {
|
|
66
|
+
affiliate,
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
setSignUpPhone: assign((context, event) => {
|
|
70
|
+
const { countryCode, phone, password, channel, subchannel } = event.data
|
|
71
|
+
return {
|
|
72
|
+
signUpData: {
|
|
73
|
+
provider: 'phone',
|
|
74
|
+
countryCode,
|
|
75
|
+
phone,
|
|
76
|
+
password,
|
|
77
|
+
},
|
|
78
|
+
channel,
|
|
79
|
+
subchannel,
|
|
80
|
+
}
|
|
81
|
+
}),
|
|
82
|
+
setSignUpEmail: assign((context, event) => {
|
|
83
|
+
const { email, password, channel, subchannel } = event.data
|
|
84
|
+
return {
|
|
85
|
+
signUpData: {
|
|
86
|
+
provider: 'email',
|
|
87
|
+
email,
|
|
88
|
+
password,
|
|
89
|
+
},
|
|
90
|
+
channel,
|
|
91
|
+
subchannel,
|
|
92
|
+
}
|
|
93
|
+
}),
|
|
94
|
+
setRegistrationData: assign((context, event) => {
|
|
95
|
+
const { account, currency, site, strategy, uid, channel, sub_channel } = event.data
|
|
96
|
+
return {
|
|
97
|
+
registrationData: {
|
|
98
|
+
account,
|
|
99
|
+
currency,
|
|
100
|
+
site,
|
|
101
|
+
strategy,
|
|
102
|
+
uid,
|
|
103
|
+
channel,
|
|
104
|
+
sub_channel,
|
|
105
|
+
},
|
|
74
106
|
}
|
|
75
107
|
}),
|
|
76
|
-
},
|
|
77
|
-
guards: {
|
|
78
|
-
isInvalidFormat: (context, event) => {
|
|
79
|
-
// return !context.email || /[+-]/.test(context.email)
|
|
80
|
-
},
|
|
81
|
-
isLessThan6Characters: (context, event) => {
|
|
82
|
-
// return context.password.length < 6
|
|
83
|
-
},
|
|
84
108
|
},
|
|
85
109
|
services: {
|
|
86
|
-
|
|
87
|
-
const {
|
|
88
|
-
|
|
110
|
+
authenticate: async (context, event) => {
|
|
111
|
+
const { channel, subchannel, signUpData } = context
|
|
112
|
+
const dt = await getDeviceToken({ fpToken, sentry, hosts: request.hosts })
|
|
113
|
+
sentry.setTag('dt', dt)
|
|
114
|
+
|
|
115
|
+
const referralCode = storage.get('referralCode')
|
|
116
|
+
const messages = {
|
|
117
|
+
url: window.location.href,
|
|
118
|
+
channelOrders: [
|
|
119
|
+
{ channel: storage.get('channel'), subchannel: storage.get('subchannel') },
|
|
120
|
+
{ channel: defaultChannel, subchannel: defaultSubchannel },
|
|
121
|
+
{ channel: channel, subchannel: subchannel },
|
|
122
|
+
],
|
|
123
|
+
referralCode,
|
|
124
|
+
}
|
|
125
|
+
sentry.captureMessage(JSON.stringify(messages))
|
|
126
|
+
|
|
127
|
+
const referralObj = {}
|
|
128
|
+
if (![undefined, 'undefined', null, 'null'].includes(referralCode)) {
|
|
129
|
+
referralObj.referralCode = referralCode
|
|
130
|
+
} else {
|
|
131
|
+
;(referralObj.channel = storage.get('channel') || defaultChannel || channel),
|
|
132
|
+
(referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return await request.send(
|
|
136
|
+
auth.register({
|
|
137
|
+
...signUpData,
|
|
138
|
+
...referralObj,
|
|
139
|
+
dt,
|
|
140
|
+
reCaptchaToken: context.reCaptchaToken,
|
|
141
|
+
affiliate: context.affiliate,
|
|
142
|
+
})
|
|
143
|
+
)
|
|
89
144
|
},
|
|
90
145
|
},
|
|
91
146
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import activity from '../api/activity.js'
|
|
3
|
+
export default function (request) {
|
|
4
|
+
return createMachine(
|
|
5
|
+
{
|
|
6
|
+
id: 'vip_table',
|
|
7
|
+
initial: 'fetching',
|
|
8
|
+
context: {
|
|
9
|
+
vipTable: [],
|
|
10
|
+
},
|
|
11
|
+
states: {
|
|
12
|
+
fetching: {
|
|
13
|
+
invoke: {
|
|
14
|
+
src: 'fetchVipTable',
|
|
15
|
+
onDone: {
|
|
16
|
+
target: 'completed',
|
|
17
|
+
actions: 'setVipTable',
|
|
18
|
+
},
|
|
19
|
+
onError: {
|
|
20
|
+
target: 'fail',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
completed: {},
|
|
25
|
+
fail: {},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
actions: {
|
|
30
|
+
setVipTable: assign((context, event) => {
|
|
31
|
+
const vipTable = event.data
|
|
32
|
+
|
|
33
|
+
return { vipTable }
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
services: {
|
|
37
|
+
fetchVipTable: async (context, event) => {
|
|
38
|
+
const { viptable = {} } = await request.send(activity.getVipTable())
|
|
39
|
+
const { data = [] } = viptable
|
|
40
|
+
data.map((item) => {
|
|
41
|
+
item.title = item.title.toLowerCase()
|
|
42
|
+
return item
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
return data
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
}
|
package/src/machine/welcome.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { assign, createMachine
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
const cookies = new Cookies()
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '../api/payment.js'
|
|
3
|
+
import user from '../api/user.js'
|
|
4
|
+
import storage from '../util/storage.js'
|
|
7
5
|
|
|
8
6
|
export default function (request) {
|
|
9
7
|
return createMachine(
|
|
@@ -71,7 +69,7 @@ export default function (request) {
|
|
|
71
69
|
const { bank_account, bank_setting_status, topup, verification_status, uid } = context.userInfo || {}
|
|
72
70
|
// const hasBankAccount = bank_account || bank_setting_status === 1 // sabai
|
|
73
71
|
const isComplete = topup === 1 || verification_status === 1
|
|
74
|
-
const isSent =
|
|
72
|
+
const isSent = storage.get(`welcome_${uid}`)
|
|
75
73
|
return !(isSent || isComplete)
|
|
76
74
|
},
|
|
77
75
|
isFilled: (context, event) => {
|
|
@@ -86,7 +84,7 @@ export default function (request) {
|
|
|
86
84
|
}
|
|
87
85
|
}),
|
|
88
86
|
setInfo: (context, event) => {
|
|
89
|
-
|
|
87
|
+
storage.set(`welcome_${context.userInfo.uid}`, 'done', {
|
|
90
88
|
path: '/',
|
|
91
89
|
maxAge: 60 * 60 * 24 * 365,
|
|
92
90
|
})
|