@kapaai/support-form-deflector 0.17.4 → 0.17.5
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/apps/react-sdk/src/lib/smooth-streaming.d.ts +40 -0
- package/dist/apps/react-sdk/src/lib/smooth-streaming.d.ts.map +1 -0
- package/dist/apps/react-sdk/src/provider.d.ts.map +1 -1
- package/dist/apps/support-form-deflector/src/answer/mantine-markdown.d.ts +1 -1
- package/dist/apps/support-form-deflector/src/answer/mantine-markdown.d.ts.map +1 -1
- package/dist/apps/support-form-deflector/src/modal/DeflectorModal.d.ts.map +1 -1
- package/dist/apps/support-form-deflector/src/utils/serialize-conversation.d.ts.map +1 -1
- package/dist/kapa-support-form-deflector.bundle.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output pacing for streamed answers. The server flushes chunks at whatever
|
|
3
|
+
* cadence inference produces, which is bursty with silent gaps. Routing those
|
|
4
|
+
* chunks straight to the DOM exposes the burstiness as visible jitter.
|
|
5
|
+
*
|
|
6
|
+
* `createSmoothDispatcher` buffers incoming text and drains it on
|
|
7
|
+
* requestAnimationFrame in steady doses. The drain rate scales with queue
|
|
8
|
+
* depth so the visible stream stays close behind the network during bursts
|
|
9
|
+
* and keeps moving during dry spells.
|
|
10
|
+
*
|
|
11
|
+
* Behavior gates:
|
|
12
|
+
* - On environments without requestAnimationFrame (SSR, some test runners),
|
|
13
|
+
* text passes through synchronously: no smoothing, no behavior change.
|
|
14
|
+
* - `flushImmediately()` drains the entire queue synchronously. Call this
|
|
15
|
+
* before any state transition that reads the final answer (e.g. the
|
|
16
|
+
* completion callback path, or when identifiers land and flip status).
|
|
17
|
+
* - `cancel()` drops the queue without dispatching. Use on stop / reset /
|
|
18
|
+
* error so partial buffered text doesn't leak into the next state.
|
|
19
|
+
* - `destroy()` permanently disables the dispatcher. Subsequent calls are
|
|
20
|
+
* no-ops. Use on unmount so late callbacks from an in-flight request
|
|
21
|
+
* cannot reach an unmounted reducer.
|
|
22
|
+
*
|
|
23
|
+
* @internal — types are exported for unit tests; not part of the public SDK.
|
|
24
|
+
*/
|
|
25
|
+
export interface SmoothDispatcher {
|
|
26
|
+
/** Push more text into the queue. Drain happens on the next frame. */
|
|
27
|
+
enqueue(text: string): void;
|
|
28
|
+
/** Drain everything in the queue synchronously. Use before completion UI. */
|
|
29
|
+
flushImmediately(): void;
|
|
30
|
+
/** Drop everything in the queue without dispatching. Use on stop / reset. */
|
|
31
|
+
cancel(): void;
|
|
32
|
+
/** Permanently disable. Subsequent calls are no-ops. Use on unmount. */
|
|
33
|
+
destroy(): void;
|
|
34
|
+
}
|
|
35
|
+
export interface SmoothDispatcherOptions {
|
|
36
|
+
/** Called with each drained slice. Receives the same string that would have been passed in unsmoothed. */
|
|
37
|
+
onFlush: (text: string) => void;
|
|
38
|
+
}
|
|
39
|
+
export declare const createSmoothDispatcher: ({ onFlush, }: SmoothDispatcherOptions) => SmoothDispatcher;
|
|
40
|
+
//# sourceMappingURL=smooth-streaming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smooth-streaming.d.ts","sourceRoot":"","sources":["../../../../../../react-sdk/src/lib/smooth-streaming.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAoBH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,6EAA6E;IAC7E,gBAAgB,IAAI,IAAI,CAAC;IACzB,6EAA6E;IAC7E,MAAM,IAAI,IAAI,CAAC;IACf,wEAAwE;IACxE,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,uBAAuB;IACtC,0GAA0G;IAC1G,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAUD,eAAO,MAAM,sBAAsB,GAAI,cAEpC,uBAAuB,KAAG,gBA2J5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../react-sdk/src/provider.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAyB,cAAc,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../react-sdk/src/provider.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAyB,cAAc,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIlD,OAAO,EACL,SAAS,EACT,eAAe,EAEf,QAAQ,EACR,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAQjB,eAAO,MAAM,UAAU;mBAEF,MAAM;YACb,MAAM,GAAG,IAAI;uBACF,OAAO;wBACN,OAAO;kBACb,YAAY;eACf,SAAS;cACV,MAAM,GAAG,IAAI;iBACV,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;uBACjB,MAAM,IAAI;oBACb,MAAM,IAAI;iBACb,CACX,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE,eAAe,KACtB,IAAI;cAGH,CAAC;AAMb,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED,eAAO,MAAM,uBAAuB,EAAE,KAAK,CAAC,EAAE,CAC5C,4BAA4B,CAmU7B,CAAC;AAMF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IACrC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEjC;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAEhC;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC;;;OAGG;IACH,sBAAsB,CAAC,EAAE,WAAW,GAAG,UAAU,CAAC;IAElD;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;CAC7B,CAmDA,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import ReactMarkdown from "react-markdown";
|
|
3
3
|
type MantineMarkdownProps = React.ComponentProps<typeof ReactMarkdown> & {
|
|
4
|
-
onLinkClick: (href
|
|
4
|
+
onLinkClick: (href: string) => void;
|
|
5
5
|
children: string;
|
|
6
6
|
};
|
|
7
7
|
export declare const MantineMarkdown: React.FC<MantineMarkdownProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mantine-markdown.d.ts","sourceRoot":"","sources":["../../../../../src/answer/mantine-markdown.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAmB3C,KAAK,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,GAAG;IACvE,WAAW,EAAE,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"mantine-markdown.d.ts","sourceRoot":"","sources":["../../../../../src/answer/mantine-markdown.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAmB3C,KAAK,oBAAoB,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,GAAG;IACvE,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAqQF,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAW1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeflectorModal.d.ts","sourceRoot":"","sources":["../../../../../src/modal/DeflectorModal.tsx"],"names":[],"mappings":"AA+EA,eAAO,MAAM,cAAc,+
|
|
1
|
+
{"version":3,"file":"DeflectorModal.d.ts","sourceRoot":"","sources":["../../../../../src/modal/DeflectorModal.tsx"],"names":[],"mappings":"AA+EA,eAAO,MAAM,cAAc,+CAuN1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize-conversation.d.ts","sourceRoot":"","sources":["../../../../../src/utils/serialize-conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAE5C,eAAO,MAAM,sBAAsB,EAAG,CAAU,CAAC;AAUjD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;
|
|
1
|
+
{"version":3,"file":"serialize-conversation.d.ts","sourceRoot":"","sources":["../../../../../src/utils/serialize-conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAE5C,eAAO,MAAM,sBAAsB,EAAG,CAAU,CAAC;AAUjD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd;AAkHD,eAAO,MAAM,UAAU,GACrB,cAAc,SAAS,EAAE,EAAE,EAC3B,UAAU,cAAc,KACvB,MAOF,CAAC"}
|