diff --git a/.changeset/config.json b/.changeset/config.json index 2d697a21..4a2f756e 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -23,6 +23,7 @@ "baseBranch": "main", "updateInternalDependencies": "patch", "ignore": [ + "@devslab-kr/dds-auth", "@devslab/compatibility-canary", "@devslab/react-canary" ] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2684763e..ed33435c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,6 +59,9 @@ jobs: - run: pnpm run verify:react:test - run: pnpm run verify:react:browser - run: pnpm run verify:react:release + - run: pnpm run verify:auth:test + - run: pnpm run verify:auth:browser + - run: pnpm run verify:auth:release - run: pnpm run verify:table-react:test - run: pnpm run verify:table-react:browser - run: pnpm run verify:table-react:release diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2d9c1a5e..86efb3ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,8 +11,8 @@ # # 2. No unconsumed changesets (the release PR was just merged, or a # version was bumped by hand) → the action runs `pnpm release`, which -# is `changeset publish`: every package whose version is not yet on -# npm is published, and a git tag per package is pushed. Versions +# runs `changeset publish` for the public npm packages. New versions +# are published, and a git tag per package is pushed. Versions # already on npm are skipped, so re-runs are safe. # # The publish only happens after the full verification gate below — the @@ -75,6 +75,9 @@ jobs: - run: pnpm run verify:react:test - run: pnpm run verify:react:browser - run: pnpm run verify:react:release + - run: pnpm run verify:auth:test + - run: pnpm run verify:auth:browser + - run: pnpm run verify:auth:release - run: pnpm run verify:table-react:test - run: pnpm run verify:table-react:browser - run: pnpm run verify:table-react:release diff --git a/README.ko.md b/README.ko.md index 54e5b46a..6308fa23 100644 --- a/README.ko.md +++ b/README.ko.md @@ -120,7 +120,7 @@ Source-Available License 1.0을 따른다. compatibility canary는 비공개· 때만 만든다 (명세 §8): `@devslab/dds-tokens` (✅ 2026-08-13) → `dds-css` v1 인벤토리 (Core 6종 ✅ 2026-08-13, +13종 ✅ 2026-08-15) → AskLinq 적용 → `dds-icons` (✅ 2026-08-15) → `dds-solid` + `site-kit` → 안드로이드 네이티브 값·테마·모션 -(0.6.0, 2026-11-12, Maven Central — 테마·모션·부품·아이콘). 0.7.0(2026-11-13, Maven Central)에서 화면 틀과 `dds-compose-testing` 꾸러미가 생겼다(D-052). 0.8.0(2026-11-13)에서 `DdsSegmentedControl`이 생겼고, 0.8.1에서 어두운 화면의 고른 칸이 밝아졌고(`bg.raised`, D-054), 0.9.0에서 고른 면이 미끄러져 옮겨 가고(D-055), 0.9.1에서 앱이 그 속도를, 0.9.2에서 `DdsTheme`에 자기 글꼴을 넘길 수 있다. RN·Ionic 패키지는 그 제품이 생길 때. +(0.6.0, 2026-11-12, Maven Central — 테마·모션·부품·아이콘). 0.7.0(2026-11-13, Maven Central)에서 화면 틀과 `dds-compose-testing` 꾸러미가 생겼다(D-052). 0.8.0(2026-11-13)에서 `DdsSegmentedControl`이 생겼고, 0.8.1에서 어두운 화면의 고른 칸이 밝아졌고(`bg.raised`, D-054), 0.9.0에서 고른 면이 미끄러져 옮겨 가고(D-055), 0.9.1에서 앱이 그 속도를, 0.9.2에서 `DdsTheme`에 자기 글꼴을 넘길 수 있다. 0.10.0에서 `DdsSocialSignIn`과 로그인 제공자 로고가 추가됐다. RN·Ionic 패키지는 그 제품이 생길 때. ## 입력·선택·공유 달력 확장 diff --git a/README.md b/README.md index f3009afe..658d54de 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ Priorities live in [`docs/backlog.md`](docs/backlog.md). Packages are created only when a consumer exists (spec §8): `@devslab/dds-tokens` (✅ 2026-08-13) → `dds-css` v1 inventory (Core 6 ✅ 2026-08-13, +13 ✅ 2026-08-15) → AskLinq adoption → `dds-icons` (✅ 2026-08-15) → `dds-solid` + `site-kit` → native Android values, theme and motion -(0.6.0, 2026-11-12, on Maven Central — theme, motion, components, icons). 0.7.0 (2026-11-13, on Maven Central) adds the screen frame and the `dds-compose-testing` artifact (D-052). 0.8.0 (2026-11-13) adds `DdsSegmentedControl`, 0.8.1 its lighter chosen face in dark (`bg.raised`, D-054), 0.9.0 makes that face slide between choices (D-055), 0.9.1 lets an app set the slide speed, and 0.9.2 lets an app pass its own typeface to `DdsTheme`. RN and Ionic packages only when such a product exists. +(0.6.0, 2026-11-12, on Maven Central — theme, motion, components, icons). 0.7.0 (2026-11-13, on Maven Central) adds the screen frame and the `dds-compose-testing` artifact (D-052). 0.8.0 (2026-11-13) adds `DdsSegmentedControl`, 0.8.1 its lighter chosen face in dark (`bg.raised`, D-054), 0.9.0 makes that face slide between choices (D-055), 0.9.1 lets an app set the slide speed, and 0.9.2 lets an app pass its own typeface to `DdsTheme`. 0.10.0 adds `DdsSocialSignIn` with selectable providers and their marks. RN and Ionic packages only when such a product exists. ## Input, choice and shared calendar additions diff --git a/android/CHANGELOG.ko.md b/android/CHANGELOG.ko.md index 6534390a..4e298a1c 100644 --- a/android/CHANGELOG.ko.md +++ b/android/CHANGELOG.ko.md @@ -5,6 +5,14 @@ `kr.devslab:dds-android-tokens`, `kr.devslab:dds-compose`, 그리고 0.7.0부터 `kr.devslab:dds-compose-testing`은 한 버전을 쓰고, 웹 패키지와는 버전이 따로다(D-048). 릴리스는 `android-v<버전>` 태그로 낸다. +## 0.10.0 — 2026-11-15 + +**새로 생긴 것** + +- **`DdsSocialSignIn`**은 앱이 선택한 로그인 방법 중 처음 세 개를 보여주고 나머지는 시트에 담는다. + 웹 DDS Auth와 제공자 ID 17개를 공유하며 로고 13개를 제공한다. 앱에서 로고를 지정하고 인증과 세션을 처리한다. + 사용법은 [소셜 로그인 선택 UI](README.ko.md#소셜-로그인-선택-ui)에 있다. + ## 0.9.2 — 2026-11-13 **새로 생긴 것** diff --git a/android/CHANGELOG.md b/android/CHANGELOG.md index abcc5c9e..286602e6 100644 --- a/android/CHANGELOG.md +++ b/android/CHANGELOG.md @@ -5,6 +5,14 @@ `kr.devslab:dds-android-tokens`, `kr.devslab:dds-compose` and (from 0.7.0) `kr.devslab:dds-compose-testing` share one version, separate from the web packages (D-048). Releases are cut by an `android-v` tag. +## 0.10.0 — 2026-11-15 + +**New** + +- **`DdsSocialSignIn`** shows the app's first three sign-in methods and puts the rest in a sheet. + The 17 provider IDs match DDS Auth on the web. DDS ships 13 marks and accepts app-provided artwork. + The app handles authentication and sessions. See [Social sign-in options](README.md#social-sign-in-options). + ## 0.9.2 — 2026-11-13 **New** diff --git a/android/README.ko.md b/android/README.ko.md index c72200eb..e09283f7 100644 --- a/android/README.ko.md +++ b/android/README.ko.md @@ -26,8 +26,8 @@ dependencies { ```kotlin dependencies { - implementation("kr.devslab:dds-compose:0.9.2") - androidTestImplementation("kr.devslab:dds-compose-testing:0.9.2") + implementation("kr.devslab:dds-compose:0.10.0") + androidTestImplementation("kr.devslab:dds-compose-testing:0.10.0") } ``` @@ -72,6 +72,28 @@ Maven Central에 올라가기 전에는 로컬 저장소에서 받는다. mavenLocal { content { includeGroup("kr.devslab") } } ``` +## 소셜 로그인 선택 UI + +`DdsSocialSignIn`은 앱이 연결한 제공자를 전달받아 순서대로 표시한다. 처음 세 수단은 화면에 표시하고 나머지는 ‘다른 로그인 방법’ 시트에서 고를 수 있다. 앱은 각 버튼의 현지화된 문구를 지정한다. DDS가 제공자 로고를 표시하며 `DdsSignInMethod.icon`으로 앱의 에셋을 지정할 수 있다. 인증을 시작할 때 `onSelect`에서 선택한 제공자 ID를 받는다. + +```kotlin +DdsSocialSignIn( + methods = listOf( + DdsSignInMethod(DdsSocialProvider.Google, "Google로 계속하기"), + DdsSignInMethod(DdsSocialProvider.Kakao, "카카오 로그인"), + DdsSignInMethod(DdsSocialProvider.Naver, "네이버 로그인"), + DdsSignInMethod(DdsSocialProvider.Discord, "Discord로 로그인"), + ), + onSelect = { provider -> startSignIn(provider.id) }, +) +``` + +어떤 로그인 수단을 제공할지와 진행 상태는 호출 앱이 정한다. OAuth 설정, 계정 연결, 세션 저장은 해당 앱의 인증 계층이 처리한다. Android 컴포넌트의 공개 제공자 ID는 웹의 [`dds-auth`](../packages/dds-auth/README.ko.md) 카탈로그와 같다. + +Google, 카카오, 네이버, LINE, Microsoft, LinkedIn, GitHub, Discord, Figma, Notion, X, Slack, Zoom 로고를 함께 제공한다. GitLab은 기본으로 글자로 표시한다. Apple, Facebook, WeChat은 앱에서 해당 제공자의 승인된 에셋이나 전용 버튼을 사용할 수 있다. + +Android의 네이버 아이콘은 공식 배포본 `NAVER_login_KR/NAVER_login_Light_KR_green_icon_H56.png` 원본이다. 카카오, Microsoft, GitHub, Slack의 SVG는 원래 색을 유지한 채 PNG로 변환했다. 어두운 테마에서는 GitHub와 카카오 원본에 흰 배경을 받치고 X는 공식 흰색 로고를 사용한다. 공식 출처와 원본 체크섬은 [공통 제공자 에셋 출처 기록](../packages/dds-auth/assets/provenance.json)에서 확인할 수 있다. + ## 값을 바꿀 때 값은 여기서 고치지 않는다. `tokens/*.json`(네이티브 전용 값은 `tokens/native.json`)을 diff --git a/android/README.md b/android/README.md index 6f1a6db5..1c9f0339 100644 --- a/android/README.md +++ b/android/README.md @@ -26,8 +26,8 @@ dependencies { ```kotlin dependencies { - implementation("kr.devslab:dds-compose:0.9.2") - androidTestImplementation("kr.devslab:dds-compose-testing:0.9.2") + implementation("kr.devslab:dds-compose:0.10.0") + androidTestImplementation("kr.devslab:dds-compose-testing:0.10.0") } ``` @@ -72,6 +72,28 @@ Until the packages are on Maven Central, install them from the local repository: mavenLocal { content { includeGroup("kr.devslab") } } ``` +## Social sign-in options + +Pass the app's supported methods to `DdsSocialSignIn` in display order. It shows the first three and offers the remaining methods in a sheet. Each method takes a localized label. DDS draws the bundled brand mark by default, and `DdsSignInMethod.icon` accepts app-provided artwork. `onSelect` provides the public provider ID through the selected `DdsSocialProvider`. + +```kotlin +DdsSocialSignIn( + methods = listOf( + DdsSignInMethod(DdsSocialProvider.Google, "Continue with Google"), + DdsSignInMethod(DdsSocialProvider.Kakao, "Continue with Kakao"), + DdsSignInMethod(DdsSocialProvider.Naver, "Continue with Naver"), + DdsSignInMethod(DdsSocialProvider.Discord, "Continue with Discord"), + ), + onSelect = { provider -> startSignIn(provider.id) }, +) +``` + +The host controls availability and progress. Its auth layer configures OAuth, links identities, and stores sessions. The public provider IDs match the web [`dds-auth`](../packages/dds-auth/README.md) catalog. + +The bundled assets cover Google, Kakao, Naver, LINE, Microsoft, LinkedIn, GitHub, Discord, Figma, Notion, X, Slack, and Zoom. GitLab uses text by default. Apps can supply approved artwork or a dedicated provider button for Apple, Facebook, and WeChat. + +Android uses the original full Naver green icon from `NAVER_login_KR/NAVER_login_Light_KR_green_icon_H56.png`. SVG marks from Kakao, Microsoft, GitHub, and Slack are rasterized with their original colors. The dark variants keep the original GitHub and Kakao marks on a white backing and use X’s white artwork. For the official sources and original checksums, see the [shared provider asset provenance](../packages/dds-auth/assets/provenance.json). + ## Changing a value Values are not edited here. Change `tokens/*.json` (native-only values live in diff --git a/android/catalog/src/main/kotlin/kr/devslab/dds/catalog/Pages.kt b/android/catalog/src/main/kotlin/kr/devslab/dds/catalog/Pages.kt index 5da31d2d..cd239509 100644 --- a/android/catalog/src/main/kotlin/kr/devslab/dds/catalog/Pages.kt +++ b/android/catalog/src/main/kotlin/kr/devslab/dds/catalog/Pages.kt @@ -59,6 +59,9 @@ import kr.devslab.dds.compose.component.DdsMenuDivider import kr.devslab.dds.compose.component.DdsMenuItem import kr.devslab.dds.compose.component.DdsSearchField import kr.devslab.dds.compose.component.DdsSelectField +import kr.devslab.dds.compose.component.DdsSignInMethod +import kr.devslab.dds.compose.component.DdsSocialProvider +import kr.devslab.dds.compose.component.DdsSocialSignIn import kr.devslab.dds.compose.component.DdsSegment import kr.devslab.dds.compose.component.DdsSegmentedControl import kr.devslab.dds.compose.component.DdsTabs @@ -349,9 +352,36 @@ fun PartsPage() { var period by rememberSaveable { mutableStateOf("week") } var menu by remember { mutableStateOf(false) } var sheet by rememberSaveable { mutableStateOf(false) } + var lastSignInMethod by rememberSaveable { mutableStateOf(null) } val toasts = remember { SnackbarHostState() } val scope = rememberCoroutineScope() PageBody { + DdsSection("Sign-in methods", description = "An app chooses the providers, their order and their labels.") { + DdsSocialSignIn( + methods = listOf( + DdsSignInMethod(DdsSocialProvider.Google, "Google로 계속하기"), + DdsSignInMethod(DdsSocialProvider.Kakao, "카카오 로그인"), + DdsSignInMethod(DdsSocialProvider.Naver, "네이버 로그인"), + DdsSignInMethod(DdsSocialProvider.Line, "LINE으로 로그인"), + DdsSignInMethod(DdsSocialProvider.Microsoft, "Microsoft로 로그인"), + DdsSignInMethod(DdsSocialProvider.LinkedIn, "LinkedIn으로 로그인"), + DdsSignInMethod(DdsSocialProvider.Apple, "Apple로 로그인"), + DdsSignInMethod(DdsSocialProvider.Facebook, "Facebook으로 로그인"), + DdsSignInMethod(DdsSocialProvider.GitHub, "GitHub로 로그인"), + DdsSignInMethod(DdsSocialProvider.GitLab, "GitLab으로 로그인"), + DdsSignInMethod(DdsSocialProvider.Discord, "Discord로 로그인"), + DdsSignInMethod(DdsSocialProvider.Figma, "Figma로 로그인"), + DdsSignInMethod(DdsSocialProvider.Notion, "Notion으로 로그인"), + DdsSignInMethod(DdsSocialProvider.X, "X로 로그인"), + DdsSignInMethod(DdsSocialProvider.Slack, "Slack으로 로그인"), + DdsSignInMethod(DdsSocialProvider.Zoom, "Zoom으로 로그인"), + DdsSignInMethod(DdsSocialProvider.WeChat, "WeChat으로 로그인"), + ), + onSelect = { lastSignInMethod = it.id }, + gutter = 0.dp, + ) + lastSignInMethod?.let { Text("Selected provider: $it", style = DdsTheme.typography.body2) } + } DdsSection("Buttons", description = "One height (48). Loading keeps the size.") { DdsCard { Column(verticalArrangement = Arrangement.spacedBy(DdsSpace.s12.dp)) { diff --git a/android/dds-compose/src/androidTest/kotlin/kr/devslab/dds/compose/ScreenReaderTest.kt b/android/dds-compose/src/androidTest/kotlin/kr/devslab/dds/compose/ScreenReaderTest.kt index 955bb0d9..78d3c6bf 100644 --- a/android/dds-compose/src/androidTest/kotlin/kr/devslab/dds/compose/ScreenReaderTest.kt +++ b/android/dds-compose/src/androidTest/kotlin/kr/devslab/dds/compose/ScreenReaderTest.kt @@ -35,6 +35,7 @@ import androidx.compose.ui.test.onNodeWithTag import androidx.compose.ui.platform.testTag import androidx.compose.ui.test.assertCountEquals import androidx.compose.ui.test.assertIsEnabled +import androidx.compose.ui.test.assertIsNotEnabled import androidx.compose.ui.test.assertIsFocused import androidx.compose.ui.test.assertIsOn import androidx.compose.ui.test.hasContentDescription @@ -65,6 +66,9 @@ import kr.devslab.dds.compose.layout.DdsCenteredColumn import kr.devslab.dds.compose.layout.DdsCenteredTitle import kr.devslab.dds.compose.component.DdsSearchField import kr.devslab.dds.compose.component.DdsSelectField +import kr.devslab.dds.compose.component.DdsSignInMethod +import kr.devslab.dds.compose.component.DdsSocialProvider +import kr.devslab.dds.compose.component.DdsSocialSignIn import kr.devslab.dds.compose.component.DdsTabs import kr.devslab.dds.compose.component.DdsTextField import kr.devslab.dds.compose.component.DdsTone @@ -95,6 +99,36 @@ class ScreenReaderTest { private fun show(content: @Composable () -> Unit) = rule.setContent { DdsTheme { content() } } + @Test + fun additionalSignInMethodsKeepTheirLabelsAndCannotRestartPendingAuth() { + var selected: DdsSocialProvider? by mutableStateOf(null) + val attempts = mutableListOf() + show { + DdsSocialSignIn( + methods = listOf( + DdsSignInMethod(DdsSocialProvider.Google, "Google로 로그인"), + DdsSignInMethod(DdsSocialProvider.Kakao, "카카오 로그인"), + DdsSignInMethod(DdsSocialProvider.Naver, "네이버 로그인"), + DdsSignInMethod(DdsSocialProvider.Discord, "Discord로 로그인"), + DdsSignInMethod(DdsSocialProvider.Zoom, "Zoom으로 로그인", enabled = false), + ), + pending = selected, + moreLabel = "다른 로그인 방법", + closeLabel = "선택 닫기", + onSelect = { attempts.add(it); selected = it }, + ) + } + rule.onNodeWithText("Discord로 로그인").assertDoesNotExist() + rule.onNodeWithText("다른 로그인 방법").performClick() + rule.onNode(hasText("다른 로그인 방법") and keyIsDefined(SemanticsProperties.Heading)).assertExists() + rule.onNodeWithText("Zoom으로 로그인").assertIsNotEnabled() + rule.onNodeWithText("Discord로 로그인").performClick().performClick() + rule.runOnIdle { assertEquals(listOf(DdsSocialProvider.Discord), attempts) } + rule.onNodeWithContentDescription("선택 닫기").performClick() + rule.onNodeWithText("Discord로 로그인").assertDoesNotExist() + rule.onNodeWithText("다른 로그인 방법").assertIsNotEnabled() + } + // --- text field --------------------------------------------------------- @Test diff --git a/android/dds-compose/src/main/kotlin/kr/devslab/dds/compose/component/Auth.kt b/android/dds-compose/src/main/kotlin/kr/devslab/dds/compose/component/Auth.kt new file mode 100644 index 00000000..7012b6db --- /dev/null +++ b/android/dds-compose/src/main/kotlin/kr/devslab/dds/compose/component/Auth.kt @@ -0,0 +1,224 @@ +package kr.devslab.dds.compose.component + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.BoxWithConstraints +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.only +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.widthIn +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll +import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.saveable.rememberSaveable +import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.luminance +import androidx.compose.ui.platform.LocalDensity +import androidx.compose.ui.platform.LocalWindowInfo +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.clearAndSetSemantics +import androidx.compose.ui.semantics.heading +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import kr.devslab.dds.compose.R +import kr.devslab.dds.compose.icons.DdsIcons +import kr.devslab.dds.compose.layout.ddsFrame +import kr.devslab.dds.compose.layout.gutter +import kr.devslab.dds.compose.theme.DdsTheme +import kr.devslab.dds.tokens.DdsIcon +import kr.devslab.dds.tokens.DdsScreen +import kr.devslab.dds.tokens.DdsSpace +import kr.devslab.dds.tokens.DdsTouch + +/** Public IDs shared with DDS Auth on the web. Provider-specific OAuth IDs belong to the app. */ +public enum class DdsSocialProvider(public val id: String) { + Google("google"), + Kakao("kakao"), + Naver("naver"), + Line("line"), + Microsoft("microsoft"), + LinkedIn("linkedin"), + Apple("apple"), + Facebook("facebook"), + GitHub("github"), + GitLab("gitlab"), + Discord("discord"), + Figma("figma"), + Notion("notion"), + X("x"), + Slack("slack"), + Zoom("zoom"), + WeChat("wechat"), +} + +/** + * A sign-in option configured by the app, with a localized [label]. + * [icon] replaces the bundled decorative mark where an app uses its own approved artwork. + */ +public class DdsSignInMethod( + public val provider: DdsSocialProvider, + public val label: String, + public val enabled: Boolean = true, + public val icon: (@Composable () -> Unit)? = null, +) + +/** + * Shows the app's [methods] in order. The first three appear inline and the rest open in a sheet. + * An empty list shows nothing. The first entry for each provider wins if the list contains duplicates. + * + * Apply this to the available screen width. It provides DDS screen gutters and uses the same + * measured column width in both placements. A containing column that already applies gutters can + * pass `gutter = 0.dp` to use its available width. + * + * [onSelect] reports the requested method. The caller configures providers, starts authentication, + * handles errors and sessions, and supplies [pending] while authenticating. A pending method retains + * its geometry and ignores repeat clicks. Other methods are unavailable until it finishes. + */ +@Composable +public fun DdsSocialSignIn( + methods: List, + onSelect: (DdsSocialProvider) -> Unit, + modifier: Modifier = Modifier, + pending: DdsSocialProvider? = null, + moreLabel: String = stringResource(R.string.dds_auth_more_methods), + closeLabel: String = stringResource(R.string.dds_auth_close_methods), + gutter: Dp = ddsFrame().width.gutter, +) { + if (methods.isEmpty()) return + + val ordered = methods.distinctBy { it.provider } + val primary = ordered.take(3) + val additional = ordered.drop(3) + BoxWithConstraints( + modifier.fillMaxWidth().padding(horizontal = gutter), + contentAlignment = Alignment.TopCenter, + ) { + val buttonWidth = minOf(maxWidth, DdsScreen.centeredMax.dp) + Column( + Modifier.widthIn(max = buttonWidth).fillMaxWidth(), + verticalArrangement = Arrangement.spacedBy(DdsSpace.s12.dp), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + primary.forEach { SignInButton(it, pending, onSelect) } + if (additional.isNotEmpty()) { + var showMore by rememberSaveable { mutableStateOf(false) } + DdsButton(moreLabel, onClick = { showMore = true }, enabled = pending == null, variant = DdsButtonVariant.Plain) + if (showMore) { + SignInSheet(moreLabel, closeLabel, buttonWidth, gutter, onDismiss = { showMore = false }) { + additional.forEach { SignInButton(it, pending, onSelect) } + } + } + } + } + } +} + +@Composable +private fun SignInButton(method: DdsSignInMethod, pending: DdsSocialProvider?, onSelect: (DdsSocialProvider) -> Unit) { + DdsButton( + onClick = { onSelect(method.provider) }, + modifier = Modifier.fillMaxWidth(), + variant = DdsButtonVariant.Secondary, + enabled = method.enabled && (pending == null || pending == method.provider), + loading = pending == method.provider, + ) { + Row( + Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.spacedBy(DdsSpace.s16.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + Box(Modifier.size(DdsIcon.sm.dp).clearAndSetSemantics { }, contentAlignment = Alignment.Center) { + if (method.icon != null) { + method.icon.invoke() + } else { + val mark = signedInMark(method.provider) + if (mark != null) Image(painterResource(mark), contentDescription = null, modifier = Modifier.size(DdsIcon.sm.dp)) + } + } + WordsText(method.label, Modifier.weight(1f), textAlign = TextAlign.Start) + } + } +} + +@Composable +private fun signedInMark(provider: DdsSocialProvider): Int? { + // DDS allows an app to force its theme independently of the device configuration. + val darkSurface = DdsTheme.colors.bgElevated.luminance() < DdsTheme.colors.textPrimary.luminance() + return when (provider) { + DdsSocialProvider.Google -> R.drawable.dds_auth_google + DdsSocialProvider.Kakao -> if (darkSurface) R.drawable.dds_auth_kakao_on_dark else R.drawable.dds_auth_kakao + DdsSocialProvider.Naver -> R.drawable.dds_auth_naver + DdsSocialProvider.Line -> R.drawable.dds_auth_line + DdsSocialProvider.Microsoft -> R.drawable.dds_auth_microsoft + DdsSocialProvider.LinkedIn -> R.drawable.dds_auth_linkedin + DdsSocialProvider.GitHub -> if (darkSurface) R.drawable.dds_auth_github_on_dark else R.drawable.dds_auth_github + DdsSocialProvider.Discord -> R.drawable.dds_auth_discord + DdsSocialProvider.Figma -> R.drawable.dds_auth_figma + DdsSocialProvider.Notion -> R.drawable.dds_auth_notion + DdsSocialProvider.X -> if (darkSurface) R.drawable.dds_auth_x_on_dark else R.drawable.dds_auth_x + DdsSocialProvider.Slack -> R.drawable.dds_auth_slack + DdsSocialProvider.Zoom -> R.drawable.dds_auth_zoom + DdsSocialProvider.Apple, DdsSocialProvider.Facebook, DdsSocialProvider.GitLab, DdsSocialProvider.WeChat -> null + } +} + +@Composable +private fun SignInSheet( + title: String, + closeLabel: String, + buttonWidth: Dp, + gutter: Dp, + onDismiss: () -> Unit, + content: @Composable () -> Unit, +) { + val density = LocalDensity.current + val windowHeight = with(density) { LocalWindowInfo.current.containerSize.height.toDp() } + val topInset = with(density) { WindowInsets.safeDrawing.getTop(this).toDp() } + val heightLimit = if (windowHeight > topInset + DdsSpace.s32.dp) { + Modifier.heightIn(max = windowHeight - topInset - DdsSpace.s32.dp) + } else { + Modifier + } + DdsBottomSheetSurface( + onDismissRequest = onDismiss, + // An offset-dependent top inset can change the height of a tall, scrollable sheet as it settles. + contentWindowInsets = { WindowInsets.safeDrawing.only(WindowInsetsSides.Bottom) }, + ) { + Column(Modifier.fillMaxWidth().then(heightLimit), horizontalAlignment = Alignment.CenterHorizontally) { + Row( + Modifier.fillMaxWidth().padding(horizontal = gutter), + verticalAlignment = Alignment.CenterVertically, + ) { + Spacer(Modifier.size(DdsTouch.min.dp)) + Box(Modifier.weight(1f), contentAlignment = Alignment.Center) { + WordsText(title, Modifier.semantics { heading() }, style = DdsTheme.typography.title3, textAlign = TextAlign.Center) + } + DdsIconButton(DdsIcons.Close, closeLabel, onClick = onDismiss) + } + Column( + Modifier.weight(1f, fill = false).verticalScroll(rememberScrollState()) + .padding(start = gutter, end = gutter, top = DdsSpace.s8.dp, bottom = DdsSpace.s16.dp) + .widthIn(max = buttonWidth).fillMaxWidth(), + verticalArrangement = Arrangement.spacedBy(DdsSpace.s12.dp), + ) { + content() + } + } + } +} diff --git a/android/dds-compose/src/main/kotlin/kr/devslab/dds/compose/component/Overlay.kt b/android/dds-compose/src/main/kotlin/kr/devslab/dds/compose/component/Overlay.kt index b08dfa3b..75ab5534 100644 --- a/android/dds-compose/src/main/kotlin/kr/devslab/dds/compose/component/Overlay.kt +++ b/android/dds-compose/src/main/kotlin/kr/devslab/dds/compose/component/Overlay.kt @@ -8,6 +8,7 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ColumnScope +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding @@ -17,6 +18,7 @@ import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.verticalScroll import androidx.compose.material3.DropdownMenu +import androidx.compose.material3.BottomSheetDefaults import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.HorizontalDivider @@ -60,6 +62,29 @@ public fun DdsBottomSheet( modifier: Modifier = Modifier, title: String? = null, content: @Composable ColumnScope.() -> Unit, +) { + DdsBottomSheetSurface(onDismissRequest, modifier) { + Column(Modifier.fillMaxWidth().verticalScroll(rememberScrollState()).navigationBarsPadding().padding(bottom = DdsSpace.s16.dp)) { + if (title != null) { + WordsText( + title, + Modifier.padding(horizontal = DdsSpace.s16.dp).padding(bottom = DdsSpace.s8.dp).semantics { heading() }, + style = DdsTheme.typography.title3, + color = DdsTheme.colors.textPrimary, + ) + } + content() + } + } +} + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +internal fun DdsBottomSheetSurface( + onDismissRequest: () -> Unit, + modifier: Modifier = Modifier, + contentWindowInsets: @Composable () -> WindowInsets = { BottomSheetDefaults.windowInsets }, + content: @Composable ColumnScope.() -> Unit, ) { val colors = DdsTheme.colors val handleWord = stringResource(R.string.dds_a11y_sheet_handle) @@ -72,6 +97,7 @@ public fun DdsBottomSheet( contentColor = colors.textPrimary, tonalElevation = 0.dp, scrimColor = colors.overlayDim, + contentWindowInsets = contentWindowInsets, dragHandle = { Box( Modifier @@ -85,19 +111,8 @@ public fun DdsBottomSheet( .semantics { contentDescription = handleWord }, ) }, - ) { - Column(Modifier.fillMaxWidth().verticalScroll(rememberScrollState()).navigationBarsPadding().padding(bottom = DdsSpace.s16.dp)) { - if (title != null) { - WordsText( - title, - Modifier.padding(horizontal = DdsSpace.s16.dp).padding(bottom = DdsSpace.s8.dp).semantics { heading() }, - style = DdsTheme.typography.title3, - color = colors.textPrimary, - ) - } - content() - } - } + content = content, + ) } /** Which edge of its button a [DdsMenu] lines up with. */ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_discord.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_discord.png new file mode 100644 index 00000000..6c5c6c95 Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_discord.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_figma.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_figma.png new file mode 100644 index 00000000..b374a5ec Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_figma.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_github.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_github.png new file mode 100644 index 00000000..c5fef8de Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_github.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_github_on_dark.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_github_on_dark.png new file mode 100644 index 00000000..bb249366 Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_github_on_dark.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_google.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_google.png new file mode 100644 index 00000000..cd6d16ac Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_google.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_kakao.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_kakao.png new file mode 100644 index 00000000..333561c1 Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_kakao.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_kakao_on_dark.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_kakao_on_dark.png new file mode 100644 index 00000000..ee355dc3 Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_kakao_on_dark.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_line.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_line.png new file mode 100644 index 00000000..6055c06c Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_line.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_linkedin.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_linkedin.png new file mode 100644 index 00000000..8bc2d53c Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_linkedin.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_microsoft.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_microsoft.png new file mode 100644 index 00000000..424649c1 Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_microsoft.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_naver.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_naver.png new file mode 100644 index 00000000..cf75ca47 Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_naver.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_notion.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_notion.png new file mode 100644 index 00000000..79a948e0 Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_notion.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_slack.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_slack.png new file mode 100644 index 00000000..1a82b6e2 Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_slack.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_x.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_x.png new file mode 100644 index 00000000..8ea803ad Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_x.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_x_on_dark.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_x_on_dark.png new file mode 100644 index 00000000..1b4857cc Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_x_on_dark.png differ diff --git a/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_zoom.png b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_zoom.png new file mode 100644 index 00000000..c992ea26 Binary files /dev/null and b/android/dds-compose/src/main/res/drawable-nodpi/dds_auth_zoom.png differ diff --git a/android/dds-compose/src/main/res/values-ko/dds_a11y.xml b/android/dds-compose/src/main/res/values-ko/dds_a11y.xml index 8b632ff2..816d75bc 100644 --- a/android/dds-compose/src/main/res/values-ko/dds_a11y.xml +++ b/android/dds-compose/src/main/res/values-ko/dds_a11y.xml @@ -7,4 +7,6 @@ 불러오는 중 시트 손잡이 뒤로 + 다른 로그인 방법 + 닫기 diff --git a/android/dds-compose/src/main/res/values/dds_a11y.xml b/android/dds-compose/src/main/res/values/dds_a11y.xml index 2a643a40..291d5ddf 100644 --- a/android/dds-compose/src/main/res/values/dds_a11y.xml +++ b/android/dds-compose/src/main/res/values/dds_a11y.xml @@ -9,4 +9,6 @@ Loading Drag handle Back + Other sign-in methods + Close diff --git a/android/dds-compose/src/main/resources/META-INF/licenses/DDS-Auth-GitHub-Octicons-MIT.txt b/android/dds-compose/src/main/resources/META-INF/licenses/DDS-Auth-GitHub-Octicons-MIT.txt new file mode 100644 index 00000000..aa1fa80e --- /dev/null +++ b/android/dds-compose/src/main/resources/META-INF/licenses/DDS-Auth-GitHub-Octicons-MIT.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 GitHub Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/android/gradle.properties b/android/gradle.properties index f1bbb71a..a82e98f2 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -8,4 +8,4 @@ kotlin.code.style=official # Android releases are versioned apart from the web packages (docs/decisions.md D-048). # The release workflow overrides VERSION_NAME from the android-v* tag. GROUP=kr.devslab -VERSION_NAME=0.9.2 +VERSION_NAME=0.10.0 diff --git a/package.json b/package.json index 8138042e..29e4d369 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "verify:site-kit:release": "pnpm run verify:foundation:core && pnpm --filter @devslab/dds-solid run build && pnpm --filter @devslab/site-kit run build && node scripts/verify-site-kit-release.mjs", "changeset": "changeset", "version-packages": "changeset version && pnpm install --lockfile-only", - "release": "changeset publish", + "release": "node scripts/publish-public-packages.mjs", "verify:react:test": "node --test tests/react-packages-contracts.test.mjs && pnpm --filter @devslab/dds-react run test && pnpm --filter @devslab/dds-react run check && pnpm --filter @devslab/dds-react run build", "verify:react:a11y": "pnpm --filter @devslab/dds-react run test:a11y", "verify:react:browser": "pnpm --filter @devslab/dds-react run build && pnpm --filter @devslab/dds-table-react run build && pnpm --filter @devslab/react-canary run build && playwright test --config playwright.react.config.ts --grep \"ui \"", @@ -45,6 +45,9 @@ "verify:table-solid:a11y": "pnpm --filter @devslab/dds-table-solid run test:a11y", "verify:table-solid:release": "pnpm run verify:foundation:core && pnpm --filter @devslab/dds-table-solid run build && pnpm --filter @devslab/dds-table run build && node scripts/verify-table-release.mjs", "verify:components": "node --test tests/component-entries.test.mjs && playwright test --config playwright.components.config.ts", + "verify:auth:test": "pnpm --filter @devslab/dds-react... run build && pnpm --filter @devslab-kr/dds-auth run check && pnpm --filter @devslab-kr/dds-auth run test", + "verify:auth:browser": "pnpm --filter @devslab-kr/dds-auth run build && playwright test --config playwright.auth.config.ts", + "verify:auth:release": "pnpm --filter @devslab-kr/dds-auth run build && pnpm --filter @devslab-kr/dds-auth run verify:consumer", "verify:vue:test": "pnpm --filter @devslab/dds-vue run check && pnpm --filter @devslab/dds-vue run test", "verify:vue:release": "pnpm --filter @devslab/dds-vue run build && node scripts/verify-vue-release.mjs", "verify:table-vue:test": "pnpm --filter @devslab/dds-table-vue run check && pnpm --filter @devslab/dds-table-vue run test", diff --git a/packages/dds-auth/LICENSE b/packages/dds-auth/LICENSE new file mode 100644 index 00000000..6ee9f10a --- /dev/null +++ b/packages/dds-auth/LICENSE @@ -0,0 +1,74 @@ +DevsLab Source-Available License 1.0 + +Copyright (c) 2026 DevsLab. All rights reserved. + +This license governs the DDS software, design tokens, components, icons, +documentation, and other materials distributed with this license (the +"Software"). + +1. Permitted use + +Subject to this license, DevsLab grants you a limited, worldwide, +non-exclusive, non-transferable, revocable, royalty-free right to: + +- download and install unmodified copies of the Software; +- use and execute the Software for internal or commercial applications; +- compile, minify, tree-shake, and bundle unmodified Software solely as a + technical part of building an application; and +- distribute the resulting object code only as an inseparable part of that + application and not as a standalone library, design system, component kit, + template, or asset collection. + +Normal application configuration through documented public APIs, design-token +overrides, CSS custom properties, and component properties is permitted and is +not considered modification of the Software. + +2. Restrictions + +Except where applicable law does not allow the restriction, you may not: + +- modify, adapt, translate, reverse engineer, or create derivative works of the + Software itself; +- publish, republish, sublicense, sell, rent, host, or redistribute the + Software or any modified version as a standalone package or downloadable + collection; +- use the Software or a substantial portion of it to create or operate a + competing general-purpose design system, UI kit, component library, icon + library, token library, template marketplace, or hosted equivalent; +- remove or alter copyright, license, attribution, or provenance notices; or +- use DevsLab names, logos, product marks, or trade dress except to make a + truthful statement that an application uses the Software. + +No patent, trademark, design, or branding rights are granted except the +copyright permissions stated in Section 1. + +3. Ownership and feedback + +The Software is licensed, not sold. DevsLab and its licensors retain all +right, title, and interest in the Software. You grant DevsLab a perpetual, +worldwide, irrevocable, royalty-free right to use feedback you voluntarily +provide about the Software. + +4. Termination + +This license terminates automatically if you breach it. Upon termination, you +must stop using and distributing the Software and delete all copies under your +control. Sections 2, 3, 5, and 6 survive termination. + +5. Disclaimer and limitation of liability + +THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE, TITLE, AND NON-INFRINGEMENT. TO THE MAXIMUM EXTENT PERMITTED BY LAW, +DEVSLAB WILL NOT BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, +CONSEQUENTIAL, EXEMPLARY, OR PUNITIVE DAMAGES, OR FOR LOSS OF DATA, PROFITS, +REVENUE, OR BUSINESS, ARISING FROM OR RELATED TO THE SOFTWARE. + +6. Governing law + +This license is governed by the laws of the Republic of Korea, excluding +conflict-of-law rules. The Seoul Central District Court has exclusive +jurisdiction over disputes arising from this license. + +This is a source-available license, not an open-source license approved by the +Open Source Initiative. diff --git a/packages/dds-auth/README.ko.md b/packages/dds-auth/README.ko.md new file mode 100644 index 00000000..8a1852c5 --- /dev/null +++ b/packages/dds-auth/README.ko.md @@ -0,0 +1,80 @@ +# DDS Auth + +소셜 로그인 공통 계약, 제어형 DDS React 로그인 버튼 목록, 서비스 설정형 로그인 영역을 제공합니다. 중앙 계정 서비스를 만들거나 세션 저장·OAuth 코드 교환·이메일 기반 계정 자동 연결을 수행하지 않습니다. + +## 설치 + +기존 공개 npm DDS 묶음과 별도로 GitHub Packages에서 배포합니다. 아래 제공자 카탈로그와 선택 설정을 쓰려면 0.2.0이 배포된 뒤 설치하세요. 사용자/프로젝트 `.npmrc`에 `@devslab-kr:registry=https://npm.pkg.github.com`을 설정하고 조직의 GitHub Packages 읽기 권한으로 인증합니다. 토큰을 저장소에 커밋하지 않습니다. DDS peer 패키지는 공개 npm에서 받습니다. + +```sh +npm install --save-exact @devslab-kr/dds-auth@0.2.0 +# /react 및 /styles.css 소비 앱에서만 필요한 선택 peer: +npm install --save-exact @devslab/dds-react@0.29.2 react@19.3.0 react-dom@19.3.0 +``` + +앱 잠금 파일을 유지합니다. 루트 진입점만 사용하는 서버/Workers는 React peer를 설치할 필요가 없습니다. 이 패키지는 Query·Form·공유 스토어·인증 SDK를 추가하지 않습니다. + +## 기존 앱 연결 + +`@devslab-kr/dds-auth/react`의 `SocialLoginOptions`는 제어형 표시 컴포넌트입니다. 앱의 기존 계정 화면 안에서 사용하고 Query mutation, 네이티브 로그인/취소, 동의·초대 확인, UUID/CAS, 최근 성공 제공자, 복구 링크는 유지합니다. 이 컴포넌트는 요청·이동·세션·타이머를 소유하지 않습니다. + +```tsx + `${label}로 로그인`} + providerIcons={officialProviderIcons} + providerBadge={(id) => + id === lastSuccessfulProvider ? 최근 사용 : null + } +/> +``` + +`buttonClassName(provider)`로 승인된 서비스별 제공자 스타일을 유지합니다. `providerHint`와 `unavailableReason` 설명은 `aria-describedby`로 버튼에 연결됩니다. `onButtonRef`는 앱의 포커스 복구를 지원합니다. 빠진·중복·잘못된 제공자 상태는 비활성 처리합니다. 로딩 중에는 모든 버튼이 비활성이며 로딩 알림과 오류는 앱이 소유합니다. + +## 서비스별 로그인 선택 + +`providerOrder`를 생략하면 기존처럼 Google·카카오·네이버와 앱이 전달하던 아이콘을 유지합니다. 더 많은 옵션을 쓰려면 `SOCIAL_PROVIDER_CATALOG`에서 Google, 카카오, 네이버, LINE, Microsoft, LinkedIn, Apple, Facebook, GitHub, GitLab, Discord, Figma, Notion, X, Slack, Zoom, WeChat 중 골라 표시 순서대로 전달하세요. + +```ts +const providerOrder = ["google", "github", "discord"] as const; +type ServiceProvider = (typeof providerOrder)[number]; +``` + +`SocialLoginOptions` 또는 `LoginPanel` 및 `createSocialAuthClient`에 동일한 `providerOrder`를 전달합니다. 서버 확인 결과는 `ProviderAvailability`로 전달합니다. 선택된 제공자의 설정이 없거나 잘못된 경우 버튼은 표시되지만 사용할 수 없습니다. 제품별 OAuth 자격 증명, 공급자 ID 변환, 콜백, 세션은 각 서비스 어댑터에서 설정합니다. [영문 예제](README.md#choose-providers-for-a-service)에 구체적인 사용법이 있습니다. + +`providerOrder`를 쓰면 `@devslab-kr/dds-auth/styles.css`가 확인된 로고를 불러옵니다. `providerIcons`로 로고를 교체하고 `null`로 숨길 수 있습니다. GitLab은 글자로 표시합니다. Apple·Facebook·WeChat은 승인된 아이콘이나 공식 버튼을 앱에서 제공합니다. 각 제공자의 공식 버튼 규칙을 따르세요. [로고 출처와 사용법](assets/README.md)을 참고하세요. + +## 로그인 영역 + +`LoginPanel`은 `brand`, `title`, `description`, `providers`, `client`, `returnTo`, `redirectOrigins`, `onRedirect`, `terms`, `privacy`를 받습니다. 전체 페이지가 아닌 재사용 영역입니다. 앱 자체 입력/동의 UI는 `children`으로 넣습니다. 약관 링크를 표시하는 행위로 동의를 추정하지 않습니다. 실제 전체 사용 예제는 [영문 가이드](README.md)의 Configurable login section을 참고합니다. + +제공자 상태는 `{id,status:'available'}` 또는 `{id,status:'unconfigured'|'disabled',reason:공개코드}`입니다. 선택된 제공자가 표시되고 명시적으로 확인된 available만 사용할 수 있습니다. client가 없으면 모두 비활성입니다. 서버/콘솔 설정이 누락된 제공자를 타입 지원만으로 연결 완료처럼 표시하지 않습니다. + +`providerIcons`로 바꿀 공식 이미지는 패키지 `assets`에서 앱 공개 경로로 복사하거나 번들러 URL import를 사용할 수 있습니다. 원본 URL·변환·SHA256은 `assets/provenance.json`에 기록했습니다. qoqo와 Qooroo에서 확인한 자산을 재사용하며 새 로고를 그리거나 색을 바꾸지 않았습니다. 자산 제공과 운영 설정 또는 브랜드 승인은 별개입니다. + +`returnTo`는 서비스 내부 경로이며 일반적인 검색어의 인코딩 공백/퍼센트는 보존합니다. `redirectOrigins`는 정확한 HTTP(S) origin 목록입니다. 잘못된 항목 하나라도 있으면 전체 목록을 거부합니다. 서버의 경로/매개변수/콜백 허용 목록 검증은 별도로 유지합니다. `intent:'link'`, `requestId`는 앱 소유 값을 그대로 전달하며 서버의 계정 연결 권한 검증을 대신하지 않습니다. + +한 번에 한 요청을 시작하고 자동 재시도하지 않습니다. 기본 15초(`timeoutMs`, 250~120000ms) 후 대기 UI를 중단하고 명시적인 재선택을 안내합니다. 시간 초과는 서버 작업이 없었다는 뜻이 아니므로 앱의 UUID·결과 불명 복구 규칙을 유지해야 합니다. 범위·제공자 준비 상태·허용 origin 변경과 언마운트 시 이전 작업을 취소하고 응답을 무시합니다. 이동 중 추가 클릭을 막지만 `onRedirect` 반환을 로그인 성공으로 간주하지 않습니다. + +`messages`로 기본 한국어 문구를 바꾸며 `loginMessagesKo`, `loginMessagesEn`을 제공합니다. `error`에는 공개 오류 enum만 넣습니다. raw OAuth 오류·토큰·임의 예외 문구를 표시하지 않습니다. `onAuthError`에도 정제된 결과만 전달합니다. `retryable:false`는 재선택 안내 버튼을 숨기며 이후 사용자의 명시적인 제공자 클릭까지 정책적으로 금지하지 않습니다. 차단이 필요하면 제공자 상태를 비활성으로 전달합니다. + +## 서버 어댑터·상태 경계 + +루트 진입점은 React/브라우저 import와 런타임 의존성이 없습니다. `createSocialAuthClient({endpoint,fetch,timeoutMs})`는 로컬 endpoint에 JSON POST 한 번만 전송하며 same-origin credential, no-store, `redirect:'error'`, abort를 적용합니다. 기본 응답은 `redirect/url` 또는 `error/code/retryable`입니다. 다른 기존 API 계약은 기존 앱 전송 함수를 `SocialAuthClient.start`로 연결합니다. 네트워크 예외는 앱에 전달하며 자체 시간 초과는 unavailable로 매핑합니다. + +`SocialAuthAdapter`의 providers/start/callback/session/signOut은 요청별 서버 계약입니다. 원래 `Response`를 보존해 Set-Cookie·캐시·상태 코드·리다이렉트를 유지합니다. Session은 앱 서버의 제네릭 값이며 LoginPanel props에 넣지 않습니다. 패키지는 제공자 SDK 구현이나 세션 저장소를 포함하지 않습니다. + +qoqo는 Supabase SSR cookie exchange, 봉인된 flow 쿠키, 정확한 복귀 경로/초대, Naver 프로필 확인, 계정 연결 UUID/CAS, 기기·사람·MFA 검증을 유지합니다. naver→custom:naver 변환은 어댑터 내부입니다. JN은 DB의 일회용 시도·PKCE·불투명 쿠키·암호화 BFF 세션과 회원/조직/계약 권한을 유지합니다. Accounts OIDC 기존 회원 이관은 별도 흐름입니다. 서비스 간 키·세션·권한 공유나 이메일만을 근거로 한 계정 연결을 추가하지 않습니다. + +앱은 CSRF/origin, PKCE/state/만료/일회성, 정확한 콜백·이동 허용 목록, HttpOnly/Secure 쿠키, 서버 권한, 로그아웃 폐기, UUID/CAS·결과 불명 복구를 소유합니다. `isSafeReturnTo`, `isSafeAuthRedirect`는 기본 방어이며 업무 허용 목록을 대체하지 않습니다. + +Next.js 앱의 서버 조회/변경은 TanStack Query, 업무 입력·동의 폼은 TanStack Form 경계를 유지합니다. LoginPanel의 대기/오류/이동 상태만 로컬 상태입니다. 공유 상태가 없어 Zustand/TanStack Store 신규 도입은 해당 없음입니다. 앱의 기존 선택과 요청/브라우저 격리·계정/회사/매장 키·로그아웃 폐기 규칙을 유지합니다. + +## 검증 + +패키지 `test`/`check`/`build`는 계약과 실제 사용자 동작을 검사합니다. `verify:consumer`는 추적되는 consumer fixture 안에 pack/install하고 공개 DDS 0.29.2 고정 소비, 타입, Node/worker import, 브라우저 없는 SSR, hydration DOM 유지와 오류 동작을 확인합니다. 임시 프로젝트를 만들지 않습니다. Playwright `playwright.auth.config.ts`는 `/login.html`의 명시적 어댑터 시뮬레이션에서 키보드·복구·로딩·설정 누락·반응형·양 테마·긴 문구·공식 자산·axe를 검사합니다. 실제 제공자 로그인이나 운영 콘솔 준비 완료 검증과 구분합니다. diff --git a/packages/dds-auth/README.md b/packages/dds-auth/README.md new file mode 100644 index 00000000..c1e77872 --- /dev/null +++ b/packages/dds-auth/README.md @@ -0,0 +1,136 @@ +# DDS Auth + +Provider-neutral sign-in contracts, a controlled DDS React provider list, and a configurable login section. This package does not operate a central account service, store sessions, exchange OAuth codes, merge identities or infer provider approval. + +## Install + +The package is distributed on GitHub Packages, separate from the public npm DDS release train. When 0.2.0 is published, install it to use the provider catalog and opt-in options described below. Configure your user/project `.npmrc` with `@devslab-kr:registry=https://npm.pkg.github.com`. Authenticate using your organization's GitHub Packages read access; keep tokens in a user configuration or secret environment, never a committed file. DDS peers continue to resolve from the public npm registry. + +```sh +npm install --save-exact @devslab-kr/dds-auth@0.2.0 +# For /react and /styles.css; headless-only users do not need these optional peers: +npm install --save-exact @devslab/dds-react@0.29.2 react@19.3.0 react-dom@19.3.0 +``` + +Keep the consumer lockfile. The package declares compatible DDS/React peer ranges; the example intentionally pins tested versions. No Query, Form, store or auth SDK dependency is installed by this package. + +## Existing applications: controlled provider UI + +Use `SocialLoginOptions` inside the product's existing account frame. It owns presentation only: no requests, timers, navigation or session state. Keep the application's Query mutation, native transport/cancel, invitation and legal checks, idempotency key, recently successful provider and account recovery flow. + +```tsx +import { SocialLoginOptions } from "@devslab-kr/dds-auth/react"; +import "@devslab-kr/dds-auth/styles.css"; + + `${label} sign in`} + providerIcons={officialProviderIcons} + providerBadge={(id) => + id === recentlySuccessfulProvider ? Recently used : null + } +/>; +``` + +`buttonClassName(provider)` preserves an application's approved provider styling. `providerHint(provider)` and `unavailableReason(provider)` add localized public explanations linked with `aria-describedby`. `onButtonRef(provider, element)` supports host-owned focus recovery. Missing, malformed or duplicate availability entries are disabled, including a missing Naver configuration. `available` must mean the service's actual verified configuration, not merely a supported TypeScript ID. If `loading` is true, all buttons are disabled and the root is busy; the host owns its loading announcement and errors. + +## Choose providers for a service + +Omitting `providerOrder` preserves the Google, Kakao and Naver options and caller-owned icons from 0.1.0. Opt in to the wider `SOCIAL_PROVIDER_CATALOG`: Google, Kakao, Naver, LINE, Microsoft, LinkedIn, Apple, Facebook, GitHub, GitLab, Discord, Figma, Notion, X, Slack, Zoom and WeChat. Pass only the IDs you intend to show, in the intended display order. Availability data alone does not add or activate any provider. An explicitly chosen provider without exactly one valid availability entry remains visible and disabled. + +```tsx +import { createSocialAuthClient, type ProviderAvailability } from "@devslab-kr/dds-auth"; +import { SocialLoginOptions } from "@devslab-kr/dds-auth/react"; +import "@devslab-kr/dds-auth/styles.css"; + +const providerOrder = ["google", "github", "discord"] as const; +type ServiceProvider = (typeof providerOrder)[number]; + +const client = createSocialAuthClient({ + endpoint: "/api/social/start", + fetch: (...args) => fetch(...args), + providerOrder, +}); + +export function ServiceOptions({ providers, start }: { + providers: readonly ProviderAvailability[]; + start: (provider: ServiceProvider) => void; +}) { + return ; +} +``` + +For `LoginPanel`, pass this same `providerOrder` and `client` together. The product adapter owns actual provider setup, wire IDs, application credentials, callback validation and sessions. The generic `SocialAuthAdapter` describes additional IDs at that boundary without changing legacy `SocialProvider`. + +With `providerOrder`, the stylesheet loads the packaged verified marks. `providerIcons` can replace a mark or suppress one with `null`. GitLab is text only; Apple, Facebook and WeChat require product-approved artwork or provider-specific controls. Use your own approved treatment when a provider requires a specific sign-in button. See [asset usage and provenance](assets/README.md). + +## Configurable login section + +`LoginPanel` supplies brand/title/description, the provider list, progress, bounded public errors, explicit retry selection and terms/privacy links. It is a section rather than a full page. `children` can hold app-owned credential/consent UI; the section never implies legal consent. + +```tsx +"use client"; +import { useState } from "react"; +import { createSocialAuthClient } from "@devslab-kr/dds-auth"; +import { LoginPanel } from "@devslab-kr/dds-auth/react"; +import "@devslab-kr/dds-auth/styles.css"; + +export function ServiceLogin({ providers }) { + const [client] = useState(() => + createSocialAuthClient({ + endpoint: "/api/social/start", + fetch: (...args) => fetch(...args), + timeoutMs: 15000, + }), + ); + return ( + + } + title="Sign in to your service" + providers={providers} + client={client} + returnTo="/account" + redirectOrigins={["https://your-auth-project.example"]} + onRedirect={(url) => window.location.assign(url)} + providerIcons={{ + google: , + kakao: , + naver: , + }} + terms={{ href: "/terms", label: "Terms of service" }} + privacy={{ href: "/privacy", label: "Privacy policy" }} + /> + ); +} +``` + +Copy the exported `assets/google-g.png`, `assets/kakao-symbol.svg` and `assets/naver-symbol.png` to the shown public paths, or use your bundler's asset URL import. Provenance/hashes and provider ownership are shipped in `assets/provenance.json` and `assets/README.md`. Preserve the provider's current branding rules; these files do not prove provider-console approval. A provider icon slot is decorative because the button already names the provider. No synthetic logos or data URIs are generated. Without icons, buttons use text labels. + +`providers` entries are `{id, status:'available'}` or `{id, status:'unconfigured'|'disabled', reason:publicCode}`. Each selected provider remains visible. A missing client disables all options. `returnTo` is a service-local path. `redirectOrigins` must contain only exact HTTP(S) origins; any malformed origin invalidates the configuration. The server must apply stricter path/parameter and callback checks. `intent:'link'` and `requestId` are passed through without generating a new key; server authorization still determines whether linking is allowed. Ordinary encoded query values, including spaces and literal percent characters, are preserved. + +`LoginPanel` starts at most one action at a time, bounds stalled custom adapters at 15 seconds (`timeoutMs`, clamped to 250–120000ms), aborts obsolete scope/provider/trust work, and blocks further actions during navigation. A timeout means the UI could not confirm the result, not that the server did nothing. The host must retain its idempotency/recovery rules before a deliberate subsequent attempt. `onRedirect` handles navigation; returning from it does not mark sign-in successful. A thrown adapter/provider message is never displayed. `error` accepts only a bounded callback code. `messages` replaces the Korean defaults (`loginMessagesKo`); `loginMessagesEn` is provided. `onAuthError` receives a sanitized failure. `retryable:false` hides the recovery button; it does not itself disable future deliberate provider selection. Supply disabled availability when policy requires a hard block. + +## Headless transport and server adapters + +The root entry has no React/browser import or runtime dependency. `createSocialAuthClient({endpoint, fetch, timeoutMs})` performs one same-origin credentialed, no-store JSON POST, sets `redirect:'error'`, forwards caller abort and returns `{status:'redirect',url}` or `{status:'error',code,retryable}`. It never retries. Network exceptions propagate to the host; its own timeout maps to `unavailable`. Existing APIs with different bodies/results should implement `SocialAuthClient.start` using their existing transport rather than changing endpoint contracts. + +`SocialAuthAdapter` is a request-scoped server contract with `providers`, `start`, `callback`, `session` and `signOut`. Start/callback/logout retain the original app `Response` so cookie headers, HTTP status, cache policy and redirects survive unchanged. `Session` is a generic app-owned server value, never a LoginPanel prop. This package provides a contract, not provider SDK implementations or session storage. + +For qoqo, an adapter retains `@supabase/ssr` cookie exchange, sealed flow, exact return path/invitation, Naver profile verification, identity linking UUID/CAS and device/human/MFA checks. Map public `naver` to `custom:naver` only inside that adapter. For JN, retain its one-time DB attempt/PKCE, opaque cookie, encrypted BFF session and user/organization/contract permissions. Its legacy Accounts OIDC migration remains a separate flow. No email-only account merging, shared keys, shared sessions or cross-service permissions are introduced. Naver remains unconfigured until each service's real server/console setup is verified. + +App adapters must preserve CSRF/origin checks, callback and redirect allowlists, PKCE/state/single-use expiry, HttpOnly/Secure cookies, server authorization, sign-out revocation, UUID/CAS and unknown-result recovery. Map provider errors to the public enum without copying raw provider descriptions, tokens or codes into UI logs. The basic `isSafeReturnTo` and `isSafeAuthRedirect` helpers supplement application allowlists; they do not replace them. + +## State and verification + +In Next.js consumers, Query owns provider/session queries and mutation orchestration, scoped to account/company/store as required and cleared on logout/scope change. TanStack Form owns app credential/consent inputs; this component has no business input form. Pending/error/navigation state in LoginPanel is local component state. Neither Zustand nor TanStack Store is needed for this isolated UI; do not introduce an account/session singleton. Shared UI state choices remain the application's documented Zustand/Store decision, preserving existing implementations and request/browser isolation. + +Taste review kept the existing title, provider list and legal link hierarchy. Polish checks the same icon slot across verified marks, legible marks in both themes, narrow widths, readable labels, keyboard focus, disabled buttons and unchanged accessible names. This component stays inside the product's existing sign-in layout. + +`pnpm --filter @devslab-kr/dds-auth test`, `check`, `build` cover contracts and user behavior. `verify:consumer` packs and installs into the tracked reusable `consumer` fixture, pins stable public DDS 0.29.2, checks types, Node/worker import, browser-free SSR and hydration identity. It creates no temporary project. `pnpm exec playwright test --config playwright.auth.config.ts` covers the explicit adapter simulation at `/login.html`: keyboard/recovery/loading/unconfigured states, desktop/tablet/mobile, both themes, long copy, real asset loading and axe. No test authenticates a real provider or proves production console readiness. diff --git a/packages/dds-auth/assets/README.md b/packages/dds-auth/assets/README.md new file mode 100644 index 00000000..178a14d8 --- /dev/null +++ b/packages/dds-auth/assets/README.md @@ -0,0 +1,5 @@ +These third-party provider marks come from the existing qoqo and Qooroo asset sets, with source, transformation and SHA-256 recorded in `provenance.json`. The providers own the marks and their brand rules apply. Including artwork does not establish provider-console setup, app verification or brand approval. The GitHub Octicons license for `github-symbol.svg` is included. + +Import `@devslab-kr/dds-auth/styles.css` to load the packaged marks for an explicit `providerOrder`: Google, Kakao, Naver, LINE, Microsoft, LinkedIn, GitHub, Discord, Figma, Notion, X, Slack and Zoom. X uses the light-on-dark variant beneath a `data-theme="dark"` element. GitLab stays text only. Apple, Facebook and WeChat have no packaged mark; the product can supply provider-approved controls or artwork. + +Use `providerIcons` to override a packaged mark or pass `null` to suppress it. You can copy the exported image files to the app's public asset directory or use bundler URL imports. Preserve the original colors and aspect ratios and use provider-specific controls when mandated. See the [LINE sign-in button guide](https://developers.line.biz/en/docs/line-login/login-button/), [Apple sign-in guidance](https://developer.apple.com/design/human-interface-guidelines/sign-in-with-apple), and the linked sources in the provenance file for each mark. The package uses relative CSS URLs; the bundler controls asset routing and inlining. diff --git a/packages/dds-auth/assets/discord-symbol.png b/packages/dds-auth/assets/discord-symbol.png new file mode 100644 index 00000000..6c5c6c95 Binary files /dev/null and b/packages/dds-auth/assets/discord-symbol.png differ diff --git a/packages/dds-auth/assets/figma-symbol.png b/packages/dds-auth/assets/figma-symbol.png new file mode 100644 index 00000000..b374a5ec Binary files /dev/null and b/packages/dds-auth/assets/figma-symbol.png differ diff --git a/packages/dds-auth/assets/github-octicons-MIT.txt b/packages/dds-auth/assets/github-octicons-MIT.txt new file mode 100644 index 00000000..aa1fa80e --- /dev/null +++ b/packages/dds-auth/assets/github-octicons-MIT.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 GitHub Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/dds-auth/assets/github-symbol.svg b/packages/dds-auth/assets/github-symbol.svg new file mode 100644 index 00000000..562aa266 --- /dev/null +++ b/packages/dds-auth/assets/github-symbol.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/dds-auth/assets/google-g.png b/packages/dds-auth/assets/google-g.png new file mode 100644 index 00000000..cd6d16ac Binary files /dev/null and b/packages/dds-auth/assets/google-g.png differ diff --git a/packages/dds-auth/assets/kakao-symbol.svg b/packages/dds-auth/assets/kakao-symbol.svg new file mode 100644 index 00000000..4858b9d5 --- /dev/null +++ b/packages/dds-auth/assets/kakao-symbol.svg @@ -0,0 +1 @@ + diff --git a/packages/dds-auth/assets/line-symbol.png b/packages/dds-auth/assets/line-symbol.png new file mode 100644 index 00000000..6055c06c Binary files /dev/null and b/packages/dds-auth/assets/line-symbol.png differ diff --git a/packages/dds-auth/assets/linkedin-symbol.png b/packages/dds-auth/assets/linkedin-symbol.png new file mode 100644 index 00000000..8bc2d53c Binary files /dev/null and b/packages/dds-auth/assets/linkedin-symbol.png differ diff --git a/packages/dds-auth/assets/microsoft-symbol.svg b/packages/dds-auth/assets/microsoft-symbol.svg new file mode 100644 index 00000000..b196b1fa --- /dev/null +++ b/packages/dds-auth/assets/microsoft-symbol.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/dds-auth/assets/naver-official-symbol.png b/packages/dds-auth/assets/naver-official-symbol.png new file mode 100644 index 00000000..cf75ca47 Binary files /dev/null and b/packages/dds-auth/assets/naver-official-symbol.png differ diff --git a/packages/dds-auth/assets/naver-symbol.png b/packages/dds-auth/assets/naver-symbol.png new file mode 100644 index 00000000..21b0a6a8 Binary files /dev/null and b/packages/dds-auth/assets/naver-symbol.png differ diff --git a/packages/dds-auth/assets/notion-symbol.png b/packages/dds-auth/assets/notion-symbol.png new file mode 100644 index 00000000..79a948e0 Binary files /dev/null and b/packages/dds-auth/assets/notion-symbol.png differ diff --git a/packages/dds-auth/assets/provenance.json b/packages/dds-auth/assets/provenance.json new file mode 100644 index 00000000..6308b6ac --- /dev/null +++ b/packages/dds-auth/assets/provenance.json @@ -0,0 +1,106 @@ +{ + "originalQoqoAssetsRetrievedAt": "2026-11-02T01:49:35.438Z", + "qoorooAssetsImportedAt": "2026-11-14", + "assets": [ + { + "file": "kakao-symbol.svg", + "source": "https://developers.kakao.com/tool/images/resource/preview/login-complete-ko.svg", + "sourceSha256": "ab90ab44616f14a671844cd991b3fbb33277f42c5bb2cc5a9422344a854c9398", + "sha256": "c4cd4159bf53ed88eee8270f8b02f22a0486dcab94c1be26692cc34fa9b7b4f9", + "transformation": "Exact first symbol path and original fill from official preview; viewBox only isolates symbol; no path redraw, geometry or color modification." + }, + { + "file": "naver-symbol.png", + "source": "https://developers.naver.com/inc/devcenter/downloads/bi/NAVER_login_KR.zip", + "entry": "NAVER_login_KR/NAVER_login_Light_KR_green_icon_H56.png", + "sourceSha256": "83eeef830bee319b83737bde1c74509e9ac7b1a6659e23e318cfcd7d6640f0f7", + "sha256": "6376556828d6a508c610077208d8b2babc028b1edada9da9d3bc9b8f0ea0d56b", + "crop": { + "left": 72, + "top": 72, + "width": 80, + "height": 80 + }, + "transformation": "Pixel crop of the official white N; original green #03A94D and shape unchanged; no redraw/recolor." + }, + { + "file": "google-g.png", + "source": "https://developers.google.com/static/identity/images/g-logo.png", + "sha256": "d1ce9c2af0b10a7333abc99bc706f9a6a199e5b65bf3e3009624f076b8638e6a", + "transformation": "Original downloaded PNG bytes unchanged." + }, + { + "file": "naver-official-symbol.png", + "source": "https://developers.naver.com/inc/devcenter/downloads/bi/NAVER_login_KR.zip", + "entry": "NAVER_login_KR/NAVER_login_Light_KR_green_icon_H56.png", + "sha256": "83eeef830bee319b83737bde1c74509e9ac7b1a6659e23e318cfcd7d6640f0f7", + "transformation": "Original unmodified PNG entry used by DDS Android and the opt-in web provider list. Imported in 2026-11-14." + }, + { + "file": "discord-symbol.png", + "source": "https://discord.com/branding", + "sha256": "c30fda4c6d1536fbc9529729cf8e3db3782ac2bbed48c78dcafdf63b36f7416e", + "transformation": "Official Clyde mark copied byte-for-byte from the Qooroo Android resource." + }, + { + "file": "figma-symbol.png", + "source": "https://static.figma.com/app/icon/2/icon-128.png", + "sha256": "a7012c890bc4ae056dd944dff7152415995cd2a3e00c7a751924e97dd6dbebbd", + "transformation": "Figma app icon copied byte-for-byte from the Qooroo Android resource." + }, + { + "file": "github-symbol.svg", + "source": "https://raw.githubusercontent.com/primer/octicons/main/icons/mark-github-24.svg", + "sha256": "b49cbd1645757eb8770372521844833234fe5d6fdfe10984462b4482bd6d98bc", + "transformation": "Original SVG path and fill from Qooroo Android; changed only the file container. See github-octicons-MIT.txt." + }, + { + "file": "line-symbol.png", + "source": "https://www.line.me/en/logo", + "sha256": "bd68dc699ba99a1899a14c75be80a772c1fa538d22b15cf93b7d99577fdc3cc4", + "transformation": "LINE app icon copied byte-for-byte from the Qooroo Android resource. Observe the provider’s minimum dimensions." + }, + { + "file": "linkedin-symbol.png", + "source": "https://brand.linkedin.com/downloads", + "sha256": "3c0149f26168b5fe0f43e68664abe40341a6443b3cd435d18a73e12f64f8b600", + "transformation": "Official LI-In-Bug graphic copied byte-for-byte from the Qooroo Android resource." + }, + { + "file": "microsoft-symbol.svg", + "source": "https://learn.microsoft.com/en-us/entra/identity-platform/media/howto-add-branding-in-apps/ms-symbollockup_mssymbol_19.svg", + "sha256": "6022013ae2386559df57d7c726ceceabf43f2bee61d09322a692c073034c4a3b", + "transformation": "Original colors and square geometry from the Qooroo Android resource, encoded as SVG paths." + }, + { + "file": "notion-symbol.png", + "source": "https://www.notion.com/front-static/logo-ios.png", + "sha256": "483846a85e43e22879445047b83b22033e70fcc25ab34809ebadb7f856507ee0", + "transformation": "Official app icon copied byte-for-byte from the Qooroo Android resource." + }, + { + "file": "slack-symbol.svg", + "source": "https://api.slack.com/sign-in-with-slack-button-generator", + "sha256": "fe11769c0e21f00bfe03a2a2d3c94753f9358f82fcc86449d0c953c4bed75c37", + "transformation": "Original four paths and colors from the Qooroo Android resource; changed only the file container." + }, + { + "file": "x-symbol.png", + "source": "https://about.x.com/en/who-we-are/brand-toolkit", + "sha256": "738d0854db70b45f9b22e15cb9839b1dd7249df466513099507f4a1fe52dce7c", + "transformation": "Dark mark for light surfaces, copied byte-for-byte from the Qooroo Android resource." + }, + { + "file": "x-symbol-light.png", + "source": "https://about.x.com/en/who-we-are/brand-toolkit", + "sha256": "159176f24755e952d22183ef8238f1b7c1c5bc8784ee922ce479bea4a83365c7", + "transformation": "Light mark for dark surfaces, copied byte-for-byte from the Qooroo Android resource." + }, + { + "file": "zoom-symbol.png", + "source": "https://play.google.com/store/apps/details?id=us.zoom.videomeetings", + "sha256": "bd5f9bc1f345de79828e17d758c4701be7fb2cef30dfcc101bfd78f936ad5215", + "transformation": "Zoom app icon copied byte-for-byte from the Qooroo Android resource." + } + ] +} diff --git a/packages/dds-auth/assets/slack-symbol.svg b/packages/dds-auth/assets/slack-symbol.svg new file mode 100644 index 00000000..21784309 --- /dev/null +++ b/packages/dds-auth/assets/slack-symbol.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/dds-auth/assets/x-symbol-light.png b/packages/dds-auth/assets/x-symbol-light.png new file mode 100644 index 00000000..1b4857cc Binary files /dev/null and b/packages/dds-auth/assets/x-symbol-light.png differ diff --git a/packages/dds-auth/assets/x-symbol.png b/packages/dds-auth/assets/x-symbol.png new file mode 100644 index 00000000..8ea803ad Binary files /dev/null and b/packages/dds-auth/assets/x-symbol.png differ diff --git a/packages/dds-auth/assets/zoom-symbol.png b/packages/dds-auth/assets/zoom-symbol.png new file mode 100644 index 00000000..c992ea26 Binary files /dev/null and b/packages/dds-auth/assets/zoom-symbol.png differ diff --git a/packages/dds-auth/consumer/.gitignore b/packages/dds-auth/consumer/.gitignore new file mode 100644 index 00000000..78693f74 --- /dev/null +++ b/packages/dds-auth/consumer/.gitignore @@ -0,0 +1,2 @@ +*.tgz +package-lock.json diff --git a/packages/dds-auth/consumer/fixture.tsx b/packages/dds-auth/consumer/fixture.tsx new file mode 100644 index 00000000..641fd30e --- /dev/null +++ b/packages/dds-auth/consumer/fixture.tsx @@ -0,0 +1,62 @@ +import { LoginPanel, SocialLoginOptions } from "@devslab-kr/dds-auth/react"; +import { + createSocialAuthClient, + type ProviderAvailability, + type SocialAuthAdapter, +} from "@devslab-kr/dds-auth"; + +export const client = createSocialAuthClient({ + endpoint: "/auth/start", + fetch, +}); +export const ui = ( + {}} + terms={{ href: "/terms", label: "Terms" }} + privacy={{ href: "/privacy", label: "Privacy" }} + /> +); +export const controlled = ( + {}} + aria-label="Sign-in methods" + /> +); +export type Adapter = SocialAuthAdapter< + { request: Request }, + { encryptedRef: string } +>; + +const providerOrder = ["google", "github", "discord"] as const; +type ServiceProvider = (typeof providerOrder)[number]; +const providers: readonly ProviderAvailability[] = [ + { id: "google", status: "available" }, + { id: "discord", status: "disabled", reason: "service-policy" }, +]; +export const extendedClient = createSocialAuthClient({ + endpoint: "/auth/start", + fetch, + providerOrder, +}); +export const extendedUi = ( + {}} + terms={{ href: "/terms", label: "Terms" }} + privacy={{ href: "/privacy", label: "Privacy" }} + /> +); diff --git a/packages/dds-auth/consumer/package.json b/packages/dds-auth/consumer/package.json new file mode 100644 index 00000000..d15c8f5b --- /dev/null +++ b/packages/dds-auth/consumer/package.json @@ -0,0 +1,14 @@ +{ + "name": "dds-auth-packed-consumer", + "private": true, + "type": "module", + "dependencies": { + "@devslab/dds-react": "0.29.2", + "react": "19.3.0", + "react-dom": "19.3.0", + "jsdom": "30.0.1", + "@types/react": "19.3.0", + "@types/react-dom": "19.3.0", + "typescript": "7.0.2" + } +} diff --git a/packages/dds-auth/consumer/runtime.mjs b/packages/dds-auth/consumer/runtime.mjs new file mode 100644 index 00000000..2f214153 --- /dev/null +++ b/packages/dds-auth/consumer/runtime.mjs @@ -0,0 +1,108 @@ +import assert from "node:assert/strict"; +import { readFile } from "node:fs/promises"; +import { Worker } from "node:worker_threads"; +import { createElement as h, act } from "react"; +import { renderToString } from "react-dom/server"; +import { + LoginPanel, + SocialLoginOptions, + loginMessagesEn, +} from "@devslab-kr/dds-auth/react"; +import { normalizeProviders } from "@devslab-kr/dds-auth"; +import { JSDOM } from "jsdom"; + +assert.equal(typeof globalThis.window, "undefined"); +assert.equal( + normalizeProviders([]).every( + (provider) => provider.status === "unconfigured", + ), + true, +); +const worker = new Worker(new URL("./worker.mjs", import.meta.url)); +await new Promise((resolve, reject) => { + worker.once("message", resolve); + worker.once("error", reject); +}); +await worker.terminate(); +const props = { + brand: "Packed service", + title: "Sign in", + providers: [{ id: "google", status: "available" }], + client: { + start: async () => ({ + status: "error", + code: "unavailable", + retryable: true, + }), + }, + returnTo: "/account", + redirectOrigins: ["https://auth.example.test"], + onRedirect() {}, + terms: { href: "/terms", label: "Terms" }, + privacy: { href: "/privacy", label: "Privacy" }, + messages: loginMessagesEn, +}; +const app = h(LoginPanel, props); +const html = renderToString(app); +assert.match(html, /Continue with Google/); +assert.match( + renderToString(h(SocialLoginOptions, { providers: [], onSelect() {} })), + /disabled/, +); +const dom = new JSDOM(`
${html}
`, { + url: "https://service.example.test", +}); +for (const key of [ + "window", + "document", + "HTMLElement", + "HTMLButtonElement", + "Node", + "Event", + "MouseEvent", + "MutationObserver", + "getComputedStyle", + "navigator", +]) { + Object.defineProperty(globalThis, key, { + value: dom.window[key], + configurable: true, + }); +} +globalThis.IS_REACT_ACT_ENVIRONMENT = true; +const { hydrateRoot } = await import("react-dom/client"); +const container = document.getElementById("root"); +const serverButton = container.querySelector("button"); +const recoverable = []; +let root; +await act(async () => { + root = hydrateRoot(container, app, { + onRecoverableError: (error) => recoverable.push(error), + }); +}); +assert.equal( + container.querySelector("button"), + serverButton, + "Hydration must retain the server control", +); +await act(async () => { + serverButton.click(); +}); +assert.match( + container.querySelector('[role="alert"]').textContent, + /Sign-in is unavailable/, +); +assert.equal(recoverable.length, 0); +await act(async () => root.unmount()); +dom.window.close(); +const moduleText = await readFile( + new URL("./node_modules/@devslab-kr/dds-auth/dist/react.js", import.meta.url), + "utf8", +); +assert.ok( + moduleText.startsWith('"use client";'), + "Published React entry must preserve the Next client boundary", +); +console.log( + "Packed Node/worker import, server rendering, hydration identity and error interaction passed", +); diff --git a/packages/dds-auth/consumer/verify.mjs b/packages/dds-auth/consumer/verify.mjs new file mode 100644 index 00000000..b82ececd --- /dev/null +++ b/packages/dds-auth/consumer/verify.mjs @@ -0,0 +1,118 @@ +import assert from "node:assert/strict"; +import { readFile, access, rm } from "node:fs/promises"; +import { spawnSync } from "node:child_process"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +// A reusable, tracked fixture; no mkdtemp, scratch project or worktree is created. +const consumer = dirname(fileURLToPath(import.meta.url)); +const root = resolve(consumer, ".."); +const nodeModules = join(dirname(process.execPath), "node_modules"); +function run(command, args, cwd = consumer) { + const result = spawnSync(command, args, { + cwd, + encoding: "utf8", + timeout: 300_000, + maxBuffer: 4 * 1024 * 1024, + }); + if (result.error || result.status !== 0) + throw new Error( + `${command} ${args.join(" ")} failed\n${result.error ?? ""}\n${result.stdout}\n${result.stderr}`, + ); + if (result.stdout.trim()) console.log(result.stdout.trim()); +} +const npm = (args) => + run( + process.platform === "win32" ? process.execPath : "npm", + process.platform === "win32" + ? [join(nodeModules, "npm/bin/npm-cli.js"), ...args] + : args, + ); +const manifest = JSON.parse(await readFile(join(root, "package.json"), "utf8")); +const tarball = join( + consumer, + `${manifest.name.replace(/^@/, "").replace("/", "-")}-${manifest.version}.tgz`, +); +run( + process.platform === "win32" ? process.execPath : "pnpm", + process.platform === "win32" + ? [ + join(nodeModules, "corepack/dist/pnpm.js"), + "pack", + "--pack-destination", + consumer, + ] + : ["pack", "--pack-destination", consumer], + root, +); +try { + npm([ + "install", + "--ignore-scripts", + "--no-audit", + "--no-fund", + "--no-save", + "--package-lock=false", + tarball, + ]); + const installed = join(consumer, "node_modules/@devslab-kr/dds-auth"); + assert.ok( + installed.startsWith(`${consumer}/`) || + installed.startsWith(`${consumer}\\`), + ); + for (const file of [ + "dist/index.js", + "dist/index.d.ts", + "dist/react.js", + "dist/react.d.ts", + "styles.css", + "LICENSE", + "assets/google-g.png", + "assets/kakao-symbol.svg", + "assets/naver-symbol.png", + "assets/naver-official-symbol.png", + "assets/discord-symbol.png", + "assets/github-symbol.svg", + "assets/github-octicons-MIT.txt", + "assets/figma-symbol.png", + "assets/line-symbol.png", + "assets/linkedin-symbol.png", + "assets/microsoft-symbol.svg", + "assets/notion-symbol.png", + "assets/slack-symbol.svg", + "assets/x-symbol.png", + "assets/x-symbol-light.png", + "assets/zoom-symbol.png", + "assets/provenance.json", + ]) + await access(join(installed, file)); + const packed = JSON.parse( + await readFile(join(installed, "package.json"), "utf8"), + ); + assert.equal(packed.name, "@devslab-kr/dds-auth"); + assert.equal(packed.version, manifest.version); + assert.equal( + packed.dependencies, + undefined, + "Headless package must not require a browser framework", + ); + run(process.execPath, [ + "node_modules/typescript/bin/tsc", + "--ignoreConfig", + "--noEmit", + "--jsx", + "react-jsx", + "--target", + "ES2022", + "--module", + "ESNext", + "--moduleResolution", + "Bundler", + "--skipLibCheck", + "fixture.tsx", + ]); + run(process.execPath, ["runtime.mjs"]); +} finally { + // This exact tarball is produced by this invocation; the permanent fixture and dependencies remain reusable. + await rm(tarball, { force: true }); +} diff --git a/packages/dds-auth/consumer/worker.mjs b/packages/dds-auth/consumer/worker.mjs new file mode 100644 index 00000000..e52a5e75 --- /dev/null +++ b/packages/dds-auth/consumer/worker.mjs @@ -0,0 +1,16 @@ +import assert from "node:assert/strict"; +import { parentPort } from "node:worker_threads"; +import { + createSocialAuthClient, + isSafeReturnTo, + normalizeProviders, +} from "@devslab-kr/dds-auth"; +assert.equal(typeof globalThis.document, "undefined"); +assert.equal(typeof globalThis.window, "undefined"); +assert.equal(isSafeReturnTo("/account?search=50%25"), true); +assert.equal(normalizeProviders([]).length, 3); +assert.equal( + typeof createSocialAuthClient({ endpoint: "/auth/start", fetch }).start, + "function", +); +parentPort.postMessage("worker contract passed"); diff --git a/packages/dds-auth/package.json b/packages/dds-auth/package.json new file mode 100644 index 00000000..d4e5f7f3 --- /dev/null +++ b/packages/dds-auth/package.json @@ -0,0 +1,81 @@ +{ + "name": "@devslab-kr/dds-auth", + "version": "0.2.0", + "description": "Provider-neutral social authentication contracts and DDS React login UI", + "type": "module", + "license": "SEE LICENSE IN LICENSE", + "repository": { + "type": "git", + "url": "https://github.com/devslab-kr/dds.git", + "directory": "packages/dds-auth" + }, + "publishConfig": { + "registry": "https://npm.pkg.github.com", + "access": "public" + }, + "files": [ + "dist", + "styles.css", + "assets", + "README.md", + "README.ko.md" + ], + "sideEffects": [ + "./styles.css" + ], + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "default": "./dist/index.js" + }, + "./react": { + "types": "./dist/react.d.ts", + "import": "./dist/react.js", + "default": "./dist/react.js" + }, + "./styles.css": "./styles.css", + "./assets/*": "./assets/*" + }, + "scripts": { + "build": "tsc -p tsconfig.build.json", + "check": "tsc -p tsconfig.json --noEmit", + "test": "vitest run", + "verify:consumer": "node consumer/verify.mjs" + }, + "peerDependencies": { + "@devslab/dds-react": "^0.29.1 || ^0.35.0", + "react": "^18.3.0 || ^19.0.0", + "react-dom": "^18.3.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@devslab/dds-react": { + "optional": true + }, + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + }, + "devDependencies": { + "@devslab/dds-react": "workspace:*", + "@testing-library/jest-dom": "6.9.1", + "@testing-library/react": "16.3.2", + "@testing-library/user-event": "14.6.1", + "@types/node": "26.3.0", + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "jsdom": "30.0.1", + "react": "19.3.0", + "react-dom": "19.3.0", + "typescript": "7.0.2", + "vitest": "4.1.1" + }, + "engines": { + "node": ">=20" + } +} diff --git a/packages/dds-auth/src/__tests__/contract.test.ts b/packages/dds-auth/src/__tests__/contract.test.ts new file mode 100644 index 00000000..f2bb8def --- /dev/null +++ b/packages/dds-auth/src/__tests__/contract.test.ts @@ -0,0 +1,302 @@ +// @vitest-environment node +import { expect, it, vi } from "vitest"; +import { + SOCIAL_PROVIDERS, + authFailure, + createSocialAuthClient, + isSafeAuthRedirect, + isSafeReturnTo, + normalizeProviders, + readSocialAuthStartResult, + type SocialAuthAdapter, +} from "../index.js"; + +it("does not infer readiness from missing, malformed or duplicate provider configuration", () => { + expect( + normalizeProviders(null).every((entry) => entry.status === "unconfigured"), + ).toBe(true); + const normalized = normalizeProviders([ + { id: "google", status: "available" }, + { id: "google", status: "available" }, + { id: "kakao", status: "disabled", reason: "review-pending" }, + { id: "naver", configured: true }, + ]); + expect(normalized.map((entry) => entry.id)).toEqual(SOCIAL_PROVIDERS); + expect(normalized.map((entry) => entry.status)).toEqual([ + "unconfigured", + "disabled", + "unconfigured", + ]); +}); + +it("keeps the historical allowlist and only includes explicitly ordered new methods", () => { + const configured = [ + { id: "google", status: "available" }, + { id: "github", status: "available" }, + { id: "discord", status: "available" }, + { id: "discord", status: "available" }, + { id: "zoom", status: "disabled", reason: "review-pending" }, + ]; + expect(normalizeProviders(configured).map(({ id }) => id)).toEqual([ + "google", "kakao", "naver", + ]); + expect(normalizeProviders(configured, ["zoom", "discord", "x", "zoom"])).toEqual([ + { id: "zoom", status: "disabled", reason: "review-pending" }, + { id: "discord", status: "unconfigured", reason: "not-configured" }, + { id: "x", status: "unconfigured", reason: "not-configured" }, + ]); +}); + +it("only submits requests for the client-selected methods", async () => { + const fetch = vi.fn(async () => + Response.json({ status: "redirect", url: "https://auth.service.test/authorize" }), + ); + const providerOrder = ["discord", "x"] as const; + const legacyClient = createSocialAuthClient({ endpoint: "/auth/start", fetch }); + const input = { provider: "discord" as const, intent: "sign-in" as const, returnTo: "/account" }; + const options = { signal: new AbortController().signal }; + // Simulate runtime input that bypasses the legacy caller's compile-time provider declaration. + expect(await legacyClient.start(input as unknown as Parameters[0], options)) + .toEqual(authFailure("invalid-request", false)); + expect(fetch).not.toHaveBeenCalled(); + const client = createSocialAuthClient({ endpoint: "/auth/start", fetch, providerOrder }); + expect(await client.start(input, options)).toEqual({ + status: "redirect", url: "https://auth.service.test/authorize", + }); + expect(fetch).toHaveBeenCalledExactlyOnceWith( + "/auth/start", expect.objectContaining({ body: JSON.stringify(input) }), + ); +}); + +it.each([ + "/", + "/account?tab=social", + "/join/abc?return=%2Fstore%3Fview%3Dorders", + "/store#orders", + "/app?search=%EA%B0%95%EB%82%A8%20station", + "/app?search=50%25", + "/app?q=100%2525", + "/my%20page", +])("accepts local return path %s", (value) => { + expect(isSafeReturnTo(value)).toBe(true); +}); +it.each([ + "https://evil.test/", + "//evil.test/", + "/\\evil.test/", + "/%2f%2fevil.test", + "/%252f%252fevil.test", + "/%5cevil.test", + "/%255cevil.test", + "/ok?next=%0d%0aLocation:evil", + "/ok?x=%250a", + "/ok\n", + " /ok", + "/bad%", + "/%E9", +])("rejects unsafe or malformed return path %s", (value) => { + expect(isSafeReturnTo(value)).toBe(false); +}); + +it("requires exact authorization origins and safe URL schemes without credentials", () => { + const origins = ["https://auth.service.test"]; + expect( + isSafeAuthRedirect( + "https://auth.service.test/authorize?state=abc", + origins, + ), + ).toBe(true); + for (const value of [ + "javascript:alert(1)", + "data:text/plain,hello", + "//auth.service.test/authorize", + "https://evil.test/authorize", + "https://auth.service.test.evil.test/", + "https://user:secret@auth.service.test/", + "http://auth.service.test/", + "https://auth.service.test/\n", + ]) { + expect(isSafeAuthRedirect(value, origins), value).toBe(false); + } + expect( + isSafeAuthRedirect("https://auth.service.test/", [ + "https://auth.service.test/a", + ]), + ).toBe(false); + expect( + isSafeAuthRedirect("http://localhost:7777/start", [ + "http://localhost:7777", + ]), + ).toBe(true); + expect( + isSafeAuthRedirect("https://auth.service.test/", [ + "https://auth.service.test", + "invalid", + ]), + ).toBe(false); + expect( + isSafeAuthRedirect("https://auth.service.test/", [ + "invalid", + "https://auth.service.test", + ]), + ).toBe(false); +}); + +it("discards raw provider errors and unknown result fields", () => { + expect( + readSocialAuthStartResult({ + status: "error", + code: "failed", + retryable: true, + token: "secret", + }), + ).toEqual(authFailure()); + expect( + readSocialAuthStartResult({ + status: "error", + code: "secret-provider-message", + retryable: true, + }), + ).toEqual(authFailure("invalid-response")); + expect( + readSocialAuthStartResult({ + status: "redirect", + url: "https://auth.service.test/", + token: "secret", + }), + ).toEqual({ status: "redirect", url: "https://auth.service.test/" }); +}); + +it("posts once with caller-owned request ID, abort signal and no cache; never retries unknown outcomes", async () => { + const fetch = vi + .fn() + .mockRejectedValue(new Error("network outcome unknown")); + const client = createSocialAuthClient({ + endpoint: "/api/social/start", + fetch, + }); + const controller = new AbortController(); + const input = { + provider: "naver" as const, + returnTo: "/account", + intent: "link" as const, + requestId: "caller-owned-uuid", + }; + await expect( + client.start(input, { signal: controller.signal }), + ).rejects.toThrow(); + expect(fetch).toHaveBeenCalledTimes(1); + expect(fetch).toHaveBeenCalledWith( + "/api/social/start", + expect.objectContaining({ + method: "POST", + credentials: "same-origin", + cache: "no-store", + redirect: "error", + signal: expect.any(AbortSignal), + body: JSON.stringify(input), + }), + ); +}); + +it("rejects a redirect carried by a failed HTTP response and invalid local requests", async () => { + const fetch = vi.fn().mockResolvedValue( + new Response( + JSON.stringify({ + status: "redirect", + url: "https://auth.service.test/", + }), + { status: 500 }, + ), + ); + const client = createSocialAuthClient({ + endpoint: "/api/social/start", + fetch, + }); + expect( + await client.start( + { provider: "google", returnTo: "/account", intent: "sign-in" }, + { signal: new AbortController().signal }, + ), + ).toEqual(authFailure("invalid-response")); + expect( + await client.start( + { provider: "google", returnTo: "//evil.test", intent: "sign-in" }, + { signal: new AbortController().signal }, + ), + ).toEqual(authFailure("invalid-request", false)); + expect(fetch).toHaveBeenCalledTimes(1); + expect(() => + createSocialAuthClient({ endpoint: "https://evil.test/", fetch }), + ).toThrow(); +}); + +it("bounds a stalled fetch, aborts transport and reports an unknown outcome without a retry", async () => { + let transportSignal: AbortSignal | undefined; + const fetch = vi.fn( + (_url, init) => + new Promise((_resolve, reject) => { + transportSignal = init?.signal ?? undefined; + transportSignal?.addEventListener( + "abort", + () => reject(new Error("aborted")), + { once: true }, + ); + }), + ); + const client = createSocialAuthClient({ + endpoint: "/api/social/start", + fetch, + timeoutMs: 250, + }); + expect( + await client.start( + { provider: "google", returnTo: "/account", intent: "sign-in" }, + { signal: new AbortController().signal }, + ), + ).toEqual(authFailure("unavailable")); + expect(transportSignal?.aborted).toBe(true); + expect(fetch).toHaveBeenCalledTimes(1); +}); + +it("allows request-scoped adapters to preserve opaque server sessions and response cookies", async () => { + const response = new Response(null, { + status: 303, + headers: { + Location: "/account", + "Set-Cookie": "opaque=app-owned; HttpOnly; Secure; SameSite=Lax", + "Cache-Control": "private, no-store", + }, + }); + const contexts: string[] = []; + const adapter: SocialAuthAdapter< + { requestId: string }, + { encryptedSessionRef: string } + > = { + providers: async () => [{ id: "google", status: "available" }], + start: async () => ({ + result: { status: "redirect", url: "https://auth.service.test/" }, + response, + }), + callback: async (_request, context) => { + contexts.push(context.requestId); + return { + status: "authenticated", + session: { encryptedSessionRef: context.requestId }, + response, + }; + }, + session: async (context) => ({ encryptedSessionRef: context.requestId }), + signOut: async () => response, + }; + const result = await adapter.callback( + new Request("https://service.test/auth/callback?code=opaque"), + { requestId: "request-1" }, + ); + expect(result.response).toBe(response); + expect(result.response.headers.get("set-cookie")).toContain("HttpOnly"); + expect(contexts).toEqual(["request-1"]); + expect(await adapter.session({ requestId: "request-2" })).toEqual({ + encryptedSessionRef: "request-2", + }); +}); diff --git a/packages/dds-auth/src/__tests__/login.test.tsx b/packages/dds-auth/src/__tests__/login.test.tsx new file mode 100644 index 00000000..4721fb07 --- /dev/null +++ b/packages/dds-auth/src/__tests__/login.test.tsx @@ -0,0 +1,355 @@ +import { StrictMode } from "react"; +import { render, screen, waitFor, act } from "@testing-library/react"; +import { renderToString } from "react-dom/server"; +import userEvent from "@testing-library/user-event"; +import { expect, it, vi } from "vitest"; +import { + LoginPanel, + SocialLoginOptions, + type LoginPanelProps, + loginMessagesEn, +} from "../react.js"; +import { authFailure, type SocialAuthStartResult } from "../index.js"; + +const props: LoginPanelProps = { + brand: "Service", + title: "Sign in", + description: "Choose your sign-in method.", + providers: [ + { id: "google", status: "available" }, + { id: "kakao", status: "available" }, + { id: "naver", status: "unconfigured", reason: "review-pending" }, + ], + client: { + start: async () => ({ + status: "redirect", + url: "https://auth.service.test/authorize", + }), + }, + returnTo: "/account", + redirectOrigins: ["https://auth.service.test"], + onRedirect: () => {}, + terms: { href: "/terms", label: "Terms" }, + privacy: { href: "https://service.test/privacy", label: "Privacy" }, + messages: loginMessagesEn, +}; + +it("renders explicit provider readiness, named legal links and browser-free SSR", () => { + const html = renderToString( + {" + + diff --git a/packages/react-canary/package.json b/packages/react-canary/package.json index 9f13ed1c..5edc876c 100644 --- a/packages/react-canary/package.json +++ b/packages/react-canary/package.json @@ -9,6 +9,7 @@ "dev": "vite --host 127.0.0.1 --port 5276 --strictPort" }, "dependencies": { + "@devslab-kr/dds-auth": "workspace:*", "@devslab/dds-react": "workspace:*", "@devslab/dds-table-react": "workspace:*", "react": "19.3.0", diff --git a/packages/react-canary/src/login-demo.css b/packages/react-canary/src/login-demo.css new file mode 100644 index 00000000..0f7b6a75 --- /dev/null +++ b/packages/react-canary/src/login-demo.css @@ -0,0 +1,65 @@ +html, +body, +#root { + margin: 0; + min-block-size: 100%; +} +.login-demo { + box-sizing: border-box; + display: grid; + grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); + align-content: center; + gap: var(--dds-space-48); + min-block-size: 100dvh; + padding: var(--dds-space-32); + background: var(--dds-color-bg-subtle); + color: var(--dds-color-text-primary); + font-family: var(--dds-font-family-sans); +} +.login-demo__controls { + min-inline-size: 0; +} +.login-demo__controls h1 { + margin: 0; + font-size: var(--dds-typo-title-2-font-size); + line-height: var(--dds-typo-title-2-line-height); +} +.login-demo__controls p, +.login-demo__legal-text { + color: var(--dds-color-text-secondary); + font-size: var(--dds-typo-body-2-font-size); + line-height: var(--dds-typo-body-2-line-height); +} +.login-demo__controls label { + display: block; + margin-block: var(--dds-space-24) var(--dds-space-8); +} +.login-demo__actions { + display: flex; + flex-wrap: wrap; + gap: var(--dds-space-8); + margin-block: var(--dds-space-16); +} +.login-demo__controls output { + overflow-wrap: anywhere; +} +.login-demo__surface { + min-inline-size: 0; + max-inline-size: 28rem; + margin-inline: auto; + background: var(--dds-color-bg-default); + border-radius: var(--dds-radius-lg); +} +.login-demo__legal-text { + padding: 0 var(--dds-space-24) var(--dds-space-16); +} +@media (max-width: 48rem) { + .login-demo { + grid-template-columns: minmax(0, 1fr); + gap: var(--dds-space-24); + padding: var(--dds-space-16); + } + .login-demo__surface { + margin-inline: 0; + } +} diff --git a/packages/react-canary/src/login-demo.tsx b/packages/react-canary/src/login-demo.tsx new file mode 100644 index 00000000..292a040a --- /dev/null +++ b/packages/react-canary/src/login-demo.tsx @@ -0,0 +1,156 @@ +import { StrictMode, useState } from "react"; +import { createRoot } from "react-dom/client"; +import { Button } from "@devslab/dds-react"; +import { LoginPanel, loginMessagesEn } from "@devslab-kr/dds-auth/react"; +import { + authFailure, + type SocialAuthClient, + type SocialAuthErrorCode, + SOCIAL_PROVIDERS, + type CatalogSocialProvider, +} from "@devslab-kr/dds-auth"; +import "@devslab-kr/dds-auth/styles.css"; +import "./login-demo.css"; +import googleIcon from "@devslab-kr/dds-auth/assets/google-g.png?url"; +import kakaoIcon from "@devslab-kr/dds-auth/assets/kakao-symbol.svg?url"; +import naverIcon from "@devslab-kr/dds-auth/assets/naver-symbol.png?url"; + +const providerIcons = { + google: , + kakao: , + naver: , +}; +const expandedProviders = [ + "google", + "naver", + "discord", + "x", + "github", + "notion", + "zoom", + "gitlab", +] as const; + +type DemoState = "ready" | "unconfigured" | "loading" | "error"; +function Demo() { + const [state, setState] = useState("ready"); + const [dark, setDark] = useState(false); + const [english, setEnglish] = useState(false); + const [long, setLong] = useState(false); + const [expanded, setExpanded] = useState(false); + const [redirect, setRedirect] = useState(""); + const [error, setError] = useState(); + // Explicit simulation, not provider credentials or a working authentication backend. + const [client] = useState>(() => ({ + async start(_input, { signal }) { + const mode = + document.querySelector("#demo-state")!.value; + if (mode === "loading") + return new Promise((_resolve, reject) => { + signal.addEventListener("abort", () => reject(new Error("aborted")), { + once: true, + }); + }); + if (mode === "error") return authFailure("unavailable"); + return { status: "redirect", url: "https://auth.example.test/authorize" }; + }, + })); + const providerOrder = expanded ? expandedProviders : SOCIAL_PROVIDERS; + const providers = providerOrder.map( + (id) => + state === "unconfigured" || id === "zoom" + ? { id, status: "unconfigured" as const, reason: "demo-not-configured" } + : { id, status: "available" as const }, + ); + return ( +
+
+

DDS 로그인 컴포넌트

+

+ 인증 어댑터 시뮬레이션입니다. 실제 계정 로그인과 공급자 연결은 + 실행하지 않습니다. +

+ + +
+ + + + + +
+ {redirect} +
+
+ +
+

+ 예제 약관 자리입니다. 제품에서는 실제 약관 주소를 연결합니다. +

+

예제 개인정보 처리방침 자리입니다.

+
+
+
+ ); +} +createRoot(document.getElementById("root")!).render( + + + , +); diff --git a/packages/react-canary/tsconfig.login.json b/packages/react-canary/tsconfig.login.json new file mode 100644 index 00000000..a9d2a96a --- /dev/null +++ b/packages/react-canary/tsconfig.login.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "include": ["src/login-demo.tsx"] +} diff --git a/packages/react-canary/vite.auth.config.ts b/packages/react-canary/vite.auth.config.ts new file mode 100644 index 00000000..ff997de9 --- /dev/null +++ b/packages/react-canary/vite.auth.config.ts @@ -0,0 +1,6 @@ +import { defineConfig } from "vite"; +export default defineConfig({ + esbuild: { jsx: "automatic" }, + optimizeDeps: { entries: ["login.html"] }, + build: { assetsInlineLimit: 0, rollupOptions: { input: "login.html" } }, +}); diff --git a/playwright.auth.config.ts b/playwright.auth.config.ts new file mode 100644 index 00000000..33d40daf --- /dev/null +++ b/playwright.auth.config.ts @@ -0,0 +1,22 @@ +import { defineConfig } from "@playwright/test"; +export default defineConfig({ + testDir: "./tests/browser", + testMatch: "auth.spec.ts", + fullyParallel: false, + workers: 1, + retries: 0, + forbidOnly: true, + reporter: "line", + use: { + baseURL: "http://127.0.0.1:5277", + headless: true, + trace: "retain-on-failure", + }, + webServer: { + command: + "pnpm --filter @devslab/react-canary exec vite --config vite.auth.config.ts --host 127.0.0.1 --port 5277 --strictPort", + url: "http://127.0.0.1:5277/login.html", + reuseExistingServer: false, + timeout: 60000, + }, +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b79ae22e..0265f917 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -109,6 +109,45 @@ importers: specifier: 4.127.1 version: 4.127.1 + packages/dds-auth: + devDependencies: + '@devslab/dds-react': + specifier: workspace:* + version: link:../dds-react + '@testing-library/jest-dom': + specifier: 6.9.1 + version: 6.9.1 + '@testing-library/react': + specifier: 16.3.2 + version: 16.3.2(@testing-library/dom@10.4.1)(@types/react-dom@19.3.0(@types/react@19.3.0))(@types/react@19.3.0)(react-dom@19.3.0(react@19.3.0))(react@19.3.0) + '@testing-library/user-event': + specifier: 14.6.1 + version: 14.6.1(@testing-library/dom@10.4.1) + '@types/node': + specifier: 26.3.0 + version: 26.3.0 + '@types/react': + specifier: ^19.0.0 + version: 19.3.0 + '@types/react-dom': + specifier: ^19.0.0 + version: 19.3.0(@types/react@19.3.0) + jsdom: + specifier: 30.0.1 + version: 30.0.1 + react: + specifier: 19.3.0 + version: 19.3.0 + react-dom: + specifier: 19.3.0 + version: 19.3.0(react@19.3.0) + typescript: + specifier: 7.0.2 + version: 7.0.2 + vitest: + specifier: 4.1.1 + version: 4.1.1(@types/node@26.3.0)(jsdom@30.0.1)(vite@8.2.1(@types/node@26.3.0)(esbuild@0.28.2)(jiti@2.7.0)(yaml@2.9.0)) + packages/dds-css: {} packages/dds-icons: {} @@ -480,6 +519,9 @@ importers: packages/react-canary: dependencies: + '@devslab-kr/dds-auth': + specifier: workspace:* + version: link:../dds-auth '@devslab/dds-react': specifier: workspace:* version: link:../dds-react diff --git a/scripts/publish-public-packages.mjs b/scripts/publish-public-packages.mjs new file mode 100644 index 00000000..faf7a453 --- /dev/null +++ b/scripts/publish-public-packages.mjs @@ -0,0 +1,27 @@ +import { spawnSync } from "node:child_process"; +import { readFileSync, writeFileSync } from "node:fs"; +import { createRequire } from "node:module"; +import { fileURLToPath } from "node:url"; + +const require = createRequire(import.meta.url); +const manifestPath = new URL("../packages/dds-auth/package.json", import.meta.url); +const source = readFileSync(manifestPath, "utf8"); +const manifest = JSON.parse(source); + +// Changesets' ignore option controls versioning; publish still queries every non-private package. +// DDS Auth is released separately to GitHub Packages, so exclude it for this invocation only. +if (manifest.name !== "@devslab-kr/dds-auth" || manifest.publishConfig?.registry !== "https://npm.pkg.github.com") { + throw new Error("Unexpected DDS Auth manifest"); +} + +try { + writeFileSync(manifestPath, JSON.stringify({ ...manifest, private: true }, null, 2) + "\n"); + const result = spawnSync(process.execPath, [require.resolve("@changesets/cli/bin.js"), "publish", ...process.argv.slice(2)], { + cwd: fileURLToPath(new URL("..", import.meta.url)), + stdio: "inherit", + }); + if (result.error) throw result.error; + process.exitCode = result.status ?? 1; +} finally { + writeFileSync(manifestPath, source); +} diff --git a/tests/browser/auth.spec.ts b/tests/browser/auth.spec.ts new file mode 100644 index 00000000..322cc5e1 --- /dev/null +++ b/tests/browser/auth.spec.ts @@ -0,0 +1,203 @@ +import { expect, test } from "@playwright/test"; +import AxeBuilder from "@axe-core/playwright"; + +test("login keyboard, error recovery, pending and explicit missing configuration", async ({ + page, +}) => { + await page.goto("/login.html"); + await page.getByLabel("표시 상태").selectOption("error"); + const google = page.getByRole("button", { name: "Google로 계속하기" }); + await google.focus(); + await page.keyboard.press("Enter"); + await expect(page.getByRole("alert")).toContainText( + "로그인 연결을 확인하지 못했습니다.", + ); + await expect( + page.getByRole("button", { name: "다시 선택하기" }), + ).toBeFocused(); + await page.keyboard.press("Enter"); + await expect(google).toBeFocused(); + await page.getByLabel("표시 상태").selectOption("loading"); + await google.click(); + await expect(google).toHaveAttribute("aria-busy", "true"); + await expect(page.getByRole("region").getByRole("status")).toContainText( + "Google 로그인 페이지", + ); + await expect( + page.getByRole("button", { name: "카카오로 계속하기" }), + ).toBeDisabled(); + await page.getByLabel("표시 상태").selectOption("unconfigured"); + for (const name of [ + "Google로 계속하기", + "카카오로 계속하기", + "네이버로 계속하기", + ]) { + await expect(page.getByRole("button", { name })).toBeDisabled(); + await expect( + page.getByRole("button", { name }), + ).toHaveAccessibleDescription("서비스의 로그인 연결 설정이 필요합니다."); + } +}); + +test("login responsive themes, long copy, accessible names and legal links", async ({ + page, +}) => { + test.setTimeout(90000); + const errors: string[] = []; + page.on("pageerror", (error) => errors.push(error.message)); + await page.goto("/login.html"); + for (const width of [1280, 768, 320]) { + await page.setViewportSize({ width, height: 900 }); + if (width === 320) + await page.getByRole("button", { name: "긴 문구" }).click(); + for (const theme of ["light", "dark"]) { + await expect( + page.getByRole("button", { name: "네이버로 계속하기" }), + ).toBeVisible(); + expect( + await page.evaluate(() => document.documentElement.scrollWidth), + ).toBeLessThanOrEqual(width); + if (width === 320) { + const intactWords = await page + .getByRole("heading", { level: 2 }) + .evaluate((heading) => { + const text = heading.firstChild!; + return ["사용하는", "서비스에"].every((word) => { + const start = text.textContent!.indexOf(word); + const range = document.createRange(); + range.setStart(text, start); + range.setEnd(text, start + word.length); + return range.getClientRects().length === 1; + }); + }); + expect(intactWords).toBe(true); + } + for (const name of [ + "Google로 계속하기", + "카카오로 계속하기", + "네이버로 계속하기", + ]) { + expect( + (await page.getByRole("button", { name }).boundingBox())!.height, + ).toBeGreaterThanOrEqual(48); + } + expect((await new AxeBuilder({ page }).analyze()).violations).toEqual([]); + const symbolContrast = await page + .locator('[data-provider="kakao"] .dds-login__provider-icon') + .evaluate((element) => { + const channels = getComputedStyle(element) + .backgroundColor.match(/[\d.]+/g)! + .slice(0, 3) + .map(Number); + const linear = channels.map((channel) => { + const value = channel / 255; + return value <= 0.04045 + ? value / 12.92 + : ((value + 0.055) / 1.055) ** 2.4; + }); + const background = + 0.2126 * linear[0]! + 0.7152 * linear[1]! + 0.0722 * linear[2]!; + // The unchanged provider asset is near-black (#191919); its backing must keep it legible. + const mark = ((25 / 255 + 0.055) / 1.055) ** 2.4; + return (background + 0.05) / (mark + 0.05); + }); + expect(symbolContrast).toBeGreaterThanOrEqual(3); + for (const image of await page + .locator(".dds-login__provider-icon img") + .all()) { + expect( + await image.evaluate( + (element: HTMLImageElement) => + element.complete && element.naturalWidth > 0, + ), + ).toBe(true); + } + const terms = page.getByRole("link", { name: "이용약관" }); + await page.getByRole("button", { name: "네이버로 계속하기" }).focus(); + await page.keyboard.press("Tab"); + await expect(terms).toBeFocused(); + expect( + await terms.evaluate( + (element) => getComputedStyle(element).outlineStyle, + ), + ).not.toBe("none"); + await page.screenshot({ + path: `test-results/login-${width}-${theme}.png`, + fullPage: true, + }); + await page.getByRole("button", { name: "테마 변경" }).click(); + } + } + await page.getByRole("button", { name: "언어 변경" }).click(); + await expect( + page.getByRole("button", { name: "Continue with Naver" }), + ).toBeVisible(); + await page.getByRole("button", { name: "Continue with Naver" }).click(); + await expect(page.getByLabel("시뮬레이션 이동 주소")).toHaveText( + "https://auth.example.test/authorize", + ); + await expect(page.getByRole("region").getByRole("status")).toHaveText( + "Opening the sign-in page.", + ); + expect(errors).toEqual([]); +}); + +test("a service can opt into additional methods and control order and availability", async ({ page }) => { + await page.setViewportSize({ width: 320, height: 900 }); + await page.goto("/login.html"); + await page.getByRole("button", { name: "추가 제공자 예제" }).click(); + await page.getByRole("button", { name: "언어 변경" }).click(); + const panel = page.getByRole("region", { name: "Sign in to your service" }); + await expect(panel.getByRole("button")).toHaveText([ + "Continue with Google", + "Continue with Naver", + "Continue with Discord", + "Continue with X", + "Continue with GitHub", + "Continue with Notion", + "Continue with Zoom", + "Continue with GitLab", + ]); + await expect(panel.getByRole("button", { name: "Continue with Zoom" })).toBeDisabled(); + await expect(panel.locator("[data-packaged-mark]")).toHaveCount(7); + await expect(panel.locator('[data-provider="naver"] [data-packaged-mark]')).toHaveCSS("background-image", /naver-official-symbol\.png/); + const group = panel.getByRole("group"); + const alignments = await group.evaluate((element) => { + const measure = () => ({ + icons: [...element.querySelectorAll("[data-packaged-mark]")].map((node) => node.getBoundingClientRect().left), + labels: [...element.querySelectorAll(".dds-login__provider-label")].map((node) => node.getBoundingClientRect().left), + iconOnRight: element.querySelector("[data-packaged-mark]")!.getBoundingClientRect().left > + element.querySelector(".dds-login__provider-label")!.getBoundingClientRect().left, + }); + const ltr = measure(); + element.setAttribute("dir", "rtl"); + const rtl = measure(); + element.removeAttribute("dir"); + return { ltr, rtl }; + }); + for (const { icons, labels } of [alignments.ltr, alignments.rtl]) { + expect(new Set(icons).size).toBe(1); + expect(new Set(labels).size).toBe(1); + } + expect(alignments.ltr.iconOnRight).toBe(false); + expect(alignments.rtl.iconOnRight).toBe(true); + if (process.env.DDS_AUTH_PREVIEW_PATH) { + await page.setViewportSize({ width: 390, height: 900 }); + await panel.screenshot({ path: process.env.DDS_AUTH_PREVIEW_PATH }); + await page.setViewportSize({ width: 320, height: 900 }); + } + await page.getByRole("button", { name: "테마 변경" }).click(); + const mark = panel.locator('[data-provider="x"] [data-packaged-mark]'); + await expect(mark).toHaveCSS("background-image", /x-symbol-light\.png/); + expect(await mark.evaluate(async (element) => { + const url = getComputedStyle(element).backgroundImage.slice(5, -2); + const image = new Image(); + image.src = url; + await image.decode(); + return image.naturalWidth; + })).toBeGreaterThan(0); + expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(320); + expect((await new AxeBuilder({ page }).analyze()).violations).toEqual([]); + await panel.getByRole("button", { name: "Continue with Discord" }).click(); + await expect(page.getByLabel("시뮬레이션 이동 주소")).toHaveText("https://auth.example.test/authorize"); +});