@salesforcedevs/docs-components 1.3.124-old-version-banner-2 → 1.3.124-old-version-banner-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.
- package/package.json +1 -1
- package/src/modules/doc/amfReference/amfReference.css +1 -1
- package/src/modules/doc/amfReference/amfReference.ts +22 -30
- package/src/modules/doc/phase/phase.html +1 -1
- package/src/modules/doc/phase/phase.ts +8 -9
- package/src/modules/doc/xmlContent/types.ts +3 -0
- package/src/modules/doc/xmlContent/xmlContent.ts +19 -6
- package/src/modules/docUtils/utils/utils.ts +7 -0
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@ doc-phase:nth-child(2)::part(container) {
|
|
|
14
14
|
border-bottom: 1px solid #f9e3b6 !important;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
/* We don't want second component to sticky as we need to handle different cases like position*/
|
|
17
|
+
/* We don't want second component to sticky as we need to handle different cases like position */
|
|
18
18
|
doc-phase:nth-child(2) {
|
|
19
19
|
position: static;
|
|
20
20
|
}
|
|
@@ -44,16 +44,16 @@ export default class AmfReference extends LightningElement {
|
|
|
44
44
|
@track
|
|
45
45
|
protected topicModel!: TopicModel;
|
|
46
46
|
|
|
47
|
+
get isVersionEnabled(): boolean {
|
|
48
|
+
return !!this._referenceSetConfig?.versions?.length;
|
|
49
|
+
}
|
|
50
|
+
|
|
47
51
|
/*TODO: Get the info based on logic*/
|
|
48
52
|
@api oldVersionInfo = {
|
|
49
53
|
title: "Newer Version Available",
|
|
50
54
|
body: `This content describes an older version of this product. <a style="font-weight: bold;" href="https://developer.salesforce.com/">
|
|
51
|
-
View Latest</a
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
get isVersionEnabled(): boolean {
|
|
55
|
-
return !!this._referenceSetConfig?.versions?.length;
|
|
56
|
-
}
|
|
55
|
+
View Latest</a>`
|
|
56
|
+
};
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* Gives if the currently selected reference is spec based or not
|
|
@@ -174,12 +174,10 @@ export default class AmfReference extends LightningElement {
|
|
|
174
174
|
constructor() {
|
|
175
175
|
super();
|
|
176
176
|
|
|
177
|
-
this._boundOnApiNavigationChanged =
|
|
178
|
-
this
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
this
|
|
182
|
-
);
|
|
177
|
+
this._boundOnApiNavigationChanged =
|
|
178
|
+
this.onApiNavigationChanged.bind(this);
|
|
179
|
+
this._boundUpdateSelectedItemFromUrlQuery =
|
|
180
|
+
this.updateSelectedItemFromUrlQuery.bind(this);
|
|
183
181
|
}
|
|
184
182
|
|
|
185
183
|
connectedCallback(): void {
|
|
@@ -235,9 +233,8 @@ export default class AmfReference extends LightningElement {
|
|
|
235
233
|
const updatedReferenceId =
|
|
236
234
|
oldReferenceIdNewReferenceIdMap[referenceId];
|
|
237
235
|
const newReferenceId = updatedReferenceId || referenceId;
|
|
238
|
-
const referenceItemConfig =
|
|
239
|
-
newReferenceId
|
|
240
|
-
);
|
|
236
|
+
const referenceItemConfig =
|
|
237
|
+
this.getAmfConfigWithId(newReferenceId);
|
|
241
238
|
if (referenceItemConfig) {
|
|
242
239
|
hashBasedRedirectUrl = `${referenceItemConfig.href}?meta=${encodedMeta}`;
|
|
243
240
|
}
|
|
@@ -306,9 +303,8 @@ export default class AmfReference extends LightningElement {
|
|
|
306
303
|
for (let i = 0; i < allVersions.length; i++) {
|
|
307
304
|
const versionItem = allVersions[i];
|
|
308
305
|
const referenceLink = versionItem.link.href;
|
|
309
|
-
const referenceId =
|
|
310
|
-
referenceLink
|
|
311
|
-
);
|
|
306
|
+
const referenceId =
|
|
307
|
+
this.getReferenceIdFromUrl(referenceLink);
|
|
312
308
|
if (this._currentReferenceId === referenceId) {
|
|
313
309
|
// This is to navigate to respective topic in the changed version
|
|
314
310
|
versionItem.link.href = `${referenceLink}/${currentRefMeta}`;
|
|
@@ -1233,12 +1229,10 @@ export default class AmfReference extends LightningElement {
|
|
|
1233
1229
|
}
|
|
1234
1230
|
if (!isRedirecting) {
|
|
1235
1231
|
const currentReferenceUrl = window.location.href;
|
|
1236
|
-
const referenceMeta =
|
|
1237
|
-
currentReferenceUrl
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
currentReferenceUrl
|
|
1241
|
-
);
|
|
1232
|
+
const referenceMeta =
|
|
1233
|
+
this.getMarkdownReferenceMeta(currentReferenceUrl);
|
|
1234
|
+
const selectedItemRefId =
|
|
1235
|
+
this.getReferenceIdFromUrl(currentReferenceUrl);
|
|
1242
1236
|
const referenceDetails = this.getRefDetailsForGivenTopicMeta(
|
|
1243
1237
|
selectedItemRefId,
|
|
1244
1238
|
referenceMeta
|
|
@@ -1277,9 +1271,8 @@ export default class AmfReference extends LightningElement {
|
|
|
1277
1271
|
const name = event.detail.name;
|
|
1278
1272
|
if (name) {
|
|
1279
1273
|
const urlReferenceId = this.getReferenceIdFromUrl(name);
|
|
1280
|
-
const specBasedReference =
|
|
1281
|
-
urlReferenceId
|
|
1282
|
-
);
|
|
1274
|
+
const specBasedReference =
|
|
1275
|
+
this.isSpecBasedReference(urlReferenceId);
|
|
1283
1276
|
if (specBasedReference) {
|
|
1284
1277
|
const metaVal = this.getMetaFromUrl(name);
|
|
1285
1278
|
const currentSelectedMeta = this.selectedTopic
|
|
@@ -1329,9 +1322,8 @@ export default class AmfReference extends LightningElement {
|
|
|
1329
1322
|
const currentReferenceId = this.getReferenceIdFromUrl(currentUrl);
|
|
1330
1323
|
//No need to do anything if user is expanding currently selected reference
|
|
1331
1324
|
if (referenceId !== currentReferenceId) {
|
|
1332
|
-
const isSpecBasedReference =
|
|
1333
|
-
referenceId
|
|
1334
|
-
);
|
|
1325
|
+
const isSpecBasedReference =
|
|
1326
|
+
this.isSpecBasedReference(referenceId);
|
|
1335
1327
|
if (isSpecBasedReference) {
|
|
1336
1328
|
// Perform functionality same as item selection
|
|
1337
1329
|
this.onNavSelect(event);
|
|
@@ -7,7 +7,7 @@ import { toJson, normalizeBoolean } from "dxUtils/normalizers";
|
|
|
7
7
|
export default class Phase extends LightningElement {
|
|
8
8
|
_docPhaseInfo: DocPhaseInfo | null = null;
|
|
9
9
|
_dismissible = false;
|
|
10
|
-
_iconName =
|
|
10
|
+
_iconName = "recipe";
|
|
11
11
|
|
|
12
12
|
@api
|
|
13
13
|
get docPhaseInfo(): DocPhaseInfo | null {
|
|
@@ -67,9 +67,8 @@ export default class Phase extends LightningElement {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
renderedCallback() {
|
|
70
|
-
const phaseBodyContainer =
|
|
71
|
-
".doc-phase-body"
|
|
72
|
-
);
|
|
70
|
+
const phaseBodyContainer =
|
|
71
|
+
this.template.querySelector(".doc-phase-body");
|
|
73
72
|
if (phaseBodyContainer && this.docPhaseInfo) {
|
|
74
73
|
// eslint-disable-next-line @lwc/lwc/no-inner-html
|
|
75
74
|
phaseBodyContainer.innerHTML = this.docPhaseInfo.body;
|
|
@@ -79,16 +78,16 @@ export default class Phase extends LightningElement {
|
|
|
79
78
|
onShowHide() {
|
|
80
79
|
this.isBodyHidden = !this.isBodyHidden;
|
|
81
80
|
}
|
|
82
|
-
|
|
83
|
-
onDismiss(){
|
|
81
|
+
|
|
82
|
+
onDismiss() {
|
|
84
83
|
this.dispatchEvent(
|
|
85
|
-
new CustomEvent("
|
|
86
|
-
detail: {
|
|
84
|
+
new CustomEvent("dismissphase", {
|
|
85
|
+
detail: {
|
|
87
86
|
docPhaseInfo: this.docPhaseInfo
|
|
88
87
|
},
|
|
89
88
|
composed: true,
|
|
90
89
|
bubbles: true
|
|
91
90
|
})
|
|
92
|
-
);
|
|
91
|
+
);
|
|
93
92
|
}
|
|
94
93
|
}
|
|
@@ -14,7 +14,8 @@ import {
|
|
|
14
14
|
} from "./types";
|
|
15
15
|
import { SearchSyncer } from "docUtils/SearchSyncer";
|
|
16
16
|
import { LightningElementWithState } from "docBaseElements/lightningElementWithState";
|
|
17
|
-
import {
|
|
17
|
+
import { oldVersionDocInfo } from "docUtils/utils"
|
|
18
|
+
import { Breadcrumb, DocPhaseInfo, Language } from "typings/custom";
|
|
18
19
|
|
|
19
20
|
// TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
|
|
20
21
|
const handleContentError = (error): void => console.log(error);
|
|
@@ -34,11 +35,23 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
34
35
|
@api coveoPublicAccessToken!: string;
|
|
35
36
|
@api coveoSearchHub!: string;
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
@api
|
|
39
|
+
get oldVersionInfo(): DocPhaseInfo | null {
|
|
40
|
+
let info = null;
|
|
41
|
+
if (!this.disableVersion) {
|
|
42
|
+
const currentGAVersion = this.versionOptions.find((version) => version.url.includes(version.id));
|
|
43
|
+
if (currentGAVersion?.link?.href) {
|
|
44
|
+
const versionNo = currentGAVersion.id;
|
|
45
|
+
/**
|
|
46
|
+
* Need to show old version doc banner only if the version is less than the current ga version
|
|
47
|
+
* We should not show it to the preview version whose version is more than ga
|
|
48
|
+
**/
|
|
49
|
+
if (parseFloat(this.version.id) < parseFloat(versionNo)) {
|
|
50
|
+
info = oldVersionDocInfo(currentGAVersion.link.href)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return info;
|
|
42
55
|
}
|
|
43
56
|
|
|
44
57
|
@api
|