@jetthai/cuora 1.1.356 → 1.1.358-apiv2-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,8 +2,18 @@
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.358-apiv2-1](https://github.com/jetthai/cuora-module/compare/v1.1.358...v1.1.358-apiv2-1) (2025-05-09)
6
+
7
+ ### [1.1.358](https://github.com/jetthai/cuora-module/compare/v1.1.357...v1.1.358) (2025-05-09)
8
+
9
+ ### [1.1.357](https://github.com/jetthai/cuora-module/compare/v1.1.356...v1.1.357) (2025-05-06)
10
+
5
11
  ### [1.1.356](https://github.com/jetthai/cuora-module/compare/v1.1.355...v1.1.356) (2025-04-29)
6
12
 
13
+ ### [1.1.355-apiv2-2](https://github.com/jetthai/cuora-module/compare/v1.1.355-apiv2-1...v1.1.355-apiv2-2) (2025-05-07)
14
+
15
+ ### [1.1.355-apiv2-1](https://github.com/jetthai/cuora-module/compare/v1.1.355...v1.1.355-apiv2-1) (2025-05-05)
16
+
7
17
  ### [1.1.355](https://github.com/jetthai/cuora-module/compare/v1.1.353-data-1...v1.1.355) (2025-04-22)
8
18
 
9
19
  ### [1.1.354](https://github.com/jetthai/cuora-module/compare/v1.1.353...v1.1.354) (2025-04-14)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.356",
3
+ "version": "1.1.358-apiv2-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
package/src/api/game.js CHANGED
@@ -4,6 +4,7 @@ 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 }),
7
8
  logoutGame: ({ uid_site, provider_id }) => ({ url: 'game/logout', method: 'get', params: { uid_site, provider_id } }),
8
9
 
9
10
  getGameTags: ({ q, lang }) => ({ url: 'game/search', method: 'get', params: { q, lang } }),
@@ -152,12 +152,8 @@ export default function (request) {
152
152
  }
153
153
  }),
154
154
  resetActivities: assign((context, event) => {
155
- const { activityList = [], specifyActivities = [] } = context
156
- const keepActivities = activityList.filter((activity) => specifyActivities.includes(activity.activityType))
157
155
  return {
158
156
  isPlaying: true,
159
- activityList: keepActivities,
160
- promotionList: [],
161
157
  }
162
158
  }),
