@vibexnpm/talkx 8.6.0 → 8.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1044,14 +1044,20 @@ export interface DecisionResponse {
1044
1044
  optionId: string;
1045
1045
  }
1046
1046
 
1047
+ /**
1048
+ * 회사 역할. `GUEST` 는 회사 밖에서 초대받아 그 회사 계정을 가진 사람이다 — 초대받은 방에서 채팅만 하고 PM·AI 버튼·조직도·
1049
+ * 방 만들기·초대 등은 서버가 막는다(403 `GUEST_FORBIDDEN`). 화면 노출 판단용이며 인가 근거는 아니다.
1050
+ */
1051
+ export type CompanyRole = 'PARTNER' | 'MEMBER' | 'GUEST';
1052
+
1047
1053
  /** 로그인한 회원. `userId` 는 메시지 발신자 식별과 같은 값이다. */
1048
1054
  export interface LoginMember {
1049
1055
  userId: string;
1050
1056
  email?: string | null;
1051
1057
  nickname?: string | null;
1052
1058
  profileUrl?: string | null;
1053
- /** 회사 역할 — 클라이언트가 파트너 화면 노출을 결정한다. 인가 근거는 아니다(서버가 재확인). */
1054
- companyRole: 'PARTNER' | 'MEMBER';
1059
+ /** 회사 역할 — 클라이언트가 파트너·게스트 화면 노출을 결정한다. 인가 근거는 아니다(서버가 재확인). */
1060
+ companyRole: CompanyRole;
1055
1061
  preferredLanguage?: string | null;
1056
1062
  /**
1057
1063
  * 초기 비밀번호를 아직 안 바꿨는가 — `true` 면 **비밀번호 변경 화면으로 보내라**.
@@ -1063,11 +1069,11 @@ export interface LoginMember {
1063
1069
  }
1064
1070
 
1065
1071
  /**
1066
- * `TalkFlowClient.loginUser` 응답.
1067
- *
1068
- * 회사 선택 단계가 없다 — 로그인 키가 전역 유일이라 이메일 하나로 회원과 회사가 함께 정해진다.
1072
+ * `TalkFlowClient.loginUser` 의 로그인 성공 응답. 회사 선택이 필요하면 대신 {@link WorkspaceSelection} 이 온다 —
1073
+ * `workspaceSelectionRequired` 로 가른다.
1069
1074
  */
1070
1075
  export interface LoginResult {
1076
+ workspaceSelectionRequired?: false;
1071
1077
  /** SDK가 저장·회전하는 갱신 자격. 직접 API를 쓰는 경우에만 응답에서 사용한다. */
1072
1078
  refreshToken?: string;
1073
1079
  /** 서버 현재 시각 및 refresh 만료 시각, Unix epoch 밀리초. */
@@ -1083,6 +1089,23 @@ export interface LoginResult {
1083
1089
  user: LoginMember;
1084
1090
  }
1085
1091
 
1092
+ /** 로그인 회사 선택지 하나. */
1093
+ export interface Workspace {
1094
+ projectId: string;
1095
+ companyName: string | null;
1096
+ /** 그 회사에서의 역할 — 선택 화면에 «게스트» 표시를 붙이는 데 쓴다. */
1097
+ companyRole: CompanyRole;
1098
+ }
1099
+
1100
+ /**
1101
+ * 로그인 회사 선택 결과 — 같은 이메일의 여러 회사 계정에서 비밀번호가 둘 이상 맞았다. **토큰이 없고 저장된 세션은 그대로다.**
1102
+ * 고른 `projectId` 를 실어 같은 이메일·비밀번호로 `loginUser` 를 다시 부른다.
1103
+ */
1104
+ export interface WorkspaceSelection {
1105
+ workspaceSelectionRequired: true;
1106
+ workspaces: Workspace[];
1107
+ }
1108
+
1086
1109
  /** 회사 조직도의 회원 — 초대 UI 에 필요한 것만. */
1087
1110
  export interface DirectoryMember {
1088
1111
  userId: string;
@@ -1124,7 +1147,7 @@ export interface MyProfile {
1124
1147
  phone?: string | null;
1125
1148
  profileUrl?: string | null;
1126
1149
  /** 회사 역할 — 방 역할(ParticipantResponse.role)과 다른 축이다. */
1127
- companyRole: 'PARTNER' | 'MEMBER';
1150
+ companyRole: CompanyRole;
1128
1151
  orgNodeId?: string | null;
1129
1152
  orgName?: string | null;
1130
1153
  preferredLanguage?: string | null;
@@ -1170,6 +1193,10 @@ export interface ParticipantResponse {
1170
1193
  role: 'OWNER' | 'ADMIN' | 'MEMBER' | 'ASSISTANT';
1171
1194
  /** 참가 시각(epoch millis). */
1172
1195
  joinedAt: number;
1196
+ /**
1197
+ * 회사 역할 — 게스트 배지(`GUEST`)용. 방 역할({@link role})과 다른 축이다. PM(ASSISTANT)·정보를 못 찾은 참여자는 없다.
1198
+ */
1199
+ companyRole?: CompanyRole;
1173
1200
  }
1174
1201
 
1175
1202
  /** 채팅방 last message preview. */
@@ -1280,6 +1307,8 @@ export interface RoomListMemberInfo {
1280
1307
  userId: string;
1281
1308
  nickname?: string | null;
1282
1309
  profileUrl?: string | null;
1310
+ /** 회사 역할 — 방금 들어온 게스트에도 다시 읽지 않고 배지를 그린다. PM·역할을 모르는 경로는 없다. */
1311
+ companyRole?: CompanyRole;
1283
1312
  }
1284
1313
 
1285
1314
  export interface RoomListUpdateEvent {
@@ -1934,7 +1963,7 @@ export interface ChatMessageReceivedPayload {
1934
1963
 
1935
1964
  export interface MemberChangePayload {
1936
1965
  roomId: string;
1937
- members: Array<{ userId: string; nickname?: string; profileUrl?: string | null }>;
1966
+ members: Array<{ userId: string; nickname?: string; profileUrl?: string | null; companyRole?: CompanyRole }>;
1938
1967
  participantCount: number;
1939
1968
  timestamp?: number;
1940
1969
  }
@@ -2602,16 +2631,18 @@ export default class TalkFlowClient implements SdkEventEmitter<TalkFlowClientEve
2602
2631
  /**
2603
2632
  * 회원 로그인 — 클라이언트 생성 **전에** 호출한다. Server Key 도 고객사 BFF 도 필요 없다.
2604
2633
  * 응답의 `clientKey`/`projectId`/`accessToken` 이 그대로 SDK 초기화 입력이다.
2605
- * 회사 선택 단계가 없다 — 로그인 키가 전역 유일이다.
2634
+ * 같은 이메일로 비밀번호가 맞는 회사 계정이 둘 이상이면 {@link WorkspaceSelection} 이 온다 — 고른 `projectId` 로 다시 부른다.
2606
2635
  */
2607
2636
  static loginUser(options: {
2608
2637
  serverUrl: string;
2609
2638
  email: string;
2610
2639
  password: string;
2611
- }): Promise<LoginResult>;
2640
+ /** 회사 선택 응답에서 고른 회사. */
2641
+ projectId?: string;
2642
+ }): Promise<LoginResult | WorkspaceSelection>;
2612
2643
 
2613
- /** 회원 로그인 (인스턴스) — 재로그인·계정 전환용. 성공 시 토큰을 자동 설정한다. */
2614
- loginUser(credentials: { email: string; password: string }): Promise<LoginResult>;
2644
+ /** 회원 로그인 (인스턴스) — 재로그인·계정 전환용. 성공 시 토큰을 자동 설정한다. 회사 선택 결과면 토큰을 설정하지 않는다. */
2645
+ loginUser(credentials: { email: string; password: string; projectId?: string }): Promise<LoginResult | WorkspaceSelection>;
2615
2646
 
2616
2647
  /** localStorage의 refresh로 복구. 세션이 없으면 null, 네트워크/서버 장애는 reject. */
2617
2648
  static restoreSession(options: { serverUrl: string }): Promise<LoginResult | null>;