@connectedxm/admin 3.3.2 → 3.3.4

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
@@ -16541,6 +16541,116 @@ var useGetSearchListValue = (searchListId = "", valueId = "", options = {}) => {
16541
16541
  );
16542
16542
  };
16543
16543
 
16544
+ // src/queries/useConnectedCursorQuery.ts
16545
+ import {
16546
+ useInfiniteQuery as useInfiniteQuery2
16547
+ } from "@tanstack/react-query";
16548
+ var useConnectedCursorQuery = (queryKeys, queryFn, params = {}, options = {
16549
+ shouldRedirect: false
16550
+ }, domain) => {
16551
+ if (typeof params.pageSize === "undefined") params.pageSize = 25;
16552
+ const {
16553
+ onModuleForbidden,
16554
+ onNotAuthorized,
16555
+ onNotFound,
16556
+ apiUrl,
16557
+ getToken,
16558
+ organizationId,
16559
+ getExecuteAs,
16560
+ queryClient
16561
+ } = useConnectedXM();
16562
+ const { allowed } = usePermission_default(domain, domain ? "read" : void 0);
16563
+ const getNextPageParam = (lastPage) => {
16564
+ if (lastPage.cursor) {
16565
+ return lastPage.cursor;
16566
+ }
16567
+ return null;
16568
+ };
16569
+ return useInfiniteQuery2({
16570
+ staleTime: 60 * 1e3,
16571
+ // 60 Seconds
16572
+ retry: (failureCount, error) => {
16573
+ if (error.response?.status === 404) {
16574
+ if (onNotFound) onNotFound(error, queryKeys, options.shouldRedirect || false);
16575
+ return false;
16576
+ }
16577
+ if (error.response?.status === 403 || error.response?.status === 460 || error.response?.status === 461) {
16578
+ if (onModuleForbidden) onModuleForbidden(error, queryKeys, options.shouldRedirect || false);
16579
+ return false;
16580
+ }
16581
+ if (error.response?.status === 401) {
16582
+ if (onNotAuthorized) onNotAuthorized(error, queryKeys, options.shouldRedirect || false);
16583
+ return false;
16584
+ }
16585
+ if (failureCount < 3) return true;
16586
+ return false;
16587
+ },
16588
+ ...options,
16589
+ queryKey: [
16590
+ ...queryKeys,
16591
+ ...GetBaseInfiniteQueryKeys(params?.search)
16592
+ ],
16593
+ queryFn: ({ pageParam }) => queryFn({
16594
+ ...params,
16595
+ pageSize: params.pageSize || 25,
16596
+ cursor: pageParam,
16597
+ queryClient,
16598
+ adminApiParams: {
16599
+ apiUrl,
16600
+ getToken,
16601
+ organizationId,
16602
+ getExecuteAs
16603
+ }
16604
+ }),
16605
+ initialPageParam: null,
16606
+ getNextPageParam,
16607
+ enabled: (!domain || allowed) && options.enabled
16608
+ });
16609
+ };
16610
+
16611
+ // src/queries/searchlists/useGetSearchListConnectedQuestions.ts
16612
+ var SEARCHLIST_CONNECTED_QUESTIONS_QUERY_KEY = (searchListId, params = {}) => [...SEARCHLIST_QUERY_KEY(searchListId), "CONNECTED_QUESTIONS", params];
16613
+ var SET_SEARCHLIST_CONNECTED_QUESTIONS_QUERY_DATA = (client, keyParams, response) => {
16614
+ client.setQueryData(
16615
+ SEARCHLIST_CONNECTED_QUESTIONS_QUERY_KEY(...keyParams),
16616
+ response
16617
+ );
16618
+ };
16619
+ var GetSearchListConnectedQuestions = async ({
16620
+ searchListId,
16621
+ cursor,
16622
+ pageSize,
16623
+ orderBy,
16624
+ search,
16625
+ adminApiParams
16626
+ }) => {
16627
+ const adminApi = await GetAdminAPI(adminApiParams);
16628
+ const { data } = await adminApi.get(
16629
+ `/searchlists/${searchListId}/questions`,
16630
+ {
16631
+ params: {
16632
+ cursor,
16633
+ pageSize,
16634
+ orderBy,
16635
+ search
16636
+ }
16637
+ }
16638
+ );
16639
+ return data;
16640
+ };
16641
+ var useGetSearchListConnectedQuestions = (searchListId = "", params = {}, options = {}) => {
16642
+ return useConnectedCursorQuery(
16643
+ SEARCHLIST_CONNECTED_QUESTIONS_QUERY_KEY(searchListId, params),
16644
+ (queryParams) => GetSearchListConnectedQuestions({ searchListId, ...queryParams }),
16645
+ params,
16646
+ {
16647
+ ...options,
16648
+ enabled: !!searchListId && (options?.enabled ?? true)
16649
+ },
16650
+ "events"
16651
+ );
16652
+ };
16653
+
16544
16654
  // src/queries/self/useGetSelf.ts
