@jetthai/cuora 1.1.465-dev.2 → 1.1.465-dev.4
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 +14 -0
- package/package.json +1 -1
- package/scripts/branch-auto-npm-publish.js +9 -2
- package/src/machine/auth.js +21 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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.465-dev.4](https://github.com/jetthai/cuora-module/compare/v1.1.465-dev.3...v1.1.465-dev.4) (2026-08-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **auth:** 清除站台已停用登入方式殘留的記住帳號 ([2c6b965](https://github.com/jetthai/cuora-module/commit/2c6b96572108cfc977d7dc99635adebbee01db46))
|
|
11
|
+
|
|
12
|
+
### [1.1.465-dev.3](https://github.com/jetthai/cuora-module/compare/v1.1.465-dev.2...v1.1.465-dev.3) (2026-08-19)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **release:** 拆分 branch/tag push 避免 tag 衝突導致 npm publish 被跳過 ([f2c4baa](https://github.com/jetthai/cuora-module/commit/f2c4baa7de0bfe50b6b0c70c5a2ed8749116d72a))
|
|
18
|
+
|
|
5
19
|
### [1.1.465-dev.2](https://github.com/jetthai/cuora-module/compare/v1.1.465-dev.1...v1.1.465-dev.2) (2026-08-19)
|
|
6
20
|
|
|
7
21
|
### [1.1.465-dev.1](https://github.com/jetthai/cuora-module/compare/v1.1.465-dev.0...v1.1.465-dev.1) (2026-08-19)
|
package/package.json
CHANGED
|
@@ -14,8 +14,15 @@ const { version } = JSON.parse(readFileSync('package.json', 'utf8'))
|
|
|
14
14
|
console.log(`Branch: ${branch}`)
|
|
15
15
|
console.log(`Version: ${version}`)
|
|
16
16
|
|
|
17
|
-
// 推送 commit
|
|
18
|
-
execSync(`git push --no-verify
|
|
17
|
+
// 推送 commit 到遠端(--no-verify 避免觸發 pre-push hook 造成無限迴圈)
|
|
18
|
+
execSync(`git push --no-verify ${remote} ${branch}`, { stdio: 'inherit' })
|
|
19
|
+
|
|
20
|
+
// 單獨推送 tag;tag 已存在於 remote 時視為成功(不中斷 npm publish)
|
|
21
|
+
try {
|
|
22
|
+
execSync(`git push --no-verify ${remote} refs/tags/v${version}`, { stdio: 'inherit' })
|
|
23
|
+
} catch {
|
|
24
|
+
console.warn(`⚠ tag v${version} push 失敗(可能已存在),繼續 npm publish`)
|
|
25
|
+
}
|
|
19
26
|
|
|
20
27
|
// 發布到 npm,使用分支名稱作為 dist-tag(例如 npm install @jetthai/cuora@dev)
|
|
21
28
|
try {
|
package/src/machine/auth.js
CHANGED
|
@@ -15,6 +15,13 @@ export default function (request) {
|
|
|
15
15
|
const accountPhoneKey = 'account_phone'
|
|
16
16
|
const accountEmailKey = 'account_email'
|
|
17
17
|
const accountUsernameKey = 'account_username'
|
|
18
|
+
// loginMethods 的鍵 → setAccount 寫入的 storage key。
|
|
19
|
+
// LOGIN_ID 與 LOGIN_LOCAL 都寫 accountUsernameKey,兩者在 loginMethods 都算 'local',此對照無法由 key 名反推。
|
|
20
|
+
const rememberedAccountKeys = [
|
|
21
|
+
['local', accountUsernameKey],
|
|
22
|
+
['phone', accountPhoneKey],
|
|
23
|
+
['email', accountEmailKey],
|
|
24
|
+
]
|
|
18
25
|
|
|
19
26
|
return createMachine(
|
|
20
27
|
{
|
|
@@ -47,7 +54,7 @@ export default function (request) {
|
|
|
47
54
|
src: 'fetchSiteConfig',
|
|
48
55
|
onDone: {
|
|
49
56
|
target: 'idle',
|
|
50
|
-
actions: 'setSiteConfig',
|
|
57
|
+
actions: ['setSiteConfig', 'pruneRememberedAccounts'],
|
|
51
58
|
},
|
|
52
59
|
onError: {
|
|
53
60
|
target: 'idle',
|
|
@@ -341,6 +348,19 @@ export default function (request) {
|
|
|
341
348
|
siteConfig: { ...event.data, loginMethods: pickBy(loginMethods), registerMethods: pickBy(registerMethods) },
|
|
342
349
|
}
|
|
343
350
|
}),
|
|
351
|
+
// setAccount 寫入的帳號 TTL 是 31 天,且只互斥清除另外兩支 key,
|
|
352
|
+
// 後台關掉某種登入方式後殘值仍在,下游會把它回填進已改型別的輸入框(例如把 email 填進 phone-only 站台)。
|
|
353
|
+
// 非 assign action,故取得的是 setSiteConfig 套用後的 context。
|
|
354
|
+
pruneRememberedAccounts: (context) => {
|
|
355
|
+
// fetchSiteConfig 失敗會走 onError 不進到這裡;此處防的是回傳成功但 loginMethods 整包缺失,避免誤清全部記住的帳號。
|
|
356
|
+
const enabledMethods = context.siteConfig?.loginMethods
|
|
357
|
+
if (!enabledMethods || !Object.keys(enabledMethods).length) return
|
|
358
|
+
rememberedAccountKeys.forEach(([method, key]) => {
|
|
359
|
+
if (enabledMethods[method]) return
|
|
360
|
+
storage.remove(key)
|
|
361
|
+
if (method === 'phone') storage.remove(phoneCountryCode)
|
|
362
|
+
})
|
|
363
|
+
},
|
|
344
364
|
setReCaptchaToken: assign((context, event) => {
|
|
345
365
|
const { reCaptchaToken } = event.data
|
|
346
366
|
return {
|