@jetthai/cuora 1.1.400-dev-12 → 1.1.400-dev-13

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,8 @@
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.400-dev-13](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-12...v1.1.400-dev-13) (2025-12-18)
6
+
5
7
  ### [1.1.400-dev-12](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-11...v1.1.400-dev-12) (2025-12-18)
6
8
 
7
9
  ### [1.1.400-dev-11](https://github.com/jetthai/cuora-module/compare/v1.1.400-dev-10...v1.1.400-dev-11) (2025-12-18)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.400-dev-12",
3
+ "version": "1.1.400-dev-13",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -466,6 +466,7 @@ export default function (request) {
466
466
  referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel
467
467
 
468
468
  const fullURL = request.config.fullURL
469
+
469
470
  const redirectURL = urljoin(
470
471
  fullURL,
471
472
  'login?' +
@@ -1,6 +1,7 @@
1
1
  import pickBy from 'lodash/pickBy.js'
2
2
  import storage from '../util/storage.js'
3
3
 
4
+ // const pickBy = require('lodash/pickBy')
4
5
  const supportVersion2List = [
5
6
  // 04-09 Update
6
7
  'game/play',
@@ -242,13 +243,10 @@ export default class Request {
242
243
  this._checkToken(req)
243
244
 
244
245
  const requestConfig = this._createConfig(req, cancelToken)
245
- // console.log('*請求資料Check', requestConfig)
246
246
  const configUrls = ['getConfig', 'get-config']
247
247
  if (this.isBlocked && !configUrls.includes(requestConfig.url)) {
248
248
  // 狀態是維護中&請求非siteConfig,終止所有的請求,除了維護頁需要的資料(siteConfig)
249
- // console.log('%c*禁止的請求目標', requestConfig)
250
249
  } else {
251
- // console.log('%c*允許的請求目標', requestConfig)
252
250
  const { data } = await this.axios.request(requestConfig)
253
251
  return data
254
252
  }
@@ -280,7 +278,23 @@ export default class Request {
280
278
  _createConfig(req, cancelToken) {
281
279
  const { method, url, params, isPublic, isFormData, headers } = req
282
280
  let fullURL = this.config.fullURL
283
- let urlName = this._convertUrlToKebabCase(url)
281
+ let urlName = url
282
+
283
+ // 有些API會將參數(/?)直接帶在URL上,所以要將參數排除
284
+ const cleanUrl = url.split('?')[0]
285
+ const isV2Supported = supportVersion2List.some((supportedUrl) => {
286
+ // 如果包含動態參數(:parameter),則使用模式匹配
287
+ if (supportedUrl.includes(':')) {
288
+ const pattern = supportedUrl.replace(/:[^/]+/g, '[^/]+')
289
+ const regex = new RegExp(`^${pattern}$`)
290
+ return regex.test(cleanUrl)
291
+ }
292
+ return supportedUrl === cleanUrl
293
+ })
294
+ // 符合轉換規則的API進行路徑調整
295
+ if (isV2Supported) {
296
+ urlName = this._convertUrlToKebabCase(url)
297
+ }
284
298
 
285
299
  if (isFormData) {
286
300
  return {