@dosgato/templating 1.2.0 → 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,37 +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
- /** The larger UI area the user is interacting with that the event is emitted from.
215
- * @example 'ActionPanel', 'PageEditor', 'ComponentDialog' */
213
+ /** Common model for user interaction events in DosGato, designed to capture contextually
214
+ * important properties for analytics and metrics logging and create enough shared structure
215
+ * to make it easy to generate meaningful reports and insights. */
216
+ export interface UserEvent {
217
+ /**
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
+ */
223
+ screen: string;
224
+ /**
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.
227
+ *
228
+ * @example 'ActionPanel', 'PageEditor', 'ComponentDialog'
229
+ */
216
230
  eventType: string;
217
- /** The specific action the user took. Typically the label for the element that emits
218
- * the event.
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.
219
235
  * @example 'Add Page', 'Edit Page', 'Preview', 'Cancel Preview' */
220
236
  action: string;
221
- /** 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
237
+ /**
238
+ * The target of the action reported in the `action` property.
239
+ *
240
+ * Each component that logs an event should consider the best value to place here. It's best
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`.
246
+ *
247
+ * For example: When moving a page, the path of the page being moved. When moving many pages, the
248
+ * path of the page being moved into.
249
+ * @example '/site3-sandbox/about'
250
+ * */
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
223
255
  * in tools like elastic-search.
224
- * @warning This is NOT a catch-all property.
225
- * @example { hiddenLabel: action.hiddenLabel } // The aria label for an action element. */
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
+ */
226
262
  additionalProperties?: Record<string, string | undefined>;
227
- }
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. */
231
- 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' */
235
- 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.
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.
239
268
  *
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' */
243
- target: string;
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;
244
273
  }
245
274
  interface AssetMetaDisplay {
246
275
  component: UITemplate['dialog'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {