@planningcenter/chat-react-native 4.4.1-qa-staging.36 → 4.4.1-qa-staging.37

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.
@@ -43,9 +43,9 @@ export function useFeatures() {
43
43
  return t2;
44
44
  }
45
45
  export const featuresQueryOptions = apiClient => queryOptions({
46
- queryKey: getFeaturesQueryKey(),
46
+ queryKey: getFeaturesQueryKey(featureNames),
47
47
  queryFn: () => {
48
- return apiClient.chat.get(getFeaturesRequestArgs()).catch(error => ({
48
+ return apiClient.chat.get(getFeaturesRequestArgs(featureNames)).catch(error => ({
49
49
  ...stableEmptyFeatures,
50
50
  failure: {
51
51
  status: error?.status
@@ -74,6 +74,7 @@ export const availableFeatures = {
74
74
  manual_archiving: 'QA_MOBILE_manual_archiving',
75
75
  manual_archiving_rollout: 'ROLLOUT_MOBILE_manual_archiving'
76
76
  };
77
+ const featureNames = Object.values(availableFeatures);
77
78
  const stableEmptyFeatures = {
78
79
  data: [],
79
80
  links: {},
@@ -1 +1 @@
1
- {"version":3,"file":"use_features.js","names":["queryOptions","useSuspenseQuery","useCallback","getFeaturesRequestArgs","getFeaturesQueryKey","FIVE_MINUTES","ONE_MINUTE","useApiClient","useFeatures","$","_c","apiClient","t0","featuresQueryOptions","data","features","t1","featureName","some","feature","name","enabled","featureEnabled","t2","queryKey","queryFn","chat","get","catch","error","stableEmptyFeatures","failure","status","staleTime","query","state","gcTime","Infinity","availableFeatures","gender_specific_conversations","message_reporting","granular_notifications_ui","custom_conversation_avatars","conversation_safety_lock","video_moderation","dm_search_clear_fix","search","search_rollout","filter_dropdown","filter_dropdown_rollout","manual_archiving","manual_archiving_rollout","links","meta","count","totalCount"],"sources":["../../src/hooks/use_features.ts"],"sourcesContent":["import { queryOptions, useSuspenseQuery } from '@tanstack/react-query'\nimport { useCallback } from 'react'\nimport { ApiCollection } from '../types'\nimport type { FeatureResource } from '../types/resources/feature_resource'\nimport { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'\nimport { FIVE_MINUTES, ONE_MINUTE } from '../utils/time'\nimport { ApiClient, useApiClient } from './use_api_client'\n\ntype FeatureName = (typeof availableFeatures)[keyof typeof availableFeatures]\n\ntype FeaturesCollection = ApiCollection<FeatureResource> & {\n failure?: { status?: number }\n}\n\nexport function useFeatures() {\n const apiClient = useApiClient()\n const { data } = useSuspenseQuery(featuresQueryOptions(apiClient))\n\n const features = data.data\n\n const featureEnabled = useCallback(\n (featureName: FeatureName) =>\n features.some(feature => feature.name === featureName && feature.enabled),\n [features]\n )\n\n return {\n features,\n featureEnabled,\n }\n}\n\nexport const featuresQueryOptions = (apiClient: ApiClient) =>\n queryOptions({\n queryKey: getFeaturesQueryKey(),\n queryFn: (): Promise<FeaturesCollection> => {\n return apiClient.chat\n .get<ApiCollection<FeatureResource>>(getFeaturesRequestArgs())\n .catch(error => ({ ...stableEmptyFeatures, failure: { status: error?.status } }))\n },\n staleTime: query => {\n const failure = query.state.data?.failure\n if (!failure) return FIVE_MINUTES\n\n return failure.status === 429 ? ONE_MINUTE : 0\n },\n gcTime: Infinity,\n })\n\nexport const availableFeatures = {\n gender_specific_conversations: 'ROLLOUT_gender_specific_conversations',\n message_reporting: 'ROLLOUT_MOBILE_message_reporting',\n granular_notifications_ui: 'ROLLOUT_granular_notification_preferences_ui',\n custom_conversation_avatars: 'ROLLOUT_custom_conversation_avatars',\n conversation_safety_lock: 'ROLLOUT_conversation_safety_lock',\n video_moderation: 'ROLLOUT_MOBILE_video_moderation',\n dm_search_clear_fix: 'ROLLOUT_MOBILE_dm_search_clear_fix',\n search: 'QA_MOBILE_search',\n search_rollout: 'ROLLOUT_MOBILE_search',\n filter_dropdown: 'QA_MOBILE_filter_dropdown',\n filter_dropdown_rollout: 'ROLLOUT_MOBILE_filter_dropdown',\n manual_archiving: 'QA_MOBILE_manual_archiving',\n manual_archiving_rollout: 'ROLLOUT_MOBILE_manual_archiving',\n} as const satisfies Record<string, `${'QA' |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AK,EAAE,CAAC,CAAC;EACTC,IAAI,EAAE;IACJC,KAAK,EAAE,CAAC;IACRC,UAAU,EAAE;EACd;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"use_features.js","names":["queryOptions","useSuspenseQuery","useCallback","getFeaturesRequestArgs","getFeaturesQueryKey","FIVE_MINUTES","ONE_MINUTE","useApiClient","useFeatures","$","_c","apiClient","t0","featuresQueryOptions","data","features","t1","featureName","some","feature","name","enabled","featureEnabled","t2","queryKey","featureNames","queryFn","chat","get","catch","error","stableEmptyFeatures","failure","status","staleTime","query","state","gcTime","Infinity","availableFeatures","gender_specific_conversations","message_reporting","granular_notifications_ui","custom_conversation_avatars","conversation_safety_lock","video_moderation","dm_search_clear_fix","search","search_rollout","filter_dropdown","filter_dropdown_rollout","manual_archiving","manual_archiving_rollout","Object","values","links","meta","count","totalCount"],"sources":["../../src/hooks/use_features.ts"],"sourcesContent":["import { queryOptions, useSuspenseQuery } from '@tanstack/react-query'\nimport { useCallback } from 'react'\nimport { ApiCollection } from '../types'\nimport type { FeatureResource } from '../types/resources/feature_resource'\nimport { getFeaturesRequestArgs, getFeaturesQueryKey } from '../utils/request/get_features'\nimport { FIVE_MINUTES, ONE_MINUTE } from '../utils/time'\nimport { ApiClient, useApiClient } from './use_api_client'\n\ntype FeatureName = (typeof availableFeatures)[keyof typeof availableFeatures]\n\ntype FeaturesCollection = ApiCollection<FeatureResource> & {\n failure?: { status?: number }\n}\n\nexport function useFeatures() {\n const apiClient = useApiClient()\n const { data } = useSuspenseQuery(featuresQueryOptions(apiClient))\n\n const features = data.data\n\n const featureEnabled = useCallback(\n (featureName: FeatureName) =>\n features.some(feature => feature.name === featureName && feature.enabled),\n [features]\n )\n\n return {\n features,\n featureEnabled,\n }\n}\n\nexport const featuresQueryOptions = (apiClient: ApiClient) =>\n queryOptions({\n queryKey: getFeaturesQueryKey(featureNames),\n queryFn: (): Promise<FeaturesCollection> => {\n return apiClient.chat\n .get<ApiCollection<FeatureResource>>(getFeaturesRequestArgs(featureNames))\n .catch(error => ({ ...stableEmptyFeatures, failure: { status: error?.status } }))\n },\n staleTime: query => {\n const failure = query.state.data?.failure\n if (!failure) return FIVE_MINUTES\n\n return failure.status === 429 ? ONE_MINUTE : 0\n },\n gcTime: Infinity,\n })\n\nexport const availableFeatures = {\n gender_specific_conversations: 'ROLLOUT_gender_specific_conversations',\n message_reporting: 'ROLLOUT_MOBILE_message_reporting',\n granular_notifications_ui: 'ROLLOUT_granular_notification_preferences_ui',\n custom_conversation_avatars: 'ROLLOUT_custom_conversation_avatars',\n conversation_safety_lock: 'ROLLOUT_conversation_safety_lock',\n video_moderation: 'ROLLOUT_MOBILE_video_moderation',\n dm_search_clear_fix: 'ROLLOUT_MOBILE_dm_search_clear_fix',\n search: 'QA_MOBILE_search',\n search_rollout: 'ROLLOUT_MOBILE_search',\n filter_dropdown: 'QA_MOBILE_filter_dropdown',\n filter_dropdown_rollout: 'ROLLOUT_MOBILE_filter_dropdown',\n manual_archiving: 'QA_MOBILE_manual_archiving',\n manual_archiving_rollout: 'ROLLOUT_MOBILE_manual_archiving',\n} as const satisfies Record<string, `${'QA' | 'ROLLOUT'}_${string}`>\n\nconst featureNames = Object.values(availableFeatures)\n\nconst stableEmptyFeatures: ApiCollection<FeatureResource> = {\n data: [],\n links: {},\n meta: {\n count: 0,\n totalCount: 0,\n },\n}\n"],"mappings":";AAAA,SAASA,YAAY,EAAEC,gBAAgB,QAAQ,uBAAuB;AACtE,SAASC,WAAW,QAAQ,OAAO;AAGnC,SAASC,sBAAsB,EAAEC,mBAAmB,QAAQ,+BAA+B;AAC3F,SAASC,YAAY,EAAEC,UAAU,QAAQ,eAAe;AACxD,SAAoBC,YAAY,QAAQ,kBAAkB;AAQ1D,OAAO,SAAAC,YAAA;EAAA,MAAAC,CAAA,GAAAC,EAAA;EACL,MAAAC,SAAA,GAAkBJ,YAAY,CAAC,CAAC;EAAA,IAAAK,EAAA;EAAA,IAAAH,CAAA,QAAAE,SAAA;I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KAAK,IAAI;IAClB,MAAMH,OAAO,GAAGG,KAAK,CAACC,KAAK,CAACtB,IAAI,EAAEkB,OAAO;IACzC,IAAI,CAACA,OAAO,EAAE,OAAO3B,YAAY;IAEjC,OAAO2B,OAAO,CAACC,MAAM,KAAK,GAAG,GAAG3B,UAAU,GAAG,CAAC;EAChD,CAAC;EACD+B,MAAM,EAAEC;AACV,CAAC,CAAC;AAEJ,OAAO,MAAMC,iBAAiB,GAAG;EAC/BC,6BAA6B,EAAE,uCAAuC;EACtEC,iBAAiB,EAAE,kCAAkC;EACrDC,yBAAyB,EAAE,8CAA8C;EACzEC,2BAA2B,EAAE,qCAAqC;EAClEC,wBAAwB,EAAE,kCAAkC;EAC5DC,gBAAgB,EAAE,iCAAiC;EACnDC,mBAAmB,EAAE,oCAAoC;EACzDC,MAAM,EAAE,kBAAkB;EAC1BC,cAAc,EAAE,uBAAuB;EACvCC,eAAe,EAAE,2BAA2B;EAC5CC,uBAAuB,EAAE,gCAAgC;EACzDC,gBAAgB,EAAE,4BAA4B;EAC9CC,wBAAwB,EAAE;AAC5B,CAAoE;AAEpE,MAAM3B,YAAY,GAAG4B,MAAM,CAACC,MAAM,CAACf,iBAAiB,CAAC;AAErD,MAAMR,mBAAmD,GAAG;EAC1DjB,IAAI,EAAE,EAAE;EACRyC,KAAK,EAAE,CAAC,CAAC;EACTC,IAAI,EAAE;IACJC,KAAK,EAAE,CAAC;IACRC,UAAU,EAAE;EACd;AACF,CAAC","ignoreList":[]}
@@ -1,11 +1,17 @@
1
- export declare const getFeaturesRequestArgs: () => {
1
+ export declare const getFeaturesRequestArgs: (names: readonly string[]) => {
2
2
  url: string;
3
+ headers: {
4
+ 'X-PCO-API-Version': string;
5
+ 'X-PCO-Chat-React-Native-Version': string;
6
+ };
3
7
  data: {
4
- perPage: number;
8
+ where: {
9
+ name: string;
10
+ };
5
11
  fields: {
6
12
  Feature: string[];
7
13
  };
8
14
  };
9
15
  };
10
- export declare const getFeaturesQueryKey: () => import("../..").RequestQueryKey;
16
+ export declare const getFeaturesQueryKey: (names: readonly string[]) => import("../..").RequestQueryKey;
11
17
  //# sourceMappingURL=get_features.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get_features.d.ts","sourceRoot":"","sources":["../../../src/utils/request/get_features.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB;;;;;;;;CAYlC,CAAA;AAED,eAAO,MAAM,mBAAmB,uCAG/B,CAAA"}
1
+ {"version":3,"file":"get_features.d.ts","sourceRoot":"","sources":["../../../src/utils/request/get_features.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,sBAAsB,GAAI,OAAO,SAAS,MAAM,EAAE;;;;;;;;;;;;;;CAkB9D,CAAA;AAED,eAAO,MAAM,mBAAmB,GAAI,OAAO,SAAS,MAAM,EAAE,oCAG3D,CAAA"}
@@ -1,18 +1,25 @@
1
1
  import { getRequestQueryKey } from '../../hooks/use_suspense_api';
2
- export const getFeaturesRequestArgs = () => {
2
+ import { chatReactNativeVersion } from '../package_version';
3
+ export const getFeaturesRequestArgs = names => {
3
4
  const url = '/me/features';
4
5
  return {
5
6
  url,
7
+ headers: {
8
+ 'X-PCO-API-Version': '2026-10-26',
9
+ 'X-PCO-Chat-React-Native-Version': chatReactNativeVersion
10
+ },
6
11
  data: {
7
- perPage: 100,
12
+ where: {
13
+ name: names.join(',')
14
+ },
8
15
  fields: {
9
16
  Feature: ['name', 'enabled']
10
17
  }
11
18
  }
12
19
  };
13
20
  };
14
- export const getFeaturesQueryKey = () => {
15
- const requestArgs = getFeaturesRequestArgs();
21
+ export const getFeaturesQueryKey = names => {
22
+ const requestArgs = getFeaturesRequestArgs(names);
16
23
  return getRequestQueryKey(requestArgs);
17
24
  };
18
25
  //# sourceMappingURL=get_features.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get_features.js","names":["getRequestQueryKey","getFeaturesRequestArgs","url","data","perPage","fields","Feature","getFeaturesQueryKey","requestArgs"],"sources":["../../../src/utils/request/get_features.ts"],"sourcesContent":["import { getRequestQueryKey } from '../../hooks/use_suspense_api'\n\nexport const getFeaturesRequestArgs = () => {\n const url = '/me/features'\n\n return {\n url,\n data: {\n perPage: 100,\n fields: {\n Feature: ['name', 'enabled'],\n },\n },\n }\n}\n\nexport const getFeaturesQueryKey = () => {\n const requestArgs = getFeaturesRequestArgs()\n return getRequestQueryKey(requestArgs)\n}\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,8BAA8B;AAEjE,OAAO,MAAMC,sBAAsB,GAAGA,CAAA,KAAM;EAC1C,MAAMC,GAAG,GAAG,cAAc;EAE1B,OAAO;IACLA,GAAG;IACHC,IAAI,EAAE;MACJC,OAAO,EAAE,GAAG;MACZC,MAAM,EAAE;QACNC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS;MAC7B;IACF;EACF,CAAC;AACH,CAAC;AAED,OAAO,MAAMC,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAMC,WAAW,GAAGP,sBAAsB,CAAC,CAAC;EAC5C,OAAOD,kBAAkB,CAACQ,WAAW,CAAC;AACxC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"get_features.js","names":["getRequestQueryKey","chatReactNativeVersion","getFeaturesRequestArgs","names","url","headers","data","where","name","join","fields","Feature","getFeaturesQueryKey","requestArgs"],"sources":["../../../src/utils/request/get_features.ts"],"sourcesContent":["import { getRequestQueryKey } from '../../hooks/use_suspense_api'\nimport { chatReactNativeVersion } from '../package_version'\n\nexport const getFeaturesRequestArgs = (names: readonly string[]) => {\n const url = '/me/features'\n\n return {\n url,\n headers: {\n 'X-PCO-API-Version': '2026-10-26',\n 'X-PCO-Chat-React-Native-Version': chatReactNativeVersion,\n },\n data: {\n where: {\n name: names.join(','),\n },\n fields: {\n Feature: ['name', 'enabled'],\n },\n },\n }\n}\n\nexport const getFeaturesQueryKey = (names: readonly string[]) => {\n const requestArgs = getFeaturesRequestArgs(names)\n return getRequestQueryKey(requestArgs)\n}\n"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,8BAA8B;AACjE,SAASC,sBAAsB,QAAQ,oBAAoB;AAE3D,OAAO,MAAMC,sBAAsB,GAAIC,KAAwB,IAAK;EAClE,MAAMC,GAAG,GAAG,cAAc;EAE1B,OAAO;IACLA,GAAG;IACHC,OAAO,EAAE;MACP,mBAAmB,EAAE,YAAY;MACjC,iCAAiC,EAAEJ;IACrC,CAAC;IACDK,IAAI,EAAE;MACJC,KAAK,EAAE;QACLC,IAAI,EAAEL,KAAK,CAACM,IAAI,CAAC,GAAG;MACtB,CAAC;MACDC,MAAM,EAAE;QACNC,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS;MAC7B;IACF;EACF,CAAC;AACH,CAAC;AAED,OAAO,MAAMC,mBAAmB,GAAIT,KAAwB,IAAK;EAC/D,MAAMU,WAAW,GAAGX,sBAAsB,CAACC,KAAK,CAAC;EACjD,OAAOH,kBAAkB,CAACa,WAAW,CAAC;AACxC,CAAC","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "4.4.1-qa-staging.36",
3
+ "version": "4.4.1-qa-staging.37",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@fortawesome/fontawesome-svg-core": "^7.2.0",
35
35
  "@fortawesome/react-native-fontawesome": "^0.3.2",
36
- "@planningcenter/emoji-keyboard": "4.4.1-qa-staging.36",
36
+ "@planningcenter/emoji-keyboard": "4.4.1-qa-staging.37",
37
37
  "lodash-inflection": "^1.5.0"
38
38
  },
39
39
  "peerDependencies": {
@@ -84,5 +84,5 @@
84
84
  "sf-symbols-typescript": "^2.2.0",
85
85
  "typescript": "~6.0.3"
86
86
  },
87
- "gitHead": "71c9c06762706a0f8144f94bc1141983d478c638"
87
+ "gitHead": "51bfb62e1947e980f65a6e7ced17d241a58576c0"
88
88
  }
@@ -6,6 +6,7 @@ import { ChatContext, ChatContextValue } from '../../contexts/chat_context'
6
6
  import { ApiClient, useApiClient } from '../../hooks/use_api_client'
7
7
  import { useCanBrowseArchivedConversations } from '../../hooks/use_can_browse_archived_conversations'
8
8
  import { currentPersonQueryKey, currentPersonRequestArgs } from '../../hooks/use_current_person'
9
+ import { availableFeatures } from '../../hooks/use_features'
9
10
  import { Session } from '../../utils'
10
11
  import { getFeaturesQueryKey } from '../../utils/request/get_features'
11
12
 
@@ -20,7 +21,7 @@ const session = new Session({ token: { access_token: 'a-real-token' } })
20
21
  const renderWithFeatures = (enabledFlags: string[], cachedPerson?: object) => {
21
22
  const queryClient = buildTestQueryClient()
22
23
  if (cachedPerson) queryClient.setQueryData(currentPersonQueryKey, { data: cachedPerson })
23
- queryClient.setQueryData(getFeaturesQueryKey(), {
24
+ queryClient.setQueryData(getFeaturesQueryKey(Object.values(availableFeatures)), {
24
25
  data: enabledFlags.map((name, index) => ({
25
26
  type: 'Feature',
26
27
  id: `${index}`,
@@ -1,6 +1,7 @@
1
1
  import { buildTestQueryClient } from '../../__utils__/query_client'
2
2
  import type { ApiClient } from '../../hooks/use_api_client'
3
3
  import { availableFeatures, featuresQueryOptions } from '../../hooks/use_features'
4
+ import { chatReactNativeVersion } from '../../utils/package_version'
4
5
 
5
6
  const features = {
6
7
  data: [{ type: 'Feature', id: '1', name: 'QA_MOBILE_search', enabled: true }],
@@ -36,6 +37,19 @@ describe('featuresQueryOptions', () => {
36
37
  jest.useRealTimers()
37
38
  })
38
39
 
40
+ it('names every flag it reads, with its chat-react-native version', async () => {
41
+ const get = jest.fn().mockResolvedValue(features)
42
+
43
+ await buildTestQueryClient().fetchQuery(featuresQueryOptions(buildClient(get)))
44
+
45
+ const [{ headers, data }] = get.mock.calls[0]
46
+ expect(data.where.name.split(',')).toEqual(Object.values(availableFeatures))
47
+ expect(headers).toEqual({
48
+ 'X-PCO-API-Version': '2026-10-26',
49
+ 'X-PCO-Chat-React-Native-Version': chatReactNativeVersion,
50
+ })
51
+ })
52
+
39
53
  it('keeps successful flags fresh for five minutes', async () => {
40
54
  const get = jest.fn().mockResolvedValue(features)
41
55
 
@@ -2,6 +2,7 @@ import { QueryClientProvider } from '@tanstack/react-query'
2
2
  import { renderHook } from '@testing-library/react-native'
3
3
  import React from 'react'
4
4
  import { buildTestQueryClient } from '../../__utils__/query_client'
5
+ import { availableFeatures } from '../../hooks/use_features'
5
6
  import { useFilterDropdownEnabled } from '../../hooks/use_filter_dropdown_enabled'
6
7
  import { getFeaturesQueryKey } from '../../utils/request/get_features'
7
8
 
@@ -9,7 +10,7 @@ jest.mock('../../hooks/use_api_client')
9
10
 
10
11
  const renderWithFeatures = (enabledFlags: string[]) => {
11
12
  const queryClient = buildTestQueryClient()
12
- queryClient.setQueryData(getFeaturesQueryKey(), {
13
+ queryClient.setQueryData(getFeaturesQueryKey(Object.values(availableFeatures)), {
13
14
  data: enabledFlags.map((name, index) => ({
14
15
  type: 'Feature',
15
16
  id: `${index}`,
@@ -32,10 +32,10 @@ export function useFeatures() {
32
32
 
33
33
  export const featuresQueryOptions = (apiClient: ApiClient) =>
34
34
  queryOptions({
35
- queryKey: getFeaturesQueryKey(),
35
+ queryKey: getFeaturesQueryKey(featureNames),
36
36
  queryFn: (): Promise<FeaturesCollection> => {
37
37
  return apiClient.chat
38
- .get<ApiCollection<FeatureResource>>(getFeaturesRequestArgs())
38
+ .get<ApiCollection<FeatureResource>>(getFeaturesRequestArgs(featureNames))
39
39
  .catch(error => ({ ...stableEmptyFeatures, failure: { status: error?.status } }))
40
40
  },
41
41
  staleTime: query => {
@@ -63,6 +63,8 @@ export const availableFeatures = {
63
63
  manual_archiving_rollout: 'ROLLOUT_MOBILE_manual_archiving',
64
64
  } as const satisfies Record<string, `${'QA' | 'ROLLOUT'}_${string}`>
65
65
 
66
+ const featureNames = Object.values(availableFeatures)
67
+
66
68
  const stableEmptyFeatures: ApiCollection<FeatureResource> = {
67
69
  data: [],
68
70
  links: {},
@@ -1,12 +1,19 @@
1
1
  import { getRequestQueryKey } from '../../hooks/use_suspense_api'
2
+ import { chatReactNativeVersion } from '../package_version'
2
3
 
3
- export const getFeaturesRequestArgs = () => {
4
+ export const getFeaturesRequestArgs = (names: readonly string[]) => {
4
5
  const url = '/me/features'
5
6
 
6
7
  return {
7
8
  url,
9
+ headers: {
10
+ 'X-PCO-API-Version': '2026-10-26',
11
+ 'X-PCO-Chat-React-Native-Version': chatReactNativeVersion,
12
+ },
8
13
  data: {
9
- perPage: 100,
14
+ where: {
15
+ name: names.join(','),
16
+ },
10
17
  fields: {
11
18
  Feature: ['name', 'enabled'],
12
19
  },
@@ -14,7 +21,7 @@ export const getFeaturesRequestArgs = () => {
14
21
  }
15
22
  }
16
23
 
17
- export const getFeaturesQueryKey = () => {
18
- const requestArgs = getFeaturesRequestArgs()
24
+ export const getFeaturesQueryKey = (names: readonly string[]) => {
25
+ const requestArgs = getFeaturesRequestArgs(names)
19
26
  return getRequestQueryKey(requestArgs)
20
27
  }