@jetthai/cuora 1.1.353-data-1 → 1.1.353-dev-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/CHANGELOG.md CHANGED
@@ -2,7 +2,11 @@
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-data-1](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.353-data-1) (2025-04-15)
5
+ ### [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)
6
+
7
+ ### [1.1.346-wallet-1](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.346-wallet-1) (2025-04-10)
8
+
9
+ ### [1.1.353-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.353-dev-1) (2025-04-11)
6
10
 
7
11
  ### [1.1.353](https://github.com/jetthai/cuora-module/compare/v1.1.352...v1.1.353) (2025-04-02)
8
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.353-data-1",
3
+ "version": "1.1.353-dev-2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -107,4 +107,9 @@ 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
+ }),
110
115
  }
package/src/api/index.js CHANGED
@@ -6,5 +6,6 @@ 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'
9
10
 
10
- export default { activity, auth, common, game, mailbox, payment, user, form }
11
+ export default { activity, auth, common, game, mailbox, payment, user, form, ranking }
@@ -0,0 +1,26 @@
1
+ export default {
2
+ // 未登入排名資料
3
+ getTournament: ({ activityNo }) => ({
4
+ url: 'tournament/detail',
5
+ method: 'get',
6
+ params: { activityNo },
7
+ isPublic: true,
8
+ }),
9
+ // 登入後排名預設期數資料
10
+ getRankingOptions: ({ activityNo }) => ({
11
+ url: 'ranking/detail/option',
12
+ method: 'get',
13
+ params: { activityNo },
14
+ }),
15
+ // 登入後排名資料
16
+ getRankingDetail: ({ activityNo, cycle, round }) => ({
17
+ url: 'ranking/detail',
18
+ method: 'post',
19
+ params: { activityNo, cycle, round },
20
+ }),
21
+ getRankingGames: ({ activityNo }) => ({
22
+ url: 'hot-game/ranking',
23
+ method: 'get',
24
+ params: { activityNo },
25
+ }),
26
+ }
@@ -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,12 +150,8 @@ export default function (request) {
152
150
  }
153
151
  }),
154
152
  resetActivities: assign((context, event) => {
155
- const { activityList = [], specifyActivities = [] } = context
156
- const keepActivities = activityList.filter((activity) => specifyActivities.includes(activity.activityType))
157
153
  return {
158
154
  isPlaying: true,
159
- activityList: keepActivities,
160
- promotionList: [],
161
155
  }
162
156
  }),
