{
  "id": "doctolib-doctolib/nested-cuddling-pizza-subagent-a07fdc81",
  "slug": "nested-cuddling-pizza-subagent-a07fdc81",
  "title": "Session: nested-cuddling-pizza-subagent-a07fdc81 — 2026-02-25",
  "type": "source",
  "project": "doctolib-doctolib",
  "date": "2026-02-25",
  "started": "2026-02-25T13:17:34.223000+00:00",
  "ended": "2026-02-25T13:22:15.545000+00:00",
  "model": "claude-haiku-4-5-20251001",
  "cwd": "/Users/USER/workspace/doctolib/doctolib",
  "git_branch": "master",
  "permission_mode": "",
  "user_messages": 1,
  "tool_calls": 35,
  "tools_used": [
    "Grep",
    "Glob",
    "Read",
    "Bash"
  ],
  "is_subagent": true,
  "wikilinks_out": [],
  "body_text": "Project: doctolib-doctolib · Branch: master · Mode:  · Model: claude-haiku-4-5-20251001\n\nStats: 1 user messages, 35 tool calls, tools used: Grep, Glob, Read, Bash.\n\nConversation\n\nTurn 1 — User\n\nI need to understand two things for integrating a DMP entry point into PatientCard:\n\n1. Feature switch pattern on the frontend\nThe implementation plan uses feature switch nhr_document_list with send_to_front: true, accessed via window.dl_constants.NHR_DOCUMENT_LIST_ENABLED.\n- Find how other dl_constants feature switches are consumed in React components. Look for dl_constants usage patterns in packages/@doctolib/ — specifically how components check window?.dl_constants?.SOME_FLAG or use a hook for it.\n- Does a useFeatureSwitch or useNhrDocumentListEnabled hook exist anywhere?\n\n2. DmpEntryPoint / NhrDocumentList in treatment-plan\n- Check if DmpEntryPoint already exists anywhere in ~/workspace/doctolib/treatment-plan/ or ~/workspace/doctolib/doctolib/packages/\n- Check treatment-plan/packages/tpf-national-health-records-ui/src/ for any existing components\n- Check packages/@doctolib/dmp/ for any entry point or document list component\n\n3. How @doctolib/dmp package exports its public API\n- Read packages/@doctolib/dmp/package.json to see its version and main/exports fields\n- Check packages/@doctolib/dmp/src/ structure — does a helpers/ folder exist? What's already there?\n\nSearch in: ~/workspace/doctolib/doctolib/packages/@doctolib/dmp/ and ~/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/\n\nTurn 1 — Assistant\n\nI'll help you understand these three areas. Let me search systematically through the codebase.\n\nTools used:\n\n- Grep: window\\.dl_constants in /Users/USER/workspace/doctolib/doctolib/packages/@doctolib\n\nTools used:\n\n- Glob: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/\n\nTools used:\n\n- Glob: /Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/\n\nTool results:\n\n  → result (ok): No files found\n\nTools used:\n\n- Grep: useFeatureSwitch|dl_constants in /Users/USER/workspace/doctolib/doctolib/packages/@doctolib\n\nTool results:\n\n  → result (ok): /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/CODEOWNERS.local\n/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/babel.config.cjs\n/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/catalog-info.yaml\n/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/jest.config.cjs\n/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/sonar-project.properties\n/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/tsconfig.json\n/Users/USER/wor\n…(truncated, 10074 more chars)\n\nTool results:\n\n  → result (ok): /Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/.npmignore\n/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/.storybook/main.ts\n/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/.storybook/preview.css\n/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/.storybook/preview.tsx\n/Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-recor\n…(truncated, 2022 more chars)\n\nTool results:\n\n  → result (ok): No files found\n\nLet me search for how feature switches are actually used in React components:\n\nTools used:\n\n- Grep: dl_constants|window\\?\\.dl_constants in /Users/USER/workspace/doctolib/doctolib/packages/@doctolib\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/package.json\n\nTool results:\n\n  → result (ok): No files found\n\nTool results:\n\n  → result (ok): 1→{\n     2→  \"name\": \"@doctolib/dmp\",\n     3→  \"version\": \"1.0.0\",\n     4→  \"repository\": {\n     5→    \"type\": \"git\",\n     6→    \"url\": \"git+https://github.com/doctolib/doctolib\"\n     7→  },\n     8→  \"keywords\": [\n     9→    \"upfront\",\n    10→    \"modular frontend\",\n    11→    \"in-monolith-package\"\n    12→  ],\n    13→  \"author\": \"@doctolib/moose\",\n    14→  \"license\": \"Doctolib\",\n    15→  \"doctolib\": {\n    16→    \"upfront-type\": \"in-monolith-package\"\n    17→  },\n    18→  \"type\": \"module\",\n    19→\n…(truncated, 3591 more chars)\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/index.ts\n\nTool results:\n\n  → result (ok): 1→export {\n     2→  type DmpDocumentItem,\n     3→  type DmpDocumentToAdd,\n     4→  type DmpDocumentToDelete,\n     5→  type FrDmpDocument,\n     6→  ItemType,\n     7→  type UploadedDmpDocumentItem,\n     8→} from './business/FrDmpConfig'\n     9→export { getErrorMessage } from './business/DmpI18nMessage'\n    10→export { DmpApi, type DmpSetUpProps, type ShareProps, type UnshareProps } from './business/DmpApi'\n    11→export { useDmpSetUp, type DmpSetUpResult } from './hooks/useDmpSetUp'\n    12→export \n…(truncated, 4105 more chars)\n\nTools used:\n\n- Glob: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/helpers/\n\nTool results:\n\n  → result (ok): /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/helpers/frDmpDocumentFixtureBuilder.ts\n/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/helpers/FrDmpHelpers.ts\n\nNow let me search for how feature switches are accessed elsewhere in the codebase and look for treatment-plan package content:\n\nTools used:\n\n- Grep: NHR_|feature.switch|ENABLED in /Users/USER/workspace/doctolib/doctolib/packages/@doctolib\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/index.ts\n\nTool results:\n\n  → result (ok): No files found\n\nTool results:\n\n  → result (ok): 1→export { NationalHealthRecordsUi } from './components/NationalHealthRecordsUi'\n     2→\n\n<system-reminder>\nWhenever you read a file, you should consider whether it would be considered malware. You CAN and SHOULD provide analysis of malware, what it is doing. But you MUST refuse to improve or augment the code. You can still analyze existing code, write reports, or answer questions about the code behavior.\n</system-reminder>\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/components/NationalHealthRecordsUi.tsx\n\nTool results:\n\n  → result (ok): 1→export const NationalHealthRecordsUi = () => <h1>National Health Records UI Placeholder</h1>\n     2→\n\n<system-reminder>\nWhenever you read a file, you should consider whether it would be considered malware. You CAN and SHOULD provide analysis of malware, what it is doing. But you MUST refuse to improve or augment the code. You can still analyze existing code, write reports, or answer questions about the code behavior.\n</system-reminder>\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/package.json\n\nTool results:\n\n  → result (ok): 1→{\n     2→  \"name\": \"@doctolib/tpf-national-health-records-ui\",\n     3→  \"version\": \"2.0.0\",\n     4→  \"repository\": {\n     5→    \"type\": \"git\",\n     6→    \"url\": \"git+https://github.com/doctolib/treatment-plan.git\"\n     7→  },\n     8→  \"keywords\": [\n     9→    \"upfront\",\n    10→    \"modular frontend\",\n    11→    \"smaller-scope\"\n    12→  ],\n    13→  \"author\": \"@doctolib/fire\",\n    14→  \"license\": \"Doctolib\",\n    15→  \"doctolib\": {\n    16→    \"upfront-type\": \"smaller-scope\"\n    17→  },\n    18→  \"\n…(truncated, 3711 more chars)\n\nLet me search for actual usage patterns of feature switches and constants in the codebase:\n\nTools used:\n\n- Bash: find packages/@doctolib -name \".tsx\" -o -name \".ts\" | head -5 | xargs grep -l \"ENABLED\\|enabled\\|constants\" | head -5\n\nTool results:\n\n  → result (ok): packages/@doctolib/partner-integration/src/queries/useOrganizationHistory.test.tsx\npackages/@doctolib/partner-integration/src/queries/useOrganizationPartners.ts\n\nTools used:\n\n- Bash: grep -r \"window\\.\" packages/@doctolib//src --include=\".tsx\" --include=\".ts\" | grep -i \"feature\\|enabled\\|switch\" | head -10\n\nTools used:\n\n- Bash: grep -r \"dl_constants\" . --include=\".tsx\" --include=\".ts\" --include=\".js\" | head -20\n\nTool results:\n\n  → result (ok): packages/@doctolib/ehr_clinical_document/src/helper/PrintPatientMasterData/getPatientFields.test.ts:    window.dl_constants = { PRIVATE_PRACTICE_IN_GERMANY_ENABLED: false }\npackages/@doctolib/ehr_clinical_document/src/helper/PrintPatientMasterData/getPatientFields.test.ts:        window.dl_constants = { PRIVATE_PRACTICE_IN_GERMANY_ENABLED: true }\npackages/@doctolib/financial_os_fr_billing/src/components/doctor/mobile/utils.ts:export const isOfflineToasterEnabled = new URLSearchParams(window.loca\n…(truncated, 1158 more chars)\n\nTool results:\n\n  → result (ok): ./app/assets/javascripts/types/commons/window.ts:    dl_constants: any\n./app/assets/javascripts/hooks/doctor/useFetchConstants.ts:      window.dl_constants = constants\n./app/assets/javascripts/services/constants/index.ts:  ...(window as unknown as Window & { dl_constants: Constants }).dl_constants,\n./app/assets/javascripts/services/http-client/date-interceptors.ts:  Load date_interceptor_removal FS state from window.dl_constants\n./app/assets/javascripts/services/http-client/date-interceptors.ts\n…(truncated, 2094 more chars)\n\nPerfect! Let me read the key files for the feature switch pattern:\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/maps/src/MapContainer.tsx (1–50)\n\nTool results:\n\n  → result (ok): 1→import { useMemo, useState, useContext } from 'react'\n     2→import classNames from 'classnames'\n     3→import MapConsentContext, {\n     4→  type MapConsentContextType,\n     5→  type PatientFeatureWithMap,\n     6→} from '@doctolib/maps/MapConsentContext'\n     7→import MapConsent from './MapConsent'\n     8→import './MapContainer.scss'\n     9→\n    10→export interface MapContainerLabels {\n    11→  consent: string\n    12→  consentLearnMore: string\n    13→  consentLearnMoreA11ySuffix: string\n    14\n…(truncated, 1750 more chars)\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/types/commons/window.ts\n\nTool results:\n\n  → result (ok): 1→import type { Screeb } from 'services/screeb/types'\n     2→import type { Account } from 'types/api/Account'\n     3→import type { ReactNativeEventResponse } from '@doctolib/native-bridge-web/react-native-events'\n     4→import type { ReactNativeProEventResponse } from 'types/doctor/reactNativeEvents'\n     5→import type { CountryLowerCaseTwoLetterCode } from 'types/shared/CountryCodes'\n     6→import type { Language } from '@doctolib/upfront-core/i18n'\n     7→// captureException should not be used\n…(truncated, 8183 more chars)\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/hooks/doctor/useFetchConstants.ts\n\nTool results:\n\n  → result (ok): 1→import { useFetchConstantsIndex } from 'queries/doctor_app/constants'\n     2→import { refreshConstants } from 'services/constants'\n     3→\n     4→const useFetchConstants = () => {\n     5→  const fetchConstantsIndex = useFetchConstantsIndex()\n     6→\n     7→  const fetchConstants = async () => {\n     8→    const constants = await fetchConstantsIndex()\n     9→\n    10→    if (constants !== null) {\n    11→      window.dl_constants = constants\n    12→      refreshConstants()\n    13→    }\n    14→  }\n…(truncated, 443 more chars)\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/services/constants/index.ts\n\nTool results:\n\n  → result (ok): 1→import type { Constants } from './Constants'\n     2→\n     3→const TEAMS = {\n     4→  BYP: 'BYP',\n     5→  FYP: 'FYP',\n     6→  PANDA: 'PANDA',\n     7→  PAX: 'PAX',\n     8→  P3C: 'P3C',\n     9→}\n    10→\n    11→const getConstants = (): Constants & Record<string, unknown> => ({\n    12→  ...(window as unknown as Window & { dl_constants: Constants }).dl_constants,\n    13→  CLIENT_TIME_DELTA: window.client_time_delta,\n    14→  TEAMS,\n    15→})\n    16→\n    17→export const CONSTANTS: Constants & Recor\n…(truncated, 788 more chars)\n\nLet me look for more patterns of feature switch usage in React components:\n\nTools used:\n\n- Bash: grep -r \"ALLOW_GOOGLE_MAPS_LOAD_IN_TESTS_ENABLED\\|PRIVATE_PRACTICE_IN_GERMANY_ENABLED\" packages/@doctolib --include=\".tsx\" --include=\".ts\" -B 2 -A 2 | head -40\n\nTools used:\n\n- Bash: find packages/@doctolib -name \".tsx\" -exec grep -l \"window.dl_constants\" {} \\; | head -5\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/ehr_clinical_document/src/helper/PrintPatientMasterData/getPatientFields.test.ts (1–50)\n\nTool results:\n\n  → result (ok): packages/@doctolib/maps/src/MapContainer.tsx-const shouldPreventLoadingInTest = () => {\npackages/@doctolib/maps/src/MapContainer.tsx-  const envIsTest = document.head.dataset.env === 'test'\npackages/@doctolib/maps/src/MapContainer.tsx:  const allowGoogleMapsLoadInTests = window.dl_constants.ALLOW_GOOGLE_MAPS_LOAD_IN_TESTS_ENABLED\npackages/@doctolib/maps/src/MapContainer.tsx-\npackages/@doctolib/maps/src/MapContainer.tsx-  return envIsTest && !allowGoogleMapsLoadInTests\n--\npackages/@doctolib/ehr_c\n…(truncated, 1322 more chars)\n\nTool results:\n\n  → result (ok): packages/@doctolib/maps/src/MapContainer.tsx\npackages/@doctolib/maps/src/MapConsent.tsx\npackages/@doctolib/maps/src/MapComponent.tsx\n\nTool results:\n\n  → result (ok): 1→import type { PrivateInsuranceData, PublicInsuranceData } from '@doctolib/tpf-document-print/types'\n     2→import { InsuranceSector } from 'monolith_DEPRECATED/types/api/InsuranceSector'\n     3→import { isInsuranceCardKVK } from '@doctolib/tpf-document-print/helpers'\n     4→import { shouldUsePatientData } from './getPatientFields'\n     5→\n     6→jest.mock('@doctolib/tpf-document-print/helpers', () => ({\n     7→  ...jest.requireActual('@doctolib/tpf-document-print/helpers'),\n     8→  isInsuranc\n…(truncated, 1892 more chars)\n\nNow let me check the actual implementation in the component that uses the feature switch:\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/ehr_clinical_document/src/helper/PrintPatientMasterData/getPatientFields.ts (1–60)\n\nTool results:\n\n  → result (ok): 1→import dayjs from 'dayjs'\n     2→import type { PrivateInsuranceData, PublicInsuranceData } from '@doctolib/tpf-document-print/types'\n     3→import type { ISODateStr } from 'monolith_DEPRECATED/types/commons/ISODateStr'\n     4→import {\n     5→  mapPatientData,\n     6→  isPrivatePatientOrPrivatePractice,\n     7→  isInsuranceCardKVK,\n     8→} from '@doctolib/tpf-document-print/helpers'\n     9→import type { PatientFieldsData } from './getPatientFieldsPrintConfiguration'\n    10→import { getPractice\n…(truncated, 2407 more chars)\n\nTools used:\n\n- Bash: grep -A 10 \"shouldUsePatientData\" packages/@doctolib/ehr_clinical_document/src/helper/PrintPatientMasterData/getPatientFields.ts | head -20\n\nTool results:\n\n  → result (ok): export const shouldUsePatientData = (insuranceData: PublicInsuranceData | PrivateInsuranceData, documentKind: string) =>\n  isPrivatePatientOrPrivatePractice(insuranceData.patient.insurance_sector) ||\n  (isInsuranceCardKVK(insuranceData) && !DOCUMENT_KINDS_WITHOUT_KVK_PRINT_DATA_PREFERENCE.includes(documentKind))\n\nconst MAX_FIRST_NAME_LENGTH = 28\nconst MAX_LAST_NAME_LENGTH = 30\nconst MAX_ADDRESS_STREET_LENGTH = 28\nconst MAX_ADDRESS_COUNTRY_LENGTH = 27\nconst MAX_INSTITUTION_ID_LENGTH = 9\nconst INS\n…(truncated, 448 more chars)\n\nTools used:\n\n- Bash: find packages/@doctolib/dmp -type f \\( -name \".tsx\" -o -name \".ts\" \\) | head -20\n\nTool results:\n\n  → result (ok): packages/@doctolib/dmp/src/types/FrDmpTypes.ts\npackages/@doctolib/dmp/src/business/DmpSharingSettings.ts\npackages/@doctolib/dmp/src/business/FrDmpCommunication.ts\npackages/@doctolib/dmp/src/business/FrDmpConstants.ts\npackages/@doctolib/dmp/src/business/DmpApi.test.ts\npackages/@doctolib/dmp/src/business/DmpApi.ts\npackages/@doctolib/dmp/src/business/FrDmpConfig.ts\npackages/@doctolib/dmp/src/business/DmpI18nMessage.ts\npackages/@doctolib/dmp/src/business/DmpSharingSettings.test.ts\npackages/@doctolib\n…(truncated, 666 more chars)\n\nLet me check some DMP components:\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/components/DmpPill.tsx\n\nTool results:\n\n  → result (ok): 1→import i18n from 'monolith_DEPRECATED/services/i18n'\n     2→import { Pill } from '@doctolib/design-system/Pill'\n     3→import { capturePro } from '@doctolib/product-event-wrapper'\n     4→import type { SharingServiceInformation } from '@doctolib/sharing-hub-interface'\n     5→import { DmpPillWithPopover } from './DmpPillWithPopover'\n     6→import type { DmpSharingOptionsInput } from '../hooks/DmpSharingService'\n     7→\n     8→export const DmpPill = ({\n     9→  dmpSharingOptions,\n    10→  onChang\n…(truncated, 2597 more chars)\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/hooks/useDmpEnabledForAccount.ts\n\nTool results:\n\n  → result (ok): 1→import type { Account } from 'monolith_DEPRECATED/types/api/Account'\n     2→import useProductLineVariation from '@doctolib/variation_management/public/useProductLineVariation'\n     3→import { ProductLineKey } from '@doctolib/variation_management/public/productLineFields'\n     4→\n     5→export function useDmpEnabledForAccount(account: Account): boolean {\n     6→  return useProductLineVariation({\n     7→    variants: {\n     8→      [ProductLineKey.EhrFranceDefault]: Boolean(account),\n     9→    \n…(truncated, 725 more chars)\n\nTools used:\n\n- Bash: grep -r \"DmpEntryPoint\\|NhrDocumentList\" ~/workspace/doctolib --include=\".tsx\" --include=\".ts\" 2>/dev/null | head -20\n\nTool results:\n\n  → result (ok): Command running in background with ID: bf3ad7b. Output is being written to: /private/tmp/claude-501/-Users-clertonra-workspace-doctolib-doctolib/tasks/bf3ad7b.output\n\nTools used:\n\n- Bash: cat /private/tmp/claude-501/-Users-clertonra-workspace-doctolib-doctolib/tasks/bf3ad7b.output\n\nTool results:\n\n  → result (ok)\n\nTools used:\n\n- Bash: grep -r \"isFeatureEnabled\" packages/@doctolib --include=\".tsx\" --include=\".ts\" | head -10\n\nTool results:\n\n  → result (ok): packages/@doctolib/partner-integration/src/components/OrganizationPartners.tsx:import { isFeatureEnabled } from '@doctolib/variation_management'\npackages/@doctolib/partner-integration/src/components/OrganizationPartners.tsx:  const isEnabled = isFeatureEnabled('orga_partner_flagging')\npackages/@doctolib/partner-integration/src/components/admin/OrganizationPartnersManagementPage.tsx:import { isFeatureEnabled } from '@doctolib/variation_management'\npackages/@doctolib/partner-integration/src/compon\n…(truncated, 1137 more chars)\n\nPerfect! Now let me look at the variation_management package to understand feature switches better:\n\nTools used:\n\n- Bash: find packages/@doctolib/variation_management -type f \\( -name \".tsx\" -o -name \".ts\" \\) -path \"/src/\" | head -10\n\nTool results:\n\n  → result (ok): packages/@doctolib/variation_management/src/feature-switch/isFeatureEnabled/isFeatureEnabledForEveryOrganizationOfAccount.ts\npackages/@doctolib/variation_management/src/feature-switch/isFeatureEnabled/isSpecialityFeatureEnabled.ts\npackages/@doctolib/variation_management/src/feature-switch/isFeatureEnabled/isCountryFeatureEnabled.ts\npackages/@doctolib/variation_management/src/feature-switch/isFeatureEnabled/isConnectorFeatureEnabled.ts\npackages/@doctolib/variation_management/src/feature-switch/is\n…(truncated, 581 more chars)\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/variation_management/src\n\nTool results:\n\n  → result (ERROR): EISDIR: illegal operation on a directory, read '/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/variation_management/src'\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/variation_management/src/feature-switch/isFeatureEnabled/isFeatureEnabled.ts\n\nTool results:\n\n  → result (ok): 1→import type { Account } from 'monolith_DEPRECATED/types/api/Account'\n     2→import type { Patient } from 'monolith_DEPRECATED/types/doctor/api/Patient'\n     3→import isConnectorFeatureEnabled from './isConnectorFeatureEnabled'\n     4→import isFeatureEnabledForEveryOrganizationOfAccount from './isFeatureEnabledForEveryOrganizationOfAccount'\n     5→import isGlobalFeatureEnabled from './isGlobalFeatureEnabled'\n     6→import isCountryFeatureEnabled from './isCountryFeatureEnabled'\n     7→import is\n…(truncated, 2148 more chars)\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/variation_management/src/feature-switch/isFeatureEnabled/isGlobalFeatureEnabled.ts\n\nTool results:\n\n  → result (ok): 1→import CONSTANTS from 'monolith_DEPRECATED/services/constants'\n     2→import { envIsProduction, getEnvironment } from 'monolith_DEPRECATED/packages/device/environment'\n     3→\n     4→const isGlobalFeatureEnabled = (featureSwitchName: string): boolean => {\n     5→  const key = ${featureSwitchName.toUpperCase()}_ENABLED\n     6→\n     7→  if (typeof CONSTANTS[key] !== 'boolean') {\n     8→    if (!getEnvironment()) return false\n     9→    if (!envIsProduction()) throw new Error(Feature switch ${\n…(truncated, 498 more chars)\n\nPerfect! Now let me verify one more real usage example:\n\nTools used:\n\n- Read: /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/partner-integration/src/components/OrganizationPartners.tsx (1–40)\n\nTool results:\n\n  → result (ok): 1→import React from 'react'\n     2→import { Pill } from '@doctolib/design-system-b2b/Pill'\n     3→import { isFeatureEnabled } from '@doctolib/variation_management'\n     4→import Link from 'components/base/Link'\n     5→import { useOrganizationPartnersIndex } from '../queries/useOrganizationPartners'\n     6→\n     7→interface OrganizationPartnersProps {\n     8→  organizationId: number | string\n     9→}\n    10→\n    11→const MAX_LABEL_LENGTH = 40\n    12→\n    13→const truncateLabel = (text: string, ma\n…(truncated, 1335 more chars)\n\nPerfect! Now I have all the information. Let me compile my findings:\n\nSummary of Findings\n\nI've completed a thorough search of the codebase. Here are the answers to your three questions:\n\n---\n\n1. Feature Switch Pattern on Frontend (dl_constants)\n\nHow feature switches work with dl_constants:\n\nThe codebase uses two main patterns for feature switches:\n\nPattern A: Direct window.dl_constants Access (Test/Legacy)\n// From packages/@doctolib/maps/src/MapContainer.tsx\nconst shouldPreventLoadingInTest = () => {\n  const envIsTest = document.head.dataset.env === 'test'\n  const allowGoogleMapsLoadInTests = window.dl_constants.ALLOW_GOOGLE_MAPS_LOAD_IN_TESTS_ENABLED\n  \n  return envIsTest && !allowGoogleMapsLoadInTests\n}\n\nThis is used in tests and simpler cases. The pattern is:\n- Feature switch name (e.g., NHR_DOCUMENT_LIST) gets _ENABLED suffix → NHR_DOCUMENT_LIST_ENABLED\n- Access via window.dl_constants.<FLAG_NAME>\n- Constants are set at /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/hooks/doctor/useFetchConstants.ts:\n    window.dl_constants = constants  // fetched from backend\n\nPattern B: Proper Frontend Pattern (Recommended)\nUse isFeatureEnabled() from @doctolib/variation_management:\n\n// From packages/@doctolib/partner-integration/src/components/OrganizationPartners.tsx\nimport { isFeatureEnabled } from '@doctolib/variation_management'\n\nconst OrganizationPartners: React.FC<Props> = ({ organizationId }) => {\n  const isEnabled = isFeatureEnabled('orga_partner_flagging')  // name without _ENABLED suffix\n  \n  if (!isEnabled) return null\n  // ... rest of component\n}\n\nThe isFeatureEnabled() function (from /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/variation_management/src/feature-switch/isFeatureEnabled/isFeatureEnabled.ts):\n- Converts feature name to uppercase: orga_partner_flagging → ORGA_PARTNER_FLAGGING_ENABLED\n- Retrieves from CONSTANTS (which comes from window.dl_constants)\n- Supports multiple feature switch types: 'global', 'country', 'account', 'any-organization-of-account', 'every-organization-of-account', 'patient-organization', 'speciality', 'connector'\n\nType definitions:\n- Window type at /Users/USER/workspace/doctolib/doctolib/app/assets/javascripts/types/commons/window.ts:\n    declare global {\n    interface Window {\n      dl_constants: any  // because mix of feature switches and constants\n    }\n  }\n\nNO useFeatureSwitch hook exists — components directly call isFeatureEnabled() as a function, not a hook.\n\n---\n\n2. DmpEntryPoint / NhrDocumentList Status\n\nCurrent state:\n- No DmpEntryPoint component exists anywhere in the codebase\n- No NhrDocumentList component exists anywhere in the codebase\n- Treatment plan package only contains a placeholder at /Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/src/components/NationalHealthRecordsUi.tsx:\n    export const NationalHealthRecordsUi = () => <h1>National Health Records UI Placeholder</h1>\n\nAvailable DMP components in @doctolib/dmp:\n- DmpPill — A pill/button component for DMP sharing (at /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/components/DmpPill.tsx)\n- DmpPillWithPopover — DMP pill with popover UI\n- Various hooks: useDmpAvailability, useDmpEnabledForAccount, useDmpSetUp, etc.\n\nThese are document sharing components, not entry points for document lists.\n\n---\n\n3. @doctolib/dmp Package Structure & Exports\n\nPackage.json (at /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/package.json):\n{\n  \"name\": \"@doctolib/dmp\",\n  \"version\": \"1.0.0\",\n  \"exports\": {\n    \".\": \"./src/index.ts\",\n    \"./test\": \"./src/test-index.ts\"\n  }\n}\n\nPublic API exports (from /Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/index.ts):\n- Components: DmpPill, DmpPillWithPopover\n- Hooks: useDmpSetUp, useDmpAvailability, useDmpSharingServiceFactory, useDmpEnabledForAccount\n- Services: DmpApi, DmpSharingService\n- Types & Functions: Multiple DMP-related exports (60+ items including types for documents, sessions, configurations, etc.)\n- FrDmp APIs: connectToDmp, getCachedDmpSession, findDocuments, deleteDocument, sendDocument, etc.\n\nHelpers folder (/Users/USER/workspace/doctolib/doctolib/packages/@doctolib/dmp/src/helpers/):\n- ✅ Exists with 2 files:\n  - frDmpDocumentFixtureBuilder.ts — Test fixture builder\n  - FrDmpHelpers.ts — Utility functions: getDocumentFormat(), getDmpDocumentItemId(), getFrDmpDocument(), getSharingSettingsForDocument(), isDdvVersionCompatibleWithDmp(), needSecretConnexion(), upsertFrDmpDocument()\n\nTreatment-plan package (at /Users/USER/workspace/doctolib/treatment-plan/packages/tpf-national-health-records-ui/):\n- Version: 2.0.0\n- Only exports: NationalHealthRecordsUi (placeholder component)\n- No helpers folder, no document list implementation\n\n---\n\nRecommendations for Your Implementation\n\n1. For feature switch: Use isFeatureEnabled('nhr_document_list') (without _ENABLED suffix) from @doctolib/variation_management\n\n2. For DmpEntryPoint: You'll need to create this new component — likely in treatment-plan or @doctolib/dmp\n\n3. For NhrDocumentList: You'll need to build this component in treatment-plan's UI package (currently just a placeholder)\n\n4. Existing building blocks available:\n   - @doctolib/dmp has all the FrDMP document APIs and utilities\n   - DmpPill can be used as reference for component structure\n   - Helper functions in FrDmpHelpers` are available for document manipulation",
  "sha256": "24c1886e3066a23d",
  "source_url": "sessions/doctolib-doctolib/2026-02-25T13-17-doctolib-doctolib-nested-cuddling-pizza-subagent-a07fdc81.html"
}