@encatch/web-sdk 0.0.27 → 0.0.29-beta.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/dist-sdk/plugin/sdk/{core-wrapper-C7F9aT2b.js → core-wrapper-B3u5t44p.js} +5142 -5130
- package/dist-sdk/plugin/sdk/{module-nnOJl6G5.js → module-B1pi3Huq.js} +1 -1
- package/dist-sdk/plugin/sdk/module.js +1 -1
- package/package.json +6 -6
- package/src/hooks/useFetchElligibleFeedbackConfiguration.ts +1 -0
- package/src/hooks/useFetchFeedbackConfigurationDetails.ts +5 -2
- package/src/hooks/useSubmitFeedbackForm.ts +3 -6
|
@@ -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-B3u5t44p.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.29-beta.0",
|
|
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",
|
|
@@ -50,8 +50,10 @@
|
|
|
50
50
|
"prepublishOnly": "pnpm run build"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@encatch/
|
|
54
|
-
"@encatch/
|
|
53
|
+
"@encatch/web-form-engine-core": "workspace:*",
|
|
54
|
+
"@encatch/event-publisher": "workspace:*",
|
|
55
|
+
"@encatch/api-sdk": "workspace:*",
|
|
56
|
+
"@encatch/schema": "workspace:*",
|
|
55
57
|
"@preact/signals": "^2.5.1",
|
|
56
58
|
"json-logic-js": "2.0.5",
|
|
57
59
|
"lucide-preact": "^0.555.0",
|
|
@@ -61,12 +63,10 @@
|
|
|
61
63
|
"ua-parser-js": "^2.0.6"
|
|
62
64
|
},
|
|
63
65
|
"devDependencies": {
|
|
64
|
-
"@encatch/web-form-engine-core": "workspace:*",
|
|
65
|
-
"@encatch/event-publisher": "workspace:*",
|
|
66
66
|
"@preact/preset-vite": "^2.10.2",
|
|
67
67
|
"vite": "^7.2.4"
|
|
68
68
|
},
|
|
69
69
|
"eslintConfig": {
|
|
70
70
|
"extends": "preact"
|
|
71
71
|
}
|
|
72
|
-
}
|
|
72
|
+
}
|
|
@@ -252,6 +252,7 @@ export const useFetchElligibleFeedbackConfiguration = ({
|
|
|
252
252
|
const pendingFeedbacks = getPendingFeedbacks();
|
|
253
253
|
const filteredFeedbacks = filterByFrequencyRules(pendingFeedbacks);
|
|
254
254
|
setData(filteredFeedbacks);
|
|
255
|
+
setAllFeedbacks(pendingFeedbacks); // Populate allFeedbacks for manual feedback lookup
|
|
255
256
|
setFeedbackInterval(storedConfig.feedbackInterval);
|
|
256
257
|
const syncInterval = storedConfig.masterProperties?.configSyncIntervalSeconds || 15 * 60;
|
|
257
258
|
setConfigSyncInterval(syncInterval);
|
|
@@ -16,7 +16,7 @@ export const useFetchFeedbackConfigurationDetails = (
|
|
|
16
16
|
enableLogging: true,
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
const fetchDetails = async (params: FetchFeedbackDetailsRequest): Promise<FetchFeedbackDetailsResponse | null> => {
|
|
19
|
+
const fetchDetails = async (params: FetchFeedbackDetailsRequest): Promise<(FetchFeedbackDetailsResponse) | null> => {
|
|
20
20
|
// Prevent API calls if apiKey is blank
|
|
21
21
|
if (!apiKey || apiKey.trim() === '') {
|
|
22
22
|
console.warn('fetchDetails: API key is required');
|
|
@@ -52,7 +52,8 @@ export const useFetchFeedbackConfigurationDetails = (
|
|
|
52
52
|
'questionnaireFields' in result &&
|
|
53
53
|
'otherConfigurationProperties' in result &&
|
|
54
54
|
'welcomeScreenProperties' in result &&
|
|
55
|
-
'endScreenProperties' in result
|
|
55
|
+
'endScreenProperties' in result &&
|
|
56
|
+
'appearanceProperties' in result;
|
|
56
57
|
|
|
57
58
|
if (!isValidResponse) {
|
|
58
59
|
throw new Error('Invalid response format from server');
|
|
@@ -69,6 +70,8 @@ export const useFetchFeedbackConfigurationDetails = (
|
|
|
69
70
|
otherConfigurationProperties: result.otherConfigurationProperties,
|
|
70
71
|
welcomeScreenProperties: result.welcomeScreenProperties,
|
|
71
72
|
endScreenProperties: result.endScreenProperties,
|
|
73
|
+
// Include appearanceProperties if available in the response
|
|
74
|
+
appearanceProperties: result.appearanceProperties || null,
|
|
72
75
|
};
|
|
73
76
|
} catch (err) {
|
|
74
77
|
const errorMessage = err instanceof Error ? err.message : "An error occurred while fetching configuration details";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useState } from "preact/hooks";
|
|
2
2
|
import { SubmitFeedback, ViewFeedback } from "@encatch/schema";
|
|
3
3
|
import { EncatchApiSDK } from "@encatch/api-sdk";
|
|
4
|
-
import { moveFeedbackToSubmitted } from "../utils/feedback-storage";
|
|
5
4
|
|
|
6
5
|
export interface SubmitFeedbackResponse {
|
|
7
6
|
success?: boolean;
|
|
@@ -63,11 +62,9 @@ export const useSubmitFeedbackForm = ({
|
|
|
63
62
|
throw new Error(result.error || "Unknown error from SDK");
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
moveFeedbackToSubmitted(feedbackConfigId);
|
|
70
|
-
}
|
|
65
|
+
// Note: moveFeedbackToSubmitted is handled in core-wrapper.tsx
|
|
66
|
+
// where it checks isManual before moving. Manual feedbacks should NOT be moved.
|
|
67
|
+
// Previously this was called here unconditionally, causing manual feedbacks to be removed.
|
|
71
68
|
|
|
72
69
|
setSuccessSubmitFeedback(true);
|
|
73
70
|
return { success: true };
|