@kapaai/support-form-deflector 0.9.4 → 0.9.6
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/kapa-support-form-deflector.bundle.js +1 -1
- package/dist/src/answer/index.d.ts.map +1 -1
- package/dist/src/answer/use-submit-button-text-override.d.ts +1 -1
- package/dist/src/answer/use-submit-button-text-override.d.ts.map +1 -1
- package/dist/src/answer/use-submit-button-text-override.test.d.ts +2 -0
- package/dist/src/answer/use-submit-button-text-override.test.d.ts.map +1 -0
- package/dist/src/state.d.ts +2 -2
- package/dist/src/state.d.ts.map +1 -1
- package/dist/src/utils/cached-deflector-state.d.ts +38 -0
- package/dist/src/utils/cached-deflector-state.d.ts.map +1 -0
- package/dist/src/utils/cached-deflector-state.test.d.ts +2 -0
- package/dist/src/utils/cached-deflector-state.test.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/answer/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/answer/index.tsx"],"names":[],"mappings":"AA4EA,QAAA,MAAM,aAAa,+CAmBlB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* config options have been set. It resets the button text to
|
|
5
5
|
* the original text once the deflector has been triggered.
|
|
6
6
|
*/
|
|
7
|
-
export declare const useSubmitButtonTextOverride: () =>
|
|
7
|
+
export declare const useSubmitButtonTextOverride: () => null;
|
|
8
8
|
//# sourceMappingURL=use-submit-button-text-override.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-submit-button-text-override.d.ts","sourceRoot":"","sources":["../../../src/answer/use-submit-button-text-override.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-submit-button-text-override.d.ts","sourceRoot":"","sources":["../../../src/answer/use-submit-button-text-override.tsx"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,YA0FvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-submit-button-text-override.test.d.ts","sourceRoot":"","sources":["../../../src/answer/use-submit-button-text-override.test.tsx"],"names":[],"mappings":""}
|
package/dist/src/state.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
export type DeflectorState = "loading" | "loading_longer" | "error" | "not_triggered" | "cancelled" | "success";
|
|
2
|
+
export type DeflectorState = "loading" | "loading_longer" | "error" | "not_triggered" | "cancelled" | "skipped" | "success";
|
|
3
3
|
type GlobalState = {
|
|
4
4
|
state: DeflectorState;
|
|
5
5
|
abortController?: AbortController;
|
|
@@ -9,7 +9,7 @@ type GlobalState = {
|
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
type GlobalAction = {
|
|
12
|
-
type: "LOADING" | "LOADING_LONGER" | "SUCCESS" | "ERROR" | "CANCELLED";
|
|
12
|
+
type: "LOADING" | "LOADING_LONGER" | "SUCCESS" | "ERROR" | "CANCELLED" | "SKIPPED";
|
|
13
13
|
data: any;
|
|
14
14
|
};
|
|
15
15
|
export declare const DeflectorProvider: React.FC<{
|
package/dist/src/state.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAqB/B,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,gBAAgB,GAChB,OAAO,GACP,eAAe,GACf,WAAW,GACX,SAAS,GACT,SAAS,CAAC;AACd,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,cAAc,CAAC;IACtB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,MAAM,CAAC,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC;AAQF,KAAK,YAAY,GAAG;IAClB,IAAI,EACA,SAAS,GACT,gBAAgB,GAChB,SAAS,GACT,OAAO,GACP,WAAW,GACX,SAAS,CAAC;IACd,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAkEF,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CA2mBA,CAAC;AAEF,eAAO,MAAM,YAAY;WAxnBZ,WAAW;cACR,MAAM,QAAQ,CAAC,YAAY,CAAC;CA6nB3C,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Logger } from "./logger";
|
|
2
|
+
export declare const LOCALSTORAGE_KEY = "kapa-support-form-deflector-state";
|
|
3
|
+
type StoreDeflectorStateProps = {
|
|
4
|
+
query: string;
|
|
5
|
+
threadId: string;
|
|
6
|
+
logger: Logger;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Saves the provided query and threadId to local storage along with a timestamp.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} params - The parameters for the function.
|
|
12
|
+
* @param {string} params.query - The query string to be saved.
|
|
13
|
+
* @param {string} params.threadId - The thread ID to be saved.
|
|
14
|
+
* @param {Object} params.logger - The logger object for logging debug information.
|
|
15
|
+
*
|
|
16
|
+
* @returns {void}
|
|
17
|
+
*/
|
|
18
|
+
export declare function storeDeflectorState({ query, threadId, logger, }: StoreDeflectorStateProps): void;
|
|
19
|
+
type CachedDeflectorStateProps = {
|
|
20
|
+
query: string;
|
|
21
|
+
logger: Logger;
|
|
22
|
+
toggleDeflectionStatus: (threadId: string, isDeflected: boolean) => void;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Hydrates the state from local storage if it matches the given query and is within the valid time window.
|
|
26
|
+
* If the data is invalid or does not match the query, it returns false. If the data is valid and matches the query,
|
|
27
|
+
* it toggles the deflection status and returns true.
|
|
28
|
+
*
|
|
29
|
+
* @param {Object} props - The properties for the function.
|
|
30
|
+
* @param {string} props.query - The query to match against the stored data.
|
|
31
|
+
* @param {Object} props.logger - The logger object to log debug information.
|
|
32
|
+
* @param {Function} props.toggleDeflectionStatus - The function to toggle the deflection status.
|
|
33
|
+
*
|
|
34
|
+
* @returns {boolean} - Whether the cached deflector state was used.
|
|
35
|
+
*/
|
|
36
|
+
export declare function shouldUseCachedDeflectorState({ query, logger, toggleDeflectionStatus, }: CachedDeflectorStateProps): boolean;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=cached-deflector-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cached-deflector-state.d.ts","sourceRoot":"","sources":["../../../src/utils/cached-deflector-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,gBAAgB,sCAAsC,CAAC;AAQpE,KAAK,wBAAwB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,QAAQ,EACR,MAAM,GACP,EAAE,wBAAwB,GAAG,IAAI,CAUjC;AAED,KAAK,yBAAyB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1E,CAAC;AAMF;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,KAAK,EACL,MAAM,EACN,sBAAsB,GACvB,EAAE,yBAAyB,GAAG,OAAO,CA8BrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cached-deflector-state.test.d.ts","sourceRoot":"","sources":["../../../src/utils/cached-deflector-state.test.tsx"],"names":[],"mappings":""}
|