@connectedxm/client 1.4.9 → 1.4.10

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.mts CHANGED
@@ -2649,11 +2649,12 @@ interface GetSelfLeadProps extends SingleQueryParams {
2649
2649
  declare const GetSelfLead: ({ leadId, clientApiParams, }: GetSelfLeadProps) => Promise<ConnectedXMResponse<Lead>>;
2650
2650
  declare const useGetSelfLead: (leadId?: string, options?: SingleQueryOptions<ReturnType<typeof GetSelfLead>>) => _tanstack_react_query.UseQueryResult<ConnectedXMResponse<Lead>, axios.AxiosError<ConnectedXMResponse<any>, any>>;
2651
2651
 
2652
- declare const SELF_LEADS_QUERY_KEY: () => QueryKey;
2652
+ declare const SELF_LEADS_QUERY_KEY: (status?: keyof typeof LeadStatus) => QueryKey;
2653
2653
  interface GetSelfLeadsProps extends InfiniteQueryParams {
2654
+ status?: keyof typeof LeadStatus;
2654
2655
  }
2655
- declare const GetSelfLeads: ({ pageParam, pageSize, orderBy, search, queryClient, clientApiParams, locale, }: GetSelfLeadsProps) => Promise<ConnectedXMResponse<Lead[]>>;
2656
- declare const useGetSelfLeads: (params?: Omit<InfiniteQueryParams, "pageParam" | "queryClient" | "clientApiParams">, options?: InfiniteQueryOptions<Awaited<ReturnType<typeof GetSelfLeads>>>) => _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<ConnectedXMResponse<Lead[]>, number>, axios.AxiosError<ConnectedXMResponse<null>, any>>;
2656
+ declare const GetSelfLeads: ({ status, pageParam, pageSize, orderBy, search, queryClient, clientApiParams, locale, }: GetSelfLeadsProps) => Promise<ConnectedXMResponse<Lead[]>>;
2657
+ declare const useGetSelfLeads: (status?: keyof typeof LeadStatus, params?: Omit<InfiniteQueryParams, "pageParam" | "queryClient" | "clientApiParams">, options?: InfiniteQueryOptions<Awaited<ReturnType<typeof GetSelfLeads>>>) => _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<ConnectedXMResponse<Lead[]>, number>, axios.AxiosError<ConnectedXMResponse<null>, any>>;
2657
2658
 
2658
2659
  declare const SELF_LEAD_COUNTS_QUERY_KEY: () => QueryKey;
2659
2660
  interface GetSelfLeadCountsProps extends SingleQueryParams {
package/dist/index.d.ts CHANGED
@@ -2649,11 +2649,12 @@ interface GetSelfLeadProps extends SingleQueryParams {
2649
2649
  declare const GetSelfLead: ({ leadId, clientApiParams, }: GetSelfLeadProps) => Promise<ConnectedXMResponse<Lead>>;
2650
2650
  declare const useGetSelfLead: (leadId?: string, options?: SingleQueryOptions<ReturnType<typeof GetSelfLead>>) => _tanstack_react_query.UseQueryResult<ConnectedXMResponse<Lead>, axios.AxiosError<ConnectedXMResponse<any>, any>>;
2651
2651
 
2652
- declare const SELF_LEADS_QUERY_KEY: () => QueryKey;
2652
+ declare const SELF_LEADS_QUERY_KEY: (status?: keyof typeof LeadStatus) => QueryKey;
2653
2653
  interface GetSelfLeadsProps extends InfiniteQueryParams {
2654
+ status?: keyof typeof LeadStatus;
2654
2655
  }
2655
- declare const GetSelfLeads: ({ pageParam, pageSize, orderBy, search, queryClient, clientApiParams, locale, }: GetSelfLeadsProps) => Promise<ConnectedXMResponse<Lead[]>>;
2656
- declare const useGetSelfLeads: (params?: Omit<InfiniteQueryParams, "pageParam" | "queryClient" | "clientApiParams">, options?: InfiniteQueryOptions<Awaited<ReturnType<typeof GetSelfLeads>>>) => _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<ConnectedXMResponse<Lead[]>, number>, axios.AxiosError<ConnectedXMResponse<null>, any>>;
2656
+ declare const GetSelfLeads: ({ status, pageParam, pageSize, orderBy, search, queryClient, clientApiParams, locale, }: GetSelfLeadsProps) => Promise<ConnectedXMResponse<Lead[]>>;
2657
+ declare const useGetSelfLeads: (status?: keyof typeof LeadStatus, params?: Omit<InfiniteQueryParams, "pageParam" | "queryClient" | "clientApiParams">, options?: InfiniteQueryOptions<Awaited<ReturnType<typeof GetSelfLeads>>>) => _tanstack_react_query.UseInfiniteQueryResult<_tanstack_react_query.InfiniteData<ConnectedXMResponse<Lead[]>, number>, axios.AxiosError<ConnectedXMResponse<null>, any>>;
2657
2658
 
2658
2659
  declare const SELF_LEAD_COUNTS_QUERY_KEY: () => QueryKey;
2659
2660
  interface GetSelfLeadCountsProps extends SingleQueryParams {
package/dist/index.js CHANGED
@@ -5317,11 +5317,15 @@ var useGetSelfAddress = (addressId = "", options = {}) => {
5317
5317
  };
5318
5318
 
5319
5319
  // src/queries/self/leads/useGetSelfLeads.ts
5320
- var SELF_LEADS_QUERY_KEY = () => [
5321
- ...SELF_QUERY_KEY(),
5322
- "LEADS"
5323
- ];
5320
+ var SELF_LEADS_QUERY_KEY = (status) => {
5321
+ const key = [...SELF_QUERY_KEY(), "LEADS"];
5322
+ if (status) {
5323
+ key.push(status);
5324
+ }
5325
+ return key;
5326
+ };
5324
5327
  var GetSelfLeads = async ({
5328
+ status,
5325
5329
  pageParam,
5326
5330
  pageSize,
5327
5331
  orderBy,
@@ -5333,6 +5337,7 @@ var GetSelfLeads = async ({
5333
5337
  const clientApi = await GetClientAPI(clientApiParams);
5334
5338
  const { data } = await clientApi.get(`/self/leads`, {
5335
5339
  params: {
5340
+ status: status || void 0,
5336
5341
  page: pageParam || void 0,
5337
5342
  pageSize: pageSize || void 0,
5338
5343
  orderBy: orderBy || void 0,
@@ -5349,11 +5354,11 @@ var GetSelfLeads = async ({
5349
5354
  }
5350
5355
  return data;
5351
5356
  };
5352
- var useGetSelfLeads = (params = {}, options = {}) => {
5357
+ var useGetSelfLeads = (status, params = {}, options = {}) => {
5353
5358
  const { authenticated } = useConnectedXM();
5354
5359
  return useConnectedInfiniteQuery(
5355
- SELF_LEADS_QUERY_KEY(),
5356
- (params2) => GetSelfLeads({ ...params2 }),
5360
+ SELF_LEADS_QUERY_KEY(status),
5361
+ (params2) => GetSelfLeads({ ...params2, status }),
5357
5362
  params,
5358
5363
  {
5359
5364
  ...options,
@@ -9645,10 +9650,17 @@ var UpdateSelfLead = async ({
9645
9650
  lead
9646
9651
  );
9647
9652
  if (queryClient && data.status === "ok") {
9648
- queryClient.invalidateQueries({ queryKey: SELF_LEADS_QUERY_KEY() });
9649
- queryClient.invalidateQueries({
9650
- queryKey: SELF_LEAD_QUERY_KEY(leadId)
9651
- });
9653
+ if (lead.status) {
9654
+ queryClient.invalidateQueries({ queryKey: SELF_LEADS_QUERY_KEY() });
9655
+ queryClient.invalidateQueries({ queryKey: SELF_LEAD_COUNTS_QUERY_KEY() });
9656
+ }
9657
+ queryClient.setQueryData(
9658
+ [
9659
+ ...SELF_LEAD_QUERY_KEY(leadId),
9660
+ ...GetBaseSingleQueryKeys(clientApiParams.locale)
9661
+ ],
9662
+ data
9663
+ );
9652
9664
  }
9653
9665
  return data;
9654
9666
  };
package/dist/index.mjs CHANGED
@@ -4325,11 +4325,15 @@ var useGetSelfAddress = (addressId = "", options = {}) => {
4325
4325
  };
4326
4326
 
4327
4327
  // src/queries/self/leads/useGetSelfLeads.ts
4328
- var SELF_LEADS_QUERY_KEY = () => [
4329
- ...SELF_QUERY_KEY(),
4330
- "LEADS"
4331
- ];
4328
+ var SELF_LEADS_QUERY_KEY = (status) => {
4329
+ const key = [...SELF_QUERY_KEY(), "LEADS"];
4330
+ if (status) {
4331
+ key.push(status);
4332
+ }
4333
+ return key;
4334
+ };
4332
4335
  var GetSelfLeads = async ({
4336
+ status,
4333
4337
  pageParam,
4334
4338
  pageSize,
4335
4339
  orderBy,
@@ -4341,6 +4345,7 @@ var GetSelfLeads = async ({
4341
4345
  const clientApi = await GetClientAPI(clientApiParams);
4342
4346
  const { data } = await clientApi.get(`/self/leads`, {
4343
4347
  params: {
4348
+ status: status || void 0,
4344
4349
  page: pageParam || void 0,
4345
4350
  pageSize: pageSize || void 0,
4346
4351
  orderBy: orderBy || void 0,
@@ -4357,11 +4362,11 @@ var GetSelfLeads = async ({
4357
4362
  }
4358
4363
  return data;
4359
4364
  };
4360
- var useGetSelfLeads = (params = {}, options = {}) => {
4365
+ var useGetSelfLeads = (status, params = {}, options = {}) => {
4361
4366
  const { authenticated } = useConnectedXM();
4362
4367
  return useConnectedInfiniteQuery(
4363
- SELF_LEADS_QUERY_KEY(),
4364
- (params2) => GetSelfLeads({ ...params2 }),
4368
+ SELF_LEADS_QUERY_KEY(status),
4369
+ (params2) => GetSelfLeads({ ...params2, status }),
4365
4370
  params,
4366
4371
  {
4367
4372
  ...options,
@@ -8656,10 +8661,17 @@ var UpdateSelfLead = async ({
8656
8661
  lead
8657
8662
  );
8658
8663
  if (queryClient && data.status === "ok") {
8659
- queryClient.invalidateQueries({ queryKey: SELF_LEADS_QUERY_KEY() });
8660
- queryClient.invalidateQueries({
8661
- queryKey: SELF_LEAD_QUERY_KEY(leadId)
8662
- });
8664
+ if (lead.status) {
8665
+ queryClient.invalidateQueries({ queryKey: SELF_LEADS_QUERY_KEY() });
8666
+ queryClient.invalidateQueries({ queryKey: SELF_LEAD_COUNTS_QUERY_KEY() });
8667
+ }
8668
+ queryClient.setQueryData(
8669
+ [
8670
+ ...SELF_LEAD_QUERY_KEY(leadId),
8671
+ ...GetBaseSingleQueryKeys(clientApiParams.locale)
8672
+ ],
8673
+ data
8674
+ );
8663
8675
  }
8664
8676
  return data;
8665
8677
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connectedxm/client",
3
- "version": "1.4.9",
3
+ "version": "1.4.10",
4
4
  "description": "Client API javascript SDK",
5
5
  "author": "ConnectedXM Inc.",
6
6
  "repository": {