@coveo/atomic-react 3.11.46 → 3.11.47

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.
@@ -9836,7 +9836,7 @@ function getWindow() {
9836
9836
  }
9837
9837
  function getAtomicEnvironment(headlessVersion) {
9838
9838
  return {
9839
- version: "3.62.0",
9839
+ version: "3.63.0",
9840
9840
  headlessVersion
9841
9841
  };
9842
9842
  }
@@ -9860,20 +9860,20 @@ function augmentAnalyticsConfigWithAtomicVersion() {
9860
9860
  const locales = {
9861
9861
  af: ()=>Promise.resolve().then(function () { return af$1; }),
9862
9862
  am: ()=>Promise.resolve().then(function () { return am$1; }),
9863
- 'ar-IQ': ()=>Promise.resolve().then(function () { return arIq$1; }),
9864
- 'ar-DZ': ()=>Promise.resolve().then(function () { return arDz$1; }),
9865
- 'ar-KW': ()=>Promise.resolve().then(function () { return arKw$1; }),
9866
- 'ar-LY': ()=>Promise.resolve().then(function () { return arLy$1; }),
9867
- 'ar-MA': ()=>Promise.resolve().then(function () { return arMa$1; }),
9868
- 'ar-SA': ()=>Promise.resolve().then(function () { return arSa$1; }),
9869
- 'ar-TN': ()=>Promise.resolve().then(function () { return arTn$1; }),
9863
+ 'ar-iq': ()=>Promise.resolve().then(function () { return arIq$1; }),
9864
+ 'ar-dz': ()=>Promise.resolve().then(function () { return arDz$1; }),
9865
+ 'ar-kw': ()=>Promise.resolve().then(function () { return arKw$1; }),
9866
+ 'ar-ly': ()=>Promise.resolve().then(function () { return arLy$1; }),
9867
+ 'ar-ma': ()=>Promise.resolve().then(function () { return arMa$1; }),
9868
+ 'ar-sa': ()=>Promise.resolve().then(function () { return arSa$1; }),
9869
+ 'ar-tn': ()=>Promise.resolve().then(function () { return arTn$1; }),
9870
9870
  ar: ()=>Promise.resolve().then(function () { return ar$1; }),
9871
9871
  az: ()=>Promise.resolve().then(function () { return az$1; }),
9872
9872
  be: ()=>Promise.resolve().then(function () { return be$1; }),
9873
9873
  bg: ()=>Promise.resolve().then(function () { return bg$1; }),
9874
9874
  bi: ()=>Promise.resolve().then(function () { return bi$1; }),
9875
9875
  bm: ()=>Promise.resolve().then(function () { return bm$1; }),
9876
- 'bn-BD': ()=>Promise.resolve().then(function () { return bnBd$1; }),
9876
+ 'bn-bd': ()=>Promise.resolve().then(function () { return bnBd$1; }),
9877
9877
  bn: ()=>Promise.resolve().then(function () { return bn$1; }),
9878
9878
  bo: ()=>Promise.resolve().then(function () { return bo$1; }),
9879
9879
  br: ()=>Promise.resolve().then(function () { return br$1; }),
@@ -9883,49 +9883,49 @@ const locales = {
9883
9883
  cv: ()=>Promise.resolve().then(function () { return cv$1; }),
9884
9884
  cy: ()=>Promise.resolve().then(function () { return cy$1; }),
9885
9885
  da: ()=>Promise.resolve().then(function () { return da$1; }),
9886
- 'de-AT': ()=>Promise.resolve().then(function () { return deAt$1; }),
9887
- 'de-CH': ()=>Promise.resolve().then(function () { return deCh$1; }),
9886
+ 'de-at': ()=>Promise.resolve().then(function () { return deAt$1; }),
9887
+ 'de-ch': ()=>Promise.resolve().then(function () { return deCh$1; }),
9888
9888
  de: ()=>Promise.resolve().then(function () { return de$1; }),
9889
9889
  dv: ()=>Promise.resolve().then(function () { return dv$1; }),
9890
- 'en-AU': ()=>Promise.resolve().then(function () { return enAu$1; }),
9890
+ 'en-au': ()=>Promise.resolve().then(function () { return enAu$1; }),
9891
9891
  el: ()=>Promise.resolve().then(function () { return el$1; }),
9892
- 'en-GB': ()=>Promise.resolve().then(function () { return enGb$1; }),
9893
- 'en-IE': ()=>Promise.resolve().then(function () { return enIe$1; }),
9894
- 'en-IL': ()=>Promise.resolve().then(function () { return enIl$1; }),
9895
- 'en-IN': ()=>Promise.resolve().then(function () { return enIn$1; }),
9896
- 'en-NZ': ()=>Promise.resolve().then(function () { return enNz$1; }),
9897
- 'en-SG': ()=>Promise.resolve().then(function () { return enSg$1; }),
9898
- 'en-TT': ()=>Promise.resolve().then(function () { return enTt$1; }),
9899
- 'en-CA': ()=>Promise.resolve().then(function () { return enCa$1; }),
9892
+ 'en-gb': ()=>Promise.resolve().then(function () { return enGb$1; }),
9893
+ 'en-ie': ()=>Promise.resolve().then(function () { return enIe$1; }),
9894
+ 'en-il': ()=>Promise.resolve().then(function () { return enIl$1; }),
9895
+ 'en-in': ()=>Promise.resolve().then(function () { return enIn$1; }),
9896
+ 'en-nz': ()=>Promise.resolve().then(function () { return enNz$1; }),
9897
+ 'en-sg': ()=>Promise.resolve().then(function () { return enSg$1; }),
9898
+ 'en-tt': ()=>Promise.resolve().then(function () { return enTt$1; }),
9899
+ 'en-ca': ()=>Promise.resolve().then(function () { return enCa$1; }),
9900
9900
  en: ()=>Promise.resolve().then(function () { return en$1; }),
9901
9901
  eo: ()=>Promise.resolve().then(function () { return eo$1; }),
9902
- 'es-MX': ()=>Promise.resolve().then(function () { return esMx$1; }),
9903
- 'es-PR': ()=>Promise.resolve().then(function () { return esPr$1; }),
9904
- 'es-US': ()=>Promise.resolve().then(function () { return esUs$1; }),
9905
- 'es-DO': ()=>Promise.resolve().then(function () { return esDo$1; }),
9902
+ 'es-mx': ()=>Promise.resolve().then(function () { return esMx$1; }),
9903
+ 'es-pr': ()=>Promise.resolve().then(function () { return esPr$1; }),
9904
+ 'es-us': ()=>Promise.resolve().then(function () { return esUs$1; }),
9905
+ 'es-do': ()=>Promise.resolve().then(function () { return esDo$1; }),
9906
9906
  et: ()=>Promise.resolve().then(function () { return et$1; }),
9907
9907
  eu: ()=>Promise.resolve().then(function () { return eu$1; }),
9908
9908
  fa: ()=>Promise.resolve().then(function () { return fa$1; }),
9909
9909
  fi: ()=>Promise.resolve().then(function () { return fi$1; }),
9910
- 'fr-CA': ()=>Promise.resolve().then(function () { return frCa$1; }),
9911
- 'fr-CH': ()=>Promise.resolve().then(function () { return frCh$1; }),
9910
+ 'fr-ca': ()=>Promise.resolve().then(function () { return frCa$1; }),
9911
+ 'fr-ch': ()=>Promise.resolve().then(function () { return frCh$1; }),
9912
9912
  fr: ()=>Promise.resolve().then(function () { return fr$1; }),
9913
9913
  fo: ()=>Promise.resolve().then(function () { return fo$1; }),
9914
9914
  fy: ()=>Promise.resolve().then(function () { return fy$1; }),
9915
9915
  ga: ()=>Promise.resolve().then(function () { return ga$1; }),
9916
9916
  gd: ()=>Promise.resolve().then(function () { return gd$1; }),
9917
9917
  gl: ()=>Promise.resolve().then(function () { return gl$1; }),
9918
- 'gom-LATN': ()=>Promise.resolve().then(function () { return gomLatn$1; }),
9918
+ 'gom-latn': ()=>Promise.resolve().then(function () { return gomLatn$1; }),
9919
9919
  gu: ()=>Promise.resolve().then(function () { return gu$1; }),
9920
9920
  he: ()=>Promise.resolve().then(function () { return he$1; }),
9921
9921
  hi: ()=>Promise.resolve().then(function () { return hi$1; }),
9922
9922
  hr: ()=>Promise.resolve().then(function () { return hr$1; }),
9923
9923
  ht: ()=>Promise.resolve().then(function () { return ht$1; }),
9924
9924
  hu: ()=>Promise.resolve().then(function () { return hu$1; }),
9925
- 'hy-AM': ()=>Promise.resolve().then(function () { return hyAm$1; }),
9925
+ 'hy-am': ()=>Promise.resolve().then(function () { return hyAm$1; }),
9926
9926
  id: ()=>Promise.resolve().then(function () { return id$1; }),
9927
9927
  is: ()=>Promise.resolve().then(function () { return is$1; }),
9928
- 'it-CH': ()=>Promise.resolve().then(function () { return itCh$1; }),
9928
+ 'it-ch': ()=>Promise.resolve().then(function () { return itCh$1; }),
9929
9929
  it: ()=>Promise.resolve().then(function () { return it$1; }),
9930
9930
  jv: ()=>Promise.resolve().then(function () { return jv$1; }),
9931
9931
  ka: ()=>Promise.resolve().then(function () { return ka$1; }),
@@ -9945,7 +9945,7 @@ const locales = {
9945
9945
  ml: ()=>Promise.resolve().then(function () { return ml$1; }),
9946
9946
  mn: ()=>Promise.resolve().then(function () { return mn$1; }),
9947
9947
  mr: ()=>Promise.resolve().then(function () { return mr$1; }),
9948
- 'ms-MY': ()=>Promise.resolve().then(function () { return msMy$1; }),
9948
+ 'ms-my': ()=>Promise.resolve().then(function () { return msMy$1; }),
9949
9949
  ms: ()=>Promise.resolve().then(function () { return ms$1; }),
9950
9950
  mt: ()=>Promise.resolve().then(function () { return mt$1; }),
9951
9951
  lo: ()=>Promise.resolve().then(function () { return lo$1; }),
@@ -9953,11 +9953,11 @@ const locales = {
9953
9953
  nb: ()=>Promise.resolve().then(function () { return nb$1; }),
9954
9954
  ne: ()=>Promise.resolve().then(function () { return ne$1; }),
9955
9955
  nl: ()=>Promise.resolve().then(function () { return nl$1; }),
9956
- 'nl-BE': ()=>Promise.resolve().then(function () { return nlBe$1; }),
9956
+ 'nl-be': ()=>Promise.resolve().then(function () { return nlBe$1; }),
9957
9957
  nn: ()=>Promise.resolve().then(function () { return nn$1; }),
9958
- 'pa-IN': ()=>Promise.resolve().then(function () { return paIn$1; }),
9958
+ 'pa-in': ()=>Promise.resolve().then(function () { return paIn$1; }),
9959
9959
  pl: ()=>Promise.resolve().then(function () { return pl$1; }),
9960
- 'pt-BR': ()=>Promise.resolve().then(function () { return ptBr$1; }),
9960
+ 'pt-br': ()=>Promise.resolve().then(function () { return ptBr$1; }),
9961
9961
  pt: ()=>Promise.resolve().then(function () { return pt$1; }),
9962
9962
  rn: ()=>Promise.resolve().then(function () { return rn$1; }),
9963
9963
  ro: ()=>Promise.resolve().then(function () { return ro$1; }),
@@ -9969,12 +9969,12 @@ const locales = {
9969
9969
  si: ()=>Promise.resolve().then(function () { return si$1; }),
9970
9970
  sk: ()=>Promise.resolve().then(function () { return sk$1; }),
9971
9971
  sl: ()=>Promise.resolve().then(function () { return sl$1; }),
9972
- 'oc-LNC': ()=>Promise.resolve().then(function () { return ocLnc$1; }),
9972
+ 'oc-lnc': ()=>Promise.resolve().then(function () { return ocLnc$1; }),
9973
9973
  sq: ()=>Promise.resolve().then(function () { return sq$1; }),
9974
- 'sr-CYRL': ()=>Promise.resolve().then(function () { return srCyrl$1; }),
9974
+ 'sr-cyrl': ()=>Promise.resolve().then(function () { return srCyrl$1; }),
9975
9975
  sr: ()=>Promise.resolve().then(function () { return sr$1; }),
9976
9976
  ss: ()=>Promise.resolve().then(function () { return ss$1; }),
9977
- 'sv-FI': ()=>Promise.resolve().then(function () { return svFi$1; }),
9977
+ 'sv-fi': ()=>Promise.resolve().then(function () { return svFi$1; }),
9978
9978
  sv: ()=>Promise.resolve().then(function () { return sv$1; }),
9979
9979
  sw: ()=>Promise.resolve().then(function () { return sw$1; }),
9980
9980
  ta: ()=>Promise.resolve().then(function () { return ta$1; }),
@@ -9982,42 +9982,56 @@ const locales = {
9982
9982
  tet: ()=>Promise.resolve().then(function () { return tet$1; }),
9983
9983
  tg: ()=>Promise.resolve().then(function () { return tg$1; }),
9984
9984
  th: ()=>Promise.resolve().then(function () { return th$1; }),
9985
- 'tl-PH': ()=>Promise.resolve().then(function () { return tlPh$1; }),
9985
+ 'tl-ph': ()=>Promise.resolve().then(function () { return tlPh$1; }),
9986
9986
  tlh: ()=>Promise.resolve().then(function () { return tlh$1; }),
9987
9987
  tr: ()=>Promise.resolve().then(function () { return tr$1; }),
9988
9988
  tzl: ()=>Promise.resolve().then(function () { return tzl$1; }),
9989
9989
  tzm: ()=>Promise.resolve().then(function () { return tzm$1; }),
9990
- 'ug-CN': ()=>Promise.resolve().then(function () { return ugCn$1; }),
9990
+ 'ug-cn': ()=>Promise.resolve().then(function () { return ugCn$1; }),
9991
9991
  uk: ()=>Promise.resolve().then(function () { return uk$1; }),
9992
9992
  tk: ()=>Promise.resolve().then(function () { return tk$1; }),
9993
9993
  ur: ()=>Promise.resolve().then(function () { return ur$1; }),
9994
- 'uz-LATN': ()=>Promise.resolve().then(function () { return uzLatn$1; }),
9994
+ 'uz-latn': ()=>Promise.resolve().then(function () { return uzLatn$1; }),
9995
9995
  uz: ()=>Promise.resolve().then(function () { return uz$1; }),
9996
9996
  vi: ()=>Promise.resolve().then(function () { return vi$1; }),
9997
- 'x-PSEUDO': ()=>Promise.resolve().then(function () { return xPseudo$1; }),
9998
- 'tzm-LATN': ()=>Promise.resolve().then(function () { return tzmLatn$1; }),
9997
+ 'x-pseudo': ()=>Promise.resolve().then(function () { return xPseudo$1; }),
9998
+ 'tzm-latn': ()=>Promise.resolve().then(function () { return tzmLatn$1; }),
9999
9999
  yo: ()=>Promise.resolve().then(function () { return yo$1; }),
10000
- 'zh-CN': ()=>Promise.resolve().then(function () { return zhCn$1; }),
10001
- 'zh-HK': ()=>Promise.resolve().then(function () { return zhHk$1; }),
10002
- 'zh-TW': ()=>Promise.resolve().then(function () { return zhTw$1; }),
10000
+ 'zh-cn': ()=>Promise.resolve().then(function () { return zhCn$1; }),
10001
+ 'zh-hk': ()=>Promise.resolve().then(function () { return zhHk$1; }),
10002
+ 'zh-tw': ()=>Promise.resolve().then(function () { return zhTw$1; }),
10003
10003
  zh: ()=>Promise.resolve().then(function () { return zh$1; })
10004
10004
  };
10005
10005
 
10006
10006
  const warn = (language)=>console.warn(`Cannot load dayjs locale file for "${language}"`);
10007
- const resolveLanguage = (languageInput)=>{
10008
- if (locales[languageInput]) return languageInput;
10009
- if (languageInput.includes('-')) {
10010
- const regionlessLanguage = languageInput.split('-')[0];
10011
- if (locales[regionlessLanguage]) return regionlessLanguage;
10007
+ const getCandidateLocales = (languageInput)=>{
10008
+ try {
10009
+ const { language, script, region } = new Intl.Locale(languageInput);
10010
+ return [
10011
+ languageInput,
10012
+ ...region ? [
10013
+ `${language}-${region}`
10014
+ ] : [],
10015
+ ...script ? [
10016
+ `${language}-${script}`
10017
+ ] : [],
10018
+ language
10019
+ ];
10020
+ } catch {
10021
+ return [
10022
+ languageInput,
10023
+ languageInput.split('-')[0]
10024
+ ];
10012
10025
  }
10013
- return languageInput;
10014
10026
  };
10015
- function loadDayjsLocale(languageInput) {
10027
+ const resolveLanguage = (languageInput)=>getCandidateLocales(languageInput).map((locale)=>locale.toLowerCase()).find((locale)=>Object.hasOwn(locales, locale)) ?? languageInput;
10028
+ async function loadDayjsLocale(languageInput) {
10016
10029
  const language = resolveLanguage(languageInput);
10017
10030
  if (!locales[language]) return void warn(language);
10018
10031
  try {
10019
- locales[language]().then(()=>dayjs.locale(language));
10020
- } catch (_) {
10032
+ await locales[language]();
10033
+ dayjs.locale(language);
10034
+ } catch {
10021
10035
  warn(language);
10022
10036
  }
10023
10037
  }
@@ -10404,9 +10418,13 @@ function i18nBackendOptions(atomicInterface) {
10404
10418
  }
10405
10419
  };
10406
10420
  }
10407
- function loadTranslations(atomicInterface, language) {
10421
+ async function loadTranslations(atomicInterface, language) {
10422
+ const { languageUtils } = atomicInterface.i18n.services;
10423
+ const languages = languageUtils.toResolveHierarchy(languageUtils.formatLanguageCode(language), false);
10424
+ await Promise.all(languages.filter(isI18nLocaleAvailable).map((lng)=>loadTranslationBundle(atomicInterface, lng)));
10425
+ }
10426
+ function loadTranslationBundle(atomicInterface, lng) {
10408
10427
  const { i18n } = atomicInterface;
10409
- const lng = language.split('-')[0];
10410
10428
  return new Promise((resolve)=>{
10411
10429
  new Backend(i18n.services, i18nBackendOptions(atomicInterface)).read(lng, i18nTranslationNamespace, (_error, data)=>{
10412
10430
  if (data) i18n.addResourceBundle(lng, i18nTranslationNamespace, data, true, false);
@@ -10621,8 +10639,10 @@ class InterfaceController {
10621
10639
  this.host.updateIconAssetsPath();
10622
10640
  initEngine();
10623
10641
  if (this.host.registerFieldsToInclude) this.host.registerFieldsToInclude();
10624
- loadDayjsLocale(this.host.language || 'en');
10625
- await this.i18nPromise;
10642
+ await Promise.all([
10643
+ this.i18nPromise,
10644
+ loadDayjsLocale(this.host.language || 'en')
10645
+ ]);
10626
10646
  this.initComponents();
10627
10647
  }
10628
10648
  onAnalyticsChange() {
@@ -10635,8 +10655,10 @@ class InterfaceController {
10635
10655
  const language = newLanguage ?? this.host.language;
10636
10656
  const languageWithFallback = language ?? 'en';
10637
10657
  const { i18n } = this.host;
10638
- loadDayjsLocale(languageWithFallback);
10639
- loadTranslations(this.host, languageWithFallback).then(()=>{
10658
+ Promise.all([
10659
+ loadDayjsLocale(languageWithFallback),
10660
+ loadTranslations(this.host, languageWithFallback)
10661
+ ]).then(()=>{
10640
10662
  i18n.changeLanguage(language);
10641
10663
  });
10642
10664
  }
@@ -10764,6 +10786,18 @@ class SafeStorage {
10764
10786
  }
10765
10787
  }
10766
10788
 
10789
+ function withCountry(language, country) {
10790
+ if (!country) return language;
10791
+ try {
10792
+ if (new Intl.Locale(language).region) return language;
10793
+ return new Intl.Locale(language, {
10794
+ region: country
10795
+ }).toString();
10796
+ } catch {
10797
+ return language;
10798
+ }
10799
+ }
10800
+
10767
10801
  function getAnalyticsConfig(commerceEngineConfig, enabled) {
10768
10802
  return {
10769
10803
  enabled,
@@ -10889,7 +10923,7 @@ let AtomicCommerceInterface$1 = class AtomicCommerceInterface extends ChildrenUp
10889
10923
  }
10890
10924
  updateLocale(language, country, currency) {
10891
10925
  if (!this.interfaceController.engineIsCreated(this.engine) || !this.context) return;
10892
- language && this.interfaceController.onLanguageChange(language);
10926
+ if (language || country && this.localizeWithCountry) this.interfaceController.onLanguageChange(this.getLocale(language || this.context.state.language, country || this.context.state.country));
10893
10927
  if (this.isNewLocale(language, country, currency)) {
10894
10928
  const { setContext } = commerce.loadContextActions(this.engine);
10895
10929
  this.engine.dispatch(setContext({
@@ -10914,7 +10948,11 @@ let AtomicCommerceInterface$1 = class AtomicCommerceInterface extends ChildrenUp
10914
10948
  if (!this.interfaceController.engineIsCreated(this.engine) || !this.language || !this.context) return;
10915
10949
  this.engine.logger.warn('The `language` property will be removed in the next major version of Atomic (v4). Rather than using this property, set the initial language through the engine configuration when calling `initialize` or `initializeWithEngine`, and update the language as needed using the `updateLocale` method.');
10916
10950
  this.context.setLanguage(this.language);
10917
- return this.interfaceController.onLanguageChange();
10951
+ return this.interfaceController.onLanguageChange(this.getLocale(this.language, this.context.state.country));
10952
+ }
10953
+ toggleLocalizeWithCountry() {
10954
+ if (!this.context) return;
10955
+ this.interfaceController.onLanguageChange(this.getLocale(this.context.state.language, this.context.state.country));
10918
10956
  }
10919
10957
  updateIconAssetsPath() {
10920
10958
  this.store.state.iconAssetsPath = this.iconAssetsPath;
@@ -10955,7 +10993,10 @@ let AtomicCommerceInterface$1 = class AtomicCommerceInterface extends ChildrenUp
10955
10993
  }
10956
10994
  initLanguage() {
10957
10995
  if (!this.context || this.language) return;
10958
- this.interfaceController.onLanguageChange(this.context.state.language);
10996
+ this.interfaceController.onLanguageChange(this.getLocale(this.context.state.language, this.context.state.country));
10997
+ }
10998
+ getLocale(language, country) {
10999
+ return this.localizeWithCountry ? withCountry(language, country) : language;
10959
11000
  }
10960
11001
  initRequestStatus() {
10961
11002
  this.searchOrListing = 'product-listing' === this.type ? commerce.buildProductListing(this.engine) : commerce.buildSearch(this.engine);
@@ -11019,7 +11060,7 @@ let AtomicCommerceInterface$1 = class AtomicCommerceInterface extends ChildrenUp
11019
11060
  this.bindings.engine.logger.info(`History pushState #${newFragment}`);
11020
11061
  }
11021
11062
  constructor(){
11022
- super(), this.bindings = {}, this.unsubscribeUrlManager = ()=>{}, this.unsubscribeSummary = ()=>{}, this.initialized = false, this.interfaceController = new InterfaceController(this, 'CoveoAtomic', commerce.VERSION), this.type = 'search', this.analytics = true, this.reflectStateInUrl = true, this.disableStateReflectionInUrl = false, this.scrollContainer = 'atomic-commerce-interface', this.languageAssetsPath = './lang', this.iconAssetsPath = './assets', this.handleInitialization = (event)=>{
11063
+ super(), this.bindings = {}, this.unsubscribeUrlManager = ()=>{}, this.unsubscribeSummary = ()=>{}, this.initialized = false, this.interfaceController = new InterfaceController(this, 'CoveoAtomic', commerce.VERSION), this.type = 'search', this.analytics = true, this.localizeWithCountry = false, this.reflectStateInUrl = true, this.disableStateReflectionInUrl = false, this.scrollContainer = 'atomic-commerce-interface', this.languageAssetsPath = './lang', this.iconAssetsPath = './assets', this.handleInitialization = (event)=>{
11023
11064
  this.interfaceController.onComponentInitializing(event);
11024
11065
  }, this.onHashChange = ()=>{
11025
11066
  this.urlManager.synchronize(this.fragment);
@@ -11081,6 +11122,13 @@ _ts_decorate$T([
11081
11122
  }),
11082
11123
  _ts_metadata$G("design:type", String)
11083
11124
  ], AtomicCommerceInterface$1.prototype, "language", void 0);
11125
+ _ts_decorate$T([
11126
+ decorators_js.property({
11127
+ type: Boolean,
11128
+ attribute: 'localize-with-country',
11129
+ reflect: true
11130
+ })
11131
+ ], AtomicCommerceInterface$1.prototype, "localizeWithCountry", void 0);
11084
11132
  _ts_decorate$T([
11085
11133
  decorators_js.property({
11086
11134
  type: Object,
@@ -11136,6 +11184,12 @@ _ts_decorate$T([
11136
11184
  _ts_metadata$G("design:paramtypes", []),
11137
11185
  _ts_metadata$G("design:returntype", void 0)
11138
11186
  ], AtomicCommerceInterface$1.prototype, "updateLanguage", null);
11187
+ _ts_decorate$T([
11188
+ watch('localizeWithCountry'),
11189
+ _ts_metadata$G("design:type", Function),
11190
+ _ts_metadata$G("design:paramtypes", []),
11191
+ _ts_metadata$G("design:returntype", void 0)
11192
+ ], AtomicCommerceInterface$1.prototype, "toggleLocalizeWithCountry", null);
11139
11193
  _ts_decorate$T([
11140
11194
  watch('iconAssetsPath'),
11141
11195
  _ts_metadata$G("design:type", Function),
@@ -11559,6 +11613,40 @@ const renderPagerNavigation = ({ props })=>(children)=>lit.html`<nav aria-label=
11559
11613
  <div part="buttons" class="flex flex-wrap gap-2">${children}</div>
11560
11614
  </nav>`;
11561
11615
 
11616
+ class PagerFitController {
11617
+ hostConnected() {
11618
+ this.resizeObserver = new ResizeObserver(()=>requestAnimationFrame(()=>this.reset()));
11619
+ this.resizeObserver.observe(document.documentElement);
11620
+ if (this.host.parentElement) this.resizeObserver.observe(this.host.parentElement);
11621
+ }
11622
+ hostDisconnected() {
11623
+ this.resizeObserver?.disconnect();
11624
+ }
11625
+ hostUpdated() {
11626
+ const root = this.host.shadowRoot;
11627
+ const previousButton = root?.querySelector('[part="previous-button"]');
11628
+ const nextButton = root?.querySelector('[part="next-button"]');
11629
+ const pageButtonCount = root?.querySelectorAll('[part~="page-button"]').length ?? 0;
11630
+ const isWrapping = !!previousButton && !!nextButton && nextButton.offsetTop > previousButton.offsetTop;
11631
+ if (isWrapping && pageButtonCount > 1) {
11632
+ this.maxPages = pageButtonCount - 1;
11633
+ queueMicrotask(()=>this.host.requestUpdate());
11634
+ }
11635
+ }
11636
+ getNumberOfPagesToDisplay(numberOfPages) {
11637
+ return Math.min(numberOfPages, this.maxPages);
11638
+ }
11639
+ reset() {
11640
+ this.maxPages = 1 / 0;
11641
+ this.host.requestUpdate();
11642
+ }
11643
+ constructor(host){
11644
+ this.host = host;
11645
+ this.maxPages = 1 / 0;
11646
+ host.addController(this);
11647
+ }
11648
+ }
11649
+
11562
11650
  const minimumPage = 0;
11563
11651
  function getCurrentPagesRange(page, desiredNumberOfPages, maxPage) {
11564
11652
  let range = buildRange(page, desiredNumberOfPages);
@@ -11623,7 +11711,7 @@ let AtomicCommercePager$1 = class AtomicCommercePager extends lit.LitElement {
11623
11711
  });
11624
11712
  }
11625
11713
  render() {
11626
- const pagesRange = getCurrentPagesRange(this.pagerState.page, this.numberOfPages, this.pagerState.totalPages - 1);
11714
+ const pagesRange = getCurrentPagesRange(this.pagerState.page, this.pagerFit.getNumberOfPagesToDisplay(this.numberOfPages), this.pagerState.totalPages - 1);
11627
11715
  return lit.html`
11628
11716
  ${when_js.when(this.pagerState.totalPages > 1 && this.isAppLoaded, ()=>lit.html`
11629
11717
  ${renderPagerNavigation({
@@ -11693,7 +11781,7 @@ let AtomicCommercePager$1 = class AtomicCommercePager extends lit.LitElement {
11693
11781
  });
11694
11782
  }
11695
11783
  constructor(){
11696
- super(), this.isAppLoaded = false, this.numberOfPages = 5, this.previousButtonIcon = arrow_left_rounded, this.nextButtonIcon = arrow_right_rounded, this.ariaMessage = new AriaLiveRegionController(this, 'atomic-pager');
11784
+ super(), this.isAppLoaded = false, this.numberOfPages = 5, this.previousButtonIcon = arrow_left_rounded, this.nextButtonIcon = arrow_right_rounded, this.ariaMessage = new AriaLiveRegionController(this, 'atomic-pager'), this.pagerFit = new PagerFitController(this);
11697
11785
  new ValidatePropsController(this, ()=>({
11698
11786
  numberOfPages: this.numberOfPages
11699
11787
  }), AtomicCommercePager.propsSchema);
@@ -14498,7 +14586,7 @@ let AtomicCommerceProductsPerPage$1 = class AtomicCommerceProductsPerPage extend
14498
14586
  render() {
14499
14587
  return lit.html`
14500
14588
  ${when_js.when(!this.summaryState.hasError && this.summaryState.hasProducts && this.isAppLoaded, ()=>lit.html`
14501
- <div class="flex items-center">
14589
+ <div class="flex flex-wrap items-center">
14502
14590
  ${renderLabel()(lit.html`${this.label}`)}
14503
14591
  ${renderFieldsetGroup({
14504
14592
  props: {
@@ -14995,7 +15083,7 @@ let AtomicCommerceRecommendationInterface$1 = class AtomicCommerceRecommendation
14995
15083
  }
14996
15084
  updateLocale(language, country, currency) {
14997
15085
  if (!this.interfaceController.engineIsCreated(this.engine) || !this.context) return;
14998
- language && this.interfaceController.onLanguageChange(language);
15086
+ if (language || country && this.localizeWithCountry) this.interfaceController.onLanguageChange(this.getLocale(language || this.context.state.language, country || this.context.state.country));
14999
15087
  if (this.isNewLocale(language, country, currency)) {
15000
15088
  const { setContext } = commerce.loadContextActions(this.engine);
15001
15089
  this.engine.dispatch(setContext({
@@ -15018,11 +15106,15 @@ let AtomicCommerceRecommendationInterface$1 = class AtomicCommerceRecommendation
15018
15106
  updateIconAssetsPath() {
15019
15107
  this.store.state.iconAssetsPath = this.iconAssetsPath;
15020
15108
  }
15109
+ toggleLocalizeWithCountry() {
15110
+ if (!this.context) return;
15111
+ this.interfaceController.onLanguageChange(this.getLocale(this.context.state.language, this.context.state.country));
15112
+ }
15021
15113
  async updateLanguage() {
15022
15114
  if (!this.interfaceController.engineIsCreated(this.engine) || !this.language || !this.context) return;
15023
15115
  this.engine.logger.warn('The `language` property will be removed in the next major version of Atomic (v4). Rather than using this property, set the initial language through the engine configuration when calling `initializeWithEngine`, and update the language as needed using the `updateLocale` method.');
15024
15116
  this.context.setLanguage(this.language);
15025
- return this.interfaceController.onLanguageChange();
15117
+ return this.interfaceController.onLanguageChange(this.getLocale(this.language, this.context.state.country));
15026
15118
  }
15027
15119
  disconnectedCallback() {
15028
15120
  super.disconnectedCallback();
@@ -15063,14 +15155,17 @@ let AtomicCommerceRecommendationInterface$1 = class AtomicCommerceRecommendation
15063
15155
  }
15064
15156
  initLanguage() {
15065
15157
  if (!this.context || this.language) return;
15066
- this.interfaceController.onLanguageChange(this.context.state.language);
15158
+ this.interfaceController.onLanguageChange(this.getLocale(this.context.state.language, this.context.state.country));
15159
+ }
15160
+ getLocale(language, country) {
15161
+ return this.localizeWithCountry ? withCountry(language, country) : language;
15067
15162
  }
15068
15163
  isNewLocale(language, country, currency) {
15069
15164
  if (!this.context) return false;
15070
15165
  return language && language !== this.context.state.language || country && country !== this.context.state.country || currency && currency !== this.context.state.currency;
15071
15166
  }
15072
15167
  constructor(){
15073
- super(), this.bindings = {}, this.interfaceController = new InterfaceController(this, 'CoveoAtomic', commerce.VERSION), this.scrollContainer = 'atomic-commerce-recommendation-interface', this.languageAssetsPath = './lang', this.iconAssetsPath = './assets', this.analytics = true, this.handleInitialization = (event)=>{
15168
+ super(), this.bindings = {}, this.interfaceController = new InterfaceController(this, 'CoveoAtomic', commerce.VERSION), this.scrollContainer = 'atomic-commerce-recommendation-interface', this.languageAssetsPath = './lang', this.iconAssetsPath = './assets', this.localizeWithCountry = false, this.analytics = true, this.handleInitialization = (event)=>{
15074
15169
  this.interfaceController.onComponentInitializing(event);
15075
15170
  };
15076
15171
  this.store = createCommerceRecommendationStore();
@@ -15138,6 +15233,13 @@ _ts_decorate$v([
15138
15233
  }),
15139
15234
  _ts_metadata$n("design:type", String)
15140
15235
  ], AtomicCommerceRecommendationInterface$1.prototype, "language", void 0);
15236
+ _ts_decorate$v([
15237
+ decorators_js.property({
15238
+ type: Boolean,
15239
+ attribute: 'localize-with-country',
15240
+ reflect: true
15241
+ })
15242
+ ], AtomicCommerceRecommendationInterface$1.prototype, "localizeWithCountry", void 0);
15141
15243
  _ts_decorate$v([
15142
15244
  decorators_js.property({
15143
15245
  type: Boolean,
@@ -15158,6 +15260,12 @@ _ts_decorate$v([
15158
15260
  _ts_metadata$n("design:paramtypes", []),
15159
15261
  _ts_metadata$n("design:returntype", void 0)
15160
15262
  ], AtomicCommerceRecommendationInterface$1.prototype, "updateIconAssetsPath", null);
15263
+ _ts_decorate$v([
15264
+ watch('localizeWithCountry'),
15265
+ _ts_metadata$n("design:type", Function),
15266
+ _ts_metadata$n("design:paramtypes", []),
15267
+ _ts_metadata$n("design:returntype", void 0)
15268
+ ], AtomicCommerceRecommendationInterface$1.prototype, "toggleLocalizeWithCountry", null);
15161
15269
  _ts_decorate$v([
15162
15270
  watch('language'),
15163
15271
  _ts_metadata$n("design:type", Function),