@synchra24/app-ui 0.1.0 → 0.3.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/CHANGELOG.md +17 -0
- package/README.md +24 -2
- package/custom-elements.json +465 -0
- package/dist/auto.js +1745 -24
- package/dist/index.d.ts +146 -2
- package/dist/index.js +1745 -24
- package/dist/react.d.ts +66 -1
- package/dist/synchra-app-ui.js +131 -8
- package/docs/AI-AGENT.md +28 -0
- package/docs/API.md +181 -0
- package/docs/DEVELOPMENT.md +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
export type SheetValues = Record<string, string | boolean>;
|
|
2
|
+
export type SheetNode =
|
|
3
|
+
| { type: 'text'; text: string; tone?: 'default' | 'secondary' }
|
|
4
|
+
| { type: 'divider' }
|
|
5
|
+
| { type: 'section'; title: string; description?: string; children: SheetNode[] }
|
|
6
|
+
| { type: 'input'; name: string; label: string; description?: string; placeholder?: string; value?: string; required?: boolean; disabled?: boolean; multiline?: boolean; maxLength?: number }
|
|
7
|
+
| { type: 'select'; name: string; label: string; description?: string; placeholder?: string; value?: string; required?: boolean; disabled?: boolean; options: { value: string; label: string; disabled?: boolean }[] }
|
|
8
|
+
| { type: 'toggle'; name: string; label: string; description?: string; value?: boolean; disabled?: boolean };
|
|
9
|
+
export interface SheetDefinition {
|
|
10
|
+
version: 1;
|
|
11
|
+
title: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
content: SheetNode[];
|
|
14
|
+
actions: { id: string; label: string; kind: 'submit' | 'cancel' | 'reset'; primary?: boolean }[];
|
|
15
|
+
resetValues?: SheetValues;
|
|
16
|
+
}
|
|
17
|
+
export interface SheetResult { supported: boolean; cancelled?: boolean; action?: string; values?: SheetValues; sheet_id?: string }
|
|
18
|
+
export interface SheetElement extends HTMLElement {
|
|
19
|
+
show(definition: SheetDefinition): Promise<SheetResult>;
|
|
20
|
+
close(): void;
|
|
21
|
+
}
|
|
22
|
+
|
|
1
23
|
export const version: string;
|
|
2
24
|
export type Runtime = "web" | "mobile";
|
|
3
25
|
export interface Theme {
|
|
@@ -21,7 +43,11 @@ export interface SDK {
|
|
|
21
43
|
inputEditor?: number;
|
|
22
44
|
nativePickers?: number;
|
|
23
45
|
nativeSelect?: number;
|
|
46
|
+
nativeSheet?: number;
|
|
47
|
+
serviceWidgets?: number;
|
|
24
48
|
};
|
|
49
|
+
openSheet?(definition: SheetDefinition, options?: { id?: string }): Promise<SheetResult>;
|
|
50
|
+
closeSheet?(id: string): Promise<{ supported: boolean; closed?: boolean }>;
|
|
25
51
|
selectOption?(options: {
|
|
26
52
|
value?: string;
|
|
27
53
|
label?: string;
|
|
@@ -41,7 +67,7 @@ export interface SDK {
|
|
|
41
67
|
time?: string;
|
|
42
68
|
}): Promise<{ time?: string; cancelled?: boolean; supported?: boolean }>;
|
|
43
69
|
editText?(
|
|
44
|
-
options: Record<string, unknown
|
|
70
|
+
options: Record<string, unknown>
|
|
45
71
|
): Promise<
|
|
46
72
|
| { supported: false }
|
|
47
73
|
| { supported: true; cancelled?: boolean; value: string }
|
|
@@ -110,13 +136,14 @@ export interface DialogElement extends HTMLElement {
|
|
|
110
136
|
export function defineComponents(registry?: CustomElementRegistry): void;
|
|
111
137
|
export function connect(
|
|
112
138
|
root: HTMLElement,
|
|
113
|
-
options?: { sdk?: SDK; runtime?: Runtime; theme?: Theme | null }
|
|
139
|
+
options?: { sdk?: SDK; runtime?: Runtime; theme?: Theme | null }
|
|
114
140
|
): () => void;
|
|
115
141
|
export const geometry: Record<Runtime, Record<string, string>>;
|
|
116
142
|
declare global {
|
|
117
143
|
interface HTMLElementTagNameMap {
|
|
118
144
|
"s24-button": ButtonElement;
|
|
119
145
|
"s24-circle-button": CircleButtonElement;
|
|
146
|
+
"s24-search": ValueElement;
|
|
120
147
|
"s24-input": ValueElement;
|
|
121
148
|
"s24-textarea": ValueElement;
|
|
122
149
|
"s24-checkbox": ChoiceElement;
|
|
@@ -127,6 +154,7 @@ declare global {
|
|
|
127
154
|
"s24-time-picker": PickerElement;
|
|
128
155
|
"s24-slider": SliderElement;
|
|
129
156
|
"s24-dialog": DialogElement;
|
|
157
|
+
"s24-sheet": SheetElement;
|
|
130
158
|
"s24-tabs": TabsElement;
|
|
131
159
|
"s24-tab": HTMLElement;
|
|
132
160
|
"s24-island": HTMLElement;
|
|
@@ -143,3 +171,119 @@ declare global {
|
|
|
143
171
|
"s24-empty": HTMLElement;
|
|
144
172
|
}
|
|
145
173
|
}
|
|
174
|
+
|
|
175
|
+
/** Employee IDs are company profile IDs, never account user IDs. */
|
|
176
|
+
export interface EmployeeItem {
|
|
177
|
+
profile_id: number;
|
|
178
|
+
name: string;
|
|
179
|
+
position?: string;
|
|
180
|
+
avatar?: string;
|
|
181
|
+
}
|
|
182
|
+
export interface AttachmentItem {
|
|
183
|
+
id?: string;
|
|
184
|
+
file?: string;
|
|
185
|
+
bucket?: string;
|
|
186
|
+
name: string;
|
|
187
|
+
type?: string;
|
|
188
|
+
size?: number;
|
|
189
|
+
/** Preview data URL, or a safe URL provided by the integration. Do not persist preview data. */
|
|
190
|
+
preview?: string;
|
|
191
|
+
url?: string;
|
|
192
|
+
localFile?: File;
|
|
193
|
+
duration_ms?: number;
|
|
194
|
+
bars?: number[];
|
|
195
|
+
}
|
|
196
|
+
export interface WidgetResult {
|
|
197
|
+
supported: boolean;
|
|
198
|
+
cancelled?: boolean;
|
|
199
|
+
items?: AttachmentItem[];
|
|
200
|
+
}
|
|
201
|
+
export interface SDK {
|
|
202
|
+
setNavigationState?(state: { canGoBack: boolean; title?: string }): Promise<{ supported: boolean }>;
|
|
203
|
+
onBack?(callback: () => void | Promise<void>): () => void;
|
|
204
|
+
selectEmployees?(options?: {
|
|
205
|
+
profile_ids?: number[];
|
|
206
|
+
all_users?: boolean;
|
|
207
|
+
max_selected?: number;
|
|
208
|
+
}): Promise<{
|
|
209
|
+
supported?: boolean;
|
|
210
|
+
cancelled?: boolean;
|
|
211
|
+
profile_ids?: number[];
|
|
212
|
+
employees?: EmployeeItem[];
|
|
213
|
+
}>;
|
|
214
|
+
selectEmployeeProfiles?(options?: {
|
|
215
|
+
profile_ids?: number[];
|
|
216
|
+
all_users?: boolean;
|
|
217
|
+
}): Promise<{
|
|
218
|
+
supported?: boolean;
|
|
219
|
+
cancelled?: boolean;
|
|
220
|
+
profile_ids?: number[];
|
|
221
|
+
}>;
|
|
222
|
+
capturePhoto?(options?: {
|
|
223
|
+
max_files?: number;
|
|
224
|
+
max_size?: number;
|
|
225
|
+
}): Promise<WidgetResult>;
|
|
226
|
+
attachFiles?(options?: {
|
|
227
|
+
max_files?: number;
|
|
228
|
+
max_size?: number;
|
|
229
|
+
}): Promise<WidgetResult>;
|
|
230
|
+
showInfo?(options: {
|
|
231
|
+
title?: string;
|
|
232
|
+
description: string;
|
|
233
|
+
}): Promise<{ supported: boolean }>;
|
|
234
|
+
editRichText?(options: {
|
|
235
|
+
value: string;
|
|
236
|
+
label?: string;
|
|
237
|
+
placeholder?: string;
|
|
238
|
+
}): Promise<{ supported: boolean; cancelled?: boolean; value?: string }>;
|
|
239
|
+
startVoiceRecording?(options: {
|
|
240
|
+
session_id: string;
|
|
241
|
+
max_duration?: number;
|
|
242
|
+
}): Promise<{ supported: boolean; started?: boolean }>;
|
|
243
|
+
stopVoiceRecording?(options: { session_id: string }): Promise<WidgetResult>;
|
|
244
|
+
cancelVoiceRecording?(options: { session_id: string }): Promise<WidgetResult>;
|
|
245
|
+
recordVoice?(options?: { max_duration?: number }): Promise<WidgetResult>;
|
|
246
|
+
}
|
|
247
|
+
export interface EmployeesElement extends HTMLElement {
|
|
248
|
+
value: number[];
|
|
249
|
+
employees: EmployeeItem[];
|
|
250
|
+
disabled: boolean;
|
|
251
|
+
open(): Promise<void>;
|
|
252
|
+
}
|
|
253
|
+
export interface AttachmentsElement extends HTMLElement {
|
|
254
|
+
value: AttachmentItem[];
|
|
255
|
+
disabled: boolean;
|
|
256
|
+
/** Browser/standalone upload adapter. Without it, s24-change contains localFile. */
|
|
257
|
+
upload?: (file: File) => Promise<AttachmentItem>;
|
|
258
|
+
add(): Promise<void>;
|
|
259
|
+
}
|
|
260
|
+
export interface VoiceRecorderElement extends HTMLElement {
|
|
261
|
+
value: AttachmentItem | null;
|
|
262
|
+
disabled: boolean;
|
|
263
|
+
upload?: (file: File) => Promise<AttachmentItem>;
|
|
264
|
+
record(): Promise<void>;
|
|
265
|
+
stop(): Promise<void>;
|
|
266
|
+
cancel(): Promise<void>;
|
|
267
|
+
}
|
|
268
|
+
declare global {
|
|
269
|
+
interface HTMLElementTagNameMap {
|
|
270
|
+
"s24-info": InfoElement;
|
|
271
|
+
"s24-progress": ProgressElement;
|
|
272
|
+
"s24-text-editor": TextEditorElement;
|
|
273
|
+
"s24-employees": EmployeesElement;
|
|
274
|
+
"s24-photos": AttachmentsElement;
|
|
275
|
+
"s24-files": AttachmentsElement;
|
|
276
|
+
"s24-voice-recorder": VoiceRecorderElement;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface InfoElement extends HTMLElement {
|
|
281
|
+
open(): Promise<void>;
|
|
282
|
+
}
|
|
283
|
+
export interface ProgressElement extends HTMLElement {
|
|
284
|
+
value: number;
|
|
285
|
+
}
|
|
286
|
+
export interface TextEditorElement extends HTMLElement {
|
|
287
|
+
value: string;
|
|
288
|
+
open(): Promise<void>;
|
|
289
|
+
}
|