@sitevision/api 2023.4.2 → 2023.7.1

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.
@@ -6,6 +6,13 @@ export interface Events {
6
6
  * @param callback The callback to trigger for the given event
7
7
  */
8
8
  on(eventName: string, callback: (options: unknown) => void): void;
9
+ /**
10
+ * Stop listening to a given event
11
+ *
12
+ * @param eventName The name of the event
13
+ * @param callback The callback to remove for the given event
14
+ */
15
+ off(eventName: string, callback: (options: unknown) => void): void;
9
16
  /**
10
17
  * Emit a server side event
11
18
  *
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
8
  on: function on() {},
9
+ off: function off() {},
9
10
  emit: function emit() {},
10
11
  trigger: function trigger() {}
11
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitevision/api",
3
- "version": "2023.4.2",
3
+ "version": "2023.7.1",
4
4
  "author": "Sitevision AB",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,5 +30,5 @@
30
30
  "access": "public",
31
31
  "directory": "dist"
32
32
  },
33
- "gitHead": "d62f9d215ffe1ca955e21ddfdca8b13cb248187a"
33
+ "gitHead": "82ca2d8a879430864a9007130b263e6ae8b05c8e"
34
34
  }
@@ -54,6 +54,36 @@ export interface NodeTreeUtil {
54
54
  */
55
55
  isDescendantOf(aDescendantNode: Node, aParentNode: Node): boolean;
56
56
 
57
+ /**
58
+ * Returns a top-down list of all web nodes from the site page down to a specified page tree node.
59
+ *
60
+ * <p>
61
+ * This method traverses the site page tree and returns a list of all web nodes, from the site page to a descendant.
62
+ * The tree traversal will use a maximum tree depth of 50. If the specified node is deeper down in the tree than that,
63
+ * an incomplete list will be returned (top nodes will be missing).
64
+ * </p>
65
+ *
66
+ * <p>
67
+ * <em>Note!</em> Mentioned "web nodes" are by this method considered to be all child nodes of the site page node you
68
+ * can see in the Sitevision editor Navigator that are accessible from the location bar of a browser (e.g. pages and articles
69
+ * but not folders and archives). File and image nodes are also recognized as web nodes - even if they are in the "site global"
70
+ * archive (i.e. in the site tree, not actually in the site page tree).
71
+ *
72
+ * In other words, though they are accessible from the location bar of a browser - a portlet node or layout node is <em>not</em>
73
+ * considered to be a web node by this method.
74
+ * </p>
75
+ *
76
+ * <p>
77
+ * <em>Tip! If you should render a linked "path to this page", consider using the <code>renderWebPathNodes</code>
78
+ * utility of {@link senselogic.sitevision.api.render.OutputUtil}.</em>
79
+ * </p>
80
+ * @param aDescendantNode a page tree node that is a descendant/child of the site page, typically a sv:page or sv:article
81
+ * @return a top-down list of the web nodes that are in the tree path from the site page node downto <code>aDescendantNode</code>&#xA; (the site page node and the descendant node are both included in the list).&#xA; An empty list will be returned if <code>aDescendantNode</code> is <code>null</code> or not a descendant of the site page.
82
+ * @since Sitevision 2.6.1_06
83
+ * @see senselogic.sitevision.api.render.OutputUtil#renderWebPathNodes(javax.jcr.Node, senselogic.sitevision.api.render.LinkRenderer, String)
84
+ */
85
+ getWebPathNodes(aDescendantNode: Node): List;
86
+
57
87
  /**
58
88
  * Find a portlet with a specific name on a page node.
59
89
  *
@@ -196,34 +226,129 @@ export interface NodeTreeUtil {
196
226
  ): List;
197
227
 
198
228
  /**
199
- * Returns a top-down list of all web nodes from the site page down to a specified page tree node.
229
+ * Find all portlets on a page node and applies a node filter to the result.
200
230
  *
201
231
  * <p>
202
- * This method traverses the site page tree and returns a list of all web nodes, from the site page to a descendant.
203
- * The tree traversal will use a maximum tree depth of 50. If the specified node is deeper down in the tree than that,
204
- * an incomplete list will be returned (top nodes will be missing).
232
+ * <em>Tip!</em> {@link senselogic.sitevision.api.node.NodeFilterUtil} can be used to create a node filter.
205
233
  * </p>
234
+ * @param aPageNode the page node that has content, typically a sv:page or sv:article
235
+ * @param aNodeFilter a node filter to refine the result of all portlets
236
+ * @return all occurrences of portlets that also applies to the aNodeFilter filter.&#xA; If no such portlets can be found or if aPageNode is not a page node, an empty List is returned
237
+ * @since Sitevision 2023.07.1
238
+ */
239
+ findPortlets(aPageNode: Node, aNodeFilter: Filter): List;
240
+
241
+ /**
242
+ * Find a layout with a specific name on a page node.
206
243
  *
207
244
  * <p>
208
- * <em>Note!</em> Mentioned "web nodes" are by this method considered to be all child nodes of the site page node you
209
- * can see in the Sitevision editor Navigator that are accessible from the location bar of a browser (e.g. pages and articles
210
- * but not folders and archives). File and image nodes are also recognized as web nodes - even if they are in the "site global"
211
- * archive (i.e. in the site tree, not actually in the site page tree).
245
+ * The <em>name</em> of the layout is determined by the <em>displayName</em> property.
246
+ * </p>
247
+ * <p>
248
+ * This method handles layouts of container-type (layout nodes that can have children), such as:
249
+ * </p>
250
+ * <ul>
251
+ * <li><code>sv:referenceLayout</code></li>
252
+ * <li><code>sv:layout</code></li>
253
+ * <li><code>sv:view</code></li>
254
+ * <li><code>sv:profileView</code></li>
255
+ * </ul>
256
+ * <p>
257
+ * <em>(i.e. this method does not handle the flat, non-container type <code>sv:linkedLayout</code>)</em>
258
+ * </p>
259
+ * @param aPageNode the page node that has content, typically a sv:page or sv:article
260
+ * @param aLayoutName the name of the layout that should be found
261
+ * @return the first occurrence of a layout with name aLayoutName, or null if no such layout can be found&#xA; or if aPageNode is not a page node
262
+ * @see #findLayoutsByName(Node, String)
263
+ * @since Sitevision 2023.07.1
264
+ */
265
+ findLayoutByName(aPageNode: Node, aLayoutName: String | string): Node;
266
+
267
+ /**
268
+ * Find all layouts with a specific name on a page node.
212
269
  *
213
- * In other words, though they are accessible from the location bar of a browser - a portlet node or layout node is <em>not</em>
214
- * considered to be a web node by this method.
270
+ * <p>
271
+ * The <em>name</em> of the layout is determined by the <em>displayName</em> property.
272
+ * </p>
273
+ * <p>
274
+ * This method handles layouts of container-type (layout nodes that can have children), such as:
215
275
  * </p>
276
+ * <ul>
277
+ * <li><code>sv:referenceLayout</code></li>
278
+ * <li><code>sv:layout</code></li>
279
+ * <li><code>sv:view</code></li>
280
+ * <li><code>sv:profileView</code></li>
281
+ * </ul>
282
+ * <p>
283
+ * <em>(i.e. this method does not handle the flat, non-container type <code>sv:linkedLayout</code>)</em>
284
+ * </p>
285
+ * @param aPageNode the page node that has content, typically a sv:page or sv:article
286
+ * @param aLayoutName the name of the layouts that should be found
287
+ * @return all occurrences of layouts with name aLayoutName. If no such layouts can be found or if aPageNode is not a page node,&#xA; an empty List is returned
288
+ * @see #findLayoutsByName(Node, String, Filter)
289
+ * @since Sitevision 2023.07.1
290
+ */
291
+ findLayoutsByName(aPageNode: Node, aLayoutName: String | string): List;
292
+
293
+ /**
294
+ * Find all layouts with a specific name on a page node and applies a node filter to the result.
216
295
  *
217
296
  * <p>
218
- * <em>Tip! If you should render a linked "path to this page", consider using the <code>renderWebPathNodes</code>
219
- * utility of {@link senselogic.sitevision.api.render.OutputUtil}.</em>
297
+ * The <em>name</em> of the layout is determined by the <em>displayName</em> property.
220
298
  * </p>
221
- * @param aDescendantNode a page tree node that is a descendant/child of the site page, typically a sv:page or sv:article
222
- * @return a top-down list of the web nodes that are in the tree path from the site page node downto <code>aDescendantNode</code>&#xA; (the site page node and the descendant node are both included in the list).&#xA; An empty list will be returned if <code>aDescendantNode</code> is <code>null</code> or not a descendant of the site page.
223
- * @since Sitevision 2.6.1_06
224
- * @see senselogic.sitevision.api.render.OutputUtil#renderWebPathNodes(javax.jcr.Node, senselogic.sitevision.api.render.LinkRenderer, String)
299
+ * <p>
300
+ * This method handles layouts of container-type (layout nodes that can have children), such as:
301
+ * </p>
302
+ * <ul>
303
+ * <li><code>sv:referenceLayout</code></li>
304
+ * <li><code>sv:layout</code></li>
305
+ * <li><code>sv:view</code></li>
306
+ * <li><code>sv:profileView</code></li>
307
+ * </ul>
308
+ * <p>
309
+ * <em>(i.e. this method does not handle the flat, non-container type <code>sv:linkedLayout</code>)</em>
310
+ * </p>
311
+ *
312
+ * <p>
313
+ * <em>Tip!</em> {@link senselogic.sitevision.api.node.NodeFilterUtil} can be used to create a node filter.
314
+ * </p>
315
+ * @param aPageNode the page node that has content, typically a sv:page or sv:article
316
+ * @param aLayoutName the name of the layouts that should be found
317
+ * @param aNodeFilter a node filter to refine the result of all layouts with matching name
318
+ * @return all occurrences of layouts with name aLayoutName that also applies to the aNodeFilter filter.&#xA; If no such layouts can be found or if aPageNode is not a page node, an empty List is returned
319
+ * @since Sitevision 2023.07.1
225
320
  */
226
- getWebPathNodes(aDescendantNode: Node): List;
321
+ findLayoutsByName(
322
+ aPageNode: Node,
323
+ aLayoutName: String | string,
324
+ aNodeFilter: Filter
325
+ ): List;
326
+
327
+ /**
328
+ * Find all layouts on a page node and applies a node filter to the result.
329
+ *
330
+ * <p>
331
+ * This method handles layouts of container-type (layout nodes that can have children), such as:
332
+ * </p>
333
+ * <ul>
334
+ * <li><code>sv:referenceLayout</code></li>
335
+ * <li><code>sv:layout</code></li>
336
+ * <li><code>sv:view</code></li>
337
+ * <li><code>sv:profileView</code></li>
338
+ * </ul>
339
+ * <p>
340
+ * <em>(i.e. this method does not handle the flat, non-container type <code>sv:linkedLayout</code>)</em>
341
+ * </p>
342
+ *
343
+ * <p>
344
+ * <em>Tip!</em> {@link senselogic.sitevision.api.node.NodeFilterUtil} can be used to create a node filter.
345
+ * </p>
346
+ * @param aPageNode the page node that has content, typically a sv:page or sv:article
347
+ * @param aNodeFilter a node filter to refine the result of all layouts
348
+ * @return all occurrences of layouts that also applies to the aNodeFilter filter.&#xA; If no such layouts can be found or if aPageNode is not a page node, an empty List is returned
349
+ * @since Sitevision 2023.07.1
350
+ */
351
+ findLayouts(aPageNode: Node, aNodeFilter: Filter): List;
227
352
  }
