@dosgato/templating 0.0.133 → 0.0.135

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.
@@ -373,6 +373,12 @@ export interface DataData {
373
373
  savedAtVersion: string;
374
374
  [keys: string]: any;
375
375
  }
376
+ export interface AssetData<T = any> {
377
+ shasum: string;
378
+ uploadedFilename: string;
379
+ meta: T;
380
+ [keys: string]: any;
381
+ }
376
382
  export interface ContextBase {
377
383
  /**
378
384
  * For accessibility, every component should consider whether it is creating headers
@@ -130,6 +130,42 @@ 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
+ }
165
+ interface AssetMetaDisplay {
166
+ component: UITemplate['dialog'];
167
+ title: string;
168
+ }
133
169
  /**
134
170
  * A type for the config object that should be exported from a CMS instance's admin/local/index.js
135
171
  * to configure how that instance should work.
@@ -140,7 +176,7 @@ export interface UIConfig {
140
176
  /**
141
177
  * What to do when we get a 401 from the API. Generally we'll want to redirect
142
178
  * to our SSO login page. Since we use sveltekit we redirect by throwing:
143
- * `throw redirect(302, 'my.sso.org/login')`
179
+ * `throw redirect(302, 'https://my.sso.org/login')`
144
180
  */
145
181
  handleUnauthorized: (environmentConfig: any) => void;
146
182
  /**
@@ -180,7 +216,7 @@ export interface UIConfig {
180
216
  * If you use cookies or if your SSO provider uses cookies and would immediately log the user back in,
181
217
  * then you need to visit a logout endpoint instead of refreshing.
182
218
  *
183
- * Since we use sveltekit, you trigger navigation with `goto('my.sso.org/logout')`
219
+ * Since we use sveltekit, you trigger navigation with `goto('https://my.sso.org/logout')`
184
220
  */
185
221
  logout?: (environmentConfig: any, token: string) => void;
186
222
  };
@@ -192,7 +228,31 @@ export interface UIConfig {
192
228
  * If you would like to collect more information about assets from editors, you may provide a dialog
193
229
  * here. The data collected will be available when you retrieve assets.
194
230
  */
195
- assetMetaDialog?: UITemplate['dialog'];
231
+ assetMeta?: {
232
+ dialog: UITemplate['dialog'];
233
+ /**
234
+ * If you provide an assetMeta.dialog to collect extra details about each asset, you'll probably want to
235
+ * display those details on the asset detail screen. Provide this function to return a map of detail
236
+ * keys and values to be displayed alongside the other vitals like asset name, size, type, etc. Insertion
237
+ * order will be maintained.
238
+ */
239
+ details?: (data: any) => Record<string, string>;
240
+ /**
241
+ * If you provide an assetMeta.dialog to collect extra details about each asset, you may want to use
242
+ * assetMeta.details to show some of it, and/or you may want your own box on the detail page to do something
243
+ * cool and custom. Provide a svelte component here and it will be passed the asset object with all of
244
+ * its metadata so that you can draw whatever you like. Your content will be placed inside a box titled
245
+ * with the title property.
246
+ *
247
+ * Provide an array to be given multiple boxes.
248
+ */
249
+ display?: AssetMetaDisplay | AssetMetaDisplay[];
250
+ };
196
251
  tracing?: TracingInterface;
252
+ /** Non-Awaited async call for logging interface interactions if defined.
253
+ * Useful for defining how to log form submissions, interaction clicks, page edits, or state
254
+ * changes of different interfaces. Can be directed to separate endpoint for APM logging as
255
+ * long as that POST is also non-awaited. */
256
+ uiInteractionsLogger?: (info: UserEvent, environmentConfig: any) => void;
197
257
  }
198
258
  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.135",
4
4
  "description": "A library to support building templates for dosgato CMS.",
5
5
  "type": "module",
6
6
  "exports": {