163
159
  leaveGame: assign((context, event) => {
@@ -188,8 +184,7 @@ export default function (request) {
188
184
  services: {
189
185
  fetchList: async (context, event) => {
190
186
  const hasToken = request.getToken()
191
- const isDoubleWallet = context.siteConfig?.walletMode === '4'
192
- const apiCallable = hasToken && isDoubleWallet
187
+ const apiCallable = hasToken
193
188
  const [{ data }, promotionList] = await Promise.all([
194
189
  hasToken ? request.send(activity.getActivityList({ appSecret })) : request.send(activity.getAllActivityList({ appSecret })),
195
190
  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) => {
@@ -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,
@@ -49,16 +49,8 @@ export default function (request) {
49
49
  target: 'fetching',
50
50
  cond: (context, event) => {
51
51
  const { siteConfig = {}, promotion = {}, selectedQrcode } = context
52
- const { walletMode = '', bonusPreviewEnable } = siteConfig
53
- return !!selectedQrcode && walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
54
- },
55
- },
56
- {
57
- target: 'debouncing',
58
- actions: 'setPromotionDefaultAmount',
59
- cond: (context, event) => {
60
- const { siteConfig = {}, promotion = {} } = context
61
- return siteConfig.walletMode === '3' && !!promotion?.minimumAmount
52
+ const { bonusPreviewEnable } = siteConfig
53
+ return !!selectedQrcode && bonusPreviewEnable && promotion.activityNo != 'none'
62
54
  },
63
55
  },
64
56
  { target: 'loaded' },
@@ -86,51 +78,21 @@ export default function (request) {
86
78
  actions: 'setQrcode',
87
79
  cond: (context, event) => {
88
80
  const { siteConfig = {}, promotion = {} } = context
89
- const { walletMode = '', bonusPreviewEnable } = siteConfig
90
- return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
81
+ const { bonusPreviewEnable } = siteConfig
82
+ return bonusPreviewEnable && promotion.activityNo != 'none'
91
83
  },
92
84
  },
93
- {
94
- target: 'debouncing',
95
- actions: ['setQrcode', 'setPromotionDefaultAmount'],
96
- cond: (context, event) => context.siteConfig?.walletMode === '3' && context.promotion?.minimumAmount,
97
- },
98
85
  {
99
86
  actions: 'setQrcode',
100
87
  },
101
88
  ],
102
89
  SELECT_AMOUNT: [
103
- {
104
- target: 'debouncing',
105
- actions: 'setAmount',
106
- cond: 'isDoubleWalletMode',
107
- },
108
- {
109
- target: 'pending',
110
- actions: 'addAmount',
111
- cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
112
- },
113
- {
114
- target: 'pending',
115
- actions: 'setAmount',
116
- cond: 'isFreeWalletMode',
117
- },
118
- {
119
- target: 'debouncing',
120
- actions: 'addAmount',
121
- cond: 'isGrandTotalEnable',
122
- },
123
90
  {
124
91
  target: 'debouncing',
125
92
  actions: 'setAmount',
126
93
  },
127
94
  ],
128
95
  KEY_IN: [
129
- {
130
- target: 'pending',
131
- actions: 'setAmount',
132
- cond: 'isFreeWalletMode',
133
- },
134
96
  {
135
97
  target: 'calculating',
136
98
  actions: 'setAmount',
@@ -138,51 +100,9 @@ export default function (request) {
138
100
  ],
139
101
  },
140
102
  },
141
- pending: {
142
- on: {
143
- SELECT_AMOUNT: [
144
- {
145
- actions: 'addAmount',
146
- cond: 'isGrandTotalEnable',
147
- },
148
- {
149
- actions: 'setAmount',
150
- },
151
- ],
152
- KEY_IN: {
153
- actions: 'setAmount',
154
- },
155
- CONFIRM: {
156
- target: 'calculating',
157
- },
158
- BACK: {
159
- target: 'loaded',
160
- },
161
- },
162
- },
163
103
  debouncing: {
164
104
  on: {
165
105
  SELECT_AMOUNT: [
166
- {
167
- target: 'debouncing',
168
- actions: 'setAmount',
169
- cond: 'isDoubleWalletMode',
170
- },
171
- {
172
- target: 'debouncing',
173
- actions: 'addAmount',
174
- cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
175
- },
176
- {
177
- target: 'debouncing',
178
- actions: 'setAmount',
179
- cond: 'isFreeWalletMode',
180
- },
181
- {
182
- target: 'debouncing',
183
- actions: 'addAmount',
184
- cond: 'isGrandTotalEnable',
185
- },
186
106
  {
187
107
  target: 'debouncing',
188
108
  actions: 'setAmount',
@@ -202,26 +122,6 @@ export default function (request) {
202
122
  entry: 'clearCalculation',
203
123
  on: {
204
124
  SELECT_AMOUNT: [
205
- {
206
- target: 'debouncing',
207
- actions: 'setAmount',
208
- cond: 'isDoubleWalletMode',
209
- },
210
- {
211
- target: 'pending',
212
- actions: 'addAmount',
213
- cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
214
- },
215
- {
216
- target: 'pending',
217
- actions: 'setAmount',
218
- cond: 'isFreeWalletMode',
219
- },
220
- {
221
- target: 'debouncing',
222
- actions: 'addAmount',
223
- cond: 'isGrandTotalEnable',
224
- },
225
125
  {
226
126
  target: 'debouncing',
227
127
  actions: 'setAmount',
@@ -240,11 +140,6 @@ export default function (request) {
240
140
  invoke: {
241
141
  src: 'fetchCalculation',
242
142
  onDone: [
243
- {
244
- target: 'submitting',
245
- actions: 'setCalculation',
246
- cond: 'isFreeWalletMode',
247
- },
248
143
  {
249
144
  target: 'calculated',
250
145
  actions: 'setCalculation',
@@ -258,16 +153,6 @@ export default function (request) {
258
153
  calculated: {
259
154
  on: {
260
155
  SELECT_AMOUNT: [
261
- {
262
- target: 'pending',
263
- actions: 'addAmount',
264
- cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
265
- },
266
- {
267
- target: 'pending',
268
- actions: 'setAmount',
269
- cond: 'isFreeWalletMode',
270
- },
271
156
  {
272
157
  target: 'debouncing',
273
158
  actions: 'addAmount',
@@ -314,8 +199,8 @@ export default function (request) {
314
199
  actions: 'setQrcode',
315
200
  cond: (context, event) => {
316
201
  const { siteConfig = {}, promotion = {} } = context
317
- const { walletMode = '', bonusPreviewEnable } = siteConfig
318
- return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
202
+ const { bonusPreviewEnable } = siteConfig
203
+ return bonusPreviewEnable && promotion.activityNo != 'none'
319
204
  },
320
205
  },
321
206
  {
@@ -395,19 +280,8 @@ export default function (request) {
395
280
  promotion,
396
281
  }
397
282
  }),
398
- setPromotionDefaultAmount: assign((context, event) => {
399
- return {
400
- selectedAmount: context.promotion.minimumAmount,
401
- }
402
- }),
403
283
  },
404
284
  guards: {
405
- isDoubleWalletMode: (context, event) => {
406
- return context.siteConfig?.walletMode === '4'
407
- },
408
- isFreeWalletMode: (context, event) => {
409
- return context.siteConfig?.walletMode === '2'
410
- },
411
285
  isGrandTotalEnable: (context, event) => {
412
286
  return context.grandTotalEnable === 1
413
287
  },
@@ -45,24 +45,8 @@ export default function (request) {
45
45
  },
46
46
  },
47
47
  step1: {
48
- initial: 'promotion',
48
+ initial: 'idle',
49
49
  states: {
50
- promotion: {
51
- always: [
52
- {
53
- target: 'idle',
54
- cond: 'isDoubleWalletMode',
55
- },
56
- {
57
- target: 'calculating',
58
- actions: 'setPromotionDefaultAmount',
59
- cond: 'hasMinPromotionDeposit',
60
- },
61
- {
62
- target: 'idle',
63
- },
64
- ],
65
- },
66
50
  idle: {},
67
51
  calculating: {
68
52
  invoke: {
@@ -104,11 +88,10 @@ export default function (request) {
104
88
  {
105
89
  target: 'pending',
106
90
  cond: (context, event) => {
107
- const { siteConfig = {}, calculation, promotion } = context
108
- const { walletMode } = siteConfig
91
+ const { calculation, promotion } = context
109
92
  const { promotionsNo, activityNo } = promotion
110
93
  const isNoBonus = promotionsNo === 'none' || activityNo === 'none'
111
- return walletMode === '4' && !!calculation && !isNoBonus
94
+ return !!calculation && !isNoBonus
112
95
  },
113
96
  },
114
97
  {
@@ -231,16 +214,8 @@ export default function (request) {
231
214
  promotion: event.data,
232
215
  }
233
216
  }),
234
- setPromotionDefaultAmount: assign((context, event) => {
235
- return {
236
- amount: context.promotion.minimumAmount,
237
- }
238
- }),
239
217
  },
240
218
  guards: {
241
- isDoubleWalletMode: (context, event) => {
242
- return context.siteConfig?.walletMode === '4'
243
- },
244
219
  isCalculable: (context, event) => {
245
220
  const {
246
221
  amount,
@@ -254,9 +229,6 @@ export default function (request) {
254
229
  isProcessing: (context, event) => {
255
230
  return context.processing
256
231
  },
257
- hasMinPromotionDeposit: (context, event) => {
258
- return context.promotion?.minimumAmount
259
- },
260
232
  },
261
233
  services: {
262
234
  fetchPaymentDetail: async (context, event) => {
@@ -74,8 +74,8 @@ export default function (request) {
74
74
  target: 'fetching',
75
75
  cond: (context, event) => {
76
76
  const { siteConfig = {}, promotion = {} } = context
77
- const { walletMode = '', bonusPreviewEnable } = siteConfig
78
- return walletMode === '4' && bonusPreviewEnable && promotion.activityNo != 'none'
77
+ const { bonusPreviewEnable } = siteConfig
78
+ return bonusPreviewEnable && promotion.activityNo != 'none'
79
79
  },
80
80
  },
81
81
  { target: 'loaded' },
@@ -39,9 +39,11 @@ export default function (request) {
39
39
  portrait: null,
40
40
  gameCode: null,
41
41
  name: null,
42
+ isDemo: false,
42
43
  },
43
- walletMode: null,
44
+ walletType: null,
44
45
  lang: 'en_US',
46
+ site: '',
45
47
  isMobile: new UAParser().getResult().device.type,
46
48
  gameURL: null,
47
49
  gameToken: null,
@@ -81,7 +83,11 @@ export default function (request) {
81
83
  },
82
84
  ENTER_GAME: {
83
85
  target: 'connecting',
84
- actions: ['setGameInfo', 'setLang', 'setWalletMode'],
86
+ actions: ['setGameInfo', 'setLang', 'setwalletType'],
87
+ },
88
+ DEMO_GAME: {
89
+ target: 'demoGame',
90
+ actions: ['setGameInfo', 'setLang', 'setSite'],
85
91
  },
86
92
  MENU_ENTER_GAME: {
87
93
  target: 'connecting',
@@ -172,6 +178,24 @@ export default function (request) {
172
178
  },
173
179
  },
174
180
  },
181
+ demoGame: {
182
+ invoke: {
183
+ src: 'demoGame',
184
+ onDone: {
185
+ target: 'playingDemo',
186
+ actions: 'setGameURL',
187
+ },
188
+ onError: {
189
+ target: 'idle',
190
+ actions: 'setGameURL',
191
+ },
192
+ },
193
+ on: {
194
+ EXIT_GAME: {
195
+ target: 'disconnect',
196
+ },
197
+ },
198
+ },
175
199
  connectSwitching: {
176
200
  invoke: {
177
201
  src: 'disconnectGame',
@@ -207,6 +231,20 @@ export default function (request) {
207
231
  },
208
232
  },
209
233
  },
234
+ playingDemo: {
235
+ on: {
236
+ EXIT_GAME: {
237
+ target: 'disconnect',
238
+ },
239
+ EXIT_DEMO_GAME: {
240
+ target: 'idle',
241
+ },
242
+ ENTER_GAME: {
243
+ target: 'connecting',
244
+ actions: ['setGameInfo', 'setLang', 'setwalletType'],
245
+ },
246
+ },
247
+ },
210
248
  refreshing: {
211
249
  invoke: {
212
250
  src: 'disconnectGame',
@@ -417,13 +455,17 @@ export default function (request) {
417
455
  const { providerId, gameId, gameTypeId, mappingId, portrait, gameCode, name } = context.switchGame
418
456
  return { game: { providerId, gameId, gameTypeId, mappingId, portrait: portrait ? 1 : 0, gameCode, name } }
419
457
  }),
420
- setWalletMode: assign((context, event) => {
421
- return { walletMode: event.data.walletMode }
458
+ setwalletType: assign((context, event) => {
459
+ return { walletType: event.data.walletType }
422
460
  }),
423
461
  setLang: assign((context, event) => {
424
462
  const lang = event.data.locale.replace('-', '_')
425
463
  return { lang }
426
464
  }),
465
+ setSite: assign((context, event) => {
466
+ const site = event.data.site
467
+ return { site }
468
+ }),
427
469
  setPageLoadingDone: assign((context, event) => {
428
470
  return {
429
471
  pageLoading: true,
@@ -556,7 +598,7 @@ export default function (request) {
556
598
  },
557
599
  connectGame: async (context, event) => {
558
600
  const returnProviders = ['RSG', 'KP', 'EPICWIN', 'AMBSLOT', 'SEXY_VENUS', 'SEXY_SEXYBCRT', 'PG', 'NPG']
559
- const { lang, isMobile, walletMode } = context
601
+ const { lang, isMobile, walletType } = context
560
602
  const { providerId, gameId, gameTypeId, mappingId } = context.game
561
603
  const params = {
562
604
  provider_id: providerId,
@@ -566,12 +608,29 @@ export default function (request) {
566
608
  is_demo: false,
567
609
  is_mobile: isMobile === 'mobile' ? 'y' : null,
568
610
  lang,
569
- selected_wallet_type: walletMode,
611
+ selected_wallet_type: walletType,
570
612
  return_url: returnProviders.includes(providerId) ? `${window.location.origin}${context.base}return` : window.location.href, // For providers to return.
571
613
  }
572
614
  const { type, redirect_url, gameToken, gameHtml, wallet_type } = await request.send(api.playGame(params))
573
615
  return { type, gameToken, gameHtml, gameURL: redirect_url, gameWalletType: wallet_type }
574
616
  },
617
+ demoGame: async (context, event) => {
618
+ const { lang, site, isMobile, game } = context
619
+ const { providerId, gameId, gameTypeId, mappingId } = context.game
620
+ const params = {
621
+ site,
622
+ provider_id: providerId,
623
+ game_id: gameId,
624
+ gametype_id: gameTypeId,
625
+ mapping_id: mappingId,
626
+ is_mobile: isMobile === 'mobile' ? 'y' : null,
627
+ lang,
628
+ }
629
+ const { type, redirect_url, gameToken, gameHtml, is_demo } = await request.send(api.demoGame(params))
630
+ // 將 is_demo 設置到 context.game.isDemo
631
+ game.isDemo = is_demo
632
+ return { type, gameToken, gameHtml, gameURL: redirect_url, game }
633
+ },
575
634
  disconnectGame: async (context, event) => {
576
635
  const uid_site = event.data
577
636
  const provider_id = context.game.providerId
@@ -154,6 +154,9 @@ export default function (request) {
154
154
  LOAD_MESSAGES: {
155
155
  target: 'checking',
156
156
  },
157
+ RESET_MESSAGES: {
158
+ target: 'reloadMessages',
159
+ },
157
160
  },
158
161
  },
159
162
  inquiring: {
@@ -282,6 +285,7 @@ export default function (request) {
282
285
  }
283
286
  }),
284
287
  resetPage: assign((context, event) => {
288
+ console.log('updateMessage resetPage')
285
289
  const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
286
290
  inbox[currentTab].page = -1
287
291
  return {
@@ -7,7 +7,6 @@ export default function (request) {
7
7
  id: 'promotions',
8
8
  initial: 'loading',
9
9
  context: {
10
- noBonus: {},
11
10
  userInfo: {},
12
11
  siteConfig: {},
13
12
  withdrawRule: {},
@@ -87,10 +86,10 @@ export default function (request) {
87
86
  actions: {
88
87
  setPromotionsList: assign((context, event) => {
89
88
  const promotionsList = JSON.parse(JSON.stringify(event.data))
90
- const { noBonus, userInfo, siteConfig } = context
89
+ const { userInfo, siteConfig } = context
91
90
  const { withdraw_rule, balance, bank_amount } = userInfo
92
- const { currencyConversionLimit, walletMode } = siteConfig
93
- const balanceAvailable = parseFloat(`${walletMode === '4' ? bank_amount : balance}`) < parseFloat(`${currencyConversionLimit}`)
91
+ const { currencyConversionLimit } = siteConfig
92
+ const balanceAvailable = parseFloat(bank_amount) < parseFloat(`${currencyConversionLimit}`)
94
93
  const isFreeLimitRule = withdraw_rule.includes('FREE_LIMIT')
95
94
  const includesDefaultRule = withdraw_rule === 'DEFAULT' || withdraw_rule.includes('FREE_DEFAULT')
96
95
 
@@ -112,7 +111,7 @@ export default function (request) {
112
111
  }
113
112
  return {
114
113
  promotionsList,
115
- selectedPromo: siteConfig?.walletMode === '4' ? promotionsList[0] : noBonus,
114
+ selectedPromo: promotionsList[0],
116
115
  }
117
116
  }),
118
117
  setSelectedPromo: assign((context, event) => {
@@ -278,6 +278,18 @@ 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
+
281
293
  // 監聽 payment-info 事件
282
294
  clientSocket.on('payment-info', (data) => {
283
295
  console.log('[socket][payment-info]:', data)
@@ -147,7 +147,6 @@ export default function (request) {
147
147
  },
148
148
  SET_ATTACHMENT_TYPE: {
149
149
  actions: 'setAttachmentType',
150
- cond: 'isNewWalletMode',
151
150
  },
152
151
  POOL: {
153
152
  target: 'pooling',
@@ -323,7 +322,7 @@ export default function (request) {
323
322
  balance,
324
323
  siteConfig,
325
324
  userInfo,
326
- attachmentType: siteConfig.walletMode > 0 ? 'withdraw' : null,
325
+ attachmentType: 'withdraw',
327
326
  }
328
327
  }),
329
328
  updateWithdrawCondition: assign((context, event) => {
@@ -434,7 +433,6 @@ export default function (request) {
434
433
  isOtpRequired: (context, event) => {
435
434
  return event.data?.status === 'otp-verifying'
436
435
  },
437
- isNewWalletMode: (context, event) => context.siteConfig.walletMode > 0,
438
436
  },
439
437
  services: {
440
438
  fetchInitData: async (context, event) => {
@@ -355,7 +355,7 @@ export default function (request) {
355
355
  const methods = siteConfig?.paymentMethods?.withdraw || []
356
356
  return {
357
357
  methods,
358
- attachmentType: siteConfig.walletMode > 0 ? 'withdraw' : null,
358
+ attachmentType: 'withdraw',
359
359
  }
360
360
  }),
361
361
  setMode: assign((context, event) => {
@@ -397,9 +397,8 @@ export default function (request) {
397
397
  return { bindingPaymentList, bindingPaymentInfo, boundBanks: combinedData, currentBank: combinedData[0] }
398
398
  }),
399
399
  preset: assign((context, event) => {
400
- const { siteConfig } = context
401
400
  return {
402
- attachmentType: siteConfig.walletMode > 0 ? 'withdraw' : null,
401
+ attachmentType: 'withdraw',
403
402
  }
404
403
  }),
405
404
  setMode: assign((context, event) => {
@@ -193,7 +193,6 @@ export default function (request) {
193
193
  },
194
194
  SET_ATTACHMENT_TYPE: {
195
195
  actions: 'setAttachmentType',
196
- cond: 'isNewWalletMode',
197
196
  },
198
197
  SUBMIT: [
199
198
  {
@@ -359,7 +358,7 @@ export default function (request) {
359
358
  balance,
360
359
  siteConfig,
361
360
  userInfo,
362
- attachmentType: siteConfig.walletMode > 0 ? 'withdraw' : null,
361
+ attachmentType: 'withdraw',
363
362
  }
364
363
  }),
365
364
  updateWithdrawCondition: assign((context, event) => {
@@ -453,7 +452,6 @@ export default function (request) {
453
452
  isOtpRequired: (context, event) => {
454
453
  return event.data?.status === 'otp-verifying'
455
454
  },
456
- isNewWalletMode: (context, event) => context.siteConfig.walletMode > 0,
457
455
  isNotWithdrawMinDepositAmount: (context, event) => {
458
456
  const { withdrawCheck } = context
459
457
  return !withdrawCheck?.passDepositeLimit
@@ -373,7 +373,7 @@ export default function (request) {
373
373
  const methods = siteConfig?.paymentMethods?.withdraw || []
374
374
  return {
375
375
  methods,
376
- attachmentType: siteConfig.walletMode > 0 ? 'withdraw' : null,
376
+ attachmentType: 'withdraw',
377
377
  }
378
378
  }),
379
379
  setMode: assign((context, event) => {
@@ -2,6 +2,54 @@ import pickBy from 'lodash/pickBy.js'
2
2
  import storage from '../util/storage.js'
3
3
 
4
4
  // const pickBy = require('lodash/pickBy')
5
+ const supportVersion2List = [
6
+ 'game/play',
7
+ 'game/gameReplay',
8
+ 'game/logout',
9
+ 'game/list/v3/root',
10
+ 'game/list/v3/category',
11
+ 'game/list/v3/addition',
12
+ 'game/list/v3/categoryByRange',
13
+ 'game/list/v3/additionByRange',
14
+ 'game/list/v3/myFavorite',
15
+ 'game/list/v3/addMyFavorite',
16
+ 'game/list/v3/removeMyFavorite',
17
+ 'login',
18
+ 'callback/:strategy',
19
+ 'guestLogin',
20
+ 'appLogin',
21
+ 'logout',
22
+ 'self',
23
+ 'register',
24
+ 'settings/password',
25
+ 'verify',
26
+ 'reset',
27
+ 'acknowledge',
28
+ 'friends',
29
+ 'friends/home',
30
+ 'friends/reward-list',
31
+ 'recovery',
32
+ 'recovery/abandon',
33
+ 'recovery/acknowledge',
34
+ 'checkDt',
35
+ 'updateDt',
36
+ 'checkAC',
37
+ 'checkAccount',
38
+ 'getAllAvatar',
39
+ 'updateUserAvatar',
40
+ 'getConfig',
41
+ 'getQuickLayout',
42
+ 'getNavbarSetting',
43
+ 'getAffiliateCode',
44
+ 'get-site-config',
45
+ 'friends/dashboard',
46
+ 'friends/dashboard/list',
47
+ 'mailbox/sendMessage',
48
+ 'mailbox/getMessageList',
49
+ 'mailbox/getMessage',
50
+ 'mailbox/updateMessage',
51
+ 'mailbox/getMessageTypes',
52
+ ]
5
53
 
6
54
  function isValid(value) {
7
55
  return value !== undefined && value !== null
@@ -24,7 +72,8 @@ export default class Request {
24
72
  axiosConfig.headers['X-TH1GAMES-VERSION'] = this.config.version
25
73
  axiosConfig.headers['X-TH1GAMES-PLATFORM'] = this.config.platform
26
74
  if (this.getToken()) {
27
- axiosConfig.headers.Authorization = this.getToken()
75
+ // 為了支援V2版本的API接口新增Bearer來進行身份驗證
76
+ axiosConfig.headers.Authorization = `Bearer ${this.getToken()}`
28
77
  }
29
78
  return axiosConfig
30
79
  })
@@ -85,9 +134,15 @@ export default class Request {
85
134
 
86
135
  _createConfig(req, cancelToken) {
87
136
  const { method, url, params, isPublic, isFormData, headers } = req
137
+ let fullURL = this.config.fullURL
138
+ // 有些API會將參數(/?)直接帶在URL上,所以要將參數排除
139
+ if (supportVersion2List.includes(url.split('?')[0])) {
140
+ console.log('*[DEV_ONLY]有支援V2的API:', url.split('?')[0])
141
+ fullURL = fullURL.replace('/v1/', '/v2/')
142
+ }
88
143
  if (isFormData) {
89
144
  return {
90
- baseURL: this.config.fullURL,
145
+ baseURL: fullURL,
91
146
  method,
92
147
  url,
93
148
  cancelToken,
@@ -97,7 +152,7 @@ export default class Request {
97
152
  }
98
153
  } else {
99
154
  return {
100
- baseURL: this.config.fullURL,
155
+ baseURL: fullURL,
101
156
  method,
102
157
  url,
103
158
  cancelToken,