@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
package/LICENSE.txt ADDED
@@ -0,0 +1,82 @@
1
+ Terms of Use
2
+
3
+ Copyright 2026 Salesforce, Inc. All rights reserved.
4
+
5
+ These Terms of Use govern the download, installation, and/or use of this
6
+ software provided by Salesforce, Inc. ("Salesforce") (the "Software"), were
7
+ last updated on April 15, 2025, and constitute a legally binding
8
+ agreement between you and Salesforce. If you do not agree to these Terms of
9
+ Use, do not install or use the Software.
10
+
11
+ Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free
12
+ copyright license to reproduce, prepare derivative works of, publicly
13
+ display, publicly perform, sublicense, and distribute the Software and
14
+ derivative works subject to these Terms. These Terms shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ Subject to the limited rights expressly granted hereunder, Salesforce
18
+ reserves all rights, title, and interest in and to all intellectual
19
+ property subsisting in the Software. No rights are granted to you hereunder
20
+ other than as expressly set forth herein. Users residing in countries on
21
+ the United States Office of Foreign Assets Control sanction list, or which
22
+ are otherwise subject to a US export embargo, may not use the Software.
23
+
24
+ Implementation of the Software may require development work, for which you
25
+ are responsible. The Software may contain bugs, errors and
26
+ incompatibilities and is made available on an AS IS basis without support,
27
+ updates, or service level commitments.
28
+
29
+ Salesforce reserves the right at any time to modify, suspend, or
30
+ discontinue, the Software (or any part thereof) with or without notice. You
31
+ agree that Salesforce shall not be liable to you or to any third party for
32
+ any modification, suspension, or discontinuance.
33
+
34
+ You agree to defend Salesforce against any claim, demand, suit or
35
+ proceeding made or brought against Salesforce by a third party arising out
36
+ of or accruing from (a) your use of the Software, and (b) any application
37
+ you develop with the Software that infringes any copyright, trademark,
38
+ trade secret, trade dress, patent, or other intellectual property right of
39
+ any person or defames any person or violates their rights of publicity or
40
+ privacy (each a "Claim Against Salesforce"), and will indemnify Salesforce
41
+ from any damages, attorney fees, and costs finally awarded against
42
+ Salesforce as a result of, or for any amounts paid by Salesforce under a
43
+ settlement approved by you in writing of, a Claim Against Salesforce,
44
+ provided Salesforce (x) promptly gives you written notice of the Claim
45
+ Against Salesforce, (y) gives you sole control of the defense and
46
+ settlement of the Claim Against Salesforce (except that you may not settle
47
+ any Claim Against Salesforce unless it unconditionally releases Salesforce
48
+ of all liability), and (z) gives you all reasonable assistance, at your
49
+ expense.
50
+
51
+ WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT
52
+ SUPPORTED AND IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES,
54
+ INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
55
+ PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA,
56
+ OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN
57
+ CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU
58
+ HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
59
+
60
+ These Terms of Use shall be governed exclusively by the internal laws of
61
+ the State of California, without regard to its conflicts of laws
62
+ rules. Each party hereby consents to the exclusive jurisdiction of the
63
+ state and federal courts located in San Francisco County, California to
64
+ adjudicate any dispute arising out of or relating to these Terms of Use and
65
+ the download, installation, and/or use of the Software. Except as expressly
66
+ stated herein, these Terms of Use constitute the entire agreement between
67
+ the parties, and supersede all prior and contemporaneous agreements,
68
+ proposals, or representations, written or oral, concerning their subject
69
+ matter. No modification, amendment, or waiver of any provision of these
70
+ Terms of Use shall be effective unless it is by an update to these Terms of
71
+ Use that Salesforce makes available, or is in writing and signed by the
72
+ party against whom the modification, amendment, or waiver is to be
73
+ asserted.
74
+
75
+ Data Privacy: Salesforce may collect, process, and store device,
76
+ system, and other information related to your use of the Software. This
77
+ information includes, but is not limited to, IP address, user metrics, and
78
+ other data ("Usage Data"). Salesforce may use Usage Data for analytics,
79
+ product development, and marketing purposes. You acknowledge that files
80
+ generated in conjunction with the Software may contain sensitive or
81
+ confidential data, and you are solely responsible for anonymizing and
82
+ protecting such data.
package/README.md ADDED
@@ -0,0 +1,250 @@
1
+ # Feature: React Global Search (Single Object)
2
+
3
+ This package is a **reference implementation** for adding global search (keyword search, filters, results list, and record detail) to a Salesforce UI Bundle. It provides **API services, hooks, types/schemas, and utilities** so you can **build your own UI** and import the data layer from the package—or optionally **copy** the reference UI from the package and adapt it.
4
+
5
+ **Intended use (vibing model):**
6
+
7
+ - **Do not copy the feature source** (api, hooks, types, utils).
8
+ - **Build your own UI** (recommended), or **copy** the reference pages/components from the package and adapt.
9
+ - **Import** data-layer pieces from the package: services, hooks, types, utilities.
10
+
11
+ UI components and feature constants are deliberately **not exported** from the public API.
12
+
13
+ ---
14
+
15
+ ## What you get (public API)
16
+
17
+ Import from the package root:
18
+
19
+ ```ts
20
+ import {
21
+ objectInfoService,
22
+ objectDetailService,
23
+ useObjectListMetadata,
24
+ useRecordListGraphQL,
25
+ useRecordDetailLayout,
26
+ useObjectColumns,
27
+ useObjectFilters,
28
+ useObjectInfoBatch,
29
+ type FilterCriteria,
30
+ parseFilterValue,
31
+ sanitizeFilterValue,
32
+ } from "@salesforce/ui-bundle-template-feature-react-global-search";
33
+ ```
34
+
35
+ ### API services
36
+
37
+ - **`objectInfoService`**
38
+ - `getObjectInfoBatch(objectApiNames)` (GraphQL uiapi.objectInfos)
39
+ - `getPicklistValues(objectApiName, fieldName, recordTypeId?)` (GraphQL uiapi.objectInfos)
40
+ - `getObjectListFilters(objectApiName)` (REST search-info filters)
41
+ - **`objectDetailService`**
42
+ - `getLayout(objectApiName, recordTypeId?)` (REST layout)
43
+ - `getRecordDetail(objectApiName, recordId, recordTypeId?)` (layout + object info + record)
44
+ - **GraphQL record helpers**
45
+ - `getRecordsGraphQL(...)` (list query, `first + after`)
46
+ - `getRecordByIdGraphQL(...)` (single record by Id)
47
+ - `buildWhereFromCriteria(...)`, `buildOrderByFromSort(...)`, `buildGetRecordsQuery(...)`
48
+
49
+ ### Hooks
50
+
51
+ - **List metadata**: `useObjectListMetadata(objectApiName)` — filters, columns (derived from filters), picklistValues.
52
+ - **List columns (legacy)**: `useObjectColumns(objectApiName)` — columns, columnsLoading, columnsError.
53
+ - **List filters**: `useObjectFilters(objectApiName)` — filtersData (filters + picklist values per object).
54
+ - **List records**: `useRecordListGraphQL({ objectApiName, first, after, filters, sortBy, searchQuery, columns? })` — GraphQL list with cursor pagination.
55
+ - **Detail**: `useRecordDetailLayout({ objectApiName, recordId, recordTypeId?, initialData? })` — layout (REST) + object metadata + record (GraphQL).
56
+ - **Batch object info**: `useObjectInfoBatch(objectApiNames)` — objectInfos, loading, error.
57
+
58
+ ### Types, schemas, utils
59
+
60
+ - **Types**: `Filter`, `FilterCriteria`, `Column`, `SearchResultRecord`, `LayoutResponse`, `ObjectInfoResult`, …
61
+ - **Zod schemas**: `LayoutResponseSchema`, `ObjectInfoResultSchema`, `SearchResultsResponseSchema`, …
62
+ - **Utilities**: `parseFilterValue`, `sanitizeFilterValue`, `createFiltersKey`, `getGraphQLNodeValue`, `graphQLNodeToSearchResultRecordData`, `fetchAndValidate`, `safeEncodePath`, `getNestedFieldValue`, `getRecordDisplayName`, layout transform and form helpers, etc.
63
+
64
+ The definitive type surface is in `index.d.ts` in this package.
65
+
66
+ ---
67
+
68
+ ## Features
69
+
70
+ - **Single object browse & search**: keyword search and “browse all” mode (`browse__all`).
71
+ - **Filterable list**: filter definitions + picklist values, criteria → GraphQL where clause.
72
+ - **Sortable list**: build orderBy from sort selection.
73
+ - **Cursor pagination (forward-only)** with **previous-page simulation via cursor stack**.
74
+ - **Record detail**: layout-driven field selection (layout REST + record GraphQL).
75
+ - **Type safety**: Zod validation + exported TypeScript types.
76
+
77
+ ---
78
+
79
+ ## Architecture
80
+
81
+ ### Data layer (GraphQL vs REST)
82
+
83
+ - **GraphQL (uiapi)**
84
+ Object metadata via `getObjectInfoBatch` and `getPicklistValues`. Records via `getRecordsGraphQL` and `getRecordByIdGraphQL`.
85
+ - **REST (uiApiClient)**
86
+ Layout from `GET /layout/{object}`. Search filters from `GET /search-info/{object}/filters`. List/search results are **GraphQL-only** via `useRecordListGraphQL` (no REST keyword search in the public API).
87
+
88
+ In the reference implementation:
89
+
90
+ - **Detail page**: `useRecordDetailLayout` → `objectDetailService.getRecordDetail` (layout REST + record GraphQL).
91
+ - **List page**: `useObjectListMetadata` (filters + columns + picklists) + `useRecordListGraphQL` (records).
92
+
93
+ ### API flow (conceptual)
94
+
95
+ - **Initialization**: `getObjectInfoBatch` for object metadata; per object: `getObjectListFilters` (columns derived from filters), then `getPicklistValues` for picklist filters.
96
+ - **List/search**: `useRecordListGraphQL` (GraphQL UI API with cursor pagination; use a cursor stack for “Previous”).
97
+ - **Detail**: `useRecordDetailLayout` / `objectDetailService.getRecordDetail`.
98
+
99
+ All API calls use `fetchAndValidate` and validate with Zod.
100
+
101
+ ---
102
+
103
+ ## Install
104
+
105
+ ```bash
106
+ npm install @salesforce/ui-bundle-template-feature-react-global-search
107
+ ```
108
+
109
+ ### Required peer environment
110
+
111
+ - `@salesforce/ui-bundle` (API proxy, auth, etc.)
112
+ - React and React Router
113
+
114
+ If you are not using that stack, you can still reuse **pure** utilities and types; the API services and hooks need an equivalent UI API transport.
115
+
116
+ ---
117
+
118
+ ## Configuration (constants)
119
+
120
+ Constants are **not exported**. When you build your app (or copy reference UI), define them in the app:
121
+
122
+ - **OBJECT_API_NAMES** – Array of object API names to search. First element is the primary object (e.g. `OBJECT_API_NAMES[0]`). Default to `["Account"]` if no object is specified.
123
+ - **DEFAULT_PAGE_SIZE** – e.g. `20`.
124
+ - **DEFAULT_DETAIL_PAGE_TITLE** – e.g. `"Untitled"`.
125
+
126
+ **Determining the search object:** Decide from the user’s request or app context. If the user does not specify an object, use **Account**. If your repo provides a script (e.g. `scripts/parse-feature-install-context.cjs`), you can use it to parse the user prompt and get an object API name or label hint; otherwise set OBJECT_API_NAMES in the app’s constants accordingly.
127
+
128
+ ---
129
+
130
+ ## Vibing integration (recommended: build your own UI)
131
+
132
+ 1. **Routes**
133
+ Search results: e.g. `/global-search/:query` (use `browse__all` for “show all”). Record detail: e.g. `/object/:objectApiName/:recordId`.
134
+
135
+ 2. **Search entry**
136
+ On submit, navigate to `/global-search/${encodeURIComponent(query)}` or `/global-search/browse__all`.
137
+
138
+ 3. **Results page (list)**
139
+ Use `useObjectListMetadata(objectApiName)` for filters/columns/picklists and `useRecordListGraphQL({ objectApiName, first, after, filters, sortBy, searchQuery, columns })` for records. Implement a **cursor stack** for “Previous” (see reference `GlobalSearch` page).
140
+
141
+ 4. **Detail page**
142
+ Use `useRecordDetailLayout({ objectApiName, recordId })` for `layout`, `record`, `objectMetadata`; render with `layoutTransformUtils` and `graphQLNodeFieldUtils` (or equivalent).
143
+
144
+ 5. **Search input placement**
145
+ Put the search entry on the **Home page** (e.g. as a card) or in the app **Header**—**not** in a root layout that wraps every page.
146
+
147
+ ---
148
+
149
+ ## Optional: copy reference UI from the package
150
+
151
+ The package **does not export** UI components. If you prefer to copy the reference UI instead of building your own:
152
+
153
+ - **What to import (do not copy):** API (`objectInfoService`, `objectDetailService`, …), hooks (`useObjectListMetadata`, `useRecordListGraphQL`, `useRecordDetailLayout`, …), types, Zod schemas, utilities.
154
+ - **What to copy into the app:** A single **constants** file (set `OBJECT_API_NAMES` to your chosen object(s)) and the **pages** and **components** from the package’s reference implementation.
155
+
156
+ **Path convention (reference implementation in this repo):**
157
+
158
+ All paths below are relative to the **package root** of this feature. The reference implementation lives under:
159
+
160
+ `src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/`
161
+
162
+ Example paths:
163
+
164
+ - Constants: `src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/constants.ts`
165
+ - Search page: `src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/pages/GlobalSearch.tsx`
166
+ - Components: `src/force-app/main/default/uiBundles/feature-react-global-search/src/features/global-search/components/`
167
+
168
+ After copying **pages/** and **components/** into your app:
169
+
170
+ 1. In the **copied files only**, replace imports from `@/api`, `@/hooks`, `@/types`, `@/utils`, `@/lib`, `@/features` with imports from **`@salesforce/ui-bundle-template-feature-react-global-search`**.
171
+ 2. Keep constants and component-to-component imports pointing at your app’s copied constants and components.
172
+ 3. Adapt markup and styles to your app’s UI library (the reference uses shadcn and Tailwind).
173
+
174
+ ---
175
+
176
+ ## Example: build filters → FilterCriteria[]
177
+
178
+ ```ts
179
+ import {
180
+ parseFilterValue,
181
+ sanitizeFilterValue,
182
+ type FilterCriteria,
183
+ } from "@salesforce/ui-bundle-template-feature-react-global-search";
184
+
185
+ function toCriteria(
186
+ objectApiName: string,
187
+ fieldPath: string,
188
+ operator: "eq" | "like",
189
+ rawValues: string[],
190
+ ): FilterCriteria {
191
+ return {
192
+ objectApiName,
193
+ fieldPath,
194
+ operator,
195
+ values: rawValues
196
+ .map((v) => sanitizeFilterValue(v))
197
+ .filter(Boolean)
198
+ .map((v) => parseFilterValue(v)),
199
+ };
200
+ }
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Implementation steps (for an agent)
206
+
207
+ 1. **Install**
208
+ From the consumer app root: `npm install @salesforce/ui-bundle-template-feature-react-global-search`.
209
+
210
+ 2. **Determine search object(s)**
211
+ From user prompt or app context. Default to **Account** if none specified. Set `OBJECT_API_NAMES` in the app’s constants to this value.
212
+
213
+ 3. **Constants**
214
+ In the app, create a constants file (or copy from the package reference path above) and set `OBJECT_API_NAMES`, `DEFAULT_PAGE_SIZE`, `DEFAULT_DETAIL_PAGE_TITLE`.
215
+
216
+ 4. **API / types / utils / hooks**
217
+ **Import** only from the package. Do **not** create or copy `api/`, `hooks/`, `types/`, or `utils/` in the app.
218
+
219
+ 5. **UI**
220
+ Either **(a)** build your own UI using the package’s hooks and types, or **(b)** copy the full **pages/** and **components/** from the package reference path into the app, then batch-replace imports in the copied files to use the package (see “Optional: copy reference UI” above).
221
+
222
+ 6. **Routes and search input**
223
+ Add routes for search (e.g. `/global-search/:query`) and record detail (e.g. `/object/:objectApiName/:recordId`). Place the search input on the **Home page** or in the **Header** only—not in a root layout.
224
+
225
+ ### Checklist
226
+
227
+ - [ ] Package installed.
228
+ - [ ] Search object(s) determined; `OBJECT_API_NAMES` set in app constants.
229
+ - [ ] API, types, utils, hooks **imported** from package only (no api/hooks/types/utils folders in app).
230
+ - [ ] UI: own implementation **or** full copy of reference pages/components with imports updated to the package.
231
+ - [ ] Routes and search entry placement done; GlobalSearchInput not in root layout.
232
+
233
+ ---
234
+
235
+ ## Notes / constraints
236
+
237
+ - **Single-object scope**: The package’s APIs and hooks are designed for one CRM object at a time (one `objectApiName` per call). There is no built-in multi-object search or tabbed results. You can still implement **multi-object CRM search** by calling the same services and hooks once per object (e.g. in parallel or per tab), then combining the results and building your own UI (tabs, merged lists, or separate sections).
238
+ - **Layout is REST**: record layout from UI API REST; record and object metadata are GraphQL-backed.
239
+ - **No UI exports**: build or copy UI in the app; import only the data layer from the package.
240
+
241
+ ---
242
+
243
+ ## Local development (this repo)
244
+
245
+ When developing this feature inside the ui-bundle repo:
246
+
247
+ ```bash
248
+ nx run @salesforce/ui-bundle-template-feature-react-global-search:build:dist-app
249
+ nx run @salesforce/ui-bundle-template-feature-react-global-search:dev
250
+ ```
@@ -0,0 +1,15 @@
1
+ # List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status
2
+ # More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm
3
+ #
4
+
5
+ package.xml
6
+
7
+ # LWC configuration files
8
+ **/jsconfig.json
9
+ **/.eslintrc.json
10
+
11
+ # LWC Jest
12
+ **/__tests__/**
13
+
14
+ node_modules/
15
+ .DS_Store
@@ -0,0 +1,4 @@
1
+ #!/bin/sh
2
+ . "$(dirname "$0")/_/husky.sh"
3
+
4
+ npm run precommit
@@ -0,0 +1,11 @@
1
+ # List files or directories below to ignore them when running prettier
2
+ # More information: https://prettier.io/docs/en/ignore.html
3
+ #
4
+
5
+ **/staticresources/**
6
+ .localdevserver
7
+ .sfdx
8
+ .sf
9
+ .vscode
10
+
11
+ coverage/
@@ -0,0 +1,17 @@
1
+ {
2
+ "trailingComma": "none",
3
+ "plugins": [
4
+ "prettier-plugin-apex",
5
+ "@prettier/plugin-xml"
6
+ ],
7
+ "overrides": [
8
+ {
9
+ "files": "**/lwc/**/*.html",
10
+ "options": { "parser": "lwc" }
11
+ },
12
+ {
13
+ "files": "*.{cmp,page,component}",
14
+ "options": { "parser": "html" }
15
+ }
16
+ ]
17
+ }
package/dist/AGENT.md ADDED
@@ -0,0 +1,193 @@
1
+ # Agent guide: Salesforce UI Bundle development
2
+
3
+ This project is a **Salesforce DX (SFDX) project** containing a **React UI Bundle**. The UI Bundle is a standalone Vite + React SPA that runs inside the Salesforce platform. Use this file when working in this project.
4
+
5
+ ## Resolving paths
6
+
7
+ Read `sfdx-project.json` at the project root. Take the first `packageDirectories[].path` value and append `/main/default` to get `<sfdx-source>`. The UI Bundle directory is:
8
+
9
+ ```
10
+ <sfdx-source>/uiBundles/<appName>/
11
+ ```
12
+
13
+ Replace `<appName>` with the actual folder name found under `uiBundles/`. The source path is **not** always `force-app` — always resolve it from `sfdx-project.json`.
14
+
15
+ ## Project layout
16
+
17
+ ```
18
+ <project-root>/
19
+ ├── sfdx-project.json
20
+ ├── package.json # SFDX root scripts
21
+ ├── scripts/
22
+ │ ├── setup-cli.mjs # One-command setup (deploy, schema, build)
23
+ │ └── graphql-search.sh # Schema entity lookup
24
+ ├── config/
25
+ │ └── project-scratch-def.json
26
+
27
+ └── <sfdx-source>/
28
+ ├── uiBundles/
29
+ │ └── <appName>/ # ← React UI Bundle (primary workspace)
30
+ │ ├── <appName>.uibundle-meta.xml
31
+ │ ├── ui-bundle.json
32
+ │ ├── index.html
33
+ │ ├── package.json
34
+ │ ├── vite.config.ts / tsconfig.json
35
+ │ ├── vitest.config.ts / playwright.config.ts
36
+ │ ├── codegen.yml / .graphqlrc.yml
37
+ │ └── src/ # All application code lives here
38
+
39
+ ├── classes/ # Apex classes (optional)
40
+ ├── objects/ # Custom objects and fields (optional)
41
+ ├── permissionsets/ # Permission sets (optional)
42
+ ├── cspTrustedSites/ # CSP trusted site definitions (optional)
43
+ ├── layouts/ # Object layouts (optional)
44
+ ├── triggers/ # Apex triggers (optional)
45
+ └── data/ # Sample data for import (optional)
46
+ ```
47
+
48
+ ## Web application source structure
49
+
50
+ All application code lives inside the UI Bundle's `src/` directory:
51
+
52
+ ```
53
+ src/
54
+ ├── app.tsx # Entry point — creates the browser router
55
+ ├── appLayout.tsx # Shell layout (header, navigation, Outlet, footer)
56
+ ├── routes.tsx # Single route registry for the entire app
57
+ ├── navigationMenu.tsx # Navigation component
58
+ ├── router-utils.tsx # Router helpers
59
+ ├── lib/utils.ts # Utility functions (cn, etc.)
60
+ ├── styles/global.css # Tailwind global styles
61
+ ├── api/ # GraphQL operations, clients, data services
62
+ ├── assets/ # Static SVGs, images
63
+ ├── components/
64
+ │ ├── ui/ # Shared primitives (shadcn-style: button, card, input, etc.)
65
+ │ ├── layout/ # Layout components (header, footer, sidebar)
66
+ │ └── <feature>/ # Feature-specific components
67
+ ├── features/ # Feature modules (auth, search, etc.)
68
+ ├── hooks/ # Custom React hooks
69
+ ├── pages/ # Page components (one per route)
70
+ ├── public/ # Static assets served as-is
71
+ └── utils/ # Shared utilities
72
+ ```
73
+
74
+ ### Key files
75
+
76
+ | File | Role |
77
+ |------|------|
78
+ | `app.tsx` | Creates `BrowserRouter`; do not add UI here |
79
+ | `appLayout.tsx` | Source of truth for navigation, header, footer, and page shell |
80
+ | `routes.tsx` | Single route registry; all pages are children of the layout route |
81
+ | `<appName>.uibundle-meta.xml` | Salesforce deploy descriptor (`masterLabel`, `version`, `isActive`) |
82
+ | `ui-bundle.json` | Runtime config (`outputDir`, routing) |
83
+
84
+ ## Two package.json contexts
85
+
86
+ ### 1. Project root
87
+
88
+ Used for SFDX metadata tooling. Scripts here target LWC/Aura, not the React app.
89
+
90
+ | Command | Purpose |
91
+ |---------|---------|
92
+ | `npm run test` | LWC Jest (passWithNoTests) |
93
+ | `npm run prettier` | Format metadata files |
94
+ | `npm run prettier:verify` | Check Prettier |
95
+
96
+ **One-command setup:** `node scripts/setup-cli.mjs --target-org <alias>` runs login, deploy, permset assignment, data import, GraphQL schema/codegen, UI Bundle build, and optionally the dev server. Use `--help` for all flags.
97
+
98
+ ### 2. Web app directory (primary workspace)
99
+
100
+ **Always `cd` into the UI Bundle directory for dev/build/lint/test:**
101
+
102
+ | Command | Purpose |
103
+ |---------|---------|
104
+ | `npm run dev` | Start Vite dev server |
105
+ | `npm run build` | TypeScript check + Vite production build |
106
+ | `npm run lint` | ESLint for the React app |
107
+ | `npm run test` | Vitest unit tests |
108
+ | `npm run preview` | Preview production build |
109
+ | `npm run graphql:codegen` | Generate GraphQL types from schema |
110
+ | `npm run graphql:schema` | Fetch GraphQL schema from org |
111
+
112
+ **Before completing any change:** run `npm run build` and `npm run lint` from the UI Bundle directory. Both must pass with zero errors.
113
+
114
+ ## Development conventions
115
+
116
+ ### UI
117
+
118
+ - **Component library:** shadcn/ui primitives in `src/components/ui/`. Always use these over raw HTML equivalents.
119
+ - **Styling:** Tailwind CSS only. No inline `style={{}}`. Use `cn()` from `@/lib/utils` for conditional classes.
120
+ - **Icons:** Lucide React.
121
+ - **Path alias:** `@/*` maps to `src/*`. Use it for all imports.
122
+ - **TypeScript:** No `any`. Use proper types, generics, or `unknown`.
123
+ - **Components:** Accept `className?: string` prop. Extract shared state to custom hooks in `src/hooks/`.
124
+ - **React apps must not** import Salesforce platform modules (`lightning/*`, `@wire`, LWC APIs).
125
+
126
+ ### Routing
127
+
128
+ - React Router with `createBrowserRouter`. Route definitions live exclusively in `routes.tsx`.
129
+ - All page routes are children of the layout route (which renders `appLayout.tsx`).
130
+ - Default-export one component per page file.
131
+ - The catch-all `path: '*'` route must always be last.
132
+ - Navigation uses absolute paths (`/dashboard`). Non-router imports use dot-relative paths (`./utils`).
133
+ - Navigation visibility is driven by `handle.showInNavigation` on route definitions.
134
+
135
+ ### Layout and navigation
136
+
137
+ - `appLayout.tsx` owns the header, navigation menu, footer, and `<Outlet />`.
138
+ - To modify header or footer, edit `appLayout.tsx` and create components in `src/components/layout/`.
139
+ - To add a page, add a route in `routes.tsx` and create the page component — do not modify `appLayout.tsx` or `app.tsx` for page additions.
140
+
141
+ ### Data access (Salesforce)
142
+
143
+ - **All data access uses the Data SDK** (`@salesforce/sdk-data`) via `createDataSDK()`.
144
+ - **Never** use `fetch()` or `axios` directly for Salesforce data.
145
+ - **GraphQL is preferred** for record operations (`sdk.graphql`). Use `sdk.fetch` only when GraphQL cannot cover the case (UI API REST, Apex REST, Connect REST, Einstein LLM).
146
+ - Use optional chaining: `sdk.graphql?.()`, `sdk.fetch?.()`.
147
+ - Apply the `@optional` directive to all record fields for field-level security resilience.
148
+ - Verify field and object names via `scripts/graphql-search.sh` before writing queries.
149
+ - Use `__SF_API_VERSION__` global for API version in REST calls.
150
+ - **Blocked APIs:** Enterprise REST query endpoint (`/query` with SOQL), `@AuraEnabled` Apex, Chatter API.
151
+
152
+ ### CSP trusted sites
153
+
154
+ Any external domain the app calls (APIs, CDNs, fonts) must have a `.cspTrustedSite-meta.xml` file under `<sfdx-source>/cspTrustedSites/`. Unregistered domains are blocked at runtime. Each subdomain needs its own entry. URLs must be HTTPS with no trailing slash, no path, and no wildcards.
155
+
156
+ ## Deploying
157
+
158
+ **Deployment order matters.** Metadata (objects, permission sets) must be deployed before fetching the GraphQL schema. After any metadata deployment that changes objects, fields, or permissions, re-run schema fetch and codegen.
159
+
160
+ **Recommended sequence:**
161
+
162
+ 1. Authenticate to the target org
163
+ 2. Build the UI Bundle (`npm run build` in the UI Bundle directory)
164
+ 3. Deploy metadata (`sf project deploy start --source-dir <packageDir> --target-org <alias>`)
165
+ 4. Assign permission sets
166
+ 5. Import data (only with user confirmation)
167
+ 6. Fetch GraphQL schema + run codegen (`npm run graphql:schema && npm run graphql:codegen`)
168
+ 7. Rebuild the UI Bundle (schema changes may affect generated types)
169
+
170
+ **Or use the one-command setup:** `node scripts/setup-cli.mjs --target-org <alias>`
171
+
172
+ ```bash
173
+ # Deploy UI Bundle only
174
+ sf project deploy start --source-dir <sfdx-source>/ui-bundles --target-org <alias>
175
+
176
+ # Deploy all metadata
177
+ sf project deploy start --source-dir <packageDir> --target-org <alias>
178
+ ```
179
+
180
+ ## Skills
181
+
182
+ Check for available skills before implementing any of the following:
183
+
184
+ | Area | When to consult |
185
+ |------|----------------|
186
+ | UI generation | Building pages, components, modifying header/footer/layout |
187
+ | Salesforce data access | Reading/writing records, GraphQL queries, REST calls |
188
+ | Metadata and deployment | Scaffolding apps, configuring CSP, deployment sequencing |
189
+ | Feature installation | Before building something from scratch — check if a pre-built feature exists |
190
+ | File upload | Adding file upload with Salesforce ContentVersion |
191
+ | Agentforce conversation | Adding or modifying the Agentforce chat widget |
192
+
193
+ Skills are the authoritative source for detailed patterns, constraints, and code examples in each area. This file provides project-level orientation; skills provide implementation depth.