@iblai/data-layer 1.38.2 → 1.39.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.
package/dist/index.js CHANGED
@@ -48182,6 +48182,45 @@ const getSpendCapExceededError = (error) => {
48182
48182
  return null;
48183
48183
  };
48184
48184
 
48185
+ // Backend contract: iblai-dm-pro#3150 (iblai-platform#2766). The endpoint is
48186
+ // mounted at the DM root, not under /api/ai-mentor/, and scopes its answer to
48187
+ // the tenant named in the `iblai-org` header.
48188
+ const AGENT_SETTINGS_REDUCER_PATH = 'agentSettingsApiSlice';
48189
+ const AGENT_SETTINGS_FIELD_PERMISSIONS_PATH = '/v1/agents/settings/field-permissions';
48190
+ const IBLAI_ORG_HEADER = 'iblai-org';
48191
+ const AGENT_SETTINGS_QUERY_KEYS = {
48192
+ FIELD_PERMISSIONS: 'AGENT_SETTINGS_FIELD_PERMISSIONS',
48193
+ };
48194
+
48195
+ const agentSettingsApiSlice = react.createApi({
48196
+ reducerPath: AGENT_SETTINGS_REDUCER_PATH,
48197
+ tagTypes: [AGENT_SETTINGS_QUERY_KEYS.FIELD_PERMISSIONS],
48198
+ baseQuery: iblFetchBaseQuery,
48199
+ endpoints: (builder) => ({
48200
+ /**
48201
+ * Which create-agent fields the caller may write. A 403 means they may not
48202
+ * create agents at all and a 404 an older backend; both are returned as
48203
+ * `{ error }` so the form can fail open on them instead of logging out.
48204
+ */
48205
+ getAgentSettingsFieldPermissions: builder.query({
48206
+ query: ({ org }) => ({
48207
+ url: AGENT_SETTINGS_FIELD_PERMISSIONS_PATH,
48208
+ service: exports.SERVICES.DM,
48209
+ method: 'GET',
48210
+ headers: { [IBLAI_ORG_HEADER]: org },
48211
+ returnErrorStatuses: [403, 404],
48212
+ }),
48213
+ // The answer is advisory (the form fails open without it), so a failure
48214
+ // frees the form at once instead of holding it through three retries.
48215
+ extraOptions: { maxRetries: 0 },
48216
+ providesTags: (_result, _error, { org }) => [
48217
+ { type: AGENT_SETTINGS_QUERY_KEYS.FIELD_PERMISSIONS, id: org },
48218
+ ],
48219
+ }),
48220
+ }),
48221
+ });
48222
+ const { useGetAgentSettingsFieldPermissionsQuery, useLazyGetAgentSettingsFieldPermissionsQuery, } = agentSettingsApiSlice;
48223
+
48185
48224
  exports.recommendationPromptTypeEnum = void 0;
