@evoke-platform/context 1.3.0-testing.4 → 1.3.0-testing.6
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.
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ available and no further installation is necessary.
|
|
|
17
17
|
|
|
18
18
|
- [Working With Objects](#working-with-objects)
|
|
19
19
|
- [REST API Calls](#rest-api-calls)
|
|
20
|
+
- [Authentication Context](#authentication-context)
|
|
20
21
|
- [Notifications](#notifications)
|
|
21
22
|
|
|
22
23
|
### Working With Objects
|
|
@@ -222,6 +223,25 @@ absolute URL.
|
|
|
222
223
|
|
|
223
224
|
##### `delete(url, options)`
|
|
224
225
|
|
|
226
|
+
### Authentication Context
|
|
227
|
+
|
|
228
|
+
- [useAuthenticationContext](#useauthenticationcontext)
|
|
229
|
+
|
|
230
|
+
#### `useAuthenticationContext()`
|
|
231
|
+
|
|
232
|
+
Hook to obtain the authentication context based on the current logged-in user.
|
|
233
|
+
|
|
234
|
+
The authentication context includes the following property and functions.
|
|
235
|
+
|
|
236
|
+
- `account` _[object]_
|
|
237
|
+
- The account of the currently logged-in user. This includes both the user's `id` and `name`.
|
|
238
|
+
- `logout()`
|
|
239
|
+
- A function that logs out the currently logged-in user. The user will be redirected to Evoke's logout page upon logout.
|
|
240
|
+
- `getAccessToken()`
|
|
241
|
+
- A function that returns an access token that is associated to the currently logged-in user. This token can be used to make API calls to Evoke's APIs to authenticate the API call.
|
|
242
|
+
- Note: As a general recommendation, the [ApiService](#class-apiservices) class should be used to make API calls as it will take care
|
|
243
|
+
of appending an access token to the call.
|
|
244
|
+
|
|
225
245
|
### Notifications
|
|
226
246
|
|
|
227
247
|
- [useNofitication](#usenotification)
|
|
@@ -9,9 +9,12 @@ export type AuthenticationContext = {
|
|
|
9
9
|
export type UserAccount = {
|
|
10
10
|
id: string;
|
|
11
11
|
name?: string;
|
|
12
|
+
username?: string;
|
|
13
|
+
lastLoginTime?: number;
|
|
14
|
+
activeMfaSession?: boolean;
|
|
12
15
|
};
|
|
13
16
|
export type AuthenticationContextProviderProps = {
|
|
14
|
-
msal
|
|
17
|
+
msal?: IMsalContext;
|
|
15
18
|
authRequest: AuthenticationRequest;
|
|
16
19
|
children?: ReactNode;
|
|
17
20
|
};
|
|
@@ -9,11 +9,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { createContext, useCallback, useContext, useMemo } from 'react';
|
|
12
|
+
import { useAuth } from 'react-oidc-context';
|
|
12
13
|
const Context = createContext(undefined);
|
|
13
14
|
Context.displayName = 'AuthenticationContext';
|
|
14
15
|
function AuthenticationContextProvider(props) {
|
|
16
|
+
// Auto-detect provider type based on presence of msal prop
|
|
17
|
+
if (props.msal) {
|
|
18
|
+
const { msal, authRequest, children } = props;
|
|
19
|
+
return (_jsx(MsalProvider, { msal: msal, authRequest: authRequest, children: children }));
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const { authRequest, children } = props;
|
|
23
|
+
return _jsx(OidcProvider, { authRequest: authRequest, children: children });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function MsalProvider({ msal, authRequest, children }) {
|
|
15
27
|
var _a;
|
|
16
|
-
|
|
28
|
+
if (!msal) {
|
|
29
|
+
throw new Error('MSAL instance is required for MsalProvider');
|
|
30
|
+
}
|
|
17
31
|
const account = (_a = msal.instance.getActiveAccount()) !== null && _a !== void 0 ? _a : msal.instance.getAllAccounts()[0];
|
|
18
32
|
const getAccessToken = useCallback(function () {
|
|
19
33
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -26,19 +40,89 @@ function AuthenticationContextProvider(props) {
|
|
|
26
40
|
return '';
|
|
27
41
|
}
|
|
28
42
|
});
|
|
29
|
-
}, [msal, authRequest]);
|
|
30
|
-
const context = useMemo(() =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
account,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
43
|
+
}, [msal, authRequest, account]);
|
|
44
|
+
const context = useMemo(() => {
|
|
45
|
+
var _a, _b;
|
|
46
|
+
return account
|
|
47
|
+
? {
|
|
48
|
+
account: {
|
|
49
|
+
id: account.localAccountId,
|
|
50
|
+
name: account.name,
|
|
51
|
+
username: account.username,
|
|
52
|
+
lastLoginTime: (_a = account.idTokenClaims) === null || _a === void 0 ? void 0 : _a.last_login_time,
|
|
53
|
+
activeMfaSession: Boolean((_b = account.idTokenClaims) === null || _b === void 0 ? void 0 : _b.active_mfa_session),
|
|
54
|
+
},
|
|
55
|
+
logout: () => {
|
|
56
|
+
msal.instance.logoutRedirect({
|
|
57
|
+
account,
|
|
58
|
+
postLogoutRedirectUri: `/logout?p=${encodeURIComponent(window.location.pathname + window.location.search)}`,
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
getAccessToken,
|
|
62
|
+
}
|
|
63
|
+
: undefined;
|
|
64
|
+
}, [account, msal, getAccessToken, authRequest]);
|
|
65
|
+
return _jsx(Context.Provider, { value: context, children: children });
|
|
66
|
+
}
|
|
67
|
+
function OidcProvider({ authRequest, children }) {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
// The authRequest for react-oidc is formatted slightly differently than msal.
|
|
70
|
+
const oidcAuthRequest = {
|
|
71
|
+
scope: (_b = (_a = authRequest.scopes) === null || _a === void 0 ? void 0 : _a.join(' ')) !== null && _b !== void 0 ? _b : 'openid profile email',
|
|
72
|
+
extraQueryParams: authRequest.extraQueryParameters,
|
|
73
|
+
state: authRequest.state,
|
|
74
|
+
};
|
|
75
|
+
const auth = useAuth();
|
|
76
|
+
const getAccessToken = useCallback(function () {
|
|
77
|
+
var _a, _b;
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
try {
|
|
80
|
+
// With automaticSilentRenew: true, oidc-client-ts will attempt to renew the token in the background before it expires.
|
|
81
|
+
// However, this is not guaranteed to be perfectly in sync with your API calls. Always check for expiration here and call signinSilent if needed
|
|
82
|
+
// to ensure you get a valid token on demand.
|
|
83
|
+
if (((_a = auth.user) === null || _a === void 0 ? void 0 : _a.access_token) && !auth.user.expired) {
|
|
84
|
+
return auth.user.access_token;
|
|
85
|
+
}
|
|
86
|
+
// Token is either missing or expired - attempt silent refresh.
|
|
87
|
+
const user = yield auth.signinSilent(oidcAuthRequest);
|
|
88
|
+
// If signinSilent returns null, it means silent login failed
|
|
89
|
+
if (!user) {
|
|
90
|
+
console.log('Silent login failed, redirecting to login');
|
|
91
|
+
auth.signinRedirect(oidcAuthRequest);
|
|
92
|
+
return '';
|
|
93
|
+
}
|
|
94
|
+
return ((_b = auth.user) === null || _b === void 0 ? void 0 : _b.access_token) || '';
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error('Failed to get access token:', error);
|
|
98
|
+
// If silent refresh throws an error (e.g., network failure, missing silent_redirect_uri,
|
|
99
|
+
// invalid session, refresh token expired, or provider returned an error), redirect to login
|
|
100
|
+
auth.signinRedirect(oidcAuthRequest);
|
|
101
|
+
return '';
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}, [auth, authRequest]);
|
|
105
|
+
const context = useMemo(() => {
|
|
106
|
+
var _a, _b, _c, _d;
|
|
107
|
+
return auth.isAuthenticated && auth.user
|
|
108
|
+
? {
|
|
109
|
+
account: {
|
|
110
|
+
id: auth.user.profile.sub,
|
|
111
|
+
name: (_a = auth.user.profile.name) !== null && _a !== void 0 ? _a : (`${(_b = auth.user.profile.given_name) !== null && _b !== void 0 ? _b : ''} ${(_c = auth.user.profile.family_name) !== null && _c !== void 0 ? _c : ''}` ||
|
|
112
|
+
undefined),
|
|
113
|
+
username: (_d = auth.user.profile.preferred_username) !== null && _d !== void 0 ? _d : auth.user.profile.email,
|
|
114
|
+
lastLoginTime: auth.user.profile.lastLoginTime,
|
|
115
|
+
},
|
|
116
|
+
logout: () => {
|
|
117
|
+
auth.signoutRedirect({
|
|
118
|
+
// Fusion auth requires an absolute url.
|
|
119
|
+
post_logout_redirect_uri: `${window.location.origin}/logout?p=${encodeURIComponent(window.location.pathname + window.location.search)}`,
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
getAccessToken,
|
|
123
|
+
}
|
|
124
|
+
: undefined;
|
|
125
|
+
}, [auth, getAccessToken]);
|
|
42
126
|
return _jsx(Context.Provider, { value: context, children: children });
|
|
43
127
|
}
|
|
44
128
|
export function useAuthenticationContext() {
|
|
@@ -29,20 +29,20 @@ type ViewLayoutEntity = {
|
|
|
29
29
|
export type TableViewLayoutEntity = ViewLayoutEntity & TableViewLayout;
|
|
30
30
|
export type DropdownViewLayoutEntity = ViewLayoutEntity & DropdownViewLayout;
|
|
31
31
|
export type ViewLayout = {
|
|
32
|
-
table?: TableViewLayout;
|
|
33
|
-
dropdown?: DropdownViewLayout;
|
|
32
|
+
table?: TableViewLayout | null;
|
|
33
|
+
dropdown?: DropdownViewLayout | null;
|
|
34
34
|
};
|
|
35
35
|
export type DropdownViewLayoutSort = {
|
|
36
36
|
propertyId: string;
|
|
37
|
-
direction?: 'asc' | 'desc';
|
|
37
|
+
direction?: 'asc' | 'desc' | null;
|
|
38
38
|
};
|
|
39
39
|
export type DropdownViewLayout = {
|
|
40
40
|
secondaryTextExpression: string;
|
|
41
|
-
sort?: DropdownViewLayoutSort;
|
|
41
|
+
sort?: DropdownViewLayoutSort | null;
|
|
42
42
|
};
|
|
43
43
|
export type TableViewLayout = {
|
|
44
44
|
properties: PropertyReference[];
|
|
45
|
-
sort?: Sort;
|
|
45
|
+
sort?: Sort | null;
|
|
46
46
|
};
|
|
47
47
|
export type PropertyReference = {
|
|
48
48
|
id: string;
|
|
@@ -50,94 +50,94 @@ export type PropertyReference = {
|
|
|
50
50
|
};
|
|
51
51
|
export type Sort = {
|
|
52
52
|
colId: string;
|
|
53
|
-
sort?: 'asc' | 'desc';
|
|
53
|
+
sort?: 'asc' | 'desc' | null;
|
|
54
54
|
};
|
|
55
55
|
export type Obj = {
|
|
56
56
|
id: string;
|
|
57
57
|
name: string;
|
|
58
|
-
typeDiscriminatorProperty?: string;
|
|
59
|
-
viewLayout?: ViewLayout;
|
|
60
|
-
baseObject?: BaseObjReference;
|
|
61
|
-
properties?: Property[];
|
|
62
|
-
actions?: Action[];
|
|
63
|
-
formId?: string;
|
|
58
|
+
typeDiscriminatorProperty?: string | null;
|
|
59
|
+
viewLayout?: ViewLayout | null;
|
|
60
|
+
baseObject?: BaseObjReference | null;
|
|
61
|
+
properties?: Property[] | null;
|
|
62
|
+
actions?: Action[] | null;
|
|
63
|
+
formId?: string | null;
|
|
64
64
|
};
|
|
65
65
|
export type ObjWithRoot = Obj & {
|
|
66
66
|
rootObjectId: string;
|
|
67
67
|
};
|
|
68
68
|
export type PropertyType = 'address' | 'array' | 'boolean' | 'collection' | 'criteria' | 'date' | 'date-time' | 'document' | 'image' | 'integer' | 'number' | 'object' | 'richText' | 'string' | 'time' | 'user';
|
|
69
69
|
export type NumericValidation = {
|
|
70
|
-
errorMessage?: string;
|
|
71
|
-
minimum?: number;
|
|
72
|
-
maximum?: number;
|
|
70
|
+
errorMessage?: string | null;
|
|
71
|
+
minimum?: number | null;
|
|
72
|
+
maximum?: number | null;
|
|
73
73
|
};
|
|
74
74
|
export type DateValidation = {
|
|
75
|
-
errorMessage?: string;
|
|
76
|
-
to?: string;
|
|
77
|
-
from?: string;
|
|
75
|
+
errorMessage?: string | null;
|
|
76
|
+
to?: string | null;
|
|
77
|
+
from?: string | null;
|
|
78
78
|
};
|
|
79
79
|
export type CriteriaValidation = {
|
|
80
|
-
criteria?: Record<string, unknown
|
|
80
|
+
criteria?: Record<string, unknown> | null;
|
|
81
81
|
};
|
|
82
82
|
export type StringValidation = {
|
|
83
83
|
operator: 'any' | 'all';
|
|
84
|
-
rules?: RegexValidation[];
|
|
84
|
+
rules?: RegexValidation[] | null;
|
|
85
85
|
};
|
|
86
86
|
export type DocumentValidation = {
|
|
87
|
-
errorMessage?: string;
|
|
88
|
-
maxDocuments?: number;
|
|
89
|
-
minDocuments?: number;
|
|
87
|
+
errorMessage?: string | null;
|
|
88
|
+
maxDocuments?: number | null;
|
|
89
|
+
minDocuments?: number | null;
|
|
90
90
|
};
|
|
91
91
|
export type PropertyValidation = StringValidation | NumericValidation | DateValidation | CriteriaValidation | DocumentValidation;
|
|
92
92
|
export type Property = {
|
|
93
93
|
id: string;
|
|
94
94
|
name: string;
|
|
95
95
|
type: PropertyType;
|
|
96
|
-
enum?: string[];
|
|
97
|
-
strictlyTrue?: boolean;
|
|
98
|
-
nonStrictEnum?: boolean;
|
|
99
|
-
objectId?: string;
|
|
100
|
-
relatedPropertyId?: string;
|
|
101
|
-
required?: boolean;
|
|
102
|
-
searchable?: boolean;
|
|
103
|
-
formula?: string;
|
|
104
|
-
formulaType?: 'aggregate' | 'custom' | 'arithmetic';
|
|
105
|
-
mask?: string;
|
|
106
|
-
validation?: PropertyValidation;
|
|
107
|
-
manyToManyPropertyId?: string;
|
|
108
|
-
textTransform?: 'titleCase' | 'upperCase' | 'lowerCase' | 'sentenceCase';
|
|
96
|
+
enum?: string[] | null;
|
|
97
|
+
strictlyTrue?: boolean | null;
|
|
98
|
+
nonStrictEnum?: boolean | null;
|
|
99
|
+
objectId?: string | null;
|
|
100
|
+
relatedPropertyId?: string | null;
|
|
101
|
+
required?: boolean | null;
|
|
102
|
+
searchable?: boolean | null;
|
|
103
|
+
formula?: string | null;
|
|
104
|
+
formulaType?: 'aggregate' | 'custom' | 'arithmetic' | null;
|
|
105
|
+
mask?: string | null;
|
|
106
|
+
validation?: PropertyValidation | null;
|
|
107
|
+
manyToManyPropertyId?: string | null;
|
|
108
|
+
textTransform?: 'titleCase' | 'upperCase' | 'lowerCase' | 'sentenceCase' | null;
|
|
109
109
|
};
|
|
110
110
|
export type ActionType = 'create' | 'update' | 'delete';
|
|
111
111
|
export type InputStringValidation = StringValidation & {
|
|
112
|
-
minLength?: number;
|
|
113
|
-
maxLength?: number;
|
|
114
|
-
mask?: string;
|
|
112
|
+
minLength?: number | null;
|
|
113
|
+
maxLength?: number | null;
|
|
114
|
+
mask?: string | null;
|
|
115
115
|
};
|
|
116
116
|
export type BasicInputParameter = Omit<InputParameter, 'name' | 'required'>;
|
|
117
117
|
export type InputParameter = {
|
|
118
118
|
id: string;
|
|
119
|
-
name?: string;
|
|
119
|
+
name?: string | null;
|
|
120
120
|
type: PropertyType;
|
|
121
|
-
required?: boolean;
|
|
122
|
-
enum?: string[];
|
|
123
|
-
strictlyTrue?: boolean;
|
|
124
|
-
nonStrictEnum?: boolean;
|
|
125
|
-
validation?: PropertyValidation | InputStringValidation;
|
|
126
|
-
objectId?: string;
|
|
127
|
-
relatedPropertyId?: string;
|
|
128
|
-
manyToManyPropertyId?: string;
|
|
121
|
+
required?: boolean | null;
|
|
122
|
+
enum?: string[] | null;
|
|
123
|
+
strictlyTrue?: boolean | null;
|
|
124
|
+
nonStrictEnum?: boolean | null;
|
|
125
|
+
validation?: PropertyValidation | InputStringValidation | null;
|
|
126
|
+
objectId?: string | null;
|
|
127
|
+
relatedPropertyId?: string | null;
|
|
128
|
+
manyToManyPropertyId?: string | null;
|
|
129
129
|
};
|
|
130
130
|
export type Action = {
|
|
131
131
|
id: string;
|
|
132
132
|
name: string;
|
|
133
133
|
type: ActionType;
|
|
134
134
|
outputEvent: string;
|
|
135
|
-
inputProperties?: ActionInput[];
|
|
136
|
-
parameters?: InputParameter[];
|
|
137
|
-
form?: Form;
|
|
138
|
-
defaultFormId?: string;
|
|
139
|
-
customCode?: string;
|
|
140
|
-
preconditions?: object;
|
|
135
|
+
inputProperties?: ActionInput[] | null;
|
|
136
|
+
parameters?: InputParameter[] | null;
|
|
137
|
+
form?: Form | null;
|
|
138
|
+
defaultFormId?: string | null;
|
|
139
|
+
customCode?: string | null;
|
|
140
|
+
preconditions?: object | null;
|
|
141
141
|
};
|
|
142
142
|
export type ObjectInstance = {
|
|
143
143
|
id: string;
|
|
@@ -147,7 +147,7 @@ export type ObjectInstance = {
|
|
|
147
147
|
};
|
|
148
148
|
export type RegexValidation = {
|
|
149
149
|
regex: string;
|
|
150
|
-
errorMessage?: string;
|
|
150
|
+
errorMessage?: string | null;
|
|
151
151
|
};
|
|
152
152
|
export type SelectOption = {
|
|
153
153
|
label: string;
|
|
@@ -157,170 +157,170 @@ export type VisibilityCondition = {
|
|
|
157
157
|
property: string;
|
|
158
158
|
operator: 'eq' | 'ne';
|
|
159
159
|
value: string | number | boolean;
|
|
160
|
-
isInstanceProperty?: boolean;
|
|
160
|
+
isInstanceProperty?: boolean | null;
|
|
161
161
|
};
|
|
162
162
|
export type VisibilityConfiguration = {
|
|
163
|
-
operator?: 'any' | 'all';
|
|
164
|
-
conditions?: VisibilityCondition[];
|
|
163
|
+
operator?: 'any' | 'all' | null;
|
|
164
|
+
conditions?: VisibilityCondition[] | null;
|
|
165
165
|
};
|
|
166
166
|
export type RelatedObjectDefaultValue = {
|
|
167
167
|
criteria: Record<string, unknown>;
|
|
168
|
-
sortBy?: string;
|
|
169
|
-
orderBy?: 'asc' | 'desc' | 'ASC' | 'DESC';
|
|
168
|
+
sortBy?: string | null;
|
|
169
|
+
orderBy?: 'asc' | 'desc' | 'ASC' | 'DESC' | null;
|
|
170
170
|
};
|
|
171
171
|
export type CriteriaDefaultValue = Record<string, unknown>;
|
|
172
172
|
export type JsonLogic = Record<string, unknown> | boolean | number | string | null;
|
|
173
173
|
export type DisplayConfiguration = {
|
|
174
|
-
label?: string;
|
|
175
|
-
placeholder?: string;
|
|
176
|
-
required?: boolean;
|
|
177
|
-
description?: string;
|
|
178
|
-
defaultValue?: string | boolean | number | string[] | RelatedObjectDefaultValue | CriteriaDefaultValue;
|
|
179
|
-
readOnly?: boolean;
|
|
180
|
-
tooltip?: string;
|
|
181
|
-
prefix?: string;
|
|
182
|
-
suffix?: string;
|
|
183
|
-
placeholderChar?: string;
|
|
184
|
-
rowCount?: number;
|
|
185
|
-
charCount?: boolean;
|
|
186
|
-
mode?: 'default' | 'existingOnly';
|
|
187
|
-
relatedObjectDisplay?: 'dropdown' | 'dialogBox';
|
|
188
|
-
visibility?: VisibilityConfiguration | JsonLogic;
|
|
189
|
-
viewLayout?: ViewLayoutEntityReference;
|
|
174
|
+
label?: string | null;
|
|
175
|
+
placeholder?: string | null;
|
|
176
|
+
required?: boolean | null;
|
|
177
|
+
description?: string | null;
|
|
178
|
+
defaultValue?: string | boolean | number | string[] | RelatedObjectDefaultValue | CriteriaDefaultValue | null;
|
|
179
|
+
readOnly?: boolean | null;
|
|
180
|
+
tooltip?: string | null;
|
|
181
|
+
prefix?: string | null;
|
|
182
|
+
suffix?: string | null;
|
|
183
|
+
placeholderChar?: string | null;
|
|
184
|
+
rowCount?: number | null;
|
|
185
|
+
charCount?: boolean | null;
|
|
186
|
+
mode?: 'default' | 'existingOnly' | null;
|
|
187
|
+
relatedObjectDisplay?: 'dropdown' | 'dialogBox' | null;
|
|
188
|
+
visibility?: VisibilityConfiguration | JsonLogic | null;
|
|
189
|
+
viewLayout?: ViewLayoutEntityReference | null;
|
|
190
190
|
choicesDisplay?: {
|
|
191
191
|
type: 'dropdown' | 'radioButton';
|
|
192
|
-
sortBy?: 'ASC' | 'DESC' | 'NONE';
|
|
193
|
-
};
|
|
194
|
-
booleanDisplay?: 'checkbox' | 'switch';
|
|
192
|
+
sortBy?: 'ASC' | 'DESC' | 'NONE' | null;
|
|
193
|
+
} | null;
|
|
194
|
+
booleanDisplay?: 'checkbox' | 'switch' | null;
|
|
195
195
|
};
|
|
196
196
|
export type InputParameterReference = {
|
|
197
197
|
type: 'input';
|
|
198
198
|
parameterId: string;
|
|
199
|
-
display?: DisplayConfiguration;
|
|
200
|
-
enumWithLabels?: SelectOption[];
|
|
201
|
-
documentMetadata?: Record<string, string
|
|
199
|
+
display?: DisplayConfiguration | null;
|
|
200
|
+
enumWithLabels?: SelectOption[] | null;
|
|
201
|
+
documentMetadata?: Record<string, string> | null;
|
|
202
202
|
};
|
|
203
203
|
export type Content = {
|
|
204
204
|
type: 'content';
|
|
205
205
|
html: string;
|
|
206
|
-
visibility?: VisibilityConfiguration | JsonLogic;
|
|
206
|
+
visibility?: VisibilityConfiguration | JsonLogic | null;
|
|
207
207
|
};
|
|
208
208
|
export type Column = {
|
|
209
209
|
width: number;
|
|
210
|
-
entries?: FormEntry[];
|
|
210
|
+
entries?: FormEntry[] | null;
|
|
211
211
|
};
|
|
212
212
|
export type Columns = {
|
|
213
213
|
type: 'columns';
|
|
214
214
|
columns: Column[];
|
|
215
|
-
visibility?: VisibilityConfiguration | JsonLogic;
|
|
215
|
+
visibility?: VisibilityConfiguration | JsonLogic | null;
|
|
216
216
|
};
|
|
217
217
|
export type Section = {
|
|
218
218
|
label: string;
|
|
219
|
-
entries?: FormEntry[];
|
|
219
|
+
entries?: FormEntry[] | null;
|
|
220
220
|
};
|
|
221
221
|
export type Sections = {
|
|
222
222
|
type: 'sections';
|
|
223
|
-
label?: string;
|
|
223
|
+
label?: string | null;
|
|
224
224
|
sections: Section[];
|
|
225
|
-
visibility?: VisibilityConfiguration | JsonLogic;
|
|
225
|
+
visibility?: VisibilityConfiguration | JsonLogic | null;
|
|
226
226
|
};
|
|
227
227
|
export type ReadonlyField = {
|
|
228
228
|
type: 'readonlyField';
|
|
229
229
|
propertyId: string;
|
|
230
|
-
display?: DisplayConfiguration;
|
|
230
|
+
display?: DisplayConfiguration | null;
|
|
231
231
|
};
|
|
232
232
|
export type InputField = {
|
|
233
233
|
type: 'inputField';
|
|
234
234
|
input: BasicInputParameter;
|
|
235
|
-
display?: DisplayConfiguration;
|
|
236
|
-
documentMetadata?: Record<string, string
|
|
235
|
+
display?: DisplayConfiguration | null;
|
|
236
|
+
documentMetadata?: Record<string, string> | null;
|
|
237
237
|
};
|
|
238
238
|
export type FormEntry = InputField | InputParameterReference | ReadonlyField | Sections | Columns | Content;
|
|
239
239
|
export type Form = {
|
|
240
|
-
entries?: FormEntry[];
|
|
240
|
+
entries?: FormEntry[] | null;
|
|
241
241
|
};
|
|
242
242
|
export type ActionInputType = 'button' | 'Boolean' | 'Columns' | 'Content' | 'Criteria' | 'Date' | 'DateTime' | 'Decimal' | 'Document' | 'Image' | 'Integer' | 'ManyToManyRepeatableField' | 'MultiSelect' | 'Object' | 'RepeatableField' | 'RichText' | 'Section' | 'Select' | 'TextField' | 'Time' | 'User';
|
|
243
243
|
/**
|
|
244
244
|
* Represents an object action inputProperty object.
|
|
245
245
|
*/
|
|
246
246
|
export type ActionInput = {
|
|
247
|
-
id?: string;
|
|
248
|
-
label?: string;
|
|
249
|
-
type?: ActionInputType;
|
|
250
|
-
key?: string;
|
|
251
|
-
initialValue?: boolean | string | string[] | number | RelatedObjectDefaultValue | SelectOption[] | SelectOption;
|
|
252
|
-
defaultToCurrentDate?: boolean;
|
|
253
|
-
defaultToCurrentTime?: boolean;
|
|
254
|
-
defaultValueCriteria?: object;
|
|
255
|
-
sortBy?: string;
|
|
256
|
-
orderBy?: 'asc' | 'desc' | 'ASC' | 'DESC';
|
|
257
|
-
html?: string;
|
|
258
|
-
labelPosition?: string;
|
|
259
|
-
placeholder?: string;
|
|
260
|
-
description?: string;
|
|
261
|
-
tooltip?: string;
|
|
262
|
-
prefix?: string;
|
|
263
|
-
suffix?: string;
|
|
247
|
+
id?: string | null;
|
|
248
|
+
label?: string | null;
|
|
249
|
+
type?: ActionInputType | null;
|
|
250
|
+
key?: string | null;
|
|
251
|
+
initialValue?: boolean | string | string[] | number | RelatedObjectDefaultValue | SelectOption[] | SelectOption | null;
|
|
252
|
+
defaultToCurrentDate?: boolean | null;
|
|
253
|
+
defaultToCurrentTime?: boolean | null;
|
|
254
|
+
defaultValueCriteria?: object | null;
|
|
255
|
+
sortBy?: string | null;
|
|
256
|
+
orderBy?: 'asc' | 'desc' | 'ASC' | 'DESC' | null;
|
|
257
|
+
html?: string | null;
|
|
258
|
+
labelPosition?: string | null;
|
|
259
|
+
placeholder?: string | null;
|
|
260
|
+
description?: string | null;
|
|
261
|
+
tooltip?: string | null;
|
|
262
|
+
prefix?: string | null;
|
|
263
|
+
suffix?: string | null;
|
|
264
264
|
data?: {
|
|
265
265
|
/**
|
|
266
266
|
* An array of values required for select options.
|
|
267
267
|
*/
|
|
268
|
-
values?: SelectOption[];
|
|
269
|
-
};
|
|
270
|
-
inputMask?: string;
|
|
271
|
-
inputMaskPlaceholderChar?: string;
|
|
272
|
-
tableView?: boolean;
|
|
273
|
-
mode?: 'default' | 'existingOnly';
|
|
274
|
-
displayOption?: 'dropdown' | 'dialogBox' | 'radioButton' | 'checkbox' | 'switch';
|
|
275
|
-
rows?: number;
|
|
276
|
-
showCharCount?: boolean;
|
|
277
|
-
readOnly?: boolean;
|
|
278
|
-
isMultiLineText?: boolean;
|
|
279
|
-
verticalLayout?: boolean;
|
|
280
|
-
input?: boolean;
|
|
281
|
-
widget?: string;
|
|
268
|
+
values?: SelectOption[] | null;
|
|
269
|
+
} | null;
|
|
270
|
+
inputMask?: string | null;
|
|
271
|
+
inputMaskPlaceholderChar?: string | null;
|
|
272
|
+
tableView?: boolean | null;
|
|
273
|
+
mode?: 'default' | 'existingOnly' | null;
|
|
274
|
+
displayOption?: 'dropdown' | 'dialogBox' | 'radioButton' | 'checkbox' | 'switch' | null;
|
|
275
|
+
rows?: number | null;
|
|
276
|
+
showCharCount?: boolean | null;
|
|
277
|
+
readOnly?: boolean | null;
|
|
278
|
+
isMultiLineText?: boolean | null;
|
|
279
|
+
verticalLayout?: boolean | null;
|
|
280
|
+
input?: boolean | null;
|
|
281
|
+
widget?: string | null;
|
|
282
282
|
conditional?: {
|
|
283
|
-
json?: JsonLogic;
|
|
284
|
-
show?: boolean;
|
|
285
|
-
when?: string;
|
|
286
|
-
eq?: string | number | boolean;
|
|
287
|
-
};
|
|
288
|
-
property?: InputParameter;
|
|
289
|
-
viewLayout?: ViewLayoutEntityReference;
|
|
290
|
-
documentMetadata?: Record<string, string
|
|
283
|
+
json?: JsonLogic | null;
|
|
284
|
+
show?: boolean | null;
|
|
285
|
+
when?: string | null;
|
|
286
|
+
eq?: string | number | boolean | null;
|
|
287
|
+
} | null;
|
|
288
|
+
property?: InputParameter | null;
|
|
289
|
+
viewLayout?: ViewLayoutEntityReference | null;
|
|
290
|
+
documentMetadata?: Record<string, string> | null;
|
|
291
291
|
validate?: {
|
|
292
|
-
required?: boolean;
|
|
293
|
-
criteria?: object;
|
|
294
|
-
operator?: 'any' | 'all';
|
|
295
|
-
regexes?: RegexValidation[];
|
|
296
|
-
minLength?: number;
|
|
297
|
-
maxLength?: number;
|
|
298
|
-
minDate?: string;
|
|
299
|
-
maxDate?: string;
|
|
300
|
-
minTime?: string;
|
|
301
|
-
maxTime?: string;
|
|
302
|
-
min?: number;
|
|
303
|
-
max?: number;
|
|
304
|
-
minDocuments?: number;
|
|
305
|
-
maxDocuments?: number;
|
|
306
|
-
customMessage?: string;
|
|
292
|
+
required?: boolean | null;
|
|
293
|
+
criteria?: object | null;
|
|
294
|
+
operator?: 'any' | 'all' | null;
|
|
295
|
+
regexes?: RegexValidation[] | null;
|
|
296
|
+
minLength?: number | null;
|
|
297
|
+
maxLength?: number | null;
|
|
298
|
+
minDate?: string | null;
|
|
299
|
+
maxDate?: string | null;
|
|
300
|
+
minTime?: string | null;
|
|
301
|
+
maxTime?: string | null;
|
|
302
|
+
min?: number | null;
|
|
303
|
+
max?: number | null;
|
|
304
|
+
minDocuments?: number | null;
|
|
305
|
+
maxDocuments?: number | null;
|
|
306
|
+
customMessage?: string | null;
|
|
307
307
|
};
|
|
308
308
|
/**
|
|
309
309
|
* An array of sub-components to be rendered inside sections.
|
|
310
310
|
*/
|
|
311
311
|
components?: {
|
|
312
312
|
key: string;
|
|
313
|
-
label?: string;
|
|
313
|
+
label?: string | null;
|
|
314
314
|
components: ActionInput[];
|
|
315
|
-
}[];
|
|
315
|
+
}[] | null;
|
|
316
316
|
/**
|
|
317
317
|
* An array of sub-components to be rendered inside columns.
|
|
318
318
|
*/
|
|
319
319
|
columns?: {
|
|
320
320
|
width: number;
|
|
321
|
-
currentWidth?: number;
|
|
321
|
+
currentWidth?: number | null;
|
|
322
322
|
components: ActionInput[];
|
|
323
|
-
}[];
|
|
323
|
+
}[] | null;
|
|
324
324
|
};
|
|
325
325
|
export type ActionRequest = {
|
|
326
326
|
actionId: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evoke-platform/context",
|
|
3
|
-
"version": "1.3.0-testing.
|
|
3
|
+
"version": "1.3.0-testing.6",
|
|
4
4
|
"description": "Utilities that provide context to Evoke platform widgets",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
"msw": "^1.3.1",
|
|
57
57
|
"react": "^18.2.0",
|
|
58
58
|
"react-dom": "^18.3.1",
|
|
59
|
+
"react-oidc-context": "^2.4.0",
|
|
59
60
|
"react-router-dom": "^6.16.0",
|
|
60
61
|
"sinon": "^18.0.0",
|
|
61
62
|
"typescript": "^5.3.3"
|
|
@@ -64,12 +65,14 @@
|
|
|
64
65
|
"@azure/msal-browser": ">=2",
|
|
65
66
|
"@azure/msal-react": ">=1",
|
|
66
67
|
"react": ">=18",
|
|
68
|
+
"react-oidc-context": ">=2",
|
|
67
69
|
"react-router-dom": ">=6"
|
|
68
70
|
},
|
|
69
71
|
"dependencies": {
|
|
70
72
|
"@isaacs/ttlcache": "^1.4.1",
|
|
71
73
|
"@microsoft/signalr": "^7.0.12",
|
|
72
74
|
"axios": "^1.7.9",
|
|
75
|
+
"oidc-client-ts": "^3.3.0",
|
|
73
76
|
"uuid": "^9.0.1"
|
|
74
77
|
}
|
|
75
78
|
}
|