@fluid-topics/ft-app-context 1.2.1 → 1.2.3

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,5 +1,5 @@
1
1
  import { FtReduxStore, Optional } from "@fluid-topics/ft-wc-utils";
2
- import { FtMetadataConfiguration, FtSession, FtUiLocale } from "@fluid-topics/public-api";
2
+ import { FtDefaultLocales, FtMetadataConfiguration, FtSession, FtUiLocale } from "@fluid-topics/public-api";
3
3
  import { PayloadAction } from "@reduxjs/toolkit";
4
4
  export declare const FtAppInfoStoreName = "ft-app-info";
5
5
  export interface FtAppInfoState {
@@ -7,6 +7,8 @@ export interface FtAppInfoState {
7
7
  apiIntegrationIdentifier: Optional<string>;
8
8
  uiLocale: string;
9
9
  availableUiLocales: Array<FtUiLocale>;
10
+ defaultLocales: FtDefaultLocales | undefined;
11
+ searchInAllLanguagesAllowed: boolean;
10
12
  metadataConfiguration: Optional<FtMetadataConfiguration>;
11
13
  editorMode: boolean;
12
14
  noCustom: boolean;
@@ -9,7 +9,7 @@ const reducers = {
9
9
  session: (state, action) => {
10
10
  if (!deepEqual(state.session, action.payload)) {
11
11
  state.session = action.payload;
12
- setTimeout(() => ftAppInfoStore.eventBus.dispatchEvent(new AuthenticationChangeEvent(action.payload)), 0);
12
+ setTimeout(() => ftAppInfoStore.dispatchEvent(new AuthenticationChangeEvent(action.payload)), 0);
13
13
  }
14
14
  }
15
15
  };
@@ -21,6 +21,8 @@ export const ftAppInfoStore = FtReduxStore.get({
21
21
  apiIntegrationIdentifier: undefined,
22
22
  uiLocale: document.documentElement.lang || "en-US",
23
23
  availableUiLocales: [],
24
+ defaultLocales: undefined,
25
+ searchInAllLanguagesAllowed: false,
24
26
  metadataConfiguration: undefined,
25
27
  editorMode: false,
26
28
  noCustom: false,
@@ -0,0 +1,4 @@
1
+ import { SearchPlaceConverter } from "@fluid-topics/ft-wc-utils";
2
+ export declare class SearchPlaceConverterProvider {
3
+ static get(defaultPerPage?: number, defaultContentLocale?: string): SearchPlaceConverter;
4
+ }
@@ -0,0 +1,12 @@
1
+ import { SearchPlaceConverter } from "@fluid-topics/ft-wc-utils";
2
+ import { ftAppInfoStore } from "../redux-stores/FtAppInfoStore";
3
+ export class SearchPlaceConverterProvider {
4
+ static get(defaultPerPage, defaultContentLocale) {
5
+ var _a, _b, _c, _d;
6
+ const appInfo = ftAppInfoStore.getState();
7
+ const { lang, region } = (_b = (_a = appInfo.defaultLocales) === null || _a === void 0 ? void 0 : _a.defaultContentLocale) !== null && _b !== void 0 ? _b : { lang: "en", region: "US" };
8
+ return new SearchPlaceConverter(appInfo.baseUrl,
9
+ // TODO: Refacto during the story on custom sorts
10
+ (_d = (_c = window.FluidTopicsClientConfiguration) === null || _c === void 0 ? void 0 : _c.predefinedSorts) !== null && _d !== void 0 ? _d : {}, defaultPerPage !== null && defaultPerPage !== void 0 ? defaultPerPage : 20, appInfo.searchInAllLanguagesAllowed, defaultContentLocale !== null && defaultContentLocale !== void 0 ? defaultContentLocale : `${lang}-${region}`);
11
+ }
12
+ }
@@ -6,3 +6,4 @@ export * from "./FtServiceWithCache";
6
6
  export * from "./HighlightHtmlService";
7
7
  export * from "./SavedSearchesService";
8
8
  export * from "./DateService";
9
+ export * from "./SearchPlaceConverterProvider";
@@ -6,3 +6,4 @@ export * from "./FtServiceWithCache";
6
6
  export * from "./HighlightHtmlService";
7
7
  export * from "./SavedSearchesService";
8
8
  export * from "./DateService";
9
+ export * from "./SearchPlaceConverterProvider";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-app-context",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Global application context for Fluid Topics integrations",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,11 +19,11 @@
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": "1.2.1",
22
+ "@fluid-topics/ft-wc-utils": "1.2.3",
23
23
  "lit": "3.1.0"
24
24
  },
25
25
  "devDependencies": {
26
- "@fluid-topics/public-api": "1.0.77"
26
+ "@fluid-topics/public-api": "1.0.78"
27
27
  },
28
- "gitHead": "bbad4c991ddc3e9bbff3b1120c7e56bc0bd6c916"
28
+ "gitHead": "31c1696257f82afca00cddf81033e8984f665c43"
29
29
  }