@iblai/web-utils 1.1.14 → 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.
@@ -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 "@data-layer/services/StorageService";
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
@@ -811,7 +811,7 @@ declare const isWeb: () => boolean;
811
811
  declare const isNode: () => any;
812
812
  declare const isExpo: () => any;
813
813
  declare const isTauri: () => boolean;
814
- declare const getPlatform: () => "react-native" | "web" | "node" | "unknown";
814
+ declare const getPlatform: () => "web" | "react-native" | "node" | "unknown";
815
815
  declare const safeRequire: (moduleName: string) => any;
816
816
  declare const getNextNavigation: () => any;
817
817
 
@@ -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,
@@ -3693,19 +3705,18 @@ function MentorProvider({ children, fallback, onAuthSuccess, onAuthFailure, redi
3693
3705
  userId: username,
3694
3706
  });
3695
3707
  console.log("[determineMentorToRedirectTo] recentlyAccessedResult ", recentlyAccessedResult);
3696
- // @ts-expect-error - API returns different shape than generated types
3697
3708
  const recentlyAccessedMentors = recentlyAccessedResult.data;
3698
3709
  const starredMentors = recentlyAccessedMentors === null || recentlyAccessedMentors === void 0 ? void 0 : recentlyAccessedMentors.starred_mentors;
3699
3710
  let recentMentors = recentlyAccessedMentors === null || recentlyAccessedMentors === void 0 ? void 0 : recentlyAccessedMentors.recent_mentors;
3700
3711
  console.log("[determineMentorToRedirectTo] starredMentors ", starredMentors);
