@posthog/browser-common 0.9.5 → 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/client.d.ts +6 -0
- package/dist/config.js +1 -1
- package/dist/config.mjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +58 -10
- package/dist/index.mjs +1 -0
- package/dist/survey-action-matcher.d.ts +27 -0
- package/dist/survey-action-matcher.js +169 -0
- package/dist/survey-action-matcher.mjs +131 -0
- package/dist/survey-constants.d.ts +86 -0
- package/dist/survey-constants.js +144 -0
- package/dist/survey-constants.mjs +76 -0
- package/dist/survey-event-host.d.ts +15 -0
- package/dist/survey-event-host.js +18 -0
- package/dist/survey-event-host.mjs +1 -0
- package/dist/survey-event-receiver-base.d.ts +180 -0
- package/dist/survey-event-receiver-base.js +354 -0
- package/dist/survey-event-receiver-base.mjs +316 -0
- package/dist/survey-event-receiver.d.ts +36 -0
- package/dist/survey-event-receiver.js +133 -0
- package/dist/survey-event-receiver.mjs +95 -0
- package/dist/survey-render-context.d.ts +13 -0
- package/dist/survey-render-context.js +45 -0
- package/dist/survey-render-context.mjs +7 -0
- package/dist/surveys/components/BottomSection.d.ts +12 -0
- package/dist/surveys/components/BottomSection.js +82 -0
- package/dist/surveys/components/BottomSection.mjs +44 -0
- package/dist/surveys/components/ConfirmationMessage.d.ts +10 -0
- package/dist/surveys/components/ConfirmationMessage.js +92 -0
- package/dist/surveys/components/ConfirmationMessage.mjs +54 -0
- package/dist/surveys/components/IntroScreen.d.ts +10 -0
- package/dist/surveys/components/IntroScreen.js +78 -0
- package/dist/surveys/components/IntroScreen.mjs +40 -0
- package/dist/surveys/components/PostHogLogo.d.ts +5 -0
- package/dist/surveys/components/PostHogLogo.js +54 -0
- package/dist/surveys/components/PostHogLogo.mjs +16 -0
- package/dist/surveys/components/QuestionHeader.d.ts +10 -0
- package/dist/surveys/components/QuestionHeader.js +82 -0
- package/dist/surveys/components/QuestionHeader.mjs +41 -0
- package/dist/surveys/components/QuestionTypes.d.ts +31 -0
- package/dist/surveys/components/QuestionTypes.js +519 -0
- package/dist/surveys/components/QuestionTypes.mjs +469 -0
- package/dist/surveys/icons.d.ts +12 -0
- package/dist/surveys/icons.js +212 -0
- package/dist/surveys/icons.mjs +147 -0
- package/dist/surveys/survey-branching.d.ts +12 -0
- package/dist/surveys/survey-branching.js +101 -0
- package/dist/surveys/survey-branching.mjs +60 -0
- package/dist/surveys/survey-styles.d.ts +1 -0
- package/dist/surveys/survey-styles.js +40 -0
- package/dist/surveys/survey-styles.mjs +2 -0
- package/dist/surveys/survey-translations.d.ts +22 -0
- package/dist/surveys/survey-translations.js +68 -0
- package/dist/surveys/survey-translations.mjs +27 -0
- package/dist/surveys/survey-url-prefill.d.ts +36 -0
- package/dist/surveys/survey-url-prefill.js +162 -0
- package/dist/surveys/survey-url-prefill.mjs +118 -0
- package/dist/surveys/surveys-extension-utils.d.ts +133 -0
- package/dist/surveys/surveys-extension-utils.js +739 -0
- package/dist/surveys/surveys-extension-utils.mjs +608 -0
- package/dist/surveys-config.d.ts +60 -0
- package/dist/surveys-config.js +68 -0
- package/dist/surveys-config.mjs +9 -0
- package/dist/surveys-renderer.d.ts +248 -0
- package/dist/surveys-renderer.js +1299 -0
- package/dist/surveys-renderer.mjs +1230 -0
- package/dist/surveys.d.ts +117 -0
- package/dist/surveys.js +566 -0
- package/dist/surveys.mjs +495 -0
- package/dist/types/surveys.d.ts +83 -86
- package/dist/types/surveys.js +1 -127
- package/dist/types/surveys.mjs +1 -76
- package/dist/utils/autocapture-utils.js +8 -9
- package/dist/utils/autocapture-utils.mjs +8 -9
- package/dist/utils/matcher-utils.d.ts +1 -1
- package/dist/utils/matcher-utils.js +13 -10
- package/dist/utils/matcher-utils.mjs +10 -7
- package/dist/utils/survey-utils.d.ts +16 -0
- package/dist/utils/survey-utils.js +121 -0
- package/dist/utils/survey-utils.mjs +38 -0
- package/dist/utils/url-targeting-utils.d.ts +3 -1
- package/dist/utils/url-targeting-utils.js +1 -2
- package/dist/utils/url-targeting-utils.mjs +1 -2
- package/dist/utils/uuidv7.js +4 -4
- package/dist/utils/uuidv7.mjs +4 -4
- package/package.json +96 -2
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
IntroScreen: ()=>IntroScreen
|
|
32
|
+
});
|
|
33
|
+
const jsx_runtime_namespaceObject = require("preact/jsx-runtime");
|
|
34
|
+
const external_preact_namespaceObject = require("preact");
|
|
35
|
+
const external_surveys_extension_utils_js_namespaceObject = require("../surveys-extension-utils.js");
|
|
36
|
+
const external_BottomSection_js_namespaceObject = require("./BottomSection.js");
|
|
37
|
+
const external_QuestionHeader_js_namespaceObject = require("./QuestionHeader.js");
|
|
38
|
+
const hooks_namespaceObject = require("preact/hooks");
|
|
39
|
+
function IntroScreen({ header, description, contentType, forceDisableHtml, appearance, onStart }) {
|
|
40
|
+
const { isPopup, onPreviewSubmit, onPopupSurveyDismissed } = (0, hooks_namespaceObject.useContext)(external_surveys_extension_utils_js_namespaceObject.SurveyContext);
|
|
41
|
+
const renderCancelButton = isPopup && true !== appearance.hideCancelButton;
|
|
42
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
43
|
+
className: "intro-screen",
|
|
44
|
+
role: "status",
|
|
45
|
+
tabIndex: 0,
|
|
46
|
+
"aria-atomic": "true",
|
|
47
|
+
children: [
|
|
48
|
+
renderCancelButton && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_QuestionHeader_js_namespaceObject.Cancel, {
|
|
49
|
+
onClick: ()=>onPopupSurveyDismissed()
|
|
50
|
+
}),
|
|
51
|
+
header && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h3", {
|
|
52
|
+
className: "intro-screen-header",
|
|
53
|
+
children: header
|
|
54
|
+
}),
|
|
55
|
+
description && (0, external_surveys_extension_utils_js_namespaceObject.renderChildrenAsTextOrHtml)({
|
|
56
|
+
component: (0, external_preact_namespaceObject.h)('p', {
|
|
57
|
+
className: 'intro-screen-body'
|
|
58
|
+
}),
|
|
59
|
+
children: description,
|
|
60
|
+
renderAsHtml: !forceDisableHtml && 'text' !== contentType
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_BottomSection_js_namespaceObject.BottomSection, {
|
|
63
|
+
text: appearance.introScreenButtonText || 'Get started',
|
|
64
|
+
submitDisabled: false,
|
|
65
|
+
appearance: appearance,
|
|
66
|
+
onSubmit: onStart,
|
|
67
|
+
onPreviewSubmit: ()=>onPreviewSubmit(null)
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
exports.IntroScreen = __webpack_exports__.IntroScreen;
|
|
73
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
74
|
+
"IntroScreen"
|
|
75
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
76
|
+
Object.defineProperty(exports, '__esModule', {
|
|
77
|
+
value: true
|
|
78
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { h } from "preact";
|
|
3
|
+
import { SurveyContext, renderChildrenAsTextOrHtml } from "../surveys-extension-utils.mjs";
|
|
4
|
+
import { BottomSection } from "./BottomSection.mjs";
|
|
5
|
+
import { Cancel } from "./QuestionHeader.mjs";
|
|
6
|
+
import { useContext } from "preact/hooks";
|
|
7
|
+
function IntroScreen({ header, description, contentType, forceDisableHtml, appearance, onStart }) {
|
|
8
|
+
const { isPopup, onPreviewSubmit, onPopupSurveyDismissed } = useContext(SurveyContext);
|
|
9
|
+
const renderCancelButton = isPopup && true !== appearance.hideCancelButton;
|
|
10
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
11
|
+
className: "intro-screen",
|
|
12
|
+
role: "status",
|
|
13
|
+
tabIndex: 0,
|
|
14
|
+
"aria-atomic": "true",
|
|
15
|
+
children: [
|
|
16
|
+
renderCancelButton && /*#__PURE__*/ jsx(Cancel, {
|
|
17
|
+
onClick: ()=>onPopupSurveyDismissed()
|
|
18
|
+
}),
|
|
19
|
+
header && /*#__PURE__*/ jsx("h3", {
|
|
20
|
+
className: "intro-screen-header",
|
|
21
|
+
children: header
|
|
22
|
+
}),
|
|
23
|
+
description && renderChildrenAsTextOrHtml({
|
|
24
|
+
component: h('p', {
|
|
25
|
+
className: 'intro-screen-body'
|
|
26
|
+
}),
|
|
27
|
+
children: description,
|
|
28
|
+
renderAsHtml: !forceDisableHtml && 'text' !== contentType
|
|
29
|
+
}),
|
|
30
|
+
/*#__PURE__*/ jsx(BottomSection, {
|
|
31
|
+
text: appearance.introScreenButtonText || 'Get started',
|
|
32
|
+
submitDisabled: false,
|
|
33
|
+
appearance: appearance,
|
|
34
|
+
onSubmit: onStart,
|
|
35
|
+
onPreviewSubmit: ()=>onPreviewSubmit(null)
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export { IntroScreen };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
PostHogLogo: ()=>PostHogLogo
|
|
32
|
+
});
|
|
33
|
+
const jsx_runtime_namespaceObject = require("preact/jsx-runtime");
|
|
34
|
+
const external_icons_js_namespaceObject = require("../icons.js");
|
|
35
|
+
function PostHogLogo({ urlParams }) {
|
|
36
|
+
const queryString = urlParams ? Object.entries(urlParams).map(([key, value])=>`${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join('&') : '';
|
|
37
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("a", {
|
|
38
|
+
href: `https://posthog.com/surveys${queryString ? `?${queryString}` : ''}`,
|
|
39
|
+
target: "_blank",
|
|
40
|
+
rel: "noopener",
|
|
41
|
+
className: "footer-branding",
|
|
42
|
+
children: [
|
|
43
|
+
"Survey by ",
|
|
44
|
+
external_icons_js_namespaceObject.IconPosthogLogo
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
exports.PostHogLogo = __webpack_exports__.PostHogLogo;
|
|
49
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
50
|
+
"PostHogLogo"
|
|
51
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
52
|
+
Object.defineProperty(exports, '__esModule', {
|
|
53
|
+
value: true
|
|
54
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { IconPosthogLogo } from "../icons.mjs";
|
|
3
|
+
function PostHogLogo({ urlParams }) {
|
|
4
|
+
const queryString = urlParams ? Object.entries(urlParams).map(([key, value])=>`${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join('&') : '';
|
|
5
|
+
return /*#__PURE__*/ jsxs("a", {
|
|
6
|
+
href: `https://posthog.com/surveys${queryString ? `?${queryString}` : ''}`,
|
|
7
|
+
target: "_blank",
|
|
8
|
+
rel: "noopener",
|
|
9
|
+
className: "footer-branding",
|
|
10
|
+
children: [
|
|
11
|
+
"Survey by ",
|
|
12
|
+
IconPosthogLogo
|
|
13
|
+
]
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export { PostHogLogo };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import type { SurveyQuestion } from '../../types/surveys';
|
|
3
|
+
export declare function QuestionHeader({ question, forceDisableHtml, htmlFor, }: {
|
|
4
|
+
question: Pick<SurveyQuestion, 'question' | 'description' | 'descriptionContentType' | 'type'>;
|
|
5
|
+
forceDisableHtml: boolean;
|
|
6
|
+
htmlFor?: string | undefined;
|
|
7
|
+
}): h.JSX.Element;
|
|
8
|
+
export declare function Cancel({ onClick }: {
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
}): h.JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
+
})();
|
|
18
|
+
(()=>{
|
|
19
|
+
__webpack_require__.r = (exports1)=>{
|
|
20
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
+
value: 'Module'
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
+
value: true
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
var __webpack_exports__ = {};
|
|
29
|
+
__webpack_require__.r(__webpack_exports__);
|
|
30
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31
|
+
Cancel: ()=>Cancel,
|
|
32
|
+
QuestionHeader: ()=>QuestionHeader
|
|
33
|
+
});
|
|
34
|
+
const jsx_runtime_namespaceObject = require("preact/jsx-runtime");
|
|
35
|
+
const external_preact_namespaceObject = require("preact");
|
|
36
|
+
const hooks_namespaceObject = require("preact/hooks");
|
|
37
|
+
const external_survey_constants_js_namespaceObject = require("../../survey-constants.js");
|
|
38
|
+
const external_icons_js_namespaceObject = require("../icons.js");
|
|
39
|
+
const external_surveys_extension_utils_js_namespaceObject = require("../surveys-extension-utils.js");
|
|
40
|
+
function QuestionHeader({ question, forceDisableHtml, htmlFor }) {
|
|
41
|
+
const TitleComponent = question.type === external_survey_constants_js_namespaceObject.SurveyQuestionType.Open ? 'label' : 'h3';
|
|
42
|
+
const isHeaderEmpty = !question.question && !question.description;
|
|
43
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
44
|
+
class: isHeaderEmpty ? 'question-header question-header--empty' : 'question-header',
|
|
45
|
+
children: [
|
|
46
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TitleComponent, {
|
|
47
|
+
className: "survey-question",
|
|
48
|
+
htmlFor: htmlFor,
|
|
49
|
+
children: question.question
|
|
50
|
+
}),
|
|
51
|
+
question.description && (0, external_surveys_extension_utils_js_namespaceObject.renderChildrenAsTextOrHtml)({
|
|
52
|
+
component: (0, external_preact_namespaceObject.h)('p', {
|
|
53
|
+
className: "survey-question-description"
|
|
54
|
+
}),
|
|
55
|
+
children: question.description,
|
|
56
|
+
renderAsHtml: !forceDisableHtml && 'text' !== question.descriptionContentType
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function Cancel({ onClick }) {
|
|
62
|
+
const { isPreviewMode } = (0, hooks_namespaceObject.useContext)(external_surveys_extension_utils_js_namespaceObject.SurveyContext);
|
|
63
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("button", {
|
|
64
|
+
className: "form-cancel",
|
|
65
|
+
onClick: onClick,
|
|
66
|
+
disabled: isPreviewMode,
|
|
67
|
+
"aria-label": "Close survey",
|
|
68
|
+
type: "button",
|
|
69
|
+
children: (0, external_icons_js_namespaceObject.cancelSVG)({
|
|
70
|
+
fill: 'black'
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
exports.Cancel = __webpack_exports__.Cancel;
|
|
75
|
+
exports.QuestionHeader = __webpack_exports__.QuestionHeader;
|
|
76
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
77
|
+
"Cancel",
|
|
78
|
+
"QuestionHeader"
|
|
79
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
80
|
+
Object.defineProperty(exports, '__esModule', {
|
|
81
|
+
value: true
|
|
82
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx, jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { h } from "preact";
|
|
3
|
+
import { useContext } from "preact/hooks";
|
|
4
|
+
import { SurveyQuestionType } from "../../survey-constants.mjs";
|
|
5
|
+
import { cancelSVG } from "../icons.mjs";
|
|
6
|
+
import { SurveyContext, renderChildrenAsTextOrHtml } from "../surveys-extension-utils.mjs";
|
|
7
|
+
function QuestionHeader({ question, forceDisableHtml, htmlFor }) {
|
|
8
|
+
const TitleComponent = question.type === SurveyQuestionType.Open ? 'label' : 'h3';
|
|
9
|
+
const isHeaderEmpty = !question.question && !question.description;
|
|
10
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
11
|
+
class: isHeaderEmpty ? 'question-header question-header--empty' : 'question-header',
|
|
12
|
+
children: [
|
|
13
|
+
/*#__PURE__*/ jsx(TitleComponent, {
|
|
14
|
+
className: "survey-question",
|
|
15
|
+
htmlFor: htmlFor,
|
|
16
|
+
children: question.question
|
|
17
|
+
}),
|
|
18
|
+
question.description && renderChildrenAsTextOrHtml({
|
|
19
|
+
component: h('p', {
|
|
20
|
+
className: "survey-question-description"
|
|
21
|
+
}),
|
|
22
|
+
children: question.description,
|
|
23
|
+
renderAsHtml: !forceDisableHtml && 'text' !== question.descriptionContentType
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function Cancel({ onClick }) {
|
|
29
|
+
const { isPreviewMode } = useContext(SurveyContext);
|
|
30
|
+
return /*#__PURE__*/ jsx("button", {
|
|
31
|
+
className: "form-cancel",
|
|
32
|
+
onClick: onClick,
|
|
33
|
+
disabled: isPreviewMode,
|
|
34
|
+
"aria-label": "Close survey",
|
|
35
|
+
type: "button",
|
|
36
|
+
children: cancelSVG({
|
|
37
|
+
fill: 'black'
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export { Cancel, QuestionHeader };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type JSX } from 'preact';
|
|
2
|
+
import type { BasicSurveyQuestion, LinkSurveyQuestion, MultipleSurveyQuestion, RatingSurveyQuestion, SurveyAppearance } from '../../types/surveys';
|
|
3
|
+
export interface CommonQuestionProps {
|
|
4
|
+
forceDisableHtml: boolean;
|
|
5
|
+
appearance: SurveyAppearance;
|
|
6
|
+
onSubmit: (res: string | string[] | number | null) => void;
|
|
7
|
+
onPreviewSubmit: (res: string | string[] | number | null) => void;
|
|
8
|
+
initialValue?: (string | string[] | number | null) | undefined;
|
|
9
|
+
displayQuestionIndex: number;
|
|
10
|
+
canGoBack?: boolean | undefined;
|
|
11
|
+
onBack?: (() => void) | undefined;
|
|
12
|
+
}
|
|
13
|
+
export declare function OpenTextQuestion({ question, forceDisableHtml, appearance, onSubmit, onPreviewSubmit, displayQuestionIndex, initialValue, canGoBack, onBack, }: CommonQuestionProps & {
|
|
14
|
+
question: BasicSurveyQuestion;
|
|
15
|
+
}): JSX.Element;
|
|
16
|
+
export declare function LinkQuestion({ question, forceDisableHtml, appearance, onSubmit, onPreviewSubmit, canGoBack, onBack, }: CommonQuestionProps & {
|
|
17
|
+
question: LinkSurveyQuestion;
|
|
18
|
+
}): JSX.Element;
|
|
19
|
+
export declare function RatingQuestion({ question, forceDisableHtml, displayQuestionIndex, appearance, onSubmit, onPreviewSubmit, initialValue, canGoBack, onBack, }: CommonQuestionProps & {
|
|
20
|
+
question: RatingSurveyQuestion;
|
|
21
|
+
}): JSX.Element;
|
|
22
|
+
export declare function RatingButton({ num, active, displayQuestionIndex, setActiveNumber, }: {
|
|
23
|
+
num: number;
|
|
24
|
+
active: boolean;
|
|
25
|
+
displayQuestionIndex: number;
|
|
26
|
+
appearance: SurveyAppearance;
|
|
27
|
+
setActiveNumber: (num: number) => void;
|
|
28
|
+
}): JSX.Element;
|
|
29
|
+
export declare function MultipleChoiceQuestion({ question, forceDisableHtml, displayQuestionIndex, appearance, onSubmit, onPreviewSubmit, initialValue, canGoBack, onBack, }: CommonQuestionProps & {
|
|
30
|
+
question: MultipleSurveyQuestion;
|
|
31
|
+
}): JSX.Element;
|