@heycater/qualification-funnel 1.3.12 → 1.3.13

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/index.esm.js CHANGED
@@ -7077,7 +7077,29 @@ const teamSizeQuestion = Object.freeze(
7077
7077
  titleDe: "Wie viele Mitarbeitende sind ca. regelmäßig vor Ort?",
7078
7078
  placeholderEn: "Number of employees",
7079
7079
  placeholderDe: "Anzahl der Mitarbeiter"
7080
- }
7080
+ },
7081
+ suggestions: [
7082
+ {
7083
+ labelEn: "10 People",
7084
+ labelDe: "10 Personen",
7085
+ value: 10
7086
+ },
7087
+ {
7088
+ labelEn: "25 People",
7089
+ labelDe: "25 Personen",
7090
+ value: 25
7091
+ },
7092
+ {
7093
+ labelEn: "50 People",
7094
+ labelDe: "50 Personen",
7095
+ value: 50
7096
+ },
7097
+ {
7098
+ labelEn: "100 People",
7099
+ labelDe: "100 Personen",
7100
+ value: 100
7101
+ }
7102
+ ]
7081
7103
  })
7082
7104
  );
7083
7105
  const questions$2 = {
@@ -9774,24 +9796,6 @@ const IconButtonRight$1 = styled(StepperIconButton$1)`
9774
9796
  const IconButtonLeft$1 = styled(StepperIconButton$1)`
9775
9797
  margin-right: ${(props) => props.theme.spacing(2)}px;
9776
9798
  `;
9777
- function PeopleCountStepper() {
9778
- const { actions, state, answerOf, errorsOf } = useQualification();
9779
- if (state.status !== QUALIFICATION_STATUS.answering) {
9780
- return null;
9781
- }
9782
- const answer = answerOf(questions$2.peopleCount.id);
9783
- const errors = errorsOf(questions$2.peopleCount.id);
9784
- return /* @__PURE__ */ jsx(
9785
- QuantityStepperField,
9786
- {
9787
- name: questions$2.peopleCount.id,
9788
- id: questions$2.peopleCount.id,
9789
- value: answer || 0,
9790
- error: !!(errors == null ? void 0 : errors.length),
9791
- onChange: (value) => actions.answerQuestion(questions$2.peopleCount.id, value)
9792
- }
9793
- );
9794
- }
9795
9799
  const localeConfig = {
9796
9800
  locales: ["en", "de"],
9797
9801
  defaultLocale: "de"
@@ -9823,18 +9827,14 @@ function useLocalizedFieldName() {
9823
9827
  localizedAttributeName
9824
9828
  };
9825
9829
  }
9826
- function PopularValues() {
9827
- const { actions } = useQualification();
9830
+ function PopularValues({ questionId, suggestions, onSelect }) {
9828
9831
  const { localizedAttributeName } = useLocalizedFieldName();
9829
9832
  const localizedOptions = useMemo(
9830
- () => {
9831
- var _a2;
9832
- return (_a2 = peopleCountQuestion.suggestions) == null ? void 0 : _a2.map((option) => ({
9833
- value: option.value,
9834
- label: option[localizedAttributeName("label")]
9835
- }));
9836
- },
9837
- [localizedAttributeName]
9833
+ () => suggestions.map((option) => ({
9834
+ value: option.value,
9835
+ label: option[localizedAttributeName("label")]
9836
+ })),
9837
+ [localizedAttributeName, suggestions]
9838
9838
  ) || [];
9839
9839
  return /* @__PURE__ */ jsx(
9840
9840
  FlexBox,
@@ -9843,11 +9843,11 @@ function PopularValues() {
9843
9843
  flexDirection: "row",
9844
9844
  alignItems: "center",
9845
9845
  justifyContent: "center",
9846
- id: peopleCountQuestion.id,
9846
+ id: questionId,
9847
9847
  children: localizedOptions.map((option, index) => /* @__PURE__ */ jsx(
9848
9848
  Box,
9849
9849
  {
9850
- onClick: () => actions.answerQuestion(peopleCountQuestion.id, option.value),
9850
+ onClick: () => onSelect(option.value),
9851
9851
  children: /* @__PURE__ */ jsx(StyledTypography$1, { variant: "caption", children: option.label })
9852
9852
  },
9853
9853
  `${option.value}::${index}`
@@ -9864,6 +9864,47 @@ const StyledTypography$1 = styled(Typography)`
9864
9864
  border-bottom: 1px dotted #000;
9865
9865
  cursor: pointer;
9866
9866
  `;
9867
+ const TeamSizeInput = ({
9868
+ label,
9869
+ questionId,
9870
+ value,
9871
+ onChange,
9872
+ placeholder,
9873
+ error,
9874
+ suggestions,
9875
+ autoFocus
9876
+ }) => {
9877
+ return /* @__PURE__ */ jsxs(Wrapper$4, { children: [
9878
+ /* @__PURE__ */ jsx(Box, { mb: 3, children: /* @__PURE__ */ jsx(Typography, { as: "label", htmlFor: questionId, children: label }) }),
9879
+ /* @__PURE__ */ jsx(Box, { mb: (suggestions == null ? void 0 : suggestions.length) ? 3 : 0, children: /* @__PURE__ */ jsx(
9880
+ QuantityStepperField,
9881
+ {
9882
+ id: questionId,
9883
+ name: questionId,
9884
+ value,
9885
+ error,
9886
+ onChange: (val) => onChange(Number(val)),
9887
+ placeholder,
9888
+ autoFocus
9889
+ }
9890
+ ) }),
9891
+ (suggestions == null ? void 0 : suggestions.length) ? /* @__PURE__ */ jsx(
9892
+ PopularValues,
9893
+ {
9894
+ questionId,
9895
+ suggestions,
9896
+ onSelect: onChange
9897
+ }
9898
+ ) : null
9899
+ ] });
9900
+ };
9901
+ const Wrapper$4 = styled.div`
9902
+ display: flex;
9903
+ flex-direction: column;
9904
+ align-items: center;
9905
+ max-width: 441px;
9906
+ margin: 0 auto;
9907
+ `;
9867
9908
  function PriceStepperField({
9868
9909
  name,
9869
9910
  min: min2,
@@ -10021,14 +10062,25 @@ function BudgetQuestionWithPeopleCount() {
10021
10062
  const { t: t2 } = useTranslation();
10022
10063
  const { currentUserAccount } = useCurrentUser();
10023
10064
  const isManagedAccount = (_b = (_a2 = currentUserAccount == null ? void 0 : currentUserAccount.owner) == null ? void 0 : _a2.salesforceCustomer) == null ? void 0 : _b.isManagedAccount;
10065
+ const peopleCountAnswer = answerOf(questions$2.peopleCount.id);
10066
+ const peopleCountErrors = errorsOf(questions$2.peopleCount.id);
10024
10067
  const pricePerPersonAnswer = answerOf(pricePerPersonQuestion.id);
10025
10068
  const pricePerPersonErrors = errorsOf(pricePerPersonQuestion.id);
10026
10069
  const budgetAnswer = answerOf(totalBudgetQuestion.id);
10027
10070
  const budgetErrors = errorsOf(totalBudgetQuestion.id);
10028
- return /* @__PURE__ */ jsxs(Wrapper$4, { children: [
10029
- /* @__PURE__ */ jsx(Box, { mb: 3, children: /* @__PURE__ */ jsx(Typography, { as: "label", htmlFor: questions$2.peopleCount.id, children: t2("common:questions.min_order_number") }) }),
10030
- /* @__PURE__ */ jsx(Box, { mb: 3, children: /* @__PURE__ */ jsx(PeopleCountStepper, {}) }),
10031
- /* @__PURE__ */ jsx(FullRowBox, { children: /* @__PURE__ */ jsx(PopularValues, {}) }),
10071
+ return /* @__PURE__ */ jsxs(Wrapper$3, { children: [
10072
+ /* @__PURE__ */ jsx(FullRowBox, { children: /* @__PURE__ */ jsx(
10073
+ TeamSizeInput,
10074
+ {
10075
+ label: t2("common:questions.min_order_number"),
10076
+ questionId: questions$2.peopleCount.id,
10077
+ value: peopleCountAnswer || 0,
10078
+ error: !!(peopleCountErrors == null ? void 0 : peopleCountErrors.length),
10079
+ onChange: (value) => actions.answerQuestion(questions$2.peopleCount.id, value),
10080
+ suggestions: peopleCountQuestion.suggestions,
10081
+ autoFocus: false
10082
+ }
10083
+ ) }),
10032
10084
  /* @__PURE__ */ jsx(Divider$1, { my: 4 }),
10033
10085
  /* @__PURE__ */ jsx(Box, { mb: 2, children: /* @__PURE__ */ jsx(Typography, { as: "label", htmlFor: pricePerPersonQuestion.id, children: t2("common:questions.budgetProPerson") }) }),
10034
10086
  /* @__PURE__ */ jsx(Box, { mb: 2, children: /* @__PURE__ */ jsx(
@@ -10078,7 +10130,7 @@ const Divider$1 = styled(Box)`
10078
10130
  width: 100%;
10079
10131
  grid-column: 1 / 3;
10080
10132
  `;
10081
- const Wrapper$4 = styled.div`
10133
+ const Wrapper$3 = styled.div`
10082
10134
  display: flex;
10083
10135
  flex-direction: column;
10084
10136
  max-width: 441px;
@@ -10341,12 +10393,12 @@ function DatePickerLayout({
10341
10393
  if (state.status !== QUALIFICATION_STATUS.answering) {
10342
10394
  return null;
10343
10395
  }
10344
- return /* @__PURE__ */ jsxs(Wrapper$3, { $hasSidebar: hasSidebar, ...boxProps, children: [
10396
+ return /* @__PURE__ */ jsxs(Wrapper$2, { $hasSidebar: hasSidebar, ...boxProps, children: [
10345
10397
  dateSelector,
10346
10398
  sideContent
10347
10399
  ] });
10348
10400
  }
10349
- const Wrapper$3 = styled(Box)`
10401
+ const Wrapper$2 = styled(Box)`
10350
10402
  display: flex;
10351
10403
  flex-wrap: wrap;
10352
10404
  justify-content: center;
@@ -10882,7 +10934,7 @@ function DietaryDistribution() {
10882
10934
  }
10883
10935
  const peopleCountAnswer = answerOf("min_order_number");
10884
10936
  return /* @__PURE__ */ jsxs(Box, { maxWidth: "500px", width: "100%", mx: "auto", children: [
10885
- /* @__PURE__ */ jsx(Wrapper$2, { children: step.questions.map((childQuestion, index) => {
10937
+ /* @__PURE__ */ jsx(Wrapper$1, { children: step.questions.map((childQuestion, index) => {
10886
10938
  return /* @__PURE__ */ jsx(
10887
10939
  DietaryStepper,
10888
10940
  {
@@ -10895,7 +10947,7 @@ function DietaryDistribution() {
10895
10947
  /* @__PURE__ */ jsx(DietaryTotal, { count: peopleCountAnswer || 0 })
10896
10948
  ] });
10897
10949
  }
10898
- const Wrapper$2 = styled.div`
10950
+ const Wrapper$1 = styled.div`
10899
10951
  display: flex;
10900
10952
  flex-direction: column;
10901
10953
  `;
@@ -11419,27 +11471,6 @@ const IconWrapper$1 = styled(Box)`
11419
11471
  function createIconEntry(id, Icon, translationKey) {
11420
11472
  return { id, Icon, translationKey: translationKey || `common:cities.${id}` };
11421
11473
  }
11422
- const TeamSizeInput = ({ value, onChange, placeholder }) => {
11423
- return /* @__PURE__ */ jsx(Wrapper$1, { children: /* @__PURE__ */ jsx(
11424
- QuantityStepperField,
11425
- {
11426
- id: "team-size",
11427
- name: "team_size",
11428
- value,
11429
- onChange: (val) => onChange(Number(val)),
11430
- placeholder
11431
- }
11432
- ) });
11433
- };
11434
- const Wrapper$1 = styled(Box)`
11435
- display: flex;
11436
- justify-content: center;
11437
- padding: ${({ theme }) => theme.spacing(2)}px;
11438
- background: white;
11439
- border-radius: 8px;
11440
- max-width: 300px;
11441
- margin: 0 auto;
11442
- `;
11443
11474
  const MAX_WIDTH_OF_WHITE_WRAPPER = 826;
11444
11475
  const defaultStepTitleMapping = {
11445
11476
  service_selection: "qualification:embeddedFunnel.serviceSelection.title",
@@ -11594,9 +11625,12 @@ const EmbeddedQuestion = ({
11594
11625
  content: /* @__PURE__ */ jsx(Container, { size: MAX_WIDTH_OF_WHITE_WRAPPER, children: /* @__PURE__ */ jsx(WhiteWrapper, { children: /* @__PURE__ */ jsx(Box, { py: 4, children: /* @__PURE__ */ jsx(
11595
11626
  TeamSizeInput,
11596
11627
  {
11628
+ label: t2("qualification:embeddedFunnel.teamSize.label", teamSizeQuestion.content.titleDe),
11629
+ questionId: teamSizeQuestion.id,
11597
11630
  value: answerOf("team_size"),
11598
11631
  onChange: (value) => actions.answerQuestion("team_size", value),
11599
- placeholder: t2("qualification:embeddedFunnel.teamSize.placeholder")
11632
+ placeholder: t2("qualification:embeddedFunnel.teamSize.placeholder"),
11633
+ suggestions: teamSizeQuestion.suggestions
11600
11634
  }
11601
11635
  ) }) }) }),
11602
11636
  side: selectedMenu && /* @__PURE__ */ jsx(SelectedMenuCard, { ...selectedMenu })
@@ -11636,9 +11670,12 @@ const EmbeddedQuestion = ({
11636
11670
  content: /* @__PURE__ */ jsx(Container, { size: MAX_WIDTH_OF_WHITE_WRAPPER, children: /* @__PURE__ */ jsx(WhiteWrapper, { children: /* @__PURE__ */ jsx(Box, { py: 4, children: /* @__PURE__ */ jsx(
11637
11671
  TeamSizeInput,
11638
11672
  {
11673
+ label: t2("common:questions.min_order_number"),
11674
+ questionId: peopleCountFullServiceQuestion.id,
11639
11675
  value: answerOf("min_order_number"),
11640
11676
  onChange: (value) => actions.answerQuestion("min_order_number", value),
11641
- placeholder: t2("qualification:embeddedFunnel.peopleCount.placeholder")
11677
+ placeholder: t2("qualification:embeddedFunnel.peopleCount.placeholder"),
11678
+ suggestions: peopleCountFullServiceQuestion.suggestions
11642
11679
  }
11643
11680
  ) }) }) }),
11644
11681
  side: selectedMenu && /* @__PURE__ */ jsx(SelectedMenuCard, { ...selectedMenu })