@iblai/data-layer 1.9.6 → 1.9.7

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
@@ -39332,7 +39332,28 @@ const NON_RETRYABLE_STATUS_CODES = [402, 401];
39332
39332
  * Uses `retry.fail()` to immediately bail out of the retry loop.
39333
39333
  */
39334
39334
  const withNonRetryableErrors = (query$1) => async (args, api, extraOptions) => {
39335
- const result = await query$1(args, api, extraOptions);
39335
+ let result;
39336
+ try {
39337
+ result = await query$1(args, api, extraOptions);
39338
+ }
39339
+ catch (e) {
39340
+ // RTK's `retry` only counts attempts for errors RETURNED as `{ error }`
39341
+ // (wrapped in HandledError); a THROWN exception bypasses its
39342
+ // retryCondition and makes the `while (true)` loop spin forever —
39343
+ // an eternal 'pending' query with no network request and no surfaced
39344
+ // error. fetchBaseQuery can throw before fetch (e.g. from
39345
+ // prepareHeaders), so convert throws into returned errors to keep the
39346
+ // retry loop bounded.
39347
+ const message = e instanceof Error ? `${e.name}: ${e.message}` : String(e);
39348
+ return {
39349
+ error: {
39350
+ status: 'FETCH_ERROR',
39351
+ // `data` is what iblFetchBaseQuery propagates to callers/logs.
39352
+ data: message,
39353
+ error: message,
39354
+ },
39355
+ };
39356
+ }
39336
39357
  if (result.error && NON_RETRYABLE_STATUS_CODES.includes(result.error.status)) {
39337
39358
  query.retry.fail(result.error);
39338
39359
  }
@@ -43489,6 +43510,163 @@ const notificationsCustomApiSlice = react.createApi({
43489
43510
  });
43490
43511
  const { useGetTemplatesQuery, useLazyGetTemplatesQuery, useGetTemplateDetailsQuery, useLazyGetTemplateDetailsQuery, useUpdateTemplateMutation, useToggleTemplateMutation, } = notificationsCustomApiSlice;
43491
43512
 
43513
+ const SUPPORT_TICKETS_REDUCER_PATH = 'supportTicketsApiSlice';
43514
+ const SUPPORT_TICKETS_TAGS = {
43515
+ TICKETS: 'SUPPORT_TICKETS',
43516
+ TICKET: 'SUPPORT_TICKET',
43517
+ TICKET_MESSAGES: 'SUPPORT_TICKET_MESSAGES',
43518
+ };
43519
+ const SUPPORT_TICKETS_ENDPOINTS = {
43520
+ TICKETS: {
43521
+ service: exports.SERVICES.DM,
43522
+ path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/support-tickets/`,
43523
+ },
43524
+ TICKET: {
43525
+ service: exports.SERVICES.DM,
43526
+ path: (org, userId, id) => `/api/ai-mentor/orgs/${org}/users/${userId}/support-tickets/${id}/`,
43527
+ },
43528
+ TICKET_CLOSE: {
43529
+ service: exports.SERVICES.DM,
43530
+ path: (org, userId, id) => `/api/ai-mentor/orgs/${org}/users/${userId}/support-tickets/${id}/close/`,
43531
+ },
43532
+ TICKET_MESSAGES: {
43533
+ service: exports.SERVICES.DM,
43534
+ path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/support-ticket-messages/`,
43535
+ },
43536
+ TICKET_MESSAGE: {
43537
+ service: exports.SERVICES.DM,
43538
+ path: (org, userId, id) => `/api/ai-mentor/orgs/${org}/users/${userId}/support-ticket-messages/${id}/`,
43539
+ },
43540
+ };
43541
+
43542
+ /**
43543
+ * Human Support ticket endpoints
43544
+ * (`/api/ai-mentor/orgs/{org}/users/{user_id}/support-tickets/` and
43545
+ * `/api/ai-mentor/orgs/{org}/users/{user_id}/support-ticket-messages/`).
43546
+ *
43547
+ * Hand-written: these endpoints are newer than the pinned `@iblai/iblai-api`
43548
+ * release, so there is no generated service method to wrap yet.
43549
+ */
43550
+ const supportTicketsApiSlice = react.createApi({
43551
+ reducerPath: SUPPORT_TICKETS_REDUCER_PATH,
43552
+ tagTypes: [...Object.values(SUPPORT_TICKETS_TAGS)],
43553
+ baseQuery: iblFetchBaseQuery,
43554
+ endpoints: (builder) => ({
43555
+ getSupportTickets: builder.query({
43556
+ query: ({ org, userId, mentorId, page, pageSize, session, status, username }) => ({
43557
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKETS.path(org, userId),
43558
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKETS.service,
43559
+ params: {
43560
+ mentor_id: mentorId,
43561
+ page,
43562
+ page_size: pageSize,
43563
+ session,
43564
+ status,
43565
+ username,
43566
+ },
43567
+ }),
43568
+ providesTags: [SUPPORT_TICKETS_TAGS.TICKETS],
43569
+ }),
43570
+ getSupportTicket: builder.query({
43571
+ query: ({ org, userId, id }) => ({
43572
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKET.path(org, userId, id),
43573
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKET.service,
43574
+ }),
43575
+ providesTags: [SUPPORT_TICKETS_TAGS.TICKET],
43576
+ }),
43577
+ updateSupportTicket: builder.mutation({
43578
+ query: ({ org, userId, id, body }) => ({
43579
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKET.path(org, userId, id),
43580
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKET.service,
43581
+ method: 'PUT',
43582
+ body,
43583
+ }),
43584
+ invalidatesTags: [SUPPORT_TICKETS_TAGS.TICKETS, SUPPORT_TICKETS_TAGS.TICKET],
43585
+ }),
43586
+ patchSupportTicket: builder.mutation({
43587
+ query: ({ org, userId, id, body }) => ({
43588
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKET.path(org, userId, id),
43589
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKET.service,
43590
+ method: 'PATCH',
43591
+ body,
43592
+ }),
43593
+ invalidatesTags: [SUPPORT_TICKETS_TAGS.TICKETS, SUPPORT_TICKETS_TAGS.TICKET],
43594
+ }),
43595
+ deleteSupportTicket: builder.mutation({
43596
+ query: ({ org, userId, id }) => ({
43597
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKET.path(org, userId, id),
43598
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKET.service,
43599
+ method: 'DELETE',
43600
+ }),
43601
+ invalidatesTags: [SUPPORT_TICKETS_TAGS.TICKETS],
43602
+ }),
43603
+ closeSupportTicket: builder.mutation({
43604
+ query: ({ org, userId, id }) => ({
43605
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKET_CLOSE.path(org, userId, id),
43606
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKET_CLOSE.service,
43607
+ method: 'POST',
43608
+ }),
43609
+ invalidatesTags: [SUPPORT_TICKETS_TAGS.TICKETS, SUPPORT_TICKETS_TAGS.TICKET],
43610
+ }),
43611
+ getSupportTicketMessages: builder.query({
43612
+ query: ({ org, userId, ticket, sender, page, pageSize }) => ({
43613
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGES.path(org, userId),
43614
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGES.service,
43615
+ params: {
43616
+ ticket,
43617
+ sender,
43618
+ page,
43619
+ page_size: pageSize,
43620
+ },
43621
+ }),
43622
+ providesTags: [SUPPORT_TICKETS_TAGS.TICKET_MESSAGES],
43623
+ }),
43624
+ getSupportTicketMessage: builder.query({
43625
+ query: ({ org, userId, id }) => ({
43626
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGE.path(org, userId, id),
43627
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGE.service,
43628
+ }),
43629
+ providesTags: [SUPPORT_TICKETS_TAGS.TICKET_MESSAGES],
43630
+ }),
43631
+ createSupportTicketMessage: builder.mutation({
43632
+ query: ({ org, userId, body }) => ({
43633
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGES.path(org, userId),
43634
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGES.service,
43635
+ method: 'POST',
43636
+ body,
43637
+ }),
43638
+ invalidatesTags: [SUPPORT_TICKETS_TAGS.TICKET_MESSAGES],
43639
+ }),
43640
+ updateSupportTicketMessage: builder.mutation({
43641
+ query: ({ org, userId, id, body }) => ({
43642
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGE.path(org, userId, id),
43643
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGE.service,
43644
+ method: 'PUT',
43645
+ body,
43646
+ }),
43647
+ invalidatesTags: [SUPPORT_TICKETS_TAGS.TICKET_MESSAGES],
43648
+ }),
43649
+ patchSupportTicketMessage: builder.mutation({
43650
+ query: ({ org, userId, id, body }) => ({
43651
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGE.path(org, userId, id),
43652
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGE.service,
43653
+ method: 'PATCH',
43654
+ body,
43655
+ }),
43656
+ invalidatesTags: [SUPPORT_TICKETS_TAGS.TICKET_MESSAGES],
43657
+ }),
43658
+ deleteSupportTicketMessage: builder.mutation({
43659
+ query: ({ org, userId, id }) => ({
43660
+ url: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGE.path(org, userId, id),
43661
+ service: SUPPORT_TICKETS_ENDPOINTS.TICKET_MESSAGE.service,
43662
+ method: 'DELETE',
43663
+ }),
43664
+ invalidatesTags: [SUPPORT_TICKETS_TAGS.TICKET_MESSAGES],
43665
+ }),
43666
+ }),
43667
+ });
43668
+ const { useGetSupportTicketsQuery, useLazyGetSupportTicketsQuery, useGetSupportTicketQuery, useLazyGetSupportTicketQuery, useUpdateSupportTicketMutation, usePatchSupportTicketMutation, useDeleteSupportTicketMutation, useCloseSupportTicketMutation, useGetSupportTicketMessagesQuery, useLazyGetSupportTicketMessagesQuery, useGetSupportTicketMessageQuery, useLazyGetSupportTicketMessageQuery, useCreateSupportTicketMessageMutation, useUpdateSupportTicketMessageMutation, usePatchSupportTicketMessageMutation, useDeleteSupportTicketMessageMutation, } = supportTicketsApiSlice;
43669
+
43492
43670
  const MENTOR_CUSTOM_REDUCER_PATH = 'mentorCustomApiSlice';
43493
43671
  const MENTOR_ENDPOINTS = {
43494
43672
  EDIT_MENTOR_SETTINGS: {
@@ -46430,6 +46608,7 @@ const mentorReducer = {
46430
46608
  [watchedGroupsApiSlice.reducerPath]: watchedGroupsApiSlice.reducer,
46431
46609
  [chatPrivacyApiSlice.reducerPath]: chatPrivacyApiSlice.reducer,
46432
46610
  [skillsApiSlice.reducerPath]: skillsApiSlice.reducer,
46611
+ [supportTicketsApiSlice.reducerPath]: supportTicketsApiSlice.reducer,
46433
46612
  };
46434
46613
  const mentorMiddleware = [
46435
46614
  mentorApiSlice.middleware,
@@ -46488,6 +46667,7 @@ const mentorMiddleware = [
46488
46667
  watchedGroupsApiSlice.middleware,
46489
46668
  chatPrivacyApiSlice.middleware,
46490
46669
  skillsApiSlice.middleware,
46670
+ supportTicketsApiSlice.middleware,
46491
46671
  ];
46492
46672
 
46493
46673
  const skillsReducer = {
@@ -46653,6 +46833,9 @@ exports.RETIREMENT_ENDPOINTS = RETIREMENT_ENDPOINTS;
46653
46833
  exports.STORAGE_KEYS = STORAGE_KEYS;
46654
46834
  exports.STUDIO_AUTHORING_ENDPOINTS = STUDIO_AUTHORING_ENDPOINTS;
46655
46835
  exports.SUGGESTED_PRIVACY_ENTITIES = SUGGESTED_PRIVACY_ENTITIES;
46836
+ exports.SUPPORT_TICKETS_ENDPOINTS = SUPPORT_TICKETS_ENDPOINTS;
46837
+ exports.SUPPORT_TICKETS_REDUCER_PATH = SUPPORT_TICKETS_REDUCER_PATH;
46838
+ exports.SUPPORT_TICKETS_TAGS = SUPPORT_TICKETS_TAGS;
46656
46839
  exports.TENANT_IDENTIFIERS = TENANT_IDENTIFIERS;
46657
46840
  exports.TENANT_LOGO_ENDPOINTS = TENANT_LOGO_ENDPOINTS;
46658
46841
  exports.TENANT_LOGO_QUERY_KEYS = TENANT_LOGO_QUERY_KEYS;
@@ -46742,6 +46925,7 @@ exports.skillsMiddleware = skillsMiddleware;
46742
46925
  exports.skillsReducer = skillsReducer;
46743
46926
  exports.stripeApiSlice = stripeApiSlice;
46744
46927
  exports.studioAuthoringApiSlice = studioAuthoringApiSlice;
46928
+ exports.supportTicketsApiSlice = supportTicketsApiSlice;
46745
46929
  exports.tenantApiReducer = tenantApiReducer;
46746
46930
  exports.tenantApiSlice = tenantApiSlice;
46747
46931
  exports.tenantLogoApiSlice = tenantLogoApiSlice;
@@ -46759,6 +46943,7 @@ exports.useCancelSubscriptionMutation = useCancelSubscriptionMutation;
46759
46943
  exports.useChatWithWorkflowMutation = useChatWithWorkflowMutation;
46760
46944
  exports.useCheckAccessQuery = useCheckAccessQuery;
46761
46945
  exports.useCheckAccessUnscopedQuery = useCheckAccessUnscopedQuery;
46946
+ exports.useCloseSupportTicketMutation = useCloseSupportTicketMutation;
46762
46947
  exports.useConnectedServicesCallbackQuery = useConnectedServicesCallbackQuery;
46763
46948
  exports.useCreateAdminProjectMutation = useCreateAdminProjectMutation;
46764
46949
  exports.useCreateAgentSkillMutation = useCreateAgentSkillMutation;
@@ -46824,6 +47009,7 @@ exports.useCreateStripeCheckoutSessionMutation = useCreateStripeCheckoutSessionM
46824
47009
  exports.useCreateStripeCustomerPortalMutation = useCreateStripeCustomerPortalMutation;
46825
47010
  exports.useCreateStudioCourseMutation = useCreateStudioCourseMutation;
46826
47011
  exports.useCreateStudioXblockMutation = useCreateStudioXblockMutation;
47012
+ exports.useCreateSupportTicketMessageMutation = useCreateSupportTicketMessageMutation;
46827
47013
  exports.useCreateTrainingDocumentRetrainScheduleMutation = useCreateTrainingDocumentRetrainScheduleMutation;
46828
47014
  exports.useCreateUserCompanyMutation = useCreateUserCompanyMutation;
46829
47015
  exports.useCreateUserEducationMutation = useCreateUserEducationMutation;
@@ -46873,6 +47059,8 @@ exports.useDeleteRbacPolicyMutation = useDeleteRbacPolicyMutation;
46873
47059
  exports.useDeleteRbacRoleMutation = useDeleteRbacRoleMutation;
46874
47060
  exports.useDeleteRecommendedPromptMutation = useDeleteRecommendedPromptMutation;
46875
47061
  exports.useDeleteStudioCourseMutation = useDeleteStudioCourseMutation;
47062
+ exports.useDeleteSupportTicketMessageMutation = useDeleteSupportTicketMessageMutation;
47063
+ exports.useDeleteSupportTicketMutation = useDeleteSupportTicketMutation;
46876
47064
  exports.useDeleteTrainingDocumentMutation = useDeleteTrainingDocumentMutation;
46877
47065
  exports.useDeleteUserEducationMutation = useDeleteUserEducationMutation;
46878
47066
  exports.useDeleteUserExperienceMutation = useDeleteUserExperienceMutation;
@@ -47063,6 +47251,10 @@ exports.useGetStripeConnectStatusQuery = useGetStripeConnectStatusQuery;
47063
47251
  exports.useGetStripeContextQuery = useGetStripeContextQuery;
47064
47252
  exports.useGetStripePricingPageSessionQuery = useGetStripePricingPageSessionQuery;
47065
47253
  exports.useGetStudentMentorCreationStatusQuery = useGetStudentMentorCreationStatusQuery;
47254
+ exports.useGetSupportTicketMessageQuery = useGetSupportTicketMessageQuery;
47255
+ exports.useGetSupportTicketMessagesQuery = useGetSupportTicketMessagesQuery;
47256
+ exports.useGetSupportTicketQuery = useGetSupportTicketQuery;
47257
+ exports.useGetSupportTicketsQuery = useGetSupportTicketsQuery;
47066
47258
  exports.useGetTemplateDetailsQuery = useGetTemplateDetailsQuery;
47067
47259
  exports.useGetTemplatesQuery = useGetTemplatesQuery;
47068
47260
  exports.useGetTenantChatPrivacyConfigQuery = useGetTenantChatPrivacyConfigQuery;
@@ -47256,6 +47448,10 @@ exports.useLazyGetStripeConnectDashboardQuery = useLazyGetStripeConnectDashboard
47256
47448
  exports.useLazyGetStripeConnectStatusQuery = useLazyGetStripeConnectStatusQuery;
47257
47449
  exports.useLazyGetStripeContextQuery = useLazyGetStripeContextQuery;
47258
47450
  exports.useLazyGetStripePricingPageSessionQuery = useLazyGetStripePricingPageSessionQuery;
47451
+ exports.useLazyGetSupportTicketMessageQuery = useLazyGetSupportTicketMessageQuery;
47452
+ exports.useLazyGetSupportTicketMessagesQuery = useLazyGetSupportTicketMessagesQuery;
47453
+ exports.useLazyGetSupportTicketQuery = useLazyGetSupportTicketQuery;
47454
+ exports.useLazyGetSupportTicketsQuery = useLazyGetSupportTicketsQuery;
47259
47455
  exports.useLazyGetTemplateDetailsQuery = useLazyGetTemplateDetailsQuery;
47260
47456
  exports.useLazyGetTemplatesQuery = useLazyGetTemplatesQuery;
47261
47457
  exports.useLazyGetTenantChatPrivacyConfigQuery = useLazyGetTenantChatPrivacyConfigQuery;
@@ -47336,6 +47532,8 @@ exports.usePartialUpdateMCPServerMutation = usePartialUpdateMCPServerMutation;
47336
47532
  exports.usePartialUpdatePeriodicAgentMutation = usePartialUpdatePeriodicAgentMutation;
47337
47533
  exports.usePartialUpdateRbacRoleMutation = usePartialUpdateRbacRoleMutation;
47338
47534
  exports.usePatchMCPServerConnectionMutation = usePatchMCPServerConnectionMutation;
47535
+ exports.usePatchSupportTicketMessageMutation = usePatchSupportTicketMessageMutation;
47536
+ exports.usePatchSupportTicketMutation = usePatchSupportTicketMutation;
47339
47537
  exports.usePatchWorkflowMutation = usePatchWorkflowMutation;
47340
47538
  exports.usePlatformInvitationsQuery = usePlatformInvitationsQuery;
47341
47539
  exports.usePlatformUserGroupsQuery = usePlatformUserGroupsQuery;
@@ -47410,6 +47608,8 @@ exports.useUpdateSessionDisableChathistoryMutation = useUpdateSessionDisableChat
47410
47608
  exports.useUpdateShareableLinkMutation = useUpdateShareableLinkMutation;
47411
47609
  exports.useUpdateStudioCourseSettingsMutation = useUpdateStudioCourseSettingsMutation;
47412
47610
  exports.useUpdateStudioXblockMutation = useUpdateStudioXblockMutation;
47611
+ exports.useUpdateSupportTicketMessageMutation = useUpdateSupportTicketMessageMutation;
47612
+ exports.useUpdateSupportTicketMutation = useUpdateSupportTicketMutation;
47413
47613
  exports.useUpdateTemplateMutation = useUpdateTemplateMutation;
47414
47614
  exports.useUpdateTenantChatPrivacyConfigMutation = useUpdateTenantChatPrivacyConfigMutation;
47415
47615
  exports.useUpdateTenantMetadataMutation = useUpdateTenantMetadataMutation;