@heycater/qualification-funnel 1.19.6 → 1.19.7

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.
@@ -595,7 +595,7 @@
595
595
  margin-left: ${e=>e.theme.spacing(2)}px;
596
596
  `,VM=_p(BM)`
597
597
  margin-right: ${e=>e.theme.spacing(2)}px;
598
- `,UM={locales:["en","de"],defaultLocale:"de"},WM=e=>t=>{const n=t=>`${t}_${UM.locales.includes(e)?e:UM.defaultLocale}`;if(t.includes(".")){const[e,r]=t.split(".");return`${e}.${n(r)}`}return n(t)};function HM(){const e=_E();var t;return{localizedFieldAlgolia:WM(e.locale),localizedAttributeName:(t=e.locale,e=>UM.locales.includes(t)?`${e}${CS(t)}`:`${e}${CS(UM.defaultLocale)}`)}}function ZM({questionId:e,suggestions:t,onSelect:n}){const{localizedAttributeName:r}=HM(),o=g.useMemo(()=>t.map(e=>({value:e.value,label:e[r("label")]})),[r,t])||[];return C.jsx(KM,{flexWrap:"wrap",flexDirection:"row",alignItems:"center",justifyContent:"center",id:e,children:o.map((e,t)=>C.jsx(Fm,{onClick:()=>n(e.value),children:C.jsx(YM,{variant:"caption",children:e.label})},`${e.value}::${t}`))})}const KM=_p(Fm)`
598
+ `,UM={locales:["en","de"],defaultLocale:"de"},WM=e=>t=>{const n=t=>{let n;return n="string"==typeof e&&e.startsWith("en")?"en":UM.locales.includes(e)?e:UM.defaultLocale,`${t}_${n}`};if(t.includes(".")){const[e,r]=t.split(".");return`${e}.${n(r)}`}return n(t)};function HM(){const e=_E();var t;return{localizedFieldAlgolia:WM(e.locale),localizedAttributeName:(t=e.locale,e=>(null==t?void 0:t.startsWith("en"))?`${e}En`:UM.locales.includes(t)?`${e}${CS(t)}`:`${e}${CS(UM.defaultLocale)}`)}}function ZM({questionId:e,suggestions:t,onSelect:n}){const{localizedAttributeName:r}=HM(),o=g.useMemo(()=>t.map(e=>({value:e.value,label:e[r("label")]})),[r,t])||[];return C.jsx(KM,{flexWrap:"wrap",flexDirection:"row",alignItems:"center",justifyContent:"center",id:e,children:o.map((e,t)=>C.jsx(Fm,{onClick:()=>n(e.value),children:C.jsx(YM,{variant:"caption",children:e.label})},`${e.value}::${t}`))})}const KM=_p(Fm)`
599
599
  display: flex;
600
600
  gap: ${({theme:e})=>e.spacing(1.5)}px;
601
601
  justify-content: space-around;
package/dist/index.cjs.js CHANGED
@@ -444,7 +444,7 @@
444
444
  margin-left: ${e=>e.theme.spacing(2)}px;
445
445
  `,gp=o(hp)`
446
446
  margin-right: ${e=>e.theme.spacing(2)}px;
447
- `,yp={locales:["en","de"],defaultLocale:"de"},vp=e=>t=>{const n=t=>`${t}_${yp.locales.includes(e)?e:yp.defaultLocale}`;if(t.includes(".")){const[e,r]=t.split(".");return`${e}.${n(r)}`}return n(t)};function bp(){const e=du();var t;return{localizedFieldAlgolia:vp(e.locale),localizedAttributeName:(t=e.locale,e=>yp.locales.includes(t)?`${e}${Rl(t)}`:`${e}${Rl(yp.defaultLocale)}`)}}function Cp({questionId:e,suggestions:r,onSelect:i}){const{localizedAttributeName:o}=bp(),a=n.useMemo(()=>r.map(e=>({value:e.value,label:e[o("label")]})),[o,r])||[];return t.jsx(xp,{flexWrap:"wrap",flexDirection:"row",alignItems:"center",justifyContent:"center",id:e,children:a.map((e,n)=>t.jsx(v,{onClick:()=>i(e.value),children:t.jsx(wp,{variant:"caption",children:e.label})},`${e.value}::${n}`))})}const xp=o(v)`
447
+ `,yp={locales:["en","de"],defaultLocale:"de"},vp=e=>t=>{const n=t=>{let n;return n="string"==typeof e&&e.startsWith("en")?"en":yp.locales.includes(e)?e:yp.defaultLocale,`${t}_${n}`};if(t.includes(".")){const[e,r]=t.split(".");return`${e}.${n(r)}`}return n(t)};function bp(){const e=du();var t;return{localizedFieldAlgolia:vp(e.locale),localizedAttributeName:(t=e.locale,e=>(null==t?void 0:t.startsWith("en"))?`${e}En`:yp.locales.includes(t)?`${e}${Rl(t)}`:`${e}${Rl(yp.defaultLocale)}`)}}function Cp({questionId:e,suggestions:r,onSelect:i}){const{localizedAttributeName:o}=bp(),a=n.useMemo(()=>r.map(e=>({value:e.value,label:e[o("label")]})),[o,r])||[];return t.jsx(xp,{flexWrap:"wrap",flexDirection:"row",alignItems:"center",justifyContent:"center",id:e,children:a.map((e,n)=>t.jsx(v,{onClick:()=>i(e.value),children:t.jsx(wp,{variant:"caption",children:e.label})},`${e.value}::${n}`))})}const xp=o(v)`
448
448
  display: flex;
449
449
  gap: ${({theme:e})=>e.spacing(1.5)}px;
450
450
  justify-content: space-around;
package/dist/index.esm.js CHANGED
@@ -9886,9 +9886,14 @@ const localeConfig = {
9886
9886
  };
9887
9887
  const algoliaAttributeNameForLocale = (locale2) => (name) => {
9888
9888
  const toLocalizedAlgoliaKey = (name2) => {
9889
- const parsedLocale = localeConfig.locales.includes(
9890
- locale2
9891
- ) ? locale2 : localeConfig.defaultLocale;
9889
+ let parsedLocale;
9890
+ if (typeof locale2 === "string" && locale2.startsWith("en")) {
9891
+ parsedLocale = "en";
9892
+ } else if (localeConfig.locales.includes(locale2)) {
9893
+ parsedLocale = locale2;
9894
+ } else {
9895
+ parsedLocale = localeConfig.defaultLocale;
9896
+ }
9892
9897
  return `${name2}_${parsedLocale}`;
9893
9898
  };
9894
9899
  if (name.includes(".")) {
@@ -9898,6 +9903,9 @@ const algoliaAttributeNameForLocale = (locale2) => (name) => {
9898
9903
  return toLocalizedAlgoliaKey(name);
9899
9904
  };
9900
9905
  const attributeNameForLocale = (locale2) => (name) => {
9906
+ if (locale2 == null ? void 0 : locale2.startsWith("en")) {
9907
+ return `${name}En`;
9908
+ }
9901
9909
  if (!localeConfig.locales.includes(locale2))
9902
9910
  return `${name}${capitalize$3(localeConfig.defaultLocale)}`;
9903
9911
  return `${name}${capitalize$3(locale2)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heycater/qualification-funnel",
3
- "version": "1.19.6",
3
+ "version": "1.19.7",
4
4
  "type": "module",
5
5
  "description": "Heycater embedded qualification funnel widget",
6
6
  "main": "dist/index.cjs.js",