@jetthai/cuora 1.1.353-dev-19 → 1.1.353-qa-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,108 +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.1.353-dev-19](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-18...v1.1.353-dev-19) (2025-04-25)
6
-
7
- ### [1.1.353-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-18...v1.1.353-dev-1) (2025-04-25)
8
-
9
- ### [1.1.353-dev-18](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-17...v1.1.353-dev-18) (2025-04-24)
10
-
11
- ### [1.1.353](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-17...v1.1.353) (2025-04-24)
12
-
13
- ### [1.1.353-dev-17](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-16...v1.1.353-dev-17) (2025-04-24)
14
-
15
- ### [1.1.353-dev-16](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-15...v1.1.353-dev-16) (2025-04-23)
16
-
17
- ### [1.1.353-dev-15](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-14...v1.1.353-dev-15) (2025-04-23)
18
-
19
- ### [1.1.353-dev-14](https://github.com/jetthai/cuora-module/compare/v1.1.355...v1.1.353-dev-14) (2025-04-23)
20
-
21
- ### [1.1.353-dev-13](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-12...v1.1.353-dev-13) (2025-04-21)
22
-
23
- ### [1.1.353-dev-12](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-11...v1.1.353-dev-12) (2025-04-20)
24
-
25
- ### [1.1.353-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-10...v1.1.353-dev-11) (2025-04-16)
26
-
27
- ### [1.1.353-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-9...v1.1.353-dev-10) (2025-04-16)
28
-
29
- ### [1.1.353-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.353-data-1...v1.1.353-dev-9) (2025-04-16)
30
-
31
- ### [1.1.353-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-7...v1.1.353-dev-8) (2025-04-15)
32
-
33
- ### [1.1.353-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.354...v1.1.353-dev-7) (2025-04-14)
34
-
35
- ### [1.1.353-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-5...v1.1.353-dev-6) (2025-04-14)
36
-
37
- ### [1.1.353-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-4...v1.1.353-dev-5) (2025-04-14)
38
-
39
- ### [1.1.353-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-3...v1.1.353-dev-4) (2025-04-14)
40
-
41
- ### [1.1.353-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-2...v1.1.353-dev-3) (2025-04-11)
42
-
43
- ### [1.1.353-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-1...v1.1.353-dev-2) (2025-04-11)
44
-
45
- ### [1.1.353-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.346-wallet-1...v1.1.353-dev-1) (2025-04-11)
5
+ ### [1.1.353-qa-1](https://github.com/jetthai/cuora-module/compare/v1.1.346-wallet-1...v1.1.353-qa-1) (2025-04-14)
46
6
 
47
7
  ### [1.1.346-wallet-1](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.346-wallet-1) (2025-04-10)
48
8
 
49
- ### [1.1.353-dev-13](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-12...v1.1.353-dev-13) (2025-04-21)
50
-
51
- ### [1.1.354](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-6...v1.1.354) (2025-04-14)
52
-
53
- ### [1.1.354](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-6...v1.1.354) (2025-04-14)
54
-
55
- ### [1.1.353-dev-12](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-11...v1.1.353-dev-12) (2025-04-20)
56
-
57
- ### [1.1.353-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-10...v1.1.353-dev-11) (2025-04-16)
58
-
59
- ### [1.1.353-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-9...v1.1.353-dev-10) (2025-04-16)
60
-
61
- ### [1.1.353-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.353-data-1...v1.1.353-dev-9) (2025-04-16)
62
-
63
- ### [1.1.353-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-7...v1.1.353-dev-8) (2025-04-15)
64
-
65
- ### [1.1.353-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-6...v1.1.353-dev-7) (2025-04-14)
66
-
67
- ### [1.1.353-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-5...v1.1.353-dev-6) (2025-04-14)
68
-
69
- ### [1.1.353-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-4...v1.1.353-dev-5) (2025-04-14)
70
-
71
- ### [1.1.353-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-3...v1.1.353-dev-4) (2025-04-14)
72
-
73
- ### [1.1.353-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-2...v1.1.353-dev-3) (2025-04-11)
74
-
75
- ### [1.1.353-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-1...v1.1.353-dev-2) (2025-04-11)
76
-
77
- ### [1.1.353-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.346-wallet-1...v1.1.353-dev-1) (2025-04-11)
78
-
79
- ### [1.1.346-wallet-1](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.346-wallet-1) (2025-04-10)
80
-
81
- ### [1.1.353-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-7...v1.1.353-dev-8) (2025-04-15)
82
-
83
- ### [1.1.353-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-6...v1.1.353-dev-7) (2025-04-14)
84
-
85
- ### [1.1.353-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-5...v1.1.353-dev-6) (2025-04-14)
86
-
87
- ### [1.1.353-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-5...v1.1.353-dev-6) (2025-04-14)
88
-
89
- ### [1.1.353-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-4...v1.1.353-dev-5) (2025-04-14)
90
-
91
- ### [1.1.353-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-3...v1.1.353-dev-4) (2025-04-14)
92
-
93
- ### [1.1.353-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-2...v1.1.353-dev-3) (2025-04-11)
94
-
95
- ### [1.1.353-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.353-dev-1...v1.1.353-dev-2) (2025-04-11)
96
-
97
- ### [1.1.346-wallet-1](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.346-wallet-1) (2025-04-10)
98
-
99
- ### [1.1.353-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.353-dev-1) (2025-04-11)
100
-
101
- ### [1.1.355](https://github.com/jetthai/cuora-module/compare/v1.1.353-data-1...v1.1.355) (2025-04-22)
102
-
103
- ### [1.1.354](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.354) (2025-04-14)
104
-
105
- ### [1.1.354](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.354) (2025-04-14)
106
-
107
9
  ### [1.1.353](https://github.com/jetthai/cuora-module/compare/v1.1.352...v1.1.353) (2025-04-02)
