@heycater/qualification-funnel 1.3.13 → 1.3.14

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
@@ -2,7 +2,7 @@ var _a;
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
4
  import React__default, { createContext, useContext, useMemo, useReducer, useCallback, useEffect, useRef, useState, isValidElement, cloneElement, Children, forwardRef } from "react";
5
- import { darken as darken$1, lighten as lighten$1, ButtonBase as ButtonBase$2, Typography as Typography$1, useMediaQuery, Input as Input$1, IconButton as IconButton$2, FormControlLabel, useTheme as useTheme$1, Tooltip, Menu, Hidden, SnackbarContent, Snackbar, TextField, CircularProgress, Modal, ThemeProvider as ThemeProvider$1, StylesProvider as StylesProvider$1, CssBaseline } from "@material-ui/core";
5
+ import { darken as darken$1, lighten as lighten$1, ButtonBase as ButtonBase$2, Typography as Typography$1, useMediaQuery, Input as Input$1, IconButton as IconButton$2, useTheme as useTheme$1, FormControlLabel, Tooltip, Menu, Hidden, SnackbarContent, Snackbar, TextField, CircularProgress, Modal, ThemeProvider as ThemeProvider$1, StylesProvider as StylesProvider$1, CssBaseline } from "@material-ui/core";
6
6
  import { useTranslation, initReactI18next, I18nextProvider } from "react-i18next";
7
7
  import styled, { css as css$1, createGlobalStyle, ThemeProvider } from "styled-components";
8
8
  import { gql, useQuery, useClient, mapExchange, Client, cacheExchange, fetchExchange, Provider } from "urql";
