@uniformdev/context-ui 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 +156 -0
  2. package/package.json +4 -4
@@ -0,0 +1,156 @@
1
+ import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
2
+ import { DimensionMatch, EnrichmentData, VariantMatchCriteria } from '@uniformdev/context';
3
+ import { InputComboBoxProps, InputComboBoxOption } from '@uniformdev/design-system';
4
+ export * from '@uniformdev/design-system';
5
+ import { DimensionDefinition, ManifestGetResponse } from '@uniformdev/context/api';
6
+ import React, { ComponentType, ReactElement } from 'react';
7
+ import * as _emotion_react from '@emotion/react';
8
+ import * as yup from 'yup';
9
+
10
+ type CriteriaOperatorMenuProps = {
11
+ value: DimensionMatch['op'];
12
+ onChange: (newValue: DimensionMatch['op']) => void;
13
+ } & Omit<InputComboBoxProps<InputComboBoxOption, false>, 'value' | 'options' | 'onChange'>;
14
+ declare const contextCriteriaMenuOperators: Array<{
15
+ name: string;
16
+ description?: string;
17
+ value: DimensionMatch['op'];
18
+ }>;
19
+ declare function CriteriaOperatorMenu({ onChange, value, ...props }: CriteriaOperatorMenuProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
20
+
21
+ interface ContextConfig {
22
+ projectId?: string;
23
+ apiHost: string;
24
+ apiKey: string;
25
+ }
26
+ type DimensionsData = {
27
+ dimensions: ResolvedDimensionDefinition[];
28
+ dimIndex: Record<string, ResolvedDimensionDefinition | undefined>;
29
+ };
30
+ type ResolvedDimensionDefinition = DimensionDefinition & {
31
+ displayName: string;
32
+ };
33
+
34
+ interface UseContextDataResult {
35
+ result: ManifestGetResponse | null;
36
+ error: string | null;
37
+ loading: boolean;
38
+ notConfigured: boolean;
39
+ }
40
+ declare function useContextData({ apiHost, apiKey, projectId }: ContextConfig): UseContextDataResult;
41
+
42
+ interface UseDimensionsResult {
43
+ result: DimensionsData | null;
44
+ error: string | null;
45
+ loading: boolean;
46
+ notConfigured: boolean;
47
+ }
48
+ declare function useDimensions({ apiHost, apiKey, projectId }: ContextConfig): UseDimensionsResult;
49
+
50
+ interface DataContextErrorProps {
51
+ contextConfig: ContextConfig;
52
+ result: UseContextDataResult | UseDimensionsResult;
53
+ }
54
+ interface ContextDataProps {
55
+ loadingComponent?: ComponentType;
56
+ errorComponent?: ComponentType<DataContextErrorProps>;
57
+ noIntentsComponent?: ComponentType<DataContextErrorProps>;
58
+ contextConfig: ContextConfig;
59
+ }
60
+ declare const ContextData: React.FC<React.PropsWithChildren<ContextDataProps>>;
61
+ declare function useContextConfig(): ContextConfig;
62
+ declare function useManifest(): ManifestGetResponse;
63
+ declare function useDimensionsDataContext(): DimensionsData;
64
+
65
+ type CriteriaMatchMenuProps = {
66
+ criteriaMatch: DimensionMatch;
67
+ dimensions: DimensionsData;
68
+ errorMessage?: string;
69
+ onChange: (newCriteria: DimensionMatch) => void;
70
+ } & Omit<InputComboBoxProps<InputComboBoxOption, false>, 'value' | 'options' | 'onChange' | 'inputValue' | 'value' | 'onInputChange'>;
71
+ declare function CriteriaMatchMenu({ onChange, criteriaMatch, dimensions, errorMessage, ...props }: CriteriaMatchMenuProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
72
+
73
+ type DimensionMenuProps = {
74
+ value?: ResolvedDimensionDefinition;
75
+ dimensions: ResolvedDimensionDefinition[];
76
+ errorMessage?: string;
77
+ onChange: (newValue: ResolvedDimensionDefinition) => void;
78
+ } & Omit<InputComboBoxProps<InputComboBoxOption, false>, 'value' | 'options' | 'onChange'>;
79
+ declare function DimensionMenu({ onChange, value, dimensions, errorMessage, ...props }: DimensionMenuProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
80
+
81
+ type DimensionValueProps = {
82
+ displayName: string;
83
+ };
84
+ declare function DimensionValue({ displayName }: DimensionValueProps): _emotion_react_types_jsx_namespace.EmotionJSX.Element;
85
+
86
+ type EditLinkProps = {
87
+ linkTo: string;
88
+ name?: string;
89
+ linkText?: string;
90
+ };
91
+ declare const EditLink: ({ linkTo, name, linkText }: EditLinkProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
92
+
93
+ declare const addEnrichmentLink: _emotion_react.SerializedStyles;
94
+ interface EnrichmentTagProps {
95
+ value: EnrichmentData[] | null | undefined;
96
+ setValue: (value: EnrichmentData[] | null) => void;
97
+ contextConfig: ContextConfig;
98
+ displayTitle?: boolean;
99
+ }
100
+ declare const EnrichmentTag: React.FC<EnrichmentTagProps>;
101
+
102
+ interface PersonalizationCriteriaStaticProps {
103
+ value: VariantMatchCriteria | null | undefined;
104
+ setValue: (value: VariantMatchCriteria | null) => void;
105
+ dimensions: DimensionsData;
106
+ displayTitle?: boolean;
107
+ onMenuOpen?: () => void;
108
+ onMenuClose?: () => void;
109
+ onAddCriteria?: (value: VariantMatchCriteria) => void;
110
+ onRemoveCriteria?: (value: VariantMatchCriteria | null) => void;
111
+ components?: {
112
+ NoDimensionsDefined?: React.ComponentType;
113
+ Title?: React.ComponentType;
114
+ CustomVariantName?: React.ComponentType;
115
+ };
116
+ errors?: {
117
+ lhs?: Array<string | undefined>;
118
+ rhs?: Array<string | undefined>;
119
+ };
120
+ }
121
+ declare const PersonalizationCriteriaStatic: React.FC<PersonalizationCriteriaStaticProps>;
122
+
123
+ type ParameterValidationError<TValue> = TValue extends string | number | boolean ? string : {
124
+ [key in keyof TValue]: ParameterValidationError<TValue[key]> | undefined;
125
+ };
126
+ declare function convertErrorsToObj(errors: yup.ValidationError[]): ParameterValidationError<VariantMatchCriteria>;
127
+ type PersonalizationCriteriaProps = {
128
+ contextConfig: ContextConfig;
129
+ } & Omit<PersonalizationCriteriaStaticProps, 'dimensions'>;
130
+ declare const PersonalizationCriteria: React.FC<PersonalizationCriteriaProps>;
131
+
132
+ type UIVersionProps = {
133
+ versionMap: Record<number, React.ComponentType>;
134
+ children?: React.ReactNode;
135
+ contextConfig: ContextConfig;
136
+ };
137
+ declare function ProjectUIVersion({ children, versionMap, contextConfig }: UIVersionProps): ReactElement;
138
+
139
+ interface UseValidateContextConfigResult {
140
+ validating: boolean;
141
+ error?: Error;
142
+ result?: ManifestGetResponse;
143
+ }
144
+ declare const useValidateContextConfig: (contextConfig?: ContextConfig) => UseValidateContextConfigResult;
145
+
146
+ declare function isEnrichmentTagData(obj: any): obj is EnrichmentData[];
147
+ declare function isPersonalizationCriteriaData(obj: any): obj is VariantMatchCriteria;
148
+ declare function opHasRhs(op: string): boolean;
149
+
150
+ declare const validateContextConfig: (contextConfig?: ContextConfig) => Promise<{
151
+ valid: boolean;
152
+ error?: Error;
153
+ result?: ManifestGetResponse;
154
+ }>;
155
+
156
+ export { ContextConfig, ContextData, ContextDataProps, CriteriaMatchMenu, CriteriaMatchMenuProps, CriteriaOperatorMenu, CriteriaOperatorMenuProps, DataContextErrorProps, DimensionMenu, DimensionMenuProps, DimensionValue, DimensionValueProps, DimensionsData, EditLink, EditLinkProps, EnrichmentTag, EnrichmentTagProps, PersonalizationCriteria, PersonalizationCriteriaProps, PersonalizationCriteriaStatic, PersonalizationCriteriaStaticProps, ProjectUIVersion, ResolvedDimensionDefinition, UseContextDataResult, UseDimensionsResult, UseValidateContextConfigResult, addEnrichmentLink, contextCriteriaMenuOperators, convertErrorsToObj, isEnrichmentTagData, isPersonalizationCriteriaData, opHasRhs, useContextConfig, useContextData, useDimensions, useDimensionsDataContext, useManifest, useValidateContextConfig, validateContextConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/context-ui",
3
- "version": "19.35.2",
3
+ "version": "19.36.0",
4
4
  "description": "React-based functionality and components for Uniform Context",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@emotion/react": "11.11.1",
35
- "@uniformdev/context": "19.35.2",
36
- "@uniformdev/design-system": "19.35.2",
35
+ "@uniformdev/context": "19.36.0",
36
+ "@uniformdev/design-system": "19.36.0",
37
37
  "immer": "9.0.21",
38
38
  "react-beautiful-dnd": "13.1.1",
39
39
  "react-icons": "^4.7.1",
@@ -75,5 +75,5 @@
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  },
78
- "gitHead": "64d3270175087c87cfaa29a283aa4a7b0a98fd2c"
78
+ "gitHead": "3ae246a7f0f39adeaf04ecba4c7e48c478c019ad"
79
79
  }