108
10
 
109
11
  ### [1.1.352](https://github.com/jetthai/cuora-module/compare/v1.1.351...v1.1.352) (2025-04-02)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.353-dev-19",
3
+ "version": "1.1.353-qa-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -107,9 +107,4 @@ export default {
107
107
  method: 'post',
108
108
  params: { startDate, endDate, appSecret },
109
109
  }),
110
- loseRebateHistory: ({ startDate, endDate, appSecret }) => ({
111
- url: 'activities/lose-rebate/history',
112
- method: 'post',
113
- params: { startDate, endDate, appSecret },
114
- }),
115
110
  }
package/src/api/game.js CHANGED
@@ -4,7 +4,6 @@ export default {
4
4
  removeFavoriteGame: (code) => ({ method: 'post', url: 'game/myfavorite/remove', params: { games: [code] } }),
5
5
  getStatements: () => ({ url: 'game/statements', method: 'get' }),
6
6
  playGame: (params) => ({ url: 'game/play', method: 'get', params }),
7
- demoGame: (params) => ({ url: 'game/demo', method: 'get', params, isPublic: true }),
8
7
  logoutGame: ({ uid_site, provider_id }) => ({ url: 'game/logout', method: 'get', params: { uid_site, provider_id } }),
9
8
 
10
9
  getGameTags: ({ q, lang }) => ({ url: 'game/search', method: 'get', params: { q, lang } }),
package/src/api/index.js CHANGED
@@ -6,6 +6,5 @@ import mailbox from './mailbox.js'
6
6
  import payment from './payment.js'
7
7
  import user from './user.js'
8
8
  import form from './form.js'
9
- import ranking from './ranking.js'
10
9
 
11
- export default { activity, auth, common, game, mailbox, payment, user, form, ranking }
10
+ export default { activity, auth, common, game, mailbox, payment, user, form }
@@ -77,6 +77,10 @@ export default function (request) {
77
77
  SET_UNREAD: {
78
78
  actions: 'setUnread',
79
79
  },
80
+ REFRESH: {
81
+ target: '#activity.fetchingList',
82
+ actions: 'leaveGame',
83
+ },
80
84
  RESET_ACTIVITIES: {
81
85
  actions: 'resetActivities',
82
86
  },
@@ -85,12 +89,6 @@ export default function (request) {
85
89
  },
86
90
  },
87
91
  },
88
- on: {
89
- REFRESH: {
90
- target: '#activity.fetchingList',
91
- actions: 'leaveGame',
92
- },
93
- },
94
92
  },
95
93
  {
96
94
  actions: {
@@ -152,8 +150,12 @@ export default function (request) {
152
150
  }
153
151
  }),
154
152
  resetActivities: assign((context, event) => {
153
+ const { activityList = [], specifyActivities = [] } = context
154
+ const keepActivities = activityList.filter((activity) => specifyActivities.includes(activity.activityType))
155
155
  return {
156
156
  isPlaying: true,
157
+ activityList: keepActivities,
158
+ promotionList: [],
157
159
  }
158
160
  }),
