@fluid-topics/ft-reader-context 1.1.28 → 1.1.29

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/build/models.d.ts CHANGED
@@ -37,6 +37,9 @@ export declare class NotFoundErrorEvent extends Event {
37
37
  export declare class UnauthorizedErrorEvent extends Event {
38
38
  constructor();
39
39
  }
40
+ export declare class ForbiddenErrorEvent extends Event {
41
+ constructor();
42
+ }
40
43
  export declare class TopicRelativeNotFoundEvent extends Event {
41
44
  constructor();
42
45
  }
package/build/models.js CHANGED
@@ -28,6 +28,11 @@ export class UnauthorizedErrorEvent extends Event {
28
28
  super("ft-reader-map-unauthorized");
29
29
  }
30
30
  }
31
+ export class ForbiddenErrorEvent extends Event {
32
+ constructor() {
33
+ super("ft-reader-map-forbidden");
34
+ }
35
+ }
31
36
  export class TopicRelativeNotFoundEvent extends Event {
32
37
  constructor() {
33
38
  super("ft-reader-topic-relative-not-found", { bubbles: true, composed: true });
@@ -1,7 +1,6 @@
1
1
  import { ClusteringHelper } from "@fluid-topics/ft-wc-utils";
2
2
  import { FtReaderReduxStore } from "./redux";
3
3
  import type { FtReaderService } from "./utils/FtReaderService";
4
- import { FtMetadata } from "@fluid-topics/public-api";
5
4
  export declare class FtReaderStateManager {
6
5
  store: FtReaderReduxStore;
7
6
  static build(id: string, serviceProvider?: () => Promise<FtReaderService>): FtReaderStateManager;
@@ -25,7 +24,7 @@ export declare class FtReaderStateManager {
25
24
  private fetchData;
26
25
  private fetchRelatives;
27
26
  private createClusteringHelper;
28
- navigateToRelativeTopicIfFound(mapId?: string, topicPivotMetadataValue?: FtMetadata): Promise<void>;
27
+ navigateToRelativeTopicIfFound(topicPivotMetadataValue: string): Promise<boolean>;
29
28
  setSearchInDocumentQuery(query: string): void;
30
29
  registerMetadataForSwitchToRelatives(id: string): void;
31
30
  unregisterMetadataForSwitchToRelatives(id: string): void;
@@ -2,7 +2,6 @@ import { CanceledPromiseError, ClusteringHelper, Debouncer, waitFor } from "@flu
2
2
  import { createReaderStore } from "./redux";
3
3
  import { FtOfficialReaderService } from "./utils/FtOfficialReaderService";
4
4
  import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
5
- import { TopicRelativeNotFoundEvent } from "../models";
6
5
  export class FtReaderStateManager {
7
6
  static build(id, serviceProvider) {
8
7
  return new FtReaderStateManager(createReaderStore(id.trim() || "context"), serviceProvider !== null && serviceProvider !== void 0 ? serviceProvider : FtOfficialReaderService.build);
@@ -120,20 +119,20 @@ export class FtReaderStateManager {
120
119
  this.store.eventBus.dispatchEvent(new CustomEvent("clustering-helper-created"));
121
120
  }
122
121
  }
123
- async navigateToRelativeTopicIfFound(mapId, topicPivotMetadataValue) {
122
+ async navigateToRelativeTopicIfFound(topicPivotMetadataValue) {
124
123
  var _a, _b, _c;
125
- if (mapId && topicPivotMetadataValue) {
126
- const relativeTopicPivotMetadata = this.store.getState().configuration.relativeTopicPivotMetadata;
127
- const service = await this.awaitService();
128
- const searchResults = await service.getRelativesForTopicInMap(mapId, relativeTopicPivotMetadata, topicPivotMetadataValue.values);
129
- await this.setMapId(mapId);
130
- if ((_c = (_b = (_a = searchResults === null || searchResults === void 0 ? void 0 : searchResults.results) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.entries) === null || _c === void 0 ? void 0 : _c[0]) {
131
- const targetTocId = searchResults.results[0].entries[0].topic.tocId;
132
- await this.navigateToTopic(targetTocId);
133
- }
134
- else {
135
- this.store.eventBus.dispatchEvent(new TopicRelativeNotFoundEvent());
136
- }
124
+ const relativeTopicPivotMetadata = await waitFor(() => { var _a; return (_a = this.store.getState().configuration) === null || _a === void 0 ? void 0 : _a.relativeTopicPivotMetadata; });
125
+ const mapId = this.store.getState().mapId;
126
+ const service = await this.awaitService();
127
+ const searchResults = await service.getRelativesForTopicInMap(mapId, relativeTopicPivotMetadata, [topicPivotMetadataValue]);
128
+ if ((_c = (_b = (_a = searchResults === null || searchResults === void 0 ? void 0 : searchResults.results) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.entries) === null || _c === void 0 ? void 0 : _c[0]) {
129
+ const targetTocId = searchResults.results[0].entries[0].topic.tocId;
130
+ await this.navigateToTopic(targetTocId);
131
+ return true;
132
+ }
133
+ else {
134
+ await this.navigateToTopic("root");
135
+ return false;
137
136
  }
138
137
  }
139
138
  setSearchInDocumentQuery(query) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-reader-context",
3
- "version": "1.1.28",
3
+ "version": "1.1.29",
4
4
  "description": "Context block for integrated reader components",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,13 +19,13 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-app-context": "1.1.28",
23
- "@fluid-topics/ft-wc-utils": "1.1.28",
22
+ "@fluid-topics/ft-app-context": "1.1.29",
23
+ "@fluid-topics/ft-wc-utils": "1.1.29",
24
24
  "@reduxjs/toolkit": "^1.6.2",
25
25
  "lit": "3.1.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@fluid-topics/public-api": "1.0.57"
29
29
  },
30
- "gitHead": "8c1055ddd23e83efa3833f033a507aa1ab32fecc"
30
+ "gitHead": "0d8f67879e2608a03b96d18ba7b3ad25e065178b"
31
31
  }