@fluid-topics/ft-reader-metadata 2.0.14 → 2.0.15

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.
@@ -4,14 +4,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { html, nothing } from "lit";
8
- import { property, state } from "lit/decorators.js";
9
- import { ClusteringHelper, numberProperty, redux, reduxEventListener, reduxReactive } from "@fluid-topics/ft-wc-utils";
7
+ import { html, nothing, } from "lit";
8
+ import { property, state, } from "lit/decorators.js";
9
+ import { ClusteringHelper, numberProperty, redux, reduxEventListener, reduxReactive, } from "@fluid-topics/ft-wc-utils";
10
10
  import { styles } from "./ft-reader-metadata.styles";
11
- import { FtReaderComponent } from "@fluid-topics/ft-reader-context/build/registration";
11
+ import { FtReaderComponent, } from "@fluid-topics/ft-reader-context/build/registration";
12
12
  import { FtTooltip } from "@fluid-topics/ft-tooltip";
13
13
  import { FtChip } from "@fluid-topics/ft-chip";
14
- import { FtFloatingMenu, FtFloatingMenuItem, FtFloatingMenuLabel } from "@fluid-topics/ft-floating-menu";
14
+ import { FtFloatingMenu, FtFloatingMenuItem, FtFloatingMenuLabel, } from "@fluid-topics/ft-floating-menu";
15
15
  import { getResultUrl } from "@fluid-topics/ft-search-result-context/build/utils";
16
16
  import { repeat } from "lit/directives/repeat.js";
17
17
  import { FtRipple } from "@fluid-topics/ft-ripple";
@@ -19,8 +19,8 @@ import { withI18n } from "@fluid-topics/ft-i18n/build/lit/i18n";
19
19
  import { readerMetadataContext } from "./ReaderMetadataMessages";
20
20
  import { withDateFormat } from "@fluid-topics/ft-app-context/build/mixins/withDateFormat";
21
21
  import { i18n } from "@fluid-topics/ft-i18n";
22
- import { FtReaderStoreEvents } from "@fluid-topics/ft-reader-context";
23
- import { FtAppInfoStoreName } from "@fluid-topics/ft-app-context";
22
+ import { addPivotQueryParam, FtReaderStoreEvents, } from "@fluid-topics/ft-reader-context";
23
+ import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
24
24
  import { MetadataValueLocalizer } from "./utils/MetadataValueLocalizer";
25
25
  class FtReaderMetadata extends withDateFormat(withI18n(FtReaderComponent)) {
26
26
  constructor() {
@@ -145,19 +145,14 @@ class FtReaderMetadata extends withDateFormat(withI18n(FtReaderComponent)) {
145
145
  }
146
146
  addTopicPivotParam(e, result) {
147
147
  const currentTocId = this.stateManager.store.getState().visibleTopics[0];
148
- if (currentTocId && result.type == "MAP") {
148
+ if (currentTocId && result.type == "MAP" && this.relativeTopicPivotMetadata) {
149
149
  e.stopPropagation();
150
150
  e.preventDefault();
151
- const tocNode = this.service.getTocNodeNow(currentTocId);
152
- this.service.getTopicInfo(tocNode).then((topicInfo) => {
151
+ this.service.getTopicMetadataValue(currentTocId, this.relativeTopicPivotMetadata).then((topicPivotMetadata) => {
153
152
  var _a;
154
- const topicPivotMetadataValue = topicInfo === null || topicInfo === void 0 ? void 0 : topicInfo.metadata.find((metadata) => metadata.key == this.relativeTopicPivotMetadata);
155
- const url = new URL((_a = getResultUrl(result)) !== null && _a !== void 0 ? _a : "");
156
- if (topicPivotMetadataValue) {
157
- topicPivotMetadataValue.values.forEach((value) => url.searchParams.append("topicPivot", value));
158
- }
153
+ const url = addPivotQueryParam((_a = getResultUrl(result)) !== null && _a !== void 0 ? _a : "", topicPivotMetadata);
159
154
  const link = document.createElement("a");
160
- link.href = url.toString();
155
+ link.href = url;
161
156
  if (e.ctrlKey || e.metaKey) {
162
157
  link.target = "_blank";
163
158
  }
@@ -252,7 +247,7 @@ __decorate([
252
247
  state()
253
248
  ], FtReaderMetadata.prototype, "relatives", void 0);
254
249
  __decorate([
255
- redux({ store: FtAppInfoStoreName })
250
+ redux({ store: ftAppInfoStore.name })
256
251
  ], FtReaderMetadata.prototype, "availableContentLocales", void 0);
257
252
  __decorate([
258
253
  i18n(readerMetadataContext.properties.itemWithNoValueForSwitchToRelatives())