@iblai/data-layer 1.12.4 → 1.12.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/dist/index.d.ts +843 -16
- package/dist/index.esm.js +133 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +141 -3
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/features/audit-logs/__tests__/api-slice.test.d.ts +1 -0
- package/dist/src/features/audit-logs/__tests__/types.test.d.ts +1 -0
- package/dist/src/features/audit-logs/api-slice.d.ts +265 -1
- package/dist/src/features/audit-logs/constants.d.ts +5 -0
- package/dist/src/features/audit-logs/types.d.ts +63 -0
- package/dist/src/features/notifications/__tests__/notifications-templates.test.d.ts +1 -0
- package/dist/src/features/notifications/constants.d.ts +9 -0
- package/dist/src/features/notifications/custom-api-slice.d.ts +391 -0
- package/dist/src/features/notifications/types.d.ts +96 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -43839,6 +43839,7 @@ const NOTIFICATIONS_CUSTOM_TAGS = {
|
|
|
43839
43839
|
TEMPLATE_DETAILS: 'NOTIFICATIONS_CUSTOM_TEMPLATE_DETAILS',
|
|
43840
43840
|
UPDATE_TEMPLATE: 'NOTIFICATIONS_CUSTOM_UPDATE_TEMPLATE',
|
|
43841
43841
|
TOGGLE_TEMPLATE: 'NOTIFICATIONS_CUSTOM_TOGGLE_TEMPLATE',
|
|
43842
|
+
RESET_TEMPLATE: 'NOTIFICATIONS_CUSTOM_RESET_TEMPLATE',
|
|
43842
43843
|
};
|
|
43843
43844
|
const NOTIFICATIONS_CUSTOM_ENDPOINTS = {
|
|
43844
43845
|
GET_TEMPLATES: {
|
|
@@ -43857,6 +43858,14 @@ const NOTIFICATIONS_CUSTOM_ENDPOINTS = {
|
|
|
43857
43858
|
service: exports.SERVICES.DM,
|
|
43858
43859
|
path: (platformKey, notificationType) => `/api/notification/v1/platforms/${platformKey}/templates/${notificationType}/toggle/`,
|
|
43859
43860
|
},
|
|
43861
|
+
RESET_TEMPLATE: {
|
|
43862
|
+
service: exports.SERVICES.DM,
|
|
43863
|
+
path: (platformKey, notificationType) => `/api/notification/v1/platforms/${platformKey}/templates/${notificationType}/reset/`,
|
|
43864
|
+
},
|
|
43865
|
+
TEST_TEMPLATE: {
|
|
43866
|
+
service: exports.SERVICES.DM,
|
|
43867
|
+
path: (platformKey, notificationType) => `/api/notification/v1/platforms/${platformKey}/templates/${notificationType}/test/`,
|
|
43868
|
+
},
|
|
43860
43869
|
};
|
|
43861
43870
|
|
|
43862
43871
|
const notificationsCustomApiSlice = react.createApi({
|
|
@@ -43906,9 +43915,50 @@ const notificationsCustomApiSlice = react.createApi({
|
|
|
43906
43915
|
},
|
|
43907
43916
|
invalidatesTags: [NOTIFICATIONS_CUSTOM_TAGS.TEMPLATES],
|
|
43908
43917
|
}),
|
|
43918
|
+
/**
|
|
43919
|
+
* Discards the platform-specific copy of the template and reverts to the
|
|
43920
|
+
* platform default.
|
|
43921
|
+
*/
|
|
43922
|
+
resetTemplate: builder.mutation({
|
|
43923
|
+
query: (args) => {
|
|
43924
|
+
return {
|
|
43925
|
+
url: NOTIFICATIONS_CUSTOM_ENDPOINTS.RESET_TEMPLATE.path(args.platformKey, args.notificationType),
|
|
43926
|
+
service: NOTIFICATIONS_CUSTOM_ENDPOINTS.RESET_TEMPLATE.service,
|
|
43927
|
+
method: 'POST',
|
|
43928
|
+
};
|
|
43929
|
+
},
|
|
43930
|
+
invalidatesTags: [
|
|
43931
|
+
NOTIFICATIONS_CUSTOM_TAGS.TEMPLATES,
|
|
43932
|
+
NOTIFICATIONS_CUSTOM_TAGS.TEMPLATE_DETAILS,
|
|
43933
|
+
],
|
|
43934
|
+
}),
|
|
43935
|
+
/** Sends a one-off rendering of the template to `testEmail`. */
|
|
43936
|
+
sendTestTemplateEmail: builder.mutation({
|
|
43937
|
+
query: (args) => {
|
|
43938
|
+
return {
|
|
43939
|
+
url: NOTIFICATIONS_CUSTOM_ENDPOINTS.TEST_TEMPLATE.path(args.platformKey, args.notificationType),
|
|
43940
|
+
service: NOTIFICATIONS_CUSTOM_ENDPOINTS.TEST_TEMPLATE.service,
|
|
43941
|
+
method: 'POST',
|
|
43942
|
+
body: {
|
|
43943
|
+
test_email: args.testEmail,
|
|
43944
|
+
},
|
|
43945
|
+
};
|
|
43946
|
+
},
|
|
43947
|
+
}),
|
|
43909
43948
|
}),
|
|
43910
43949
|
});
|
|
43911
|
-
const { useGetTemplatesQuery, useLazyGetTemplatesQuery, useGetTemplateDetailsQuery, useLazyGetTemplateDetailsQuery, useUpdateTemplateMutation, useToggleTemplateMutation, } = notificationsCustomApiSlice;
|
|
43950
|
+
const { useGetTemplatesQuery, useLazyGetTemplatesQuery, useGetTemplateDetailsQuery, useLazyGetTemplateDetailsQuery, useUpdateTemplateMutation, useToggleTemplateMutation, useResetTemplateMutation, useSendTestTemplateEmailMutation, } = notificationsCustomApiSlice;
|
|
43951
|
+
|
|
43952
|
+
/** Notification type of the "User Progress Summary" template. */
|
|
43953
|
+
const USER_PROGRESS_SUMMARY_TYPE = 'COURSES_PROGRESS_SUMMARY';
|
|
43954
|
+
const USER_PROGRESS_DATA_POINTS = [
|
|
43955
|
+
'courses_progressed',
|
|
43956
|
+
'courses_completed',
|
|
43957
|
+
'credentials_earned',
|
|
43958
|
+
'time_spent',
|
|
43959
|
+
'active_days',
|
|
43960
|
+
'mentors_accessed',
|
|
43961
|
+
];
|
|
43912
43962
|
|
|
43913
43963
|
const SUPPORT_TICKETS_REDUCER_PATH = 'supportTicketsApiSlice';
|
|
43914
43964
|
const SUPPORT_TICKETS_TAGS = {
|
|
@@ -46698,17 +46748,54 @@ const { useGetWorkflowsQuery, useLazyGetWorkflowsQuery, useGetWorkflowQuery, use
|
|
|
46698
46748
|
const AUDIT_LOGS_REDUCER_PATH = 'auditLogsApiSlice';
|
|
46699
46749
|
const AUDIT_LOGS_QUERY_KEYS = {
|
|
46700
46750
|
GET_AUDIT_LOGS: () => ['AUDIT_LOGS'],
|
|
46751
|
+
GET_PLATFORM_AUDIT_LOGS: () => ['PLATFORM_AUDIT_LOGS'],
|
|
46701
46752
|
};
|
|
46702
46753
|
const AUDIT_LOGS_ENDPOINTS = {
|
|
46703
46754
|
GET_AUDIT_LOGS: {
|
|
46704
46755
|
service: exports.SERVICES.AXD,
|
|
46705
46756
|
path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/mentors/audit-logs/`,
|
|
46706
46757
|
},
|
|
46758
|
+
GET_PLATFORM_AUDIT_LOGS: {
|
|
46759
|
+
service: exports.SERVICES.DM,
|
|
46760
|
+
path: (platformKey) => `/api/core/platforms/${encodeURIComponent(platformKey)}/audit-logs/`,
|
|
46761
|
+
},
|
|
46707
46762
|
};
|
|
46708
46763
|
|
|
46764
|
+
/**
|
|
46765
|
+
* The only query params the platform audit endpoint accepts. Anything else a
|
|
46766
|
+
* caller puts on `params` — `platform_key` above all — is dropped rather than
|
|
46767
|
+
* forwarded: tenant isolation rests on the path segment, and a smuggled scope
|
|
46768
|
+
* override must never reach the query string.
|
|
46769
|
+
*/
|
|
46770
|
+
const ALLOWED_PLATFORM_AUDIT_PARAMS = [
|
|
46771
|
+
'event_type',
|
|
46772
|
+
'action',
|
|
46773
|
+
'actor_username',
|
|
46774
|
+
'actor_email',
|
|
46775
|
+
'from_date',
|
|
46776
|
+
'to_date',
|
|
46777
|
+
'limit',
|
|
46778
|
+
'offset',
|
|
46779
|
+
];
|
|
46780
|
+
const pickAllowedParams = (params) => {
|
|
46781
|
+
if (!params)
|
|
46782
|
+
return params;
|
|
46783
|
+
const safeParams = {};
|
|
46784
|
+
for (const key of ALLOWED_PLATFORM_AUDIT_PARAMS) {
|
|
46785
|
+
const value = params[key];
|
|
46786
|
+
if (value !== undefined) {
|
|
46787
|
+
// Each key maps to its own value type; the loop erases that pairing.
|
|
46788
|
+
safeParams[key] = value;
|
|
46789
|
+
}
|
|
46790
|
+
}
|
|
46791
|
+
return safeParams;
|
|
46792
|
+
};
|
|
46709
46793
|
const auditLogsApiSlice = react.createApi({
|
|
46710
46794
|
reducerPath: AUDIT_LOGS_REDUCER_PATH,
|
|
46711
|
-
tagTypes: [
|
|
46795
|
+
tagTypes: [
|
|
46796
|
+
...AUDIT_LOGS_QUERY_KEYS.GET_AUDIT_LOGS(),
|
|
46797
|
+
...AUDIT_LOGS_QUERY_KEYS.GET_PLATFORM_AUDIT_LOGS(),
|
|
46798
|
+
],
|
|
46712
46799
|
baseQuery: iblFetchBaseQuery,
|
|
46713
46800
|
endpoints: (builder) => ({
|
|
46714
46801
|
getAuditLogs: builder.query({
|
|
@@ -46719,9 +46806,51 @@ const auditLogsApiSlice = react.createApi({
|
|
|
46719
46806
|
}),
|
|
46720
46807
|
providesTags: AUDIT_LOGS_QUERY_KEYS.GET_AUDIT_LOGS(),
|
|
46721
46808
|
}),
|
|
46809
|
+
getPlatformAuditLogs: builder.query({
|
|
46810
|
+
query: (args) => ({
|
|
46811
|
+
url: AUDIT_LOGS_ENDPOINTS.GET_PLATFORM_AUDIT_LOGS.path(args.platformKey),
|
|
46812
|
+
service: AUDIT_LOGS_ENDPOINTS.GET_PLATFORM_AUDIT_LOGS.service,
|
|
46813
|
+
params: pickAllowedParams(args.params),
|
|
46814
|
+
}),
|
|
46815
|
+
providesTags: AUDIT_LOGS_QUERY_KEYS.GET_PLATFORM_AUDIT_LOGS(),
|
|
46816
|
+
}),
|
|
46722
46817
|
}),
|
|
46723
46818
|
});
|
|
46724
|
-
const { useGetAuditLogsQuery, useLazyGetAuditLogsQuery } = auditLogsApiSlice;
|
|
46819
|
+
const { useGetAuditLogsQuery, useLazyGetAuditLogsQuery, useGetPlatformAuditLogsQuery, useLazyGetPlatformAuditLogsQuery, } = auditLogsApiSlice;
|
|
46820
|
+
|
|
46821
|
+
/* -------------------------------------------------------------------------
|
|
46822
|
+
* Platform-scoped audit trail
|
|
46823
|
+
*
|
|
46824
|
+
* `/api/core/platforms/<platform_key>/audit-logs/` merges two kinds of entry
|
|
46825
|
+
* into one stream, told apart by `event_type`:
|
|
46826
|
+
* - `event_type === null` → an automatic CRUD/model change. Read
|
|
46827
|
+
* `resource_type` / `resource_id` / `resource_repr` and the `changes` diff.
|
|
46828
|
+
* - `event_type !== null` → a manually recorded security/activity event.
|
|
46829
|
+
* Read the `event_type` label and the `metadata` payload.
|
|
46830
|
+
* Everything else (`action`, `actor_*`, `timestamp`, `remote_addr`) is shared.
|
|
46831
|
+
* ---------------------------------------------------------------------- */
|
|
46832
|
+
/** Manual event categories the backend records. `null` means a CRUD entry. */
|
|
46833
|
+
const PLATFORM_AUDIT_EVENT_TYPES = [
|
|
46834
|
+
'login',
|
|
46835
|
+
'logout',
|
|
46836
|
+
'login_failed',
|
|
46837
|
+
'password_change',
|
|
46838
|
+
'export',
|
|
46839
|
+
'download_file',
|
|
46840
|
+
'api_call',
|
|
46841
|
+
'view_student_record',
|
|
46842
|
+
'change_grade',
|
|
46843
|
+
'admin_action',
|
|
46844
|
+
];
|
|
46845
|
+
/** Integer codes the `action` query param accepts. */
|
|
46846
|
+
const PLATFORM_AUDIT_ACTION_CODES = {
|
|
46847
|
+
create: 0,
|
|
46848
|
+
update: 1,
|
|
46849
|
+
delete: 2,
|
|
46850
|
+
access: 3,
|
|
46851
|
+
};
|
|
46852
|
+
/** Backend caps `limit` at 1000 and defaults to 100 when it is omitted. */
|
|
46853
|
+
const PLATFORM_AUDIT_LOGS_MAX_LIMIT = 1000;
|
|
46725
46854
|
|
|
46726
46855
|
const EVALUATIONS_REDUCER_PATH = 'evaluationsApiSlice';
|
|
46727
46856
|
const evaluationsBase = (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/evaluations`;
|
|
@@ -47648,6 +47777,9 @@ exports.MENTOR_SKILL_ASSIGNMENTS_PAGE_SIZE = MENTOR_SKILL_ASSIGNMENTS_PAGE_SIZE;
|
|
|
47648
47777
|
exports.NOTIFICATIONS_CUSTOM_ENDPOINTS = NOTIFICATIONS_CUSTOM_ENDPOINTS;
|
|
47649
47778
|
exports.NOTIFICATIONS_CUSTOM_REDUCER_PATH = NOTIFICATIONS_CUSTOM_REDUCER_PATH;
|
|
47650
47779
|
exports.NOTIFICATIONS_CUSTOM_TAGS = NOTIFICATIONS_CUSTOM_TAGS;
|
|
47780
|
+
exports.PLATFORM_AUDIT_ACTION_CODES = PLATFORM_AUDIT_ACTION_CODES;
|
|
47781
|
+
exports.PLATFORM_AUDIT_EVENT_TYPES = PLATFORM_AUDIT_EVENT_TYPES;
|
|
47782
|
+
exports.PLATFORM_AUDIT_LOGS_MAX_LIMIT = PLATFORM_AUDIT_LOGS_MAX_LIMIT;
|
|
47651
47783
|
exports.PLATFORM_CONFIGURATION_TAG = PLATFORM_CONFIGURATION_TAG;
|
|
47652
47784
|
exports.PLATFORM_CUSTOM_ENDPOINTS = PLATFORM_CUSTOM_ENDPOINTS;
|
|
47653
47785
|
exports.PLATFORM_CUSTOM_REDUCER_PATH = PLATFORM_CUSTOM_REDUCER_PATH;
|
|
@@ -47672,6 +47804,8 @@ exports.TENANT_LOGO_ENDPOINTS = TENANT_LOGO_ENDPOINTS;
|
|
|
47672
47804
|
exports.TENANT_LOGO_QUERY_KEYS = TENANT_LOGO_QUERY_KEYS;
|
|
47673
47805
|
exports.TENANT_LOGO_REDUCER_PATH = TENANT_LOGO_REDUCER_PATH;
|
|
47674
47806
|
exports.URL_PATTERNS = URL_PATTERNS;
|
|
47807
|
+
exports.USER_PROGRESS_DATA_POINTS = USER_PROGRESS_DATA_POINTS;
|
|
47808
|
+
exports.USER_PROGRESS_SUMMARY_TYPE = USER_PROGRESS_SUMMARY_TYPE;
|
|
47675
47809
|
exports.WATCHED_GROUPS_ENDPOINTS = WATCHED_GROUPS_ENDPOINTS;
|
|
47676
47810
|
exports.WATCHED_GROUPS_QUERY_KEYS = WATCHED_GROUPS_QUERY_KEYS;
|
|
47677
47811
|
exports.WATCHED_GROUPS_REDUCER_PATH = WATCHED_GROUPS_REDUCER_PATH;
|
|
@@ -48071,6 +48205,7 @@ exports.useGetPeriodicAgentsQuery = useGetPeriodicAgentsQuery;
|
|
|
48071
48205
|
exports.useGetPersonnalizedMentorsQuery = useGetPersonnalizedMentorsQuery;
|
|
48072
48206
|
exports.useGetPersonnalizedSearchQuery = useGetPersonnalizedSearchQuery;
|
|
48073
48207
|
exports.useGetPinnedMessagesQuery = useGetPinnedMessagesQuery;
|
|
48208
|
+
exports.useGetPlatformAuditLogsQuery = useGetPlatformAuditLogsQuery;
|
|
48074
48209
|
exports.useGetPlatformConfigurationsQuery = useGetPlatformConfigurationsQuery;
|
|
48075
48210
|
exports.useGetPlatformImageAssetDetailsQuery = useGetPlatformImageAssetDetailsQuery;
|
|
48076
48211
|
exports.useGetPlatformImageAssetsListQuery = useGetPlatformImageAssetsListQuery;
|
|
@@ -48298,6 +48433,7 @@ exports.useLazyGetPeriodicAgentsQuery = useLazyGetPeriodicAgentsQuery;
|
|
|
48298
48433
|
exports.useLazyGetPersonnalizedMentorsQuery = useLazyGetPersonnalizedMentorsQuery;
|
|
48299
48434
|
exports.useLazyGetPersonnalizedSearchQuery = useLazyGetPersonnalizedSearchQuery;
|
|
48300
48435
|
exports.useLazyGetPinnedMessagesQuery = useLazyGetPinnedMessagesQuery;
|
|
48436
|
+
exports.useLazyGetPlatformAuditLogsQuery = useLazyGetPlatformAuditLogsQuery;
|
|
48301
48437
|
exports.useLazyGetPlatformInfoQuery = useLazyGetPlatformInfoQuery;
|
|
48302
48438
|
exports.useLazyGetPlatformMembershipQuery = useLazyGetPlatformMembershipQuery;
|
|
48303
48439
|
exports.useLazyGetProgramCompletionQuery = useLazyGetProgramCompletionQuery;
|
|
@@ -48439,10 +48575,12 @@ exports.useRemoveWatchedUserMutation = useRemoveWatchedUserMutation;
|
|
|
48439
48575
|
exports.useRenewApplicationMutation = useRenewApplicationMutation;
|
|
48440
48576
|
exports.useRenewSubscriptionMutation = useRenewSubscriptionMutation;
|
|
48441
48577
|
exports.useResetPasswordMutation = useResetPasswordMutation;
|
|
48578
|
+
exports.useResetTemplateMutation = useResetTemplateMutation;
|
|
48442
48579
|
exports.useRevokeShareableLinkMutation = useRevokeShareableLinkMutation;
|
|
48443
48580
|
exports.useSeedMentorsQuery = useSeedMentorsQuery;
|
|
48444
48581
|
exports.useSelfRetireMutation = useSelfRetireMutation;
|
|
48445
48582
|
exports.useSendNotificationMutation = useSendNotificationMutation;
|
|
48583
|
+
exports.useSendTestTemplateEmailMutation = useSendTestTemplateEmailMutation;
|
|
48446
48584
|
exports.useSetCurrentVersionMutation = useSetCurrentVersionMutation;
|
|
48447
48585
|
exports.useSetPlatformConfigurationsMutation = useSetPlatformConfigurationsMutation;
|
|
48448
48586
|
exports.useSetStudentMentorCreationStatusMutation = useSetStudentMentorCreationStatusMutation;
|