@dosgato/templating 1.2.1 → 1.2.2

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.
@@ -210,60 +210,66 @@ export interface TracingInterface {
210
210
  endTransaction?: (name: string, details: any, env?: TracingEnvironment) => void;
211
211
  event?: (name: string, details: any, env?: TracingEnvironment) => void;
212
212
  }
213
- export interface BaseEvent {
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
- */
220
- eventType: string;
221
- /** The specific action the user took. Typically the label for the element that emits
222
- * the event.
223
- * @example 'Add Page', 'Edit Page', 'Preview', 'Cancel Preview' */
224
- action: string;
225
- /** Additional data points specific to a particular event type's context. These should
226
- * be significant enough to understanding the event to merit adding additional columns
227
- * in tools like elastic-search.
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.
230
- * @example { hiddenLabel: action.hiddenLabel } // The aria label for an action element. */
231
- additionalProperties?: Record<string, string | undefined>;
232
- }
233
213
  /** Common model for user interaction events in DosGato, designed to capture contextually
234
214
  * important properties for analytics and metrics logging and create enough shared structure
235
215
  * to make it easy to generate meaningful reports and insights. */
236
- export interface UserEvent extends BaseEvent {
216
+ export interface UserEvent {
237
217
  /**
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) */
218
+ * The sveltekit route the user is navigated to when the event is triggered. This should
219
+ * always be a sveltekit route with the param abstracted out. additionalProperties might have
220
+ * a full path to the page being acted on.
221
+ * @example '/pages', '/pages/[id]'
222
+ */
243
223
  screen: string;
244
224
  /**
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.
225
+ * An identifier for the log statement in the code. This should be human readable
226
+ * but also help developers find the log statement in the codebase.
247
227
  *
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.
228
+ * @example 'ActionPanel', 'PageEditor', 'ComponentDialog'
252
229
  */
253
- section?: string;
230
+ eventType: string;
231
+ /**
232
+ * The specific action the user took. If you are logging a button click, it's probably the
233
+ * button label. If you are logging a page view, whether it's a first page view or a CSR navigation.
234
+ * If you're logging a modal, 'Open', 'Success', 'Failed', 'Cancel', etc.
235
+ * @example 'Add Page', 'Edit Page', 'Preview', 'Cancel Preview' */
236
+ action: string;
254
237
  /**
255
238
  * The target of the action reported in the `action` property.
256
239
  *
257
240
  * 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.
241
+ * if it's human-readable (avoid numeric and UUIDs) and consistent enough to use in lots of different
242
+ * reports. In DosGato, we try to record the path to the page, asset, or data item being manipulated,
243
+ * even if the action is more fine-grained, like adding a component to a specific area. This allows us
244
+ * to make reports about pages being edited regardless of the type of edit. We can store the path to the
245
+ * area or component being edited in `additionalProperties`.
260
246
  *
261
247
  * 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'
248
+ * path of the page being moved into.
249
+ * @example '/site3-sandbox/about'
265
250
  * */
266
- target: string;
251
+ target?: string;
252
+ /**
253
+ * Additional data points specific to a particular event type's context. These should
254
+ * be significant enough to understanding the event to merit adding additional columns
255
+ * in tools like elastic-search.
256
+ *
257
+ * @warning This is NOT a catch-all property. It should be used for metrics an analytics
258
+ * report would be likely to filter or group by. Every new property name likely forces the
259
+ * analytics database to add a new column that is null for every event that doesn't use it.
260
+ * @example { path: 'areas.main' } // when adding a component, the area we're adding to
261
+ */
262
+ additionalProperties?: Record<string, string | undefined>;
263
+ /**
264
+ * In some cases `screen` may be too ambiguous to understand where the user was. For instance,
265
+ * a screen might have tabs at the top of the page that switch between very different functionalities
266
+ * without changing the sveltekit route. Or a dashboard might have multiple independent widgets and
267
+ * we'd like to know which they were interacting with.
268
+ *
269
+ * This property can be used in those situations to disambiguate. Use it when the deprecated
270
+ * `{ screen: '/pages/[id]#tab1' }` format would have made sense pre-deprecation.
271
+ */
272
+ section?: string;
267
273
  }
268
274
  interface AssetMetaDisplay {
269
275
  component: UITemplate['dialog'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {