@iblai/web-utils 1.1.15 → 1.1.16
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/dist/data-layer/src/config.d.ts +1 -0
- package/dist/data-layer/src/constants.d.ts +1 -0
- package/dist/data-layer/src/features/workflows/api-slice.d.ts +2454 -0
- package/dist/data-layer/src/features/workflows/constants.d.ts +57 -0
- package/dist/data-layer/src/features/workflows/types.d.ts +130 -0
- package/dist/data-layer/src/index.d.ts +3 -0
- package/dist/data-layer/src/utils/index.d.ts +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +213 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +213 -11
- package/dist/index.js.map +1 -1
- package/dist/package.json +3 -2
- package/dist/web-utils/src/hooks/tenant-metadata/use-tenant-metadata.d.ts +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SERVICES } from '@data-layer/constants';
|
|
2
|
+
export declare const WORKFLOWS_REDUCER_PATH = "workflowsApiSlice";
|
|
3
|
+
export declare const WORKFLOWS_ENDPOINTS: {
|
|
4
|
+
LIST: {
|
|
5
|
+
service: SERVICES;
|
|
6
|
+
path: (org: string) => string;
|
|
7
|
+
};
|
|
8
|
+
CREATE: {
|
|
9
|
+
service: SERVICES;
|
|
10
|
+
path: (org: string) => string;
|
|
11
|
+
};
|
|
12
|
+
RETRIEVE: {
|
|
13
|
+
service: SERVICES;
|
|
14
|
+
path: (org: string, uniqueId: string) => string;
|
|
15
|
+
};
|
|
16
|
+
UPDATE: {
|
|
17
|
+
service: SERVICES;
|
|
18
|
+
path: (org: string, uniqueId: string) => string;
|
|
19
|
+
};
|
|
20
|
+
DELETE: {
|
|
21
|
+
service: SERVICES;
|
|
22
|
+
path: (org: string, uniqueId: string) => string;
|
|
23
|
+
};
|
|
24
|
+
ACTIVATE: {
|
|
25
|
+
service: SERVICES;
|
|
26
|
+
path: (org: string, uniqueId: string) => string;
|
|
27
|
+
};
|
|
28
|
+
DEACTIVATE: {
|
|
29
|
+
service: SERVICES;
|
|
30
|
+
path: (org: string, uniqueId: string) => string;
|
|
31
|
+
};
|
|
32
|
+
PUBLISH: {
|
|
33
|
+
service: SERVICES;
|
|
34
|
+
path: (org: string, uniqueId: string) => string;
|
|
35
|
+
};
|
|
36
|
+
UNPUBLISH: {
|
|
37
|
+
service: SERVICES;
|
|
38
|
+
path: (org: string, uniqueId: string) => string;
|
|
39
|
+
};
|
|
40
|
+
VALIDATE: {
|
|
41
|
+
service: SERVICES;
|
|
42
|
+
path: (org: string, uniqueId: string) => string;
|
|
43
|
+
};
|
|
44
|
+
CHAT: {
|
|
45
|
+
service: SERVICES;
|
|
46
|
+
path: (org: string, uniqueId: string) => string;
|
|
47
|
+
};
|
|
48
|
+
NODE_TYPES: {
|
|
49
|
+
service: SERVICES;
|
|
50
|
+
path: (org: string) => string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export declare const WORKFLOWS_QUERY_KEYS: {
|
|
54
|
+
LIST: () => readonly ["WORKFLOWS"];
|
|
55
|
+
DETAILS: () => readonly ["WORKFLOW_DETAILS"];
|
|
56
|
+
NODE_TYPES: () => readonly ["WORKFLOW_NODE_TYPES"];
|
|
57
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
export type WorkflowDefinition = {
|
|
2
|
+
nodes: unknown[];
|
|
3
|
+
edges: unknown[];
|
|
4
|
+
};
|
|
5
|
+
export type Workflow = {
|
|
6
|
+
readonly id: number;
|
|
7
|
+
readonly unique_id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
definition: WorkflowDefinition;
|
|
11
|
+
is_active?: boolean;
|
|
12
|
+
is_template?: boolean;
|
|
13
|
+
parent_workflow?: number | null;
|
|
14
|
+
readonly platform: number;
|
|
15
|
+
readonly platform_key: string;
|
|
16
|
+
readonly platform_name: string;
|
|
17
|
+
readonly created_by: number;
|
|
18
|
+
readonly created_by_username: string;
|
|
19
|
+
readonly created_at: string;
|
|
20
|
+
readonly updated_at: string;
|
|
21
|
+
readonly node_count: number;
|
|
22
|
+
readonly edge_count: number;
|
|
23
|
+
readonly entry_mentor_id: string;
|
|
24
|
+
chat_name?: string;
|
|
25
|
+
chat_proactive_response?: string;
|
|
26
|
+
};
|
|
27
|
+
export type PaginatedWorkflowList = {
|
|
28
|
+
count: number;
|
|
29
|
+
next?: string | null;
|
|
30
|
+
previous?: string | null;
|
|
31
|
+
results: Workflow[];
|
|
32
|
+
};
|
|
33
|
+
export type GetWorkflowsParams = {
|
|
34
|
+
search?: string;
|
|
35
|
+
is_active?: boolean;
|
|
36
|
+
is_template?: boolean;
|
|
37
|
+
created_by?: string;
|
|
38
|
+
sort?: string;
|
|
39
|
+
limit?: number;
|
|
40
|
+
offset?: number;
|
|
41
|
+
};
|
|
42
|
+
export type GetWorkflowsArgs = {
|
|
43
|
+
org: string;
|
|
44
|
+
params?: GetWorkflowsParams;
|
|
45
|
+
};
|
|
46
|
+
export type GetWorkflowArgs = {
|
|
47
|
+
org: string;
|
|
48
|
+
uniqueId: string;
|
|
49
|
+
};
|
|
50
|
+
export type CreateWorkflowData = {
|
|
51
|
+
name: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
definition?: WorkflowDefinition;
|
|
54
|
+
};
|
|
55
|
+
export type CreateWorkflowArgs = {
|
|
56
|
+
org: string;
|
|
57
|
+
data: CreateWorkflowData;
|
|
58
|
+
};
|
|
59
|
+
export type PatchWorkflowData = {
|
|
60
|
+
name?: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
definition?: WorkflowDefinition;
|
|
63
|
+
chat_name?: string;
|
|
64
|
+
chat_proactive_response?: string;
|
|
65
|
+
};
|
|
66
|
+
export type PatchWorkflowArgs = {
|
|
67
|
+
org: string;
|
|
68
|
+
uniqueId: string;
|
|
69
|
+
data: PatchWorkflowData;
|
|
70
|
+
};
|
|
71
|
+
export type UpdateWorkflowData = {
|
|
72
|
+
name: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
definition: WorkflowDefinition;
|
|
75
|
+
chat_name?: string;
|
|
76
|
+
chat_proactive_response?: string;
|
|
77
|
+
};
|
|
78
|
+
export type UpdateWorkflowArgs = {
|
|
79
|
+
org: string;
|
|
80
|
+
uniqueId: string;
|
|
81
|
+
data: UpdateWorkflowData;
|
|
82
|
+
};
|
|
83
|
+
export type DeleteWorkflowArgs = {
|
|
84
|
+
org: string;
|
|
85
|
+
uniqueId: string;
|
|
86
|
+
};
|
|
87
|
+
export type WorkflowActionArgs = {
|
|
88
|
+
org: string;
|
|
89
|
+
uniqueId: string;
|
|
90
|
+
};
|
|
91
|
+
export type PublishWorkflowArgs = {
|
|
92
|
+
org: string;
|
|
93
|
+
uniqueId: string;
|
|
94
|
+
data?: {
|
|
95
|
+
definition?: WorkflowDefinition;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export type WorkflowValidationResponse = {
|
|
99
|
+
is_valid: boolean;
|
|
100
|
+
errors: string[];
|
|
101
|
+
warnings: string[];
|
|
102
|
+
workflow?: Workflow;
|
|
103
|
+
};
|
|
104
|
+
export type WorkflowChatArgs = {
|
|
105
|
+
org: string;
|
|
106
|
+
uniqueId: string;
|
|
107
|
+
message: string;
|
|
108
|
+
};
|
|
109
|
+
export type WorkflowChatResponse = {
|
|
110
|
+
response: string;
|
|
111
|
+
workflow_id: string;
|
|
112
|
+
session_id: string;
|
|
113
|
+
};
|
|
114
|
+
export type GetNodeTypesArgs = {
|
|
115
|
+
org: string;
|
|
116
|
+
};
|
|
117
|
+
export type NodeTypeInfo = {
|
|
118
|
+
label: string;
|
|
119
|
+
category: string;
|
|
120
|
+
executable: boolean;
|
|
121
|
+
description: string;
|
|
122
|
+
required_fields: string[];
|
|
123
|
+
optional_fields: string[];
|
|
124
|
+
aliases?: string[];
|
|
125
|
+
status?: string;
|
|
126
|
+
};
|
|
127
|
+
export type NodeTypesResponse = {
|
|
128
|
+
node_types: Record<string, NodeTypeInfo>;
|
|
129
|
+
categories: string[];
|
|
130
|
+
};
|
|
@@ -87,6 +87,9 @@ export * from './features/search/constants';
|
|
|
87
87
|
export * from './features/projects/api-slice';
|
|
88
88
|
export * from './features/projects/constants';
|
|
89
89
|
export type { Project, ProjectsFetchResponse, GetProjectsParams, GetProjectsArgs, GetProjectDetailsArgs, CreateProjectData, CreateProjectArgs, UpdateProjectData, UpdateProjectArgs, DeleteProjectArgs, } from './features/projects/types';
|
|
90
|
+
export * from './features/workflows/api-slice';
|
|
91
|
+
export * from './features/workflows/types';
|
|
92
|
+
export * from './features/workflows/constants';
|
|
90
93
|
export * from './reducers';
|
|
91
94
|
export * from './utils';
|
|
92
95
|
export type { CustomQueryArgs } from './features/utils';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { StorageService } from
|
|
2
|
-
export declare const initializeDataLayer: (dmUrl: string, lmsUrl: string, storageService: StorageService, httpErrorHandler?: Record<number, () => void>) => void;
|
|
1
|
+
import { StorageService } from '@data-layer/services/StorageService';
|
|
2
|
+
export declare const initializeDataLayer: (dmUrl: string, lmsUrl: string, legacyLmsUrl: string, storageService: StorageService, httpErrorHandler?: Record<number, () => void>) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1369,6 +1369,7 @@ declare const useTenantMetadata: ({ org, spa, skip, }: {
|
|
|
1369
1369
|
isMentorAIEnabled: () => boolean;
|
|
1370
1370
|
isSkillsLeaderBoardEnabled: () => boolean;
|
|
1371
1371
|
getEmbeddedMentorToUse: () => any;
|
|
1372
|
+
isMentorInappropriateContentEnabled: () => boolean;
|
|
1372
1373
|
metadataLoaded: any;
|
|
1373
1374
|
getAllMetadatas: () => {
|
|
1374
1375
|
value: any;
|
package/dist/index.esm.js
CHANGED
|
@@ -539,6 +539,13 @@ const MENTOR_AI_CONFIG = {
|
|
|
539
539
|
description: "Allow users to access the mentors from the community.",
|
|
540
540
|
type: "boolean",
|
|
541
541
|
},
|
|
542
|
+
{
|
|
543
|
+
slug: "mentor_report_inappropriate_content",
|
|
544
|
+
label: "Report Inappropriate Content",
|
|
545
|
+
defaultValue: true,
|
|
546
|
+
description: "Allow users to report inappropriate content.",
|
|
547
|
+
type: "boolean",
|
|
548
|
+
},
|
|
542
549
|
{
|
|
543
550
|
slug: "help_center_url",
|
|
544
551
|
label: "Help Center URL",
|
|
@@ -1258,6 +1265,10 @@ const useTenantMetadata = ({ org, spa, skip = false, }) => {
|
|
|
1258
1265
|
var _a;
|
|
1259
1266
|
return (_a = data === null || data === void 0 ? void 0 : data.metadata) === null || _a === void 0 ? void 0 : _a.support_email;
|
|
1260
1267
|
};
|
|
1268
|
+
const isMentorInappropriateContentEnabled = () => {
|
|
1269
|
+
var _a;
|
|
1270
|
+
return ((_a = data === null || data === void 0 ? void 0 : data.metadata) === null || _a === void 0 ? void 0 : _a.mentor_report_inappropriate_content) !== false;
|
|
1271
|
+
};
|
|
1261
1272
|
const getAllMetadatas = () => {
|
|
1262
1273
|
const metadatas = loadMetadataConfig(spa);
|
|
1263
1274
|
return metadatas.map((_metadata) => {
|
|
@@ -1278,6 +1289,7 @@ const useTenantMetadata = ({ org, spa, skip = false, }) => {
|
|
|
1278
1289
|
isMentorAIEnabled,
|
|
1279
1290
|
isSkillsLeaderBoardEnabled,
|
|
1280
1291
|
getEmbeddedMentorToUse,
|
|
1292
|
+
isMentorInappropriateContentEnabled,
|
|
1281
1293
|
metadataLoaded: !isLoading && (data === null || data === void 0 ? void 0 : data.metadata),
|
|
1282
1294
|
getAllMetadatas,
|
|
1283
1295
|
getSupportEmail,
|
|
@@ -13349,11 +13361,12 @@ Hook ${hookName} was either not provided or not a function.`);
|
|
|
13349
13361
|
var createApi = /* @__PURE__ */ buildCreateApi(coreModule(), reactHooksModule());
|
|
13350
13362
|
|
|
13351
13363
|
const STORAGE_KEYS = {
|
|
13352
|
-
EDX_TOKEN_KEY:
|
|
13353
|
-
DM_TOKEN_KEY:
|
|
13354
|
-
AXD_TOKEN_KEY:
|
|
13364
|
+
EDX_TOKEN_KEY: 'edx_jwt_token',
|
|
13365
|
+
DM_TOKEN_KEY: 'dm_token',
|
|
13366
|
+
AXD_TOKEN_KEY: 'axd_token'};
|
|
13355
13367
|
var SERVICES;
|
|
13356
13368
|
(function (SERVICES) {
|
|
13369
|
+
SERVICES["LEGACY_LMS"] = "LEGACY_LMS";
|
|
13357
13370
|
SERVICES["LMS"] = "LMS";
|
|
13358
13371
|
SERVICES["DM"] = "DM";
|
|
13359
13372
|
SERVICES["AXD"] = "AXD";
|
|
@@ -13361,10 +13374,11 @@ var SERVICES;
|
|
|
13361
13374
|
|
|
13362
13375
|
class Config {
|
|
13363
13376
|
}
|
|
13364
|
-
Config.
|
|
13365
|
-
Config.
|
|
13366
|
-
Config.
|
|
13367
|
-
Config.
|
|
13377
|
+
Config.legacyLmsUrl = 'https://learn.iblai.app';
|
|
13378
|
+
Config.lmsUrl = 'https://learn.iblai.app';
|
|
13379
|
+
Config.dmUrl = 'https://base.manager.iblai.app';
|
|
13380
|
+
Config.axdUrl = 'https://base.manager.iblai.app';
|
|
13381
|
+
Config.mentorIframeUrl = 'https://mentor.iblai.tech';
|
|
13368
13382
|
Config.httpErrorHandlers = {};
|
|
13369
13383
|
|
|
13370
13384
|
class IblDataLayer {
|
|
@@ -13425,6 +13439,8 @@ const iblFakeBaseQuery = retry(fakeBaseQueryWithLogging, {
|
|
|
13425
13439
|
*/
|
|
13426
13440
|
const getServiceUrl = (service) => {
|
|
13427
13441
|
switch (service) {
|
|
13442
|
+
case SERVICES.LEGACY_LMS:
|
|
13443
|
+
return Config.legacyLmsUrl;
|
|
13428
13444
|
case SERVICES.LMS:
|
|
13429
13445
|
return Config.lmsUrl;
|
|
13430
13446
|
case SERVICES.DM:
|
|
@@ -13478,6 +13494,7 @@ const buildEndpointFromService = (service, serviceFn) => {
|
|
|
13478
13494
|
try {
|
|
13479
13495
|
OpenAPI.BASE = getServiceUrl(service);
|
|
13480
13496
|
OpenAPI.HEADERS = await getHeaders(service);
|
|
13497
|
+
OpenAPI.CREDENTIALS = service === SERVICES.LEGACY_LMS ? 'include' : 'omit';
|
|
13481
13498
|
// API request initiated
|
|
13482
13499
|
const data = await serviceFn(args);
|
|
13483
13500
|
// API response received
|
|
@@ -13513,6 +13530,7 @@ const isErrorObject = (data) => {
|
|
|
13513
13530
|
const baseQuery = (service, jsonContentType = true, contentType, skipAuth = false) => fetchBaseQuery({
|
|
13514
13531
|
baseUrl: getServiceUrl(service),
|
|
13515
13532
|
timeout: 30000, // 30 second timeout
|
|
13533
|
+
credentials: service === SERVICES.LEGACY_LMS ? 'include' : 'omit',
|
|
13516
13534
|
prepareHeaders: async (headers) => {
|
|
13517
13535
|
// Only add auth headers if skipAuth is false
|
|
13518
13536
|
if (!skipAuth) {
|
|
@@ -13626,6 +13644,7 @@ const buildEndpointFromServiceLegacy = (service, serviceFn) => {
|
|
|
13626
13644
|
try {
|
|
13627
13645
|
OpenAPI.BASE = getServiceUrl(service);
|
|
13628
13646
|
OpenAPI.HEADERS = await getHeaders(service);
|
|
13647
|
+
OpenAPI.CREDENTIALS = service === SERVICES.LEGACY_LMS ? 'include' : 'omit';
|
|
13629
13648
|
const data = await serviceFn(...args);
|
|
13630
13649
|
return { data };
|
|
13631
13650
|
}
|
|
@@ -14132,7 +14151,7 @@ const AUTH_ENDPOINTS = {
|
|
|
14132
14151
|
path: () => '/api/ibl/manager/consolidated-token/proxy/',
|
|
14133
14152
|
},
|
|
14134
14153
|
REFRESH_JWT_TOKEN: {
|
|
14135
|
-
service: SERVICES.
|
|
14154
|
+
service: SERVICES.LEGACY_LMS,
|
|
14136
14155
|
path: () => '/ibl-auth/request-jwt/',
|
|
14137
14156
|
},
|
|
14138
14157
|
};
|
|
@@ -14166,14 +14185,12 @@ createApi({
|
|
|
14166
14185
|
isJson: false,
|
|
14167
14186
|
method: 'POST',
|
|
14168
14187
|
body: formData,
|
|
14169
|
-
credentials: 'include',
|
|
14170
14188
|
}),
|
|
14171
14189
|
}),
|
|
14172
14190
|
refreshJwtToken: builder.query({
|
|
14173
14191
|
query: () => ({
|
|
14174
14192
|
url: AUTH_ENDPOINTS.REFRESH_JWT_TOKEN.path(),
|
|
14175
14193
|
service: AUTH_ENDPOINTS.REFRESH_JWT_TOKEN.service,
|
|
14176
|
-
credentials: 'include',
|
|
14177
14194
|
}),
|
|
14178
14195
|
}),
|
|
14179
14196
|
}),
|
|
@@ -14207,10 +14224,10 @@ createApi({
|
|
|
14207
14224
|
try {
|
|
14208
14225
|
const authHeaders = await getHeaders(SERVICES.LMS);
|
|
14209
14226
|
const response = await fetch(`${Config.lmsUrl}${TENANTS_ENDPOINTS.GET_USER_TENANTS.path()}`, {
|
|
14210
|
-
credentials: 'include',
|
|
14211
14227
|
headers: {
|
|
14212
14228
|
...authHeaders,
|
|
14213
14229
|
},
|
|
14230
|
+
credentials: 'omit',
|
|
14214
14231
|
});
|
|
14215
14232
|
if (!response.ok) {
|
|
14216
14233
|
return {
|
|
@@ -14296,6 +14313,7 @@ createApi({
|
|
|
14296
14313
|
const response = await fetch(url, {
|
|
14297
14314
|
method: 'GET',
|
|
14298
14315
|
headers: OpenAPI.HEADERS,
|
|
14316
|
+
credentials: 'omit',
|
|
14299
14317
|
});
|
|
14300
14318
|
if (!response.ok) {
|
|
14301
14319
|
const error = new Error('Failed to fetch platform users');
|
|
@@ -14330,6 +14348,7 @@ createApi({
|
|
|
14330
14348
|
const response = await fetch(url, {
|
|
14331
14349
|
method: 'GET',
|
|
14332
14350
|
headers: OpenAPI.HEADERS,
|
|
14351
|
+
credentials: 'omit',
|
|
14333
14352
|
});
|
|
14334
14353
|
if (!response.ok) {
|
|
14335
14354
|
const error = new Error('Failed to fetch team details');
|
|
@@ -14351,6 +14370,7 @@ createApi({
|
|
|
14351
14370
|
'Content-Type': 'application/json',
|
|
14352
14371
|
},
|
|
14353
14372
|
body: JSON.stringify(args.requestBody),
|
|
14373
|
+
credentials: 'omit',
|
|
14354
14374
|
});
|
|
14355
14375
|
if (!response.ok) {
|
|
14356
14376
|
const error = new Error('Failed to update platform user role with policies');
|
|
@@ -14576,6 +14596,7 @@ createApi({
|
|
|
14576
14596
|
const response = await fetch(url, {
|
|
14577
14597
|
method: 'GET',
|
|
14578
14598
|
headers: OpenAPI.HEADERS,
|
|
14599
|
+
credentials: 'omit',
|
|
14579
14600
|
});
|
|
14580
14601
|
if (!response.ok) {
|
|
14581
14602
|
const error = new Error('Failed to fetch RBAC group details');
|
|
@@ -14612,6 +14633,7 @@ createApi({
|
|
|
14612
14633
|
const response = await fetch(url, {
|
|
14613
14634
|
method: 'GET',
|
|
14614
14635
|
headers: OpenAPI.HEADERS,
|
|
14636
|
+
credentials: 'omit',
|
|
14615
14637
|
});
|
|
14616
14638
|
if (!response.ok) {
|
|
14617
14639
|
const error = new Error('Failed to fetch RBAC policy details');
|
|
@@ -14652,6 +14674,7 @@ createApi({
|
|
|
14652
14674
|
const response = await fetch(url, {
|
|
14653
14675
|
method: 'GET',
|
|
14654
14676
|
headers: OpenAPI.HEADERS,
|
|
14677
|
+
credentials: 'omit',
|
|
14655
14678
|
});
|
|
14656
14679
|
if (!response.ok) {
|
|
14657
14680
|
const error = new Error('Failed to fetch RBAC role details');
|
|
@@ -14762,6 +14785,7 @@ createApi({
|
|
|
14762
14785
|
const response = await fetch(url, {
|
|
14763
14786
|
method: 'GET',
|
|
14764
14787
|
headers: OpenAPI.HEADERS,
|
|
14788
|
+
credentials: 'omit',
|
|
14765
14789
|
});
|
|
14766
14790
|
if (!response.ok) {
|
|
14767
14791
|
const error = new Error('Failed to fetch credentials');
|
|
@@ -15737,6 +15761,7 @@ createApi({
|
|
|
15737
15761
|
const response = await fetch(url, {
|
|
15738
15762
|
method: 'GET',
|
|
15739
15763
|
headers: OpenAPI.HEADERS,
|
|
15764
|
+
credentials: 'omit',
|
|
15740
15765
|
});
|
|
15741
15766
|
if (!response.ok) {
|
|
15742
15767
|
const error = new Error('Failed to fetch program invitations');
|
|
@@ -15837,6 +15862,7 @@ const performCareerRequest = async (path, options = {}) => {
|
|
|
15837
15862
|
method: (_b = options.method) !== null && _b !== void 0 ? _b : 'GET',
|
|
15838
15863
|
body: (_c = options.body) !== null && _c !== void 0 ? _c : null,
|
|
15839
15864
|
headers,
|
|
15865
|
+
credentials: 'omit',
|
|
15840
15866
|
});
|
|
15841
15867
|
if (!response.ok) {
|
|
15842
15868
|
const errorData = await parseResponse(response);
|
|
@@ -17409,6 +17435,182 @@ createApi({
|
|
|
17409
17435
|
}),
|
|
17410
17436
|
});
|
|
17411
17437
|
|
|
17438
|
+
const WORKFLOWS_REDUCER_PATH = 'workflowsApiSlice';
|
|
17439
|
+
const WORKFLOWS_ENDPOINTS = {
|
|
17440
|
+
LIST: {
|
|
17441
|
+
service: SERVICES.AXD,
|
|
17442
|
+
path: (org) => `/api/ai-mentor/orgs/${org}/workflows/`,
|
|
17443
|
+
},
|
|
17444
|
+
CREATE: {
|
|
17445
|
+
service: SERVICES.AXD,
|
|
17446
|
+
path: (org) => `/api/ai-mentor/orgs/${org}/workflows/`,
|
|
17447
|
+
},
|
|
17448
|
+
RETRIEVE: {
|
|
17449
|
+
service: SERVICES.AXD,
|
|
17450
|
+
path: (org, uniqueId) => `/api/ai-mentor/orgs/${org}/workflows/${uniqueId}/`,
|
|
17451
|
+
},
|
|
17452
|
+
UPDATE: {
|
|
17453
|
+
service: SERVICES.AXD,
|
|
17454
|
+
path: (org, uniqueId) => `/api/ai-mentor/orgs/${org}/workflows/${uniqueId}/`,
|
|
17455
|
+
},
|
|
17456
|
+
DELETE: {
|
|
17457
|
+
service: SERVICES.AXD,
|
|
17458
|
+
path: (org, uniqueId) => `/api/ai-mentor/orgs/${org}/workflows/${uniqueId}/`,
|
|
17459
|
+
},
|
|
17460
|
+
ACTIVATE: {
|
|
17461
|
+
service: SERVICES.AXD,
|
|
17462
|
+
path: (org, uniqueId) => `/api/ai-mentor/orgs/${org}/workflows/${uniqueId}/activate/`,
|
|
17463
|
+
},
|
|
17464
|
+
DEACTIVATE: {
|
|
17465
|
+
service: SERVICES.AXD,
|
|
17466
|
+
path: (org, uniqueId) => `/api/ai-mentor/orgs/${org}/workflows/${uniqueId}/deactivate/`,
|
|
17467
|
+
},
|
|
17468
|
+
PUBLISH: {
|
|
17469
|
+
service: SERVICES.AXD,
|
|
17470
|
+
path: (org, uniqueId) => `/api/ai-mentor/orgs/${org}/workflows/${uniqueId}/publish/`,
|
|
17471
|
+
},
|
|
17472
|
+
UNPUBLISH: {
|
|
17473
|
+
service: SERVICES.AXD,
|
|
17474
|
+
path: (org, uniqueId) => `/api/ai-mentor/orgs/${org}/workflows/${uniqueId}/unpublish/`,
|
|
17475
|
+
},
|
|
17476
|
+
VALIDATE: {
|
|
17477
|
+
service: SERVICES.AXD,
|
|
17478
|
+
path: (org, uniqueId) => `/api/ai-mentor/orgs/${org}/workflows/${uniqueId}/validate/`,
|
|
17479
|
+
},
|
|
17480
|
+
CHAT: {
|
|
17481
|
+
service: SERVICES.AXD,
|
|
17482
|
+
path: (org, uniqueId) => `/api/ai-mentor/orgs/${org}/workflows/${uniqueId}/chat/`,
|
|
17483
|
+
},
|
|
17484
|
+
NODE_TYPES: {
|
|
17485
|
+
service: SERVICES.AXD,
|
|
17486
|
+
path: (org) => `/api/ai-mentor/orgs/${org}/workflows/node-types/`,
|
|
17487
|
+
},
|
|
17488
|
+
};
|
|
17489
|
+
const WORKFLOWS_QUERY_KEYS = {
|
|
17490
|
+
LIST: () => ['WORKFLOWS'],
|
|
17491
|
+
DETAILS: () => ['WORKFLOW_DETAILS'],
|
|
17492
|
+
NODE_TYPES: () => ['WORKFLOW_NODE_TYPES'],
|
|
17493
|
+
};
|
|
17494
|
+
|
|
17495
|
+
createApi({
|
|
17496
|
+
reducerPath: WORKFLOWS_REDUCER_PATH,
|
|
17497
|
+
tagTypes: [
|
|
17498
|
+
...WORKFLOWS_QUERY_KEYS.LIST(),
|
|
17499
|
+
...WORKFLOWS_QUERY_KEYS.DETAILS(),
|
|
17500
|
+
...WORKFLOWS_QUERY_KEYS.NODE_TYPES(),
|
|
17501
|
+
],
|
|
17502
|
+
baseQuery: iblFetchBaseQuery,
|
|
17503
|
+
endpoints: (builder) => ({
|
|
17504
|
+
getWorkflows: builder.query({
|
|
17505
|
+
query: ({ org, params }) => ({
|
|
17506
|
+
url: WORKFLOWS_ENDPOINTS.LIST.path(org),
|
|
17507
|
+
params,
|
|
17508
|
+
service: WORKFLOWS_ENDPOINTS.LIST.service,
|
|
17509
|
+
}),
|
|
17510
|
+
providesTags: WORKFLOWS_QUERY_KEYS.LIST(),
|
|
17511
|
+
}),
|
|
17512
|
+
getWorkflow: builder.query({
|
|
17513
|
+
query: ({ org, uniqueId }) => ({
|
|
17514
|
+
url: WORKFLOWS_ENDPOINTS.RETRIEVE.path(org, uniqueId),
|
|
17515
|
+
service: WORKFLOWS_ENDPOINTS.RETRIEVE.service,
|
|
17516
|
+
}),
|
|
17517
|
+
providesTags: WORKFLOWS_QUERY_KEYS.DETAILS(),
|
|
17518
|
+
}),
|
|
17519
|
+
createWorkflow: builder.mutation({
|
|
17520
|
+
query: ({ org, data }) => ({
|
|
17521
|
+
url: WORKFLOWS_ENDPOINTS.CREATE.path(org),
|
|
17522
|
+
method: 'POST',
|
|
17523
|
+
body: data,
|
|
17524
|
+
service: WORKFLOWS_ENDPOINTS.CREATE.service,
|
|
17525
|
+
}),
|
|
17526
|
+
invalidatesTags: WORKFLOWS_QUERY_KEYS.LIST(),
|
|
17527
|
+
}),
|
|
17528
|
+
// Full update (PUT) - replaces entire workflow
|
|
17529
|
+
updateWorkflow: builder.mutation({
|
|
17530
|
+
query: ({ org, uniqueId, data }) => ({
|
|
17531
|
+
url: WORKFLOWS_ENDPOINTS.UPDATE.path(org, uniqueId),
|
|
17532
|
+
method: 'PUT',
|
|
17533
|
+
body: data,
|
|
17534
|
+
service: WORKFLOWS_ENDPOINTS.UPDATE.service,
|
|
17535
|
+
}),
|
|
17536
|
+
invalidatesTags: [...WORKFLOWS_QUERY_KEYS.LIST(), ...WORKFLOWS_QUERY_KEYS.DETAILS()],
|
|
17537
|
+
}),
|
|
17538
|
+
// Partial update (PATCH) - updates only provided fields
|
|
17539
|
+
patchWorkflow: builder.mutation({
|
|
17540
|
+
query: ({ org, uniqueId, data }) => ({
|
|
17541
|
+
url: WORKFLOWS_ENDPOINTS.UPDATE.path(org, uniqueId),
|
|
17542
|
+
method: 'PATCH',
|
|
17543
|
+
body: data,
|
|
17544
|
+
service: WORKFLOWS_ENDPOINTS.UPDATE.service,
|
|
17545
|
+
}),
|
|
17546
|
+
invalidatesTags: [...WORKFLOWS_QUERY_KEYS.LIST(), ...WORKFLOWS_QUERY_KEYS.DETAILS()],
|
|
17547
|
+
}),
|
|
17548
|
+
deleteWorkflow: builder.mutation({
|
|
17549
|
+
query: ({ org, uniqueId }) => ({
|
|
17550
|
+
url: WORKFLOWS_ENDPOINTS.DELETE.path(org, uniqueId),
|
|
17551
|
+
method: 'DELETE',
|
|
17552
|
+
service: WORKFLOWS_ENDPOINTS.DELETE.service,
|
|
17553
|
+
}),
|
|
17554
|
+
invalidatesTags: WORKFLOWS_QUERY_KEYS.LIST(),
|
|
17555
|
+
}),
|
|
17556
|
+
activateWorkflow: builder.mutation({
|
|
17557
|
+
query: ({ org, uniqueId }) => ({
|
|
17558
|
+
url: WORKFLOWS_ENDPOINTS.ACTIVATE.path(org, uniqueId),
|
|
17559
|
+
method: 'POST',
|
|
17560
|
+
service: WORKFLOWS_ENDPOINTS.ACTIVATE.service,
|
|
17561
|
+
}),
|
|
17562
|
+
invalidatesTags: [...WORKFLOWS_QUERY_KEYS.LIST(), ...WORKFLOWS_QUERY_KEYS.DETAILS()],
|
|
17563
|
+
}),
|
|
17564
|
+
deactivateWorkflow: builder.mutation({
|
|
17565
|
+
query: ({ org, uniqueId }) => ({
|
|
17566
|
+
url: WORKFLOWS_ENDPOINTS.DEACTIVATE.path(org, uniqueId),
|
|
17567
|
+
method: 'POST',
|
|
17568
|
+
service: WORKFLOWS_ENDPOINTS.DEACTIVATE.service,
|
|
17569
|
+
}),
|
|
17570
|
+
invalidatesTags: [...WORKFLOWS_QUERY_KEYS.LIST(), ...WORKFLOWS_QUERY_KEYS.DETAILS()],
|
|
17571
|
+
}),
|
|
17572
|
+
publishWorkflow: builder.mutation({
|
|
17573
|
+
query: ({ org, uniqueId, data }) => ({
|
|
17574
|
+
url: WORKFLOWS_ENDPOINTS.PUBLISH.path(org, uniqueId),
|
|
17575
|
+
method: 'POST',
|
|
17576
|
+
body: data,
|
|
17577
|
+
service: WORKFLOWS_ENDPOINTS.PUBLISH.service,
|
|
17578
|
+
}),
|
|
17579
|
+
invalidatesTags: [...WORKFLOWS_QUERY_KEYS.LIST(), ...WORKFLOWS_QUERY_KEYS.DETAILS()],
|
|
17580
|
+
}),
|
|
17581
|
+
unpublishWorkflow: builder.mutation({
|
|
17582
|
+
query: ({ org, uniqueId }) => ({
|
|
17583
|
+
url: WORKFLOWS_ENDPOINTS.UNPUBLISH.path(org, uniqueId),
|
|
17584
|
+
method: 'POST',
|
|
17585
|
+
service: WORKFLOWS_ENDPOINTS.UNPUBLISH.service,
|
|
17586
|
+
}),
|
|
17587
|
+
invalidatesTags: [...WORKFLOWS_QUERY_KEYS.LIST(), ...WORKFLOWS_QUERY_KEYS.DETAILS()],
|
|
17588
|
+
}),
|
|
17589
|
+
validateWorkflow: builder.mutation({
|
|
17590
|
+
query: ({ org, uniqueId }) => ({
|
|
17591
|
+
url: WORKFLOWS_ENDPOINTS.VALIDATE.path(org, uniqueId),
|
|
17592
|
+
method: 'POST',
|
|
17593
|
+
service: WORKFLOWS_ENDPOINTS.VALIDATE.service,
|
|
17594
|
+
}),
|
|
17595
|
+
}),
|
|
17596
|
+
chatWithWorkflow: builder.mutation({
|
|
17597
|
+
query: ({ org, uniqueId, message }) => ({
|
|
17598
|
+
url: WORKFLOWS_ENDPOINTS.CHAT.path(org, uniqueId),
|
|
17599
|
+
method: 'POST',
|
|
17600
|
+
body: { message },
|
|
17601
|
+
service: WORKFLOWS_ENDPOINTS.CHAT.service,
|
|
17602
|
+
}),
|
|
17603
|
+
}),
|
|
17604
|
+
getNodeTypes: builder.query({
|
|
17605
|
+
query: ({ org }) => ({
|
|
17606
|
+
url: WORKFLOWS_ENDPOINTS.NODE_TYPES.path(org),
|
|
17607
|
+
service: WORKFLOWS_ENDPOINTS.NODE_TYPES.service,
|
|
17608
|
+
}),
|
|
17609
|
+
providesTags: WORKFLOWS_QUERY_KEYS.NODE_TYPES(),
|
|
17610
|
+
}),
|
|
17611
|
+
}),
|
|
17612
|
+
});
|
|
17613
|
+
|
|
17412
17614
|
function useMentorSettings({ mentorId, tenantKey, username, isPublicRoute, }) {
|
|
17413
17615
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
17414
17616
|
const isLoggedIn = username !== ANONYMOUS_USERNAME;
|