3701
- if (starredMentors.length > 0) {
3712
+ if (starredMentors && starredMentors.length > 0) {
3702
3713
  const starredMentor = starredMentors[0];
3703
3714
  if (starredMentor === null || starredMentor === void 0 ? void 0 : starredMentor.unique_id) {
3704
3715
  return starredMentor;
3705
3716
  }
3706
3717
  }
3707
3718
  console.log("[determineMentorToRedirectTo] recentMentors ", recentMentors);
3708
- if (recentMentors.length > 0) {
3719
+ if (recentMentors && recentMentors.length > 0) {
3709
3720
  const recentMentor = recentMentors[0];
3710
3721
  if (recentMentor === null || recentMentor === void 0 ? void 0 : recentMentor.unique_id) {
3711
3722
  return recentMentor;
@@ -13350,11 +13361,12 @@ Hook ${hookName} was either not provided or not a function.`);
13350
13361
  var createApi = /* @__PURE__ */ buildCreateApi(coreModule(), reactHooksModule());
13351
13362
 
13352
13363
  const STORAGE_KEYS = {
13353
- EDX_TOKEN_KEY: "edx_jwt_token",
13354
- DM_TOKEN_KEY: "dm_token",
13355
- AXD_TOKEN_KEY: "axd_token"};
13364
+ EDX_TOKEN_KEY: 'edx_jwt_token',
13365
+ DM_TOKEN_KEY: 'dm_token',
13366
+ AXD_TOKEN_KEY: 'axd_token'};
13356
13367
  var SERVICES;
13357
13368
  (function (SERVICES) {
13369
+ SERVICES["LEGACY_LMS"] = "LEGACY_LMS";
13358
13370
  SERVICES["LMS"] = "LMS";
13359
13371
  SERVICES["DM"] = "DM";
13360
13372
  SERVICES["AXD"] = "AXD";
@@ -13362,10 +13374,11 @@ var SERVICES;
13362
13374
 
13363
13375
  class Config {
13364
13376
  }
13365
- Config.lmsUrl = "https://learn.iblai.app";
13366
- Config.dmUrl = "https://base.manager.iblai.app";
13367
- Config.axdUrl = "https://base.manager.iblai.app";
13368
- Config.mentorIframeUrl = "https://mentor.iblai.tech";
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';
13369
13382
  Config.httpErrorHandlers = {};
13370
13383
 
13371
13384
  class IblDataLayer {
@@ -13426,6 +13439,8 @@ const iblFakeBaseQuery = retry(fakeBaseQueryWithLogging, {
13426
13439
  */
13427
13440
  const getServiceUrl = (service) => {
13428
13441
  switch (service) {
13442
+ case SERVICES.LEGACY_LMS:
13443
+ return Config.legacyLmsUrl;
13429
13444
  case SERVICES.LMS:
13430
13445
  return Config.lmsUrl;
13431
13446
  case SERVICES.DM:
@@ -13479,6 +13494,7 @@ const buildEndpointFromService = (service, serviceFn) => {
13479
13494
  try {
13480
13495
  OpenAPI.BASE = getServiceUrl(service);
13481
13496
  OpenAPI.HEADERS = await getHeaders(service);
13497
+ OpenAPI.CREDENTIALS = service === SERVICES.LEGACY_LMS ? 'include' : 'omit';
13482
13498
  // API request initiated
13483
13499
  const data = await serviceFn(args);
13484
13500
  // API response received
@@ -13514,6 +13530,7 @@ const isErrorObject = (data) => {
13514
13530
  const baseQuery = (service, jsonContentType = true, contentType, skipAuth = false) => fetchBaseQuery({
13515
13531
  baseUrl: getServiceUrl(service),
13516
13532
  timeout: 30000, // 30 second timeout
13533
+ credentials: service === SERVICES.LEGACY_LMS ? 'include' : 'omit',
13517
13534
  prepareHeaders: async (headers) => {
13518
13535
  // Only add auth headers if skipAuth is false
13519
13536
  if (!skipAuth) {
@@ -13627,6 +13644,7 @@ const buildEndpointFromServiceLegacy = (service, serviceFn) => {
13627
13644
  try {
13628
13645
  OpenAPI.BASE = getServiceUrl(service);
13629
13646
  OpenAPI.HEADERS = await getHeaders(service);
13647
+ OpenAPI.CREDENTIALS = service === SERVICES.LEGACY_LMS ? 'include' : 'omit';
13630
13648
  const data = await serviceFn(...args);
13631
13649
  return { data };
13632
13650
  }
@@ -14133,7 +14151,7 @@ const AUTH_ENDPOINTS = {
14133
14151
  path: () => '/api/ibl/manager/consolidated-token/proxy/',
14134
14152
  },
14135
14153
  REFRESH_JWT_TOKEN: {
14136
- service: SERVICES.LMS,
14154
+ service: SERVICES.LEGACY_LMS,
14137
14155
  path: () => '/ibl-auth/request-jwt/',
14138
14156
  },
14139
14157
  };
@@ -14167,14 +14185,12 @@ createApi({
14167
14185
  isJson: false,
14168
14186
  method: 'POST',
14169
14187
  body: formData,
14170
- credentials: 'include',
14171
14188
  }),
14172
14189
  }),
14173
14190
  refreshJwtToken: builder.query({
14174
14191
  query: () => ({
14175
14192
  url: AUTH_ENDPOINTS.REFRESH_JWT_TOKEN.path(),
14176
14193
  service: AUTH_ENDPOINTS.REFRESH_JWT_TOKEN.service,
14177
- credentials: 'include',
14178
14194
  }),
14179
14195
  }),
14180
14196
  }),
@@ -14208,10 +14224,10 @@ createApi({
14208
14224
  try {
14209
14225
  const authHeaders = await getHeaders(SERVICES.LMS);
14210
14226
  const response = await fetch(`${Config.lmsUrl}${TENANTS_ENDPOINTS.GET_USER_TENANTS.path()}`, {
14211
- credentials: 'include',
14212
14227
  headers: {
14213
14228
  ...authHeaders,
14214
14229
  },
14230
+ credentials: 'omit',
14215
14231
  });
14216
14232
  if (!response.ok) {
14217
14233
  return {
@@ -14297,6 +14313,7 @@ createApi({
14297
14313
  const response = await fetch(url, {
14298
14314
  method: 'GET',
14299
14315
  headers: OpenAPI.HEADERS,
14316
+ credentials: 'omit',
14300
14317
  });
14301
14318
  if (!response.ok) {
14302
14319
  const error = new Error('Failed to fetch platform users');
@@ -14331,6 +14348,7 @@ createApi({
14331
14348
  const response = await fetch(url, {
14332
14349
  method: 'GET',
14333
14350
  headers: OpenAPI.HEADERS,
14351
+ credentials: 'omit',
14334
14352
  });
14335
14353
  if (!response.ok) {
14336
14354
  const error = new Error('Failed to fetch team details');
@@ -14352,6 +14370,7 @@ createApi({
14352
14370
  'Content-Type': 'application/json',
14353
14371
  },
14354
14372
  body: JSON.stringify(args.requestBody),
14373
+ credentials: 'omit',
14355
14374
  });
14356
14375
  if (!response.ok) {
14357
14376
  const error = new Error('Failed to update platform user role with policies');
@@ -14577,6 +14596,7 @@ createApi({
14577
14596
  const response = await fetch(url, {
14578
14597
  method: 'GET',
14579
14598
  headers: OpenAPI.HEADERS,
14599
+ credentials: 'omit',
14580
14600
  });
14581
14601
  if (!response.ok) {
14582
14602
  const error = new Error('Failed to fetch RBAC group details');
@@ -14613,6 +14633,7 @@ createApi({
14613
14633
  const response = await fetch(url, {
14614
14634
  method: 'GET',
14615
14635
  headers: OpenAPI.HEADERS,
14636
+ credentials: 'omit',
14616
14637
  });
14617
14638
  if (!response.ok) {
14618
14639
  const error = new Error('Failed to fetch RBAC policy details');
@@ -14653,6 +14674,7 @@ createApi({
14653
14674
  const response = await fetch(url, {
14654
14675
  method: 'GET',
14655
14676
  headers: OpenAPI.HEADERS,
14677
+ credentials: 'omit',
14656
14678
  });
14657
14679
  if (!response.ok) {
14658
14680
  const error = new Error('Failed to fetch RBAC role details');
@@ -14763,6 +14785,7 @@ createApi({
14763
14785
  const response = await fetch(url, {
14764
14786
  method: 'GET',
14765
14787
  headers: OpenAPI.HEADERS,
14788
+ credentials: 'omit',
14766
14789
  });
14767
14790
  if (!response.ok) {
14768
14791
  const error = new Error('Failed to fetch credentials');
@@ -15738,6 +15761,7 @@ createApi({
15738
15761
  const response = await fetch(url, {
15739
15762
  method: 'GET',
15740
15763
  headers: OpenAPI.HEADERS,
15764
+ credentials: 'omit',
15741
15765
  });
15742
15766
  if (!response.ok) {
15743
15767
  const error = new Error('Failed to fetch program invitations');
@@ -15838,6 +15862,7 @@ const performCareerRequest = async (path, options = {}) => {
15838
15862
  method: (_b = options.method) !== null && _b !== void 0 ? _b : 'GET',
15839
15863
  body: (_c = options.body) !== null && _c !== void 0 ? _c : null,
15840
15864
  headers,
15865
+ credentials: 'omit',
15841
15866
  });
15842
15867
  if (!response.ok) {
15843
15868
  const errorData = await parseResponse(response);
@@ -17410,6 +17435,182 @@ createApi({
17410
17435
  }),
17411
17436
  });
17412
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
+
17413
17614
  function useMentorSettings({ mentorId, tenantKey, username, isPublicRoute, }) {
17414
17615
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
17415
17616
  const isLoggedIn = username !== ANONYMOUS_USERNAME;