@encatch/web-sdk 0.0.26 → 0.0.28
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-sdk/plugin/sdk/{core-wrapper-vAPvPwZx.js → core-wrapper-BqBdNXcC.js} +7234 -7228
- package/dist-sdk/plugin/sdk/{module-CyTvQ4YT.js → module-vF-t_Wh7.js} +1 -1
- package/dist-sdk/plugin/sdk/module.js +1 -1
- package/package.json +1 -1
- package/src/hooks/useFetchElligibleFeedbackConfiguration.ts +7 -0
- package/src/hooks/useFetchFeedbackConfigurationDetails.ts +8 -1
- package/src/hooks/useRefineTextForm.ts +7 -0
- package/src/hooks/useSubmitFeedbackForm.ts +12 -0
|
@@ -319,7 +319,7 @@ async function Ee() {
|
|
|
319
319
|
if (!(te || typeof window > "u" || typeof document > "u")) {
|
|
320
320
|
te = !0;
|
|
321
321
|
try {
|
|
322
|
-
const { render: t } = await Promise.resolve().then(() => be), e = (await import("./core-wrapper-
|
|
322
|
+
const { render: t } = await Promise.resolve().then(() => be), e = (await import("./core-wrapper-BqBdNXcC.js")).default;
|
|
323
323
|
if (typeof document > "u") return;
|
|
324
324
|
let n = document.getElementById("enisght-root");
|
|
325
325
|
!n && document.body && (n = document.createElement("div"), n.id = "enisght-root", document.body.appendChild(n)), n && t(/* @__PURE__ */ Se(e, {}), n);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@encatch/web-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"description": "A powerful, lightweight JavaScript SDK for collecting user feedback and running surveys on web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist-sdk/plugin/sdk/module.js",
|
|
@@ -233,6 +233,13 @@ export const useFetchElligibleFeedbackConfiguration = ({
|
|
|
233
233
|
enableLogging: true,
|
|
234
234
|
});
|
|
235
235
|
const fetchConfiguration = async (params: FetchConfigurationListRequest) => {
|
|
236
|
+
// Prevent API calls if apiKey is blank
|
|
237
|
+
if (!apiKey || apiKey.trim() === '') {
|
|
238
|
+
console.warn('fetchConfiguration: API key is required');
|
|
239
|
+
setError('API key is required');
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
|
|
236
243
|
setLastFetchParams(params);
|
|
237
244
|
lastFetchParamsRef.current = params;
|
|
238
245
|
setLoading(true);
|
|
@@ -17,10 +17,17 @@ export const useFetchFeedbackConfigurationDetails = (
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
const fetchDetails = async (params: FetchFeedbackDetailsRequest): Promise<FetchFeedbackDetailsResponse | null> => {
|
|
20
|
+
// Prevent API calls if apiKey is blank
|
|
21
|
+
if (!apiKey || apiKey.trim() === '') {
|
|
22
|
+
console.warn('fetchDetails: API key is required');
|
|
23
|
+
setErrorFetchDetails('API key is required');
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
setLoadingFetchDetails(true);
|
|
21
28
|
setErrorFetchDetails(null);
|
|
22
29
|
setSuccessFetchDetails(false);
|
|
23
|
-
|
|
30
|
+
|
|
24
31
|
try {
|
|
25
32
|
// Prepare request in the shape expected by the SDK
|
|
26
33
|
const sdkParams: FetchFeedbackDetailsRequest = {
|
|
@@ -17,6 +17,13 @@ export const useRefineTextForm = ({ apiKey, hostUrl }: { apiKey?: string; hostUr
|
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
const refineText = async (params: RefineTextParams): Promise<RefineTextResponse | null> => {
|
|
20
|
+
// Prevent API calls if apiKey is blank
|
|
21
|
+
if (!apiKey || apiKey.trim() === '') {
|
|
22
|
+
console.warn('refineText: API key is required');
|
|
23
|
+
setErrorRefineText('API key is required');
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
setLoadingRefineText(true);
|
|
21
28
|
setErrorRefineText(null);
|
|
22
29
|
setResultRefineText(null);
|
|
@@ -39,6 +39,12 @@ export const useSubmitFeedbackForm = ({
|
|
|
39
39
|
const submitFeedback = async (
|
|
40
40
|
params: SubmitFeedback
|
|
41
41
|
): Promise<SubmitFeedbackResponse> => {
|
|
42
|
+
// Prevent API calls if apiKey is blank
|
|
43
|
+
if (!apiKey || apiKey.trim() === '') {
|
|
44
|
+
console.warn('submitFeedback: API key is required');
|
|
45
|
+
return { error: 'API key is required' };
|
|
46
|
+
}
|
|
47
|
+
|
|
42
48
|
setLoadingSubmitFeedback(true);
|
|
43
49
|
setErrorSubmitFeedback(null);
|
|
44
50
|
setSuccessSubmitFeedback(false);
|
|
@@ -80,6 +86,12 @@ export const useSubmitFeedbackForm = ({
|
|
|
80
86
|
const viewFeedback = async (
|
|
81
87
|
params: ViewFeedback
|
|
82
88
|
): Promise<SubmitFeedbackResponse> => {
|
|
89
|
+
// Prevent API calls if apiKey is blank
|
|
90
|
+
if (!apiKey || apiKey.trim() === '') {
|
|
91
|
+
console.warn('viewFeedback: API key is required');
|
|
92
|
+
return { error: 'API key is required' };
|
|
93
|
+
}
|
|
94
|
+
|
|
83
95
|
setLoadingViewFeedback(true);
|
|
84
96
|
setErrorViewFeedback(null);
|
|
85
97
|
setSuccessViewFeedback(false);
|