@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,517 @@
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 { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
18
+ import { CRM_COLLECTIONS, isPipelineArchived } from "@aglyn/aglyn";
19
+ import { mdiArchiveArrowDownOutline, mdiArchiveArrowUpOutline, mdiFormatListBulleted, mdiPencilOutline, mdiStarOutline } from "@aglyn/shared-data-mdi";
20
+ import { MdiIcon } from "@aglyn/shared-ui-jsx";
21
+ import RowActionsMenu from "@aglyn/shared-ui-jsx/components/row-actions-menu.component";
22
+ import { useSnackbar } from "@aglyn/shared-ui-snackstack";
23
+ import { useFirestore, useUser, writeGuardedBySeed } from "@aglyn/tenant-feature-instance";
24
+ import { Button, Chip, Dialog, DialogActions, DialogContent, DialogTitle, Divider, Stack, TextField, Typography } from "@mui/material";
25
+ import { addDoc, collection, doc, getCountFromServer, query, updateDoc, where, writeBatch } from "firebase/firestore";
26
+ import { useCallback, useEffect, useState } from "react";
27
+ import { activePipelines, newPipelineDocument, PIPELINE_NAME_MAX, pipelineArchiveRefusal, pipelineNameProblem, sortedStages } from "../model/deal-board-model.js";
28
+ import { PipelineStagesDialog } from "./pipeline-stages-dialog.js";
29
+ /**
30
+ * The org's pipelines (AGL-2620): list, create, rename, set as default,
31
+ * archive, and a door into each one's stages.
32
+ *
33
+ * ## Org documents, scoped like every CRM row
34
+ *
35
+ * A pipeline lives at `orgs/{orgId}/pipelines` and is stamped with the same
36
+ * scope tokens a contact captured on this site would carry, so an agency's
37
+ * client sees its own pipelines and the org-wide ones — the same rule the
38
+ * board reads by. Nothing here assumes one site: the tokens come in as
39
+ * props from `useCrmScope`, and an org-level mount passes its own.
40
+ *
41
+ * ## What each verb writes
42
+ *
43
+ * - **New pipeline** — one `addDoc` of `newPipelineDocument`: a COPY of the
44
+ * default stages, not the default, active. The field sits UNDER the list.
45
+ * - **Rename** — `name` on the one document, refused when an active
46
+ * pipeline already has the name (`pipelineNameProblem`).
47
+ * - **Set as default** — one batch: the flag on, and off on every other
48
+ * document that had it. A batch rather than two updates because two
49
+ * defaults for the length of a network round trip is a board that opens
50
+ * on either.
51
+ * - **Archive** — `archivedAt: now`, after the server has counted the
52
+ * pipeline's OPEN deals and `pipelineArchiveRefusal` has agreed; the
53
+ * count is taken at the click because a deal can be created into the
54
+ * pipeline from another tab meanwhile. The default pipeline and the last
55
+ * active one refuse. **Restore** clears the stamp.
56
+ * - **Edit stages** — opens the stages dialog for that pipeline, unchanged.
57
+ */ export function PipelinesDialog(props) {
58
+ var _pipelines_find;
59
+ const { open, onClose, orgId, hostId, pipelines, fromCache, unreadable, visibleToTokens, createTokens } = props;
60
+ const firestore = useFirestore();
61
+ const { enqueueSnackbar } = useSnackbar();
62
+ const { data: user } = useUser();
63
+ const [busy, setBusy] = useState(null);
64
+ const [newName, setNewName] = useState('');
65
+ const [renaming, setRenaming] = useState(null);
66
+ const [editingStages, setEditingStages] = useState(null);
67
+ useEffect(()=>{
68
+ if (!open) return;
69
+ setNewName('');
70
+ setRenaming(null);
71
+ setEditingStages(null);
72
+ }, [
73
+ open
74
+ ]);
75
+ const pipelineRef = useCallback((id)=>doc(firestore, 'orgs', orgId, CRM_COLLECTIONS.pipelines, id), [
76
+ firestore,
77
+ orgId
78
+ ]);
79
+ /** One guarded write, reported as a snackbar either way. */ const run = useCallback(async (key, write, done)=>{
80
+ setBusy(key);
81
+ try {
82
+ const verdict = await writeGuardedBySeed({
83
+ subject: 'pipeline',
84
+ unreadable,
85
+ fromCache
86
+ }, write);
87
+ if (!verdict.ok) {
88
+ enqueueSnackbar(verdict.message, {
89
+ variant: 'warning',
90
+ persist: false
91
+ });
92
+ return false;
93
+ }
94
+ enqueueSnackbar(done, {
95
+ variant: 'success',
96
+ persist: false
97
+ });
98
+ return true;
99
+ } catch (error) {
100
+ console.error(error);
101
+ enqueueSnackbar('An error has occurred', {
102
+ variant: 'error',
103
+ allowDuplicate: true
104
+ });
105
+ return false;
106
+ } finally{
107
+ setBusy(null);
108
+ }
109
+ }, [
110
+ unreadable,
111
+ fromCache,
112
+ enqueueSnackbar
113
+ ]);
114
+ const newProblem = newName.trim() ? pipelineNameProblem(newName, pipelines) : null;
115
+ const handleCreate = useCallback(async ()=>{
116
+ if (!(user == null ? void 0 : user.uid) || newProblem || !newName.trim()) return;
117
+ const ok = await run('create', async ()=>{
118
+ await addDoc(collection(firestore, 'orgs', orgId, CRM_COLLECTIONS.pipelines), newPipelineDocument(newName, {
119
+ visibleTo: createTokens,
120
+ hostId,
121
+ uid: user.uid,
122
+ nowMs: Date.now()
123
+ }));
124
+ }, 'Pipeline created');
125
+ if (ok) setNewName('');
126
+ }, [
127
+ user,
128
+ newProblem,
129
+ newName,
130
+ run,
131
+ firestore,
132
+ orgId,
133
+ createTokens,
134
+ hostId
135
+ ]);
136
+ const handleRename = useCallback(async ()=>{
137
+ if (!renaming) return;
138
+ const problem = pipelineNameProblem(renaming.name, pipelines, renaming.id);
139
+ if (problem) {
140
+ enqueueSnackbar(problem, {
141
+ variant: 'warning',
142
+ persist: false
143
+ });
144
+ return;
145
+ }
146
+ const ok = await run(`rename:${renaming.id}`, async ()=>{
147
+ await updateDoc(pipelineRef(renaming.id), {
148
+ name: renaming.name.trim().slice(0, PIPELINE_NAME_MAX),
149
+ updatedAt: new Date()
150
+ });
151
+ }, 'Pipeline renamed');
152
+ if (ok) setRenaming(null);
153
+ }, [
154
+ renaming,
155
+ pipelines,
156
+ enqueueSnackbar,
157
+ run,
158
+ pipelineRef
159
+ ]);
160
+ const handleSetDefault = useCallback((pipeline)=>void run(`default:${pipeline.$id}`, async ()=>{
161
+ const batch = writeBatch(firestore);
162
+ const now = new Date();
163
+ for (const entry of pipelines){
164
+ if (entry.$id === pipeline.$id) {
165
+ batch.update(pipelineRef(entry.$id), {
166
+ isDefault: true,
167
+ updatedAt: now
168
+ });
169
+ } else if (entry.isDefault) {
170
+ batch.update(pipelineRef(entry.$id), {
171
+ isDefault: false,
172
+ updatedAt: now
173
+ });
174
+ }
175
+ }
176
+ await batch.commit();
177
+ }, `${pipeline.name} is now the default pipeline`), [
178
+ run,
179
+ firestore,
180
+ pipelines,
181
+ pipelineRef
182
+ ]);
183
+ const handleArchive = useCallback(async (pipeline)=>{
184
+ setBusy(`archive:${pipeline.$id}`);
185
+ let openDeals;
186
+ try {
187
+ const snapshot = await getCountFromServer(query(collection(firestore, 'orgs', orgId, CRM_COLLECTIONS.deals), where('visibleTo', 'array-contains-any', [
188
+ ...visibleToTokens
189
+ ]), where('pipelineId', '==', pipeline.$id), where('status', '==', 'open')));
190
+ openDeals = snapshot.data().count;
191
+ } catch (error) {
192
+ console.error(error);
193
+ setBusy(null);
194
+ enqueueSnackbar('The open deals in this pipeline could not be counted, so it stays.', {
195
+ variant: 'error',
196
+ allowDuplicate: true
197
+ });
198
+ return;
199
+ }
200
+ const refusal = pipelineArchiveRefusal(pipeline, pipelines, openDeals);
201
+ if (refusal) {
202
+ setBusy(null);
203
+ enqueueSnackbar(refusal, {
204
+ variant: 'warning',
205
+ persist: false
206
+ });
207
+ return;
208
+ }
209
+ await run(`archive:${pipeline.$id}`, async ()=>{
210
+ await updateDoc(pipelineRef(pipeline.$id), {
211
+ archivedAt: Date.now(),
212
+ isDefault: false,
213
+ updatedAt: new Date()
214
+ });
215
+ }, `${pipeline.name} archived`);
216
+ }, [
217
+ firestore,
218
+ orgId,
219
+ visibleToTokens,
220
+ pipelines,
221
+ run,
222
+ pipelineRef,
223
+ enqueueSnackbar
224
+ ]);
225
+ const handleRestore = useCallback((pipeline)=>{
226
+ const problem = pipelineNameProblem(pipeline.name, pipelines, pipeline.$id);
227
+ if (problem) {
228
+ enqueueSnackbar(`${problem} Rename it after restoring, or rename the other one first.`, {
229
+ variant: 'warning',
230
+ persist: false
231
+ });
232
+ return;
233
+ }
234
+ void run(`restore:${pipeline.$id}`, async ()=>{
235
+ await updateDoc(pipelineRef(pipeline.$id), {
236
+ archivedAt: null,
237
+ updatedAt: new Date()
238
+ });
239
+ }, `${pipeline.name} restored`);
240
+ }, [
241
+ pipelines,
242
+ enqueueSnackbar,
243
+ run,
244
+ pipelineRef
245
+ ]);
246
+ const actionsFor = (pipeline)=>{
247
+ const archived = isPipelineArchived(pipeline);
248
+ const working = busy !== null;
249
+ return archived ? [
250
+ {
251
+ key: 'restore',
252
+ label: 'Restore',
253
+ icon: /*#__PURE__*/ _jsx(MdiIcon, {
254
+ path: mdiArchiveArrowUpOutline.path,
255
+ size: 0.8
256
+ }),
257
+ disabled: working,
258
+ onClick: ()=>handleRestore(pipeline)
259
+ }
260
+ ] : [
261
+ {
262
+ key: 'stages',
263
+ label: 'Edit stages',
264
+ icon: /*#__PURE__*/ _jsx(MdiIcon, {
265
+ path: mdiFormatListBulleted.path,
266
+ size: 0.8
267
+ }),
268
+ disabled: working,
269
+ onClick: ()=>setEditingStages(pipeline.$id)
270
+ },
271
+ {
272
+ key: 'rename',
273
+ label: 'Rename',
274
+ icon: /*#__PURE__*/ _jsx(MdiIcon, {
275
+ path: mdiPencilOutline.path,
276
+ size: 0.8
277
+ }),
278
+ disabled: working,
279
+ onClick: ()=>setRenaming({
280
+ id: pipeline.$id,
281
+ name: pipeline.name
282
+ })
283
+ },
284
+ {
285
+ key: 'default',
286
+ label: 'Set as default',
287
+ icon: /*#__PURE__*/ _jsx(MdiIcon, {
288
+ path: mdiStarOutline.path,
289
+ size: 0.8
290
+ }),
291
+ disabled: working || Boolean(pipeline.isDefault),
292
+ disabledReason: pipeline.isDefault ? 'Already the default' : undefined,
293
+ onClick: ()=>handleSetDefault(pipeline)
294
+ },
295
+ {
296
+ key: 'archive',
297
+ label: 'Archive',
298
+ icon: /*#__PURE__*/ _jsx(MdiIcon, {
299
+ path: mdiArchiveArrowDownOutline.path,
300
+ size: 0.8
301
+ }),
302
+ disabled: working,
303
+ destructive: true,
304
+ onClick: ()=>void handleArchive(pipeline)
305
+ }
306
+ ];
307
+ };
308
+ const active = activePipelines(pipelines);
309
+ const archived = pipelines.filter((pipeline)=>isPipelineArchived(pipeline));
310
+ const stagesPipeline = editingStages ? (_pipelines_find = pipelines.find((pipeline)=>pipeline.$id === editingStages)) != null ? _pipelines_find : null : null;
311
+ const row = (pipeline)=>{
312
+ const stageCount = sortedStages(pipeline).filter((stage)=>stage.kind === 'open').length;
313
+ const isRenaming = (renaming == null ? void 0 : renaming.id) === pipeline.$id;
314
+ return /*#__PURE__*/ _jsx(Stack, {
315
+ direction: "row",
316
+ spacing: 1,
317
+ sx: {
318
+ alignItems: 'center',
319
+ py: 0.5
320
+ },
321
+ "data-pipeline-id": pipeline.$id,
322
+ children: isRenaming ? /*#__PURE__*/ _jsxs(_Fragment, {
323
+ children: [
324
+ /*#__PURE__*/ _jsx(TextField, {
325
+ size: "small",
326
+ label: "Name",
327
+ value: renaming.name,
328
+ autoFocus: true,
329
+ onChange: (event)=>setRenaming({
330
+ id: pipeline.$id,
331
+ name: event.target.value
332
+ }),
333
+ onKeyDown: (event)=>{
334
+ if (event.key === 'Enter') {
335
+ event.preventDefault();
336
+ void handleRename();
337
+ }
338
+ if (event.key === 'Escape') setRenaming(null);
339
+ },
340
+ sx: {
341
+ flex: 1
342
+ },
343
+ slotProps: {
344
+ htmlInput: {
345
+ maxLength: PIPELINE_NAME_MAX
346
+ }
347
+ }
348
+ }),
349
+ /*#__PURE__*/ _jsx(Button, {
350
+ size: "small",
351
+ onClick: ()=>setRenaming(null),
352
+ disabled: busy !== null,
353
+ children: 'Cancel'
354
+ }),
355
+ /*#__PURE__*/ _jsx(Button, {
356
+ size: "small",
357
+ variant: "contained",
358
+ disabled: busy !== null || !renaming.name.trim(),
359
+ onClick: ()=>void handleRename(),
360
+ children: 'Save'
361
+ })
362
+ ]
363
+ }) : /*#__PURE__*/ _jsxs(_Fragment, {
364
+ children: [
365
+ /*#__PURE__*/ _jsxs(Stack, {
366
+ sx: {
367
+ flex: 1,
368
+ minWidth: 0,
369
+ lineHeight: 1.25
370
+ },
371
+ children: [
372
+ /*#__PURE__*/ _jsx(Typography, {
373
+ variant: "body2",
374
+ noWrap: true,
375
+ children: pipeline.name || 'Untitled pipeline'
376
+ }),
377
+ /*#__PURE__*/ _jsx(Typography, {
378
+ variant: "caption",
379
+ color: "text.secondary",
380
+ children: `${stageCount} open ${stageCount === 1 ? 'stage' : 'stages'}`
381
+ })
382
+ ]
383
+ }),
384
+ pipeline.isDefault && !isPipelineArchived(pipeline) ? /*#__PURE__*/ _jsx(Chip, {
385
+ size: "small",
386
+ color: "primary",
387
+ variant: "outlined",
388
+ label: "Default"
389
+ }) : null,
390
+ isPipelineArchived(pipeline) ? /*#__PURE__*/ _jsx(Chip, {
391
+ size: "small",
392
+ label: "Archived"
393
+ }) : null,
394
+ /*#__PURE__*/ _jsx(RowActionsMenu, {
395
+ items: actionsFor(pipeline),
396
+ label: pipeline.name
397
+ })
398
+ ]
399
+ })
400
+ }, pipeline.$id);
401
+ };
402
+ return /*#__PURE__*/ _jsxs(_Fragment, {
403
+ children: [
404
+ /*#__PURE__*/ _jsxs(Dialog, {
405
+ open: open,
406
+ onClose: busy ? undefined : onClose,
407
+ fullWidth: true,
408
+ maxWidth: "sm",
409
+ children: [
410
+ /*#__PURE__*/ _jsx(DialogTitle, {
411
+ children: 'Pipelines'
412
+ }),
413
+ /*#__PURE__*/ _jsx(DialogContent, {
414
+ children: /*#__PURE__*/ _jsxs(Stack, {
415
+ spacing: 1,
416
+ sx: {
417
+ pt: 1
418
+ },
419
+ children: [
420
+ /*#__PURE__*/ _jsx(Typography, {
421
+ variant: "body2",
422
+ color: "text.secondary",
423
+ children: 'A pipeline is one way your business sells — its own stages, its own board. ' + 'New deals land in the default pipeline unless the drawer picks another.'
424
+ }),
425
+ active.length ? active.map(row) : /*#__PURE__*/ _jsx(Typography, {
426
+ variant: "body2",
427
+ color: "text.secondary",
428
+ children: 'No active pipeline. Create one below.'
429
+ }),
430
+ archived.length ? /*#__PURE__*/ _jsxs(_Fragment, {
431
+ children: [
432
+ /*#__PURE__*/ _jsx(Divider, {
433
+ sx: {
434
+ my: 1
435
+ }
436
+ }),
437
+ /*#__PURE__*/ _jsx(Typography, {
438
+ variant: "caption",
439
+ color: "text.secondary",
440
+ children: 'Archived — kept so closed deals still show their stages'
441
+ }),
442
+ archived.map(row)
443
+ ]
444
+ }) : null,
445
+ /*#__PURE__*/ _jsx(Divider, {
446
+ sx: {
447
+ my: 1
448
+ }
449
+ }),
450
+ /*#__PURE__*/ _jsxs(Stack, {
451
+ direction: "row",
452
+ spacing: 1,
453
+ sx: {
454
+ alignItems: 'flex-start'
455
+ },
456
+ children: [
457
+ /*#__PURE__*/ _jsx(TextField, {
458
+ size: "small",
459
+ label: "New pipeline",
460
+ placeholder: "Renewals",
461
+ value: newName,
462
+ onChange: (event)=>setNewName(event.target.value),
463
+ onKeyDown: (event)=>{
464
+ if (event.key !== 'Enter' || !newName.trim() || newProblem) return;
465
+ event.preventDefault();
466
+ void handleCreate();
467
+ },
468
+ error: Boolean(newProblem),
469
+ helperText: newProblem != null ? newProblem : 'Starts with the default stages, which you can then edit.',
470
+ sx: {
471
+ flex: 1
472
+ },
473
+ slotProps: {
474
+ htmlInput: {
475
+ maxLength: PIPELINE_NAME_MAX
476
+ }
477
+ }
478
+ }),
479
+ /*#__PURE__*/ _jsx(Button, {
480
+ variant: "contained",
481
+ disabled: busy !== null || !newName.trim() || Boolean(newProblem) || !(user == null ? void 0 : user.uid),
482
+ onClick: ()=>void handleCreate(),
483
+ sx: {
484
+ mt: 0.25
485
+ },
486
+ children: 'Create'
487
+ })
488
+ ]
489
+ })
490
+ ]
491
+ })
492
+ }),
493
+ /*#__PURE__*/ _jsx(DialogActions, {
494
+ children: /*#__PURE__*/ _jsx(Button, {
495
+ onClick: onClose,
496
+ disabled: busy !== null,
497
+ children: 'Done'
498
+ })
499
+ })
500
+ ]
501
+ }),
502
+ /*#__PURE__*/ _jsx(PipelineStagesDialog, {
503
+ open: Boolean(stagesPipeline),
504
+ onClose: ()=>setEditingStages(null),
505
+ orgId: orgId,
506
+ pipeline: stagesPipeline,
507
+ fromCache: fromCache,
508
+ unreadable: unreadable,
509
+ visibleToTokens: visibleToTokens
510
+ })
511
+ ]
512
+ });
513
+ }
514
+ PipelinesDialog.displayName = 'PipelinesDialog';
515
+ export default PipelinesDialog;
516
+
517
+ //# sourceMappingURL=pipelines-dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/pipelines-dialog.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 { CRM_COLLECTIONS, isPipelineArchived } from '@aglyn/aglyn'\nimport {\n mdiArchiveArrowDownOutline,\n mdiArchiveArrowUpOutline,\n mdiFormatListBulleted,\n mdiPencilOutline,\n mdiStarOutline,\n} from '@aglyn/shared-data-mdi'\nimport { MdiIcon } from '@aglyn/shared-ui-jsx'\nimport RowActionsMenu, {\n type RowActionsMenuItem,\n} from '@aglyn/shared-ui-jsx/components/row-actions-menu.component'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport {\n useFirestore,\n useUser,\n writeGuardedBySeed,\n} from '@aglyn/tenant-feature-instance'\nimport {\n Button,\n Chip,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n Divider,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport {\n addDoc,\n collection,\n doc,\n getCountFromServer,\n query,\n updateDoc,\n where,\n writeBatch,\n} from 'firebase/firestore'\nimport { useCallback, useEffect, useState } from 'react'\nimport {\n activePipelines,\n newPipelineDocument,\n PIPELINE_NAME_MAX,\n type PipelineDoc,\n pipelineArchiveRefusal,\n pipelineNameProblem,\n sortedStages,\n} from '../model/deal-board-model'\nimport { PipelineStagesDialog } from './pipeline-stages-dialog'\n\nexport interface PipelinesDialogProps {\n open: boolean\n onClose: () => void\n orgId: string\n /**\n * The site this console is viewed from — provenance on a pipeline created\n * here — or at the organization level the site the reader picked, `null`\n * until they have (AGL-2630): a pipeline made there is the org's.\n */\n hostId: string | null\n /** Every pipeline the viewer may read, archived ones included. */\n pipelines: PipelineDoc[]\n /** The listener's verdict on the rows, for the stale-seed guard. */\n fromCache: boolean\n unreadable: boolean\n /** The scope tokens the open-deal count is filtered by — the viewer's own. */\n visibleToTokens: readonly string[]\n /** What a pipeline created here is stamped with. */\n createTokens: readonly string[]\n}\n\n/**\n * The org's pipelines (AGL-2620): list, create, rename, set as default,\n * archive, and a door into each one's stages.\n *\n * ## Org documents, scoped like every CRM row\n *\n * A pipeline lives at `orgs/{orgId}/pipelines` and is stamped with the same\n * scope tokens a contact captured on this site would carry, so an agency's\n * client sees its own pipelines and the org-wide ones — the same rule the\n * board reads by. Nothing here assumes one site: the tokens come in as\n * props from `useCrmScope`, and an org-level mount passes its own.\n *\n * ## What each verb writes\n *\n * - **New pipeline** — one `addDoc` of `newPipelineDocument`: a COPY of the\n * default stages, not the default, active. The field sits UNDER the list.\n * - **Rename** — `name` on the one document, refused when an active\n * pipeline already has the name (`pipelineNameProblem`).\n * - **Set as default** — one batch: the flag on, and off on every other\n * document that had it. A batch rather than two updates because two\n * defaults for the length of a network round trip is a board that opens\n * on either.\n * - **Archive** — `archivedAt: now`, after the server has counted the\n * pipeline's OPEN deals and `pipelineArchiveRefusal` has agreed; the\n * count is taken at the click because a deal can be created into the\n * pipeline from another tab meanwhile. The default pipeline and the last\n * active one refuse. **Restore** clears the stamp.\n * - **Edit stages** — opens the stages dialog for that pipeline, unchanged.\n */\nexport function PipelinesDialog(props: PipelinesDialogProps) {\n const {\n open,\n onClose,\n orgId,\n hostId,\n pipelines,\n fromCache,\n unreadable,\n visibleToTokens,\n createTokens,\n } = props\n const firestore = useFirestore()\n const { enqueueSnackbar } = useSnackbar()\n const { data: user } = useUser()\n const [busy, setBusy] = useState<string | null>(null)\n const [newName, setNewName] = useState('')\n const [renaming, setRenaming] = useState<{ id: string; name: string } | null>(null)\n const [editingStages, setEditingStages] = useState<string | null>(null)\n\n useEffect(() => {\n if (!open) return\n setNewName('')\n setRenaming(null)\n setEditingStages(null)\n }, [open])\n\n const pipelineRef = useCallback(\n (id: string) => doc(firestore, 'orgs', orgId, CRM_COLLECTIONS.pipelines, id),\n [firestore, orgId],\n )\n\n /** One guarded write, reported as a snackbar either way. */\n const run = useCallback(\n async (key: string, write: () => Promise<void>, done: string) => {\n setBusy(key)\n try {\n const verdict = await writeGuardedBySeed(\n { subject: 'pipeline', unreadable, fromCache },\n write,\n )\n if (!verdict.ok) {\n enqueueSnackbar(verdict.message, { variant: 'warning', persist: false })\n return false\n }\n enqueueSnackbar(done, { variant: 'success', persist: false })\n return true\n } catch (error) {\n console.error(error)\n enqueueSnackbar('An error has occurred', { variant: 'error', allowDuplicate: true })\n return false\n } finally {\n setBusy(null)\n }\n },\n [unreadable, fromCache, enqueueSnackbar],\n )\n\n const newProblem = newName.trim() ? pipelineNameProblem(newName, pipelines) : null\n const handleCreate = useCallback(async () => {\n if (!user?.uid || newProblem || !newName.trim()) return\n const ok = await run(\n 'create',\n async () => {\n await addDoc(\n collection(firestore, 'orgs', orgId, CRM_COLLECTIONS.pipelines),\n newPipelineDocument(newName, {\n visibleTo: createTokens,\n hostId,\n uid: user.uid,\n nowMs: Date.now(),\n }),\n )\n },\n 'Pipeline created',\n )\n if (ok) setNewName('')\n }, [user, newProblem, newName, run, firestore, orgId, createTokens, hostId])\n\n const handleRename = useCallback(async () => {\n if (!renaming) return\n const problem = pipelineNameProblem(renaming.name, pipelines, renaming.id)\n if (problem) {\n enqueueSnackbar(problem, { variant: 'warning', persist: false })\n return\n }\n const ok = await run(\n `rename:${renaming.id}`,\n async () => {\n await updateDoc(pipelineRef(renaming.id), {\n name: renaming.name.trim().slice(0, PIPELINE_NAME_MAX),\n updatedAt: new Date(),\n })\n },\n 'Pipeline renamed',\n )\n if (ok) setRenaming(null)\n }, [renaming, pipelines, enqueueSnackbar, run, pipelineRef])\n\n const handleSetDefault = useCallback(\n (pipeline: PipelineDoc) =>\n void run(\n `default:${pipeline.$id}`,\n async () => {\n const batch = writeBatch(firestore)\n const now = new Date()\n for (const entry of pipelines) {\n if (entry.$id === pipeline.$id) {\n batch.update(pipelineRef(entry.$id), { isDefault: true, updatedAt: now })\n } else if (entry.isDefault) {\n batch.update(pipelineRef(entry.$id), { isDefault: false, updatedAt: now })\n }\n }\n await batch.commit()\n },\n `${pipeline.name} is now the default pipeline`,\n ),\n [run, firestore, pipelines, pipelineRef],\n )\n\n const handleArchive = useCallback(\n async (pipeline: PipelineDoc) => {\n setBusy(`archive:${pipeline.$id}`)\n let openDeals: number\n try {\n const snapshot = await getCountFromServer(\n query(\n collection(firestore, 'orgs', orgId, CRM_COLLECTIONS.deals),\n where('visibleTo', 'array-contains-any', [...visibleToTokens]),\n where('pipelineId', '==', pipeline.$id),\n where('status', '==', 'open'),\n ),\n )\n openDeals = snapshot.data().count\n } catch (error) {\n console.error(error)\n setBusy(null)\n enqueueSnackbar('The open deals in this pipeline could not be counted, so it stays.', {\n variant: 'error',\n allowDuplicate: true,\n })\n return\n }\n const refusal = pipelineArchiveRefusal(pipeline, pipelines, openDeals)\n if (refusal) {\n setBusy(null)\n enqueueSnackbar(refusal, { variant: 'warning', persist: false })\n return\n }\n await run(\n `archive:${pipeline.$id}`,\n async () => {\n await updateDoc(pipelineRef(pipeline.$id), {\n archivedAt: Date.now(),\n isDefault: false,\n updatedAt: new Date(),\n })\n },\n `${pipeline.name} archived`,\n )\n },\n [firestore, orgId, visibleToTokens, pipelines, run, pipelineRef, enqueueSnackbar],\n )\n\n const handleRestore = useCallback(\n (pipeline: PipelineDoc) => {\n const problem = pipelineNameProblem(pipeline.name, pipelines, pipeline.$id)\n if (problem) {\n enqueueSnackbar(`${problem} Rename it after restoring, or rename the other one first.`, {\n variant: 'warning',\n persist: false,\n })\n return\n }\n void run(\n `restore:${pipeline.$id}`,\n async () => {\n await updateDoc(pipelineRef(pipeline.$id), { archivedAt: null, updatedAt: new Date() })\n },\n `${pipeline.name} restored`,\n )\n },\n [pipelines, enqueueSnackbar, run, pipelineRef],\n )\n\n const actionsFor = (pipeline: PipelineDoc): RowActionsMenuItem[] => {\n const archived = isPipelineArchived(pipeline)\n const working = busy !== null\n return archived\n ? [\n {\n key: 'restore',\n label: 'Restore',\n icon: <MdiIcon path={mdiArchiveArrowUpOutline.path} size={0.8} />,\n disabled: working,\n onClick: () => handleRestore(pipeline),\n },\n ]\n : [\n {\n key: 'stages',\n label: 'Edit stages',\n icon: <MdiIcon path={mdiFormatListBulleted.path} size={0.8} />,\n disabled: working,\n onClick: () => setEditingStages(pipeline.$id),\n },\n {\n key: 'rename',\n label: 'Rename',\n icon: <MdiIcon path={mdiPencilOutline.path} size={0.8} />,\n disabled: working,\n onClick: () => setRenaming({ id: pipeline.$id, name: pipeline.name }),\n },\n {\n key: 'default',\n label: 'Set as default',\n icon: <MdiIcon path={mdiStarOutline.path} size={0.8} />,\n disabled: working || Boolean(pipeline.isDefault),\n disabledReason: pipeline.isDefault ? 'Already the default' : undefined,\n onClick: () => handleSetDefault(pipeline),\n },\n {\n key: 'archive',\n label: 'Archive',\n icon: <MdiIcon path={mdiArchiveArrowDownOutline.path} size={0.8} />,\n disabled: working,\n destructive: true,\n onClick: () => void handleArchive(pipeline),\n },\n ]\n }\n\n const active = activePipelines(pipelines)\n const archived = pipelines.filter((pipeline) => isPipelineArchived(pipeline))\n const stagesPipeline = editingStages\n ? (pipelines.find((pipeline) => pipeline.$id === editingStages) ?? null)\n : null\n\n const row = (pipeline: PipelineDoc) => {\n const stageCount = sortedStages(pipeline).filter((stage) => stage.kind === 'open').length\n const isRenaming = renaming?.id === pipeline.$id\n return (\n <Stack\n key={pipeline.$id}\n direction=\"row\"\n spacing={1}\n sx={{ alignItems: 'center', py: 0.5 }}\n data-pipeline-id={pipeline.$id}\n >\n {isRenaming ? (\n <>\n <TextField\n size=\"small\"\n label=\"Name\"\n value={renaming.name}\n autoFocus\n onChange={(event) => setRenaming({ id: pipeline.$id, name: event.target.value })}\n onKeyDown={(event) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n void handleRename()\n }\n if (event.key === 'Escape') setRenaming(null)\n }}\n sx={{ flex: 1 }}\n slotProps={{ htmlInput: { maxLength: PIPELINE_NAME_MAX } }}\n />\n <Button size=\"small\" onClick={() => setRenaming(null)} disabled={busy !== null}>\n {'Cancel'}\n </Button>\n <Button\n size=\"small\"\n variant=\"contained\"\n disabled={busy !== null || !renaming.name.trim()}\n onClick={() => void handleRename()}\n >\n {'Save'}\n </Button>\n </>\n ) : (\n <>\n <Stack sx={{ flex: 1, minWidth: 0, lineHeight: 1.25 }}>\n <Typography variant=\"body2\" noWrap>\n {pipeline.name || 'Untitled pipeline'}\n </Typography>\n <Typography variant=\"caption\" color=\"text.secondary\">\n {`${stageCount} open ${stageCount === 1 ? 'stage' : 'stages'}`}\n </Typography>\n </Stack>\n {pipeline.isDefault && !isPipelineArchived(pipeline) ? (\n <Chip size=\"small\" color=\"primary\" variant=\"outlined\" label=\"Default\" />\n ) : null}\n {isPipelineArchived(pipeline) ? <Chip size=\"small\" label=\"Archived\" /> : null}\n <RowActionsMenu items={actionsFor(pipeline)} label={pipeline.name} />\n </>\n )}\n </Stack>\n )\n }\n\n return (\n <>\n <Dialog open={open} onClose={busy ? undefined : onClose} fullWidth maxWidth=\"sm\">\n <DialogTitle>{'Pipelines'}</DialogTitle>\n <DialogContent>\n <Stack spacing={1} sx={{ pt: 1 }}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'A pipeline is one way your business sells — its own stages, its own board. ' +\n 'New deals land in the default pipeline unless the drawer picks another.'}\n </Typography>\n {active.length ? (\n active.map(row)\n ) : (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'No active pipeline. Create one below.'}\n </Typography>\n )}\n {archived.length ? (\n <>\n <Divider sx={{ my: 1 }} />\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'Archived — kept so closed deals still show their stages'}\n </Typography>\n {archived.map(row)}\n </>\n ) : null}\n <Divider sx={{ my: 1 }} />\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'flex-start' }}>\n <TextField\n size=\"small\"\n label=\"New pipeline\"\n placeholder=\"Renewals\"\n value={newName}\n onChange={(event) => setNewName(event.target.value)}\n onKeyDown={(event) => {\n if (event.key !== 'Enter' || !newName.trim() || newProblem) return\n event.preventDefault()\n void handleCreate()\n }}\n error={Boolean(newProblem)}\n helperText={newProblem ?? 'Starts with the default stages, which you can then edit.'}\n sx={{ flex: 1 }}\n slotProps={{ htmlInput: { maxLength: PIPELINE_NAME_MAX } }}\n />\n <Button\n variant=\"contained\"\n disabled={busy !== null || !newName.trim() || Boolean(newProblem) || !user?.uid}\n onClick={() => void handleCreate()}\n sx={{ mt: 0.25 }}\n >\n {'Create'}\n </Button>\n </Stack>\n </Stack>\n </DialogContent>\n <DialogActions>\n <Button onClick={onClose} disabled={busy !== null}>\n {'Done'}\n </Button>\n </DialogActions>\n </Dialog>\n <PipelineStagesDialog\n open={Boolean(stagesPipeline)}\n onClose={() => setEditingStages(null)}\n orgId={orgId}\n pipeline={stagesPipeline}\n fromCache={fromCache}\n unreadable={unreadable}\n visibleToTokens={visibleToTokens}\n />\n </>\n )\n}\nPipelinesDialog.displayName = 'PipelinesDialog'\n\nexport default PipelinesDialog\n"],"names":["CRM_COLLECTIONS","isPipelineArchived","mdiArchiveArrowDownOutline","mdiArchiveArrowUpOutline","mdiFormatListBulleted","mdiPencilOutline","mdiStarOutline","MdiIcon","RowActionsMenu","useSnackbar","useFirestore","useUser","writeGuardedBySeed","Button","Chip","Dialog","DialogActions","DialogContent","DialogTitle","Divider","Stack","TextField","Typography","addDoc","collection","doc","getCountFromServer","query","updateDoc","where","writeBatch","useCallback","useEffect","useState","activePipelines","newPipelineDocument","PIPELINE_NAME_MAX","pipelineArchiveRefusal","pipelineNameProblem","sortedStages","PipelineStagesDialog","PipelinesDialog","props","pipelines","open","onClose","orgId","hostId","fromCache","unreadable","visibleToTokens","createTokens","firestore","enqueueSnackbar","data","user","busy","setBusy","newName","setNewName","renaming","setRenaming","editingStages","setEditingStages","pipelineRef","id","run","key","write","done","verdict","subject","ok","message","variant","persist","error","console","allowDuplicate","newProblem","trim","handleCreate","uid","visibleTo","nowMs","Date","now","handleRename","problem","name","slice","updatedAt","handleSetDefault","pipeline","$id","batch","entry","update","isDefault","commit","handleArchive","openDeals","snapshot","deals","count","refusal","archivedAt","handleRestore","actionsFor","archived","working","label","icon","path","size","disabled","onClick","Boolean","disabledReason","undefined","destructive","active","filter","stagesPipeline","find","row","stageCount","stage","kind","length","isRenaming","direction","spacing","sx","alignItems","py","data-pipeline-id","value","autoFocus","onChange","event","target","onKeyDown","preventDefault","flex","slotProps","htmlInput","maxLength","minWidth","lineHeight","noWrap","color","items","fullWidth","maxWidth","pt","map","my","placeholder","helperText","mt","displayName"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA,SAASA,eAAe,EAAEC,kBAAkB,QAAQ,eAAc;AAClE,SACEC,0BAA0B,EAC1BC,wBAAwB,EACxBC,qBAAqB,EACrBC,gBAAgB,EAChBC,cAAc,QACT,yBAAwB;AAC/B,SAASC,OAAO,QAAQ,uBAAsB;AAC9C,OAAOC,oBAEA,6DAA4D;AACnE,SAASC,WAAW,QAAQ,8BAA6B;AACzD,SACEC,YAAY,EACZC,OAAO,EACPC,kBAAkB,QACb,iCAAgC;AACvC,SACEC,MAAM,EACNC,IAAI,EACJC,MAAM,EACNC,aAAa,EACbC,aAAa,EAC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AACJ,KAAK;4CAClDK,WAAW,CAACF;gDACV,IAAIA,MAAMzE,GAAG,KAAK,WAAW,CAACT,QAAQsB,IAAI,MAAMD,YAAY;gDAC5D6D,MAAMG,cAAc;gDACpB,KAAK9D;4CACP;4CACAL,OAAOyC,QAAQtC;4CACfgF,UAAU,EAAEhF,qBAAAA,aAAc;4CAC1BsD,IAAI;gDAAEW,MAAM;4CAAE;4CACdC,WAAW;gDAAEC,WAAW;oDAAEC,WAAW/G;gDAAkB;4CAAE;;sDAE3D,KAACvB;4CACC6D,SAAQ;4CACRyC,UAAU3D,SAAS,QAAQ,CAACE,QAAQsB,IAAI,MAAMqC,QAAQtC,eAAe,EAACxB,wBAAAA,KAAM2B,GAAG;4CAC/EkC,SAAS,IAAM,KAAKnC;4CACpBoD,IAAI;gDAAE2B,IAAI;4CAAK;sDAEd;;;;;;;kCAKT,KAAChJ;kCACC,cAAA,KAACH;4BAAOuG,SAASvE;4BAASsE,UAAU3D,SAAS;sCAC1C;;;;;0BAIP,KAAChB;gBACCI,MAAMyE,QAAQM;gBACd9E,SAAS,IAAMkB,iBAAiB;gBAChCjB,OAAOA;gBACP+C,UAAU8B;gBACV3E,WAAWA;gBACXC,YAAYA;gBACZC,iBAAiBA;;;;AAIzB;AACAT,gBAAgBwH,WAAW,GAAG;AAE9B,eAAexH,gBAAe"}
@@ -0,0 +1,39 @@
1
+ import { type CrmOrg } from './activity-queries';
2
+ /** The feed's default depth — a glance, not a log. */
3
+ export declare const RECENT_ACTIVITY_LIMIT = 10;
4
+ export interface RecentActivityFeedProps {
5
+ /** The site the record is read under, or `null` at the organization level. */
6
+ hostId: string | null;
7
+ org: CrmOrg;
8
+ /** The newest this many, across every record. */
9
+ limit?: number;
10
+ /**
11
+ * The hub's mount path, for the link each row carries to its record. The
12
+ * shell supplies it on every hub page; a mount without one draws the
13
+ * record's label with no link rather than a link into nowhere.
14
+ */
15
+ basePath?: string;
16
+ }
17
+ /**
18
+ * The newest logged activity across the CRM (AGL-2600): the last few calls,
19
+ * emails, meetings and notes anyone on the team filed against any record,
20
+ * each linking to the record it is about.
21
+ *
22
+ * What the contacts landing shows under its list, so that opening the CRM
23
+ * answers "what has the team been doing" before anybody opens a record. One
24
+ * bounded listener on `(visibleTo, atMs DESC)` — the index that exists for
25
+ * exactly this query — filtered to what this reader may see, the same
26
+ * predicate the rules evaluate. Bounded to `limit` and no further: a feed
27
+ * is a glance, and the record's own page is where the whole log lives.
28
+ *
29
+ * A row links to its CONTACT when it has one, else its deal, else its
30
+ * company — `crmActivityRecordLink`'s precedence — through `crmRoutes`, so
31
+ * the address it builds is the one the hub resolves. Nothing is looked up
32
+ * to name the record: a name per row would be a document read per row of a
33
+ * feed drawn on every visit to the list, and the record's page names itself.
34
+ */
35
+ export declare function RecentActivityFeed(props: RecentActivityFeedProps): import("react").JSX.Element;
36
+ export declare namespace RecentActivityFeed {
37
+ var displayName: string;
38
+ }
39
+ export default RecentActivityFeed;