@aglyn/plugins-crm 1.0.0-beta.143

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 (669) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +7 -0
  3. package/package.json +57 -0
  4. package/src/index.d.ts +21 -0
  5. package/src/index.js +29 -0
  6. package/src/index.js.map +1 -0
  7. package/src/lib/components/activity-list.d.ts +98 -0
  8. package/src/lib/components/activity-list.js +321 -0
  9. package/src/lib/components/activity-list.js.map +1 -0
  10. package/src/lib/components/activity-queries.d.ts +117 -0
  11. package/src/lib/components/activity-queries.js +198 -0
  12. package/src/lib/components/activity-queries.js.map +1 -0
  13. package/src/lib/components/add-to-list-button.d.ts +25 -0
  14. package/src/lib/components/add-to-list-button.js +64 -0
  15. package/src/lib/components/add-to-list-button.js.map +1 -0
  16. package/src/lib/components/add-to-list-dialog.d.ts +24 -0
  17. package/src/lib/components/add-to-list-dialog.js +327 -0
  18. package/src/lib/components/add-to-list-dialog.js.map +1 -0
  19. package/src/lib/components/assignment-rule-drawer.d.ts +43 -0
  20. package/src/lib/components/assignment-rule-drawer.js +293 -0
  21. package/src/lib/components/assignment-rule-drawer.js.map +1 -0
  22. package/src/lib/components/companies-bulk-bar.d.ts +29 -0
  23. package/src/lib/components/companies-bulk-bar.js +274 -0
  24. package/src/lib/components/companies-bulk-bar.js.map +1 -0
  25. package/src/lib/components/companies-section.d.ts +54 -0
  26. package/src/lib/components/companies-section.js +522 -0
  27. package/src/lib/components/companies-section.js.map +1 -0
  28. package/src/lib/components/company-contacts-card.d.ts +49 -0
  29. package/src/lib/components/company-contacts-card.js +435 -0
  30. package/src/lib/components/company-contacts-card.js.map +1 -0
  31. package/src/lib/components/company-deals-card.d.ts +20 -0
  32. package/src/lib/components/company-deals-card.js +38 -0
  33. package/src/lib/components/company-deals-card.js.map +1 -0
  34. package/src/lib/components/company-detail-page.d.ts +20 -0
  35. package/src/lib/components/company-detail-page.js +165 -0
  36. package/src/lib/components/company-detail-page.js.map +1 -0
  37. package/src/lib/components/company-edit-drawer.d.ts +65 -0
  38. package/src/lib/components/company-edit-drawer.js +433 -0
  39. package/src/lib/components/company-edit-drawer.js.map +1 -0
  40. package/src/lib/components/company-import-drawer.d.ts +42 -0
  41. package/src/lib/components/company-import-drawer.js +99 -0
  42. package/src/lib/components/company-import-drawer.js.map +1 -0
  43. package/src/lib/components/company-picker.d.ts +127 -0
  44. package/src/lib/components/company-picker.js +323 -0
  45. package/src/lib/components/company-picker.js.map +1 -0
  46. package/src/lib/components/company-properties-card.d.ts +47 -0
  47. package/src/lib/components/company-properties-card.js +289 -0
  48. package/src/lib/components/company-properties-card.js.map +1 -0
  49. package/src/lib/components/contact-address-fields.d.ts +29 -0
  50. package/src/lib/components/contact-address-fields.js +149 -0
  51. package/src/lib/components/contact-address-fields.js.map +1 -0
  52. package/src/lib/components/contact-associations-card.d.ts +72 -0
  53. package/src/lib/components/contact-associations-card.js +296 -0
  54. package/src/lib/components/contact-associations-card.js.map +1 -0
  55. package/src/lib/components/contact-custom-columns.d.ts +38 -0
  56. package/src/lib/components/contact-custom-columns.js +102 -0
  57. package/src/lib/components/contact-custom-columns.js.map +1 -0
  58. package/src/lib/components/contact-custom-fields-card.d.ts +39 -0
  59. package/src/lib/components/contact-custom-fields-card.js +204 -0
  60. package/src/lib/components/contact-custom-fields-card.js.map +1 -0
  61. package/src/lib/components/contact-deals-card.d.ts +20 -0
  62. package/src/lib/components/contact-deals-card.js +38 -0
  63. package/src/lib/components/contact-deals-card.js.map +1 -0
  64. package/src/lib/components/contact-detail-page.d.ts +46 -0
  65. package/src/lib/components/contact-detail-page.js +535 -0
  66. package/src/lib/components/contact-detail-page.js.map +1 -0
  67. package/src/lib/components/contact-duplicates-card.d.ts +42 -0
  68. package/src/lib/components/contact-duplicates-card.js +167 -0
  69. package/src/lib/components/contact-duplicates-card.js.map +1 -0
  70. package/src/lib/components/contact-field-drawer.d.ts +64 -0
  71. package/src/lib/components/contact-field-drawer.js +251 -0
  72. package/src/lib/components/contact-field-drawer.js.map +1 -0
  73. package/src/lib/components/contact-import-drawer.d.ts +46 -0
  74. package/src/lib/components/contact-import-drawer.js +149 -0
  75. package/src/lib/components/contact-import-drawer.js.map +1 -0
  76. package/src/lib/components/contact-known-by-card.d.ts +39 -0
  77. package/src/lib/components/contact-known-by-card.js +142 -0
  78. package/src/lib/components/contact-known-by-card.js.map +1 -0
  79. package/src/lib/components/contact-list-columns.d.ts +53 -0
  80. package/src/lib/components/contact-list-columns.js +288 -0
  81. package/src/lib/components/contact-list-columns.js.map +1 -0
  82. package/src/lib/components/contact-merge-dialog.d.ts +79 -0
  83. package/src/lib/components/contact-merge-dialog.js +405 -0
  84. package/src/lib/components/contact-merge-dialog.js.map +1 -0
  85. package/src/lib/components/contact-properties-card.d.ts +89 -0
  86. package/src/lib/components/contact-properties-card.js +492 -0
  87. package/src/lib/components/contact-properties-card.js.map +1 -0
  88. package/src/lib/components/contact-timeline-card.d.ts +68 -0
  89. package/src/lib/components/contact-timeline-card.js +435 -0
  90. package/src/lib/components/contact-timeline-card.js.map +1 -0
  91. package/src/lib/components/contacts-bulk-bar.d.ts +91 -0
  92. package/src/lib/components/contacts-bulk-bar.js +493 -0
  93. package/src/lib/components/contacts-bulk-bar.js.map +1 -0
  94. package/src/lib/components/contacts-section.d.ts +26 -0
  95. package/src/lib/components/contacts-section.js +1025 -0
  96. package/src/lib/components/contacts-section.js.map +1 -0
  97. package/src/lib/components/copy-capture-address-button.d.ts +33 -0
  98. package/src/lib/components/copy-capture-address-button.js +60 -0
  99. package/src/lib/components/copy-capture-address-button.js.map +1 -0
  100. package/src/lib/components/crm-attribution-zone.d.ts +38 -0
  101. package/src/lib/components/crm-attribution-zone.js +36 -0
  102. package/src/lib/components/crm-attribution-zone.js.map +1 -0
  103. package/src/lib/components/crm-booking-zone.d.ts +61 -0
  104. package/src/lib/components/crm-booking-zone.js +50 -0
  105. package/src/lib/components/crm-booking-zone.js.map +1 -0
  106. package/src/lib/components/crm-bulk-bar-frame.d.ts +47 -0
  107. package/src/lib/components/crm-bulk-bar-frame.js +137 -0
  108. package/src/lib/components/crm-bulk-bar-frame.js.map +1 -0
  109. package/src/lib/components/crm-call-actions.d.ts +65 -0
  110. package/src/lib/components/crm-call-actions.js +110 -0
  111. package/src/lib/components/crm-call-actions.js.map +1 -0
  112. package/src/lib/components/crm-column-menu.d.ts +21 -0
  113. package/src/lib/components/crm-column-menu.js +103 -0
  114. package/src/lib/components/crm-column-menu.js.map +1 -0
  115. package/src/lib/components/crm-console-page.d.ts +19 -0
  116. package/src/lib/components/crm-console-page.js +151 -0
  117. package/src/lib/components/crm-console-page.js.map +1 -0
  118. package/src/lib/components/crm-console-sections.d.ts +52 -0
  119. package/src/lib/components/crm-console-sections.js +83 -0
  120. package/src/lib/components/crm-console-sections.js.map +1 -0
  121. package/src/lib/components/crm-custom-field-control.d.ts +26 -0
  122. package/src/lib/components/crm-custom-field-control.js +131 -0
  123. package/src/lib/components/crm-custom-field-control.js.map +1 -0
  124. package/src/lib/components/crm-email-template-tools.d.ts +69 -0
  125. package/src/lib/components/crm-email-template-tools.js +240 -0
  126. package/src/lib/components/crm-email-template-tools.js.map +1 -0
  127. package/src/lib/components/crm-export-all-button.d.ts +39 -0
  128. package/src/lib/components/crm-export-all-button.js +98 -0
  129. package/src/lib/components/crm-export-all-button.js.map +1 -0
  130. package/src/lib/components/crm-filter-bar.d.ts +53 -0
  131. package/src/lib/components/crm-filter-bar.js +294 -0
  132. package/src/lib/components/crm-filter-bar.js.map +1 -0
  133. package/src/lib/components/crm-glance-card.d.ts +54 -0
  134. package/src/lib/components/crm-glance-card.js +219 -0
  135. package/src/lib/components/crm-glance-card.js.map +1 -0
  136. package/src/lib/components/crm-next-activity-column.d.ts +35 -0
  137. package/src/lib/components/crm-next-activity-column.js +100 -0
  138. package/src/lib/components/crm-next-activity-column.js.map +1 -0
  139. package/src/lib/components/crm-record-header.d.ts +97 -0
  140. package/src/lib/components/crm-record-header.js +160 -0
  141. package/src/lib/components/crm-record-header.js.map +1 -0
  142. package/src/lib/components/crm-record-insights-zone.d.ts +50 -0
  143. package/src/lib/components/crm-record-insights-zone.js +169 -0
  144. package/src/lib/components/crm-record-insights-zone.js.map +1 -0
  145. package/src/lib/components/crm-record-picker.d.ts +42 -0
  146. package/src/lib/components/crm-record-picker.js +104 -0
  147. package/src/lib/components/crm-record-picker.js.map +1 -0
  148. package/src/lib/components/crm-send-email-button.d.ts +39 -0
  149. package/src/lib/components/crm-send-email-button.js +81 -0
  150. package/src/lib/components/crm-send-email-button.js.map +1 -0
  151. package/src/lib/components/crm-send-email-dialog.d.ts +61 -0
  152. package/src/lib/components/crm-send-email-dialog.js +851 -0
  153. package/src/lib/components/crm-send-email-dialog.js.map +1 -0
  154. package/src/lib/components/crm-site-picker.d.ts +61 -0
  155. package/src/lib/components/crm-site-picker.js +99 -0
  156. package/src/lib/components/crm-site-picker.js.map +1 -0
  157. package/src/lib/components/crm-suite-lock.d.ts +29 -0
  158. package/src/lib/components/crm-suite-lock.js +114 -0
  159. package/src/lib/components/crm-suite-lock.js.map +1 -0
  160. package/src/lib/components/crm-tasks-due-card.d.ts +42 -0
  161. package/src/lib/components/crm-tasks-due-card.js +225 -0
  162. package/src/lib/components/crm-tasks-due-card.js.map +1 -0
  163. package/src/lib/components/crm-views-control.d.ts +65 -0
  164. package/src/lib/components/crm-views-control.js +518 -0
  165. package/src/lib/components/crm-views-control.js.map +1 -0
  166. package/src/lib/components/csv-import-drawer.d.ts +132 -0
  167. package/src/lib/components/csv-import-drawer.js +746 -0
  168. package/src/lib/components/csv-import-drawer.js.map +1 -0
  169. package/src/lib/components/deal-board.d.ts +70 -0
  170. package/src/lib/components/deal-board.js +478 -0
  171. package/src/lib/components/deal-board.js.map +1 -0
  172. package/src/lib/components/deal-detail-page.d.ts +18 -0
  173. package/src/lib/components/deal-detail-page.js +323 -0
  174. package/src/lib/components/deal-detail-page.js.map +1 -0
  175. package/src/lib/components/deal-edit-drawer.d.ts +59 -0
  176. package/src/lib/components/deal-edit-drawer.js +640 -0
  177. package/src/lib/components/deal-edit-drawer.js.map +1 -0
  178. package/src/lib/components/deal-import-drawer.d.ts +24 -0
  179. package/src/lib/components/deal-import-drawer.js +83 -0
  180. package/src/lib/components/deal-import-drawer.js.map +1 -0
  181. package/src/lib/components/deal-products-card.d.ts +48 -0
  182. package/src/lib/components/deal-products-card.js +614 -0
  183. package/src/lib/components/deal-products-card.js.map +1 -0
  184. package/src/lib/components/deal-properties-card.d.ts +29 -0
  185. package/src/lib/components/deal-properties-card.js +144 -0
  186. package/src/lib/components/deal-properties-card.js.map +1 -0
  187. package/src/lib/components/deal-stage-card.d.ts +24 -0
  188. package/src/lib/components/deal-stage-card.js +199 -0
  189. package/src/lib/components/deal-stage-card.js.map +1 -0
  190. package/src/lib/components/deals-bulk-bar.d.ts +31 -0
  191. package/src/lib/components/deals-bulk-bar.js +340 -0
  192. package/src/lib/components/deals-bulk-bar.js.map +1 -0
  193. package/src/lib/components/deals-section.d.ts +49 -0
  194. package/src/lib/components/deals-section.js +767 -0
  195. package/src/lib/components/deals-section.js.map +1 -0
  196. package/src/lib/components/email-capture-card.d.ts +42 -0
  197. package/src/lib/components/email-capture-card.js +134 -0
  198. package/src/lib/components/email-capture-card.js.map +1 -0
  199. package/src/lib/components/email-template-drawer.d.ts +33 -0
  200. package/src/lib/components/email-template-drawer.js +209 -0
  201. package/src/lib/components/email-template-drawer.js.map +1 -0
  202. package/src/lib/components/email-templates-card.d.ts +33 -0
  203. package/src/lib/components/email-templates-card.js +370 -0
  204. package/src/lib/components/email-templates-card.js.map +1 -0
  205. package/src/lib/components/erase-person-action.d.ts +92 -0
  206. package/src/lib/components/erase-person-action.js +261 -0
  207. package/src/lib/components/erase-person-action.js.map +1 -0
  208. package/src/lib/components/fields-section.d.ts +37 -0
  209. package/src/lib/components/fields-section.js +641 -0
  210. package/src/lib/components/fields-section.js.map +1 -0
  211. package/src/lib/components/form-contact-fields-card.d.ts +46 -0
  212. package/src/lib/components/form-contact-fields-card.js +253 -0
  213. package/src/lib/components/form-contact-fields-card.js.map +1 -0
  214. package/src/lib/components/insert-link-at-caret.d.ts +28 -0
  215. package/src/lib/components/insert-link-at-caret.js +37 -0
  216. package/src/lib/components/insert-link-at-caret.js.map +1 -0
  217. package/src/lib/components/lead-convert-dialog.d.ts +32 -0
  218. package/src/lib/components/lead-convert-dialog.js +493 -0
  219. package/src/lib/components/lead-convert-dialog.js.map +1 -0
  220. package/src/lib/components/lead-detail-page.d.ts +16 -0
  221. package/src/lib/components/lead-detail-page.js +163 -0
  222. package/src/lib/components/lead-detail-page.js.map +1 -0
  223. package/src/lib/components/lead-history-card.d.ts +32 -0
  224. package/src/lib/components/lead-history-card.js +165 -0
  225. package/src/lib/components/lead-history-card.js.map +1 -0
  226. package/src/lib/components/lead-import-drawer.d.ts +24 -0
  227. package/src/lib/components/lead-import-drawer.js +95 -0
  228. package/src/lib/components/lead-import-drawer.js.map +1 -0
  229. package/src/lib/components/lead-owner-select.d.ts +35 -0
  230. package/src/lib/components/lead-owner-select.js +91 -0
  231. package/src/lib/components/lead-owner-select.js.map +1 -0
  232. package/src/lib/components/lead-properties-card.d.ts +61 -0
  233. package/src/lib/components/lead-properties-card.js +395 -0
  234. package/src/lib/components/lead-properties-card.js.map +1 -0
  235. package/src/lib/components/lead-status-chip.d.ts +12 -0
  236. package/src/lib/components/lead-status-chip.js +43 -0
  237. package/src/lib/components/lead-status-chip.js.map +1 -0
  238. package/src/lib/components/lead-surfaces-note.d.ts +126 -0
  239. package/src/lib/components/lead-surfaces-note.js +262 -0
  240. package/src/lib/components/lead-surfaces-note.js.map +1 -0
  241. package/src/lib/components/lead-unqualify-dialog.d.ts +24 -0
  242. package/src/lib/components/lead-unqualify-dialog.js +125 -0
  243. package/src/lib/components/lead-unqualify-dialog.js.map +1 -0
  244. package/src/lib/components/leads-bulk-bar.d.ts +58 -0
  245. package/src/lib/components/leads-bulk-bar.js +307 -0
  246. package/src/lib/components/leads-bulk-bar.js.map +1 -0
  247. package/src/lib/components/leads-section.d.ts +23 -0
  248. package/src/lib/components/leads-section.js +664 -0
  249. package/src/lib/components/leads-section.js.map +1 -0
  250. package/src/lib/components/linked-deals-card.d.ts +32 -0
  251. package/src/lib/components/linked-deals-card.js +163 -0
  252. package/src/lib/components/linked-deals-card.js.map +1 -0
  253. package/src/lib/components/log-activity-dialog.d.ts +60 -0
  254. package/src/lib/components/log-activity-dialog.js +368 -0
  255. package/src/lib/components/log-activity-dialog.js.map +1 -0
  256. package/src/lib/components/lost-reason-dialog.d.ts +26 -0
  257. package/src/lib/components/lost-reason-dialog.js +95 -0
  258. package/src/lib/components/lost-reason-dialog.js.map +1 -0
  259. package/src/lib/components/new-contact-drawer.d.ts +78 -0
  260. package/src/lib/components/new-contact-drawer.js +343 -0
  261. package/src/lib/components/new-contact-drawer.js.map +1 -0
  262. package/src/lib/components/org-lead-surfaces-note.d.ts +57 -0
  263. package/src/lib/components/org-lead-surfaces-note.js +172 -0
  264. package/src/lib/components/org-lead-surfaces-note.js.map +1 -0
  265. package/src/lib/components/owner-avatar.d.ts +18 -0
  266. package/src/lib/components/owner-avatar.js +61 -0
  267. package/src/lib/components/owner-avatar.js.map +1 -0
  268. package/src/lib/components/pipeline-stages-dialog.d.ts +43 -0
  269. package/src/lib/components/pipeline-stages-dialog.js +339 -0
  270. package/src/lib/components/pipeline-stages-dialog.js.map +1 -0
  271. package/src/lib/components/pipelines-dialog.d.ts +55 -0
  272. package/src/lib/components/pipelines-dialog.js +517 -0
  273. package/src/lib/components/pipelines-dialog.js.map +1 -0
  274. package/src/lib/components/recent-activity-feed.d.ts +39 -0
  275. package/src/lib/components/recent-activity-feed.js +103 -0
  276. package/src/lib/components/recent-activity-feed.js.map +1 -0
  277. package/src/lib/components/recipes-card.d.ts +39 -0
  278. package/src/lib/components/recipes-card.js +485 -0
  279. package/src/lib/components/recipes-card.js.map +1 -0
  280. package/src/lib/components/record-activity-card.d.ts +26 -0
  281. package/src/lib/components/record-activity-card.js +121 -0
  282. package/src/lib/components/record-activity-card.js.map +1 -0
  283. package/src/lib/components/record-files-card.d.ts +67 -0
  284. package/src/lib/components/record-files-card.js +290 -0
  285. package/src/lib/components/record-files-card.js.map +1 -0
  286. package/src/lib/components/record-tasks-card.d.ts +32 -0
  287. package/src/lib/components/record-tasks-card.js +306 -0
  288. package/src/lib/components/record-tasks-card.js.map +1 -0
  289. package/src/lib/components/reports/activity-card.d.ts +57 -0
  290. package/src/lib/components/reports/activity-card.js +281 -0
  291. package/src/lib/components/reports/activity-card.js.map +1 -0
  292. package/src/lib/components/reports/closed-deals-card.d.ts +20 -0
  293. package/src/lib/components/reports/closed-deals-card.js +194 -0
  294. package/src/lib/components/reports/closed-deals-card.js.map +1 -0
  295. package/src/lib/components/reports/contacts-mix-card.d.ts +27 -0
  296. package/src/lib/components/reports/contacts-mix-card.js +161 -0
  297. package/src/lib/components/reports/contacts-mix-card.js.map +1 -0
  298. package/src/lib/components/reports/contacts-trend-card.d.ts +31 -0
  299. package/src/lib/components/reports/contacts-trend-card.js +144 -0
  300. package/src/lib/components/reports/contacts-trend-card.js.map +1 -0
  301. package/src/lib/components/reports/forecast-card.d.ts +22 -0
  302. package/src/lib/components/reports/forecast-card.js +251 -0
  303. package/src/lib/components/reports/forecast-card.js.map +1 -0
  304. package/src/lib/components/reports/lead-counts.d.ts +32 -0
  305. package/src/lib/components/reports/lead-counts.js +44 -0
  306. package/src/lib/components/reports/lead-counts.js.map +1 -0
  307. package/src/lib/components/reports/lead-funnel-card.d.ts +38 -0
  308. package/src/lib/components/reports/lead-funnel-card.js +375 -0
  309. package/src/lib/components/reports/lead-funnel-card.js.map +1 -0
  310. package/src/lib/components/reports/pipeline-card.d.ts +19 -0
  311. package/src/lib/components/reports/pipeline-card.js +338 -0
  312. package/src/lib/components/reports/pipeline-card.js.map +1 -0
  313. package/src/lib/components/reports/report-bar-chart.d.ts +39 -0
  314. package/src/lib/components/reports/report-bar-chart.js +133 -0
  315. package/src/lib/components/reports/report-bar-chart.js.map +1 -0
  316. package/src/lib/components/reports/report-breakdown.d.ts +32 -0
  317. package/src/lib/components/reports/report-breakdown.js +105 -0
  318. package/src/lib/components/reports/report-breakdown.js.map +1 -0
  319. package/src/lib/components/reports/report-export.d.ts +37 -0
  320. package/src/lib/components/reports/report-export.js +66 -0
  321. package/src/lib/components/reports/report-export.js.map +1 -0
  322. package/src/lib/components/reports/report-format.d.ts +36 -0
  323. package/src/lib/components/reports/report-format.js +43 -0
  324. package/src/lib/components/reports/report-format.js.map +1 -0
  325. package/src/lib/components/reports/report-scope.d.ts +81 -0
  326. package/src/lib/components/reports/report-scope.js +58 -0
  327. package/src/lib/components/reports/report-scope.js.map +1 -0
  328. package/src/lib/components/reports/report-stat-tile.d.ts +47 -0
  329. package/src/lib/components/reports/report-stat-tile.js +96 -0
  330. package/src/lib/components/reports/report-stat-tile.js.map +1 -0
  331. package/src/lib/components/reports/source-conversion-card.d.ts +28 -0
  332. package/src/lib/components/reports/source-conversion-card.js +205 -0
  333. package/src/lib/components/reports/source-conversion-card.js.map +1 -0
  334. package/src/lib/components/reports/tasks-card.d.ts +26 -0
  335. package/src/lib/components/reports/tasks-card.js +279 -0
  336. package/src/lib/components/reports/tasks-card.js.map +1 -0
  337. package/src/lib/components/reports/use-aggregate-read.d.ts +99 -0
  338. package/src/lib/components/reports/use-aggregate-read.js +195 -0
  339. package/src/lib/components/reports/use-aggregate-read.js.map +1 -0
  340. package/src/lib/components/reports/won-lost-by-owner-card.d.ts +30 -0
  341. package/src/lib/components/reports/won-lost-by-owner-card.js +168 -0
  342. package/src/lib/components/reports/won-lost-by-owner-card.js.map +1 -0
  343. package/src/lib/components/reports-section.d.ts +42 -0
  344. package/src/lib/components/reports-section.js +308 -0
  345. package/src/lib/components/reports-section.js.map +1 -0
  346. package/src/lib/components/sending-addresses-card.d.ts +49 -0
  347. package/src/lib/components/sending-addresses-card.js +262 -0
  348. package/src/lib/components/sending-addresses-card.js.map +1 -0
  349. package/src/lib/components/settings-section.d.ts +151 -0
  350. package/src/lib/components/settings-section.js +783 -0
  351. package/src/lib/components/settings-section.js.map +1 -0
  352. package/src/lib/components/task-cells.d.ts +51 -0
  353. package/src/lib/components/task-cells.js +139 -0
  354. package/src/lib/components/task-cells.js.map +1 -0
  355. package/src/lib/components/task-edit-drawer.d.ts +53 -0
  356. package/src/lib/components/task-edit-drawer.js +483 -0
  357. package/src/lib/components/task-edit-drawer.js.map +1 -0
  358. package/src/lib/components/task-import-drawer.d.ts +24 -0
  359. package/src/lib/components/task-import-drawer.js +82 -0
  360. package/src/lib/components/task-import-drawer.js.map +1 -0
  361. package/src/lib/components/task-snooze-menu.d.ts +65 -0
  362. package/src/lib/components/task-snooze-menu.js +207 -0
  363. package/src/lib/components/task-snooze-menu.js.map +1 -0
  364. package/src/lib/components/tasks-bulk-bar.d.ts +25 -0
  365. package/src/lib/components/tasks-bulk-bar.js +348 -0
  366. package/src/lib/components/tasks-bulk-bar.js.map +1 -0
  367. package/src/lib/components/tasks-calendar.d.ts +38 -0
  368. package/src/lib/components/tasks-calendar.js +228 -0
  369. package/src/lib/components/tasks-calendar.js.map +1 -0
  370. package/src/lib/components/tasks-section.d.ts +27 -0
  371. package/src/lib/components/tasks-section.js +579 -0
  372. package/src/lib/components/tasks-section.js.map +1 -0
  373. package/src/lib/components/use-contact-campaign-emails.d.ts +32 -0
  374. package/src/lib/components/use-contact-campaign-emails.js +83 -0
  375. package/src/lib/components/use-contact-campaign-emails.js.map +1 -0
  376. package/src/lib/components/use-crm-api.d.ts +44 -0
  377. package/src/lib/components/use-crm-api.js +84 -0
  378. package/src/lib/components/use-crm-api.js.map +1 -0
  379. package/src/lib/components/use-crm-inbound-address.d.ts +60 -0
  380. package/src/lib/components/use-crm-inbound-address.js +124 -0
  381. package/src/lib/components/use-crm-inbound-address.js.map +1 -0
  382. package/src/lib/components/use-emails-hub-path.d.ts +24 -0
  383. package/src/lib/components/use-emails-hub-path.js +59 -0
  384. package/src/lib/components/use-emails-hub-path.js.map +1 -0
  385. package/src/lib/components/use-member-email-aliases.d.ts +54 -0
  386. package/src/lib/components/use-member-email-aliases.js +186 -0
  387. package/src/lib/components/use-member-email-aliases.js.map +1 -0
  388. package/src/lib/components/use-org-members.d.ts +40 -0
  389. package/src/lib/components/use-org-members.js +100 -0
  390. package/src/lib/components/use-org-members.js.map +1 -0
  391. package/src/lib/constants/api-routes.d.ts +109 -0
  392. package/src/lib/constants/api-routes.js +74 -0
  393. package/src/lib/constants/api-routes.js.map +1 -0
  394. package/src/lib/constants/bundle-common.d.ts +14 -0
  395. package/src/lib/constants/bundle-common.js +14 -0
  396. package/src/lib/constants/bundle-common.js.map +1 -0
  397. package/src/lib/constants/company-filters.d.ts +18 -0
  398. package/src/lib/constants/company-filters.js +51 -0
  399. package/src/lib/constants/company-filters.js.map +1 -0
  400. package/src/lib/constants/contact-filters.d.ts +38 -0
  401. package/src/lib/constants/contact-filters.js +294 -0
  402. package/src/lib/constants/contact-filters.js.map +1 -0
  403. package/src/lib/hooks/use-contact-field-definitions.d.ts +48 -0
  404. package/src/lib/hooks/use-contact-field-definitions.js +72 -0
  405. package/src/lib/hooks/use-contact-field-definitions.js.map +1 -0
  406. package/src/lib/hooks/use-contact-update.d.ts +25 -0
  407. package/src/lib/hooks/use-contact-update.js +80 -0
  408. package/src/lib/hooks/use-contact-update.js.map +1 -0
  409. package/src/lib/hooks/use-crm-activity-logger.d.ts +73 -0
  410. package/src/lib/hooks/use-crm-activity-logger.js +101 -0
  411. package/src/lib/hooks/use-crm-activity-logger.js.map +1 -0
  412. package/src/lib/hooks/use-crm-bulk-apply.d.ts +52 -0
  413. package/src/lib/hooks/use-crm-bulk-apply.js +112 -0
  414. package/src/lib/hooks/use-crm-bulk-apply.js.map +1 -0
  415. package/src/lib/hooks/use-crm-default-view.d.ts +24 -0
  416. package/src/lib/hooks/use-crm-default-view.js +64 -0
  417. package/src/lib/hooks/use-crm-default-view.js.map +1 -0
  418. package/src/lib/hooks/use-crm-email-templates.d.ts +59 -0
  419. package/src/lib/hooks/use-crm-email-templates.js +103 -0
  420. package/src/lib/hooks/use-crm-email-templates.js.map +1 -0
  421. package/src/lib/hooks/use-crm-hub-path.d.ts +29 -0
  422. package/src/lib/hooks/use-crm-hub-path.js +41 -0
  423. package/src/lib/hooks/use-crm-hub-path.js.map +1 -0
  424. package/src/lib/hooks/use-crm-org-mount.d.ts +97 -0
  425. package/src/lib/hooks/use-crm-org-mount.js +215 -0
  426. package/src/lib/hooks/use-crm-org-mount.js.map +1 -0
  427. package/src/lib/hooks/use-crm-record-names.d.ts +52 -0
  428. package/src/lib/hooks/use-crm-record-names.js +126 -0
  429. package/src/lib/hooks/use-crm-record-names.js.map +1 -0
  430. package/src/lib/hooks/use-crm-records-quota.d.ts +68 -0
  431. package/src/lib/hooks/use-crm-records-quota.js +118 -0
  432. package/src/lib/hooks/use-crm-records-quota.js.map +1 -0
  433. package/src/lib/hooks/use-crm-saved-view.d.ts +96 -0
  434. package/src/lib/hooks/use-crm-saved-view.js +329 -0
  435. package/src/lib/hooks/use-crm-saved-view.js.map +1 -0
  436. package/src/lib/hooks/use-crm-scope.d.ts +117 -0
  437. package/src/lib/hooks/use-crm-scope.js +147 -0
  438. package/src/lib/hooks/use-crm-scope.js.map +1 -0
  439. package/src/lib/hooks/use-crm-tasks.d.ts +85 -0
  440. package/src/lib/hooks/use-crm-tasks.js +153 -0
  441. package/src/lib/hooks/use-crm-tasks.js.map +1 -0
  442. package/src/lib/hooks/use-crm-view-grid.d.ts +55 -0
  443. package/src/lib/hooks/use-crm-view-grid.js +170 -0
  444. package/src/lib/hooks/use-crm-view-grid.js.map +1 -0
  445. package/src/lib/hooks/use-crm-views.d.ts +42 -0
  446. package/src/lib/hooks/use-crm-views.js +84 -0
  447. package/src/lib/hooks/use-crm-views.js.map +1 -0
  448. package/src/lib/hooks/use-deal-stage-api.d.ts +69 -0
  449. package/src/lib/hooks/use-deal-stage-api.js +78 -0
  450. package/src/lib/hooks/use-deal-stage-api.js.map +1 -0
  451. package/src/lib/hooks/use-deals.d.ts +47 -0
  452. package/src/lib/hooks/use-deals.js +105 -0
  453. package/src/lib/hooks/use-deals.js.map +1 -0
  454. package/src/lib/hooks/use-org-leads.d.ts +53 -0
  455. package/src/lib/hooks/use-org-leads.js +114 -0
  456. package/src/lib/hooks/use-org-leads.js.map +1 -0
  457. package/src/lib/hooks/use-org-member-directory.d.ts +36 -0
  458. package/src/lib/hooks/use-org-member-directory.js +116 -0
  459. package/src/lib/hooks/use-org-member-directory.js.map +1 -0
  460. package/src/lib/hooks/use-org-member-options.d.ts +38 -0
  461. package/src/lib/hooks/use-org-member-options.js +131 -0
  462. package/src/lib/hooks/use-org-member-options.js.map +1 -0
  463. package/src/lib/hooks/use-pipeline.d.ts +71 -0
  464. package/src/lib/hooks/use-pipeline.js +159 -0
  465. package/src/lib/hooks/use-pipeline.js.map +1 -0
  466. package/src/lib/model/companies-bulk-writes.d.ts +40 -0
  467. package/src/lib/model/companies-bulk-writes.js +103 -0
  468. package/src/lib/model/companies-bulk-writes.js.map +1 -0
  469. package/src/lib/model/companies-csv.d.ts +36 -0
  470. package/src/lib/model/companies-csv.js +38 -0
  471. package/src/lib/model/companies-csv.js.map +1 -0
  472. package/src/lib/model/companies.d.ts +99 -0
  473. package/src/lib/model/companies.js +168 -0
  474. package/src/lib/model/companies.js.map +1 -0
  475. package/src/lib/model/company-delete-route.d.ts +43 -0
  476. package/src/lib/model/company-delete-route.js +31 -0
  477. package/src/lib/model/company-delete-route.js.map +1 -0
  478. package/src/lib/model/company-delete.d.ts +42 -0
  479. package/src/lib/model/company-delete.js +52 -0
  480. package/src/lib/model/company-delete.js.map +1 -0
  481. package/src/lib/model/contact-duplicates.d.ts +58 -0
  482. package/src/lib/model/contact-duplicates.js +67 -0
  483. package/src/lib/model/contact-duplicates.js.map +1 -0
  484. package/src/lib/model/contact-record.d.ts +113 -0
  485. package/src/lib/model/contact-record.js +70 -0
  486. package/src/lib/model/contact-record.js.map +1 -0
  487. package/src/lib/model/contact-update.d.ts +93 -0
  488. package/src/lib/model/contact-update.js +50 -0
  489. package/src/lib/model/contact-update.js.map +1 -0
  490. package/src/lib/model/contacts-bulk-writes.d.ts +173 -0
  491. package/src/lib/model/contacts-bulk-writes.js +196 -0
  492. package/src/lib/model/contacts-bulk-writes.js.map +1 -0
  493. package/src/lib/model/contacts-csv.d.ts +54 -0
  494. package/src/lib/model/contacts-csv.js +67 -0
  495. package/src/lib/model/contacts-csv.js.map +1 -0
  496. package/src/lib/model/contacts-list-seed.d.ts +51 -0
  497. package/src/lib/model/contacts-list-seed.js +63 -0
  498. package/src/lib/model/contacts-list-seed.js.map +1 -0
  499. package/src/lib/model/crm-activity-report.d.ts +27 -0
  500. package/src/lib/model/crm-activity-report.js +56 -0
  501. package/src/lib/model/crm-activity-report.js.map +1 -0
  502. package/src/lib/model/crm-api.d.ts +49 -0
  503. package/src/lib/model/crm-api.js +47 -0
  504. package/src/lib/model/crm-api.js.map +1 -0
  505. package/src/lib/model/crm-bulk-writes.d.ts +147 -0
  506. package/src/lib/model/crm-bulk-writes.js +207 -0
  507. package/src/lib/model/crm-bulk-writes.js.map +1 -0
  508. package/src/lib/model/crm-company-import.d.ts +154 -0
  509. package/src/lib/model/crm-company-import.js +331 -0
  510. package/src/lib/model/crm-company-import.js.map +1 -0
  511. package/src/lib/model/crm-custom-draft.d.ts +62 -0
  512. package/src/lib/model/crm-custom-draft.js +67 -0
  513. package/src/lib/model/crm-custom-draft.js.map +1 -0
  514. package/src/lib/model/crm-deal-import.d.ts +112 -0
  515. package/src/lib/model/crm-deal-import.js +263 -0
  516. package/src/lib/model/crm-deal-import.js.map +1 -0
  517. package/src/lib/model/crm-import.d.ts +244 -0
  518. package/src/lib/model/crm-import.js +466 -0
  519. package/src/lib/model/crm-import.js.map +1 -0
  520. package/src/lib/model/crm-lead-import.d.ts +105 -0
  521. package/src/lib/model/crm-lead-import.js +255 -0
  522. package/src/lib/model/crm-lead-import.js.map +1 -0
  523. package/src/lib/model/crm-record-routes.d.ts +21 -0
  524. package/src/lib/model/crm-record-routes.js +70 -0
  525. package/src/lib/model/crm-record-routes.js.map +1 -0
  526. package/src/lib/model/crm-routes.d.ts +101 -0
  527. package/src/lib/model/crm-routes.js +92 -0
  528. package/src/lib/model/crm-routes.js.map +1 -0
  529. package/src/lib/model/crm-task-import.d.ts +94 -0
  530. package/src/lib/model/crm-task-import.js +275 -0
  531. package/src/lib/model/crm-task-import.js.map +1 -0
  532. package/src/lib/model/crm-view-param.d.ts +43 -0
  533. package/src/lib/model/crm-view-param.js +49 -0
  534. package/src/lib/model/crm-view-param.js.map +1 -0
  535. package/src/lib/model/deal-board-model.d.ts +241 -0
  536. package/src/lib/model/deal-board-model.js +439 -0
  537. package/src/lib/model/deal-board-model.js.map +1 -0
  538. package/src/lib/model/deal-form-model.d.ts +114 -0
  539. package/src/lib/model/deal-form-model.js +218 -0
  540. package/src/lib/model/deal-form-model.js.map +1 -0
  541. package/src/lib/model/deals-csv.d.ts +32 -0
  542. package/src/lib/model/deals-csv.js +37 -0
  543. package/src/lib/model/deals-csv.js.map +1 -0
  544. package/src/lib/model/import-column-shapes.d.ts +36 -0
  545. package/src/lib/model/import-column-shapes.js +76 -0
  546. package/src/lib/model/import-column-shapes.js.map +1 -0
  547. package/src/lib/model/lead-company-suggestion.d.ts +61 -0
  548. package/src/lib/model/lead-company-suggestion.js +65 -0
  549. package/src/lib/model/lead-company-suggestion.js.map +1 -0
  550. package/src/lib/model/lead-filters.d.ts +29 -0
  551. package/src/lib/model/lead-filters.js +39 -0
  552. package/src/lib/model/lead-filters.js.map +1 -0
  553. package/src/lib/model/lead-surfaces.d.ts +58 -0
  554. package/src/lib/model/lead-surfaces.js +67 -0
  555. package/src/lib/model/lead-surfaces.js.map +1 -0
  556. package/src/lib/model/leads-csv.d.ts +40 -0
  557. package/src/lib/model/leads-csv.js +40 -0
  558. package/src/lib/model/leads-csv.js.map +1 -0
  559. package/src/lib/model/next-activity-api.d.ts +31 -0
  560. package/src/lib/model/next-activity-api.js +57 -0
  561. package/src/lib/model/next-activity-api.js.map +1 -0
  562. package/src/lib/model/next-activity.d.ts +64 -0
  563. package/src/lib/model/next-activity.js +47 -0
  564. package/src/lib/model/next-activity.js.map +1 -0
  565. package/src/lib/model/person-key-web.d.ts +43 -0
  566. package/src/lib/model/person-key-web.js +52 -0
  567. package/src/lib/model/person-key-web.js.map +1 -0
  568. package/src/lib/model/record-facts.d.ts +282 -0
  569. package/src/lib/model/record-facts.js +434 -0
  570. package/src/lib/model/record-facts.js.map +1 -0
  571. package/src/lib/model/task-api.d.ts +28 -0
  572. package/src/lib/model/task-api.js +57 -0
  573. package/src/lib/model/task-api.js.map +1 -0
  574. package/src/lib/model/task-calendar.d.ts +108 -0
  575. package/src/lib/model/task-calendar.js +139 -0
  576. package/src/lib/model/task-calendar.js.map +1 -0
  577. package/src/lib/model/task-routes.d.ts +177 -0
  578. package/src/lib/model/task-routes.js +197 -0
  579. package/src/lib/model/task-routes.js.map +1 -0
  580. package/src/lib/model/task-scope.d.ts +45 -0
  581. package/src/lib/model/task-scope.js +51 -0
  582. package/src/lib/model/task-scope.js.map +1 -0
  583. package/src/lib/model/task-views.d.ts +149 -0
  584. package/src/lib/model/task-views.js +286 -0
  585. package/src/lib/model/task-views.js.map +1 -0
  586. package/src/lib/model/tasks-csv.d.ts +28 -0
  587. package/src/lib/model/tasks-csv.js +28 -0
  588. package/src/lib/model/tasks-csv.js.map +1 -0
  589. package/src/lib/plugin.d.ts +32 -0
  590. package/src/lib/plugin.js +208 -0
  591. package/src/lib/plugin.js.map +1 -0
  592. package/src/lib/server/companies-import.d.ts +57 -0
  593. package/src/lib/server/companies-import.js +242 -0
  594. package/src/lib/server/companies-import.js.map +1 -0
  595. package/src/lib/server/company-delete.d.ts +59 -0
  596. package/src/lib/server/company-delete.js +146 -0
  597. package/src/lib/server/company-delete.js.map +1 -0
  598. package/src/lib/server/contact-email-history.d.ts +82 -0
  599. package/src/lib/server/contact-email-history.js +264 -0
  600. package/src/lib/server/contact-email-history.js.map +1 -0
  601. package/src/lib/server/contact-profile.d.ts +41 -0
  602. package/src/lib/server/contact-profile.js +45 -0
  603. package/src/lib/server/contact-profile.js.map +1 -0
  604. package/src/lib/server/contact-update.d.ts +92 -0
  605. package/src/lib/server/contact-update.js +512 -0
  606. package/src/lib/server/contact-update.js.map +1 -0
  607. package/src/lib/server/contacts-import.d.ts +73 -0
  608. package/src/lib/server/contacts-import.js +263 -0
  609. package/src/lib/server/contacts-import.js.map +1 -0
  610. package/src/lib/server/contacts-merge.d.ts +86 -0
  611. package/src/lib/server/contacts-merge.js +206 -0
  612. package/src/lib/server/contacts-merge.js.map +1 -0
  613. package/src/lib/server/deals-import.d.ts +76 -0
  614. package/src/lib/server/deals-import.js +246 -0
  615. package/src/lib/server/deals-import.js.map +1 -0
  616. package/src/lib/server/email-send.d.ts +119 -0
  617. package/src/lib/server/email-send.js +667 -0
  618. package/src/lib/server/email-send.js.map +1 -0
  619. package/src/lib/server/email-template-duplicate.d.ts +19 -0
  620. package/src/lib/server/email-template-duplicate.js +206 -0
  621. package/src/lib/server/email-template-duplicate.js.map +1 -0
  622. package/src/lib/server/erase-person.d.ts +108 -0
  623. package/src/lib/server/erase-person.js +309 -0
  624. package/src/lib/server/erase-person.js.map +1 -0
  625. package/src/lib/server/import-context.d.ts +85 -0
  626. package/src/lib/server/import-context.js +181 -0
  627. package/src/lib/server/import-context.js.map +1 -0
  628. package/src/lib/server/inbound-address.d.ts +61 -0
  629. package/src/lib/server/inbound-address.js +188 -0
  630. package/src/lib/server/inbound-address.js.map +1 -0
  631. package/src/lib/server/lead-convert.d.ts +78 -0
  632. package/src/lib/server/lead-convert.js +250 -0
  633. package/src/lib/server/lead-convert.js.map +1 -0
  634. package/src/lib/server/leads-import.d.ts +84 -0
  635. package/src/lib/server/leads-import.js +261 -0
  636. package/src/lib/server/leads-import.js.map +1 -0
  637. package/src/lib/server/next-activity-routes.d.ts +33 -0
  638. package/src/lib/server/next-activity-routes.js +110 -0
  639. package/src/lib/server/next-activity-routes.js.map +1 -0
  640. package/src/lib/server/org-activity.d.ts +61 -0
  641. package/src/lib/server/org-activity.js +120 -0
  642. package/src/lib/server/org-activity.js.map +1 -0
  643. package/src/lib/server/org-caller.d.ts +110 -0
  644. package/src/lib/server/org-caller.js +154 -0
  645. package/src/lib/server/org-caller.js.map +1 -0
  646. package/src/lib/server/recipe-routes.d.ts +75 -0
  647. package/src/lib/server/recipe-routes.js +442 -0
  648. package/src/lib/server/recipe-routes.js.map +1 -0
  649. package/src/lib/server/record-facts.d.ts +65 -0
  650. package/src/lib/server/record-facts.js +337 -0
  651. package/src/lib/server/record-facts.js.map +1 -0
  652. package/src/lib/server/record-timeline.d.ts +51 -0
  653. package/src/lib/server/record-timeline.js +215 -0
  654. package/src/lib/server/record-timeline.js.map +1 -0
  655. package/src/lib/server/suite-gate.d.ts +42 -0
  656. package/src/lib/server/suite-gate.js +87 -0
  657. package/src/lib/server/suite-gate.js.map +1 -0
  658. package/src/lib/server/task-routes.d.ts +132 -0
  659. package/src/lib/server/task-routes.js +699 -0
  660. package/src/lib/server/task-routes.js.map +1 -0
  661. package/src/lib/server/tasks-import.d.ts +54 -0
  662. package/src/lib/server/tasks-import.js +157 -0
  663. package/src/lib/server/tasks-import.js.map +1 -0
  664. package/src/lib/server-deal-stage.d.ts +88 -0
  665. package/src/lib/server-deal-stage.js +316 -0
  666. package/src/lib/server-deal-stage.js.map +1 -0
  667. package/src/lib/server.d.ts +149 -0
  668. package/src/lib/server.js +615 -0
  669. package/src/lib/server.js.map +1 -0
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ 'use client';
17
+ import { _ as _extends } from "@swc/helpers/_/_extends";
18
+ import { CRM_COLLECTIONS, CRM_EMAIL_TEMPLATES_LIMIT, crmEmailTemplateIsListed, normalizeCrmEmailTemplate, ORG_SCOPE_TOKEN } from "@aglyn/aglyn";
19
+ import { useFirestore, useFirestoreCollection } from "@aglyn/tenant-feature-instance";
20
+ import { collection, limit, orderBy, query } from "firebase/firestore";
21
+ import { useMemo } from "react";
22
+ import { crmScopeListable, crmVisibleToClause, useCrmScope } from "./use-crm-scope.js";
23
+ const ORG_TOKENS = Object.freeze([
24
+ ORG_SCOPE_TOKEN
25
+ ]);
26
+ const NO_ROWS = [];
27
+ /**
28
+ * Where an email template lives, for the surface writing or listing it
29
+ * (AGL-2658).
30
+ *
31
+ * Under a site it is the site's, as a task is: stamped with the site's
32
+ * tokens and `hostId`. From the ORGANIZATION's own hub it is the
33
+ * organization's — `hostId: null`, the org token alone — the way an
34
+ * organization task is (AGL-2637): a letter the whole workspace keeps is
35
+ * not one brand's, and the org-level reader is an org-wide member who may
36
+ * stamp it so. Every site's hub lists it beside its own, because a site's
37
+ * read tokens carry the org token.
38
+ */ export function useCrmEmailTemplateScope(props) {
39
+ const crmScope = useCrmScope(props);
40
+ return useMemo(()=>{
41
+ var _ref, _ref1;
42
+ var _crmScope_createGroup, _crmScope_consentGroup;
43
+ return crmScope.level === 'org' ? {
44
+ scope: crmScope.scope,
45
+ orgId: crmScope.orgId,
46
+ ready: crmScope.ready,
47
+ visibleTo: null,
48
+ createHostId: null,
49
+ createTokens: ORG_TOKENS,
50
+ groupId: (_ref = (_crmScope_createGroup = crmScope.createGroup) == null ? void 0 : _crmScope_createGroup.groupId) != null ? _ref : null
51
+ } : {
52
+ scope: crmScope.scope,
53
+ orgId: crmScope.orgId,
54
+ ready: crmScope.ready,
55
+ visibleTo: crmScope.visibleTo,
56
+ createHostId: crmScope.createHostId,
57
+ createTokens: crmScope.createTokens,
58
+ groupId: (_ref1 = (_crmScope_consentGroup = crmScope.consentGroup) == null ? void 0 : _crmScope_consentGroup.groupId) != null ? _ref1 : null
59
+ };
60
+ }, [
61
+ crmScope
62
+ ]);
63
+ }
64
+ /**
65
+ * The templates and snippets this member may pick from (AGL-2658): every
66
+ * shared one the reader's scope reaches, and the personal ones they own.
67
+ *
68
+ * ONE bounded listener, filtered on the reader's tokens like every CRM read
69
+ * and ordered by name — the `(visibleTo, name)` index under a site, the
70
+ * automatic single-field one at the organization level. A colleague's
71
+ * personal template is readable under the rules and hidden here by
72
+ * `crmEmailTemplateIsListed`, for the reason a private saved view is
73
+ * (AGL-2617). Rows past the window are not listed; the console's create
74
+ * stops at the window, so a workspace cannot write what its menu cannot
75
+ * show.
76
+ */ export function useCrmEmailTemplates(options) {
77
+ const { scope, visibleTo, uid } = options;
78
+ const firestore = useFirestore();
79
+ const { data, status, fromCache } = useFirestoreCollection(()=>scope && crmScopeListable(visibleTo) ? query(collection(firestore, scope[0], scope[1], CRM_COLLECTIONS.emailTemplates), ...crmVisibleToClause(visibleTo), orderBy('name'), limit(CRM_EMAIL_TEMPLATES_LIMIT)) : null, [
80
+ firestore,
81
+ scope,
82
+ visibleTo
83
+ ], {
84
+ idField: '$id'
85
+ });
86
+ const templates = useMemo(()=>{
87
+ if (!(data == null ? void 0 : data.length)) return NO_ROWS;
88
+ return data.map((row)=>_extends({
89
+ $id: String(row['$id'])
90
+ }, normalizeCrmEmailTemplate(row))).filter((template)=>template.name && crmEmailTemplateIsListed(template, uid));
91
+ }, [
92
+ data,
93
+ uid
94
+ ]);
95
+ return {
96
+ templates,
97
+ ready: Boolean(scope) && status !== 'loading',
98
+ fromCache
99
+ };
100
+ }
101
+ export default useCrmEmailTemplates;
102
+
103
+ //# sourceMappingURL=use-crm-email-templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/hooks/use-crm-email-templates.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport {\n CRM_COLLECTIONS,\n CRM_EMAIL_TEMPLATES_LIMIT,\n type CrmEmailTemplateRow,\n crmEmailTemplateIsListed,\n normalizeCrmEmailTemplate,\n ORG_SCOPE_TOKEN,\n type ScopeToken,\n} from '@aglyn/aglyn'\nimport { useFirestore, useFirestoreCollection } from '@aglyn/tenant-feature-instance'\nimport { collection, limit, orderBy, query } from 'firebase/firestore'\nimport { useMemo } from 'react'\nimport {\n type CrmOrgDoc,\n crmScopeListable,\n crmVisibleToClause,\n useCrmScope,\n} from './use-crm-scope'\n\nconst ORG_TOKENS: readonly ScopeToken[] = Object.freeze([ORG_SCOPE_TOKEN])\nconst NO_ROWS: CrmEmailTemplateRow[] = []\n\nexport interface CrmEmailTemplateScope {\n /** The org data root, or `null` until the org lookup settles or when there is none. */\n scope: readonly ['orgs', string] | null\n orgId: string | null\n ready: boolean\n /** The listener's clause under a site; `null` at the organization level. */\n visibleTo: readonly ScopeToken[] | null\n /**\n * The site a template written here is filed under, or `null` for the\n * organization's own — see {@link useCrmEmailTemplateScope}.\n */\n createHostId: string | null\n /** What a template written here is stamped with; empty while no site is known. */\n createTokens: readonly ScopeToken[]\n /** The holder group whose facet the merge fields read a contact by. */\n groupId: string | null\n}\n\n/**\n * Where an email template lives, for the surface writing or listing it\n * (AGL-2658).\n *\n * Under a site it is the site's, as a task is: stamped with the site's\n * tokens and `hostId`. From the ORGANIZATION's own hub it is the\n * organization's — `hostId: null`, the org token alone — the way an\n * organization task is (AGL-2637): a letter the whole workspace keeps is\n * not one brand's, and the org-level reader is an org-wide member who may\n * stamp it so. Every site's hub lists it beside its own, because a site's\n * read tokens carry the org token.\n */\nexport function useCrmEmailTemplateScope(props: {\n hostId: string | null | undefined\n org?: CrmOrgDoc\n}): CrmEmailTemplateScope {\n const crmScope = useCrmScope(props)\n return useMemo(\n () =>\n crmScope.level === 'org'\n ? {\n scope: crmScope.scope,\n orgId: crmScope.orgId,\n ready: crmScope.ready,\n visibleTo: null,\n createHostId: null,\n createTokens: ORG_TOKENS,\n groupId: crmScope.createGroup?.groupId ?? null,\n }\n : {\n scope: crmScope.scope,\n orgId: crmScope.orgId,\n ready: crmScope.ready,\n visibleTo: crmScope.visibleTo,\n createHostId: crmScope.createHostId,\n createTokens: crmScope.createTokens,\n groupId: crmScope.consentGroup?.groupId ?? null,\n },\n [crmScope],\n )\n}\n\n/**\n * The templates and snippets this member may pick from (AGL-2658): every\n * shared one the reader's scope reaches, and the personal ones they own.\n *\n * ONE bounded listener, filtered on the reader's tokens like every CRM read\n * and ordered by name — the `(visibleTo, name)` index under a site, the\n * automatic single-field one at the organization level. A colleague's\n * personal template is readable under the rules and hidden here by\n * `crmEmailTemplateIsListed`, for the reason a private saved view is\n * (AGL-2617). Rows past the window are not listed; the console's create\n * stops at the window, so a workspace cannot write what its menu cannot\n * show.\n */\nexport function useCrmEmailTemplates(options: {\n scope: readonly ['orgs', string] | null\n /** The reader's tokens, or `null` at the organization level — no clause. */\n visibleTo: readonly string[] | null\n uid: string | null | undefined\n}): { templates: CrmEmailTemplateRow[]; ready: boolean; fromCache: boolean } {\n const { scope, visibleTo, uid } = options\n const firestore = useFirestore()\n const { data, status, fromCache } = useFirestoreCollection<Record<string, unknown>>(\n () =>\n scope && crmScopeListable(visibleTo)\n ? query(\n collection(firestore, scope[0], scope[1], CRM_COLLECTIONS.emailTemplates),\n ...crmVisibleToClause(visibleTo),\n orderBy('name'),\n limit(CRM_EMAIL_TEMPLATES_LIMIT),\n )\n : null,\n [firestore, scope, visibleTo],\n { idField: '$id' },\n )\n const templates = useMemo<CrmEmailTemplateRow[]>(() => {\n if (!data?.length) return NO_ROWS\n return data\n .map((row) => ({ $id: String(row['$id']), ...normalizeCrmEmailTemplate(row) }))\n .filter((template) => template.name && crmEmailTemplateIsListed(template, uid))\n }, [data, uid])\n return { templates, ready: Boolean(scope) && status !== 'loading', fromCache }\n}\n\nexport default useCrmEmailTemplates\n"],"names":["CRM_COLLECTIONS","CRM_EMAIL_TEMPLATES_LIMIT","crmEmailTemplateIsListed","normalizeCrmEmailTemplate","ORG_SCOPE_TOKEN","useFirestore","useFirestoreCollection","collection","limit","orderBy","query","useMemo","crmScopeListable","crmVisibleToClause","useCrmScope","ORG_TOKENS","Object","freeze","NO_ROWS","useCrmEmailTemplateScope","props","crmScope","level","scope","orgId","ready","visibleTo","createHostId","createTokens","groupId","createGroup","consentGroup","useCrmEmailTemplates","options","uid","firestore","data","status","fromCache","emailTemplates","idField","templates","length","map","row","$id","String","filter","template","name","Boolean"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA,SACEA,eAAe,EACfC,yBAAyB,EAEzBC,wBAAwB,EACxBC,yBAAyB,EACzBC,eAAe,QAEV,eAAc;AACrB,SAASC,YAAY,EAAEC,sBAAsB,QAAQ,iCAAgC;AACrF,SAASC,UAAU,EAAEC,KAAK,EAAEC,OAAO,EAAEC,KAAK,QAAQ,qBAAoB;AACtE,SAASC,OAAO,QAAQ,QAAO;AAC/B,SAEEC,gBAAgB,EAChBC,kBAAkB,EAClBC,WAAW,QACN,qBAAiB;AAExB,MAAMC,aAAoCC,OAAOC,MAAM,CAAC;IAACb;CAAgB;AACzE,MAAMc,UAAiC,EAAE;AAoBzC;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,yBAAyBC,KAGxC;IACC,MAAMC,WAAWP,YAAYM;IAC7B,OAAOT,QACL;;YASiBU,uBASAA;eAjBfA,SAASC,KAAK,KAAK,QACf;YACEC,OAAOF,SAASE,KAAK;YACrBC,OAAOH,SAASG,KAAK;YACrBC,OAAOJ,SAASI,KAAK;YACrBC,WAAW;YACXC,cAAc;YACdC,cAAcb;YACdc,OAAO,WAAER,wBAAAA,SAASS,WAAW,qBAApBT,sBAAsBQ,OAAO,mBAAI;QAC5C,IACA;YACEN,OAAOF,SAASE,KAAK;YACrBC,OAAOH,SAASG,KAAK;YACrBC,OAAOJ,SAASI,KAAK;YACrBC,WAAWL,SAASK,SAAS;YAC7BC,cAAcN,SAASM,YAAY;YACnCC,cAAcP,SAASO,YAAY;YACnCC,OAAO,YAAER,yBAAAA,SAASU,YAAY,qBAArBV,uBAAuBQ,OAAO,oBAAI;QAC7C;OACN;QAACR;KAAS;AAEd;AAEA;;;;;;;;;;;;CAYC,GACD,OAAO,SAASW,qBAAqBC,OAKpC;IACC,MAAM,EAAEV,KAAK,EAAEG,SAAS,EAAEQ,GAAG,EAAE,GAAGD;IAClC,MAAME,YAAY9B;IAClB,MAAM,EAAE+B,IAAI,EAAEC,MAAM,EAAEC,SAAS,EAAE,GAAGhC,uBAClC,IACEiB,SAASX,iBAAiBc,aACtBhB,MACEH,WAAW4B,WAAWZ,KAAK,CAAC,EAAE,EAAEA,KAAK,CAAC,EAAE,EAAEvB,gBAAgBuC,cAAc,MACrE1B,mBAAmBa,YACtBjB,QAAQ,SACRD,MAAMP,8BAER,MACN;QAACkC;QAAWZ;QAAOG;KAAU,EAC7B;QAAEc,SAAS;IAAM;IAEnB,MAAMC,YAAY9B,QAA+B;QAC/C,IAAI,EAACyB,wBAAAA,KAAMM,MAAM,GAAE,OAAOxB;QAC1B,OAAOkB,KACJO,GAAG,CAAC,CAACC,MAAS;gBAAEC,KAAKC,OAAOF,GAAG,CAAC,MAAM;eAAMzC,0BAA0ByC,OACtEG,MAAM,CAAC,CAACC,WAAaA,SAASC,IAAI,IAAI/C,yBAAyB8C,UAAUd;IAC9E,GAAG;QAACE;QAAMF;KAAI;IACd,OAAO;QAAEO;QAAWhB,OAAOyB,QAAQ3B,UAAUc,WAAW;QAAWC;IAAU;AAC/E;AAEA,eAAeN,qBAAoB"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * The CRM hub's own path — `/{orgSlug}/hosts/{host}/crm` — for a surface
19
+ * that was not handed one (AGL-2599).
20
+ *
21
+ * A section rendered by the hub receives `basePath` from the shell and
22
+ * passes it down, and that value wins whenever it is present: it is the
23
+ * address the shell actually resolved, legacy `/contacts` included. The
24
+ * dashboard widget and a record card dropped onto somebody else's page get
25
+ * a host id and nothing else, so for them the path is rebuilt from the URL
26
+ * the way the other dashboard glances build theirs. `useParams` is called
27
+ * unconditionally because a hook cannot be skipped on a prop.
28
+ */
29
+ export declare function useCrmHubPath(basePath?: string | null): string;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { buildRoute, Route } from "@aglyn/aglyn";
17
+ import { useParams } from "next/navigation";
18
+ /**
19
+ * The CRM hub's own path — `/{orgSlug}/hosts/{host}/crm` — for a surface
20
+ * that was not handed one (AGL-2599).
21
+ *
22
+ * A section rendered by the hub receives `basePath` from the shell and
23
+ * passes it down, and that value wins whenever it is present: it is the
24
+ * address the shell actually resolved, legacy `/contacts` included. The
25
+ * dashboard widget and a record card dropped onto somebody else's page get
26
+ * a host id and nothing else, so for them the path is rebuilt from the URL
27
+ * the way the other dashboard glances build theirs. `useParams` is called
28
+ * unconditionally because a hook cannot be skipped on a prop.
29
+ */ export function useCrmHubPath(basePath) {
30
+ var _ref, _ref1;
31
+ const params = useParams();
32
+ if (basePath) return basePath;
33
+ const orgSlug = String((_ref = params == null ? void 0 : params.orgSlug) != null ? _ref : '');
34
+ const host = String((_ref1 = params == null ? void 0 : params.host) != null ? _ref1 : '');
35
+ return `${buildRoute(Route.HOST_DASHBOARD, {
36
+ orgSlug,
37
+ host
38
+ })}/crm`;
39
+ }
40
+
41
+ //# sourceMappingURL=use-crm-hub-path.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/hooks/use-crm-hub-path.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { buildRoute, Route } from '@aglyn/aglyn'\nimport { useParams } from 'next/navigation'\n\n/**\n * The CRM hub's own path — `/{orgSlug}/hosts/{host}/crm` — for a surface\n * that was not handed one (AGL-2599).\n *\n * A section rendered by the hub receives `basePath` from the shell and\n * passes it down, and that value wins whenever it is present: it is the\n * address the shell actually resolved, legacy `/contacts` included. The\n * dashboard widget and a record card dropped onto somebody else's page get\n * a host id and nothing else, so for them the path is rebuilt from the URL\n * the way the other dashboard glances build theirs. `useParams` is called\n * unconditionally because a hook cannot be skipped on a prop.\n */\nexport function useCrmHubPath(basePath?: string | null): string {\n const params = useParams<{ orgSlug?: string; host?: string }>()\n if (basePath) return basePath\n const orgSlug = String(params?.orgSlug ?? '')\n const host = String(params?.host ?? '')\n return `${buildRoute(Route.HOST_DASHBOARD, { orgSlug, host })}/crm`\n}\n"],"names":["buildRoute","Route","useParams","useCrmHubPath","basePath","params","orgSlug","String","host","HOST_DASHBOARD"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,UAAU,EAAEC,KAAK,QAAQ,eAAc;AAChD,SAASC,SAAS,QAAQ,kBAAiB;AAE3C;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,cAAcC,QAAwB;;IACpD,MAAMC,SAASH;IACf,IAAIE,UAAU,OAAOA;IACrB,MAAME,UAAUC,eAAOF,0BAAAA,OAAQC,OAAO,mBAAI;IAC1C,MAAME,OAAOD,gBAAOF,0BAAAA,OAAQG,IAAI,oBAAI;IACpC,OAAO,GAAGR,WAAWC,MAAMQ,cAAc,EAAE;QAAEH;QAASE;IAAK,GAAG,IAAI,CAAC;AACrE"}
@@ -0,0 +1,97 @@
1
+ import type { ConsolePluginOrgMount } from '@aglyn/aglyn';
2
+ import { type ComponentType, type ReactNode } from 'react';
3
+ /**
4
+ * The organization-level mount, as every CRM surface beneath the hub reads
5
+ * it (AGL-2630).
6
+ *
7
+ * The shell hands the hub page an org and its sites; the hub publishes them
8
+ * through this context so a drawer four components down — the one that has
9
+ * to ask which site a new record is captured by — reaches them without four
10
+ * components threading a prop they never read. `useCrmScope` reads it too:
11
+ * a surface handed `hostId: null` learns from here which org it is under,
12
+ * which is what lets every existing `useCrmScope({ hostId, org })` call
13
+ * serve the org level unchanged.
14
+ */
15
+ export interface CrmOrgMount extends ConsolePluginOrgMount {
16
+ /**
17
+ * The site the next create stamps from: the reader's last pick this
18
+ * session, or the org's only site when it has exactly one, else `null`
19
+ * until somebody picks. A record is always captured BY a site — its
20
+ * `hostId`, its `visibleTo`, the consent group its profile lives on all
21
+ * come from one — and at the org level nothing else can say which.
22
+ */
23
+ createHostId: string | null;
24
+ setCreateHostId: (hostId: string) => void;
25
+ /** How a site reads on screen — its name, or its id when the list cannot name it. */
26
+ siteName: (hostId: string) => string;
27
+ /**
28
+ * The subdomain a console URL under `/hosts/[host]` takes, or `null` for
29
+ * a site the list did not answer for — named, never linked.
30
+ */
31
+ siteSubdomain: (hostId: string) => string | null;
32
+ /**
33
+ * The site's own CRM hub — `${hostsPath}/${subdomain}/crm` — or `null`
34
+ * for a site whose subdomain the list could not answer, which is named
35
+ * and not linked.
36
+ */
37
+ siteHubHref: (hostId: string) => string | null;
38
+ }
39
+ /**
40
+ * Publishes the org-level mount to every surface beneath it.
41
+ *
42
+ * Mounted by the hub page ONLY when the shell handed it an `orgMount`; under
43
+ * a site there is no provider and `useCrmOrgMount` answers `null`, which is
44
+ * how a surface tells the two levels apart without a second prop.
45
+ */
46
+ export declare function CrmOrgMountProvider(props: {
47
+ mount: ConsolePluginOrgMount;
48
+ children: ReactNode;
49
+ }): import("react").JSX.Element;
50
+ export declare namespace CrmOrgMountProvider {
51
+ var displayName: string;
52
+ }
53
+ /** The org-level mount, or `null` under a site. */
54
+ export declare function useCrmOrgMount(): CrmOrgMount | null;
55
+ /**
56
+ * `Card` beneath the org-level mount the SHELL hands it as a prop (AGL-2636).
57
+ *
58
+ * The hub page mounts the provider itself, because the shell hands the hub
59
+ * page an `orgMount` and the page owns everything under it. A widget on the
60
+ * org's `orgDashboard` slot is dropped into a console page the CRM does not
61
+ * own — the org's sites list — and the console never imports a plugin, so
62
+ * the page cannot mount this plugin's provider around the slot. The slot
63
+ * hands each widget the same `orgMount` instead, and this puts the provider
64
+ * where the hub page puts it: around the surface, one level down. `Card`
65
+ * then reads `useCrmOrgMount()` and `useCrmScope({ hostId: null })` exactly
66
+ * as it does under the hub, and stays one component for both mounts.
67
+ *
68
+ * Handed no mount — a slot that names a site, or a shell older than the org
69
+ * zone — the card renders as it is, and `useCrmOrgMount` answers `null` the
70
+ * way it does under a site.
71
+ */
72
+ export declare function withCrmOrgMount<P extends object>(Card: ComponentType<P>): ComponentType<P & {
73
+ orgMount?: ConsolePluginOrgMount;
74
+ }>;
75
+ /**
76
+ * THE SITE A CREATE OPENED FROM A RECORD DEFAULTS TO (AGL-2630).
77
+ *
78
+ * A task, an activity or a deal filed from a contact's page belongs, nine
79
+ * times in ten, with the site that captured the contact — not with the
80
+ * site the reader last picked in a list's drawer. So a record page wraps
81
+ * its cards in this, naming its record's own capturing site, and every
82
+ * create under it defaults its Site picker there. A pick the reader makes
83
+ * INSIDE such a create is held for that page alone; the session's pick,
84
+ * which a create opened from a list keeps defaulting to, is untouched.
85
+ *
86
+ * Nothing under a site, nothing for a record no site has captured, and
87
+ * nothing for a site the mount's list does not carry — the reader may not
88
+ * have it: the children render as they are and the session's pick stands.
89
+ */
90
+ export declare function CrmCreateSiteDefault(props: {
91
+ hostId: string | null | undefined;
92
+ children: ReactNode;
93
+ }): import("react").JSX.Element;
94
+ export declare namespace CrmCreateSiteDefault {
95
+ var displayName: string;
96
+ }
97
+ export default useCrmOrgMount;
@@ -0,0 +1,215 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ 'use client';
17
+ import { _ as _extends } from "@swc/helpers/_/_extends";
18
+ import { _ as _object_without_properties_loose } from "@swc/helpers/_/_object_without_properties_loose";
19
+ import { jsx as _jsx } from "react/jsx-runtime";
20
+ import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
21
+ const CrmOrgMountContext = /*#__PURE__*/ createContext(null);
22
+ /**
23
+ * The session's memory of the picked site, per org. Session storage rather
24
+ * than local: the pick is a working convenience for one sitting, and a
25
+ * site remembered across weeks would stamp a record onto a site the reader
26
+ * had forgotten choosing.
27
+ */ const pickStorageKey = (orgId)=>`aglyn.crm.createSite.${orgId}`;
28
+ function readRememberedPick(orgId) {
29
+ try {
30
+ return window.sessionStorage.getItem(pickStorageKey(orgId));
31
+ } catch (unused) {
32
+ return null;
33
+ }
34
+ }
35
+ function writeRememberedPick(orgId, hostId) {
36
+ try {
37
+ window.sessionStorage.setItem(pickStorageKey(orgId), hostId);
38
+ } catch (unused) {
39
+ // A browser that refuses storage still gets the pick for this page.
40
+ }
41
+ }
42
+ /**
43
+ * Publishes the org-level mount to every surface beneath it.
44
+ *
45
+ * Mounted by the hub page ONLY when the shell handed it an `orgMount`; under
46
+ * a site there is no provider and `useCrmOrgMount` answers `null`, which is
47
+ * how a surface tells the two levels apart without a second prop.
48
+ */ export function CrmOrgMountProvider(props) {
49
+ const { mount, children } = props;
50
+ const { orgId, hosts, hostsReady, hostsPath } = mount;
51
+ const [picked, setPicked] = useState(null);
52
+ // Read after mount rather than in the initializer, so the server and the
53
+ // first client paint agree: the pick only ever affects a drawer somebody
54
+ // has since opened.
55
+ useEffect(()=>{
56
+ setPicked(readRememberedPick(orgId));
57
+ }, [
58
+ orgId
59
+ ]);
60
+ const byId = useMemo(()=>{
61
+ const index = new Map();
62
+ for (const host of hosts)index.set(host.id, host);
63
+ return index;
64
+ }, [
65
+ hosts
66
+ ]);
67
+ /*
68
+ * A remembered site the list no longer carries is forgotten rather than
69
+ * stamped — the reader may have lost the site, or the site may be gone.
70
+ * An org with exactly one site needs no picker at all; nothing else is
71
+ * picked silently, because a wrong guess files a person under a brand
72
+ * that never met them.
73
+ */ const createHostId = useMemo(()=>{
74
+ if (picked && byId.has(picked)) return picked;
75
+ if (hostsReady && hosts.length === 1) return hosts[0].id;
76
+ return null;
77
+ }, [
78
+ picked,
79
+ byId,
80
+ hostsReady,
81
+ hosts
82
+ ]);
83
+ const setCreateHostId = useCallback((hostId)=>{
84
+ setPicked(hostId);
85
+ writeRememberedPick(orgId, hostId);
86
+ }, [
87
+ orgId
88
+ ]);
89
+ const siteName = useCallback((hostId)=>{
90
+ var _byId_get;
91
+ return ((_byId_get = byId.get(hostId)) == null ? void 0 : _byId_get.name) || hostId;
92
+ }, [
93
+ byId
94
+ ]);
95
+ const siteSubdomain = useCallback((hostId)=>{
96
+ var _ref;
97
+ var _byId_get;
98
+ return (_ref = (_byId_get = byId.get(hostId)) == null ? void 0 : _byId_get.subdomain) != null ? _ref : null;
99
+ }, [
100
+ byId
101
+ ]);
102
+ const siteHubHref = useCallback((hostId)=>{
103
+ var _byId_get;
104
+ const subdomain = (_byId_get = byId.get(hostId)) == null ? void 0 : _byId_get.subdomain;
105
+ return subdomain ? `${hostsPath}/${encodeURIComponent(subdomain)}/crm` : null;
106
+ }, [
107
+ byId,
108
+ hostsPath
109
+ ]);
110
+ const value = useMemo(()=>({
111
+ orgId,
112
+ hosts,
113
+ hostsReady,
114
+ hostsPath,
115
+ createHostId,
116
+ setCreateHostId,
117
+ siteName,
118
+ siteSubdomain,
119
+ siteHubHref
120
+ }), [
121
+ orgId,
122
+ hosts,
123
+ hostsReady,
124
+ hostsPath,
125
+ createHostId,
126
+ setCreateHostId,
127
+ siteName,
128
+ siteSubdomain,
129
+ siteHubHref
130
+ ]);
131
+ return /*#__PURE__*/ _jsx(CrmOrgMountContext.Provider, {
132
+ value: value,
133
+ children: children
134
+ });
135
+ }
136
+ CrmOrgMountProvider.displayName = 'CrmOrgMountProvider';
137
+ /** The org-level mount, or `null` under a site. */ export function useCrmOrgMount() {
138
+ return useContext(CrmOrgMountContext);
139
+ }
140
+ /**
141
+ * `Card` beneath the org-level mount the SHELL hands it as a prop (AGL-2636).
142
+ *
143
+ * The hub page mounts the provider itself, because the shell hands the hub
144
+ * page an `orgMount` and the page owns everything under it. A widget on the
145
+ * org's `orgDashboard` slot is dropped into a console page the CRM does not
146
+ * own — the org's sites list — and the console never imports a plugin, so
147
+ * the page cannot mount this plugin's provider around the slot. The slot
148
+ * hands each widget the same `orgMount` instead, and this puts the provider
149
+ * where the hub page puts it: around the surface, one level down. `Card`
150
+ * then reads `useCrmOrgMount()` and `useCrmScope({ hostId: null })` exactly
151
+ * as it does under the hub, and stays one component for both mounts.
152
+ *
153
+ * Handed no mount — a slot that names a site, or a shell older than the org
154
+ * zone — the card renders as it is, and `useCrmOrgMount` answers `null` the
155
+ * way it does under a site.
156
+ */ export function withCrmOrgMount(Card) {
157
+ var _ref, _Card_displayName;
158
+ function CrmOrgMounted(props) {
159
+ const { orgMount } = props, rest = _object_without_properties_loose(props, [
160
+ "orgMount"
161
+ ]);
162
+ const card = /*#__PURE__*/ _jsx(Card, _extends({}, rest));
163
+ return orgMount ? /*#__PURE__*/ _jsx(CrmOrgMountProvider, {
164
+ mount: orgMount,
165
+ children: card
166
+ }) : card;
167
+ }
168
+ CrmOrgMounted.displayName = `CrmOrgMounted(${(_ref = (_Card_displayName = Card.displayName) != null ? _Card_displayName : Card.name) != null ? _ref : 'Card'})`;
169
+ return CrmOrgMounted;
170
+ }
171
+ /**
172
+ * THE SITE A CREATE OPENED FROM A RECORD DEFAULTS TO (AGL-2630).
173
+ *
174
+ * A task, an activity or a deal filed from a contact's page belongs, nine
175
+ * times in ten, with the site that captured the contact — not with the
176
+ * site the reader last picked in a list's drawer. So a record page wraps
177
+ * its cards in this, naming its record's own capturing site, and every
178
+ * create under it defaults its Site picker there. A pick the reader makes
179
+ * INSIDE such a create is held for that page alone; the session's pick,
180
+ * which a create opened from a list keeps defaulting to, is untouched.
181
+ *
182
+ * Nothing under a site, nothing for a record no site has captured, and
183
+ * nothing for a site the mount's list does not carry — the reader may not
184
+ * have it: the children render as they are and the session's pick stands.
185
+ */ export function CrmCreateSiteDefault(props) {
186
+ const { hostId, children } = props;
187
+ const mount = useContext(CrmOrgMountContext);
188
+ const [picked, setPicked] = useState(null);
189
+ // Another record on the same page starts from its own site again.
190
+ useEffect(()=>{
191
+ setPicked(null);
192
+ }, [
193
+ hostId
194
+ ]);
195
+ const value = useMemo(()=>{
196
+ if (!mount || !hostId) return mount;
197
+ if (!mount.hosts.some((host)=>host.id === hostId)) return mount;
198
+ return _extends({}, mount, {
199
+ createHostId: picked != null ? picked : hostId,
200
+ setCreateHostId: setPicked
201
+ });
202
+ }, [
203
+ mount,
204
+ hostId,
205
+ picked
206
+ ]);
207
+ return /*#__PURE__*/ _jsx(CrmOrgMountContext.Provider, {
208
+ value: value,
209
+ children: children
210
+ });
211
+ }
212
+ CrmCreateSiteDefault.displayName = 'CrmCreateSiteDefault';
213
+ export default useCrmOrgMount;
214
+
215
+ //# sourceMappingURL=use-crm-org-mount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/hooks/use-crm-org-mount.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport type { ConsolePluginOrgHost, ConsolePluginOrgMount } from '@aglyn/aglyn'\nimport {\n type ComponentType,\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react'\n\n/**\n * The organization-level mount, as every CRM surface beneath the hub reads\n * it (AGL-2630).\n *\n * The shell hands the hub page an org and its sites; the hub publishes them\n * through this context so a drawer four components down — the one that has\n * to ask which site a new record is captured by — reaches them without four\n * components threading a prop they never read. `useCrmScope` reads it too:\n * a surface handed `hostId: null` learns from here which org it is under,\n * which is what lets every existing `useCrmScope({ hostId, org })` call\n * serve the org level unchanged.\n */\nexport interface CrmOrgMount extends ConsolePluginOrgMount {\n /**\n * The site the next create stamps from: the reader's last pick this\n * session, or the org's only site when it has exactly one, else `null`\n * until somebody picks. A record is always captured BY a site — its\n * `hostId`, its `visibleTo`, the consent group its profile lives on all\n * come from one — and at the org level nothing else can say which.\n */\n createHostId: string | null\n setCreateHostId: (hostId: string) => void\n /** How a site reads on screen — its name, or its id when the list cannot name it. */\n siteName: (hostId: string) => string\n /**\n * The subdomain a console URL under `/hosts/[host]` takes, or `null` for\n * a site the list did not answer for — named, never linked.\n */\n siteSubdomain: (hostId: string) => string | null\n /**\n * The site's own CRM hub — `${hostsPath}/${subdomain}/crm` — or `null`\n * for a site whose subdomain the list could not answer, which is named\n * and not linked.\n */\n siteHubHref: (hostId: string) => string | null\n}\n\nconst CrmOrgMountContext = createContext<CrmOrgMount | null>(null)\n\n/**\n * The session's memory of the picked site, per org. Session storage rather\n * than local: the pick is a working convenience for one sitting, and a\n * site remembered across weeks would stamp a record onto a site the reader\n * had forgotten choosing.\n */\nconst pickStorageKey = (orgId: string) => `aglyn.crm.createSite.${orgId}`\n\nfunction readRememberedPick(orgId: string): string | null {\n try {\n return window.sessionStorage.getItem(pickStorageKey(orgId))\n } catch {\n return null\n }\n}\n\nfunction writeRememberedPick(orgId: string, hostId: string): void {\n try {\n window.sessionStorage.setItem(pickStorageKey(orgId), hostId)\n } catch {\n // A browser that refuses storage still gets the pick for this page.\n }\n}\n\n/**\n * Publishes the org-level mount to every surface beneath it.\n *\n * Mounted by the hub page ONLY when the shell handed it an `orgMount`; under\n * a site there is no provider and `useCrmOrgMount` answers `null`, which is\n * how a surface tells the two levels apart without a second prop.\n */\nexport function CrmOrgMountProvider(props: {\n mount: ConsolePluginOrgMount\n children: ReactNode\n}) {\n const { mount, children } = props\n const { orgId, hosts, hostsReady, hostsPath } = mount\n const [picked, setPicked] = useState<string | null>(null)\n // Read after mount rather than in the initializer, so the server and the\n // first client paint agree: the pick only ever affects a drawer somebody\n // has since opened.\n useEffect(() => {\n setPicked(readRememberedPick(orgId))\n }, [orgId])\n\n const byId = useMemo(() => {\n const index = new Map<string, ConsolePluginOrgHost>()\n for (const host of hosts) index.set(host.id, host)\n return index\n }, [hosts])\n\n /*\n * A remembered site the list no longer carries is forgotten rather than\n * stamped — the reader may have lost the site, or the site may be gone.\n * An org with exactly one site needs no picker at all; nothing else is\n * picked silently, because a wrong guess files a person under a brand\n * that never met them.\n */\n const createHostId = useMemo(() => {\n if (picked && byId.has(picked)) return picked\n if (hostsReady && hosts.length === 1) return hosts[0].id\n return null\n }, [picked, byId, hostsReady, hosts])\n\n const setCreateHostId = useCallback(\n (hostId: string) => {\n setPicked(hostId)\n writeRememberedPick(orgId, hostId)\n },\n [orgId],\n )\n const siteName = useCallback(\n (hostId: string) => byId.get(hostId)?.name || hostId,\n [byId],\n )\n const siteSubdomain = useCallback(\n (hostId: string) => byId.get(hostId)?.subdomain ?? null,\n [byId],\n )\n const siteHubHref = useCallback(\n (hostId: string) => {\n const subdomain = byId.get(hostId)?.subdomain\n return subdomain ? `${hostsPath}/${encodeURIComponent(subdomain)}/crm` : null\n },\n [byId, hostsPath],\n )\n\n const value = useMemo<CrmOrgMount>(\n () => ({\n orgId,\n hosts,\n hostsReady,\n hostsPath,\n createHostId,\n setCreateHostId,\n siteName,\n siteSubdomain,\n siteHubHref,\n }),\n [\n orgId,\n hosts,\n hostsReady,\n hostsPath,\n createHostId,\n setCreateHostId,\n siteName,\n siteSubdomain,\n siteHubHref,\n ],\n )\n return (\n <CrmOrgMountContext.Provider value={value}>\n {children}\n </CrmOrgMountContext.Provider>\n )\n}\nCrmOrgMountProvider.displayName = 'CrmOrgMountProvider'\n\n/** The org-level mount, or `null` under a site. */\nexport function useCrmOrgMount(): CrmOrgMount | null {\n return useContext(CrmOrgMountContext)\n}\n\n/**\n * `Card` beneath the org-level mount the SHELL hands it as a prop (AGL-2636).\n *\n * The hub page mounts the provider itself, because the shell hands the hub\n * page an `orgMount` and the page owns everything under it. A widget on the\n * org's `orgDashboard` slot is dropped into a console page the CRM does not\n * own — the org's sites list — and the console never imports a plugin, so\n * the page cannot mount this plugin's provider around the slot. The slot\n * hands each widget the same `orgMount` instead, and this puts the provider\n * where the hub page puts it: around the surface, one level down. `Card`\n * then reads `useCrmOrgMount()` and `useCrmScope({ hostId: null })` exactly\n * as it does under the hub, and stays one component for both mounts.\n *\n * Handed no mount — a slot that names a site, or a shell older than the org\n * zone — the card renders as it is, and `useCrmOrgMount` answers `null` the\n * way it does under a site.\n */\nexport function withCrmOrgMount<P extends object>(\n Card: ComponentType<P>,\n): ComponentType<P & { orgMount?: ConsolePluginOrgMount }> {\n function CrmOrgMounted(props: P & { orgMount?: ConsolePluginOrgMount }) {\n const { orgMount, ...rest } = props\n const card = <Card {...(rest as P)} />\n return orgMount ? (\n <CrmOrgMountProvider mount={orgMount}>{card}</CrmOrgMountProvider>\n ) : (\n card\n )\n }\n CrmOrgMounted.displayName = `CrmOrgMounted(${\n Card.displayName ?? (Card as { name?: string }).name ?? 'Card'\n })`\n return CrmOrgMounted\n}\n\n/**\n * THE SITE A CREATE OPENED FROM A RECORD DEFAULTS TO (AGL-2630).\n *\n * A task, an activity or a deal filed from a contact's page belongs, nine\n * times in ten, with the site that captured the contact — not with the\n * site the reader last picked in a list's drawer. So a record page wraps\n * its cards in this, naming its record's own capturing site, and every\n * create under it defaults its Site picker there. A pick the reader makes\n * INSIDE such a create is held for that page alone; the session's pick,\n * which a create opened from a list keeps defaulting to, is untouched.\n *\n * Nothing under a site, nothing for a record no site has captured, and\n * nothing for a site the mount's list does not carry — the reader may not\n * have it: the children render as they are and the session's pick stands.\n */\nexport function CrmCreateSiteDefault(props: {\n hostId: string | null | undefined\n children: ReactNode\n}) {\n const { hostId, children } = props\n const mount = useContext(CrmOrgMountContext)\n const [picked, setPicked] = useState<string | null>(null)\n // Another record on the same page starts from its own site again.\n useEffect(() => {\n setPicked(null)\n }, [hostId])\n const value = useMemo<CrmOrgMount | null>(() => {\n if (!mount || !hostId) return mount\n if (!mount.hosts.some((host) => host.id === hostId)) return mount\n return {\n ...mount,\n createHostId: picked ?? hostId,\n setCreateHostId: setPicked,\n }\n }, [mount, hostId, picked])\n return (\n <CrmOrgMountContext.Provider value={value}>\n {children}\n </CrmOrgMountContext.Provider>\n )\n}\nCrmCreateSiteDefault.displayName = 'CrmCreateSiteDefault'\n\nexport default useCrmOrgMount\n"],"names":["createContext","useCallback","useContext","useEffect","useMemo","useState","CrmOrgMountContext","pickStorageKey","orgId","readRememberedPick","window","sessionStorage","getItem","writeRememberedPick","hostId","setItem","CrmOrgMountProvider","props","mount","children","hosts","hostsReady","hostsPath","picked","setPicked","byId","index","Map","host","set","id","createHostId","has","length","setCreateHostId","siteName","get","name","siteSubdomain","subdomain","siteHubHref","encodeURIComponent","value","Provider","displayName","useCrmOrgMount","withCrmOrgMount","Card","CrmOrgMounted","orgMount","rest","card","CrmCreateSiteDefault","some"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;;AAGA,SAEEA,aAAa,EAEbC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,QAAO;AAuCd,MAAMC,mCAAqBN,cAAkC;AAE7D;;;;;CAKC,GACD,MAAMO,iBAAiB,CAACC,QAAkB,CAAC,qBAAqB,EAAEA,OAAO;AAEzE,SAASC,mBAAmBD,KAAa;IACvC,IAAI;QACF,OAAOE,OAAOC,cAAc,CAACC,OAAO,CAACL,eAAeC;IACtD,EAAE,eAAM;QACN,OAAO;IACT;AACF;AAEA,SAASK,oBAAoBL,KAAa,EAAEM,MAAc;IACxD,IAAI;QACFJ,OAAOC,cAAc,CAACI,OAAO,CAACR,eAAeC,QAAQM;IACvD,EAAE,eAAM;IACN,oEAAoE;IACtE;AACF;AAEA;;;;;;CAMC,GACD,OAAO,SAASE,oBAAoBC,KAGnC;IACC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGF;IAC5B,MAAM,EAAET,KAAK,EAAEY,KAAK,EAAEC,UAAU,EAAEC,SAAS,EAAE,GAAGJ;IAChD,MAAM,CAACK,QAAQC,UAAU,GAAGnB,SAAwB;IACpD,yEAAyE;IACzE,yEAAyE;IACzE,oBAAoB;IACpBF,UAAU;QACRqB,UAAUf,mBAAmBD;IAC/B,GAAG;QAACA;KAAM;IAEV,MAAMiB,OAAOrB,QAAQ;QACnB,MAAMsB,QAAQ,IAAIC;QAClB,KAAK,MAAMC,QAAQR,MAAOM,MAAMG,GAAG,CAACD,KAAKE,EAAE,EAAEF;QAC7C,OAAOF;IACT,GAAG;QAACN;KAAM;IAEV;;;;;;GAMC,GACD,MAAMW,eAAe3B,QAAQ;QAC3B,IAAImB,UAAUE,KAAKO,GAAG,CAACT,SAAS,OAAOA;QACvC,IAAIF,cAAcD,MAAMa,MAAM,KAAK,GAAG,OAAOb,KAAK,CAAC,EAAE,CAACU,EAAE;QACxD,OAAO;IACT,GAAG;QAACP;QAAQE;QAAMJ;QAAYD;KAAM;IAEpC,MAAMc,kBAAkBjC,YACtB,CAACa;QACCU,UAAUV;QACVD,oBAAoBL,OAAOM;IAC7B,GACA;QAACN;KAAM;IAET,MAAM2B,WAAWlC,YACf,CAACa;YAAmBW;eAAAA,EAAAA,YAAAA,KAAKW,GAAG,CAACtB,4BAATW,UAAkBY,IAAI,KAAIvB;OAC9C;QAACW;KAAK;IAER,MAAMa,gBAAgBrC,YACpB,CAACa;;YAAmBW;wBAAAA,YAAAA,KAAKW,GAAG,CAACtB,4BAATW,UAAkBc,SAAS,mBAAI;OACnD;QAACd;KAAK;IAER,MAAMe,cAAcvC,YAClB,CAACa;YACmBW;QAAlB,MAAMc,aAAYd,YAAAA,KAAKW,GAAG,CAACtB,4BAATW,UAAkBc,SAAS;QAC7C,OAAOA,YAAY,GAAGjB,UAAU,CAAC,EAAEmB,mBAAmBF,WAAW,IAAI,CAAC,GAAG;IAC3E,GACA;QAACd;QAAMH;KAAU;IAGnB,MAAMoB,QAAQtC,QACZ,IAAO,CAAA;YACLI;YACAY;YACAC;YACAC;YACAS;YACAG;YACAC;YACAG;YACAE;QACF,CAAA,GACA;QACEhC;QACAY;QACAC;QACAC;QACAS;QACAG;QACAC;QACAG;QACAE;KACD;IAEH,qBACE,KAAClC,mBAAmBqC,QAAQ;QAACD,OAAOA;kBACjCvB;;AAGP;AACAH,oBAAoB4B,WAAW,GAAG;AAElC,iDAAiD,GACjD,OAAO,SAASC;IACd,OAAO3C,WAAWI;AACpB;AAEA;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASwC,gBACdC,IAAsB;QAYpBA,MAAAA;IAVF,SAASC,cAAc/B,KAA+C;QACpE,MAAM,EAAEgC,QAAQ,EAAW,GAAGhC,OAATiC,wCAASjC;;;QAC9B,MAAMkC,qBAAO,KAACJ,mBAAUG;QACxB,OAAOD,yBACL,KAACjC;YAAoBE,OAAO+B;sBAAWE;aAEvCA;IAEJ;IACAH,cAAcJ,WAAW,GAAG,CAAC,cAAc,GACzCG,QAAAA,oBAAAA,KAAKH,WAAW,YAAhBG,oBAAoB,AAACA,KAA2BV,IAAI,YAApDU,OAAwD,OACzD,CAAC,CAAC;IACH,OAAOC;AACT;AAEA;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASI,qBAAqBnC,KAGpC;IACC,MAAM,EAAEH,MAAM,EAAEK,QAAQ,EAAE,GAAGF;IAC7B,MAAMC,QAAQhB,WAAWI;IACzB,MAAM,CAACiB,QAAQC,UAAU,GAAGnB,SAAwB;IACpD,kEAAkE;IAClEF,UAAU;QACRqB,UAAU;IACZ,GAAG;QAACV;KAAO;IACX,MAAM4B,QAAQtC,QAA4B;QACxC,IAAI,CAACc,SAAS,CAACJ,QAAQ,OAAOI;QAC9B,IAAI,CAACA,MAAME,KAAK,CAACiC,IAAI,CAAC,CAACzB,OAASA,KAAKE,EAAE,KAAKhB,SAAS,OAAOI;QAC5D,OAAO,aACFA;YACHa,YAAY,EAAER,iBAAAA,SAAUT;YACxBoB,iBAAiBV;;IAErB,GAAG;QAACN;QAAOJ;QAAQS;KAAO;IAC1B,qBACE,KAACjB,mBAAmBqC,QAAQ;QAACD,OAAOA;kBACjCvB;;AAGP;AACAiC,qBAAqBR,WAAW,GAAG;AAEnC,eAAeC,eAAc"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export type CrmRecordKind = 'contact' | 'company' | 'deal';
18
+ /** The collection each kind of record lives in, under `orgs/{orgId}/`. */
19
+ export declare const CRM_RECORD_COLLECTIONS: Record<CrmRecordKind, string>;
20
+ /**
21
+ * What a record is CALLED, from its document.
22
+ *
23
+ * A contact's name is read through the viewing group's facet, the way the
24
+ * people list reads it, so one business renaming a person does not change
25
+ * what an unrelated business's task list shows; the email stands in for a
26
+ * contact nobody has named. A company has a name and a deal a title.
27
+ */
28
+ export declare function crmRecordName(kind: CrmRecordKind, data: Record<string, unknown> | undefined, groupId: string): string;
29
+ /** Test seam: forget everything, so a spec's fixtures are what get read. */
30
+ export declare function resetCrmRecordNameCache(): void;
31
+ /**
32
+ * The names of the records a list of tasks points at, resolved once each.
33
+ *
34
+ * Returns a lookup rather than a map so the caller does not have to know the
35
+ * cache's key shape. An unresolved record answers `undefined` — the cell
36
+ * renders the link with the id until the name lands, which is one render
37
+ * later on a warm cache and one round trip on a cold one.
38
+ */
39
+ export declare function useCrmRecordNames(options: {
40
+ orgId: string | null | undefined;
41
+ /**
42
+ * The viewing group a contact is named through, or `null` at the
43
+ * organization level (AGL-2630), where each contact is named through its
44
+ * own primary holder, resolved from {@link org}.
45
+ */
46
+ groupId: string | null;
47
+ org?: Record<string, unknown> | null;
48
+ records: ReadonlyArray<{
49
+ kind: CrmRecordKind;
50
+ id: string;
51
+ }>;
52
+ }): (kind: CrmRecordKind, id: string) => string | undefined;