update feedback widget to overwrite config with open(), fix customer view in feedback timeline in app

This commit is contained in:
Matthias Nannt
2023-01-23 13:12:11 +01:00
parent 7b72ffb82e
commit 5bfb3a1864
13 changed files with 46 additions and 46 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@formbricks/feedback",
"version": "0.2.0",
"version": "0.2.1",
"source": "src/index.ts",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
+6 -3
View File
@@ -18,7 +18,7 @@ export interface FormbricksConfig {
disableErrorAlert: boolean;
}
const config: FormbricksConfig = {
let config: FormbricksConfig = {
customer: {},
disableErrorAlert: false,
// Merge with existing config
@@ -120,7 +120,10 @@ function onDisplay() {
trap.activate();
}
function open(e: Event) {
function open(e: Event, updatedConfig?: FormbricksConfig) {
if (updatedConfig) {
config = { ...config, ...updatedConfig };
}
if (config.divId) {
console.error('open() is not supported when using "divId" in config.');
return;
@@ -130,7 +133,7 @@ function open(e: Event) {
containerElement.classList.add("formbricks__modal");
}
const target = (e?.target as HTMLElement) || document.body;
const target = (e.target as HTMLElement) || document.body;
computePosition(target, containerElement, {
placement: "bottom",
middleware: [flip(), shift({ crossAxis: true, padding: 8 })],
+2 -2
View File
@@ -2,9 +2,10 @@
<script src="./dist/index.umd.js" charset="UTF-8" defer></script>
<script>
window.formbricks = {
...window.formbricks,
config: {
hqUrl: "http://localhost:3000",
formId: "clcovbccf000019uss1gyqufg",
formId: "cld8pxn4j0000yznuo6qggxfu",
contact: {
name: "Peer",
position: "Co-Founder",
@@ -24,7 +25,6 @@
buttonHoverColor: "#F3F4F6",
},
},
...window.formbricks,
};
</script>
</head>
+1 -1
View File
@@ -2,6 +2,7 @@
<script src="./dist/index.umd.js" charset="UTF-8" defer></script>
<script>
window.formbricks = {
...window.formbricks,
config: {
hqUrl: "http://localhost:3000",
formId: "clcg4dewt0000yz267be5rya6",
@@ -23,7 +24,6 @@
buttonHoverColor: "#F9FAFB",
},
},
...window.formbricks,
};
</script>
</head>
+1 -1
View File
@@ -2,6 +2,7 @@
<script src="./dist/index.umd.js" charset="UTF-8" defer></script>
<script>
window.formbricks = {
...window.formbricks,
config: {
hqUrl: "http://localhost:3000",
formId: "clcxavrfm0006yz11frfb0ms2",
@@ -25,7 +26,6 @@
buttonHoverColor: "#F3F4F6",
},
},
...window.formbricks,
};
</script>
</head>
+1 -1
View File
@@ -2,6 +2,7 @@
<script src="./dist/index.umd.js" charset="UTF-8" defer></script>
<script>
window.formbricks = {
...window.formbricks,
config: {
hqUrl: "http://localhost:3000",
formId: "clcovbccf000019uss1gyqufg",
@@ -25,7 +26,6 @@
borderRadius: "4px",
},
},
...window.formbricks,
};
</script>
</head>