@jetthai/cuora 1.1.413-dev-8 → 1.1.413-dev-10

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,14 +2,36 @@
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.413-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-7...v1.1.413-dev-8) (2026-03-10)
5
+ ### [1.1.413-dev-10](https://github.com/jetthai/cuora-module/compare/v1.1.413-dev-9...v1.1.413-dev-10) (2026-03-11)
6
+
7
+ ### [1.1.413-dev-9](https://github.com/jetthai/cuora-module/compare/v1.1.421...v1.1.413-dev-9) (2026-03-11)
8
+
9
+ ### [1.1.413-dev-8](https://github.com/jetthai/cuora-module/compare/v1.1.420...v1.1.413-dev-8) (2026-03-10)
6
10
 
7
11
  ### [1.1.413-dev-7](https://github.com/jetthai/cuora-module/compare/v1.1.413-6...v1.1.413-dev-7) (2026-03-06)
8
12
 
9
- ### [1.1.413-6](https://github.com/jetthai/cuora-module/compare/v1.1.413-5...v1.1.413-6) (2026-03-06)
13
+ ### [1.1.413-6](https://github.com/jetthai/cuora-module/compare/v1.1.416...v1.1.413-6) (2026-03-06)
10
14
 
11
15
  ### [1.1.413-5](https://github.com/jetthai/cuora-module/compare/v1.1.413...v1.1.413-5) (2026-03-05)
12
16
 
17
+ ### [1.1.421](https://github.com/jetthai/cuora-module/compare/v1.1.420...v1.1.421) (2026-03-10)
18
+
19
+ ### [1.1.420](https://github.com/jetthai/cuora-module/compare/v1.1.419...v1.1.420) (2026-03-10)
20
+
21
+ ### [1.1.419](https://github.com/jetthai/cuora-module/compare/v1.1.418...v1.1.419) (2026-03-09)
22
+
23
+ ### [1.1.418](https://github.com/jetthai/cuora-module/compare/v1.1.417...v1.1.418) (2026-03-06)
24
+
25
+ ### [1.1.417](https://github.com/jetthai/cuora-module/compare/v1.1.416...v1.1.417) (2026-03-06)
26
+
27
+ ### Bug Fixes
28
+
29
+ - handle query string in \_convertUrlToKebabCase to avoid incorrect conversion ([3dc8596](https://github.com/jetthai/cuora-module/commit/3dc8596af4855c9af6ff05475fd9422bc24c4ac3))
30
+
31
+ ### [1.1.416](https://github.com/jetthai/cuora-module/compare/v1.1.414...v1.1.416) (2026-03-05)
32
+
33
+ ### [1.1.414](https://github.com/jetthai/cuora-module/compare/v1.1.413...v1.1.414) (2026-03-05)
34
+
13
35
  ### Bug Fixes
14
36
 
15
37
  - add null check for appendContent to prevent TypeError ([ba1eabd](https://github.com/jetthai/cuora-module/commit/ba1eabd6a6b42a89fb88d55363f02c37e84a2dd3))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.413-dev-8",
3
+ "version": "1.1.413-dev-10",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -130,19 +130,28 @@ export default function (request, context) {
130
130
  setInitData: assign((context, event) => {
131
131
  const { paymentDetail } = context
132
132
  const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
133
- const cryptos = payments.map((payment) => ({
134
- ...payment,
135
- label: `${payment.networks?.[0]?.cryptoName} - ${payment.networks?.[0]?.networkDisplayName}`,
136
- // network: payment.networkName?.[0], // 改由 networkCode 取代
137
- value: payment.method,
138
- icon: payment.channel,
139
- networkCode: payment.networks?.[0]?.networkCode,
140
- }))
133
+
134
+ // 安全地處理 networks 數組,添加空值檢查
135
+ const cryptos = payments.flatMap((payment) => {
136
+ if (!payment.networks || !Array.isArray(payment.networks)) {
137
+ return []
138
+ }
139
+ return payment.networks.map((network) => ({
140
+ ...network,
141
+ label: `${network.cryptoName || ''} - ${network.networkDisplayName || ''}`,
142
+ value: payment.method,
143
+ icon: payment.channel,
144
+ networkCode: network.networkCode,
145
+ }))
146
+ })
147
+
148
+ // 安全地處理空數組情況
149
+ const defaultCrypto = cryptos.length > 0 ? cryptos[0] : null
141
150
 
142
151
  return {
143
152
  cryptos,
144
- selectedCrypto: cryptos[0],
145
- options: cryptos[0].optional,
153
+ selectedCrypto: defaultCrypto,
154
+ options: defaultCrypto?.optional || [],
146
155
  }
147
156
  }),
148
157
  setCrypto: assign((context, event) => {
@@ -152,7 +161,7 @@ export default function (request, context) {
152
161
  selectedCrypto: selectedCrypto,
153
162
  selectedAmount: null,
154
163
  calculation: null,
155
- options: selectedCrypto.optional,
164
+ options: selectedCrypto?.optional || [],
156
165
  }
157
166
  }),
158
167
  setAmount: assign((context, event) => {
@@ -167,7 +167,7 @@ export default function (request, context) {
167
167
  actions: {
168
168
  setInitData: assign((context, event) => {
169
169
  const { currentPayment, paymentInfo, withdrawRule, processing } = event.data
170
- const userBanks = [...paymentInfo.bankList, ...paymentInfo.cryptoList, ...paymentInfo.ewalletList]
170
+ const userBanks = [...paymentInfo.bankList, ...paymentInfo.ewalletList, ...paymentInfo.cryptoList]
171
171
 
172
172
  return {
173
173
  currentPayment,
@@ -321,6 +321,7 @@ export default class Request {
321
321
 
322
322
  // 調整API路徑與名稱
323
323
  _convertUrlToKebabCase(url) {
324
+ const [path, queryString] = url.split('?')
324
325
  const specifyingPath = {
325
326
  'all-activities/list': 'activities/all-activities-list',
326
327
  friends: 'activities/friends',
@@ -342,13 +343,9 @@ export default class Request {
342
343
  'activities/exchange/diamond/max-amount': 'activities/diamond/exchange/max-amount',
343
344
  'activities/exchange/diamond/settle': 'activities/diamond/exchange/settle',
344
345
  }
345
- if (specifyingPath[url]) {
346
- // 和原有路徑不同有另外改路徑
347
- return specifyingPath[url]
348
- } else {
349
- // 將API_URL的命名規則由駝峰調整為短橫線(-)
350
- return url.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
351
- }
346
+ // 和原有路徑不同有另外改路徑
347
+ const convertedPath = specifyingPath[path] ? specifyingPath[path] : path.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
348
+ return queryString ? `${convertedPath}?${queryString}` : convertedPath
352
349
  }
353
350
 
354
351
  _checkToken(req) {