159
161
  leaveGame: assign((context, event) => {
@@ -123,8 +123,12 @@ export default function (request) {
123
123
  }
124
124
  }),
125
125
  resetActivities: assign((context, event) => {
126
+ const { activityList = [], detailNeededActivityTypes = [] } = context
127
+ const keepActivities = activityList.filter((activity) => detailNeededActivityTypes.includes(activity.activityType))
126
128
  return {
127
129
  isPlaying: true,
130
+ activityList: keepActivities,
131
+ promotionList: [],
128
132
  }
129
133
  }),
130
134
  leaveGame: assign((context, event) => {
@@ -11,19 +11,17 @@ export default function (request) {
11
11
  activityDetail: null,
12
12
  conditions: null,
13
13
  rebateType: null,
14
- nextCycleCardCurrentReachLevel: null,
15
- nextCycleCardNextReachLevel: null,
16
- lastCycleCard: null,
14
+ currentReachLevel: null,
15
+ nextReachLevel: null,
16
+ lastPeriod: null,
17
17
  nextDepositLimit: null,
18
18
  nextTurnoverLimit: null,
19
- accumulateTotalDeposit: null,
20
- accumulateTotalValidTurnover: null,
19
+ currentTotalDeposit: null,
20
+ currentTotalTurnover: null,
21
21
  retainAmount: '0',
22
- yesterdayRewardsAmount: '0',
22
+ yesterdayReward: '0',
23
23
  calculateWalletMode: '1',
24
24
  duration: 0,
25
- isAccumulationPeriod: false, // 當前是否為累積期
26
- isAwardPeriod: false, // 當前是否為領獎期
27
25
  },
28
26
  initial: 'idle',
29
27
  states: {
@@ -33,10 +31,6 @@ export default function (request) {
33
31
  target: 'loading',
34
32
  actions: 'setActivityNo',
35
33
  },
36
- SET_ACTIVITY: {
37
- target: 'loading',
38
- actions: 'setActivity',
39
- },
40
34
  },
41
35
  },
42
36
  loading: {
@@ -51,17 +45,6 @@ export default function (request) {
51
45
  },
52
46
  },
53
47
  },
54
- sentAward: {
55
- invoke: {
56
- src: 'sentAward',
57
- onDone: {
58
- target: 'loading',
59
- },
60
- onError: {
61
- target: 'loaded',
62
- },
63
- },
64
- },
65
48
  loaded: {
66
49
  entry: 'setDuration',
67
50
  after: {
@@ -78,9 +61,6 @@ export default function (request) {
78
61
  STOP: {
79
62
  target: '.idle',
80
63
  },
81
- SENT_AWARD: {
82
- target: '.sentAward',
83
- },
84
64
  },
85
65
  },
86
66
  {
@@ -91,80 +71,58 @@ export default function (request) {
91
71
  }
92
72
  }),
93
73
  setActivityDetail: assign((context, event) => {
94
- let activityDetail = event.data
95
- if (context.activityDetail && (!event.data || Object.keys(event.data).length === 0)) {
96
- activityDetail = context.activityDetail
97
- }
98
- return {
99
- activityDetail,
100
- }
101
- }),
102
- setActivity: assign((context, event) => {
103
74
  return {
104
- activityDetail: event.data.activityDetail,
105
- activityNo: event.data.activityNo,
75
+ activityDetail: event.data,
106
76
  }
107
77
  }),
