@web-site-utilities/feedback 0.0.12 → 0.0.15
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/form/App.d.ts
CHANGED
|
@@ -8,5 +8,5 @@ export declare const App: (props: AppProps) => string | React.FunctionComponentE
|
|
|
8
8
|
theme: typeof import("@web-site-utilities/common/theme/ThemeProvider").theme;
|
|
9
9
|
selectedVariant?: import("@web-site-utilities/common/theme/ThemeProvider").Variants;
|
|
10
10
|
children: React.ReactNode;
|
|
11
|
-
}
|
|
11
|
+
}> | null;
|
|
12
12
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { FormConfigTheme, InlineForm } from
|
|
3
|
-
import { Nullable } from
|
|
2
|
+
import { FormConfigTheme, InlineForm } from "@web-site-utilities/common/types/FormConfig";
|
|
3
|
+
import { Nullable } from "@web-site-utilities/common/types/Nullable";
|
|
4
4
|
export type InPlaceFormProps = {
|
|
5
5
|
formId: string;
|
|
6
6
|
domainId: string;
|
package/dist/index.cjs.js
CHANGED
|
@@ -2934,6 +2934,7 @@ const useStepper = (props) => {
|
|
|
2934
2934
|
return {
|
|
2935
2935
|
step,
|
|
2936
2936
|
errors,
|
|
2937
|
+
isLastStep: step === props.stepsCount,
|
|
2937
2938
|
onContinue,
|
|
2938
2939
|
onBack
|
|
2939
2940
|
};
|
|
@@ -3756,12 +3757,15 @@ const InPlaceForm = (props) => {
|
|
|
3756
3757
|
[]
|
|
3757
3758
|
);
|
|
3758
3759
|
const [maxHeight, setMaxHeight] = React.useState(null);
|
|
3759
|
-
const onSetMaxHeight = React.useCallback(
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3760
|
+
const onSetMaxHeight = React.useCallback(
|
|
3761
|
+
(h) => {
|
|
3762
|
+
setMaxHeight((stateHeight) => {
|
|
3763
|
+
if (!stateHeight || stateHeight < h) return h;
|
|
3764
|
+
return stateHeight;
|
|
3765
|
+
});
|
|
3766
|
+
},
|
|
3767
|
+
[setMaxHeight, props.inlineForm.form.steps]
|
|
3768
|
+
);
|
|
3765
3769
|
const populatedForm = useForm({
|
|
3766
3770
|
form: props.inlineForm.form,
|
|
3767
3771
|
formId: props.formId,
|
|
@@ -3807,7 +3811,7 @@ const InPlaceForm = (props) => {
|
|
|
3807
3811
|
React.createElement(Footer$1, {
|
|
3808
3812
|
children: [
|
|
3809
3813
|
React.createElement(Button, {
|
|
3810
|
-
children:
|
|
3814
|
+
children: props.inlineForm.config.previousButtonText,
|
|
3811
3815
|
disabled: stepper.step === 0,
|
|
3812
3816
|
onClick: stepper.onBack
|
|
3813
3817
|
}),
|
|
@@ -3816,7 +3820,7 @@ const InPlaceForm = (props) => {
|
|
|
3816
3820
|
currentStepIndex: stepper.step
|
|
3817
3821
|
}),
|
|
3818
3822
|
React.createElement(Button, {
|
|
3819
|
-
children:
|
|
3823
|
+
children: stepper.isLastStep ? props.inlineForm.config.submitButtonText : props.inlineForm.config.nextButtonText,
|
|
3820
3824
|
onClick: stepper.onContinue
|
|
3821
3825
|
})
|
|
3822
3826
|
]
|
|
@@ -4054,12 +4058,14 @@ const PopupForm = (props) => {
|
|
|
4054
4058
|
});
|
|
4055
4059
|
};
|
|
4056
4060
|
const App = (props) => {
|
|
4061
|
+
const [isClient, setIsClient] = React.useState(false);
|
|
4057
4062
|
props.locale ?? "en-US";
|
|
4058
4063
|
let { data, loading, error } = useRequest(
|
|
4059
4064
|
() => getFormConfigMock({
|
|
4060
4065
|
formId: props.formId
|
|
4061
4066
|
})
|
|
4062
4067
|
);
|
|
4068
|
+
React.useEffect(() => setIsClient(true), []);
|
|
4063
4069
|
const inPlaceForm = React.useMemo(() => {
|
|
4064
4070
|
if (!(data == null ? void 0 : data.inlineForm)) return null;
|
|
4065
4071
|
return React.createElement(InPlaceForm, {
|
|
@@ -4080,6 +4086,7 @@ const App = (props) => {
|
|
|
4080
4086
|
popupForm: data.popupForm
|
|
4081
4087
|
});
|
|
4082
4088
|
}, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, props.formId]);
|
|
4089
|
+
if (!isClient) return null;
|
|
4083
4090
|
if (!data && loading) return "Loading...";
|
|
4084
4091
|
if (!data || error) return error ? error.message : "Unknown error";
|
|
4085
4092
|
return React.createElement(ThemeProvider, {
|
package/dist/index.es.js
CHANGED
|
@@ -2932,6 +2932,7 @@ const useStepper = (props) => {
|
|
|
2932
2932
|
return {
|
|
2933
2933
|
step,
|
|
2934
2934
|
errors,
|
|
2935
|
+
isLastStep: step === props.stepsCount,
|
|
2935
2936
|
onContinue,
|
|
2936
2937
|
onBack
|
|
2937
2938
|
};
|
|
@@ -3754,12 +3755,15 @@ const InPlaceForm = (props) => {
|
|
|
3754
3755
|
[]
|
|
3755
3756
|
);
|
|
3756
3757
|
const [maxHeight, setMaxHeight] = React.useState(null);
|
|
3757
|
-
const onSetMaxHeight = useCallback(
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3758
|
+
const onSetMaxHeight = useCallback(
|
|
3759
|
+
(h) => {
|
|
3760
|
+
setMaxHeight((stateHeight) => {
|
|
3761
|
+
if (!stateHeight || stateHeight < h) return h;
|
|
3762
|
+
return stateHeight;
|
|
3763
|
+
});
|
|
3764
|
+
},
|
|
3765
|
+
[setMaxHeight, props.inlineForm.form.steps]
|
|
3766
|
+
);
|
|
3763
3767
|
const populatedForm = useForm({
|
|
3764
3768
|
form: props.inlineForm.form,
|
|
3765
3769
|
formId: props.formId,
|
|
@@ -3805,7 +3809,7 @@ const InPlaceForm = (props) => {
|
|
|
3805
3809
|
React.createElement(Footer$1, {
|
|
3806
3810
|
children: [
|
|
3807
3811
|
React.createElement(Button, {
|
|
3808
|
-
children:
|
|
3812
|
+
children: props.inlineForm.config.previousButtonText,
|
|
3809
3813
|
disabled: stepper.step === 0,
|
|
3810
3814
|
onClick: stepper.onBack
|
|
3811
3815
|
}),
|
|
@@ -3814,7 +3818,7 @@ const InPlaceForm = (props) => {
|
|
|
3814
3818
|
currentStepIndex: stepper.step
|
|
3815
3819
|
}),
|
|
3816
3820
|
React.createElement(Button, {
|
|
3817
|
-
children:
|
|
3821
|
+
children: stepper.isLastStep ? props.inlineForm.config.submitButtonText : props.inlineForm.config.nextButtonText,
|
|
3818
3822
|
onClick: stepper.onContinue
|
|
3819
3823
|
})
|
|
3820
3824
|
]
|
|
@@ -4052,12 +4056,14 @@ const PopupForm = (props) => {
|
|
|
4052
4056
|
});
|
|
4053
4057
|
};
|
|
4054
4058
|
const App = (props) => {
|
|
4059
|
+
const [isClient, setIsClient] = React.useState(false);
|
|
4055
4060
|
props.locale ?? "en-US";
|
|
4056
4061
|
let { data, loading, error } = useRequest(
|
|
4057
4062
|
() => getFormConfigMock({
|
|
4058
4063
|
formId: props.formId
|
|
4059
4064
|
})
|
|
4060
4065
|
);
|
|
4066
|
+
React.useEffect(() => setIsClient(true), []);
|
|
4061
4067
|
const inPlaceForm = useMemo(() => {
|
|
4062
4068
|
if (!(data == null ? void 0 : data.inlineForm)) return null;
|
|
4063
4069
|
return React.createElement(InPlaceForm, {
|
|
@@ -4078,6 +4084,7 @@ const App = (props) => {
|
|
|
4078
4084
|
popupForm: data.popupForm
|
|
4079
4085
|
});
|
|
4080
4086
|
}, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, props.formId]);
|
|
4087
|
+
if (!isClient) return null;
|
|
4081
4088
|
if (!data && loading) return "Loading...";
|
|
4082
4089
|
if (!data || error) return error ? error.message : "Unknown error";
|
|
4083
4090
|
return React.createElement(ThemeProvider, {
|
package/dist/index.iife.js
CHANGED
|
@@ -2932,6 +2932,7 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
2932
2932
|
return {
|
|
2933
2933
|
step,
|
|
2934
2934
|
errors,
|
|
2935
|
+
isLastStep: step === props.stepsCount,
|
|
2935
2936
|
onContinue,
|
|
2936
2937
|
onBack
|
|
2937
2938
|
};
|
|
@@ -3754,12 +3755,15 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
3754
3755
|
[]
|
|
3755
3756
|
);
|
|
3756
3757
|
const [maxHeight, setMaxHeight] = React2.useState(null);
|
|
3757
|
-
const onSetMaxHeight = React2.useCallback(
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3758
|
+
const onSetMaxHeight = React2.useCallback(
|
|
3759
|
+
(h) => {
|
|
3760
|
+
setMaxHeight((stateHeight) => {
|
|
3761
|
+
if (!stateHeight || stateHeight < h) return h;
|
|
3762
|
+
return stateHeight;
|
|
3763
|
+
});
|
|
3764
|
+
},
|
|
3765
|
+
[setMaxHeight, props.inlineForm.form.steps]
|
|
3766
|
+
);
|
|
3763
3767
|
const populatedForm = useForm({
|
|
3764
3768
|
form: props.inlineForm.form,
|
|
3765
3769
|
formId: props.formId,
|
|
@@ -3805,7 +3809,7 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
3805
3809
|
React2.createElement(Footer$1, {
|
|
3806
3810
|
children: [
|
|
3807
3811
|
React2.createElement(Button, {
|
|
3808
|
-
children:
|
|
3812
|
+
children: props.inlineForm.config.previousButtonText,
|
|
3809
3813
|
disabled: stepper.step === 0,
|
|
3810
3814
|
onClick: stepper.onBack
|
|
3811
3815
|
}),
|
|
@@ -3814,7 +3818,7 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
3814
3818
|
currentStepIndex: stepper.step
|
|
3815
3819
|
}),
|
|
3816
3820
|
React2.createElement(Button, {
|
|
3817
|
-
children:
|
|
3821
|
+
children: stepper.isLastStep ? props.inlineForm.config.submitButtonText : props.inlineForm.config.nextButtonText,
|
|
3818
3822
|
onClick: stepper.onContinue
|
|
3819
3823
|
})
|
|
3820
3824
|
]
|
|
@@ -4052,12 +4056,14 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
4052
4056
|
});
|
|
4053
4057
|
};
|
|
4054
4058
|
const App = (props) => {
|
|
4059
|
+
const [isClient, setIsClient] = React2.useState(false);
|
|
4055
4060
|
props.locale ?? "en-US";
|
|
4056
4061
|
let { data, loading, error } = useRequest(
|
|
4057
4062
|
() => getFormConfigMock({
|
|
4058
4063
|
formId: props.formId
|
|
4059
4064
|
})
|
|
4060
4065
|
);
|
|
4066
|
+
React2.useEffect(() => setIsClient(true), []);
|
|
4061
4067
|
const inPlaceForm = React2.useMemo(() => {
|
|
4062
4068
|
if (!(data == null ? void 0 : data.inlineForm)) return null;
|
|
4063
4069
|
return React2.createElement(InPlaceForm, {
|
|
@@ -4078,6 +4084,7 @@ var SiteUtilsFeedback = (function(exports, React2, require$$02) {
|
|
|
4078
4084
|
popupForm: data.popupForm
|
|
4079
4085
|
});
|
|
4080
4086
|
}, [data == null ? void 0 : data.attributes.theme, data == null ? void 0 : data.domainId, data == null ? void 0 : data.inlineForm, props.formId]);
|
|
4087
|
+
if (!isClient) return null;
|
|
4081
4088
|
if (!data && loading) return "Loading...";
|
|
4082
4089
|
if (!data || error) return error ? error.message : "Unknown error";
|
|
4083
4090
|
return React2.createElement(ThemeProvider, {
|