@dosgato/templating 1.1.18 → 1.2.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.
@@ -97,15 +97,31 @@ export interface APITemplate<DataType> {
97
97
  */
98
98
  getLinks?: LinkGatheringFn<DataType>;
99
99
  /**
100
- * Each template must provide the text from any text or rich editor data it possesses, so that
101
- * the text can be decomposed into words and indexed for fulltext searches. Any text returned
102
- * by this function will also be scanned for links.
103
- * Examples of text to include would be any text from data that's rendered as visible text content
100
+ * Each template must provide the plain text from its data so that it can be decomposed into
101
+ * words and indexed for fulltext searches. Any text returned by this function will also be
102
+ * scanned for links.
103
+ *
104
+ * Examples of text to include would be any plain text data that's rendered as visible content
104
105
  * but not things like dates and times.
106
+ *
107
+ * Rich text / HTML content should be returned via `getHtml` instead. Markup in `getFulltext`
108
+ * results will be indexed as-is, meaning tags and attributes will pollute the index.
109
+ *
105
110
  * @note You do not need to filter the text elements returned to ensure they're defined as that
106
111
  * can be done by the routine that calls `getFulltext`.
107
112
  */
108
113
  getFulltext?: FulltextGatheringFn<DataType>;
114
+ /**
115
+ * Return any HTML content from your template data so it can be parsed for indexing. The
116
+ * system will use cheerio to strip the markup and index the remaining text for fulltext
117
+ * search, and will also extract link targets (e.g. href attributes) before removing tags.
118
+ *
119
+ * This is preferable to stripping HTML yourself and returning it in getFulltext, because
120
+ * if you strip the markup yourself you'd also need to remember to extract and return links
121
+ * separately in getLinks. By returning the raw HTML here, both text and links are handled
122
+ * automatically in one place.
123
+ */
124
+ getHtml?: FulltextGatheringFn<DataType>;
109
125
  /**
110
126
  * Extra filters for this template
111
127
  *
@@ -211,35 +211,58 @@ export interface TracingInterface {
211
211
  event?: (name: string, details: any, env?: TracingEnvironment) => void;
212
212
  }
213
213
  export interface BaseEvent {
214
- /** The larger UI area the user is interacting with that the event is emitted from.
215
- * @example 'ActionPanel', 'PageEditor', 'ComponentDialog' */
214
+ /**
215
+ * The name of the UI component that is recording the event. This should help you track
216
+ * down where the event is being logged in the code.
217
+ *
218
+ * @example 'ActionPanel', 'PageEditor', 'ComponentDialog'
219
+ */
216
220
  eventType: string;
217
221
  /** The specific action the user took. Typically the label for the element that emits
218
222
  * the event.
219
223
  * @example 'Add Page', 'Edit Page', 'Preview', 'Cancel Preview' */
220
224
  action: string;
221
225
  /** Additional data points specific to a particular event type's context. These should
222
- * be significant enough to understanding the event to merrit adding additional columns
226
+ * be significant enough to understanding the event to merit adding additional columns
223
227
  * in tools like elastic-search.
224
- * @warning This is NOT a catch-all property.
228
+ * @warning This is NOT a catch-all property. It should be used for metrics an analytics
229
+ * report would be likely to filter or group by.
225
230
  * @example { hiddenLabel: action.hiddenLabel } // The aria label for an action element. */
226
231
  additionalProperties?: Record<string, string | undefined>;
227
232
  }
228
- /** Events triggered by user interactions with interface elements in DosGato. This interface
229
- * is intended to provide a common model for succinctly expressing the contextually important
230
- * properties of these events to loggers that can be pointed to analytics and metrics services. */
233
+ /** Common model for user interaction events in DosGato, designed to capture contextually
234
+ * important properties for analytics and metrics logging and create enough shared structure
235
+ * to make it easy to generate meaningful reports and insights. */
231
236
  export interface UserEvent extends BaseEvent {
232
- /** The page, screen, or dialog the user is looking at in which the associated event emitter is
233
- * in context to.
234
- * @example '/pages', '/pages/[id]', '/pages/[id]/dialog' */
237
+ /**
238
+ * The sveltekit route the user is looking at when the event is triggered.
239
+ *
240
+ * Some dialogs will add the dialog name after a '#' for extra context, but this behavior is
241
+ * deprecated.
242
+ * @example '/pages', '/pages/[id]', '/pages/[id]#dialog' (deprecated) */
235
243
  screen: string;
236
- /** The target the emitted event is to trigger actions on.
237
- * Each page/screen, or dialog, needs to set their target for what events in it are targeted
238
- * to act on in in its context.
244
+ /**
245
+ * Identify a section of the screen to help identify what the user was looking at when
246
+ * taking the action. Very useful for tabs that do not have their own sveltekit routes.
247
+ *
248
+ * Also, if interacting inside a modal dialog that has a title,
249
+ * the title of the dialog could go here.
250
+ *
251
+ * Do not duplicate eventType here.
252
+ */
253
+ section?: string;
254
+ /**
255
+ * The target of the action reported in the `action` property.
256
+ *
257
+ * Each component that logs an event should consider the best value to place here. It's best
258
+ * if it's human-readable (avoid numeric and UUIDs), specific enough to understand what the user
259
+ * was doing, but not so unique that an analytics search would never filter or group on it.
239
260
  *
240
- * For example: The page in the page tree of the Pages screen that ActionPanel actions,
241
- * such as edit or preview, will act on.
242
- * @example '/site3-sandbox/about' */
261
+ * For example: When moving a page, the path of the page being moved. When moving many pages, the
262
+ * path of the page being moved into. When adding a component to a page, the templateKey of the
263
+ * component being added.
264
+ * @example '/site3-sandbox/about', 'hero-banner'
265
+ * */
243
266
  target: string;
244
267
  }
245
268
  interface AssetMetaDisplay {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "1.1.18",
3
+ "version": "1.2.1",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {