@jetthai/cuora 1.1.405 → 1.1.406-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,6 +2,12 @@
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.406-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.406-dev-1...v1.1.406-dev-2) (2025-12-22)
6
+
7
+ ### [1.1.406-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.406...v1.1.406-dev-1) (2025-12-19)
8
+
9
+ ### [1.1.406](https://github.com/jetthai/cuora-module/compare/v1.1.405...v1.1.406) (2025-12-16)
10
+
5
11
  ### [1.1.405](https://github.com/jetthai/cuora-module/compare/v1.1.404...v1.1.405) (2025-12-16)
6
12
 
7
13
  ### [1.1.404](https://github.com/jetthai/cuora-module/compare/v1.1.403...v1.1.404) (2025-12-16)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.405",
3
+ "version": "1.1.406-dev-2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
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
  }
@@ -465,10 +465,7 @@ export default function (request) {
465
465
  referralObj.channel = storage.get('channel') || defaultChannel || channel
466
466
  referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel
467
467
 
468
- // OZE、ZAZA 先使用 v2 測試 ,等待確認沒問題後再統一用 v2
469
- // 但 ZALO 仍維持 v1
470
- const fullURL =
471
- ['OZE', 'ZAZA'].includes(clientId) && provider !== 'zalo' ? request.config.fullURL.replace('/v1/', '/v2/') : request.config.fullURL
468
+ const fullURL = request.config.fullURL
472
469
 
473
470
  const redirectURL = urljoin(
474
471
  fullURL,
@@ -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') || ''
@@ -549,7 +549,12 @@ export default function (request) {
549
549
  },
550
550
  getPageContent: async (context, event) => {
551
551
  const { room, index, additionEnable, staticData } = context
552
- if (room.categoryId === GAME_SEARCH) {
552
+ // 如果沒有 categoryId 不往下執行
553
+ if (!room?.categoryId) {
554
+ console.error('No room categoryId found for updating content')
555
+ return
556
+ }
557
+ if (room?.categoryId === GAME_SEARCH) {
553
558
  return
554
559
  } else if (!request.getToken()) {
555
560
  const list = staticData.find((data) => data.category == room.categoryId)?.info || []
@@ -571,7 +576,12 @@ export default function (request) {
571
576
  },
572
577
  updatePageContent: async (context, event) => {
573
578
  const { room, content, index, additionEnable } = context
574
- if (room.categoryId === GAME_SEARCH) {
579
+ // 如果沒有 categoryId 不往下執行
580
+ if (!room?.categoryId) {
581
+ console.error('No room categoryId found for updating content')
582
+ return []
583
+ }
584
+ if (room?.categoryId === GAME_SEARCH) {
575
585
  return []
576
586
  } else if (!request.getToken()) {
577
587
  return []
@@ -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',
@@ -241,13 +243,10 @@ export default class Request {
241
243
  this._checkToken(req)
242
244
 
243
245
  const requestConfig = this._createConfig(req, cancelToken)
244
- // console.log('*請求資料Check', requestConfig)
245
246
  const configUrls = ['getConfig', 'get-config']
246
247
  if (this.isBlocked && !configUrls.includes(requestConfig.url)) {
247
248
  // 狀態是維護中&請求非siteConfig,終止所有的請求,除了維護頁需要的資料(siteConfig)
248
- // console.log('%c*禁止的請求目標', requestConfig)
249
249
  } else {
250
- // console.log('%c*允許的請求目標', requestConfig)
251
250
  const { data } = await this.axios.request(requestConfig)
252
251
  return data
253
252
  }
@@ -280,9 +279,9 @@ export default class Request {
280
279
  const { method, url, params, isPublic, isFormData, headers } = req
281
280
  let fullURL = this.config.fullURL
282
281
  let urlName = url
282
+
283
283
  // 有些API會將參數(/?)直接帶在URL上,所以要將參數排除
284
284
  const cleanUrl = url.split('?')[0]
285
-
286
285
  const isV2Supported = supportVersion2List.some((supportedUrl) => {
287
286
  // 如果包含動態參數(:parameter),則使用模式匹配
288
287
  if (supportedUrl.includes(':')) {
@@ -292,16 +291,9 @@ export default class Request {
292
291
  }
293
292
  return supportedUrl === cleanUrl
294
293
  })
295
-
296
- // 目前全站都支援V2,若有需要限制為V1的站點可以填入,此段等轉換全部完成之後就可以移除了
297
- const supportV2Toggle = [''].includes(this.config?.clientId)
298
-
299
- if (isV2Supported && !supportV2Toggle) {
300
- fullURL = fullURL.replace('/v1/', '/v2/')
294
+ // 符合轉換規則的API進行路徑調整
295
+ if (isV2Supported) {
301
296
  urlName = this._convertUrlToKebabCase(url)
302
- // console.log(`*[DEV_ONLY]V2`, 'url:', urlName)
303
- } else {
304
- // console.log(`*[DEV_ONLY]V2-不支援:`, 'url:', urlName)
305
297
  }
306
298
 
307
299
  if (isFormData) {