48186
48225
  (function (recommendationPromptTypeEnum) {
48187
48226
  recommendationPromptTypeEnum["mentors"] = "mentors";
@@ -50295,6 +50334,7 @@ const mentorReducer = {
50295
50334
  [supportTicketsApiSlice.reducerPath]: supportTicketsApiSlice.reducer,
50296
50335
  [gradingApiSlice.reducerPath]: gradingApiSlice.reducer,
50297
50336
  [spendCapsApiSlice.reducerPath]: spendCapsApiSlice.reducer,
50337
+ [agentSettingsApiSlice.reducerPath]: agentSettingsApiSlice.reducer,
50298
50338
  [userChatHistoryApiSlice.reducerPath]: userChatHistoryApiSlice.reducer,
50299
50339
  [virtualMachineApiSlice.reducerPath]: virtualMachineApiSlice.reducer,
50300
50340
  [userLlmUsageApiSlice.reducerPath]: userLlmUsageApiSlice.reducer,
@@ -50361,6 +50401,7 @@ const mentorMiddleware = [
50361
50401
  supportTicketsApiSlice.middleware,
50362
50402
  gradingApiSlice.middleware,
50363
50403
  spendCapsApiSlice.middleware,
50404
+ agentSettingsApiSlice.middleware,
50364
50405
  userChatHistoryApiSlice.middleware,
50365
50406
  virtualMachineApiSlice.middleware,
50366
50407
  userLlmUsageApiSlice.middleware,
@@ -50408,6 +50449,7 @@ const skillsReducer = {
50408
50449
  [studioAuthoringApiSlice.reducerPath]: studioAuthoringApiSlice.reducer,
50409
50450
  [watchedGroupsApiSlice.reducerPath]: watchedGroupsApiSlice.reducer,
50410
50451
  [spendCapsApiSlice.reducerPath]: spendCapsApiSlice.reducer,
50452
+ [agentSettingsApiSlice.reducerPath]: agentSettingsApiSlice.reducer,
50411
50453
  [chatPrivacyApiSlice.reducerPath]: chatPrivacyApiSlice.reducer,
50412
50454
  [agentSkillsApiSlice.reducerPath]: agentSkillsApiSlice.reducer,
50413
50455
  [userChatHistoryApiSlice.reducerPath]: userChatHistoryApiSlice.reducer,
@@ -50457,6 +50499,7 @@ const skillsMiddleware = [
50457
50499
  studioAuthoringApiSlice.middleware,
50458
50500
  watchedGroupsApiSlice.middleware,
50459
50501
  spendCapsApiSlice.middleware,
50502
+ agentSettingsApiSlice.middleware,
50460
50503
  chatPrivacyApiSlice.middleware,
50461
50504
  agentSkillsApiSlice.middleware,
50462
50505
  userChatHistoryApiSlice.middleware,
@@ -50479,6 +50522,9 @@ const initializeDataLayer = (dmUrl, lmsUrl, legacyLmsUrl, storageService, httpEr
50479
50522
  Config.edxProxyEnabled = (_a = options === null || options === void 0 ? void 0 : options.edxProxy) !== null && _a !== void 0 ? _a : false;
50480
50523
  };
50481
50524
 
50525
+ exports.AGENT_SETTINGS_FIELD_PERMISSIONS_PATH = AGENT_SETTINGS_FIELD_PERMISSIONS_PATH;
50526
+ exports.AGENT_SETTINGS_QUERY_KEYS = AGENT_SETTINGS_QUERY_KEYS;
50527
+ exports.AGENT_SETTINGS_REDUCER_PATH = AGENT_SETTINGS_REDUCER_PATH;
50482
50528
  exports.AGENT_SKILLS_ENDPOINTS = AGENT_SKILLS_ENDPOINTS;
50483
50529
  exports.AGENT_SKILLS_REDUCER_PATH = AGENT_SKILLS_REDUCER_PATH;
50484
50530
  exports.AGENT_SKILLS_TAG_TYPES = AGENT_SKILLS_TAG_TYPES;
@@ -50526,6 +50572,7 @@ exports.GRADING_REDUCER_PATH = GRADING_REDUCER_PATH;
50526
50572
  exports.HOSTING_ENDPOINTS = HOSTING_ENDPOINTS;
50527
50573
  exports.HOSTING_QUERY_KEYS = HOSTING_QUERY_KEYS;
50528
50574
  exports.HOSTING_REDUCER_PATH = HOSTING_REDUCER_PATH;
50575
+ exports.IBLAI_ORG_HEADER = IBLAI_ORG_HEADER;
50529
50576
  exports.IblDataLayer = IblDataLayer;
50530
50577
  exports.LEARNER_COMPLETION_PATH = LEARNER_COMPLETION_PATH;
50531
50578
  exports.LOGO_ENDPOINTS = LOGO_ENDPOINTS;
@@ -50610,6 +50657,7 @@ exports.WATCHER_NOTIFICATION_EVENT_LABELS = WATCHER_NOTIFICATION_EVENT_LABELS;
50610
50657
  exports.WORKFLOWS_ENDPOINTS = WORKFLOWS_ENDPOINTS;
50611
50658
  exports.WORKFLOWS_QUERY_KEYS = WORKFLOWS_QUERY_KEYS;
50612
50659
  exports.WORKFLOWS_REDUCER_PATH = WORKFLOWS_REDUCER_PATH;
50660
+ exports.agentSettingsApiSlice = agentSettingsApiSlice;
50613
50661
  exports.agentSkillsApiSlice = agentSkillsApiSlice;
50614
50662
  exports.analyticsApiSlice = analyticsApiSlice;
50615
50663
  exports.apiKeysApiReducer = apiKeysApiReducer;
@@ -50921,6 +50969,7 @@ exports.useGetAdminProjectDetailsQuery = useGetAdminProjectDetailsQuery;
50921
50969
  exports.useGetAdminProjectsQuery = useGetAdminProjectsQuery;
50922
50970
  exports.useGetAgentConfigQuery = useGetAgentConfigQuery;
50923
50971
  exports.useGetAgentCostQuery = useGetAgentCostQuery;
50972
+ exports.useGetAgentSettingsFieldPermissionsQuery = useGetAgentSettingsFieldPermissionsQuery;
50924
50973
  exports.useGetAgentSkillQuery = useGetAgentSkillQuery;
50925
50974
  exports.useGetAgentSkillResourceQuery = useGetAgentSkillResourceQuery;
50926
50975
  exports.useGetAgentSkillResourcesQuery = useGetAgentSkillResourcesQuery;
@@ -51213,6 +51262,7 @@ exports.useLazyGetAccountBillingInfoQuery = useLazyGetAccountBillingInfoQuery;
51213
51262
  exports.useLazyGetAdminProjectDetailsQuery = useLazyGetAdminProjectDetailsQuery;
51214
51263
  exports.useLazyGetAdminProjectsQuery = useLazyGetAdminProjectsQuery;
51215
51264
  exports.useLazyGetAgentConfigQuery = useLazyGetAgentConfigQuery;
51265
+ exports.useLazyGetAgentSettingsFieldPermissionsQuery = useLazyGetAgentSettingsFieldPermissionsQuery;
51216
51266
  exports.useLazyGetAgentSkillResourcesQuery = useLazyGetAgentSkillResourcesQuery;
51217
51267
  exports.useLazyGetAgentSkillsQuery = useLazyGetAgentSkillsQuery;
51218
51268
  exports.useLazyGetAgentSpendCapQuery = useLazyGetAgentSpendCapQuery;