@fluid-topics/ft-app-context 2.2.26 → 2.2.28

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.
@@ -1,4 +1,5 @@
1
1
  import { SearchPlaceConverter } from "@fluid-topics/ft-wc-utils";
2
+ import { FtAppInfoState } from "../redux-stores/FtAppInfoStore";
2
3
  export declare class SearchPlaceConverterProvider {
3
- static get(defaultPerPage?: number, defaultContentLocale?: string): SearchPlaceConverter;
4
+ static get(defaultPerPage?: number, defaultContentLocale?: string, { baseUrl, localesConfiguration, availableContentLocales }?: Pick<FtAppInfoState, "baseUrl" | "localesConfiguration" | "availableContentLocales">): SearchPlaceConverter;
4
5
  }
@@ -1,11 +1,12 @@
1
1
  import { SearchPlaceConverter } from "@fluid-topics/ft-wc-utils";
2
- import { ftAppInfoStore } from "../redux-stores/FtAppInfoStore";
2
+ import { ftAppInfoStore, } from "../redux-stores/FtAppInfoStore";
3
3
  export class SearchPlaceConverterProvider {
4
- static get(defaultPerPage, defaultContentLocale) {
5
- var _a, _b, _c;
6
- var _d;
7
- const appInfo = ftAppInfoStore.getState();
8
- const { lang, region } = (_d = (_b = (_a = appInfo.localesConfiguration) === null || _a === void 0 ? void 0 : _a.defaultLocales) === null || _b === void 0 ? void 0 : _b.defaultContentLocale) !== null && _d !== void 0 ? _d : { lang: "en", region: "US" };
9
- return new SearchPlaceConverter(appInfo.baseUrl, defaultPerPage !== null && defaultPerPage !== void 0 ? defaultPerPage : 20, (_c = appInfo.localesConfiguration) === null || _c === void 0 ? void 0 : _c.allLanguagesAllowed, defaultContentLocale !== null && defaultContentLocale !== void 0 ? defaultContentLocale : `${lang}-${region}`);
4
+ static get(defaultPerPage, defaultContentLocale, { baseUrl, localesConfiguration, availableContentLocales } = ftAppInfoStore.getState()) {
5
+ var _a;
6
+ if (!defaultContentLocale || (availableContentLocales.length > 0 && !availableContentLocales.some((l) => l.lang === defaultContentLocale))) {
7
+ const globalDefault = localesConfiguration === null || localesConfiguration === void 0 ? void 0 : localesConfiguration.defaultLocales.defaultContentLocale;
8
+ defaultContentLocale = globalDefault ? `${globalDefault.lang}-${globalDefault.region}` : (_a = availableContentLocales[0]) === null || _a === void 0 ? void 0 : _a.lang;
9
+ }
10
+ return new SearchPlaceConverter(baseUrl, defaultPerPage !== null && defaultPerPage !== void 0 ? defaultPerPage : 20, localesConfiguration === null || localesConfiguration === void 0 ? void 0 : localesConfiguration.allLanguagesAllowed, defaultContentLocale, availableContentLocales);
10
11
  }
11
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-app-context",
3
- "version": "2.2.26",
3
+ "version": "2.2.28",
4
4
  "description": "Global application context for Fluid Topics integrations",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,7 +19,7 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-wc-utils": "2.2.26",
22
+ "@fluid-topics/ft-wc-utils": "2.2.28",
23
23
  "@lit/context": "1.1.6",
24
24
  "@reduxjs/toolkit": "2.13.0",
25
25
  "lit": "3.3.3"
@@ -27,5 +27,5 @@
27
27
  "devDependencies": {
28
28
  "@fluid-topics/public-api": "1.0.144"
29
29
  },
30
- "gitHead": "8372f450183ce9d47e678a6a2cb60bdc619a49db"
30
+ "gitHead": "8ca1d190ac34fad2ecec7ad3b03890913f865eb7"
31
31
  }