@useago/sdk 0.4.2 → 0.4.4
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/{createConversationSession-DtaeA418.cjs → createConversationSession-DibXdxoC.cjs} +1 -1
- package/dist/{createConversationSession-D9FesBQS.js → createConversationSession-XkiOGAUT.js} +1 -1
- package/dist/createFormCollector-D4-yZh1i.js +207 -0
- package/dist/createFormCollector-DLwgDX24.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +15 -3
- package/dist/index.d.ts +15 -3
- package/dist/index.js +59 -58
- package/dist/react.cjs +13 -13
- package/dist/react.d.cts +20 -5
- package/dist/react.d.ts +20 -5
- package/dist/react.js +1031 -1025
- package/dist/widget.cjs +1 -1
- package/dist/widget.d.cts +37 -0
- package/dist/widget.d.ts +37 -0
- package/dist/widget.js +205 -183
- package/package.json +1 -1
- package/dist/createFormCollector-BwvkKi48.js +0 -211
- package/dist/createFormCollector-Wb8Rr-U2.cjs +0 -1
package/dist/react.d.cts
CHANGED
|
@@ -542,6 +542,14 @@ export declare interface CreateFormCollectorOptions<V = Record<string, unknown>>
|
|
|
542
542
|
*/
|
|
543
543
|
export declare function createMockClient(options?: MockAgoClientOptions): MockAgoClient;
|
|
544
544
|
|
|
545
|
+
/**
|
|
546
|
+
* Compute which required fields are still empty and whether the form is complete.
|
|
547
|
+
* Pure — the single home for the "required + non-empty" rule, shared by the update
|
|
548
|
+
* handler, submit, the dynamic context, and the React hook. Derived on read so the
|
|
549
|
+
* store only ever holds canonical state ({@link FormCollectorState}).
|
|
550
|
+
*/
|
|
551
|
+
export declare function deriveFormStatus(schema: FormCollectorSchema, values: Partial<Record<string, unknown>>): FormCollectorStatus;
|
|
552
|
+
|
|
545
553
|
/**
|
|
546
554
|
* A function that returns a fresh context entry on demand.
|
|
547
555
|
* Evaluated every time a message is sent — use it to pull data from stores,
|
|
@@ -583,16 +591,20 @@ export declare interface FormCollector<V = Record<string, unknown>> {
|
|
|
583
591
|
*/
|
|
584
592
|
export declare type FormCollectorSchema = ClientFunctionSchema["parameters"];
|
|
585
593
|
|
|
586
|
-
/**
|
|
594
|
+
/** Canonical, source-of-truth state held in the collector's store. */
|
|
587
595
|
export declare interface FormCollectorState<V = Record<string, unknown>> {
|
|
588
596
|
/** Field values collected so far. */
|
|
589
597
|
values: Partial<V>;
|
|
598
|
+
/** True once a submit succeeded. */
|
|
599
|
+
submitted: boolean;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/** Completeness status derived from values + schema — computed on read, never stored. */
|
|
603
|
+
export declare interface FormCollectorStatus {
|
|
590
604
|
/** Required field names still empty. */
|
|
591
605
|
missing: string[];
|
|
592
606
|
/** True when no required field is missing. */
|
|
593
607
|
complete: boolean;
|
|
594
|
-
/** True once a submit succeeded. */
|
|
595
|
-
submitted: boolean;
|
|
596
608
|
}
|
|
597
609
|
|
|
598
610
|
declare interface FormField {
|
|
@@ -994,8 +1006,11 @@ export declare interface UseConversationResult {
|
|
|
994
1006
|
export declare function useFormCollector<V = Record<string, unknown>>(options: CreateFormCollectorOptions<V>): UseFormCollectorResult<V>;
|
|
995
1007
|
|
|
996
1008
|
export declare interface UseFormCollectorResult<V = Record<string, unknown>> extends FormCollector<V> {
|
|
997
|
-
/**
|
|
998
|
-
|
|
1009
|
+
/**
|
|
1010
|
+
* Live form state from the store (`values`, `submitted`) plus the completeness
|
|
1011
|
+
* status (`missing`, `complete`) derived on read — re-renders on every change.
|
|
1012
|
+
*/
|
|
1013
|
+
state: FormCollectorState<V> & FormCollectorStatus;
|
|
999
1014
|
}
|
|
1000
1015
|
|
|
1001
1016
|
/**
|
package/dist/react.d.ts
CHANGED
|
@@ -542,6 +542,14 @@ export declare interface CreateFormCollectorOptions<V = Record<string, unknown>>
|
|
|
542
542
|
*/
|
|
543
543
|
export declare function createMockClient(options?: MockAgoClientOptions): MockAgoClient;
|
|
544
544
|
|
|
545
|
+
/**
|
|
546
|
+
* Compute which required fields are still empty and whether the form is complete.
|
|
547
|
+
* Pure — the single home for the "required + non-empty" rule, shared by the update
|
|
548
|
+
* handler, submit, the dynamic context, and the React hook. Derived on read so the
|
|
549
|
+
* store only ever holds canonical state ({@link FormCollectorState}).
|
|
550
|
+
*/
|
|
551
|
+
export declare function deriveFormStatus(schema: FormCollectorSchema, values: Partial<Record<string, unknown>>): FormCollectorStatus;
|
|
552
|
+
|
|
545
553
|
/**
|
|
546
554
|
* A function that returns a fresh context entry on demand.
|
|
547
555
|
* Evaluated every time a message is sent — use it to pull data from stores,
|
|
@@ -583,16 +591,20 @@ export declare interface FormCollector<V = Record<string, unknown>> {
|
|
|
583
591
|
*/
|
|
584
592
|
export declare type FormCollectorSchema = ClientFunctionSchema["parameters"];
|
|
585
593
|
|
|
586
|
-
/**
|
|
594
|
+
/** Canonical, source-of-truth state held in the collector's store. */
|
|
587
595
|
export declare interface FormCollectorState<V = Record<string, unknown>> {
|
|
588
596
|
/** Field values collected so far. */
|
|
589
597
|
values: Partial<V>;
|
|
598
|
+
/** True once a submit succeeded. */
|
|
599
|
+
submitted: boolean;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/** Completeness status derived from values + schema — computed on read, never stored. */
|
|
603
|
+
export declare interface FormCollectorStatus {
|
|
590
604
|
/** Required field names still empty. */
|
|
591
605
|
missing: string[];
|
|
592
606
|
/** True when no required field is missing. */
|
|
593
607
|
complete: boolean;
|
|
594
|
-
/** True once a submit succeeded. */
|
|
595
|
-
submitted: boolean;
|
|
596
608
|
}
|
|
597
609
|
|
|
598
610
|
declare interface FormField {
|
|
@@ -994,8 +1006,11 @@ export declare interface UseConversationResult {
|
|
|
994
1006
|
export declare function useFormCollector<V = Record<string, unknown>>(options: CreateFormCollectorOptions<V>): UseFormCollectorResult<V>;
|
|
995
1007
|
|
|
996
1008
|
export declare interface UseFormCollectorResult<V = Record<string, unknown>> extends FormCollector<V> {
|
|
997
|
-
/**
|
|
998
|
-
|
|
1009
|
+
/**
|
|
1010
|
+
* Live form state from the store (`values`, `submitted`) plus the completeness
|
|
1011
|
+
* status (`missing`, `complete`) derived on read — re-renders on every change.
|
|
1012
|
+
*/
|
|
1013
|
+
state: FormCollectorState<V> & FormCollectorStatus;
|
|
999
1014
|
}
|
|
1000
1015
|
|
|
1001
1016
|
/**
|