108
78
  setInitData: assign((context, event) => {
109
79
  const {
110
80
  rebateType,
111
81
  conditions = [],
112
- nextCycleCardCurrentReachLevel = {},
113
- nextCycleCardNextReachLevel = {},
114
- lastCycleCard = {},
115
- accumulateTotalDeposit = '0',
116
- accumulateTotalValidTurnover = '0',
82
+ currentReachLevel = {},
83
+ nextReachLevel = {},
84
+ lastPeriod = {},
85
+ currentTotalDeposit = '0',
86
+ currentTotalTurnover = '0',
117
87
  retainAmount = '0',
118
- yesterdayRewardsAmount = '0',
88
+ yesterdayReward = '0',
119
89
  calculateWalletMode = '0',
120
- accumulateStartTime,
121
- accumulateEndTime,
122
- lastCycleCardStartTime,
123
- lastCycleCardEndTime,
124
90
  } = context.activityDetail || {}
125
91
 
126
92
  let nextDepositLimit = '0'
127
93
  let nextTurnoverLimit = '0'
128
- const maxReachLevel = conditions?.[conditions?.length - 1]
94
+ let currentTurnover = '0'
95
+ let currentDeposit = '0'
129
96
  // 若已達到最高等級,所有數值皆以最高等級顯示
130
- if (maxReachLevel && nextCycleCardCurrentReachLevel?.title === maxReachLevel.title) {
131
- nextDepositLimit = maxReachLevel.depositLimit
132
- nextTurnoverLimit = maxReachLevel.turnoverLimit
97
+ if (currentReachLevel?.title === conditions?.[conditions?.length - 1]?.title) {
98
+ currentDeposit = conditions[conditions.length - 1].depositLimit
99
+ currentTurnover = conditions[conditions.length - 1].turnoverLimit
100
+ nextDepositLimit = conditions[conditions.length - 1].depositLimit
101
+ nextTurnoverLimit = conditions[conditions.length - 1].turnoverLimit
133
102
  } else {
134
- nextDepositLimit = nextCycleCardNextReachLevel?.depositLimit
135
- nextTurnoverLimit = nextCycleCardNextReachLevel?.turnoverLimit
103
+ currentDeposit = currentTotalDeposit
104
+ currentTurnover = currentTotalTurnover
105
+ nextDepositLimit = nextReachLevel?.depositLimit
106
+ nextTurnoverLimit = nextReachLevel?.turnoverLimit
136
107
  }
137
- // 計算當前是否為累積期及領獎期
138
- const currentTime = new Date().getTime() / 1000
139
- const isAccumulationPeriod = currentTime >= accumulateStartTime && currentTime <= accumulateEndTime
140
- const isAwardPeriod = currentTime >= lastCycleCardStartTime && currentTime <= lastCycleCardEndTime
141
108
 
142
109
  return {
143
110
  rebateType,
144
111
  conditions,
145
- nextCycleCardCurrentReachLevel,
146
- nextCycleCardNextReachLevel,
147
- lastCycleCard,
112
+ currentReachLevel,
113
+ nextReachLevel,
114
+ lastPeriod,
148
115
  nextDepositLimit,
149
116
  nextTurnoverLimit,
150
- accumulateTotalDeposit,
151
- accumulateTotalValidTurnover,
117
+ currentTotalDeposit: currentDeposit,
118
+ currentTotalTurnover: currentTurnover,
152
119
  retainAmount,
153
- yesterdayRewardsAmount,
120
+ yesterdayReward,
154
121
  calculateWalletMode,
155
- isAccumulationPeriod,
156
- isAwardPeriod,
157
122
  }
158
123
  }),
159
124
  setDuration: assign((context, event) => {
160
- const { rewardPeriodSameAsAccumulationPeriod, accumulateEndTime, lastCycleCardEndTime } = context?.activityDetail
161
- const { isAwardPeriod } = context
162
- // 若為累積期,則倒數時間以累積期結束時間計算
163
- let currentEndTime = accumulateEndTime
164
- // 若為領獎期,則倒數時間以領獎期結束時間計算
165
- if (!rewardPeriodSameAsAccumulationPeriod && isAwardPeriod) {
166
- currentEndTime = lastCycleCardEndTime
167
- }
125
+ const { currentEndTime } = context?.activityDetail
168
126
  return {
169
127
  duration: Math.max(parseInt(currentEndTime) - new Date().getTime() / 1000, 0),
170
128
  }
@@ -176,11 +134,6 @@ export default function (request) {
176
134
  const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
177
135
  return data
178
136
  },
179
- sentAward: async (context, event) => {
180
- const { activityNo } = context
181
- const { data } = await request.send(api.sentAward({ activityNo, appSecret }))
182
- return data
183
- },
184
137
  },
185
138
  }
186
139
  )
@@ -113,7 +113,6 @@ export default function (request) {
113
113
  actions: 'resetByEnterGame',
114
114
  },
115
115
  LEAVE_GAME_REFRESH: {
116
- target: '.updating',
117
116
  actions: 'leaveGame',
118
117
  },
119
118
  },
@@ -294,12 +293,7 @@ export default function (request) {
294
293
  }),
295
294
  setFeeds: assign((context, event) => {
296
295
  const { announcementList, broadcastList, mailBoxInfo } = event.data
297
- const { siteConfig } = context
298
296
  const promotions = announcementList?.announcements?.filter?.((item) => item.category === 3) || []
299
- const customerMessageEnable = siteConfig?.csChat?.some((item) => item.enable && item.name === 'customermessage')
300
- if (!customerMessageEnable) {
301
- mailBoxInfo.rows -= mailBoxInfo.detailRows?.CUSTOMER || 0
302
- }
303
297
  return { broadcastList, mailBoxInfo, promotions }
304
298
  }),