163
157
  leaveGame: assign((context, event) => {
@@ -188,8 +182,7 @@ export default function (request) {
188
182
  services: {
189
183
  fetchList: async (context, event) => {
190
184
  const hasToken = request.getToken()
191
- const isDoubleWallet = context.siteConfig?.walletMode === '4'
192
- const apiCallable = hasToken && isDoubleWallet
185
+ const apiCallable = hasToken
193
186
  const [{ data }, promotionList] = await Promise.all([
194
187
  hasToken ? request.send(activity.getActivityList({ appSecret })) : request.send(activity.getAllActivityList({ appSecret })),
195
188
  apiCallable && !context.isPlaying ? request.send(payment.getPromotionsList()) : [],
@@ -123,12 +123,8 @@ 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))
128
126
  return {
129
127
  isPlaying: true,
130
- activityList: keepActivities,
131
- promotionList: [],
132
128
  }
133
129
  }),
134
130
  leaveGame: assign((context, event) => {
@@ -11,17 +11,19 @@ export default function (request) {
11
11
  activityDetail: null,
12
12
  conditions: null,
13
13
  rebateType: null,
14
- currentReachLevel: null,
15
- nextReachLevel: null,
16
- lastPeriod: null,
14
+ nextCycleCardCurrentReachLevel: null,
15
+ nextCycleCardNextReachLevel: null,
16
+ lastCycleCard: null,
17
17
  nextDepositLimit: null,
18
18
  nextTurnoverLimit: null,
19
- currentTotalDeposit: null,
20
- currentTotalTurnover: null,
19
+ accumulateTotalDeposit: null,
20
+ accumulateTotalValidTurnover: null,
21
21
  retainAmount: '0',
22
- yesterdayReward: '0',
22
+ yesterdayRewardsAmount: '0',
23
23
  calculateWalletMode: '1',
24
24
  duration: 0,
25
+ isAccumulationPeriod: false, // 當前是否為累積期
26
+ isAwardPeriod: false, // 當前是否為領獎期
25
27
  },
26
28
  initial: 'idle',
27
29
  states: {
@@ -45,6 +47,17 @@ export default function (request) {
45
47
  },
46
48
  },
47
49
  },
50
+ sentAward: {
51
+ invoke: {
52
+ src: 'sentAward',
53
+ onDone: {
54
+ target: 'loading',
55
+ },
56
+ onError: {
57
+ target: 'loaded',
58
+ },
59
+ },
60
+ },
48
61
  loaded: {
49
62
  entry: 'setDuration',
50
63
  after: {
@@ -61,6 +74,9 @@ export default function (request) {
61
74
  STOP: {
62
75
  target: '.idle',
63
76
  },
77
+ SENT_AWARD: {
78
+ target: '.sentAward',
79
+ },
64
80
  },
65
81
  },
66
82
  {
@@ -79,50 +95,68 @@ export default function (request) {
79
95
  const {
80
96
  rebateType,
81
97
  conditions = [],
82
- currentReachLevel = {},
83
- nextReachLevel = {},
84
- lastPeriod = {},
85
- currentTotalDeposit = '0',
86
- currentTotalTurnover = '0',
98
+ nextCycleCardCurrentReachLevel = {},
99
+ nextCycleCardNextReachLevel = {},
100
+ lastCycleCard = {},
101
+ accumulateTotalDeposit = '0',
102
+ accumulateTotalValidTurnover = '0',
87
103
  retainAmount = '0',
88
- yesterdayReward = '0',
104
+ yesterdayRewardsAmount = '0',
89
105
  calculateWalletMode = '0',
106
+ accumulateStartTime,
107
+ accumulateEndTime,
108
+ lastCycleCardStartTime,
109
+ lastCycleCardEndTime,
90
110
  } = context.activityDetail || {}
91
111
 
92
112
  let nextDepositLimit = '0'
93
113
  let nextTurnoverLimit = '0'
94
114
  let currentTurnover = '0'
95
115
  let currentDeposit = '0'
116
+ const maxReachLevel = conditions?.[conditions?.length - 1]
96
117
  // 若已達到最高等級,所有數值皆以最高等級顯示
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
118
+ if (maxReachLevel && nextCycleCardCurrentReachLevel?.title === maxReachLevel.title) {
119
+ currentDeposit = maxReachLevel.depositLimit
120
+ currentTurnover = maxReachLevel.turnoverLimit
121
+ nextDepositLimit = maxReachLevel.depositLimit
122
+ nextTurnoverLimit = maxReachLevel.turnoverLimit
102
123
  } else {
103
- currentDeposit = currentTotalDeposit
104
- currentTurnover = currentTotalTurnover
105
- nextDepositLimit = nextReachLevel?.depositLimit
106
- nextTurnoverLimit = nextReachLevel?.turnoverLimit
124
+ currentDeposit = accumulateTotalDeposit
125
+ currentTurnover = accumulateTotalValidTurnover
126
+ nextDepositLimit = nextCycleCardNextReachLevel?.depositLimit
127
+ nextTurnoverLimit = nextCycleCardNextReachLevel?.turnoverLimit
107
128
  }
129
+ // 計算當前是否為累積期及領獎期
130
+ const currentTime = new Date().getTime() / 1000
131
+ const isAccumulationPeriod = currentTime >= accumulateStartTime && currentTime <= accumulateEndTime
132
+ const isAwardPeriod = currentTime >= lastCycleCardStartTime && currentTime <= lastCycleCardEndTime
108
133
 
109
134
  return {
110
135
  rebateType,
111
136
  conditions,
112
- currentReachLevel,
113
- nextReachLevel,
114
- lastPeriod,
137
+ nextCycleCardCurrentReachLevel,
138
+ nextCycleCardNextReachLevel,
139
+ lastCycleCard,
115
140
  nextDepositLimit,
116
141
  nextTurnoverLimit,
117
- currentTotalDeposit: currentDeposit,
118
- currentTotalTurnover: currentTurnover,
142
+ accumulateTotalDeposit: currentDeposit,
143
+ accumulateTotalValidTurnover: currentTurnover,
119
144
  retainAmount,
120
- yesterdayReward,
145
+ yesterdayRewardsAmount,
121
146
  calculateWalletMode,
147
+ isAccumulationPeriod,
148
+ isAwardPeriod,
122
149
  }
123
150
  }),
124
151
  setDuration: assign((context, event) => {
125
- const { currentEndTime } = context?.activityDetail
152
+ const { rewardPeriodSameAsAccumulationPeriod, accumulateEndTime, lastCycleCardEndTime } = context?.activityDetail
153
+ const { isAwardPeriod } = context
154
+ // 若為累積期,則倒數時間以累積期結束時間計算
155
+ let currentEndTime = accumulateEndTime
156
+ // 若為領獎期,則倒數時間以領獎期結束時間計算
157
+ if (!rewardPeriodSameAsAccumulationPeriod && isAwardPeriod) {
158
+ currentEndTime = lastCycleCardEndTime
159
+ }
126
160
  return {
127
161
  duration: Math.max(parseInt(currentEndTime) - new Date().getTime() / 1000, 0),
128
162
  }
@@ -134,6 +168,11 @@ export default function (request) {
134
168
  const { data } = await request.send(api.getActivityDetail({ activityNo, appSecret }))
135
169
  return data
136
170
  },
171
+ sentAward: async (context, event) => {
172
+ const { activityNo } = context
173
+ const { data } = await request.send(api.sentAward({ activityNo, appSecret }))
174
+ return data
175
+ },
137
176
  },
138
177
  }
139
178
  )
@@ -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
  },
@@ -293,8 +292,12 @@ export default function (request) {
293
292
  return { announcementList: { data } }
294
293
  }),
295
294
  setFeeds: assign((context, event) => {
296
- const { announcementList, broadcastList, mailBoxInfo } = event.data
295
+ const { announcementList, broadcastList, mailBoxInfo, siteConfig } = event.data
297
296
  const promotions = announcementList?.announcements?.filter?.((item) => item.category === 3) || []
297
+ const customerMessageEnable = siteConfig?.csChat?.some((item) => item.enable && item.name === 'customermessage')
298
+ if (!customerMessageEnable) {
299
+ mailBoxInfo.rows -= mailBoxInfo.detailRows?.CUSTOMER || 0
300
+ }
298
301
  return { broadcastList, mailBoxInfo, promotions }
299
302
  }),
300
303
  setBroadcast: assign((context, event) => {
@@ -58,7 +58,6 @@ export default function (request) {
58
58
  always: [
59
59
  {
60
60
  target: 'loaded',
61
- cond: 'isDoubleWalletMode',
62
61
  },
63
62
  {
64
63
  target: 'calculating',
@@ -91,7 +90,7 @@ export default function (request) {
91
90
  SUBMIT: [
92
91
  {
93
92
  target: 'pending',
94
- cond: (context, event) => context.siteConfig?.walletMode === '4' && !!context.calculation,
93
+ cond: (context, event) => !!context.calculation,
95
94
  },
96
95
  {
97
96
  target: 'submitting',
@@ -129,7 +128,7 @@ export default function (request) {
129
128
  SUBMIT: [
130
129
  {
131
130
  target: 'pending',
132
- cond: (context, event) => context.siteConfig?.walletMode === '4' && !!context.calculation,
131
+ cond: (context, event) => !!context.calculation,
133
132
  },
134
133
  {
135
134
  target: 'submitting',
@@ -247,9 +246,6 @@ export default function (request) {
247
246
  }),
248
247
  },
249
248
  guards: {
250
- isDoubleWalletMode: (context, event) => {
251
- return context.siteConfig?.walletMode === '4'
252
- },
253
249
  isCalculable: (context, event) => {
254
250
  const {
255
251
  amount,
@@ -72,8 +72,8 @@ export default function (request) {
72
72
  target: 'fetching',
73
73
  cond: (context, event) => {
74
74
  const { siteConfig = {}, promotion = {} } = context
75
- const { walletMode = '', bonusPreviewEnable } = siteConfig
76
- return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
75
+ const { bonusPreviewEnable } = siteConfig
76
+ return bonusPreviewEnable && promotion.activityNo != 'none'
77
77
  },
78
78
  },
79
79
  { target: 'loaded' },
@@ -49,8 +49,8 @@ export default function (request) {
49
49
  target: 'fetching',
50
50
  cond: (context, event) => {
51
51
  const { siteConfig = {}, promotion = {}, selectedCard } = context
52
- const { walletMode = '', bonusPreviewEnable } = siteConfig
53
- return !!selectedCard && walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
52
+ const { bonusPreviewEnable } = siteConfig
53
+ return !!selectedCard && bonusPreviewEnable && promotion.activityNo != 'none'
54
54
  },
55
55
  },
56
56
  { target: 'loaded' },
@@ -78,8 +78,8 @@ export default function (request) {
78
78
  actions: 'setCard',
79
79
  cond: (context, event) => {
80
80
  const { siteConfig = {}, promotion = {} } = context
81
- const { walletMode = '', bonusPreviewEnable } = siteConfig
82
- return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
81
+ const { bonusPreviewEnable } = siteConfig
82
+ return bonusPreviewEnable && promotion.activityNo != 'none'
83
83
  },
84
84
  },
85
85
  {
@@ -87,11 +87,6 @@ export default function (request) {
87
87
  },
88
88
  ],
89
89
  SELECT_AMOUNT: [
90
- {
91
- target: 'pending',
92
- actions: 'setAmount',
93
- cond: 'isFreeWalletMode',
94
- },
95
90
  {
96
91
  target: 'debouncing',
97
92
  actions: 'setAmount',
@@ -99,19 +94,6 @@ export default function (request) {
99
94
  ],
100
95
  },
101
96
  },
102
- pending: {
103
- on: {
104
- SELECT_AMOUNT: {
105
- actions: 'setAmount',
106
- },
107
- CONFIRM: {
108
- target: 'debouncing',
109
- },
110
- BACK: {
111
- target: 'loaded',
112
- },
113
- },
114
- },
115
97
  debouncing: {
116
98
  on: {
117
99
  SELECT_AMOUNT: {
@@ -132,19 +114,6 @@ export default function (request) {
132
114
  invoke: {
133
115
  src: 'fetchCalculation',
134
116
  onDone: [
135
- {
136
- target: 'submitting',
137
- actions: 'setCalculation',
138
- cond: (context, event) => {
139
- const { siteConfig = {}, selectedCard = {} } = context
140
- return siteConfig.walletMode === '2' && selectedCard.jumpLinkEnable === 1
141
- },
142
- },
143
- {
144
- target: 'cardInfo',
145
- actions: 'setCalculation',
146
- cond: 'isFreeWalletMode',
147
- },
148
117
  {
149
118
  target: 'calculated',
150
119
  actions: 'setCalculation',
@@ -158,17 +127,10 @@ export default function (request) {
158
127
  calculable: {
159
128
  entry: 'clearCalculation',
160
129
  on: {
161
- SELECT_AMOUNT: [
162
- {
163
- target: 'pending',
164
- actions: 'setAmount',
165
- cond: 'isFreeWalletMode',
166
- },
167
- {
168
- target: 'debouncing',
169
- actions: 'setAmount',
170
- },
171
- ],
130
+ SELECT_AMOUNT: {
131
+ target: 'debouncing',
132
+ actions: 'setAmount',
133
+ },
172
134
  BACK: {
173
135
  target: 'loaded',
174
136
  },
@@ -216,8 +178,8 @@ export default function (request) {
216
178
  actions: 'setCard',
217
179
  cond: (context, event) => {
218
180
  const { siteConfig = {}, promotion = {} } = context
219
- const { walletMode = '', bonusPreviewEnable } = siteConfig
220
- return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
181
+ const { bonusPreviewEnable } = siteConfig
182
+ return bonusPreviewEnable && promotion.activityNo != 'none'
221
183
  },
222
184
  },
223
185
  {
@@ -325,9 +287,6 @@ export default function (request) {
325
287
  }),
326
288
  },
327
289
  guards: {
328
- isFreeWalletMode: (context, event) => {
329
- return context.siteConfig?.walletMode === '2'
330
- },
331
290
  isSubmittable: (context, event) => {
332
291
  const { cardNumber, serialNumber } = context
333
292
  return cardNumber && serialNumber
@@ -75,24 +75,8 @@ export default function (request) {
75
75
  },
76
76
  },
77
77
  step1: {
78
- initial: 'promotion',
78
+ initial: 'idle',
79
79
  states: {
80
- promotion: {
81
- always: [
82
- {
83
- target: 'idle',
84
- cond: 'isDoubleWalletMode',
85
- },
86
- {
87
- target: 'calculating',
88
- actions: 'setPromotionDefaultAmount',
89
- cond: 'hasMinPromotionDeposit',
90
- },
91
- {
92
- target: 'idle',
93
- },
94
- ],
95
- },
96
80
  idle: {},
97
81
  calculating: {
98
82
  invoke: {
@@ -137,11 +121,10 @@ export default function (request) {
137
121
  {
138
122
  target: 'pending',
139
123
  cond: (context, event) => {
140
- const { siteConfig = {}, calculation, promotion } = context
141
- const { walletMode } = siteConfig
124
+ const { calculation, promotion } = context
142
125
  const { promotionsNo, activityNo } = promotion
143
126
  const isNoBonus = promotionsNo === 'none' || activityNo === 'none'
144
- return walletMode === '4' && !!calculation && !isNoBonus
127
+ return !!calculation && !isNoBonus
145
128
  },
146
129
  },
147
130
  {
@@ -385,9 +368,6 @@ export default function (request) {
385
368
  }),
386
369
  },
387
370
  guards: {
388
- isDoubleWalletMode: (context, event) => {
389
- return context.siteConfig?.walletMode === '4'
390
- },
391
371
  isCalculable: (context, event) => {
392
372
  const {
393
373
  amount,