@csntgao/uni-base 0.1.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/.prettierignore +4 -0
- package/.prettierrc.json +6 -0
- package/AGENTS.md +519 -0
- package/CLAUDE.md +512 -0
- package/README.md +734 -0
- package/docs//346/225/260/345/255/227/345/221/230/345/267/245/345/256/214/346/225/264/346/212/275/345/261/211/346/216/245/345/205/245/350/257/264/346/230/216.md +110 -0
- package/docs//347/273/204/347/273/207/345/221/230/345/267/245/345/215/225/351/200/211/347/273/204/344/273/266/346/216/245/345/205/245/350/257/264/346/230/216.md +79 -0
- package/docs//347/273/204/347/273/207/345/221/230/345/267/245/345/244/232/351/200/211/347/273/204/344/273/266/346/216/245/345/205/245/350/257/264/346/230/216.md +93 -0
- package/docs//350/264/246/346/210/267/344/270/216/347/231/273/345/275/225/347/273/204/344/273/266/345/212/250/346/200/201/346/216/245/345/205/245/350/257/264/346/230/216.md +201 -0
- package/eslint.config.js +30 -0
- package/examples/vanilla/index.html +33 -0
- package/examples/vanilla/main.js +247 -0
- package/examples/vanilla/package.json +15 -0
- package/examples/vanilla/public/runtime-config.js +10 -0
- package/examples/vanilla/style.css +99 -0
- package/package.json +31 -0
- package/packages/core/package.json +30 -0
- package/packages/core/src/client.ts +1132 -0
- package/packages/core/src/customer-support-client.ts +825 -0
- package/packages/core/src/customer-support-types.ts +123 -0
- package/packages/core/src/index.ts +79 -0
- package/packages/core/src/notification-center-client.ts +462 -0
- package/packages/core/src/notification-center-types.ts +154 -0
- package/packages/core/src/protocol.ts +237 -0
- package/packages/core/src/types.ts +170 -0
- package/packages/core/tests/client.test.ts +760 -0
- package/packages/core/tests/customer-support-client.test.ts +576 -0
- package/packages/core/tests/fake-websocket.ts +55 -0
- package/packages/core/tests/notification-center-client.test.ts +467 -0
- package/packages/core/tests/protocol.test.ts +124 -0
- package/packages/core/tsconfig.json +7 -0
- package/packages/core/tsup.config.ts +11 -0
- package/packages/web-components/package.json +35 -0
- package/packages/web-components/scripts/verify-runtime-build.mjs +111 -0
- package/packages/web-components/src/account-context.ts +1540 -0
- package/packages/web-components/src/application-switcher-transport.ts +243 -0
- package/packages/web-components/src/application-switcher.ts +1103 -0
- package/packages/web-components/src/chat.ts +1754 -0
- package/packages/web-components/src/customer-support-chat.ts +862 -0
- package/packages/web-components/src/customer-support-transport.ts +269 -0
- package/packages/web-components/src/index.ts +256 -0
- package/packages/web-components/src/notification-center.ts +1066 -0
- package/packages/web-components/src/notification-popover.ts +615 -0
- package/packages/web-components/src/organization-multi-employee-selector.ts +1564 -0
- package/packages/web-components/src/organization-onboarding-transport.ts +54 -0
- package/packages/web-components/src/organization-onboarding.ts +1216 -0
- package/packages/web-components/src/organization-selector.ts +534 -0
- package/packages/web-components/src/organization-single-employee-selector.ts +114 -0
- package/packages/web-components/src/prototype-icons.ts +242 -0
- package/packages/web-components/src/safe-image-url.ts +29 -0
- package/packages/web-components/src/safe-markdown.ts +192 -0
- package/packages/web-components/src/uniplat-base-account-context-transport.ts +625 -0
- package/packages/web-components/src/uniplat-base-application-switcher-transport.ts +418 -0
- package/packages/web-components/src/uniplat-base-application-ticket.ts +254 -0
- package/packages/web-components/src/uniplat-base-identity-ticket.ts +202 -0
- package/packages/web-components/src/uniplat-base-notification-center-transport.ts +378 -0
- package/packages/web-components/src/uniplat-base-organization-multi-employee-selector-transport.ts +394 -0
- package/packages/web-components/src/uniplat-base-organization-onboarding-transport.ts +183 -0
- package/packages/web-components/src/uniplat-base-organization-single-employee-selector-transport.ts +14 -0
- package/packages/web-components/src/user-login-transport.ts +563 -0
- package/packages/web-components/src/user-login.ts +2027 -0
- package/packages/web-components/src/user-menu.ts +880 -0
- package/packages/web-components/tests/account-context.test.ts +798 -0
- package/packages/web-components/tests/application-switcher.test.ts +562 -0
- package/packages/web-components/tests/chat.test.ts +1130 -0
- package/packages/web-components/tests/customer-support-chat.test.ts +428 -0
- package/packages/web-components/tests/customer-support-transport.test.ts +79 -0
- package/packages/web-components/tests/notification-center-transport.test.ts +271 -0
- package/packages/web-components/tests/notification-center.test.ts +429 -0
- package/packages/web-components/tests/notification-popover.test.ts +283 -0
- package/packages/web-components/tests/organization-multi-employee-selector-transport.test.ts +332 -0
- package/packages/web-components/tests/organization-multi-employee-selector.test.ts +225 -0
- package/packages/web-components/tests/organization-onboarding.test.ts +260 -0
- package/packages/web-components/tests/organization-selector.test.ts +127 -0
- package/packages/web-components/tests/organization-single-employee-selector.test.ts +145 -0
- package/packages/web-components/tests/uniplat-base-account-context-transport.test.ts +496 -0
- package/packages/web-components/tests/uniplat-base-application-switcher-transport.test.ts +598 -0
- package/packages/web-components/tests/uniplat-base-application-ticket.test.ts +233 -0
- package/packages/web-components/tests/uniplat-base-identity-ticket.test.ts +226 -0
- package/packages/web-components/tests/uniplat-base-organization-onboarding-transport.test.ts +227 -0
- package/packages/web-components/tests/user-login-transport.test.ts +443 -0
- package/packages/web-components/tests/user-login.test.ts +626 -0
- package/packages/web-components/tests/user-menu.test.ts +271 -0
- package/packages/web-components/tsconfig.json +8 -0
- package/packages/web-components/tsup.config.ts +12 -0
- package/packages/web-components/tsup.runtime.config.ts +37 -0
- package/pnpm-workspace.yaml +6 -0
- package/tsconfig.base.json +21 -0
- package/vitest.config.ts +20 -0
- package//344/272/244/346/216/245/346/226/207/346/241/243.md +254 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
CustomerSupportAgent,
|
|
3
|
+
CustomerSupportCreateSessionResult,
|
|
4
|
+
CustomerSupportMessage,
|
|
5
|
+
CustomerSupportMessagePage,
|
|
6
|
+
CustomerSupportSenderType,
|
|
7
|
+
CustomerSupportSession,
|
|
8
|
+
CustomerSupportSessionStatus,
|
|
9
|
+
CustomerSupportTransport,
|
|
10
|
+
} from '@uniplat/ai-employee-client'
|
|
11
|
+
|
|
12
|
+
export interface HrSaasCustomerSupportTransportOptions {
|
|
13
|
+
serviceBaseUrl: string
|
|
14
|
+
getAccessToken(): string | Promise<string>
|
|
15
|
+
fetch?: typeof fetch
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const SESSION_PAGE_ACTION = 'user_session_page'
|
|
19
|
+
const SESSION_CREATE_ACTION = 'user_session_create'
|
|
20
|
+
const SESSION_DETAIL_ACTION = 'user_session_detail'
|
|
21
|
+
const MESSAGE_PAGE_ACTION = 'user_message_page'
|
|
22
|
+
const MESSAGE_SEND_ACTION = 'user_message_send'
|
|
23
|
+
const MARK_READ_ACTION = 'user_mark_read'
|
|
24
|
+
|
|
25
|
+
export function createHrSaasCustomerSupportTransport(
|
|
26
|
+
options: HrSaasCustomerSupportTransportOptions,
|
|
27
|
+
): CustomerSupportTransport {
|
|
28
|
+
if (!options || typeof options.getAccessToken !== 'function') {
|
|
29
|
+
throw new TypeError('Customer support transport requires getAccessToken()')
|
|
30
|
+
}
|
|
31
|
+
const serviceBaseUrl = validateServiceBaseUrl(options.serviceBaseUrl)
|
|
32
|
+
const fetchImplementation = options.fetch ?? globalThis.fetch
|
|
33
|
+
const request = async (action: string, body: Record<string, unknown>): Promise<unknown> => {
|
|
34
|
+
const token = await resolveAccessToken(options.getAccessToken)
|
|
35
|
+
return requestData(fetchImplementation, `${serviceBaseUrl}/${action}`, token, body)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
async getAccessToken() {
|
|
40
|
+
return resolveAccessToken(options.getAccessToken)
|
|
41
|
+
},
|
|
42
|
+
async listSessions() {
|
|
43
|
+
const data = record(await request(SESSION_PAGE_ACTION, { page_index: 1, page_size: 100 }))
|
|
44
|
+
return Array.isArray(data.list)
|
|
45
|
+
? data.list
|
|
46
|
+
.map(parseSession)
|
|
47
|
+
.filter((value): value is CustomerSupportSession => value !== null)
|
|
48
|
+
: []
|
|
49
|
+
},
|
|
50
|
+
async createSession(createRequest) {
|
|
51
|
+
const body: Record<string, unknown> = {
|
|
52
|
+
client_request_id: requiredText(createRequest.clientRequestId, 128),
|
|
53
|
+
}
|
|
54
|
+
const title = optionalText(createRequest.title, 200)
|
|
55
|
+
const initialMessage = optionalText(createRequest.initialMessage, 8_000)
|
|
56
|
+
if (title) body.title = title
|
|
57
|
+
if (initialMessage) body.initial_message = initialMessage
|
|
58
|
+
const data = record(await request(SESSION_CREATE_ACTION, body))
|
|
59
|
+
const session = parseSession(data.session ?? data)
|
|
60
|
+
if (!session) throw new Error('Invalid customer support session response')
|
|
61
|
+
const parsedInitialMessage = parseMessage(data.initial_message)
|
|
62
|
+
const result: CustomerSupportCreateSessionResult = { session }
|
|
63
|
+
if (parsedInitialMessage) result.initialMessage = parsedInitialMessage
|
|
64
|
+
return result
|
|
65
|
+
},
|
|
66
|
+
async getSession(sessionId) {
|
|
67
|
+
const data = await request(SESSION_DETAIL_ACTION, {
|
|
68
|
+
session_id: requiredText(sessionId, 128),
|
|
69
|
+
})
|
|
70
|
+
const session = parseSession(data)
|
|
71
|
+
if (!session) throw new Error('Invalid customer support session response')
|
|
72
|
+
return session
|
|
73
|
+
},
|
|
74
|
+
async listMessages(sessionId) {
|
|
75
|
+
const data = record(
|
|
76
|
+
await request(MESSAGE_PAGE_ACTION, {
|
|
77
|
+
session_id: requiredText(sessionId, 128),
|
|
78
|
+
page_size: 100,
|
|
79
|
+
before_sequence: null,
|
|
80
|
+
}),
|
|
81
|
+
)
|
|
82
|
+
const page: CustomerSupportMessagePage = {
|
|
83
|
+
messages: Array.isArray(data.messages)
|
|
84
|
+
? data.messages
|
|
85
|
+
.map(parseMessage)
|
|
86
|
+
.filter((value): value is CustomerSupportMessage => value !== null)
|
|
87
|
+
: [],
|
|
88
|
+
latestSequence: text(data.latest_sequence),
|
|
89
|
+
sessionVersion: text(data.session_version),
|
|
90
|
+
}
|
|
91
|
+
return page
|
|
92
|
+
},
|
|
93
|
+
async sendMessage(sessionId, clientMessageId, content) {
|
|
94
|
+
const data = record(
|
|
95
|
+
await request(MESSAGE_SEND_ACTION, {
|
|
96
|
+
session_id: requiredText(sessionId, 128),
|
|
97
|
+
client_message_id: requiredText(clientMessageId, 128),
|
|
98
|
+
content: requiredText(content, 8_000),
|
|
99
|
+
attachments: [],
|
|
100
|
+
}),
|
|
101
|
+
)
|
|
102
|
+
const message = parseMessage(data.message)
|
|
103
|
+
if (!message) throw new Error('Invalid customer support message response')
|
|
104
|
+
return message
|
|
105
|
+
},
|
|
106
|
+
async markRead(sessionId, lastReadSequence) {
|
|
107
|
+
await request(MARK_READ_ACTION, {
|
|
108
|
+
session_id: requiredText(sessionId, 128),
|
|
109
|
+
last_read_sequence: requiredText(lastReadSequence, 128),
|
|
110
|
+
})
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function parseSession(value: unknown): CustomerSupportSession | null {
|
|
116
|
+
const data = record(value)
|
|
117
|
+
const id = text(data.session_id ?? data.id)
|
|
118
|
+
if (!id) return null
|
|
119
|
+
const primaryAgent = parseAgent(data.primary_agent)
|
|
120
|
+
const lastMessage = record(data.last_message)
|
|
121
|
+
return {
|
|
122
|
+
id,
|
|
123
|
+
sessionNo: text(data.session_no),
|
|
124
|
+
title: text(data.title) || '企业服务顾问',
|
|
125
|
+
status: sessionStatus(data.status),
|
|
126
|
+
statusText: text(data.status_text),
|
|
127
|
+
primaryAgent,
|
|
128
|
+
lastMessage: text(lastMessage.content_preview),
|
|
129
|
+
unreadCount: nonNegativeInteger(data.unread_count),
|
|
130
|
+
openedAt: text(data.opened_at),
|
|
131
|
+
updatedAt: text(data.updated_at),
|
|
132
|
+
version: text(data.version),
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function parseAgent(value: unknown): CustomerSupportAgent | null {
|
|
137
|
+
const data = record(value)
|
|
138
|
+
const id = text(data.agent_id)
|
|
139
|
+
const name = text(data.name)
|
|
140
|
+
if (!id && !name) return null
|
|
141
|
+
return {
|
|
142
|
+
id,
|
|
143
|
+
name: name || '人工顾问',
|
|
144
|
+
avatarUrl: safeImageUrl(data.avatar_url),
|
|
145
|
+
roleName: text(data.role_name) || '客服专员',
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function parseMessage(value: unknown): CustomerSupportMessage | null {
|
|
150
|
+
const data = record(value)
|
|
151
|
+
const id = text(data.message_id ?? data.id)
|
|
152
|
+
const sessionId = text(data.session_id)
|
|
153
|
+
if (!id || !sessionId) return null
|
|
154
|
+
return {
|
|
155
|
+
id,
|
|
156
|
+
sessionId,
|
|
157
|
+
sequence: text(data.sequence),
|
|
158
|
+
clientMessageId: text(data.client_message_id),
|
|
159
|
+
senderType: senderType(data.sender_type),
|
|
160
|
+
senderName: text(data.sender_name),
|
|
161
|
+
content: text(data.content),
|
|
162
|
+
createdAt: text(data.created_at),
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function requestData(
|
|
167
|
+
fetchImplementation: typeof fetch | undefined,
|
|
168
|
+
endpoint: string,
|
|
169
|
+
accessToken: string,
|
|
170
|
+
body: Record<string, unknown>,
|
|
171
|
+
): Promise<unknown> {
|
|
172
|
+
if (!fetchImplementation) throw new Error('Fetch is unavailable')
|
|
173
|
+
const response = await fetchImplementation(endpoint, {
|
|
174
|
+
method: 'POST',
|
|
175
|
+
credentials: 'include',
|
|
176
|
+
headers: {
|
|
177
|
+
accept: 'application/json',
|
|
178
|
+
authorization: `Bearer ${accessToken}`,
|
|
179
|
+
'content-type': 'application/json',
|
|
180
|
+
},
|
|
181
|
+
body: JSON.stringify(body),
|
|
182
|
+
})
|
|
183
|
+
if (!response.ok) throw new Error('Customer support request failed')
|
|
184
|
+
const payload: unknown = await response.json()
|
|
185
|
+
const envelope = record(payload)
|
|
186
|
+
if ('rescode' in envelope) {
|
|
187
|
+
if (Number(envelope.rescode) !== 0) throw new Error('Customer support request failed')
|
|
188
|
+
return envelope.data
|
|
189
|
+
}
|
|
190
|
+
return payload
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function validateServiceBaseUrl(value: string): string {
|
|
194
|
+
const raw = typeof value === 'string' ? value.trim() : ''
|
|
195
|
+
if (!raw) throw new TypeError('Customer support serviceBaseUrl is required')
|
|
196
|
+
const base = typeof document === 'undefined' ? 'https://localhost/' : document.baseURI
|
|
197
|
+
let parsed: URL
|
|
198
|
+
try {
|
|
199
|
+
parsed = new URL(raw, base)
|
|
200
|
+
} catch {
|
|
201
|
+
throw new TypeError('Customer support serviceBaseUrl is invalid')
|
|
202
|
+
}
|
|
203
|
+
if (!['http:', 'https:'].includes(parsed.protocol) || parsed.username || parsed.password) {
|
|
204
|
+
throw new TypeError('Customer support serviceBaseUrl must use safe HTTP(S)')
|
|
205
|
+
}
|
|
206
|
+
if (parsed.search || parsed.hash) {
|
|
207
|
+
throw new TypeError('Customer support serviceBaseUrl must not contain query or hash')
|
|
208
|
+
}
|
|
209
|
+
return parsed.href.replace(/\/$/, '')
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
async function resolveAccessToken(provider: () => string | Promise<string>): Promise<string> {
|
|
213
|
+
let value = ''
|
|
214
|
+
try {
|
|
215
|
+
value = (await provider()).trim()
|
|
216
|
+
} catch {
|
|
217
|
+
// Provider details may contain credentials and are intentionally discarded.
|
|
218
|
+
}
|
|
219
|
+
if (!value) throw new Error('Access token is unavailable')
|
|
220
|
+
return value
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function requiredText(value: unknown, maximumLength: number): string {
|
|
224
|
+
const normalized = optionalText(value, maximumLength)
|
|
225
|
+
if (!normalized) throw new Error('Required customer support field is missing')
|
|
226
|
+
return normalized
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function optionalText(value: unknown, maximumLength: number): string {
|
|
230
|
+
return typeof value === 'string' ? value.trim().slice(0, maximumLength) : ''
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function text(value: unknown): string {
|
|
234
|
+
return typeof value === 'string' || typeof value === 'number' ? String(value).trim() : ''
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function record(value: unknown): Record<string, unknown> {
|
|
238
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
239
|
+
? (value as Record<string, unknown>)
|
|
240
|
+
: {}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function sessionStatus(value: unknown): CustomerSupportSessionStatus {
|
|
244
|
+
return value === 'active' || value === 'closed' ? value : 'waiting'
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function senderType(value: unknown): CustomerSupportSenderType {
|
|
248
|
+
return value === 'customer' || value === 'agent' ? value : 'system'
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function nonNegativeInteger(value: unknown): number {
|
|
252
|
+
const parsed = Number(value)
|
|
253
|
+
return Number.isFinite(parsed) && parsed > 0 ? Math.floor(parsed) : 0
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function safeImageUrl(value: unknown): string {
|
|
257
|
+
const raw = text(value)
|
|
258
|
+
if (!raw) return ''
|
|
259
|
+
try {
|
|
260
|
+
const base = typeof document === 'undefined' ? 'https://localhost/' : document.baseURI
|
|
261
|
+
const url = new URL(raw, base)
|
|
262
|
+
if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password || url.hash) {
|
|
263
|
+
return ''
|
|
264
|
+
}
|
|
265
|
+
return url.href
|
|
266
|
+
} catch {
|
|
267
|
+
return ''
|
|
268
|
+
}
|
|
269
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { UniplatAccountContext } from './account-context'
|
|
2
|
+
import { UniplatAiEmployeeChat } from './chat'
|
|
3
|
+
import { UniplatCustomerSupportChat } from './customer-support-chat'
|
|
4
|
+
import { UniplatNotificationCenter } from './notification-center'
|
|
5
|
+
import { UniplatNotificationPopover } from './notification-popover'
|
|
6
|
+
import { UniplatOrganizationMultiEmployeeSelectorElement } from './organization-multi-employee-selector'
|
|
7
|
+
import { UniplatOrganizationSingleEmployeeSelectorElement } from './organization-single-employee-selector'
|
|
8
|
+
import { UniplatOrganizationSelector } from './organization-selector'
|
|
9
|
+
import { UniplatUserLogin } from './user-login'
|
|
10
|
+
import { UniplatUserMenu } from './user-menu'
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
UniplatAccountContext,
|
|
14
|
+
UniplatAiEmployeeChat,
|
|
15
|
+
UniplatCustomerSupportChat,
|
|
16
|
+
UniplatNotificationCenter,
|
|
17
|
+
UniplatNotificationPopover,
|
|
18
|
+
UniplatOrganizationMultiEmployeeSelectorElement,
|
|
19
|
+
UniplatOrganizationSingleEmployeeSelectorElement,
|
|
20
|
+
UniplatOrganizationSelector,
|
|
21
|
+
UniplatUserLogin,
|
|
22
|
+
UniplatUserMenu,
|
|
23
|
+
}
|
|
24
|
+
export type {
|
|
25
|
+
AccountContextConfig,
|
|
26
|
+
AccountContextEmployeeInfo,
|
|
27
|
+
AccountContextEventMap,
|
|
28
|
+
AccountContextOrganization,
|
|
29
|
+
AccountContextOrganizationType,
|
|
30
|
+
AccountContextProjection,
|
|
31
|
+
AccountContextTransport,
|
|
32
|
+
AccountContextUser,
|
|
33
|
+
} from './account-context'
|
|
34
|
+
export {
|
|
35
|
+
createUniplatBaseAccountContextTransport,
|
|
36
|
+
UniplatBaseAccountContextTransportError,
|
|
37
|
+
} from './uniplat-base-account-context-transport'
|
|
38
|
+
export type {
|
|
39
|
+
AccountContextApplicationScope,
|
|
40
|
+
UniplatBaseAccountContextIdentity,
|
|
41
|
+
UniplatBaseAccountContextProjection,
|
|
42
|
+
UniplatBaseAccountContextTransport,
|
|
43
|
+
UniplatBaseAccountContextTransportErrorCode,
|
|
44
|
+
UniplatBaseAccountContextTransportOptions,
|
|
45
|
+
} from './uniplat-base-account-context-transport'
|
|
46
|
+
export {
|
|
47
|
+
MOCK_APPLICATION_ENTRIES,
|
|
48
|
+
MOCK_ORGANIZATIONS,
|
|
49
|
+
createHttpApplicationSwitcherTransport,
|
|
50
|
+
createMockApplicationSwitcherTransport,
|
|
51
|
+
} from './application-switcher-transport'
|
|
52
|
+
export {
|
|
53
|
+
UNIPLAT_APPLICATION_TICKET_FRAGMENT_KEY,
|
|
54
|
+
UNIPLAT_APPLICATION_TICKET_SOURCE_SYSTEM_FRAGMENT_KEY,
|
|
55
|
+
exchangeUniplatBaseApplicationTicket,
|
|
56
|
+
} from './uniplat-base-application-ticket'
|
|
57
|
+
export { createUniplatBaseApplicationSwitcherTransport } from './uniplat-base-application-switcher-transport'
|
|
58
|
+
export {
|
|
59
|
+
loginWithUniplatBaseIdentityTicket,
|
|
60
|
+
UNIPLAT_IDENTITY_TICKET_FRAGMENT_KEY,
|
|
61
|
+
UNIPLAT_IDENTITY_TICKET_SOURCE_SYSTEM_FRAGMENT_KEY,
|
|
62
|
+
} from './uniplat-base-identity-ticket'
|
|
63
|
+
export type {
|
|
64
|
+
ApplicationEntry,
|
|
65
|
+
ApplicationLaunchResult,
|
|
66
|
+
ApplicationSwitcherConfig,
|
|
67
|
+
ApplicationSwitcherTransport,
|
|
68
|
+
HttpApplicationSwitcherTransportOptions,
|
|
69
|
+
OrganizationEntry,
|
|
70
|
+
OrganizationListResult,
|
|
71
|
+
} from './application-switcher-transport'
|
|
72
|
+
export type { UniplatBaseApplicationTicketExchangeOptions } from './uniplat-base-application-ticket'
|
|
73
|
+
export type { UniplatBaseApplicationSwitcherTransportOptions } from './uniplat-base-application-switcher-transport'
|
|
74
|
+
export type { UniplatBaseIdentityTicketLoginOptions } from './uniplat-base-identity-ticket'
|
|
75
|
+
export type { AiEmployeeChatConfig, AiEmployeeChatEventMap } from './chat'
|
|
76
|
+
export type {
|
|
77
|
+
CustomerSupportChatConfig,
|
|
78
|
+
CustomerSupportChatEventMap,
|
|
79
|
+
} from './customer-support-chat'
|
|
80
|
+
export { createHrSaasCustomerSupportTransport } from './customer-support-transport'
|
|
81
|
+
export type { HrSaasCustomerSupportTransportOptions } from './customer-support-transport'
|
|
82
|
+
export type {
|
|
83
|
+
NotificationCenterConfig,
|
|
84
|
+
NotificationCenterEventMap,
|
|
85
|
+
NotificationCenterTypeIconMap,
|
|
86
|
+
NotificationResourceRequestedDetail,
|
|
87
|
+
} from './notification-center'
|
|
88
|
+
export type {
|
|
89
|
+
NotificationCenterRequestedDetail,
|
|
90
|
+
NotificationPopoverConfig,
|
|
91
|
+
NotificationPopoverEventMap,
|
|
92
|
+
} from './notification-popover'
|
|
93
|
+
export { createUniplatBaseNotificationCenterTransport } from './uniplat-base-notification-center-transport'
|
|
94
|
+
export type { UniplatBaseNotificationCenterTransportOptions } from './uniplat-base-notification-center-transport'
|
|
95
|
+
export { OrganizationMultiEmployeeSelectorTransportError } from './organization-multi-employee-selector'
|
|
96
|
+
export type {
|
|
97
|
+
OrganizationDepartmentNode,
|
|
98
|
+
OrganizationEmployeeAvatar,
|
|
99
|
+
OrganizationEmployeeEmploymentStatus,
|
|
100
|
+
OrganizationEmployeePage,
|
|
101
|
+
OrganizationEmployeeSelectionItem,
|
|
102
|
+
OrganizationMultiEmployeeSelectionConfirmedDetail,
|
|
103
|
+
OrganizationMultiEmployeeSelectorConfig,
|
|
104
|
+
OrganizationMultiEmployeeSelectorDisabledSelection,
|
|
105
|
+
OrganizationMultiEmployeeSelectorErrorDetail,
|
|
106
|
+
OrganizationMultiEmployeeSelectorEventMap,
|
|
107
|
+
OrganizationMultiEmployeeSelectorOpenOptions,
|
|
108
|
+
UniplatOrganizationMultiEmployeeSelectorTransport,
|
|
109
|
+
} from './organization-multi-employee-selector'
|
|
110
|
+
export { createUniplatBaseOrganizationMultiEmployeeSelectorTransport } from './uniplat-base-organization-multi-employee-selector-transport'
|
|
111
|
+
export type { UniplatBaseOrganizationMultiEmployeeSelectorTransportOptions } from './uniplat-base-organization-multi-employee-selector-transport'
|
|
112
|
+
export type {
|
|
113
|
+
OrganizationSingleEmployeeSelectionConfirmedDetail,
|
|
114
|
+
OrganizationSingleEmployeeSelectorConfig,
|
|
115
|
+
OrganizationSingleEmployeeSelectorDisabledSelection,
|
|
116
|
+
OrganizationSingleEmployeeSelectorErrorDetail,
|
|
117
|
+
OrganizationSingleEmployeeSelectorEventMap,
|
|
118
|
+
OrganizationSingleEmployeeSelectorOpenOptions,
|
|
119
|
+
UniplatOrganizationSingleEmployeeSelectorTransport,
|
|
120
|
+
} from './organization-single-employee-selector'
|
|
121
|
+
export { createUniplatBaseOrganizationSingleEmployeeSelectorTransport } from './uniplat-base-organization-single-employee-selector-transport'
|
|
122
|
+
export type { UniplatBaseOrganizationSingleEmployeeSelectorTransportOptions } from './uniplat-base-organization-single-employee-selector-transport'
|
|
123
|
+
export {
|
|
124
|
+
createMockOrganizationOnboardingTransport,
|
|
125
|
+
OrganizationOnboardingTransportError,
|
|
126
|
+
} from './organization-onboarding-transport'
|
|
127
|
+
export { createUniplatBaseOrganizationOnboardingTransport } from './uniplat-base-organization-onboarding-transport'
|
|
128
|
+
export type {
|
|
129
|
+
CreatedOnboardingOrganization,
|
|
130
|
+
CreateEnterpriseRequest,
|
|
131
|
+
CreateTeamRequest,
|
|
132
|
+
OnboardingOrganizationType,
|
|
133
|
+
OrganizationOnboardingTransport,
|
|
134
|
+
OrganizationOnboardingTransportErrorCode,
|
|
135
|
+
} from './organization-onboarding-transport'
|
|
136
|
+
export type { UniplatBaseOrganizationOnboardingTransportOptions } from './uniplat-base-organization-onboarding-transport'
|
|
137
|
+
export type {
|
|
138
|
+
EnterpriseVerificationStatus,
|
|
139
|
+
OrganizationSelectorConfig,
|
|
140
|
+
OrganizationSelectorEntry,
|
|
141
|
+
OrganizationSelectorEventMap,
|
|
142
|
+
OrganizationSelectorType,
|
|
143
|
+
} from './organization-selector'
|
|
144
|
+
export type {
|
|
145
|
+
UserLoginConfig,
|
|
146
|
+
UserLoginErrorCode,
|
|
147
|
+
UserLoginErrorDetail,
|
|
148
|
+
UserLoginEventMap,
|
|
149
|
+
UserLoginMethod,
|
|
150
|
+
} from './user-login'
|
|
151
|
+
export {
|
|
152
|
+
createUniplatBaseUserLoginTransport,
|
|
153
|
+
UserLoginTransportError,
|
|
154
|
+
} from './user-login-transport'
|
|
155
|
+
export type {
|
|
156
|
+
UniplatBaseUserLoginDeviceInfo,
|
|
157
|
+
UniplatBaseUserLoginMetadata,
|
|
158
|
+
UniplatBaseUserLoginTransportOptions,
|
|
159
|
+
UserLoginCaptcha,
|
|
160
|
+
UserLoginPasswordRequest,
|
|
161
|
+
UserLoginQrChallenge,
|
|
162
|
+
UserLoginQrChallengeRequest,
|
|
163
|
+
UserLoginQrPollResult,
|
|
164
|
+
UserLoginQrStatus,
|
|
165
|
+
UserLoginRequest,
|
|
166
|
+
UserLoginSmsRequest,
|
|
167
|
+
UserLoginSuccess,
|
|
168
|
+
UserLoginTransport,
|
|
169
|
+
UserLoginTransportErrorCode,
|
|
170
|
+
} from './user-login-transport'
|
|
171
|
+
export type {
|
|
172
|
+
UserMenuConfig,
|
|
173
|
+
UserMenuEventMap,
|
|
174
|
+
UserMenuOrganization,
|
|
175
|
+
UserMenuOrganizationType,
|
|
176
|
+
} from './user-menu'
|
|
177
|
+
|
|
178
|
+
export const AI_EMPLOYEE_CHAT_TAG = 'uniplat-ai-employee-chat' as const
|
|
179
|
+
export const CUSTOMER_SUPPORT_CHAT_TAG = 'uniplat-customer-support-chat' as const
|
|
180
|
+
export const NOTIFICATION_CENTER_TAG = 'uniplat-notification-center' as const
|
|
181
|
+
export const NOTIFICATION_POPOVER_TAG = 'uniplat-notification-popover' as const
|
|
182
|
+
export const ACCOUNT_CONTEXT_TAG = 'uniplat-account-context' as const
|
|
183
|
+
export const ORGANIZATION_MULTI_EMPLOYEE_SELECTOR_TAG =
|
|
184
|
+
'uniplat-organization-multi-employee-selector' as const
|
|
185
|
+
export const ORGANIZATION_SINGLE_EMPLOYEE_SELECTOR_TAG =
|
|
186
|
+
'uniplat-organization-single-employee-selector' as const
|
|
187
|
+
export const ORGANIZATION_SELECTOR_TAG = 'uniplat-organization-selector' as const
|
|
188
|
+
export const USER_LOGIN_TAG = 'uniplat-user-login' as const
|
|
189
|
+
export const USER_MENU_TAG = 'uniplat-user-menu' as const
|
|
190
|
+
|
|
191
|
+
if (typeof customElements !== 'undefined' && !customElements.get(ACCOUNT_CONTEXT_TAG)) {
|
|
192
|
+
customElements.define(ACCOUNT_CONTEXT_TAG, UniplatAccountContext)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (typeof customElements !== 'undefined' && !customElements.get(AI_EMPLOYEE_CHAT_TAG)) {
|
|
196
|
+
customElements.define(AI_EMPLOYEE_CHAT_TAG, UniplatAiEmployeeChat)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (typeof customElements !== 'undefined' && !customElements.get(CUSTOMER_SUPPORT_CHAT_TAG)) {
|
|
200
|
+
customElements.define(CUSTOMER_SUPPORT_CHAT_TAG, UniplatCustomerSupportChat)
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (typeof customElements !== 'undefined' && !customElements.get(NOTIFICATION_CENTER_TAG)) {
|
|
204
|
+
customElements.define(NOTIFICATION_CENTER_TAG, UniplatNotificationCenter)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (typeof customElements !== 'undefined' && !customElements.get(NOTIFICATION_POPOVER_TAG)) {
|
|
208
|
+
customElements.define(NOTIFICATION_POPOVER_TAG, UniplatNotificationPopover)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (
|
|
212
|
+
typeof customElements !== 'undefined' &&
|
|
213
|
+
!customElements.get(ORGANIZATION_MULTI_EMPLOYEE_SELECTOR_TAG)
|
|
214
|
+
) {
|
|
215
|
+
customElements.define(
|
|
216
|
+
ORGANIZATION_MULTI_EMPLOYEE_SELECTOR_TAG,
|
|
217
|
+
UniplatOrganizationMultiEmployeeSelectorElement,
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (
|
|
222
|
+
typeof customElements !== 'undefined' &&
|
|
223
|
+
!customElements.get(ORGANIZATION_SINGLE_EMPLOYEE_SELECTOR_TAG)
|
|
224
|
+
) {
|
|
225
|
+
customElements.define(
|
|
226
|
+
ORGANIZATION_SINGLE_EMPLOYEE_SELECTOR_TAG,
|
|
227
|
+
UniplatOrganizationSingleEmployeeSelectorElement,
|
|
228
|
+
)
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (typeof customElements !== 'undefined' && !customElements.get(ORGANIZATION_SELECTOR_TAG)) {
|
|
232
|
+
customElements.define(ORGANIZATION_SELECTOR_TAG, UniplatOrganizationSelector)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (typeof customElements !== 'undefined' && !customElements.get(USER_LOGIN_TAG)) {
|
|
236
|
+
customElements.define(USER_LOGIN_TAG, UniplatUserLogin)
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (typeof customElements !== 'undefined' && !customElements.get(USER_MENU_TAG)) {
|
|
240
|
+
customElements.define(USER_MENU_TAG, UniplatUserMenu)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
declare global {
|
|
244
|
+
interface HTMLElementTagNameMap {
|
|
245
|
+
'uniplat-account-context': UniplatAccountContext
|
|
246
|
+
'uniplat-ai-employee-chat': UniplatAiEmployeeChat
|
|
247
|
+
'uniplat-customer-support-chat': UniplatCustomerSupportChat
|
|
248
|
+
'uniplat-notification-center': UniplatNotificationCenter
|
|
249
|
+
'uniplat-notification-popover': UniplatNotificationPopover
|
|
250
|
+
'uniplat-organization-multi-employee-selector': UniplatOrganizationMultiEmployeeSelectorElement
|
|
251
|
+
'uniplat-organization-single-employee-selector': UniplatOrganizationSingleEmployeeSelectorElement
|
|
252
|
+
'uniplat-organization-selector': UniplatOrganizationSelector
|
|
253
|
+
'uniplat-user-login': UniplatUserLogin
|
|
254
|
+
'uniplat-user-menu': UniplatUserMenu
|
|
255
|
+
}
|
|
256
|
+
}
|