305
299
  setBroadcast: assign((context, event) => {
@@ -179,7 +179,7 @@ export default function (request) {
179
179
  }),
180
180
  setMainTagList: assign((context, event) => {
181
181
  return {
182
- mainTagList: event.data.slice(0, 20),
182
+ mainTagList: event.data,
183
183
  }
184
184
  }),
185
185
  setInitialData: assign((context, event) => {
@@ -187,7 +187,7 @@ export default function (request) {
187
187
  actions: {
188
188
  setMainTagList: assign((context, event) => {
189
189
  return {
190
- mainTagList: event.data.slice(0, 20),
190
+ mainTagList: event.data,
191
191
  }
192
192
  }),
193
193
  setInitialData: assign((context, event) => {
@@ -42,7 +42,6 @@ export default function (request) {
42
42
  },
43
43
  walletType: null,
44
44
  lang: 'en_US',
45
- site: '',
46
45
  isMobile: new UAParser().getResult().device.type,
47
46
  gameURL: null,
48
47
  gameToken: null,
@@ -84,10 +83,6 @@ export default function (request) {
84
83
  target: 'connecting',
85
84
  actions: ['setGameInfo', 'setLang', 'setwalletType'],
86
85
  },
87
- DEMO_GAME: {
88
- target: 'demoGame',
89
- actions: ['setGameInfo', 'setLang', 'setSite'],
90
- },
91
86
  MENU_ENTER_GAME: {
92
87
  target: 'connecting',
93
88
  actions: ['setGameInfo', 'setLang'],
@@ -177,24 +172,6 @@ export default function (request) {
177
172
  },
178
173
  },
179
174
  },
180
- demoGame: {
181
- invoke: {
182
- src: 'demoGame',
183
- onDone: {
184
- target: 'playingDemo',
185
- actions: 'setGameURL',
186
- },
187
- onError: {
188
- target: 'idle',
189
- actions: 'setGameURL',
190
- },
191
- },
192
- on: {
193
- EXIT_GAME: {
194
- target: 'disconnect',
195
- },
196
- },
197
- },
198
175
  connectSwitching: {
199
176
  invoke: {
200
177
  src: 'disconnectGame',
@@ -228,16 +205,8 @@ export default function (request) {
228
205
  ENTER_GAME_PAUSE: {
229
206
  actions: ['setIsPlaying', 'resetContent', 'resetSHA'],
230
207
  },
231
- },
232
- },
233
- playingDemo: {
234
- on: {
235
- EXIT_DEMO_GAME: {
236
- target: 'idle',
237
- },
238
- ENTER_GAME: {
239
- target: 'connecting',
240
- actions: ['setGameInfo', 'setLang', 'setwalletType'],
208
+ LEAVE_GAME_REFRESH: {
209
+ actions: 'setIsPlaying',
241
210
  },
242
211
  },
243
212
  },
@@ -274,6 +243,9 @@ export default function (request) {
274
243
  },
275
244
  },
276
245
  on: {
246
+ LEAVE_GAME_REFRESH: {
247
+ actions: 'setIsPlaying',
248
+ },
277
249
  LOAD: {
278
250
  target: 'routing',
279
251
  actions: 'setLoadable',
@@ -320,11 +292,6 @@ export default function (request) {
320
292
  },
321
293
  },
322
294
  },
323
- on: {
324
- LEAVE_GAME_REFRESH: {
325
- actions: 'setIsPlaying',
326
- },
327
- },
328
295
  },
329
296
  {
330
297
  actions: {
@@ -458,10 +425,6 @@ export default function (request) {
458
425
  const lang = event.data.locale.replace('-', '_')
459
426
  return { lang }
460
427
  }),
461
- setSite: assign((context, event) => {
462
- const site = event.data.site
463
- return { site }
464
- }),
465
428
  setPageLoadingDone: assign((context, event) => {
466
429
  return {
467
430
  pageLoading: true,
@@ -610,21 +573,6 @@ export default function (request) {
610
573
  const { type, redirect_url, gameToken, gameHtml, wallet_type } = await request.send(api.playGame(params))
611
574
  return { type, gameToken, gameHtml, gameURL: redirect_url, gameWalletType: wallet_type }
612
575
  },
613
- demoGame: async (context, event) => {
614
- const { lang, site, isMobile } = context
615
- const { providerId, gameId, gameTypeId, mappingId } = context.game
616
- const params = {
617
- site,
618
- provider_id: providerId,
619
- game_id: gameId,
620
- gametype_id: gameTypeId,
621
- mapping_id: mappingId,
622
- is_mobile: isMobile === 'mobile' ? 'y' : null,
623
- lang,
624
- }
625
- const { type, redirect_url, gameToken, gameHtml } = await request.send(api.demoGame(params))
626
- return { type, gameToken, gameHtml, gameURL: redirect_url }
627
- },
628
576
  disconnectGame: async (context, event) => {
629
577
  const uid_site = event.data
630
578
  const provider_id = context.game.providerId
@@ -39,7 +39,6 @@ import honor_board from './honor_board.js'
39
39
  import user_photo from './user_photo.js'
40
40
  import navbar from './navbar.js'
41
41
  import websocket from './websocket.js'
42
- import ranking from './ranking.js'
43
42
 
44
43
  export default {
45
44
  ...activity,
@@ -83,5 +82,4 @@ export default {
83
82
  navbar,
84
83
  ...withdraw,
85
84
  websocket,
86
- ranking,
87
85
  }
@@ -37,7 +37,7 @@ export default function (request) {
37
37
  },
38
38
  pending: {
39
39
  after: {
40
- 20000: [{ target: 'loading', cond: 'isNotInGame' }, { target: 'pending' }],
40
+ 20000: { target: 'loading', cond: 'isNotInGame' },
41
41
  },
42
42
  },
43
43
  },
@@ -16,6 +16,7 @@ export default function (request) {
16
16
  activityNo: null,
17
17
  receiveNo: null,
18
18
  withdrawRule: {},
19
+ isPlaying: false,
19
20
  callback: () => {},
20
21
  },
21
22
  states: {
@@ -46,7 +47,7 @@ export default function (request) {
46
47
  },
47
48
  pending: {
48
49
  after: {
49
- 20000: { target: 'loading' },
50
+ 20000: [{ target: 'loading', cond: 'isNotInGame' }, { target: 'pending' }],
50
51
  },
51
52
  },
52
53
  },
@@ -73,6 +74,9 @@ export default function (request) {
73
74
  target: 'allPointsReceiving',
74
75
  actions: 'setCallback',
75
76
  },
77
+ SET_IS_PLAYING: {
78
+ actions: 'setIsPlaying',
79
+ },
76
80
  },
77
81
  },
78
82
  fetching: {
@@ -143,6 +147,11 @@ export default function (request) {
143
147
  },
144
148
  },
145
149
  {
150
+ guards: {
151
+ isNotInGame: (context, event) => {
152
+ return !context.isPlaying
153
+ },
154
+ },
146
155
  actions: {
147
156
  setAuth: assign((context, event) => {
148
157
  return { auth: !!event.data }
@@ -174,6 +183,11 @@ export default function (request) {
174
183
  withdrawRule: event.data,
175
184
  }
176
185
  }),
186
+ setIsPlaying: assign((context, event) => {
187
+ return {
188
+ isPlaying: event.data,
189
+ }
190
+ }),
177
191
  },
178
192
  services: {
179
193
  fetchRewardList: async (context, event) => {
@@ -17,9 +17,6 @@ export default function () {
17
17
  idle: {},
18
18
  },
19
19
  on: {
20
- DEFAULT_SETTING: {
21
- actions: 'setSetting',
22
- },
23
20
  MODIFY_SETTING: {
24
21
  actions: 'saveSetting',
25
22
  },
@@ -32,10 +29,6 @@ export default function () {
32
29
  const setting = JSON.parse(localStorage.getItem('setting')) || { sound: soundPlay, music: musicPlay }
33
30
  return { ...setting }
34
31
  }),
35
- setSetting: assign((context, event) => {
36
- const { sound, music, locale } = event.data
37
- return { sound, music, locale }
38
- }),
39
32
  saveSetting: assign((context, event) => {
40
33
  const { sound, music, locale } = event.data
41
34
  localStorage.setItem('setting', JSON.stringify({ sound, music, locale }))
@@ -278,18 +278,6 @@ export default function (request) {
278
278
  callback({ type: 'PUSH_ANALYTICS', data })
279
279
  })
280
280
 
281
- // 監聽 activity-reward-info 事件
282
- clientSocket.on('activity-reward-info', (data) => {
283
- console.log('[socket][activity-reward-info]:', data)
284
- callback({ type: 'ACTIVITY_INFO', data })
285
- })
286
-
287
- // 監聽 message-notice-info 事件
288
- clientSocket.on('message-notice-info', (data) => {
289
- console.log('[socket][message-notice-info]:', data)
290
- callback({ type: 'ACTIVITY_INFO', data })
291
- })
292
-
293
281
  // 監聽 payment-info 事件
294
282
  clientSocket.on('payment-info', (data) => {
295
283
  console.log('[socket][payment-info]:', data)
@@ -1,27 +0,0 @@
1
- export default {
2
- // 未登入排名資料
3
- getTournament: ({ activityNo, cycle, round, site }) => ({
4
- url: 'tournament/detail',
5
- method: 'post',
6
- params: { activityNo, cycle, round, site },
7
- isPublic: true,
8
- }),
9
- // 登入後排名預設期數資料
10
- getRankingOptions: ({ activityNo }) => ({
11
- url: 'ranking/detail/option',
12
- method: 'get',
13
- params: { activityNo },
14
- isPublic: true,
15
- }),
16
- // 登入後排名資料
17
- getRankingDetail: ({ activityNo, cycle, round }) => ({
18
- url: 'ranking/detail',
19
- method: 'post',
20
- params: { activityNo, cycle, round },
21
- }),
22
- getRankingGames: ({ activityNo }) => ({
23
- url: 'hot-game/ranking',
24
- method: 'get',
25
- params: { activityNo },
26
- }),
27
- }
@@ -1,216 +0,0 @@
1
- import { createMachine, assign } from 'xstate'
2
- import ranking from '../api/ranking.js'
3
-
4
- export default function (request) {
5
- const cycleMapping = ['DAILY', 'WEEKLY', 'MONTHLY']
6
-
7
- function roundProcess(rounds) {
8
- const roundArrays = rounds.map((round) => Array.from({ length: round }, (_, i) => i + 1))
9
- return roundArrays.reduce((acc, roundArray, index) => {
10
- acc[cycleMapping[index]] = roundArray.reverse()
11
- return acc
12
- }, {})
13
- }
14
-
15
- function transGameData(item) {
16
- if (!item) return {}
17
- item.providerId = item.provider
18
- return item
19
- }
20
-
21
- return createMachine(
22
- {
23
- id: 'ranking',
24
- initial: 'idle',
25
- context: {
26
- auth: false,
27
- site: '',
28
- activityNo: '',
29
- // api options 回傳的資料
30
- currentRound: [],
31
- cycle: '',
32
- round: 0,
33
- rule: '',
34
- // api detail 資料
35
- description: '',
36
- descriptionUrl: [],
37
- // api detail 排名資料
38
- playerRanking: {},
39
- gameRanking: [],
40
- topRanking: [],
41
- settleStatus: false,
42
- // 前端這邊用的選單資料 { cycle, round }
43
- options: {},
44
- },
45
- states: {
46
- idle: {
47
- on: {
48
- SET_ACTIVITY: {
49
- target: 'loading',
50
- },
51
- SET_OPTIONS: {
52
- target: 'setting',
53
- },
54
- },
55
- },
56
- loading: {
57
- entry: 'setActivity',
58
- always: [{ target: 'getRankingOptions' }],
59
- },
60
- setting: {
61
- entry: 'setOptions',
62
- always: [{ target: 'getRankingDetail', cond: 'hasAuth' }, { target: 'getTournament' }],
63
- },
64
- // 取得排名選單資料
65
- getRankingOptions: {
66
- invoke: {
67
- src: 'fetchRankingOptions',
68
- onDone: {
69
- target: 'decideNextAfterOptions',
70
- actions: 'setRankingOptions',
71
- },
72
- onError: {
73
- target: 'idle',
74
- },
75
- },
76
- },
77
- // 取得排名選單資料後的跳轉
78
- decideNextAfterOptions: {
79
- always: [
80
- // 有登入且為冠軍: 先拿遊戲排行榜再拿排行榜資料
81
- { target: 'getRankingGames', cond: 'canGetGameRanking' },
82
- // 有登入但不為冠軍活動: 直接拿排行榜資料
83
- { target: 'getRankingDetail', cond: 'hasAuth' },
84
- // 未登入; 拿未登入的排行榜資料
85
- { target: 'getTournament' },
86
- ],
87
- },
88
- // 未登入時取得排名資料
89
- getTournament: {
90
- invoke: {
91
- src: 'fetchTournament',
92
- onDone: {
93
- target: 'idle',
94
- actions: 'setRanking',
95
- },
96
- onError: {
97
- target: 'idle',
98
- },
99
- },
100
- },
101
- // 登入後取得排名資料
102
- getRankingDetail: {
103
- invoke: {
104
- src: 'fetchRankingDetail',
105
- onDone: {
106
- target: 'idle',
107
- actions: 'setRanking',
108
- },
109
- onError: {
110
- target: 'idle',
111
- },
112
- },
113
- },
114
- getRankingGames: {
115
- invoke: {
116
- src: 'fetchRankingGames',
117
- onDone: {
118
- target: 'getRankingDetail',
119
- actions: 'setRankingGames',
120
- },
121
- onError: {
122
- target: 'idle',
123
- },
124
- },
125
- },
126
- },
127
- },
128
- {
129
- actions: {
130
- setActivity: assign((context, event) => {
131
- return {
132
- site: event.data?.site,
133
- auth: !!request.getToken(),
134
- activityNo: event.data?.activityNo,
135
- }
136
- }),
137
- setRanking: assign((context, event) => {
138
- const topRanking = event.data?.topRanking?.map((rank) => transGameData(rank)) || []
139
- return {
140
- description: event.data?.description,
141
- descriptionUrl: event.data?.descriptionUrl,
142
- topRanking: topRanking,
143
- playerRanking: transGameData(event.data?.playerRanking) || {},
144
- settleStatus: !!topRanking[0]?.settleStatus,
145
- }
146
- }),
147
- setRankingGames: assign((context, event) => {
148
- const gameRanking = event.data?.map((rank) => transGameData(rank))
149
- return {
150
- gameRanking: gameRanking || [],
151
- }
152
- }),
153
- setRankingOptions: assign((context, event) => {
154
- const cycle = event.data?.cycle
155
- const currentRound = event.data?.currentRound || []
156
- // 取得結算週期選單列表
157
- const cycleOptions = cycleMapping.slice(0, currentRound.length)
158
- // 取得每週期的歷史期數選單列表
159
- const roundOptions = roundProcess(currentRound)
160
- // 如果是月結算,則加入全部選項
161
- if (cycle === 'MONTHLY') {
162
- cycleOptions.push('ALL')
163
- roundOptions.ALL = roundOptions.MONTHLY
164
- }
165
- return {
166
- ...event.data,
167
- options: { cycle: cycleOptions, round: roundOptions },
168
- // 初始固定顯示 DAILY
169
- cycle: event.data?.rule !== 'NORMAL' ? 'DAILY' : cycle,
170
- round: currentRound[0],
171
- }
172
- }),
173
- setOptions: assign((context, event) => {
174
- const { cycle, round } = context
175
- // 處理變更 cycle,如果沒有輸入或沒有變更就不更新
176
- if (event.data?.cycle && cycle !== event.data?.cycle) {
177
- const { currentRound } = context
178
- const cycleForRound = event.data?.cycle === 'ALL' ? 'MONTHLY' : event.data?.cycle
179
- const cycleIndex = cycleMapping.indexOf(cycleForRound)
180
- return { cycle: event.data?.cycle, round: currentRound[cycleIndex] }
181
- }
182
- if (event.data?.round && round !== event.data?.round) {
183
- return { round: event.data?.round }
184
- }
185
- return {}
186
- }),
187
- },
188
- guards: {
189
- hasAuth: (context) => context.auth,
190
- canGetGameRanking: (context) => context.auth && context.rule === 'CHAMPION',
191
- },
192
- services: {
193
- fetchTournament: async (context) => {
194
- const { activityNo, cycle, round, site } = context
195
- const { data } = await request.send(ranking.getTournament({ activityNo, cycle, round, site }))
196
- return data
197
- },
198
- fetchRankingOptions: async (context) => {
199
- const { activityNo } = context
200
- const { data } = await request.send(ranking.getRankingOptions({ activityNo }))
201
- return data
202
- },
203
- fetchRankingDetail: async (context, event) => {
204
- const { activityNo, cycle, round } = context
205
- const { data } = await request.send(ranking.getRankingDetail({ activityNo, cycle, round }))
206
- return data
207
- },
208
- fetchRankingGames: async (context) => {
209
- const { activityNo } = context
210
- const { data } = await request.send(ranking.getRankingGames({ activityNo }))
211
- return data
212
- },
213
- },
214
- }
215
- )
216
- }