@@ -9683,6 +9683,7 @@ const QuantityStepperField = ({
9683
9683
  autoFocus = true
9684
9684
  }) => {
9685
9685
  const { inputRef } = useInputFocusOnMount({ shouldFocus: autoFocus });
9686
+ const muiTheme = useTheme$1();
9686
9687
  const handleChange = (nextValue) => {
9687
9688
  onChange(Number(nextValue));
9688
9689
  };
@@ -9692,6 +9693,15 @@ const QuantityStepperField = ({
9692
9693
  const onIncrement = () => {
9693
9694
  handleChange((value ?? 0) + 1);
9694
9695
  };
9696
+ const inputInlineStyle = {
9697
+ textAlign: "center",
9698
+ backgroundColor: muiTheme.palette.text.disabled,
9699
+ border: "1px solid transparent",
9700
+ borderRadius: muiTheme.spacing(1),
9701
+ height: 49,
9702
+ width: 110,
9703
+ boxSizing: "border-box"
9704
+ };
9695
9705
  return /* @__PURE__ */ jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", children: [
9696
9706
  /* @__PURE__ */ jsx(
9697
9707
  IconButtonLeft$1,
@@ -9716,7 +9726,8 @@ const QuantityStepperField = ({
9716
9726
  defaultValue,
9717
9727
  onChange: (event) => handleChange(event.target.value),
9718
9728
  value,
9719
- autoComplete: "off"
9729
+ autoComplete: "off",
9730
+ inputProps: { style: inputInlineStyle }
9720
9731
  }
9721
9732
  ),
9722
9733
  /* @__PURE__ */ jsx(
@@ -9864,47 +9875,6 @@ const StyledTypography$1 = styled(Typography)`
9864
9875
  border-bottom: 1px dotted #000;
9865
9876
  cursor: pointer;
9866
9877
  `;
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
- `;
9908
9878
  function PriceStepperField({
9909
9879
  name,
9910
9880
  min: min2,
@@ -9916,6 +9886,7 @@ function PriceStepperField({
9916
9886
  autoFocus
9917
9887
  }) {
9918
9888
  const { inputRef } = useInputFocusOnMount({ shouldFocus: !!autoFocus });
9889
+ const muiTheme = useTheme$1();
9919
9890
  const minValue = min2 || 0;
9920
9891
  const currencySymbol = useCurrencySymbol();
9921
9892
  const isInputValid = (value2) => {
@@ -9965,7 +9936,18 @@ function PriceStepperField({
9965
9936
  type: "tel",
9966
9937
  onChange: handleChange,
9967
9938
  value: Number(value),
9968
- autoComplete: "off"
9939
+ autoComplete: "off",
9940
+ inputProps: {
9941
+ style: {
9942
+ textAlign: "center",
9943
+ backgroundColor: muiTheme.palette.text.disabled,
9944
+ border: "1px solid transparent",
9945
+ borderRadius: muiTheme.spacing(1),
9946
+ height: 49,
9947
+ width: 110,
9948
+ boxSizing: "border-box"
9949
+ }
9950
+ }
9969
9951
  }
9970
9952
  ),
9971
9953
  /* @__PURE__ */ jsx(Adornment, { children: /* @__PURE__ */ jsx(Typography, { children: currencySymbol }) })
@@ -10068,19 +10050,27 @@ function BudgetQuestionWithPeopleCount() {
10068
10050
  const pricePerPersonErrors = errorsOf(pricePerPersonQuestion.id);
10069
10051
  const budgetAnswer = answerOf(totalBudgetQuestion.id);
10070
10052
  const budgetErrors = errorsOf(totalBudgetQuestion.id);
10071
- return /* @__PURE__ */ jsxs(Wrapper$3, { children: [
10072
- /* @__PURE__ */ jsx(FullRowBox, { children: /* @__PURE__ */ jsx(
10073
- TeamSizeInput,
10053
+ return /* @__PURE__ */ jsxs(Wrapper$4, { children: [
10054
+ /* @__PURE__ */ jsx(Box, { mb: 3, children: /* @__PURE__ */ jsx(Typography, { as: "label", htmlFor: questions$2.peopleCount.id, children: t2("common:questions.min_order_number") }) }),
10055
+ /* @__PURE__ */ jsx(Box, { mb: 3, children: /* @__PURE__ */ jsx(
10056
+ QuantityStepperField,
10074
10057
  {
10075
- label: t2("common:questions.min_order_number"),
10076
- questionId: questions$2.peopleCount.id,
10058
+ name: questions$2.peopleCount.id,
10059
+ id: questions$2.peopleCount.id,
10077
10060
  value: peopleCountAnswer || 0,
10078
10061
  error: !!(peopleCountErrors == null ? void 0 : peopleCountErrors.length),
10079
10062
  onChange: (value) => actions.answerQuestion(questions$2.peopleCount.id, value),
10080
- suggestions: peopleCountQuestion.suggestions,
10081
10063
  autoFocus: false
10082
10064
  }
10083
10065
  ) }),
10066
+ /* @__PURE__ */ jsx(FullRowBox, { children: /* @__PURE__ */ jsx(
10067
+ PopularValues,
10068
+ {
10069
+ questionId: questions$2.peopleCount.id,
10070
+ suggestions: peopleCountQuestion.suggestions || [],
10071
+ onSelect: (value) => actions.answerQuestion(questions$2.peopleCount.id, value)
10072
+ }
10073
+ ) }),
10084
10074
  /* @__PURE__ */ jsx(Divider$1, { my: 4 }),
10085
10075
  /* @__PURE__ */ jsx(Box, { mb: 2, children: /* @__PURE__ */ jsx(Typography, { as: "label", htmlFor: pricePerPersonQuestion.id, children: t2("common:questions.budgetProPerson") }) }),
10086
10076
  /* @__PURE__ */ jsx(Box, { mb: 2, children: /* @__PURE__ */ jsx(
@@ -10130,7 +10120,7 @@ const Divider$1 = styled(Box)`
10130
10120
  width: 100%;
10131
10121
  grid-column: 1 / 3;
10132
10122
  `;
10133
- const Wrapper$3 = styled.div`
10123
+ const Wrapper$4 = styled.div`
10134
10124
  display: flex;
10135
10125
  flex-direction: column;
10136
10126
  max-width: 441px;
@@ -10393,12 +10383,12 @@ function DatePickerLayout({
10393
10383
  if (state.status !== QUALIFICATION_STATUS.answering) {
10394
10384
  return null;
10395
10385
  }
10396
- return /* @__PURE__ */ jsxs(Wrapper$2, { $hasSidebar: hasSidebar, ...boxProps, children: [
10386
+ return /* @__PURE__ */ jsxs(Wrapper$3, { $hasSidebar: hasSidebar, ...boxProps, children: [
10397
10387
  dateSelector,
10398
10388
  sideContent
10399
10389
  ] });
10400
10390
  }
10401
- const Wrapper$2 = styled(Box)`
10391
+ const Wrapper$3 = styled(Box)`
10402
10392
  display: flex;
10403
10393
  flex-wrap: wrap;
10404
10394
  justify-content: center;
@@ -10934,7 +10924,7 @@ function DietaryDistribution() {
10934
10924
  }
10935
10925
  const peopleCountAnswer = answerOf("min_order_number");
10936
10926
  return /* @__PURE__ */ jsxs(Box, { maxWidth: "500px", width: "100%", mx: "auto", children: [
10937
- /* @__PURE__ */ jsx(Wrapper$1, { children: step.questions.map((childQuestion, index) => {
10927
+ /* @__PURE__ */ jsx(Wrapper$2, { children: step.questions.map((childQuestion, index) => {
10938
10928
  return /* @__PURE__ */ jsx(
10939
10929
  DietaryStepper,
10940
10930
  {
@@ -10947,7 +10937,7 @@ function DietaryDistribution() {
10947
10937
  /* @__PURE__ */ jsx(DietaryTotal, { count: peopleCountAnswer || 0 })
10948
10938
  ] });
10949
10939
  }
10950
- const Wrapper$1 = styled.div`
10940
+ const Wrapper$2 = styled.div`
10951
10941
  display: flex;
10952
10942
  flex-direction: column;
10953
10943
  `;
@@ -11471,6 +11461,47 @@ const IconWrapper$1 = styled(Box)`
11471
11461
  function createIconEntry(id, Icon, translationKey) {
11472
11462
  return { id, Icon, translationKey: translationKey || `common:cities.${id}` };
11473
11463
  }
11464
+ const TeamSizeInput = ({
11465
+ label,
11466
+ questionId,
11467
+ value,
11468
+ onChange,
11469
+ placeholder,
11470
+ error,
11471
+ suggestions,
11472
+ autoFocus
11473
+ }) => {
11474
+ return /* @__PURE__ */ jsxs(Wrapper$1, { children: [
11475
+ /* @__PURE__ */ jsx(Box, { mb: 3, children: /* @__PURE__ */ jsx(Typography, { as: "label", htmlFor: questionId, children: label }) }),
11476
+ /* @__PURE__ */ jsx(Box, { mb: (suggestions == null ? void 0 : suggestions.length) ? 3 : 0, children: /* @__PURE__ */ jsx(
11477
+ QuantityStepperField,
11478
+ {
11479
+ id: questionId,
11480
+ name: questionId,
11481
+ value,
11482
+ error,
11483
+ onChange: (val) => onChange(Number(val)),
11484
+ placeholder,
11485
+ autoFocus
11486
+ }
11487
+ ) }),
11488
+ (suggestions == null ? void 0 : suggestions.length) ? /* @__PURE__ */ jsx(
11489
+ PopularValues,
11490
+ {
11491
+ questionId,
11492
+ suggestions,
11493
+ onSelect: onChange
11494
+ }
11495
+ ) : null
11496
+ ] });
11497
+ };
11498
+ const Wrapper$1 = styled.div`
11499
+ display: flex;
11500
+ flex-direction: column;
11501
+ align-items: center;
11502
+ max-width: 441px;
11503
+ margin: 0 auto;
11504
+ `;
11474
11505
  const MAX_WIDTH_OF_WHITE_WRAPPER = 826;
11475
11506
  const defaultStepTitleMapping = {
11476
11507
  service_selection: "qualification:embeddedFunnel.serviceSelection.title",
@@ -11495,7 +11526,7 @@ const EmbeddedQuestion = ({
11495
11526
  LayoutComponent = EmbeddedQuestionLayout,
11496
11527
  mode = "embedded"
11497
11528
  }) => {
11498
- var _a2, _b, _c, _d;
11529
+ var _a2, _b, _c, _d, _e;
11499
11530
  const { t: t2 } = useTranslation();
11500
11531
  const { state, actions, answerOf } = useQualification();
11501
11532
  const selectedMenu = "qualification" in state ? state.qualification.selectedMenu : null;
@@ -11625,7 +11656,7 @@ const EmbeddedQuestion = ({
11625
11656
  content: /* @__PURE__ */ jsx(Container, { size: MAX_WIDTH_OF_WHITE_WRAPPER, children: /* @__PURE__ */ jsx(WhiteWrapper, { children: /* @__PURE__ */ jsx(Box, { py: 4, children: /* @__PURE__ */ jsx(
11626
11657
  TeamSizeInput,
11627
11658
  {
11628
- label: t2("qualification:embeddedFunnel.teamSize.label", teamSizeQuestion.content.titleDe),
11659
+ label: t2("qualification:embeddedFunnel.teamSize.label", (_e = teamSizeQuestion.content) == null ? void 0 : _e.titleDe),
11629
11660
  questionId: teamSizeQuestion.id,
11630
11661
  value: answerOf("team_size"),
11631
11662
  onChange: (value) => actions.answerQuestion("team_size", value),
@@ -14740,17 +14771,12 @@ function requireReactIs_development() {
14740
14771
  }
14741
14772
  return reactIs_development;
14742
14773
  }
14743
- var hasRequiredReactIs;
14744
- function requireReactIs() {
14745
- if (hasRequiredReactIs) return reactIs$1.exports;
14746
- hasRequiredReactIs = 1;
14747
- if (process.env.NODE_ENV === "production") {
14748
- reactIs$1.exports = requireReactIs_production_min();
14749
- } else {
14750
- reactIs$1.exports = requireReactIs_development();
14751
- }
14752
- return reactIs$1.exports;
14774
+ if (process.env.NODE_ENV === "production") {
14775
+ reactIs$1.exports = requireReactIs_production_min();
14776
+ } else {
14777
+ reactIs$1.exports = requireReactIs_development();
14753
14778
  }
14779
+ var reactIsExports = reactIs$1.exports;
14754
14780
  /*
14755
14781
  object-assign
14756
14782
  (c) Sindre Sorhus
@@ -14911,7 +14937,7 @@ var hasRequiredFactoryWithTypeCheckers;
14911
14937
  function requireFactoryWithTypeCheckers() {
14912
14938
  if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
14913
14939
  hasRequiredFactoryWithTypeCheckers = 1;
14914
- var ReactIs = requireReactIs();
14940
+ var ReactIs = reactIsExports;
14915
14941
  var assign2 = requireObjectAssign();
14916
14942
  var ReactPropTypesSecret = requireReactPropTypesSecret();
14917
14943
  var has2 = requireHas();
@@ -15404,7 +15430,7 @@ function requireFactoryWithThrowingShims() {
15404
15430
  return factoryWithThrowingShims;
15405
15431
  }
15406
15432
  if (process.env.NODE_ENV !== "production") {
15407
- var ReactIs = requireReactIs();
15433
+ var ReactIs = reactIsExports;
15408
15434
  var throwOnDirectAccess = true;
15409
15435
  propTypes.exports = requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
15410
15436
  } else {
@@ -15499,7 +15525,6 @@ function formatMuiErrorMessage(code) {
15499
15525
  }
15500
15526
  return "Minified Material-UI error #" + code + "; visit " + url + " for the full message.";
15501
15527
  }
15502
- var reactIsExports = requireReactIs();
15503
15528
  var fnNameMatchRegex = /^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;
15504
15529
  function getFunctionName(fn) {
15505
15530
  var match2 = "".concat(fn).match(fnNameMatchRegex);
@@ -18994,7 +19019,7 @@ function makeStyles(stylesOrCreator) {
18994
19019
  };
18995
19020
  return useStyles;
18996
19021
  }
18997
- var reactIs = requireReactIs();
19022
+ var reactIs = reactIsExports;
18998
19023
  var REACT_STATICS = {
18999
19024
  childContextTypes: true,
19000
19025
  contextType: true,