@@ -1187,7 +1187,7 @@ function getCardSettings(cardSettings: OnyxEntry<ExpensifyCardSettings>, program
11871187 ) ;
11881188}
11891189
1190- /** Backend may nest fields like linkedPolicyIds / linkedPolicyIDs under each program block (not only on the settings root). */
1190+ /** Backend may nest linkedPolicyIDs under each program block (not only on the settings root). */
11911191const NESTED_EXPENSIFY_CARD_PROGRAM_KEYS : readonly CardProgramKey [ ] = [ CONST . COUNTRY . US , CONST . EXPENSIFY_CARD . CARD_PROGRAM . CURRENT , CONST . COUNTRY . GB , CONST . TRAVEL . PROGRAM_TRAVEL_US ] ;
11921192
11931193function getNestedExpensifyCardProgramSettings ( settings : ExpensifyCardSettings , key : CardProgramKey ) : ExpensifyCardSettingsBase | undefined {
@@ -1198,18 +1198,11 @@ function getNestedExpensifyCardProgramSettings(settings: ExpensifyCardSettings,
11981198 return undefined ;
11991199}
12001200
1201- function collectLinkedPolicyIdsFromBase ( base : ExpensifyCardSettingsBase | undefined ) : string [ ] {
1201+ function collectLinkedPolicyIDsFromBase ( base : ExpensifyCardSettingsBase | undefined ) : string [ ] {
12021202 if ( ! base ) {
12031203 return [ ] ;
12041204 }
1205- const raw : string [ ] = [ ] ;
1206- if ( base . linkedPolicyIds ?. length ) {
1207- raw . push ( ...base . linkedPolicyIds ) ;
1208- }
1209- if ( base . linkedPolicyIDs ?. length ) {
1210- raw . push ( ...base . linkedPolicyIDs ) ;
1211- }
1212- return raw ;
1205+ return base . linkedPolicyIDs ?. length ? [ ...base . linkedPolicyIDs ] : [ ] ;
12131206}
12141207
12151208function dedupePolicyIDsCaseInsensitive ( ids : string [ ] ) : string [ ] {
@@ -1227,15 +1220,15 @@ function dedupePolicyIDsCaseInsensitive(ids: string[]): string[] {
12271220
12281221/**
12291222 * Linked workspace IDs from the settings root and US / CURRENT / GB / TRAVEL_US nests.
1230- * Merges `linkedPolicyIds` and `linkedPolicyIDs` (API spelling). Deduplicates case-insensitively; keeps API casing for Onyx lookups.
1223+ * Deduplicates case-insensitively; keeps API casing for Onyx lookups.
12311224 */
1232- function getLinkedPolicyIdsFromExpensifyCardSettings ( settings : ExpensifyCardSettings | OnyxEntry < ExpensifyCardSettings > ) : string [ ] | undefined {
1225+ function getLinkedPolicyIDsFromExpensifyCardSettings ( settings : ExpensifyCardSettings | OnyxEntry < ExpensifyCardSettings > ) : string [ ] | undefined {
12331226 if ( ! settings ) {
12341227 return undefined ;
12351228 }
1236- const ids : string [ ] = [ ...collectLinkedPolicyIdsFromBase ( settings as ExpensifyCardSettingsBase ) ] ;
1229+ const ids : string [ ] = [ ...collectLinkedPolicyIDsFromBase ( settings as ExpensifyCardSettingsBase ) ] ;
12371230 for ( const key of NESTED_EXPENSIFY_CARD_PROGRAM_KEYS ) {
1238- ids . push ( ...collectLinkedPolicyIdsFromBase ( getNestedExpensifyCardProgramSettings ( settings , key ) ) ) ;
1231+ ids . push ( ...collectLinkedPolicyIDsFromBase ( getNestedExpensifyCardProgramSettings ( settings , key ) ) ) ;
12391232 }
12401233 if ( ids . length === 0 ) {
12411234 return undefined ;
@@ -1244,8 +1237,8 @@ function getLinkedPolicyIdsFromExpensifyCardSettings(settings: ExpensifyCardSett
12441237}
12451238
12461239/** True if `policyID` is in the linked list (case-insensitive). */
1247- function isPolicyIDInLinkedExpensifyCardPolicyList ( linkedPolicyIds : string [ ] | undefined , policyID : string ) : boolean {
1248- return ! ! linkedPolicyIds ?. some ( ( id ) => id . toUpperCase ( ) === policyID . toUpperCase ( ) ) ;
1240+ function isPolicyIDInLinkedExpensifyCardPolicyList ( linkedPolicyIDs : string [ ] | undefined , policyID : string ) : boolean {
1241+ return ! ! linkedPolicyIDs ?. some ( ( id ) => id . toUpperCase ( ) === policyID . toUpperCase ( ) ) ;
12491242}
12501243
12511244/** Resolves preferredPolicy from the settings root or the first nested program block that defines it. */
@@ -1716,7 +1709,7 @@ export {
17161709 isExpensifyCardFullySetUp ,
17171710 getCardSettings ,
17181711 getCardProgramKey ,
1719- getLinkedPolicyIdsFromExpensifyCardSettings ,
1712+ getLinkedPolicyIDsFromExpensifyCardSettings ,
17201713 getPreferredPolicyFromExpensifyCardSettings ,
17211714 isPolicyIDInLinkedExpensifyCardPolicyList ,
17221715 filterAllInactiveCards ,
0 commit comments