@heycater/qualification-funnel 1.19.10 → 1.19.11

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
@@ -4273,11 +4273,7 @@ const useIsGb = () => {
4273
4273
  };
4274
4274
  const getIsGb = (query) => {
4275
4275
  if (typeof window !== "undefined") {
4276
- const pathname = window.location.pathname.toLowerCase();
4277
- if (pathname.includes("london")) {
4278
- return true;
4279
- }
4280
- if (pathname.includes("en-uk")) {
4276
+ if (window.location.pathname.toLowerCase().includes("london")) {
4281
4277
  return true;
4282
4278
  }
4283
4279
  }
@@ -9265,8 +9261,6 @@ function getPillValue({
9265
9261
  answers.price_per_person,
9266
9262
  answers.min_order_number
9267
9263
  ];
9268
- const isGb = getIsGb();
9269
- const currency = getCurrencySymbol(isGb);
9270
9264
  return [
9271
9265
  {
9272
9266
  stepId,
@@ -9278,8 +9272,7 @@ function getPillValue({
9278
9272
  questionId: "price_per_person",
9279
9273
  text: t2("qualification:selection.budget", {
9280
9274
  perPerson: pricePerPerson,
9281
- total: total2,
9282
- currency
9275
+ total: total2
9283
9276
  })
9284
9277
  }
9285
9278
  ];
@@ -9889,14 +9882,9 @@ const localeConfig = {
9889
9882
  };
9890
9883
  const algoliaAttributeNameForLocale = (locale2) => (name) => {
9891
9884
  const toLocalizedAlgoliaKey = (name2) => {
9892
- let parsedLocale;
9893
- if (typeof locale2 === "string" && locale2.startsWith("en")) {
9894
- parsedLocale = "en";
9895
- } else if (localeConfig.locales.includes(locale2)) {
9896
- parsedLocale = locale2;
9897
- } else {
9898
- parsedLocale = localeConfig.defaultLocale;
9899
- }
9885
+ const parsedLocale = localeConfig.locales.includes(
9886
+ locale2
9887
+ ) ? locale2 : localeConfig.defaultLocale;
9900
9888
  return `${name2}_${parsedLocale}`;
9901
9889
  };
9902
9890
  if (name.includes(".")) {
@@ -9906,9 +9894,6 @@ const algoliaAttributeNameForLocale = (locale2) => (name) => {
9906
9894
  return toLocalizedAlgoliaKey(name);
9907
9895
  };
9908
9896
  const attributeNameForLocale = (locale2) => (name) => {
9909
- if (locale2 == null ? void 0 : locale2.startsWith("en")) {
9910
- return `${name}En`;
9911
- }
9912
9897
  if (!localeConfig.locales.includes(locale2))
9913
9898
  return `${name}${capitalize$3(localeConfig.defaultLocale)}`;
9914
9899
  return `${name}${capitalize$3(locale2)}`;
@@ -10860,7 +10845,7 @@ const SwitchesWrapper = styled.div`
10860
10845
  `;
10861
10846
  const defaultLeadTimeInDays = DEFAULT_LEAD_DAYS;
10862
10847
  function DatePickerEmbedded() {
10863
- var _a2, _b, _c;
10848
+ var _a2, _b;
10864
10849
  const router = useRouter();
10865
10850
  const { answerOf, actions, state } = useQualification();
10866
10851
  const { trackAnswer } = useTracking();
@@ -10874,7 +10859,7 @@ function DatePickerEmbedded() {
10874
10859
  answers: state.qualification.answers,
10875
10860
  selectedCaterer: state.qualification.selectedCaterer
10876
10861
  }) : null;
10877
- const minDateMessage = ((_a2 = router.locale) == null ? void 0 : _a2.startsWith("en")) ? (_b = attributes == null ? void 0 : attributes.minDate) == null ? void 0 : _b.messageEn : (_c = attributes == null ? void 0 : attributes.minDate) == null ? void 0 : _c.messageDe;
10862
+ const minDateMessage = router.locale === "en" ? (_a2 = attributes == null ? void 0 : attributes.minDate) == null ? void 0 : _a2.messageEn : (_b = attributes == null ? void 0 : attributes.minDate) == null ? void 0 : _b.messageDe;
10878
10863
  const [isRecurringNeedSelected] = useState(
10879
10864
  !!answerOf(isRecurringQuestion.id)
10880
10865
  );
@@ -11880,7 +11865,7 @@ const EmbeddedQuestion = ({
11880
11865
  content: /* @__PURE__ */ jsx(Container, { size: MAX_WIDTH_OF_WHITE_WRAPPER, children: /* @__PURE__ */ jsx(WhiteWrapper, { children: /* @__PURE__ */ jsx(Box, { py: 4, children: /* @__PURE__ */ jsx(
11881
11866
  TeamSizeInput,
11882
11867
  {
11883
- label: t2("qualification:embeddedFunnel.teamSize.label", (_e = teamSizeQuestion.content) == null ? void 0 : _e.titleEn),
11868
+ label: t2("qualification:embeddedFunnel.teamSize.label", (_e = teamSizeQuestion.content) == null ? void 0 : _e.titleDe),
11884
11869
  questionId: teamSizeQuestion.id,
11885
11870
  value: answerOf("team_size"),
11886
11871
  onChange: (value) => actions.answerQuestion("team_size", value),
@@ -28432,7 +28417,7 @@ const selection$1 = {
28432
28417
  vegan: "{{ amount }} Veganer",
28433
28418
  vegetarian: "{{ amount }} Vegetarier",
28434
28419
  carnivore: "{{ amount }} Fleischesser",
28435
- budget: "{{ perPerson }}{{currency}} p.P. / {{ total }}{{currency}} Gesamtbudget"
28420
+ budget: "{{ perPerson }} p.P. / {{ total }} Gesamtbudget"
28436
28421
  };
28437
28422
  const diet$1 = {
28438
28423
  pax: "Personenzahl:"
@@ -28895,7 +28880,7 @@ const questions = {
28895
28880
  lead_type: "request type",
28896
28881
  min_order_number: "Number of people",
28897
28882
  budget: "budget",
28898
- budgetProPerson: "Budget per person",
28883
+ budgetProPerson: "Budget pro Person",
28899
28884
  totalBudget: "Total Budget",
28900
28885
  services: "services"
28901
28886
  };
@@ -29624,7 +29609,7 @@ const selection = {
29624
29609
  vegan: "{{ amount }} Vegans",
29625
29610
  vegetarian: "{{ amount }} Vegetarians",
29626
29611
  carnivore: "{{ amount }} Carnivores",
29627
- budget: "{{currency}}{{ perPerson }} pp / {{currency}}{{ total }} Total Budget"
29612
+ budget: "{{ perPerson }} p.P. / {{ total }} Total Budget"
29628
29613
  };
29629
29614
  const diet = {
29630
29615
  pax: "Number of people:"
@@ -30723,6 +30708,7 @@ function QualificationFunnel({
30723
30708
  }) {
30724
30709
  const [ratings, setRatings] = useState(null);
30725
30710
  const [initialized, setInitialized] = useState(false);
30711
+ const [isGb, setIsGb] = useState(() => getIsGb());
30726
30712
  useEffect(() => {
30727
30713
  setAssetsBaseUrl(assetBaseUrl);
30728
30714
  initConfig({
@@ -30732,6 +30718,27 @@ function QualificationFunnel({
30732
30718
  });
30733
30719
  setInitialized(true);
30734
30720
  }, [apiEndpoint, googleMapsApiKey, locale2, assetBaseUrl]);
30721
+ useEffect(() => {
30722
+ const handleUrlChange = () => {
30723
+ setIsGb(getIsGb());
30724
+ };
30725
+ window.addEventListener("popstate", handleUrlChange);
30726
+ const originalPushState = history.pushState.bind(history);
30727
+ const originalReplaceState = history.replaceState.bind(history);
30728
+ history.pushState = (...args) => {
30729
+ originalPushState(...args);
30730
+ handleUrlChange();
30731
+ };
30732
+ history.replaceState = (...args) => {
30733
+ originalReplaceState(...args);
30734
+ handleUrlChange();
30735
+ };
30736
+ return () => {
30737
+ window.removeEventListener("popstate", handleUrlChange);
30738
+ history.pushState = originalPushState;
30739
+ history.replaceState = originalReplaceState;
30740
+ };
30741
+ }, []);
30735
30742
  useEffect(() => {
30736
30743
  if (initialized) {
30737
30744
  fetchRatings().then(setRatings).catch(console.error);
@@ -30749,7 +30756,7 @@ function QualificationFunnel({
30749
30756
  QualificationProvider,
30750
30757
  {
30751
30758
  initialized: true,
30752
- storageKey,
30759
+ storageKey: isGb ? `${storageKey}-gb` : storageKey,
30753
30760
  storage: "sessionStorage",
30754
30761
  children: /* @__PURE__ */ jsx(
30755
30762
  EmbeddedFunnel,
@@ -30761,7 +30768,8 @@ function QualificationFunnel({
30761
30768
  onCancel
30762
30769
  }
30763
30770
  )
30764
- }
30771
+ },
30772
+ isGb ? "gb" : "de"
30765
30773
  )
30766
30774
  ] }) }) }) }) }) });
30767
30775
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycater/qualification-funnel",
3
- "version": "1.19.10",
3
+ "version": "1.19.11",
4
4
  "type": "module",
5
5
  "description": "Heycater embedded qualification funnel widget",
6
6
  "main": "dist/index.cjs.js",