@jetthai/cuora 1.1.407 → 1.1.408-dev-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,6 +2,16 @@
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.408-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.406-dev-8...v1.1.408-dev-1) (2026-01-14)
6
+
7
+ ### [1.1.408](https://github.com/jetthai/cuora-module/compare/v1.1.406-dev-6...v1.1.408) (2026-01-12)
8
+
9
+ ### Bug Fixes
10
+
11
+ - add null check for appendContent to prevent TypeError ([5c9de6e](https://github.com/jetthai/cuora-module/commit/5c9de6eaeff4182dd8098aa8816fb9b5650f36c1))
12
+
13
+ ### [1.1.408](https://github.com/jetthai/cuora-module/compare/v1.1.407...v1.1.408) (2026-01-12)
14
+
5
15
  ### [1.1.407](https://github.com/jetthai/cuora-module/compare/v1.1.406...v1.1.407) (2025-12-22)
6
16
 
7
17
  ### [1.1.406](https://github.com/jetthai/cuora-module/compare/v1.1.405...v1.1.406) (2025-12-16)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.407",
3
+ "version": "1.1.408-dev-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -87,6 +87,12 @@ export default {
87
87
  getVipTable: ({ appSecret }) => ({ url: 'activities/viptable', method: 'get', params: { appSecret } }),
88
88
  getLevelBonusInfo: () => ({ url: 'activities/level-bonus/info', method: 'get' }),
89
89
  getRankingList: () => ({ url: 'activities/ranking', method: 'get' }),
90
+ getPublicRankingList: ({ appSecret }) => ({
91
+ url: 'activities/ranking/public/promotion-ranking',
92
+ method: 'get',
93
+ isPublic: true,
94
+ params: { appSecret },
95
+ }),
90
96
  exchangeDiamond: ({ activityNo, exchangeAward = [] }) => ({
91
97
  url: 'activities/exchange/diamond',
92
98
  method: 'post',
package/src/api/common.js CHANGED
@@ -7,4 +7,9 @@ export default {
7
7
  getNavbar: ({ appSecret } = {}) => ({ url: 'getNavbarSetting', params: { appSecret }, method: 'get', isPublic: true }),
8
8
  getDefaultAffiliateCode: ({ appSecret }) => ({ url: 'getAffiliateCode', params: { appSecret }, method: 'get', isPublic: true }),
9
9
  getSiteInfoConfig: ({ appSecret, config }) => ({ url: 'get-site-config', method: 'get', params: { appSecret, config }, isPublic: true }),
10
+ sendPixel: ({ appSecret, eventId, fbc, fbp, event }) => ({
11
+ url: 'pixel',
12
+ method: 'post',
13
+ params: { appSecret, eventId, fbc, fbp, event },
14
+ }),
10
15
  }
@@ -176,12 +176,12 @@ export default {
176
176
  params: { transferType: 'DEPOSIT', amount, promotionsNo },
177
177
  }),
178
178
  submitWithdrawTransactionCrypto: ({ method, amount, cryptoCurrency, cryptoNetwork, targetAddress, applyerHolderName }) => ({
179
- url: `payment/v2/${method}/transaction`,
179
+ url: `/payment/v2/${method}/withdraw-otp/verify`,
180
180
  method: 'post',
181
181
  params: { transferType: 'WITHDRAW', amount, cryptoCurrency, cryptoNetwork, targetAddress, applyerHolderName },
182
182
  }),
183
183
  submitWithdrawTransactionVN: ({ method, amount, applyerBankCode, applyerAccountNumber, applyerIfscCode, branch, applyerHolderName }) => ({
184
- url: `payment/v2/${method}/transaction`,
184
+ url: `/payment/v2/${method}/withdraw-otp/verify`,
185
185
  method: 'post',
186
186
  params: {
187
187
  transferType: 'WITHDRAW',
@@ -205,7 +205,7 @@ export default {
205
205
  cryptoNetwork,
206
206
  targetAddress,
207
207
  }) => ({
208
- url: `payment/v2/${method}/transaction`,
208
+ url: `payment/v2/${method}/withdraw-otp/verify`,
209
209
  method: 'post',
210
210
  params: {
211
211
  transferType: 'WITHDRAW',
@@ -247,4 +247,16 @@ export default {
247
247
  withdrawCheck: () => ({ url: `payment/v2/withdrawCheck`, method: 'post' }),
248
248
  updateUtr: ({ applyId, utr }) => ({ url: 'payment/v2/updateUtr', method: 'post', params: { applyId, utr } }),
249
249
  uploadCommonSlip: ({ applyId, slip }) => ({ url: 'payment/v2/uploadCommonSlip', method: 'post', params: { applyId, slip } }),
250
+ otpAcknowledge: ({ method, requestId, code }) => ({
251
+ url: `/payment/v2/${method}/withdraw-otp/acknowledge`,
252
+ method: 'post',
253
+ params: { requestId, code },
254
+ isPublic: true,
255
+ }),
256
+ otpReset: ({ method, requestId }) => ({
257
+ url: `/payment/v2/${method}/withdraw-otp/reset-otp`,
258
+ method: 'post',
259
+ params: { requestId },
260
+ isPublic: true,
261
+ }),
250
262
  }
@@ -55,7 +55,7 @@ export default function (request) {
55
55
  },
56
56
  },
57
57
  fetching: {
58
- entry: ['setUA', 'setAgent', 'setPixel', 'setKPixel'],
58
+ entry: ['setUA', 'setAgent', 'setPixel', 'setKPixel', 'setFbclid'],
59
59
  invoke: {
60
60
  src: 'fetchConfig',
61
61
  onDone: [
@@ -237,6 +237,18 @@ export default function (request) {
237
237
  isMobile: userAgent?.device?.type,
238
238
  }
239
239
  }),
240
+ setFbclid: assign(() => {
241
+ const urlParams = new URLSearchParams(window.location.search)
242
+ const fbclid = urlParams.get('fbclid') || ''
243
+ if (fbclid !== '') {
244
+ const timestamp = Date.now()
245
+ const cookieRecord = 'fb.1.' + timestamp + '.' + fbclid
246
+ document.cookie = `_fbc=${cookieRecord}; path=/; max-age=${60 * 60 * 24 * 7}`
247
+ }
248
+ return {
249
+ fbclid,
250
+ }
251
+ }),
240
252
  setPixel: assign(() => {
241
253
  let urlParams = new URLSearchParams(window.location.search)
242
254
  const pix = urlParams.get('pix') || storage.get('pix') || ''
@@ -49,6 +49,10 @@ export default function (request, context) {
49
49
  services: {
50
50
  // 取得遊戲資訊
51
51
  fetchGameInfo: async (context, event) => {
52
+ // [防呆] 確保有 gameCode
53
+ if (!gameCode) {
54
+ return { data: {} }
55
+ }
52
56
  return await request.send(game.getGameInfo({ appSecret, gameCode }))
53
57
  },
54
58
  },
@@ -390,6 +390,10 @@ export default function (request) {
390
390
  }),
391
391
  appendContent: assign((context, event) => {
392
392
  const { room, additionEnable } = context
393
+ // [防呆] 確保有 categoryId
394
+ if (!room?.categoryId) {
395
+ return
396
+ }
393
397
  if (room.categoryId === GAME_SEARCH) {
394
398
  return
395
399
  } else if (additionEnable) {
@@ -517,38 +521,60 @@ export default function (request) {
517
521
  })
518
522
  return list.filter((item) => item.downLine.length > 0).slice(0, 6)
519
523
  } else if (additionEnable) {
520
- const param = { categoryId: room.categoryId, index, appSecret }
521
- requestChain = event.data.list.map((category, b) => {
522
- return request
523
- .send(
524
- api.getListCategory({
525
- categoryId: category.id,
526
- index: 0,
527
- appSecret,
528
- })
529
- )
530
- .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
531
- })
532
- const result = await Promise.all([...requestChain, request.send(api.getListAddition(param))])
533
- return result.filter((item) => item.downLine.length > 0).slice(0, 6)
524
+ // [防呆] 確保有 categoryId
525
+ const hasCategoryId = !!room?.categoryId
526
+ const param = hasCategoryId ? { categoryId: room.categoryId, index, appSecret } : null
527
+ // [防呆] 確保有 categoryId
528
+ requestChain = event.data.list
529
+ .filter((category) => category?.id != null)
530
+ .map((category) =>
531
+ request
532
+ .send(
533
+ api.getListCategory({
534
+ categoryId: category.id,
535
+ index: 0,
536
+ appSecret,
537
+ })
538
+ )
539
+ .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
540
+ )
541
+ const promises = [...requestChain]
542
+ if (hasCategoryId) {
543
+ promises.push(request.send(api.getListAddition(param)))
544
+ }
545
+ const result = await Promise.all(promises)
546
+ return result.filter((item) => item.downLine?.length > 0).slice(0, 6)
534
547
  } else {
535
- requestChain = event.data.list.map((category, b) => {
536
- return request
537
- .send(
538
- api.getListCategory({
539
- categoryId: category.id,
540
- index: 0,
541
- appSecret,
542
- })
543
- )
544
- .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
545
- })
548
+ // [防呆] 確保有 categoryId
549
+ requestChain = event.data.list
550
+ .filter((category) => category?.id != null)
551
+ .map((category) =>
552
+ request
553
+ .send(
554
+ api.getListCategory({
555
+ categoryId: category.id,
556
+ index: 0,
557
+ appSecret,
558
+ })
559
+ )
560
+ .then((res) => Object.assign({ downLine: res.data.filter((item) => item.isGame).slice(0, 20) }, category))
561
+ )
546
562
  const result = await Promise.all([...requestChain])
547
563
  return result.filter((item) => item.downLine.length > 0).slice(0, 6)
548
564
  }
549
565
  },
550
566
  getPageContent: async (context, event) => {
551
567
  const { room, index, additionEnable, staticData } = context
568
+ // [防呆] 確保有 categoryId
569
+ if (!room?.categoryId) {
570
+ return [
571
+ {
572
+ data: [],
573
+ totalPage: 0,
574
+ timestamp: context.content?.timestamp ?? null,
575
+ },
576
+ ]
577
+ }
552
578
  if (room.categoryId === GAME_SEARCH) {
553
579
  return
554
580
  } else if (!request.getToken()) {
@@ -571,6 +597,10 @@ export default function (request) {
571
597
  },
572
598
  updatePageContent: async (context, event) => {
573
599
  const { room, content, index, additionEnable } = context
600
+ // [防呆] 確保有 categoryId
601
+ if (!room?.categoryId) {
602
+ return []
603
+ }
574
604
  if (room.categoryId === GAME_SEARCH) {
575
605
  return []
576
606
  } else if (!request.getToken()) {
@@ -608,9 +638,14 @@ export default function (request) {
608
638
  }
609
639
  },
610
640
  connectGame: async (context, event) => {
641
+ // [防呆] 確保有 providerId 和 gameId
642
+ const { providerId, gameId } = context.game || {}
643
+ if (!providerId || !gameId) {
644
+ return
645
+ }
611
646
  const returnProviders = ['RSG', 'KP', 'EPICWIN', 'AMBSLOT', 'SEXY_VENUS', 'SEXY_SEXYBCRT', 'PG', 'NPG']
612
647
  const { lang, isMobile, walletType } = context
613
- const { providerId, gameId, gameTypeId, mappingId } = context.game
648
+ const { gameTypeId, mappingId } = context.game
614
649
  const params = {
615
650
  provider_id: providerId,
616
651
  game_id: gameId,
@@ -37,12 +37,13 @@ export default function (request) {
37
37
  checking: {
38
38
  always: [
39
39
  { target: 'idle', actions: 'setActivityDetail', cond: 'isExist' },
40
- { target: 'loading', cond: 'hasActivityNo' },
40
+ { target: 'loading', cond: 'hasActivityNoAndToken' },
41
+ { target: 'idle' },
41
42
  ],
42
43
  },
43
44
  loading: {
44
45
  invoke: {
45
- src: 'fetchPublicActivityDetail',
46
+ src: 'fetchActivityDetail',
46
47
  onDone: {
47
48
  target: 'idle',
48
49
  actions: ['setActivityMap', 'setActivityDetail'],
@@ -100,8 +101,9 @@ export default function (request) {
100
101
  const { activityMap, activityNo } = context
101
102
  return activityMap[activityNo]
102
103
  },
103
- hasActivityNo: (context, event) => {
104
- return !!context.activityNo
104
+ hasActivityNoAndToken: (context, event) => {
105
+ const hasToken = request.getToken()
106
+ return !!context.activityNo && hasToken
105
107
  },
106
108
  },
107
109
  services: {
@@ -116,15 +118,10 @@ export default function (request) {
116
118
  const { data } = await request.send(hasToken ? api.getActivityList({ appSecret }) : api.getAllActivityList({ appSecret }))
117
119
  return data
118
120
  },
119
- fetchPublicActivityDetail: async (context, event) => {
120
- const hasToken = request.getToken()
121
+ fetchActivityDetail: async (context, event) => {
121
122
  const { activityNo } = context
122
123
  let result = {}
123
- if (hasToken) {
124
- result = await request.send(api.getActivityDetail({ activityNo, appSecret }))
125
- } else {
126
- result = await request.send(api.getTournamentDetail({ activityNo, appSecret }))
127
- }
124
+ result = await request.send(api.getActivityDetail({ activityNo, appSecret }))
128
125
  return result.data
129
126
  },
130
127
  },
@@ -1,7 +1,6 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import findLastIndex from 'lodash/findLastIndex.js'
3
3
  import payment from '../../api/payment.js'
4
- import user from '../../api/user.js'
5
4
 
6
5
  export default function (request) {
7
6
  const { appSecret } = request.config
@@ -36,8 +35,8 @@ export default function (request) {
36
35
 
37
36
  // otp
38
37
  requestId: null,
39
- status: null,
40
- target: null,
38
+ number: null,
39
+ email: null,
41
40
  ttl: null,
42
41
  },
43
42
  states: {
@@ -356,26 +355,27 @@ export default function (request) {
356
355
  return { paymentDetail }
357
356
  }),
358
357
  setOtp: assign((context, event) => {
359
- const { requestId, status, target, ttl } = event.data
358
+ const { request_id, number, email, ttl } = event.data
360
359
  return {
361
- requestId,
362
- status,
363
- target,
360
+ requestId: request_id,
361
+ number,
362
+ email,
364
363
  ttl,
365
364
  }
366
365
  }),
367
366
  decreaseTtl: assign((context, evnet) => {
368
367
  const second = context.ttl
369
368
  return {
370
- ttl: Math.max(second - 1, 0),
369
+ ttl: Math.max(second - 1000, 0),
371
370
  }
372
371
  }),
373
372
  setVerificationData: assign((context, event) => {
374
- const { requestId, ttl, target } = event.data
373
+ const { request_id, number, email, ttl } = event.data
375
374
  return {
376
- requestId,
375
+ requestId: request_id,
376
+ number,
377
+ email,
377
378
  ttl,
378
- target,
379
379
  }
380
380
  }),
381
381
  setAttachmentType: assign((context, event) => {
@@ -439,7 +439,8 @@ export default function (request) {
439
439
  return !enableWithdraw || balance < minWithdrawAmount
440
440
  },
441
441
  isOtpRequired: (context, event) => {
442
- return event.data?.status === 'otp-verifying'
442
+ const { request_id, number, email } = event.data || {}
443
+ return request_id !== undefined && (number || email)
443
444
  },
444
445
  isNotWithdrawMinDepositAmount: (context, event) => {
445
446
  const { withdrawCheck } = context
@@ -509,13 +510,15 @@ export default function (request) {
509
510
  return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
510
511
  },
511
512
  resetOtp: async (context, event) => {
512
- const { requestId, target } = context
513
- return await request.send(user.otpReset({ requestId, target }))
513
+ const { requestId } = context
514
+ const { method } = context.paymentDetail[0]
515
+ return await request.send(payment.otpReset({ method: method, requestId }))
514
516
  },
515
517
  acknowledge: async (context, event) => {
516
- const { requestId, target } = context
518
+ const { requestId } = context
519
+ const { method } = context.paymentDetail[0]
517
520
  const code = event.data
518
- return await request.send(user.otpAcknowledge({ requestId, target, code }))
521
+ return await request.send(payment.otpAcknowledge({ method: method, requestId, code }))
519
522
  },
520
523
  pool: async (context, event) => {
521
524
  const { amount } = context
@@ -23,6 +23,8 @@ export default function (request, context) {
23
23
  requestId: null,
24
24
  status: null,
25
25
  target: null,
26
+ email: null,
27
+ number: null,
26
28
  ttl: null,
27
29
  },
28
30
  states: {
@@ -117,29 +119,18 @@ export default function (request, context) {
117
119
  RESET_OTP: {
118
120
  target: 'reset',
119
121
  },
120
- BACK: [
121
- // {
122
- // target: '#withdraw_vn2.activity.convertible',
123
- // cond: 'isActivity',
124
- // },
125
- // {
126
- // target: '#withdraw_vn2.cash.withdrawable',
127
- // },
128
- ],
122
+ BACK: {
123
+ target: '#withdraw_manual_cash.calculated',
124
+ },
129
125
  },
130
126
  },
131
127
  acknowledging: {
132
128
  invoke: {
133
129
  src: 'acknowledge',
134
- onDone: [
135
- // {
136
- // target: '#withdraw_vn2.activity.converted',
137
- // cond: 'isActivity',
138
- // },
139
- // {
140
- // target: '#withdraw_vn2.cash.submitted',
141
- // },
142
- ],
130
+ onDone: {
131
+ target: '#withdraw_manual_cash.submitted',
132
+ actions: 'setProcessing',
133
+ },
143
134
  onError: {
144
135
  target: 'idle',
145
136
  },
@@ -203,26 +194,27 @@ export default function (request, context) {
203
194
  }
204
195
  }),
205
196
  setOtp: assign((context, event) => {
206
- const { requestId, status, target, ttl } = event.data
197
+ const { request_id, email, number, ttl } = event.data
207
198
  return {
208
- requestId,
209
- status,
210
- target,
199
+ requestId: request_id,
200
+ email,
201
+ number,
211
202
  ttl,
212
203
  }
213
204
  }),
214
205
  decreaseTtl: assign((context, evnet) => {
215
206
  const second = context.ttl
216
207
  return {
217
- ttl: Math.max(second - 1, 0),
208
+ ttl: Math.max(second - 1000, 0),
218
209
  }
219
210
  }),
220
211
  setVerificationData: assign((context, event) => {
221
- const { requestId, ttl, target } = event.data
212
+ const { request_id, ttl, number, email } = event.data
222
213
  return {
223
- requestId,
214
+ requestId: request_id,
224
215
  ttl,
225
- target,
216
+ number,
217
+ email,
226
218
  }
227
219
  }),
228
220
  },
@@ -238,7 +230,7 @@ export default function (request, context) {
238
230
  return selectedUserBank && selectedAmount > 0 && currentPayment.minimum <= selectedAmount && selectedAmount <= currentPayment.maximum
239
231
  },
240
232
  isOtpRequired: (context, event) => {
241
- return event.data?.status === 'otp-verifying'
233
+ return event.data?.request_id !== undefined
242
234
  },
243
235
  },
244
236
  services: {
@@ -289,13 +281,13 @@ export default function (request, context) {
289
281
  )
290
282
  },
291
283
  resetOtp: async (context, event) => {
292
- const { requestId, target } = context
293
- return await request.send(user.otpReset({ requestId, target }))
284
+ const { currentPayment, requestId } = context
285
+ return await request.send(payment.otpReset({ method: currentPayment.method, requestId }))
294
286
  },
295
287
  acknowledge: async (context, event) => {
296
- const { requestId, target } = context
288
+ const { currentPayment, requestId } = context
297
289
  const code = event.data
298
- return await request.send(user.otpAcknowledge({ requestId, target, code }))
290
+ return await request.send(payment.otpAcknowledge({ method: currentPayment.method, requestId, code }))
299
291
  },
300
292
  },
301
293
  }
@@ -140,6 +140,8 @@ const supportVersion2List = [
140
140
  'game/list/v3/gameInfo',
141
141
  'payment/v2/uploadCommonSlip',
142
142
  'game/history/options',
143
+ // 09/30
144
+ 'pixel',
143
145
  // 10/09
144
146
  'account-binding/status',
145
147
  'account-binding/bind',