@jetthai/cuora 1.1.463-dev.0 → 1.1.463-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,15 @@
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.463-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.463-dev.1...v1.1.463-dev.2) (2026-08-16)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **deposit:** 切換存款活動不再重設使用者已選的通道 ([b9c1de2](https://github.com/jetthai/cuora-module/commit/b9c1de2f3665c56f52d7b074e892837e836d02fa))
11
+
12
+ ### [1.1.463-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.463-dev.0...v1.1.463-dev.1) (2026-08-13)
13
+
5
14
  ### [1.1.463-dev.0](https://github.com/jetthai/cuora-module/compare/v1.1.463...v1.1.463-dev.0) (2026-08-13)
6
15
 
7
16
  ### [1.1.455-dev.8](https://github.com/jetthai/cuora-module/compare/v1.1.455...v1.1.455-dev.8) (2026-08-09)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.463-dev.0",
3
+ "version": "1.1.463-dev.2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -475,8 +475,8 @@ export default function (request) {
475
475
  const hasExplicitAc = !!event.data && Object.prototype.hasOwnProperty.call(event.data, 'ac')
476
476
  const acRead = readParamFromLocation(AC_KEYS)
477
477
  const affiliateCode = hasExplicitAc ? normalize(event.data.ac) : acRead.value
478
- // 尾綴 undefined 是刻意的:全空時維持原本序列化成 fc=undefined 的行為,不改為 fc=null
479
- const friendCode = fc || readParamFromLocation(FC_KEYS).value || undefined
478
+ // 宿主可能傳進字面 'undefined',先 normalize 才不會蓋掉網址/儲存層的真值
479
+ const friendCode = normalize(fc) || readParamFromLocation(FC_KEYS).value
480
480
 
481
481
  // 本段結尾以 window.location.href 離站,離站後 SPA 記憶體全丟;導頁前先落地雙寫
482
482
  writeParam('ac', affiliateCode, { sentry })
@@ -496,30 +496,24 @@ export default function (request) {
496
496
 
497
497
  sentry?.captureMessage(`[Auth] RedirectTo3Party Data: ${JSON.stringify(messages)}`, { level: 'info' })
498
498
 
499
- const referralObj = {}
500
- if (![undefined, 'undefined', null, 'null'].includes(affiliateCode)) {
501
- referralObj.ac = affiliateCode
502
- }
503
-
504
- if (![undefined, 'undefined', null, 'null'].includes(nickname)) {
505
- referralObj.nick_name = nickname
506
- }
507
-
508
- if (![undefined, 'undefined', null, 'null'].includes(phone)) {
509
- referralObj.phone = phone
510
- }
511
-
512
- if (![undefined, 'undefined', null, 'null'].includes(countryCode)) {
513
- referralObj.countryCode = countryCode
514
- }
515
-
516
- if (![undefined, 'undefined', null, 'null'].includes(email)) {
517
- referralObj.email = email
518
- }
519
-
520
- if (![undefined, 'undefined', null, 'null'].includes(birthday)) {
521
- referralObj.birthday = birthday
522
- }
499
+ // 空值一律不進 query。dt 與 fc 原本裸展開進 URLSearchParams,兩者為 undefined 時會被
500
+ // 序列化成字面字串 dt=undefined / fc=undefined,後端收到的是 "undefined" 而非缺省
501
+ const query = pickBy(
502
+ {
503
+ provider,
504
+ redirectURI: `${window.location.protocol}//${window.location.host}${context.base}`,
505
+ ac: affiliateCode,
506
+ nick_name: nickname,
507
+ phone,
508
+ countryCode,
509
+ email,
510
+ birthday,
511
+ dt,
512
+ platform: 'pwa',
513
+ fc: friendCode,
514
+ },
515
+ (value) => normalize(value) !== null
516
+ )
523
517
 
524
518
  storage.remove('tp_phone')
525
519
  storage.remove('tp_countryCode')
@@ -528,18 +522,7 @@ export default function (request) {
528
522
 
529
523
  const fullURL = request.config.fullURL
530
524
 
531
- const redirectURL = urljoin(
532
- fullURL,
533
- 'login?' +
534
- new URLSearchParams({
535
- provider,
536
- redirectURI: `${window.location.protocol}//${window.location.host}${context.base}`,
537
- ...referralObj,
538
- dt,
539
- platform: 'pwa',
540
- fc: friendCode,
541
- }).toString()
542
- )
525
+ const redirectURL = urljoin(fullURL, 'login?' + new URLSearchParams(query).toString())
543
526
 
544
527
  window.location.href = redirectURL
545
528
  },
@@ -109,14 +109,11 @@ export default function (request, context) {
109
109
  }
110
110
  }),
111
111
  setPromotion: assign((context, event) => {
112
- const promotion = event.data
113
- const loadcards = context.loadcards
114
- const selectedLoadcard = loadcards[0]
112
+ // 通道清單不隨活動改變(loadcards 由 setInitData 從 paymentDetail 產生),
113
+ // 因此切換活動只清計算結果、保留使用者已選的通道;重設成 loadcards[0] 會讓
114
+ // 使用者選的通道被打回第一個,且重算的是錯誤通道的獎金
115
115
  return {
116
- promotion,
117
- loadcards,
118
- selectedLoadcard,
119
- options: selectedLoadcard?.optional,
116
+ promotion: event.data,
120
117
  calculation: null,
121
118
  }
122
119
  }),
@@ -121,14 +121,11 @@ export default function (request, context) {
121
121
  }
122
122
  }),
123
123
  setPromotion: assign((context, event) => {
124
- const promotion = event.data
125
- const qrcodes = context.qrcodes
126
- const selectedQrcode = qrcodes[0]
124
+ // 通道清單不隨活動改變(qrcodes 由 setInitData 從 paymentDetail 產生),
125
+ // 因此切換活動只清計算結果、保留使用者已選的通道;重設成 qrcodes[0] 會讓
126
+ // 使用者選的通道被打回第一個,且重算的是錯誤通道的獎金
127
127
  return {
128
- promotion,
129
- qrcodes,
130
- selectedQrcode,
131
- options: selectedQrcode?.optional,
128
+ promotion: event.data,
132
129
  calculation: null,
133
130
  }
134
131
  }),
@@ -84,7 +84,8 @@ export default function (request) {
84
84
  }),
85
85
  setFriendCode: assign((context, event) => {
86
86
  const { fc } = event.data
87
- return { fc }
87
+ // api/auth.js 的 register 只濾 undefined/null,字面 'undefined' 會直送 query string
88
+ return { fc: normalize(fc) }
88
89
  }),
89
90
  setSignUpId: assign((context, event) => {
90
91
  const {
@@ -222,7 +223,7 @@ export default function (request) {
222
223
  ...referralObj,
223
224
  dt,
224
225
  reCaptchaToken: context.reCaptchaToken,
225
- fc: context.fc || readParamFromLocation(FC_KEYS).value || undefined,
226
+ fc: context.fc || readParamFromLocation(FC_KEYS).value,
226
227
  })
227
228
  )
228
229
  },