@uniformdev/context-devtools 19.35.2 → 19.36.0

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.
Files changed (2) hide show
  1. package/dist/index.d.mts +84 -0
  2. package/package.json +5 -5
@@ -0,0 +1,84 @@
1
+ import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
2
+ import { VisitorData, OutputSeverity, DevToolsState, DevToolsActions, Context } from '@uniformdev/context';
3
+ import { ManifestV2 } from '@uniformdev/context/*';
4
+ import { DimensionDisplayData, Quirk } from '@uniformdev/context/api';
5
+
6
+ type FullDimensionData = DimensionDisplayData & {
7
+ cap: number;
8
+ str: number;
9
+ };
10
+ type DimensionIndexData = Record<string, FullDimensionData>;
11
+ /**
12
+ * Fetches dimension data in an indexed object from Uniform API
13
+ * If incomplete data is sent, returns empty index.
14
+ */
15
+ declare function useDimensionIndex({ apiHost, apiKey, projectId }: DevToolsSettings, manifest?: ManifestV2): {
16
+ loading: boolean;
17
+ error: Error | undefined;
18
+ index: DimensionIndexData;
19
+ };
20
+
21
+ type QuirkIndexHookType = {
22
+ loading: boolean;
23
+ error: Error | undefined;
24
+ index: QuirksIndexData;
25
+ };
26
+ type QuirksIndexData = Record<string, Quirk & {
27
+ value: string | undefined;
28
+ }>;
29
+ /**
30
+ * Fetches dimension data in an indexed object from Uniform API
31
+ * If incomplete data is sent, returns empty index.
32
+ */
33
+ declare function useQuirkIndex({ apiHost, apiKey, projectId }: DevToolsSettings, quirksData: VisitorData['quirks']): QuirkIndexHookType;
34
+
35
+ type Override<T> = {
36
+ initial: T;
37
+ override: T;
38
+ };
39
+ /** Settings for the DevTools. Stored **per-origin**. */
40
+ type DevToolsSettings = {
41
+ apiKey?: string;
42
+ projectId?: string;
43
+ apiHost?: string;
44
+ logLevel?: OutputSeverity;
45
+ /** Current route the app is on */
46
+ route?: string;
47
+ consentMode?: boolean;
48
+ ignoreApiKeyPrompt?: boolean;
49
+ scoreOverrides?: Record<string, Override<number>>;
50
+ quirkOverrides?: Record<string, Override<string>>;
51
+ };
52
+ type ContextDevToolsProps = {
53
+ state: DevToolsState;
54
+ actions: DevToolsActions;
55
+ settings: DevToolsSettings;
56
+ saveSettings: (settings: DevToolsSettings) => void | Promise<void>;
57
+ clearAllExtensionData: () => void | Promise<void>;
58
+ };
59
+ type ContextDevToolsRouteProps = ContextDevToolsProps & {
60
+ dimensionIndex: ReturnType<typeof useDimensionIndex>;
61
+ quirksIndex: ReturnType<typeof useQuirkIndex>;
62
+ };
63
+ declare function ContextDevTools(props: ContextDevToolsProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
64
+
65
+ type EmbeddedContextDevToolsProps = {
66
+ /**
67
+ * Pass a Context instance to connect to DevTools.
68
+ * This is optional, and defaults to a context instance registered in `window`
69
+ * when the `enableContextDevTools()` plugin is activated so no direct contact is required.
70
+ *
71
+ * Using the window interface enables you to render the DevTools in an isolated React app easily,
72
+ * or in non-React apps.
73
+ */
74
+ context?: Context;
75
+ /** Initial settings for the devtools. */
76
+ initialSettings?: DevToolsSettings;
77
+ };
78
+ /** Renders Uniform Context DevTools in an embedded state (as a React component that can be an island on a demo page, for example) */
79
+ declare function EmbeddedContextDevTools({ context, initialSettings }: EmbeddedContextDevToolsProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
80
+
81
+ /** Renders Uniform Context DevTools in an embedded state (as a React component that can be an island on a demo page, for example) */
82
+ declare function ToggleEmbeddedContextDevTools(props: EmbeddedContextDevToolsProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element | null;
83
+
84
+ export { ContextDevTools, ContextDevToolsProps, ContextDevToolsRouteProps, DevToolsSettings, EmbeddedContextDevTools, EmbeddedContextDevToolsProps, Override, ToggleEmbeddedContextDevTools };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/context-devtools",
3
- "version": "19.35.2",
3
+ "version": "19.36.0",
4
4
  "description": "Uniform Context developer tools components",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -27,12 +27,12 @@
27
27
  "postcss": "8.4.25",
28
28
  "react": "18.2.0",
29
29
  "react-dom": "18.2.0",
30
- "tsup": "7.0.0"
30
+ "tsup": "7.1.0"
31
31
  },
32
32
  "dependencies": {
33
33
  "@emotion/react": "11.11.1",
34
- "@uniformdev/context": "19.35.2",
35
- "@uniformdev/design-system": "19.35.2",
34
+ "@uniformdev/context": "19.36.0",
35
+ "@uniformdev/design-system": "19.36.0",
36
36
  "formik": "^2.2.9",
37
37
  "react-use": "^17.4.0",
38
38
  "reakit": "^1.3.11",
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "64d3270175087c87cfaa29a283aa4a7b0a98fd2c"
47
+ "gitHead": "3ae246a7f0f39adeaf04ecba4c7e48c478c019ad"
48
48
  }