228
353
 
229
354
  declare namespace NodeTreeUtil {}
@@ -8,9 +8,13 @@ var _default = {
8
8
  getNode: function getNode() {},
9
9
  getParent: function getParent() {},
10
10
  isDescendantOf: function isDescendantOf() {},
11
+ getWebPathNodes: function getWebPathNodes() {},
11
12
  findPortletByName: function findPortletByName() {},
12
13
  findPortletsByName: function findPortletsByName() {},
13
14
  findPortletsByType: function findPortletsByType() {},
14
- getWebPathNodes: function getWebPathNodes() {}
15
+ findPortlets: function findPortlets() {},
16
+ findLayoutByName: function findLayoutByName() {},
17
+ findLayoutsByName: function findLayoutsByName() {},
18
+ findLayouts: function findLayouts() {}
15
19
  };
16
20
  exports["default"] = _default;
@@ -786,7 +786,7 @@ export type SearchHit = SearchHitConstants & {
786
786
  getType(): number;
787
787
 
788
788
  /**
789
- * Returns a jQuery expression with a token that enables tracking of search hit clicks.
789
+ * Returns a jQuery expression for tracking of clicks on this search hit.
790
790
  *
791
791
  * <p>
792
792
  * Tracking search hits clicks is a helpful tool when analyzing if visitors seems to find interesting information in their search results.
@@ -799,11 +799,18 @@ export type SearchHit = SearchHitConstants & {
799
799
  * When rendering links to search hits with the {@link senselogic.sitevision.api.render.LinkRenderer}, apply the click tracking callback via
800
800
  * {@link senselogic.sitevision.api.render.LinkRenderer#setOnclick(String)}
801
801
  * </p>
802
- * @return a click tracking callback jQuery expression
802
+ * @return a click tracking callback jQuery expression, or null if query logging inactive or unavailable
803
803
  * @since Sitevision 3.0
804
804
  */
805
805
  getClickTrackingCallback(): string;
806
806
 
807
+ /**
808
+ * Returns the uri for tracking of clicks on this search hit.
809
+ * @return a click tracking uri, or null if query logging inactive or unavailable
810
+ * @since Sitevision 2023.07.1
811
+ */
812
+ getClickTrackingUri(): string;
813
+
807
814
  /**
808
815
  * <p>Indicates that the hit is an internal resource managed by the Sitevision server</p>
809
816
 
@@ -30,6 +30,7 @@ var _default = {
30
30
  getScore: function getScore() {},
31
31
  isElevated: function isElevated() {},
32
32
  getType: function getType() {},
33
- getClickTrackingCallback: function getClickTrackingCallback() {}
33
+ getClickTrackingCallback: function getClickTrackingCallback() {},
34
+ getClickTrackingUri: function getClickTrackingUri() {}
34
35
  };
35
36
  exports["default"] = _default;