16545
16655
  var SELF_QUERY_KEY = () => ["SELF"];
16546
16656
  var SET_SELF_QUERY_DATA = (client, keyParams, response) => {
@@ -18363,73 +18473,6 @@ var useGetThreadMembers = (threadId = "", params = {}, options = {}) => {
18363
18473
  );
18364
18474
  };
18365
18475
 
18366
- // src/queries/useConnectedCursorQuery.ts
18367
- import {
18368
- useInfiniteQuery as useInfiniteQuery2
18369
- } from "@tanstack/react-query";
18370
- var useConnectedCursorQuery = (queryKeys, queryFn, params = {}, options = {
18371
- shouldRedirect: false
18372
- }, domain) => {
18373
- if (typeof params.pageSize === "undefined") params.pageSize = 25;
18374
- const {
18375
- onModuleForbidden,
18376
- onNotAuthorized,
18377
- onNotFound,
18378
- apiUrl,
18379
- getToken,
18380
- organizationId,
18381
- getExecuteAs,
18382
- queryClient
18383
- } = useConnectedXM();
18384
- const { allowed } = usePermission_default(domain, domain ? "read" : void 0);
18385
- const getNextPageParam = (lastPage) => {
18386
- if (lastPage.cursor) {
18387
- return lastPage.cursor;
18388
- }
18389
- return null;
18390
- };
18391
- return useInfiniteQuery2({
18392
- staleTime: 60 * 1e3,
18393
- // 60 Seconds
18394
- retry: (failureCount, error) => {
18395
- if (error.response?.status === 404) {
18396
- if (onNotFound) onNotFound(error, queryKeys, options.shouldRedirect || false);
18397
- return false;
18398
- }
18399
- if (error.response?.status === 403 || error.response?.status === 460 || error.response?.status === 461) {
18400
- if (onModuleForbidden) onModuleForbidden(error, queryKeys, options.shouldRedirect || false);
18401
- return false;
18402
- }
18403
- if (error.response?.status === 401) {
18404
- if (onNotAuthorized) onNotAuthorized(error, queryKeys, options.shouldRedirect || false);
18405
- return false;
18406
- }
18407
- if (failureCount < 3) return true;
18408
- return false;
18409
- },
18410
- ...options,
18411
- queryKey: [
18412
- ...queryKeys,
18413
- ...GetBaseInfiniteQueryKeys(params?.search)
18414
- ],
18415
- queryFn: ({ pageParam }) => queryFn({
18416
- ...params,
18417
- pageSize: params.pageSize || 25,
18418
- cursor: pageParam,
18419
- queryClient,
18420
- adminApiParams: {
18421
- apiUrl,
18422
- getToken,
18423
- organizationId,
18424
- getExecuteAs
18425
- }
18426
- }),
18427
- initialPageParam: null,
18428
- getNextPageParam,
18429
- enabled: (!domain || allowed) && options.enabled
18430
- });
18431
- };
18432
-
18433
18476
  // src/utilities/AppendInfiniteQuery.ts
18434
18477
  import { produce } from "immer";
18435
18478
  var AppendInfiniteQuery = (queryClient, key, newData) => {
@@ -18543,8 +18586,6 @@ var TransformPrice = (value, currency) => {
18543
18586
  maximumFractionDigits: 2
18544
18587
  });
18545
18588
  if (value === 0) return "--.--";
18546
- if (value < 0)
18547
- return formatter.format(-value / 100).replace(currency, `-${currency}`);
18548
18589
  return formatter.format(value / 100);
18549
18590
  };
18550
18591
 
