@dosgato/templating 0.0.133 → 0.0.134

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.
@@ -130,6 +130,38 @@ export interface TracingInterface {
130
130
  endTransaction?: (name: string, details: any, env?: TracingEnvironment) => void;
131
131
  event?: (name: string, details: any, env?: TracingEnvironment) => void;
132
132
  }
133
+ export interface BaseEvent {
134
+ /** The larger UI area the user is interacting with that the event is emitted from.
135
+ * @example 'ActionPanel', 'PageEditor', 'ComponentDialog' */
136
+ eventType: string;
137
+ /** The specific action the user took. Typically the label for the element that emits
138
+ * the event.
139
+ * @example 'Add Page', 'Edit Page', 'Preview', 'Cancel Preview' */
140
+ action: string;
141
+ /** Additional data points specific to a particular event type's context. These should
142
+ * be significant enough to understanding the event to merrit adding additional columns
143
+ * in tools like elastic-search.
144
+ * @warning This is NOT a catch-all property.
145
+ * @example { hiddenLabel: action.hiddenLabel } // The aria label for an action element. */
146
+ additionalProperties?: Record<string, string | undefined>;
147
+ }
148
+ /** Events triggered by user interactions with interface elements in DosGato. This interface
149
+ * is intended to provide a common model for succinctly expressing the contextually important
150
+ * properties of these events to loggers that can be pointed to analytics and metrics services. */
151
+ export interface UserEvent extends BaseEvent {
152
+ /** The page, screen, or dialog the user is looking at in which the associated event emitter is
153
+ * in context to.
154
+ * @example '/pages', '/pages/[id]', '/pages/[id]/dialog' */
155
+ screen: string;
156
+ /** The target the emitted event is to trigger actions on.
157
+ * Each page/screen, or dialog, needs to set their target for what events in it are targeted
158
+ * to act on in in its context.
159
+ *
160
+ * For example: The page in the page tree of the Pages screen that ActionPanel actions,
161
+ * such as edit or preview, will act on.
162
+ * @example '/site3-sandbox/about' */
163
+ target: string;
164
+ }
133
165
  /**
134
166
  * A type for the config object that should be exported from a CMS instance's admin/local/index.js
135
167
  * to configure how that instance should work.
@@ -140,7 +172,7 @@ export interface UIConfig {
140
172
  /**
141
173
  * What to do when we get a 401 from the API. Generally we'll want to redirect
142
174
  * to our SSO login page. Since we use sveltekit we redirect by throwing:
143
- * `throw redirect(302, 'my.sso.org/login')`
175
+ * `throw redirect(302, 'https://my.sso.org/login')`
144
176
  */
145
177
  handleUnauthorized: (environmentConfig: any) => void;
146
178
  /**
@@ -180,7 +212,7 @@ export interface UIConfig {
180
212
  * If you use cookies or if your SSO provider uses cookies and would immediately log the user back in,
181
213
  * then you need to visit a logout endpoint instead of refreshing.
182
214
  *
183
- * Since we use sveltekit, you trigger navigation with `goto('my.sso.org/logout')`
215
+ * Since we use sveltekit, you trigger navigation with `goto('https://my.sso.org/logout')`
184
216
  */
185
217
  logout?: (environmentConfig: any, token: string) => void;
186
218
  };
@@ -194,5 +226,10 @@ export interface UIConfig {
194
226
  */
195
227
  assetMetaDialog?: UITemplate['dialog'];
196
228
  tracing?: TracingInterface;
229
+ /** Non-Awaited async call for logging interface interactions if defined.
230
+ * Useful for defining how to log form submissions, interaction clicks, page edits, or state
231
+ * changes of different interfaces. Can be directed to separate endpoint for APM logging as
232
+ * long as that POST is also non-awaited. */
233
+ uiInteractionsLogger?: (info: UserEvent, environmentConfig: any) => void;
197
234
  }
198
235
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dosgato/templating",
3
- "version": "0.0.133",
3
+ "version": "0.0.134",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {