@salesforce/ui-bundle-template-feature-react-global-search 1.117.2

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.
Files changed (231) hide show
  1. package/LICENSE.txt +82 -0
  2. package/README.md +250 -0
  3. package/dist/.forceignore +15 -0
  4. package/dist/.husky/pre-commit +4 -0
  5. package/dist/.prettierignore +11 -0
  6. package/dist/.prettierrc +17 -0
  7. package/dist/AGENT.md +193 -0
  8. package/dist/CHANGELOG.md +2128 -0
  9. package/dist/README.md +28 -0
  10. package/dist/config/project-scratch-def.json +13 -0
  11. package/dist/eslint.config.js +7 -0
  12. package/dist/force-app/main/default/uiBundles/feature-react-global-search/.forceignore +15 -0
  13. package/dist/force-app/main/default/uiBundles/feature-react-global-search/.graphqlrc.yml +2 -0
  14. package/dist/force-app/main/default/uiBundles/feature-react-global-search/.prettierignore +9 -0
  15. package/dist/force-app/main/default/uiBundles/feature-react-global-search/.prettierrc +11 -0
  16. package/dist/force-app/main/default/uiBundles/feature-react-global-search/CHANGELOG.md +10 -0
  17. package/dist/force-app/main/default/uiBundles/feature-react-global-search/README.md +75 -0
  18. package/dist/force-app/main/default/uiBundles/feature-react-global-search/codegen.yml +95 -0
  19. package/dist/force-app/main/default/uiBundles/feature-react-global-search/components.json +18 -0
  20. package/dist/force-app/main/default/uiBundles/feature-react-global-search/e2e/app.spec.ts +17 -0
  21. package/dist/force-app/main/default/uiBundles/feature-react-global-search/eslint.config.js +169 -0
  22. package/dist/force-app/main/default/uiBundles/feature-react-global-search/feature-react-global-search.uibundle-meta.xml +7 -0
  23. package/dist/force-app/main/default/uiBundles/feature-react-global-search/index.html +12 -0
  24. package/dist/force-app/main/default/uiBundles/feature-react-global-search/package.json +70 -0
  25. package/dist/force-app/main/default/uiBundles/feature-react-global-search/playwright.config.ts +24 -0
  26. package/dist/force-app/main/default/uiBundles/feature-react-global-search/scripts/get-graphql-schema.mjs +68 -0
  27. package/dist/force-app/main/default/uiBundles/feature-react-global-search/scripts/rewrite-e2e-assets.mjs +23 -0
  28. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/api/graphqlClient.ts +25 -0
  29. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/app.tsx +17 -0
  30. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/appLayout.tsx +83 -0
  31. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/assets/icons/book.svg +3 -0
  32. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/assets/icons/copy.svg +4 -0
  33. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/assets/icons/rocket.svg +3 -0
  34. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/assets/icons/star.svg +3 -0
  35. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/assets/images/codey-1.png +0 -0
  36. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/assets/images/codey-2.png +0 -0
  37. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/assets/images/codey-3.png +0 -0
  38. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/assets/images/vibe-codey.svg +194 -0
  39. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/alerts/status-alert.tsx +49 -0
  40. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/layouts/card-layout.tsx +29 -0
  41. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/alert.tsx +76 -0
  42. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/badge.tsx +48 -0
  43. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/breadcrumb.tsx +109 -0
  44. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/button.tsx +67 -0
  45. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/calendar.tsx +232 -0
  46. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/card.tsx +103 -0
  47. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/checkbox.tsx +32 -0
  48. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/collapsible.tsx +33 -0
  49. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/datePicker.tsx +127 -0
  50. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/dialog.tsx +162 -0
  51. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/field.tsx +237 -0
  52. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/index.ts +84 -0
  53. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/input.tsx +19 -0
  54. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/label.tsx +22 -0
  55. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/pagination.tsx +132 -0
  56. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/popover.tsx +89 -0
  57. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/select.tsx +193 -0
  58. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/separator.tsx +26 -0
  59. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/skeleton.tsx +14 -0
  60. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/sonner.tsx +20 -0
  61. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/spinner.tsx +16 -0
  62. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/table.tsx +114 -0
  63. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/tabs.tsx +88 -0
  64. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/api/objectDetailService.ts +102 -0
  65. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/api/objectInfoGraphQLService.ts +137 -0
  66. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/api/objectInfoService.ts +95 -0
  67. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/api/recordListGraphQLService.ts +364 -0
  68. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/DetailFields.tsx +55 -0
  69. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/DetailForm.tsx +146 -0
  70. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/DetailHeader.tsx +34 -0
  71. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/DetailLayoutSections.tsx +80 -0
  72. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/Section.tsx +108 -0
  73. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/SectionRow.tsx +20 -0
  74. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/UiApiDetailForm.tsx +140 -0
  75. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FieldValueDisplay.tsx +73 -0
  76. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FormattedAddress.tsx +29 -0
  77. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FormattedEmail.tsx +17 -0
  78. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FormattedPhone.tsx +24 -0
  79. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FormattedText.tsx +11 -0
  80. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FormattedUrl.tsx +29 -0
  81. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/filters/FilterField.tsx +54 -0
  82. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/filters/FilterInput.tsx +55 -0
  83. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/filters/FilterSelect.tsx +72 -0
  84. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/filters/FiltersPanel.tsx +380 -0
  85. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/forms/filters-form.tsx +114 -0
  86. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/forms/submit-button.tsx +47 -0
  87. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/GlobalSearchInput.tsx +114 -0
  88. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/ResultCardFields.tsx +71 -0
  89. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/SearchHeader.tsx +31 -0
  90. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/SearchPagination.tsx +144 -0
  91. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/SearchResultCard.tsx +138 -0
  92. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/SearchResultsPanel.tsx +197 -0
  93. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/shared/LoadingFallback.tsx +61 -0
  94. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/constants.ts +39 -0
  95. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/filters/FilterInput.tsx +55 -0
  96. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/filters/FilterSelect.tsx +72 -0
  97. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/hooks/form.tsx +209 -0
  98. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/hooks/useObjectInfoBatch.ts +72 -0
  99. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/hooks/useObjectSearchData.ts +174 -0
  100. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/hooks/useRecordDetailLayout.ts +137 -0
  101. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/hooks/useRecordListGraphQL.ts +135 -0
  102. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/pages/DetailPage.tsx +109 -0
  103. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/pages/GlobalSearch.tsx +235 -0
  104. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/filters/filters.ts +121 -0
  105. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/filters/picklist.ts +6 -0
  106. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/objectInfo/objectInfo.ts +49 -0
  107. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/recordDetail/recordDetail.ts +61 -0
  108. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/schema.d.ts +200 -0
  109. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/search/searchResults.ts +229 -0
  110. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/apiUtils.ts +59 -0
  111. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/cacheUtils.ts +76 -0
  112. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/debounce.ts +90 -0
  113. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/fieldUtils.ts +354 -0
  114. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/fieldValueExtractor.ts +67 -0
  115. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/filterUtils.ts +32 -0
  116. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/formDataTransformUtils.ts +260 -0
  117. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/formUtils.ts +142 -0
  118. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/graphQLNodeFieldUtils.ts +186 -0
  119. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/graphQLObjectInfoAdapter.ts +77 -0
  120. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/graphQLRecordAdapter.ts +90 -0
  121. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/layoutTransformUtils.ts +236 -0
  122. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/linkUtils.ts +14 -0
  123. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/paginationUtils.ts +49 -0
  124. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/recordUtils.ts +159 -0
  125. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/sanitizationUtils.ts +50 -0
  126. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/index.ts +120 -0
  127. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/lib/utils.ts +6 -0
  128. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/navigationMenu.tsx +80 -0
  129. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/pages/Home.tsx +13 -0
  130. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/pages/NotFound.tsx +18 -0
  131. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/router-utils.tsx +35 -0
  132. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/routes.tsx +44 -0
  133. package/dist/force-app/main/default/uiBundles/feature-react-global-search/src/styles/global.css +135 -0
  134. package/dist/force-app/main/default/uiBundles/feature-react-global-search/tsconfig.json +42 -0
  135. package/dist/force-app/main/default/uiBundles/feature-react-global-search/tsconfig.node.json +13 -0
  136. package/dist/force-app/main/default/uiBundles/feature-react-global-search/ui-bundle.json +7 -0
  137. package/dist/force-app/main/default/uiBundles/feature-react-global-search/vite-env.d.ts +1 -0
  138. package/dist/force-app/main/default/uiBundles/feature-react-global-search/vite.config.ts +106 -0
  139. package/dist/force-app/main/default/uiBundles/feature-react-global-search/vitest-env.d.ts +2 -0
  140. package/dist/force-app/main/default/uiBundles/feature-react-global-search/vitest.config.ts +11 -0
  141. package/dist/force-app/main/default/uiBundles/feature-react-global-search/vitest.setup.ts +1 -0
  142. package/dist/jest.config.js +6 -0
  143. package/dist/package-lock.json +9995 -0
  144. package/dist/package.json +40 -0
  145. package/dist/scripts/apex/hello.apex +10 -0
  146. package/dist/scripts/graphql-search.sh +191 -0
  147. package/dist/scripts/prepare-import-unique-fields.js +122 -0
  148. package/dist/scripts/setup-cli.mjs +563 -0
  149. package/dist/scripts/sf-project-setup.mjs +66 -0
  150. package/dist/scripts/soql/account.soql +6 -0
  151. package/dist/sfdx-project.json +12 -0
  152. package/package.json +53 -0
  153. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/__inherit__appLayout.tsx +9 -0
  154. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/alerts/__inherit__status-alert.tsx +27 -0
  155. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/layouts/__inherit__card-layout.tsx +9 -0
  156. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/__inherit__alert.tsx +41 -0
  157. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/__inherit__button.tsx +45 -0
  158. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/__inherit__card.tsx +33 -0
  159. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/__inherit__field.tsx +62 -0
  160. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/__inherit__input.tsx +5 -0
  161. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/__inherit__label.tsx +8 -0
  162. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/__inherit__pagination.tsx +47 -0
  163. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/__inherit__select.tsx +57 -0
  164. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/__inherit__skeleton.tsx +5 -0
  165. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/components/ui/__inherit__spinner.tsx +7 -0
  166. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/api/objectDetailService.ts +102 -0
  167. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/api/objectInfoGraphQLService.ts +137 -0
  168. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/api/objectInfoService.ts +95 -0
  169. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/api/recordListGraphQLService.ts +364 -0
  170. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/DetailFields.tsx +55 -0
  171. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/DetailForm.tsx +146 -0
  172. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/DetailHeader.tsx +34 -0
  173. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/DetailLayoutSections.tsx +80 -0
  174. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/Section.tsx +108 -0
  175. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/SectionRow.tsx +20 -0
  176. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/UiApiDetailForm.tsx +140 -0
  177. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FieldValueDisplay.tsx +73 -0
  178. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FormattedAddress.tsx +29 -0
  179. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FormattedEmail.tsx +17 -0
  180. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FormattedPhone.tsx +24 -0
  181. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FormattedText.tsx +11 -0
  182. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/detail/formatted/FormattedUrl.tsx +29 -0
  183. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/filters/FilterField.tsx +54 -0
  184. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/filters/FilterInput.tsx +55 -0
  185. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/filters/FilterSelect.tsx +72 -0
  186. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/filters/FiltersPanel.tsx +380 -0
  187. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/forms/filters-form.tsx +114 -0
  188. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/forms/submit-button.tsx +47 -0
  189. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/GlobalSearchInput.tsx +114 -0
  190. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/ResultCardFields.tsx +71 -0
  191. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/SearchHeader.tsx +31 -0
  192. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/SearchPagination.tsx +144 -0
  193. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/SearchResultCard.tsx +138 -0
  194. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/search/SearchResultsPanel.tsx +197 -0
  195. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/shared/LoadingFallback.tsx +61 -0
  196. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/constants.ts +39 -0
  197. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/filters/FilterInput.tsx +55 -0
  198. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/filters/FilterSelect.tsx +72 -0
  199. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/hooks/form.tsx +209 -0
  200. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/hooks/useObjectInfoBatch.ts +72 -0
  201. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/hooks/useObjectSearchData.ts +174 -0
  202. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/hooks/useRecordDetailLayout.ts +137 -0
  203. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/hooks/useRecordListGraphQL.ts +135 -0
  204. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/pages/DetailPage.tsx +109 -0
  205. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/pages/GlobalSearch.tsx +235 -0
  206. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/filters/filters.ts +121 -0
  207. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/filters/picklist.ts +6 -0
  208. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/objectInfo/objectInfo.ts +49 -0
  209. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/recordDetail/recordDetail.ts +61 -0
  210. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/schema.d.ts +200 -0
  211. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/types/search/searchResults.ts +229 -0
  212. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/apiUtils.ts +59 -0
  213. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/cacheUtils.ts +76 -0
  214. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/debounce.ts +90 -0
  215. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/fieldUtils.ts +354 -0
  216. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/fieldValueExtractor.ts +67 -0
  217. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/filterUtils.ts +32 -0
  218. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/formDataTransformUtils.ts +260 -0
  219. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/formUtils.ts +142 -0
  220. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/graphQLNodeFieldUtils.ts +186 -0
  221. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/graphQLObjectInfoAdapter.ts +77 -0
  222. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/graphQLRecordAdapter.ts +90 -0
  223. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/layoutTransformUtils.ts +236 -0
  224. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/linkUtils.ts +14 -0
  225. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/paginationUtils.ts +49 -0
  226. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/recordUtils.ts +159 -0
  227. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/utils/sanitizationUtils.ts +50 -0
  228. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/index.ts +120 -0
  229. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/lib/__inherit__utils.ts +5 -0
  230. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/pages/Home.tsx +13 -0
  231. package/src/force-app/main/default/uiBundles/feature-react-global-search/src/routes.tsx +52 -0
@@ -0,0 +1,72 @@
1
+ /**
2
+ * useObjectInfoBatch
3
+ *
4
+ * Fetches object metadata (label, labelPlural, fields, etc.) for the given object API names.
5
+ * Uses the shared cache in objectInfoService so List, Home, and Detail views reuse one request.
6
+ */
7
+
8
+ import { useState, useEffect, useRef } from "react";
9
+ import { objectInfoService } from "../api/objectInfoService";
10
+ import type { ObjectInfoResult } from "../types/objectInfo/objectInfo";
11
+
12
+ export interface UseObjectInfoBatchResult {
13
+ /** Object metadata in the same order as the requested objectApiNames. */
14
+ objectInfos: ObjectInfoResult[];
15
+ loading: boolean;
16
+ error: string | null;
17
+ }
18
+
19
+ /**
20
+ * Fetches batch object info for the given object API names. Results are cached;
21
+ * multiple callers (List, Home, Detail) share the same request.
22
+ *
23
+ * @param objectApiNames - Array of object API names (e.g. OBJECT_API_NAMES)
24
+ * @returns objectInfos (same order as input), loading, error
25
+ */
26
+ export function useObjectInfoBatch(objectApiNames: string[]): UseObjectInfoBatchResult {
27
+ const [state, setState] = useState<UseObjectInfoBatchResult>({
28
+ objectInfos: [],
29
+ loading: objectApiNames.length > 0,
30
+ error: null,
31
+ });
32
+ const isCancelled = useRef(false);
33
+ // Derive a stable primitive from the array so the effect dependency doesn't
34
+ // change on every render. A new array reference (even with identical contents)
35
+ // would otherwise trigger the effect on every render, causing an infinite loop.
36
+ const namesKey = objectApiNames.filter(Boolean).join(",");
37
+
38
+ useEffect(() => {
39
+ isCancelled.current = false;
40
+ // Re-derive the array inside the effect from the stable key rather than
41
+ // closing over objectApiNames directly, which would require it in the dep
42
+ // array and reintroduce the infinite loop.
43
+ const names = namesKey ? namesKey.split(",") : [];
44
+ if (names.length === 0) {
45
+ queueMicrotask(() => setState({ objectInfos: [], loading: false, error: null }));
46
+ return;
47
+ }
48
+ queueMicrotask(() => setState((s) => ({ ...s, loading: true, error: null })));
49
+ objectInfoService
50
+ .getObjectInfoBatch(namesKey)
51
+ .then((res) => {
52
+ if (isCancelled.current) return;
53
+ const objectInfos = names
54
+ .map((apiName) => res.results?.find((r) => r.result?.ApiName === apiName)?.result)
55
+ .filter((r) => r != null) as ObjectInfoResult[];
56
+ setState({ objectInfos, loading: false, error: null });
57
+ })
58
+ .catch((err) => {
59
+ if (isCancelled.current) return;
60
+ setState({
61
+ objectInfos: [],
62
+ loading: false,
63
+ error: err instanceof Error ? err.message : (err as string),
64
+ });
65
+ });
66
+ return () => {
67
+ isCancelled.current = true;
68
+ };
69
+ }, [namesKey]);
70
+
71
+ return state;
72
+ }
@@ -0,0 +1,174 @@
1
+ /**
2
+ * Object Search Data Hooks
3
+ *
4
+ * - useObjectListMetadata: single source for list-view metadata (filters → columns + picklists). Use in list pages to avoid duplicate state and API calls.
5
+ * - useObjectColumns / useObjectFilters: thin wrappers over useObjectListMetadata for backward compatibility.
6
+ * - getSharedFilters: module-level deduplication for getObjectListFilters across hook instances.
7
+ */
8
+
9
+ import { useState, useEffect } from "react";
10
+ import { objectInfoService } from "../api/objectInfoService";
11
+ import type { Column } from "../types/search/searchResults";
12
+ import type { Filter } from "../types/filters/filters";
13
+ import type { PicklistValue } from "../types/filters/picklist";
14
+
15
+ // --- Shared filters cache (deduplicates getObjectListFilters across useObjectColumns + useObjectFilters) ---
16
+ const sharedFiltersCache = new Map<string, Filter[]>();
17
+ const sharedFiltersInFlight = new Map<string, Promise<Filter[]>>();
18
+
19
+ function getSharedFilters(objectApiName: string): Promise<Filter[]> {
20
+ const cached = sharedFiltersCache.get(objectApiName);
21
+ if (cached) return Promise.resolve(cached);
22
+ const inFlight = sharedFiltersInFlight.get(objectApiName);
23
+ if (inFlight) return inFlight;
24
+ const promise = objectInfoService
25
+ .getObjectListFilters(objectApiName)
26
+ .then((filters) => {
27
+ sharedFiltersCache.set(objectApiName, filters);
28
+ sharedFiltersInFlight.delete(objectApiName);
29
+ return filters;
30
+ })
31
+ .catch((err) => {
32
+ sharedFiltersInFlight.delete(objectApiName);
33
+ throw err;
34
+ });
35
+ sharedFiltersInFlight.set(objectApiName, promise);
36
+ return promise;
37
+ }
38
+
39
+ // --- Shared Types ---
40
+ export interface FiltersData {
41
+ filters: Filter[];
42
+ picklistValues: Record<string, PicklistValue[]>;
43
+ loading: boolean;
44
+ error: string | null;
45
+ }
46
+
47
+ /**
48
+ * Derives column definitions from filter definitions for list/result UI.
49
+ */
50
+ function filtersToColumns(filters: Filter[]): Column[] {
51
+ return filters.map((f) => ({
52
+ fieldApiName: f.targetFieldPath,
53
+ label: f.label,
54
+ searchable: true,
55
+ sortable: true,
56
+ }));
57
+ }
58
+
59
+ export interface ObjectListMetadata {
60
+ columns: Column[];
61
+ filters: Filter[];
62
+ picklistValues: Record<string, PicklistValue[]>;
63
+ loading: boolean;
64
+ error: string | null;
65
+ }
66
+
67
+ /**
68
+ * Single hook for list-view metadata: filters (shared API), derived columns, and picklist values.
69
+ * Use this in list/search pages to avoid duplicate useObjectColumns + useObjectFilters and duplicate state.
70
+ */
71
+ export function useObjectListMetadata(objectApiName: string | null): ObjectListMetadata {
72
+ const [state, setState] = useState<{
73
+ columns: Column[];
74
+ filters: Filter[];
75
+ picklistValues: Record<string, PicklistValue[]>;
76
+ loading: boolean;
77
+ error: string | null;
78
+ }>({
79
+ columns: [],
80
+ filters: [],
81
+ picklistValues: {},
82
+ loading: true,
83
+ error: null,
84
+ });
85
+
86
+ useEffect(() => {
87
+ if (!objectApiName) {
88
+ queueMicrotask(() => setState((s) => ({ ...s, loading: false, error: "Invalid object" })));
89
+ return;
90
+ }
91
+
92
+ let isCancelled = false;
93
+
94
+ const run = async () => {
95
+ queueMicrotask(() => setState((s) => ({ ...s, loading: true, error: null })));
96
+ try {
97
+ const filters = await getSharedFilters(objectApiName!);
98
+ if (isCancelled) return;
99
+
100
+ const selectFilters = filters.filter((f) => f.affordance?.toLowerCase() === "select");
101
+ const picklistPromises = selectFilters.map((f) =>
102
+ objectInfoService
103
+ .getPicklistValues(objectApiName!, f.targetFieldPath)
104
+ .then((values) => ({ fieldPath: f.targetFieldPath, values }))
105
+ .catch(() => ({ fieldPath: f.targetFieldPath, values: [] as PicklistValue[] })),
106
+ );
107
+ const picklistResults = await Promise.all(picklistPromises);
108
+ if (isCancelled) return;
109
+
110
+ const picklistValues: Record<string, PicklistValue[]> = {};
111
+ picklistResults.forEach(({ fieldPath, values }) => {
112
+ picklistValues[fieldPath] = values;
113
+ });
114
+
115
+ setState({
116
+ columns: filtersToColumns(filters),
117
+ filters,
118
+ picklistValues,
119
+ loading: false,
120
+ error: null,
121
+ });
122
+ } catch {
123
+ if (isCancelled) return;
124
+ setState((s) => ({
125
+ ...s,
126
+ columns: [],
127
+ filters: [],
128
+ picklistValues: {},
129
+ loading: false,
130
+ error: "Failed to load list metadata",
131
+ }));
132
+ }
133
+ };
134
+
135
+ run();
136
+ return () => {
137
+ isCancelled = true;
138
+ };
139
+ }, [objectApiName]);
140
+
141
+ return state;
142
+ }
143
+
144
+ /**
145
+ * Hook: useObjectColumns
146
+ * Thin wrapper over useObjectListMetadata for backward compatibility.
147
+ */
148
+ export function useObjectColumns(objectApiName: string | null) {
149
+ const { columns, loading, error } = useObjectListMetadata(objectApiName);
150
+ return {
151
+ columns: objectApiName ? columns : [],
152
+ columnsLoading: loading,
153
+ columnsError: error,
154
+ };
155
+ }
156
+
157
+ /**
158
+ * Hook: useObjectFilters
159
+ * Thin wrapper over useObjectListMetadata for backward compatibility.
160
+ */
161
+ export function useObjectFilters(objectApiName: string | null) {
162
+ const { filters, picklistValues, loading, error } = useObjectListMetadata(objectApiName);
163
+ const filtersData: Record<string, FiltersData> = objectApiName
164
+ ? {
165
+ [objectApiName]: {
166
+ filters,
167
+ picklistValues,
168
+ loading,
169
+ error,
170
+ },
171
+ }
172
+ : {};
173
+ return { filtersData };
174
+ }
@@ -0,0 +1,137 @@
1
+ import { useState, useEffect, useRef } from "react";
2
+ import { objectDetailService } from "../api/objectDetailService";
3
+ import type { LayoutResponse } from "../types/recordDetail/recordDetail";
4
+ import type { ObjectInfoResult } from "../types/objectInfo/objectInfo";
5
+ import type { GraphQLRecordNode } from "../api/recordListGraphQLService";
6
+
7
+ export interface UseRecordDetailLayoutReturn {
8
+ layout: LayoutResponse | null;
9
+ record: GraphQLRecordNode | null;
10
+ objectMetadata: ObjectInfoResult | null;
11
+ loading: boolean;
12
+ error: string | null;
13
+ }
14
+
15
+ export interface UseRecordDetailLayoutParams {
16
+ objectApiName: string | null;
17
+ recordId: string | null;
18
+ recordTypeId?: string | null;
19
+ initialData?: {
20
+ layout: LayoutResponse;
21
+ record: GraphQLRecordNode;
22
+ objectMetadata: ObjectInfoResult;
23
+ } | null;
24
+ }
25
+
26
+ const MAX_CACHE_SIZE = 50;
27
+ const CACHE_TTL_MS = 5 * 60 * 1000;
28
+
29
+ type CacheEntry = {
30
+ layout: LayoutResponse;
31
+ record: GraphQLRecordNode;
32
+ objectMetadata: ObjectInfoResult;
33
+ cachedAt: number;
34
+ };
35
+
36
+ export function useRecordDetailLayout({
37
+ objectApiName,
38
+ recordId,
39
+ recordTypeId = null,
40
+ initialData = null,
41
+ }: UseRecordDetailLayoutParams): UseRecordDetailLayoutReturn {
42
+ const [layout, setLayout] = useState<LayoutResponse | null>(initialData?.layout ?? null);
43
+ const [record, setRecord] = useState<GraphQLRecordNode | null>(initialData?.record ?? null);
44
+ const [objectMetadata, setObjectMetadata] = useState<ObjectInfoResult | null>(
45
+ initialData?.objectMetadata ?? null,
46
+ );
47
+ const [loading, setLoading] = useState(!initialData);
48
+ const [error, setError] = useState<string | null>(null);
49
+
50
+ const cacheKey =
51
+ objectApiName && recordId ? `${objectApiName}:${recordId}:${recordTypeId ?? "default"}` : null;
52
+ const cacheRef = useRef<Map<string, CacheEntry>>(new Map());
53
+
54
+ useEffect(() => {
55
+ if (!objectApiName || !recordId) {
56
+ setError("Invalid object or record ID");
57
+ setLoading(false);
58
+ return;
59
+ }
60
+
61
+ if (
62
+ initialData?.layout != null &&
63
+ initialData?.record != null &&
64
+ initialData?.objectMetadata != null
65
+ ) {
66
+ return;
67
+ }
68
+
69
+ const cached = cacheRef.current.get(cacheKey!);
70
+ const now = Date.now();
71
+ if (cached && now - cached.cachedAt < CACHE_TTL_MS) {
72
+ setLayout(cached.layout);
73
+ setRecord(cached.record);
74
+ setObjectMetadata(cached.objectMetadata);
75
+ setLoading(false);
76
+ setError(null);
77
+ return;
78
+ }
79
+
80
+ let isCancelled = false;
81
+
82
+ const fetchDetail = async () => {
83
+ setLoading(true);
84
+ setError(null);
85
+
86
+ try {
87
+ const {
88
+ layout: layoutData,
89
+ record: recordData,
90
+ objectMetadata: objectMetadataData,
91
+ } = await objectDetailService.getRecordDetail(
92
+ objectApiName,
93
+ recordId,
94
+ recordTypeId ?? undefined,
95
+ );
96
+
97
+ if (isCancelled) return;
98
+
99
+ const cache = cacheRef.current;
100
+ if (cache.size >= MAX_CACHE_SIZE) {
101
+ const firstKey = cache.keys().next().value;
102
+ if (firstKey != null) cache.delete(firstKey);
103
+ }
104
+ cache.set(cacheKey!, {
105
+ layout: layoutData,
106
+ record: recordData,
107
+ objectMetadata: objectMetadataData,
108
+ cachedAt: Date.now(),
109
+ });
110
+ setLayout(layoutData);
111
+ setRecord(recordData);
112
+ setObjectMetadata(objectMetadataData);
113
+ } catch {
114
+ if (isCancelled) return;
115
+ setError("Failed to load record details");
116
+ } finally {
117
+ if (!isCancelled) {
118
+ setLoading(false);
119
+ }
120
+ }
121
+ };
122
+
123
+ fetchDetail();
124
+
125
+ return () => {
126
+ isCancelled = true;
127
+ };
128
+ }, [objectApiName, recordId, recordTypeId, cacheKey, initialData]);
129
+
130
+ return {
131
+ layout,
132
+ record,
133
+ objectMetadata,
134
+ loading,
135
+ error,
136
+ };
137
+ }
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Record list hook: GraphQL records with filter, sort, pagination, search.
3
+ * Use for list/search views; detail view uses useRecordDetailLayout instead.
4
+ *
5
+ * @module hooks/useRecordListGraphQL
6
+ */
7
+
8
+ import { useState, useEffect, useCallback } from "react";
9
+ import { useObjectColumns } from "./useObjectSearchData";
10
+ import {
11
+ getRecordsGraphQL,
12
+ buildOrderByFromSort,
13
+ type RecordListGraphQLResult,
14
+ } from "../api/recordListGraphQLService";
15
+ import type { Column } from "../types/search/searchResults";
16
+ import type { FilterCriteria } from "../types/filters/filters";
17
+
18
+ const EMPTY_FILTERS: FilterCriteria[] = [];
19
+
20
+ export interface UseRecordListGraphQLOptions {
21
+ objectApiName: string;
22
+ first?: number;
23
+ after?: string | null;
24
+ filters?: FilterCriteria[];
25
+ sortBy?: string;
26
+ searchQuery?: string;
27
+ /** When provided, skips useObjectColumns (use from parent e.g. useObjectListMetadata). */
28
+ columns?: Column[];
29
+ columnsLoading?: boolean;
30
+ columnsError?: string | null;
31
+ }
32
+
33
+ export interface UseRecordListGraphQLReturn {
34
+ data: RecordListGraphQLResult | null;
35
+ edges: Array<{ node?: Record<string, unknown> }>;
36
+ pageInfo: {
37
+ hasNextPage?: boolean;
38
+ hasPreviousPage?: boolean;
39
+ endCursor?: string | null;
40
+ startCursor?: string | null;
41
+ } | null;
42
+ loading: boolean;
43
+ error: string | null;
44
+ columnsLoading: boolean;
45
+ columnsError: string | null;
46
+ refetch: () => void;
47
+ }
48
+
49
+ /**
50
+ * Fetches records via GraphQL for the given object with filter, sort, pagination, and search.
51
+ */
52
+ export function useRecordListGraphQL(
53
+ options: UseRecordListGraphQLOptions,
54
+ ): UseRecordListGraphQLReturn {
55
+ const {
56
+ objectApiName,
57
+ first = 50,
58
+ after = null,
59
+ filters = EMPTY_FILTERS,
60
+ sortBy = "",
61
+ searchQuery = "",
62
+ columns: columnsProp,
63
+ columnsLoading: columnsLoadingProp,
64
+ columnsError: columnsErrorProp,
65
+ } = options;
66
+
67
+ const fromParent = columnsProp !== undefined;
68
+ const fromHook = useObjectColumns(fromParent ? null : objectApiName);
69
+
70
+ const columns = fromParent ? columnsProp : fromHook.columns;
71
+ const columnsLoading = fromParent ? (columnsLoadingProp ?? false) : fromHook.columnsLoading;
72
+ const columnsError = fromParent ? (columnsErrorProp ?? null) : fromHook.columnsError;
73
+
74
+ const [data, setData] = useState<RecordListGraphQLResult | null>(null);
75
+ const [loading, setLoading] = useState(false);
76
+ const [error, setError] = useState<string | null>(null);
77
+
78
+ const fetchRecords = useCallback(() => {
79
+ if (columnsLoading || columnsError || columns.length === 0) return;
80
+
81
+ setLoading(true);
82
+ setError(null);
83
+ const orderBy = buildOrderByFromSort(sortBy);
84
+
85
+ getRecordsGraphQL({
86
+ objectApiName,
87
+ columns,
88
+ first,
89
+ after,
90
+ filters,
91
+ orderBy,
92
+ searchQuery: searchQuery.trim() || undefined,
93
+ })
94
+ .then((result) => {
95
+ setData(result);
96
+ })
97
+ .catch((err) => {
98
+ setError(err instanceof Error ? err.message : "Failed to load records");
99
+ })
100
+ .finally(() => {
101
+ setLoading(false);
102
+ });
103
+ }, [
104
+ objectApiName,
105
+ columns,
106
+ columnsLoading,
107
+ columnsError,
108
+ first,
109
+ after,
110
+ filters,
111
+ sortBy,
112
+ searchQuery,
113
+ ]);
114
+
115
+ useEffect(() => {
116
+ if (!objectApiName || columnsLoading || columnsError) return;
117
+ if (columns.length === 0 && !columnsLoading) return;
118
+ queueMicrotask(() => fetchRecords());
119
+ }, [objectApiName, columns, columnsLoading, columnsError, fetchRecords]);
120
+
121
+ const objectData = data?.uiapi?.query?.[objectApiName];
122
+ const edges = objectData?.edges ?? [];
123
+ const pageInfo = objectData?.pageInfo ?? null;
124
+
125
+ return {
126
+ data,
127
+ edges,
128
+ pageInfo,
129
+ loading: columnsLoading || loading,
130
+ error: columnsError || error,
131
+ columnsLoading,
132
+ columnsError,
133
+ refetch: fetchRecords,
134
+ };
135
+ }
@@ -0,0 +1,109 @@
1
+ import { useMemo } from "react";
2
+ import { useParams, useNavigate } from "react-router";
3
+ import { Card, CardContent, CardHeader, CardTitle } from "../../../components/ui/card";
4
+ import { Skeleton } from "../../../components/ui/skeleton";
5
+ import { Alert, AlertDescription, AlertTitle } from "../../../components/ui/alert";
6
+ import { AlertCircle } from "lucide-react";
7
+ import DetailHeader from "../components/detail/DetailHeader";
8
+ import { UiApiDetailForm } from "../components/detail/UiApiDetailForm";
9
+ import { OBJECT_API_NAMES, DEFAULT_DETAIL_PAGE_TITLE } from "../constants";
10
+ import { toRecordDisplayNameMetadata } from "../utils/fieldUtils";
11
+ import { useRecordDetailLayout } from "../hooks/useRecordDetailLayout";
12
+ import { getGraphQLRecordDisplayName } from "../utils/graphQLNodeFieldUtils";
13
+
14
+ export default function DetailPage() {
15
+ const { objectApiName: objectApiNameParam, recordId } = useParams<{
16
+ objectApiName: string;
17
+ recordId: string;
18
+ }>();
19
+ const navigate = useNavigate();
20
+ const objectApiName = objectApiNameParam ?? OBJECT_API_NAMES[0];
21
+
22
+ const { layout, record, objectMetadata, loading, error } = useRecordDetailLayout({
23
+ objectApiName,
24
+ recordId: recordId ?? null,
25
+ });
26
+
27
+ const recordTitle = useMemo(
28
+ () =>
29
+ record
30
+ ? getGraphQLRecordDisplayName(record, toRecordDisplayNameMetadata(objectMetadata))
31
+ : DEFAULT_DETAIL_PAGE_TITLE,
32
+ [record, objectMetadata],
33
+ );
34
+
35
+ const handleBack = () => navigate(-1);
36
+
37
+ if (loading) {
38
+ return (
39
+ <div
40
+ className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12"
41
+ role="status"
42
+ aria-live="polite"
43
+ aria-label="Loading record details"
44
+ >
45
+ <span className="sr-only">Loading record details</span>
46
+ <Skeleton className="h-10 w-32 mb-6" aria-hidden="true" />
47
+ <Card aria-hidden="true">
48
+ <CardHeader>
49
+ <Skeleton className="h-8 w-3/4" />
50
+ </CardHeader>
51
+ <CardContent className="space-y-4">
52
+ {[1, 2, 3, 4].map((i) => (
53
+ <div key={i} className="space-y-2">
54
+ <Skeleton className="h-4 w-24" />
55
+ <Skeleton className="h-4 w-full" />
56
+ </div>
57
+ ))}
58
+ </CardContent>
59
+ </Card>
60
+ </div>
61
+ );
62
+ }
63
+
64
+ if (error) {
65
+ return (
66
+ <div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
67
+ <DetailHeader title="" onBack={handleBack} />
68
+ <Alert variant="destructive" role="alert">
69
+ <AlertCircle className="h-4 w-4" aria-hidden="true" />
70
+ <AlertTitle>Error</AlertTitle>
71
+ <AlertDescription>{error}</AlertDescription>
72
+ </Alert>
73
+ </div>
74
+ );
75
+ }
76
+
77
+ if (!layout || !record) {
78
+ return (
79
+ <div className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12">
80
+ <DetailHeader title="" onBack={handleBack} />
81
+ <Alert role="alert">
82
+ <AlertCircle className="h-4 w-4" aria-hidden="true" />
83
+ <AlertTitle>Not Found</AlertTitle>
84
+ <AlertDescription>Record not found</AlertDescription>
85
+ </Alert>
86
+ </div>
87
+ );
88
+ }
89
+
90
+ return (
91
+ <main className="max-w-4xl mx-auto px-4 sm:px-6 lg:px-8 py-12" aria-label="Record details">
92
+ <DetailHeader title={recordTitle} onBack={handleBack} />
93
+ <Card>
94
+ <CardHeader>
95
+ <CardTitle className="text-2xl">{recordTitle}</CardTitle>
96
+ </CardHeader>
97
+ <CardContent>
98
+ <UiApiDetailForm
99
+ objectApiName={objectApiName}
100
+ recordId={recordId!}
101
+ layout={layout}
102
+ record={record}
103
+ objectMetadata={objectMetadata}
104
+ />
105
+ </CardContent>
106
+ </Card>
107
+ </main>
108
+ );
109
+ }