@@ -26944,9 +26985,9 @@ var UpdateEventQuestion = async ({
26944
26985
  queryClient.invalidateQueries({
26945
26986
  queryKey: EVENT_QUESTIONS_QUERY_KEY(eventId)
26946
26987
  });
26947
- if (question.searchListId !== void 0) {
26988
+ if (typeof data.data.searchListId === "string") {
26948
26989
  queryClient.invalidateQueries({
26949
- queryKey: SEARCHLIST_QUERY_KEY(question.searchListId)
26990
+ queryKey: SEARCHLIST_QUERY_KEY(data.data.searchListId)
26950
26991
  });
26951
26992
  queryClient.invalidateQueries({
26952
26993
  predicate: (query) => {
@@ -29076,9 +29117,9 @@ var UpdateEventSessionQuestion = async ({
29076
29117
  queryClient.invalidateQueries({
29077
29118
  queryKey: EVENT_SESSION_QUESTIONS_QUERY_KEY(eventId, sessionId)
29078
29119
  });
29079
- if (question.searchListId !== void 0) {
29120
+ if (typeof data.data.searchListId === "string") {
29080
29121
  queryClient.invalidateQueries({
29081
- queryKey: SEARCHLIST_QUERY_KEY(question.searchListId)
29122
+ queryKey: SEARCHLIST_QUERY_KEY(data.data.searchListId)
29082
29123
  });
29083
29124
  queryClient.invalidateQueries({
29084
29125
  predicate: (query) => {
@@ -35629,9 +35670,9 @@ var UpdateSurveyQuestion = async ({
35629
35670
  queryClient.invalidateQueries({
35630
35671
  queryKey: SURVEY_QUESTIONS_QUERY_KEY(surveyId)
35631
35672
  });
35632
- if (question.searchListId !== void 0) {
35673
+ if (typeof data.data.searchListId === "string") {
35633
35674
  queryClient.invalidateQueries({
35634
- queryKey: SEARCHLIST_QUERY_KEY(question.searchListId)
35675
+ queryKey: SEARCHLIST_QUERY_KEY(data.data.searchListId)
35635
35676
  });
35636
35677
  queryClient.invalidateQueries({
35637
35678
  predicate: (query) => {
@@ -38244,6 +38285,7 @@ export {
38244
38285
  GetReport,
38245
38286
  GetReports,
38246
38287
  GetSearchList,
38288
+ GetSearchListConnectedQuestions,
38247
38289
  GetSearchListValue,
38248
38290
  GetSearchListValues,
38249
38291
  GetSearchLists,
@@ -38488,6 +38530,7 @@ export {
38488
38530
  ReportType,
38489
38531
  ResendRegistrationConfirmationEmail,
38490
38532
  SEARCHLISTS_QUERY_KEY,
38533
+ SEARCHLIST_CONNECTED_QUESTIONS_QUERY_KEY,
38491
38534
  SEARCHLIST_QUERY_KEY,
38492
38535
  SEARCHLIST_VALUES_QUERY_KEY,
38493
38536
  SEARCHLIST_VALUE_QUERY_KEY,
@@ -38867,6 +38910,7 @@ export {
38867
38910
  SET_REPORTS_QUERY_DATA,
38868
38911
  SET_REPORT_QUERY_DATA,
38869
38912
  SET_SEARCHLISTS_QUERY_DATA,
38913
+ SET_SEARCHLIST_CONNECTED_QUESTIONS_QUERY_DATA,
38870
38914
  SET_SEARCHLIST_QUERY_DATA,
38871
38915
  SET_SEARCHLIST_VALUES_QUERY_DATA,
38872
38916
  SET_SEARCHLIST_VALUE_QUERY_DATA,
@@ -39934,6 +39978,7 @@ export {
39934
39978
  useGetReport,
39935
39979
  useGetReports,
39936
39980
  useGetSearchList,
39981
+ useGetSearchListConnectedQuestions,
39937
39982
  useGetSearchListValue,
39938
39983
  useGetSearchListValues,
39939
39984
  useGetSearchLists,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectedxm/admin",
3
- "version": "3.3.2",
3
+ "version": "3.3.4",
4
4
  "description": "Admin API javascript SDK",
5
5
  "author": "ConnectedXM Inc.",
6
6
  "type": "module",