@susilkumar006/widgets-test 1.0.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/README.md +445 -0
- package/dist/api/FacePeApiClient.d.cts +74 -0
- package/dist/api/FacePeApiClient.d.ts +74 -0
- package/dist/api/FacePeApiContext.d.cts +8 -0
- package/dist/api/FacePeApiContext.d.ts +8 -0
- package/dist/api/decoders.d.cts +48 -0
- package/dist/api/decoders.d.ts +48 -0
- package/dist/api/index.d.cts +8 -0
- package/dist/api/index.d.ts +8 -0
- package/dist/api/json.d.cts +5 -0
- package/dist/api/json.d.ts +5 -0
- package/dist/api/useFacePeResource.d.cts +21 -0
- package/dist/api/useFacePeResource.d.ts +21 -0
- package/dist/components/Avatar/FacePeAvatar.d.cts +23 -0
- package/dist/components/Avatar/FacePeAvatar.d.ts +23 -0
- package/dist/components/Avatar/engines.d.cts +30 -0
- package/dist/components/Avatar/engines.d.ts +30 -0
- package/dist/components/Avatar/index.d.cts +1 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Form/FacePeForm.d.cts +19 -0
- package/dist/components/Form/FacePeForm.d.ts +19 -0
- package/dist/components/Form/index.d.cts +1 -0
- package/dist/components/Form/index.d.ts +1 -0
- package/dist/components/Picker/FacePePicker.d.cts +22 -0
- package/dist/components/Picker/FacePePicker.d.ts +22 -0
- package/dist/components/Picker/index.d.cts +1 -0
- package/dist/components/Picker/index.d.ts +1 -0
- package/dist/components/Placement/FacePeOverlay.d.cts +13 -0
- package/dist/components/Placement/FacePeOverlay.d.ts +13 -0
- package/dist/components/Placement/FacePePage.d.cts +10 -0
- package/dist/components/Placement/FacePePage.d.ts +10 -0
- package/dist/components/Placement/index.d.cts +2 -0
- package/dist/components/Placement/index.d.ts +2 -0
- package/dist/components/Timeline/FacePeTimeline.d.cts +23 -0
- package/dist/components/Timeline/FacePeTimeline.d.ts +23 -0
- package/dist/components/Timeline/index.d.cts +1 -0
- package/dist/components/Timeline/index.d.ts +1 -0
- package/dist/components/shared/FacePeErrorBoundary.d.cts +28 -0
- package/dist/components/shared/FacePeErrorBoundary.d.ts +28 -0
- package/dist/components/shared/surface.d.cts +6 -0
- package/dist/components/shared/surface.d.ts +6 -0
- package/dist/context/FacePeContext.d.cts +22 -0
- package/dist/context/FacePeContext.d.ts +22 -0
- package/dist/context/avatar.d.cts +6 -0
- package/dist/context/avatar.d.ts +6 -0
- package/dist/context/index.d.cts +5 -0
- package/dist/context/index.d.ts +5 -0
- package/dist/context/navigation.d.cts +10 -0
- package/dist/context/navigation.d.ts +10 -0
- package/dist/events/FacePeEventEmitter.d.cts +59 -0
- package/dist/events/FacePeEventEmitter.d.ts +59 -0
- package/dist/events/createCorrelationId.d.cts +9 -0
- package/dist/events/createCorrelationId.d.ts +9 -0
- package/dist/events/index.d.cts +8 -0
- package/dist/events/index.d.ts +8 -0
- package/dist/events/telemetry.d.cts +11 -0
- package/dist/events/telemetry.d.ts +11 -0
- package/dist/events/useFacePeEmitter.d.cts +15 -0
- package/dist/events/useFacePeEmitter.d.ts +15 -0
- package/dist/index.cjs +1925 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +1903 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/FacePeCustomerPayload.schema.json +31 -0
- package/dist/schemas/FacePeError.schema.json +63 -0
- package/dist/schemas/FacePeEventMeta.schema.json +53 -0
- package/dist/schemas/FacePeFormValues.schema.json +27 -0
- package/dist/schemas/FacePeNavigationRequest.schema.json +33 -0
- package/dist/schemas/FacePePickerOption.schema.json +34 -0
- package/dist/schemas/FacePePickerOptionsPayload.schema.json +49 -0
- package/dist/schemas/FacePeTelemetryEvent.schema.json +66 -0
- package/dist/schemas/FacePeTimelineItem.schema.json +91 -0
- package/dist/schemas/FacePeTimelinePayload.schema.json +109 -0
- package/dist/styles.css +887 -0
- package/dist/types/api.d.cts +60 -0
- package/dist/types/api.d.ts +60 -0
- package/dist/types/avatar.d.cts +102 -0
- package/dist/types/avatar.d.ts +102 -0
- package/dist/types/common.d.cts +42 -0
- package/dist/types/common.d.ts +42 -0
- package/dist/types/components.d.cts +53 -0
- package/dist/types/components.d.ts +53 -0
- package/dist/types/config.d.cts +27 -0
- package/dist/types/config.d.ts +27 -0
- package/dist/types/events.d.cts +85 -0
- package/dist/types/events.d.ts +85 -0
- package/dist/types/form.d.cts +83 -0
- package/dist/types/form.d.ts +83 -0
- package/dist/types/index.d.cts +18 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/picker.d.cts +82 -0
- package/dist/types/picker.d.ts +82 -0
- package/dist/types/placement.d.cts +69 -0
- package/dist/types/placement.d.ts +69 -0
- package/dist/types/provider.d.cts +75 -0
- package/dist/types/provider.d.ts +75 -0
- package/dist/types/results.d.cts +28 -0
- package/dist/types/results.d.ts +28 -0
- package/dist/types/telemetry.d.cts +38 -0
- package/dist/types/telemetry.d.ts +38 -0
- package/dist/types/timeline.d.cts +103 -0
- package/dist/types/timeline.d.ts +103 -0
- package/dist/version.d.cts +2 -0
- package/dist/version.d.ts +2 -0
- package/package.json +71 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: runtime validation of gateway payloads — the trust boundary, the
|
|
3
|
+
* one place types are checked at runtime (architecture §7.5). Each decoder
|
|
4
|
+
* accepts the documented shape, ignores unknown fields (forward
|
|
5
|
+
* compatibility) and turns anything else into Failure INVAL_RESPONSE-style
|
|
6
|
+
* `INVALID_PAYLOAD`, never an exception.
|
|
7
|
+
*/
|
|
8
|
+
import type { FacePeAvatarInfo, FacePeFormValues, FacePePickerOption, FacePeTimelineItem } from '../types/index.js';
|
|
9
|
+
import type { FacePeDecoder } from './FacePeApiClient.js';
|
|
10
|
+
/** GET /orders/:id/timeline → `{ items: FacePeTimelineItem[] }`. */
|
|
11
|
+
export declare const decodeTimeline: FacePeDecoder<readonly FacePeTimelineItem[]>;
|
|
12
|
+
/** GET /locations/:id/categories → `{ options: FacePePickerOption[] }`. */
|
|
13
|
+
export declare const decodePickerOptions: FacePeDecoder<readonly FacePePickerOption[]>;
|
|
14
|
+
/** GET/PUT /orders/:id/customer → `{ name, email, notes }`. */
|
|
15
|
+
export declare const decodeFormValues: FacePeDecoder<FacePeFormValues>;
|
|
16
|
+
/** GET /avatars/:avatarId → `{ avatar }`. */
|
|
17
|
+
export declare const decodeAvatar: FacePeDecoder<FacePeAvatarInfo>;
|
|
18
|
+
/** GET /avatars → `{ avatars }`: the avatars the signed-in user may use. Entries that do not decode are skipped. */
|
|
19
|
+
export declare const decodeAvatarList: FacePeDecoder<readonly FacePeAvatarInfo[]>;
|
|
20
|
+
/**
|
|
21
|
+
* What POST /avatars/:avatarId/sessions returns: how to connect. The gateway
|
|
22
|
+
* never says where an avatar comes from, only the kind of connection:
|
|
23
|
+
* `room` (join a media room) or `stream` (a hosted stream).
|
|
24
|
+
*/
|
|
25
|
+
export type FacePeAvatarConnection = {
|
|
26
|
+
readonly type: 'stream';
|
|
27
|
+
readonly usageId: string | null;
|
|
28
|
+
readonly avatar: FacePeAvatarInfo;
|
|
29
|
+
readonly token: string;
|
|
30
|
+
readonly greeting: string | null;
|
|
31
|
+
} | {
|
|
32
|
+
readonly type: 'room';
|
|
33
|
+
readonly usageId: string | null;
|
|
34
|
+
readonly avatar: FacePeAvatarInfo;
|
|
35
|
+
readonly url: string;
|
|
36
|
+
readonly token: string;
|
|
37
|
+
};
|
|
38
|
+
export declare const decodeAvatarConnection: FacePeDecoder<FacePeAvatarConnection>;
|
|
39
|
+
/** Gateway paths, one per component (entity ids are path-encoded). */
|
|
40
|
+
export declare const gatewayPath: {
|
|
41
|
+
readonly avatars: "/avatars";
|
|
42
|
+
readonly avatar: (avatarId: string) => string;
|
|
43
|
+
readonly avatarSessions: (avatarId: string) => string;
|
|
44
|
+
readonly endAvatarSession: (usageId: string) => string;
|
|
45
|
+
readonly timeline: (orderId: string) => string;
|
|
46
|
+
readonly pickerOptions: (locationId: string) => string;
|
|
47
|
+
readonly customer: (orderId: string) => string;
|
|
48
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal API-client infrastructure for SDK components. Not re-exported from
|
|
3
|
+
* src/index.ts, and package.json exports no path to it.
|
|
4
|
+
*/
|
|
5
|
+
export { FacePeApiClient, CORRELATION_HEADER, SDK_VERSION_HEADER, DEFAULT_TIMEOUT_MS, type FacePeApiClientOptions, type FacePeApiSettings, type FacePeDecoder, type FacePeQuery, type FacePeRequestOptions, } from './FacePeApiClient.cjs';
|
|
6
|
+
export { FacePeApiContext, useFacePeApi } from './FacePeApiContext.cjs';
|
|
7
|
+
export { decodeAvatar, decodeAvatarList, decodeAvatarConnection, decodeFormValues, decodePickerOptions, decodeTimeline, gatewayPath, type FacePeAvatarConnection, } from './decoders.cjs';
|
|
8
|
+
export { useFacePeResource, type FacePeResource } from './useFacePeResource.cjs';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal API-client infrastructure for SDK components. Not re-exported from
|
|
3
|
+
* src/index.ts, and package.json exports no path to it.
|
|
4
|
+
*/
|
|
5
|
+
export { FacePeApiClient, CORRELATION_HEADER, SDK_VERSION_HEADER, DEFAULT_TIMEOUT_MS, type FacePeApiClientOptions, type FacePeApiSettings, type FacePeDecoder, type FacePeQuery, type FacePeRequestOptions, } from './FacePeApiClient.js';
|
|
6
|
+
export { FacePeApiContext, useFacePeApi } from './FacePeApiContext.js';
|
|
7
|
+
export { decodeAvatar, decodeAvatarList, decodeAvatarConnection, decodeFormValues, decodePickerOptions, decodeTimeline, gatewayPath, type FacePeAvatarConnection, } from './decoders.js';
|
|
8
|
+
export { useFacePeResource, type FacePeResource } from './useFacePeResource.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JsonObject, JsonValue } from '../types/index.cjs';
|
|
2
|
+
/** True when `value` is valid JSON data (what `JSON.parse` can produce). */
|
|
3
|
+
export declare function isJsonValue(value: unknown): value is JsonValue;
|
|
4
|
+
/** True for a JSON object (not an array, not null). */
|
|
5
|
+
export declare function isJsonObject(value: JsonValue | undefined): value is JsonObject;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { JsonObject, JsonValue } from '../types/index.js';
|
|
2
|
+
/** True when `value` is valid JSON data (what `JSON.parse` can produce). */
|
|
3
|
+
export declare function isJsonValue(value: unknown): value is JsonValue;
|
|
4
|
+
/** True for a JSON object (not an array, not null). */
|
|
5
|
+
export declare function isJsonObject(value: JsonValue | undefined): value is JsonObject;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FacePeError } from '../types/index.cjs';
|
|
2
|
+
import type { FacePeDecoder } from './FacePeApiClient.cjs';
|
|
3
|
+
/** What a component knows about data it fetches through the gateway. */
|
|
4
|
+
export type FacePeResource<T> = {
|
|
5
|
+
readonly status: 'idle';
|
|
6
|
+
} | {
|
|
7
|
+
readonly status: 'loading';
|
|
8
|
+
} | {
|
|
9
|
+
readonly status: 'ready';
|
|
10
|
+
readonly data: T;
|
|
11
|
+
} | {
|
|
12
|
+
readonly status: 'failed';
|
|
13
|
+
readonly error: FacePeError;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Internal: GETs `path` through the provider's API client and decodes it.
|
|
17
|
+
* `path` null means "nothing to fetch" (the host passed the data itself).
|
|
18
|
+
* A new path cancels the request in flight; so does unmounting. The component
|
|
19
|
+
* reports a `failed` state through its own `error` event.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useFacePeResource<T>(path: string | null, decode: FacePeDecoder<T>): FacePeResource<T>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FacePeError } from '../types/index.js';
|
|
2
|
+
import type { FacePeDecoder } from './FacePeApiClient.js';
|
|
3
|
+
/** What a component knows about data it fetches through the gateway. */
|
|
4
|
+
export type FacePeResource<T> = {
|
|
5
|
+
readonly status: 'idle';
|
|
6
|
+
} | {
|
|
7
|
+
readonly status: 'loading';
|
|
8
|
+
} | {
|
|
9
|
+
readonly status: 'ready';
|
|
10
|
+
readonly data: T;
|
|
11
|
+
} | {
|
|
12
|
+
readonly status: 'failed';
|
|
13
|
+
readonly error: FacePeError;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Internal: GETs `path` through the provider's API client and decodes it.
|
|
17
|
+
* `path` null means "nothing to fetch" (the host passed the data itself).
|
|
18
|
+
* A new path cancels the request in flight; so does unmounting. The component
|
|
19
|
+
* reports a `failed` state through its own `error` event.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useFacePeResource<T>(path: string | null, decode: FacePeDecoder<T>): FacePeResource<T>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FacePeAvatarEvents, FacePeAvatarHandle } from '../../types/index.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* The FacePe avatar conversation, embedded in the host's page: the same
|
|
4
|
+
* avatar, trained prompt, voice and features as on the FacePe website.
|
|
5
|
+
*
|
|
6
|
+
* Talks to the avatar_id given here or on the provider. The user whose keys
|
|
7
|
+
* the host uses must have that avatar assigned (super admin → company → user
|
|
8
|
+
* → avatar); otherwise the component reports `FORBIDDEN` through `onError`.
|
|
9
|
+
* Without an avatar_id it loads the user's assigned avatars and lets the user
|
|
10
|
+
* choose (the first is selected), so the keys alone are enough.
|
|
11
|
+
*
|
|
12
|
+
* Styles ship separately: import "@facepe/widgets/styles.css" once in the host.
|
|
13
|
+
*/
|
|
14
|
+
export declare const FacePeAvatar: import("react").ForwardRefExoticComponent<import("../../index.cjs").FacePeConfig & import("../../index.cjs").FacePeEventHandlers<FacePeAvatarEvents> & {
|
|
15
|
+
readonly slots?: import("../../index.cjs").FacePeSlots<import("../../index.cjs").FacePeAvatarSlots> | undefined;
|
|
16
|
+
readonly emphasis?: import("../../index.cjs").FacePeEmphasis;
|
|
17
|
+
readonly size?: import("../../index.cjs").FacePeSize;
|
|
18
|
+
} & {
|
|
19
|
+
readonly avatarId?: string;
|
|
20
|
+
readonly language?: string;
|
|
21
|
+
readonly autoStart?: boolean;
|
|
22
|
+
readonly captions?: boolean;
|
|
23
|
+
} & import("react").RefAttributes<FacePeAvatarHandle>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FacePeAvatarEvents, FacePeAvatarHandle } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The FacePe avatar conversation, embedded in the host's page: the same
|
|
4
|
+
* avatar, trained prompt, voice and features as on the FacePe website.
|
|
5
|
+
*
|
|
6
|
+
* Talks to the avatar_id given here or on the provider. The user whose keys
|
|
7
|
+
* the host uses must have that avatar assigned (super admin → company → user
|
|
8
|
+
* → avatar); otherwise the component reports `FORBIDDEN` through `onError`.
|
|
9
|
+
* Without an avatar_id it loads the user's assigned avatars and lets the user
|
|
10
|
+
* choose (the first is selected), so the keys alone are enough.
|
|
11
|
+
*
|
|
12
|
+
* Styles ship separately: import "@facepe/widgets/styles.css" once in the host.
|
|
13
|
+
*/
|
|
14
|
+
export declare const FacePeAvatar: import("react").ForwardRefExoticComponent<import("../../index.js").FacePeConfig & import("../../index.js").FacePeEventHandlers<FacePeAvatarEvents> & {
|
|
15
|
+
readonly slots?: import("../../index.js").FacePeSlots<import("../../index.js").FacePeAvatarSlots> | undefined;
|
|
16
|
+
readonly emphasis?: import("../../index.js").FacePeEmphasis;
|
|
17
|
+
readonly size?: import("../../index.js").FacePeSize;
|
|
18
|
+
} & {
|
|
19
|
+
readonly avatarId?: string;
|
|
20
|
+
readonly language?: string;
|
|
21
|
+
readonly autoStart?: boolean;
|
|
22
|
+
readonly captions?: boolean;
|
|
23
|
+
} & import("react").RefAttributes<FacePeAvatarHandle>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: the two avatar engines behind <FacePeAvatar>, as on the FacePe
|
|
3
|
+
* website — Anam's hosted avatar, or FacePe's self-hosted agent in a LiveKit
|
|
4
|
+
* room. Each is loaded with import() only when a conversation starts, so a
|
|
5
|
+
* host pays for it (in its own bundle, as a separate chunk) only when used.
|
|
6
|
+
*/
|
|
7
|
+
import type { FacePeAvatarConnection } from '../../api/index.cjs';
|
|
8
|
+
import type { FacePeTranscriptLine } from '../../types/index.cjs';
|
|
9
|
+
export type EngineHandlers = {
|
|
10
|
+
/** The avatar's picture is playing. */
|
|
11
|
+
onLive(): void;
|
|
12
|
+
onTranscript(line: FacePeTranscriptLine): void;
|
|
13
|
+
onOrder(items: readonly {
|
|
14
|
+
name: string;
|
|
15
|
+
qty: number;
|
|
16
|
+
}[]): void;
|
|
17
|
+
/** The stream dropped (not called after end()). */
|
|
18
|
+
onDisconnected(): void;
|
|
19
|
+
};
|
|
20
|
+
export type EngineSession = {
|
|
21
|
+
end(): Promise<void>;
|
|
22
|
+
setMuted(muted: boolean): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Starts fetching the connection libraries; safe to call any number of times.
|
|
26
|
+
* Which one an avatar needs is only known when its session starts, so both
|
|
27
|
+
* are fetched (each once). A failed preload is retried by connectEngine.
|
|
28
|
+
*/
|
|
29
|
+
export declare function preloadEngines(): void;
|
|
30
|
+
export declare function connectEngine(video: HTMLVideoElement, conn: FacePeAvatarConnection, on: EngineHandlers): Promise<EngineSession>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: the two avatar engines behind <FacePeAvatar>, as on the FacePe
|
|
3
|
+
* website — Anam's hosted avatar, or FacePe's self-hosted agent in a LiveKit
|
|
4
|
+
* room. Each is loaded with import() only when a conversation starts, so a
|
|
5
|
+
* host pays for it (in its own bundle, as a separate chunk) only when used.
|
|
6
|
+
*/
|
|
7
|
+
import type { FacePeAvatarConnection } from '../../api/index.js';
|
|
8
|
+
import type { FacePeTranscriptLine } from '../../types/index.js';
|
|
9
|
+
export type EngineHandlers = {
|
|
10
|
+
/** The avatar's picture is playing. */
|
|
11
|
+
onLive(): void;
|
|
12
|
+
onTranscript(line: FacePeTranscriptLine): void;
|
|
13
|
+
onOrder(items: readonly {
|
|
14
|
+
name: string;
|
|
15
|
+
qty: number;
|
|
16
|
+
}[]): void;
|
|
17
|
+
/** The stream dropped (not called after end()). */
|
|
18
|
+
onDisconnected(): void;
|
|
19
|
+
};
|
|
20
|
+
export type EngineSession = {
|
|
21
|
+
end(): Promise<void>;
|
|
22
|
+
setMuted(muted: boolean): Promise<void>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Starts fetching the connection libraries; safe to call any number of times.
|
|
26
|
+
* Which one an avatar needs is only known when its session starts, so both
|
|
27
|
+
* are fetched (each once). A failed preload is retried by connectEngine.
|
|
28
|
+
*/
|
|
29
|
+
export declare function preloadEngines(): void;
|
|
30
|
+
export declare function connectEngine(video: HTMLVideoElement, conn: FacePeAvatarConnection, on: EngineHandlers): Promise<EngineSession>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FacePeAvatar } from './FacePeAvatar.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FacePeAvatar } from './FacePeAvatar.js';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FacePeFormEvents, FacePeFormHandle, FacePeFormValues } from '../../types/index.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* A basic FacePe form: name, email and notes, with required-field validation.
|
|
4
|
+
*
|
|
5
|
+
* Reads shared configuration from the nearest `<FacePeProvider>`; its own
|
|
6
|
+
* `mode`, `density` and `locale` props override the provider's. In `view`
|
|
7
|
+
* mode (the default) the fields are read-only and there is no submit action.
|
|
8
|
+
*
|
|
9
|
+
* Styles ship separately: import "@facepe/widgets/styles.css" once in the host.
|
|
10
|
+
*/
|
|
11
|
+
export declare const FacePeForm: import("react").ForwardRefExoticComponent<import("../../index.cjs").FacePeConfig & import("../../index.cjs").FacePeEventHandlers<FacePeFormEvents> & {
|
|
12
|
+
readonly slots?: import("../../index.cjs").FacePeSlots<import("../../index.cjs").FacePeFormSlots> | undefined;
|
|
13
|
+
readonly emphasis?: import("../../index.cjs").FacePeEmphasis;
|
|
14
|
+
readonly size?: import("../../index.cjs").FacePeSize;
|
|
15
|
+
} & {
|
|
16
|
+
readonly initialValues?: Partial<FacePeFormValues>;
|
|
17
|
+
readonly submitAction?: import("../../index.cjs").FacePeFormSubmitAction;
|
|
18
|
+
readonly variant?: import("../../index.cjs").FacePeFormVariant;
|
|
19
|
+
} & import("react").RefAttributes<FacePeFormHandle>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FacePeFormEvents, FacePeFormHandle, FacePeFormValues } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* A basic FacePe form: name, email and notes, with required-field validation.
|
|
4
|
+
*
|
|
5
|
+
* Reads shared configuration from the nearest `<FacePeProvider>`; its own
|
|
6
|
+
* `mode`, `density` and `locale` props override the provider's. In `view`
|
|
7
|
+
* mode (the default) the fields are read-only and there is no submit action.
|
|
8
|
+
*
|
|
9
|
+
* Styles ship separately: import "@facepe/widgets/styles.css" once in the host.
|
|
10
|
+
*/
|
|
11
|
+
export declare const FacePeForm: import("react").ForwardRefExoticComponent<import("../../index.js").FacePeConfig & import("../../index.js").FacePeEventHandlers<FacePeFormEvents> & {
|
|
12
|
+
readonly slots?: import("../../index.js").FacePeSlots<import("../../index.js").FacePeFormSlots> | undefined;
|
|
13
|
+
readonly emphasis?: import("../../index.js").FacePeEmphasis;
|
|
14
|
+
readonly size?: import("../../index.js").FacePeSize;
|
|
15
|
+
} & {
|
|
16
|
+
readonly initialValues?: Partial<FacePeFormValues>;
|
|
17
|
+
readonly submitAction?: import("../../index.js").FacePeFormSubmitAction;
|
|
18
|
+
readonly variant?: import("../../index.js").FacePeFormVariant;
|
|
19
|
+
} & import("react").RefAttributes<FacePeFormHandle>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FacePeForm } from './FacePeForm.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FacePeForm } from './FacePeForm.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FacePePickerEvents, FacePePickerHandle, FacePePickerOption } from '../../types/index.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* A single-choice FacePe picker built on a native radio group, so arrow keys,
|
|
4
|
+
* focus and the selected/disabled states work and are announced natively.
|
|
5
|
+
*
|
|
6
|
+
* Reads shared configuration from the nearest `<FacePeProvider>`; its own
|
|
7
|
+
* `mode`, `density`, `locale` and `featureFlags` props override the provider's.
|
|
8
|
+
* In `view` mode (the default) the current selection is shown but cannot be
|
|
9
|
+
* changed.
|
|
10
|
+
*
|
|
11
|
+
* Styles ship separately: import "@facepe/widgets/styles.css" once in the host.
|
|
12
|
+
*/
|
|
13
|
+
export declare const FacePePicker: import("react").ForwardRefExoticComponent<import("../../index.cjs").FacePeConfig & import("../../index.cjs").FacePeEventHandlers<FacePePickerEvents> & {
|
|
14
|
+
readonly slots?: import("../../index.cjs").FacePeSlots<import("../../index.cjs").FacePePickerSlots> | undefined;
|
|
15
|
+
readonly emphasis?: import("../../index.cjs").FacePeEmphasis;
|
|
16
|
+
readonly size?: import("../../index.cjs").FacePeSize;
|
|
17
|
+
} & {
|
|
18
|
+
readonly label?: string;
|
|
19
|
+
readonly options?: readonly FacePePickerOption[];
|
|
20
|
+
readonly defaultValue?: string;
|
|
21
|
+
readonly variant?: import("../../index.cjs").FacePePickerVariant;
|
|
22
|
+
} & import("react").RefAttributes<FacePePickerHandle>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FacePePickerEvents, FacePePickerHandle, FacePePickerOption } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* A single-choice FacePe picker built on a native radio group, so arrow keys,
|
|
4
|
+
* focus and the selected/disabled states work and are announced natively.
|
|
5
|
+
*
|
|
6
|
+
* Reads shared configuration from the nearest `<FacePeProvider>`; its own
|
|
7
|
+
* `mode`, `density`, `locale` and `featureFlags` props override the provider's.
|
|
8
|
+
* In `view` mode (the default) the current selection is shown but cannot be
|
|
9
|
+
* changed.
|
|
10
|
+
*
|
|
11
|
+
* Styles ship separately: import "@facepe/widgets/styles.css" once in the host.
|
|
12
|
+
*/
|
|
13
|
+
export declare const FacePePicker: import("react").ForwardRefExoticComponent<import("../../index.js").FacePeConfig & import("../../index.js").FacePeEventHandlers<FacePePickerEvents> & {
|
|
14
|
+
readonly slots?: import("../../index.js").FacePeSlots<import("../../index.js").FacePePickerSlots> | undefined;
|
|
15
|
+
readonly emphasis?: import("../../index.js").FacePeEmphasis;
|
|
16
|
+
readonly size?: import("../../index.js").FacePeSize;
|
|
17
|
+
} & {
|
|
18
|
+
readonly label?: string;
|
|
19
|
+
readonly options?: readonly FacePePickerOption[];
|
|
20
|
+
readonly defaultValue?: string;
|
|
21
|
+
readonly variant?: import("../../index.js").FacePePickerVariant;
|
|
22
|
+
} & import("react").RefAttributes<FacePePickerHandle>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FacePePicker } from './FacePePicker.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FacePePicker } from './FacePePicker.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FacePeOverlayProps } from '../../types/index.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Overlay display mode: shows a FacePe component over the page, as a centred
|
|
4
|
+
* modal or (`variant="drawer"`) a side drawer. Both are a modal dialog built on
|
|
5
|
+
* the native `<dialog>`, so focus stays inside, Escape is handled and the page
|
|
6
|
+
* behind is inert. The host owns `open`; Escape only asks, via `onClose`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <FacePeOverlay open={open} label="Update details" onClose={() => setOpen(false)}>
|
|
10
|
+
* <FacePeForm onCancel={() => setOpen(false)} />
|
|
11
|
+
* </FacePeOverlay>
|
|
12
|
+
*/
|
|
13
|
+
export declare function FacePeOverlay({ open, label, variant, onClose, children }: FacePeOverlayProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FacePeOverlayProps } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Overlay display mode: shows a FacePe component over the page, as a centred
|
|
4
|
+
* modal or (`variant="drawer"`) a side drawer. Both are a modal dialog built on
|
|
5
|
+
* the native `<dialog>`, so focus stays inside, Escape is handled and the page
|
|
6
|
+
* behind is inert. The host owns `open`; Escape only asks, via `onClose`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <FacePeOverlay open={open} label="Update details" onClose={() => setOpen(false)}>
|
|
10
|
+
* <FacePeForm onCancel={() => setOpen(false)} />
|
|
11
|
+
* </FacePeOverlay>
|
|
12
|
+
*/
|
|
13
|
+
export declare function FacePeOverlay({ open, label, variant, onClose, children }: FacePeOverlayProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FacePePageProps } from '../../types/index.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Page display mode: shows a FacePe component as a full view filling the
|
|
4
|
+
* container the host gives it. The component inside is unchanged; titles,
|
|
5
|
+
* breadcrumbs and navigation stay with the host.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Route path="/schedule" element={<FacePePage><FacePeTimeline items={items} /></FacePePage>} />
|
|
9
|
+
*/
|
|
10
|
+
export declare function FacePePage({ children }: FacePePageProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FacePePageProps } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Page display mode: shows a FacePe component as a full view filling the
|
|
4
|
+
* container the host gives it. The component inside is unchanged; titles,
|
|
5
|
+
* breadcrumbs and navigation stay with the host.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <Route path="/schedule" element={<FacePePage><FacePeTimeline items={items} /></FacePePage>} />
|
|
9
|
+
*/
|
|
10
|
+
export declare function FacePePage({ children }: FacePePageProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FacePeTimelineEvents, FacePeTimelineHandle, FacePeTimelineItem } from '../../types/index.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* A chronological FacePe timeline: each item shows a status marker and label,
|
|
4
|
+
* title, time, and optional description and metadata.
|
|
5
|
+
*
|
|
6
|
+
* Items become selectable buttons when `onSelect` is passed; otherwise the
|
|
7
|
+
* timeline is a plain, read-only list. Reads shared configuration from the
|
|
8
|
+
* nearest `<FacePeProvider>`; its own `density`, `locale` and `featureFlags`
|
|
9
|
+
* props override the provider's. `mode` has no effect: a timeline has
|
|
10
|
+
* nothing to edit, and selecting an item is viewing, not editing.
|
|
11
|
+
*
|
|
12
|
+
* Styles ship separately: import "@facepe/widgets/styles.css" once in the host.
|
|
13
|
+
*/
|
|
14
|
+
export declare const FacePeTimeline: import("react").ForwardRefExoticComponent<import("../../index.cjs").FacePeConfig & import("../../index.cjs").FacePeEventHandlers<FacePeTimelineEvents> & {
|
|
15
|
+
readonly slots?: import("../../index.cjs").FacePeSlots<import("../../index.cjs").FacePeTimelineSlots> | undefined;
|
|
16
|
+
readonly emphasis?: import("../../index.cjs").FacePeEmphasis;
|
|
17
|
+
readonly size?: import("../../index.cjs").FacePeSize;
|
|
18
|
+
} & {
|
|
19
|
+
readonly items?: readonly FacePeTimelineItem[];
|
|
20
|
+
readonly label?: string;
|
|
21
|
+
readonly sort?: "none" | "ascending" | "descending";
|
|
22
|
+
readonly loading?: boolean;
|
|
23
|
+
} & import("react").RefAttributes<FacePeTimelineHandle>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { FacePeTimelineEvents, FacePeTimelineHandle, FacePeTimelineItem } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* A chronological FacePe timeline: each item shows a status marker and label,
|
|
4
|
+
* title, time, and optional description and metadata.
|
|
5
|
+
*
|
|
6
|
+
* Items become selectable buttons when `onSelect` is passed; otherwise the
|
|
7
|
+
* timeline is a plain, read-only list. Reads shared configuration from the
|
|
8
|
+
* nearest `<FacePeProvider>`; its own `density`, `locale` and `featureFlags`
|
|
9
|
+
* props override the provider's. `mode` has no effect: a timeline has
|
|
10
|
+
* nothing to edit, and selecting an item is viewing, not editing.
|
|
11
|
+
*
|
|
12
|
+
* Styles ship separately: import "@facepe/widgets/styles.css" once in the host.
|
|
13
|
+
*/
|
|
14
|
+
export declare const FacePeTimeline: import("react").ForwardRefExoticComponent<import("../../index.js").FacePeConfig & import("../../index.js").FacePeEventHandlers<FacePeTimelineEvents> & {
|
|
15
|
+
readonly slots?: import("../../index.js").FacePeSlots<import("../../index.js").FacePeTimelineSlots> | undefined;
|
|
16
|
+
readonly emphasis?: import("../../index.js").FacePeEmphasis;
|
|
17
|
+
readonly size?: import("../../index.js").FacePeSize;
|
|
18
|
+
} & {
|
|
19
|
+
readonly items?: readonly FacePeTimelineItem[];
|
|
20
|
+
readonly label?: string;
|
|
21
|
+
readonly sort?: "none" | "ascending" | "descending";
|
|
22
|
+
readonly loading?: boolean;
|
|
23
|
+
} & import("react").RefAttributes<FacePeTimelineHandle>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FacePeTimeline } from './FacePeTimeline.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FacePeTimeline } from './FacePeTimeline.js';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component, type ReactNode } from 'react';
|
|
2
|
+
import type { EntityId, FacePeError, FacePeEvent, FacePeEventHandler, FacePeFallbackContext, FacePeSlot } from '../../types/index.cjs';
|
|
3
|
+
type Props = {
|
|
4
|
+
/** The wrapped component's name, stamped on the error event. */
|
|
5
|
+
readonly source: string;
|
|
6
|
+
readonly entityId?: EntityId;
|
|
7
|
+
readonly onError?: FacePeEventHandler<FacePeEvent<'error', FacePeError>>;
|
|
8
|
+
readonly fallback?: FacePeSlot<FacePeFallbackContext>;
|
|
9
|
+
readonly children?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
type State = {
|
|
12
|
+
readonly error: FacePeError | null;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Internal: keeps a failing FacePe component from taking the host's React tree
|
|
16
|
+
* down with it. Reports `error` (code RENDER_FAILED) through the same event
|
|
17
|
+
* envelope as every other event, then shows the host's `fallback` slot, or a
|
|
18
|
+
* short message. To retry, the host remounts the component (e.g. a new `key`).
|
|
19
|
+
*/
|
|
20
|
+
export declare class FacePeErrorBoundary extends Component<Props, State> {
|
|
21
|
+
state: State;
|
|
22
|
+
private readonly events;
|
|
23
|
+
constructor(props: Props);
|
|
24
|
+
static getDerivedStateFromError(): State;
|
|
25
|
+
componentDidCatch(): void;
|
|
26
|
+
render(): ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Component, type ReactNode } from 'react';
|
|
2
|
+
import type { EntityId, FacePeError, FacePeEvent, FacePeEventHandler, FacePeFallbackContext, FacePeSlot } from '../../types/index.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
/** The wrapped component's name, stamped on the error event. */
|
|
5
|
+
readonly source: string;
|
|
6
|
+
readonly entityId?: EntityId;
|
|
7
|
+
readonly onError?: FacePeEventHandler<FacePeEvent<'error', FacePeError>>;
|
|
8
|
+
readonly fallback?: FacePeSlot<FacePeFallbackContext>;
|
|
9
|
+
readonly children?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
type State = {
|
|
12
|
+
readonly error: FacePeError | null;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Internal: keeps a failing FacePe component from taking the host's React tree
|
|
16
|
+
* down with it. Reports `error` (code RENDER_FAILED) through the same event
|
|
17
|
+
* envelope as every other event, then shows the host's `fallback` slot, or a
|
|
18
|
+
* short message. To retry, the host remounts the component (e.g. a new `key`).
|
|
19
|
+
*/
|
|
20
|
+
export declare class FacePeErrorBoundary extends Component<Props, State> {
|
|
21
|
+
state: State;
|
|
22
|
+
private readonly events;
|
|
23
|
+
constructor(props: Props);
|
|
24
|
+
static getDerivedStateFromError(): State;
|
|
25
|
+
componentDidCatch(): void;
|
|
26
|
+
render(): ReactNode;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: the root classes every FacePe component shares — the token
|
|
3
|
+
* defaults plus the L2 `emphasis` and `size` variants.
|
|
4
|
+
*/
|
|
5
|
+
import type { FacePeEmphasis, FacePeSize } from '../../types/index.cjs';
|
|
6
|
+
export declare function surfaceClass(emphasis?: FacePeEmphasis, size?: FacePeSize): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: the root classes every FacePe component shares — the token
|
|
3
|
+
* defaults plus the L2 `emphasis` and `size` variants.
|
|
4
|
+
*/
|
|
5
|
+
import type { FacePeEmphasis, FacePeSize } from '../../types/index.js';
|
|
6
|
+
export declare function surfaceClass(emphasis?: FacePeEmphasis, size?: FacePeSize): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FacePeContextValue, FacePeProviderProps } from '../types/index.cjs';
|
|
2
|
+
/**
|
|
3
|
+
* Makes the host's FacePe configuration available to every FacePe component
|
|
4
|
+
* rendered below it, and gives them an API client scoped to this provider.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <FacePeProvider
|
|
8
|
+
* config={{ locale: 'en-IN', density: 'compact' }}
|
|
9
|
+
* apiBaseUrl="https://api.example.com/api/v1"
|
|
10
|
+
* getToken={({ forceRefresh }) => auth.accessToken({ forceRefresh })}
|
|
11
|
+
* onSessionExpired={() => auth.signIn()}
|
|
12
|
+
* >
|
|
13
|
+
* <App />
|
|
14
|
+
* </FacePeProvider>
|
|
15
|
+
*/
|
|
16
|
+
export declare function FacePeProvider({ config, children, ...settings }: FacePeProviderProps): import("react").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Reads the configuration from the nearest `<FacePeProvider>`.
|
|
19
|
+
*
|
|
20
|
+
* @throws Error when called outside a `<FacePeProvider>`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useFacePe(): FacePeContextValue;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { FacePeContextValue, FacePeProviderProps } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Makes the host's FacePe configuration available to every FacePe component
|
|
4
|
+
* rendered below it, and gives them an API client scoped to this provider.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <FacePeProvider
|
|
8
|
+
* config={{ locale: 'en-IN', density: 'compact' }}
|
|
9
|
+
* apiBaseUrl="https://api.example.com/api/v1"
|
|
10
|
+
* getToken={({ forceRefresh }) => auth.accessToken({ forceRefresh })}
|
|
11
|
+
* onSessionExpired={() => auth.signIn()}
|
|
12
|
+
* >
|
|
13
|
+
* <App />
|
|
14
|
+
* </FacePeProvider>
|
|
15
|
+
*/
|
|
16
|
+
export declare function FacePeProvider({ config, children, ...settings }: FacePeProviderProps): import("react").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Reads the configuration from the nearest `<FacePeProvider>`.
|
|
19
|
+
*
|
|
20
|
+
* @throws Error when called outside a `<FacePeProvider>`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useFacePe(): FacePeContextValue;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: the provider's `avatarId`, the default for `<FacePeAvatar>`.
|
|
3
|
+
* Kept apart from the public context so `FacePeContextValue` is unchanged.
|
|
4
|
+
*/
|
|
5
|
+
export declare const FacePeAvatarIdContext: import("react").Context<string | undefined>;
|
|
6
|
+
export declare function useFacePeAvatarId(): string | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal: the provider's `avatarId`, the default for `<FacePeAvatar>`.
|
|
3
|
+
* Kept apart from the public context so `FacePeContextValue` is unchanged.
|
|
4
|
+
*/
|
|
5
|
+
export declare const FacePeAvatarIdContext: import("react").Context<string | undefined>;
|
|
6
|
+
export declare function useFacePeAvatarId(): string | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FacePeEvent, FacePeNavigationRequest } from '../types/index.cjs';
|
|
2
|
+
/** Hands a component's `navigate` event to the provider's `onNavigate`. */
|
|
3
|
+
export type FacePeNavigationRelay = (event: FacePeEvent<'navigate', FacePeNavigationRequest>) => void;
|
|
4
|
+
/**
|
|
5
|
+
* Internal: the navigation side of the context bridge. Components emit
|
|
6
|
+
* `navigate` to their own handler and relay the same event here; the host's
|
|
7
|
+
* router does the navigating. Not exported from the package.
|
|
8
|
+
*/
|
|
9
|
+
export declare const FacePeNavigationContext: import("react").Context<FacePeNavigationRelay>;
|
|
10
|
+
export declare function useFacePeNavigationRelay(): FacePeNavigationRelay;
|