@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,483 @@
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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
+ import { CRM_COLLECTIONS, findOrgMember } from "@aglyn/aglyn";
20
+ import { useConfirmationContext } from "@aglyn/shared-ui-jsx";
21
+ import { useSnackbar } from "@aglyn/shared-ui-snackstack";
22
+ import { useFirestore, useUser, writeGuardedBySeed } from "@aglyn/tenant-feature-instance";
23
+ import { Button, Drawer, MenuItem, Stack, TextField, Typography } from "@mui/material";
24
+ import { deleteDoc, doc } from "firebase/firestore";
25
+ import { useState } from "react";
26
+ import { useOrgMemberDirectory } from "../hooks/use-org-member-directory.js";
27
+ import { refreshCrmNextActivity } from "../model/next-activity-api.js";
28
+ import { saveCrmTask } from "../model/task-api.js";
29
+ import { CRM_TASK_NOTES_MAX, CRM_TASK_TITLE_MAX, crmTaskFieldsOf } from "../model/task-routes.js";
30
+ import { CRM_TASK_KIND_LABELS, CRM_TASK_KINDS, CRM_TASK_PRIORITIES, CRM_TASK_PRIORITY_LABELS, dueAtToLocalInput, localInputToDueAt } from "../model/task-views.js";
31
+ import { useCrmOrgMount } from "../hooks/use-crm-org-mount.js";
32
+ import { useCrmScope } from "../hooks/use-crm-scope.js";
33
+ import { isOrgTask } from "../model/task-scope.js";
34
+ import CrmRecordPicker from "./crm-record-picker.js";
35
+ import { CrmSitePicker } from "./crm-site-picker.js";
36
+ import TaskSnoozeMenu from "./task-snooze-menu.js";
37
+ /**
38
+ * Create or edit one task (AGL-2599).
39
+ *
40
+ * A drawer on the list, the console's standing shape for creating — the
41
+ * list stays where it was and the form slides over it. The same drawer edits,
42
+ * because a task is small enough that "the record's own page" would be this
43
+ * form with more air around it.
44
+ *
45
+ * The form is mounted only while the drawer is open and keyed by the task,
46
+ * so opening a different task or "New task" after an edit starts from that
47
+ * task's values and not from whatever was last typed.
48
+ */ export function TaskEditDrawer(props) {
49
+ var _ref;
50
+ const { open, onClose, task } = props;
51
+ return /*#__PURE__*/ _jsx(Drawer, {
52
+ anchor: "right",
53
+ open: open,
54
+ onClose: onClose,
55
+ children: open ? /*#__PURE__*/ _jsx(TaskForm, _extends({}, props), (_ref = task == null ? void 0 : task.$id) != null ? _ref : 'new') : null
56
+ });
57
+ }
58
+ TaskEditDrawer.displayName = 'TaskEditDrawer';
59
+ function TaskForm(props) {
60
+ var _ref, _task_hostId, _ref1, _ref2, _directory_error;
61
+ const { onClose, hostId, org, orgId, scope, readTokens, task, prefill, seed, onSaved } = props;
62
+ const firestore = useFirestore();
63
+ const { data: user } = useUser();
64
+ const { enqueueSnackbar } = useSnackbar();
65
+ const { confirm } = useConfirmationContext();
66
+ const directory = useOrgMemberDirectory(orgId);
67
+ const mount = useCrmOrgMount();
68
+ // The viewing group under a site, for a linked contact's facet name; null
69
+ // at the organization level, where the picker names each contact through
70
+ // its own holder. The site the route files a NEW task from is the mounted
71
+ // one or the picked one — or none, when the reader files the task with
72
+ // the organization itself; an edit goes back to the task's own.
73
+ const { consentGroup, createHostId } = useCrmScope({
74
+ hostId,
75
+ org
76
+ });
77
+ const groupId = (_ref = consentGroup == null ? void 0 : consentGroup.groupId) != null ? _ref : null;
78
+ const [noSite, setNoSite] = useState(false);
79
+ const filedFrom = task ? (_task_hostId = task.hostId) != null ? _task_hostId : null : noSite ? null : createHostId;
80
+ /*
81
+ * Whether the form knows where the task goes: an edit always does (the
82
+ * document does), and a create does once a site is picked or the
83
+ * organization is. `filedFrom` alone cannot say — it is null for both
84
+ * "not yet picked" and "the organization's own".
85
+ */ const filed = Boolean(task) || noSite || Boolean(createHostId);
86
+ /*
87
+ * Which level the route runs at: the site the drawer is mounted under, or
88
+ * the organization, with the site a NEW task is filed from named beside
89
+ * it. An edit names no site — the route reads the task's own.
90
+ */ const routeScope = hostId ? {
91
+ hostId
92
+ } : orgId ? _extends({
93
+ orgId
94
+ }, task || !filedFrom ? {} : {
95
+ hostId: filedFrom
96
+ }) : null;
97
+ const [fields, setFields] = useState(()=>{
98
+ var _ref;
99
+ const base = crmTaskFieldsOf(task != null ? task : {});
100
+ if (task) return base;
101
+ // A new task is the creator's own unless a button said otherwise: it
102
+ // lands in "My tasks", and assigning it elsewhere is a choice made in
103
+ // the picker rather than a default that notifies a teammate by accident.
104
+ // Its reminder is left UNSAID (AGL-2659) — the field shows the due time
105
+ // and the route decides — until the person touches it.
106
+ return _extends({}, base, {
107
+ remindAtMs: undefined,
108
+ assigneeUid: (_ref = user == null ? void 0 : user.uid) != null ? _ref : null
109
+ }, prefill);
110
+ });
111
+ const assignee = findOrgMember(directory.members, fields.assigneeUid);
112
+ const [busy, setBusy] = useState(false);
113
+ const [error, setError] = useState(null);
114
+ const set = (key, value)=>setFields((prev)=>_extends({}, prev, {
115
+ [key]: value
116
+ }));
117
+ /*
118
+ * The due date, and the reminder with it (AGL-2659): a reminder left
119
+ * unsaid shows the due time and needs no help, and one a person set to
120
+ * the due time follows it here as the route would follow it — so what
121
+ * the field shows after the change is what the save will store.
122
+ */ const setDue = (dueAtMs)=>setFields((prev)=>_extends({}, prev, {
123
+ dueAtMs
124
+ }, typeof prev.remindAtMs === 'number' && prev.remindAtMs === prev.dueAtMs ? {
125
+ remindAtMs: dueAtMs
126
+ } : {}));
127
+ /** What the reminder field shows: the due time while nothing is said. */ const remindAtMs = fields.remindAtMs === undefined ? fields.dueAtMs : fields.remindAtMs;
128
+ const reminderHelp = remindAtMs === null ? 'No reminder.' : remindAtMs === fields.dueAtMs ? 'At the due time — the assignee is reminded in the console and by email.' : 'The assignee is reminded in the console and by email.';
129
+ const save = async ()=>{
130
+ if (!fields.title.trim()) {
131
+ setError('A task needs a title.');
132
+ return;
133
+ }
134
+ if (!filed) {
135
+ setError('Pick the site this task is filed from, or file it with the organization.');
136
+ return;
137
+ }
138
+ if (!routeScope) {
139
+ setError('The organization is still loading. Try again in a moment.');
140
+ return;
141
+ }
142
+ setBusy(true);
143
+ setError(null);
144
+ try {
145
+ const write = async ()=>{
146
+ const result = await saveCrmTask(user, _extends({}, routeScope, task ? {
147
+ taskId: task.$id
148
+ } : {}, {
149
+ task: _extends({}, fields, {
150
+ title: fields.title.trim()
151
+ })
152
+ }));
153
+ enqueueSnackbar(task ? 'Task saved' : result.notified ? 'Task created and the assignee notified' : 'Task created', {
154
+ variant: 'success'
155
+ });
156
+ onSaved == null ? void 0 : onSaved(result.taskId);
157
+ onClose();
158
+ };
159
+ if (task) {
160
+ var _ref, _ref1;
161
+ const verdict = await writeGuardedBySeed({
162
+ subject: 'task',
163
+ fromCache: (_ref = seed == null ? void 0 : seed.fromCache) != null ? _ref : false,
164
+ unreadable: (_ref1 = seed == null ? void 0 : seed.unreadable) != null ? _ref1 : false
165
+ }, write);
166
+ if (!verdict.ok) {
167
+ var _verdict_message;
168
+ enqueueSnackbar((_verdict_message = verdict.message) != null ? _verdict_message : 'The task could not be saved.', {
169
+ variant: 'warning'
170
+ });
171
+ }
172
+ } else {
173
+ await write();
174
+ }
175
+ } catch (cause) {
176
+ setError(cause instanceof Error ? cause.message : 'The task could not be saved.');
177
+ } finally{
178
+ setBusy(false);
179
+ }
180
+ };
181
+ /*
182
+ * Deleting is client-direct: it has no side effect outside the document,
183
+ * and the rules gate it on the same predicate as any other CRM write.
184
+ */ const remove = async ()=>{
185
+ if (!task || !scope) return;
186
+ const confirmed = await confirm({
187
+ title: 'Delete this task?',
188
+ description: `"${task.title}" is removed for everyone who can see it. Completed tasks can be kept instead — tick it done.`,
189
+ confirmationText: 'Delete',
190
+ confirmationButtonProps: {
191
+ color: 'error'
192
+ }
193
+ });
194
+ if (!confirmed) return;
195
+ setBusy(true);
196
+ try {
197
+ await deleteDoc(doc(firestore, scope[0], scope[1], CRM_COLLECTIONS.tasks, task.$id));
198
+ enqueueSnackbar('Task deleted', {
199
+ variant: 'success'
200
+ });
201
+ onClose();
202
+ // A client-direct write: the records it named are told (AGL-2661).
203
+ await refreshCrmNextActivity(user, routeScope, [
204
+ task
205
+ ]);
206
+ } catch (cause) {
207
+ setError(cause instanceof Error ? cause.message : 'The task could not be deleted.');
208
+ } finally{
209
+ setBusy(false);
210
+ }
211
+ };
212
+ return /*#__PURE__*/ _jsxs(Stack, {
213
+ component: "form",
214
+ spacing: 2,
215
+ sx: {
216
+ width: {
217
+ xs: '100vw',
218
+ sm: 420
219
+ },
220
+ p: 3
221
+ },
222
+ onSubmit: (event)=>{
223
+ event.preventDefault();
224
+ void save();
225
+ },
226
+ children: [
227
+ /*#__PURE__*/ _jsx(Typography, {
228
+ variant: "h6",
229
+ children: task ? 'Edit task' : 'New task'
230
+ }),
231
+ task ? null : /*#__PURE__*/ _jsx(CrmSitePicker, {
232
+ hostId: hostId,
233
+ disabled: busy,
234
+ noSite: {
235
+ label: 'This organization (no site)',
236
+ helperText: 'A task of the organization itself, listed from the ' + 'organization hub and from every site. Completing it runs no ' + "site's automations.",
237
+ picked: noSite,
238
+ onPick: setNoSite
239
+ }
240
+ }),
241
+ task && mount ? /*#__PURE__*/ _jsx(Typography, {
242
+ variant: "caption",
243
+ color: "text.secondary",
244
+ children: isOrgTask(task) ? 'Filed with the organization — no site.' : `Filed from ${mount.siteName(task.hostId)}.`
245
+ }) : null,
246
+ /*#__PURE__*/ _jsx(TextField, {
247
+ label: "Title",
248
+ value: fields.title,
249
+ onChange: (event)=>set('title', event.target.value),
250
+ size: "small",
251
+ autoFocus: true,
252
+ required: true,
253
+ slotProps: {
254
+ htmlInput: {
255
+ maxLength: CRM_TASK_TITLE_MAX
256
+ }
257
+ }
258
+ }),
259
+ /*#__PURE__*/ _jsxs(Stack, {
260
+ direction: "row",
261
+ spacing: 1,
262
+ children: [
263
+ /*#__PURE__*/ _jsx(TextField, {
264
+ select: true,
265
+ label: "Kind",
266
+ value: fields.kind,
267
+ onChange: (event)=>set('kind', event.target.value),
268
+ size: "small",
269
+ sx: {
270
+ flex: 1
271
+ },
272
+ children: CRM_TASK_KINDS.map((kind)=>/*#__PURE__*/ _jsx(MenuItem, {
273
+ value: kind,
274
+ children: CRM_TASK_KIND_LABELS[kind]
275
+ }, kind))
276
+ }),
277
+ /*#__PURE__*/ _jsx(TextField, {
278
+ select: true,
279
+ label: "Priority",
280
+ value: fields.priority,
281
+ onChange: (event)=>set('priority', event.target.value),
282
+ size: "small",
283
+ sx: {
284
+ flex: 1
285
+ },
286
+ children: CRM_TASK_PRIORITIES.map((priority)=>/*#__PURE__*/ _jsx(MenuItem, {
287
+ value: priority,
288
+ children: CRM_TASK_PRIORITY_LABELS[priority]
289
+ }, priority))
290
+ })
291
+ ]
292
+ }),
293
+ /*#__PURE__*/ _jsxs(Stack, {
294
+ direction: "row",
295
+ spacing: 1,
296
+ sx: {
297
+ alignItems: 'flex-start'
298
+ },
299
+ children: [
300
+ /*#__PURE__*/ _jsx(TextField, {
301
+ label: "Due",
302
+ type: "datetime-local",
303
+ value: dueAtToLocalInput(fields.dueAtMs),
304
+ onChange: (event)=>setDue(localInputToDueAt(event.target.value)),
305
+ size: "small",
306
+ slotProps: {
307
+ inputLabel: {
308
+ shrink: true
309
+ }
310
+ },
311
+ helperText: "Leave empty for a task with no due date.",
312
+ sx: {
313
+ flex: 1
314
+ }
315
+ }),
316
+ /*#__PURE__*/ _jsx(TaskSnoozeMenu, {
317
+ variant: "button",
318
+ dueAtMs: fields.dueAtMs,
319
+ remindAtMs: remindAtMs,
320
+ disabled: busy,
321
+ target: task && scope ? {
322
+ write: {
323
+ scope,
324
+ taskId: task.$id
325
+ }
326
+ } : {
327
+ pick: setDue
328
+ },
329
+ onSnoozed: setDue
330
+ })
331
+ ]
332
+ }),
333
+ /*#__PURE__*/ _jsxs(Stack, {
334
+ direction: "row",
335
+ spacing: 1,
336
+ sx: {
337
+ alignItems: 'flex-start'
338
+ },
339
+ children: [
340
+ /*#__PURE__*/ _jsx(TextField, {
341
+ label: "Remind me",
342
+ type: "datetime-local",
343
+ value: dueAtToLocalInput(remindAtMs),
344
+ onChange: (event)=>set('remindAtMs', localInputToDueAt(event.target.value)),
345
+ size: "small",
346
+ slotProps: {
347
+ inputLabel: {
348
+ shrink: true
349
+ }
350
+ },
351
+ helperText: reminderHelp,
352
+ sx: {
353
+ flex: 1
354
+ }
355
+ }),
356
+ /*#__PURE__*/ _jsx(Button, {
357
+ size: "small",
358
+ onClick: ()=>set('remindAtMs', null),
359
+ disabled: busy || remindAtMs === null,
360
+ children: 'No reminder'
361
+ })
362
+ ]
363
+ }),
364
+ /*#__PURE__*/ _jsxs(TextField, {
365
+ select: true,
366
+ label: "Assignee",
367
+ // The stored assignee resolved to a member — by uid, or by an
368
+ // address the roster has — so the picker highlights the person and
369
+ // a save writes their uid. One the roster does not hold is kept as
370
+ // its own option: a controlled select whose value is absent from
371
+ // its options renders empty, which reads as unassigned.
372
+ value: (_ref1 = (_ref2 = assignee == null ? void 0 : assignee.uid) != null ? _ref2 : fields.assigneeUid) != null ? _ref1 : '',
373
+ onChange: (event)=>set('assigneeUid', event.target.value || null),
374
+ size: "small",
375
+ disabled: directory.loading,
376
+ helperText: (_directory_error = directory.error) != null ? _directory_error : fields.assigneeUid && fields.assigneeUid !== (user == null ? void 0 : user.uid) ? 'They will be notified when you save.' : undefined,
377
+ children: [
378
+ /*#__PURE__*/ _jsx(MenuItem, {
379
+ value: "",
380
+ children: 'Unassigned'
381
+ }),
382
+ fields.assigneeUid && !assignee ? /*#__PURE__*/ _jsx(MenuItem, {
383
+ value: fields.assigneeUid,
384
+ children: directory.nameOf(fields.assigneeUid)
385
+ }) : null,
386
+ directory.members.map((member)=>/*#__PURE__*/ _jsxs(MenuItem, {
387
+ value: member.uid,
388
+ children: [
389
+ member.label,
390
+ member.uid === (user == null ? void 0 : user.uid) ? ' (you)' : ''
391
+ ]
392
+ }, member.uid))
393
+ ]
394
+ }),
395
+ /*#__PURE__*/ _jsx(Typography, {
396
+ variant: "overline",
397
+ color: "text.secondary",
398
+ children: 'Linked to'
399
+ }),
400
+ /*#__PURE__*/ _jsx(CrmRecordPicker, {
401
+ kind: "contact",
402
+ scope: scope,
403
+ readTokens: readTokens,
404
+ groupId: groupId,
405
+ org: org,
406
+ value: fields.contactId,
407
+ onChange: (id)=>set('contactId', id),
408
+ disabled: busy
409
+ }),
410
+ /*#__PURE__*/ _jsx(CrmRecordPicker, {
411
+ kind: "company",
412
+ scope: scope,
413
+ readTokens: readTokens,
414
+ groupId: groupId,
415
+ org: org,
416
+ value: fields.companyId,
417
+ onChange: (id)=>set('companyId', id),
418
+ disabled: busy
419
+ }),
420
+ /*#__PURE__*/ _jsx(CrmRecordPicker, {
421
+ kind: "deal",
422
+ scope: scope,
423
+ readTokens: readTokens,
424
+ groupId: groupId,
425
+ org: org,
426
+ value: fields.dealId,
427
+ onChange: (id)=>set('dealId', id),
428
+ disabled: busy
429
+ }),
430
+ /*#__PURE__*/ _jsx(TextField, {
431
+ label: "Notes",
432
+ value: fields.notes,
433
+ onChange: (event)=>set('notes', event.target.value),
434
+ size: "small",
435
+ multiline: true,
436
+ minRows: 3,
437
+ slotProps: {
438
+ htmlInput: {
439
+ maxLength: CRM_TASK_NOTES_MAX
440
+ }
441
+ }
442
+ }),
443
+ error ? /*#__PURE__*/ _jsx(Typography, {
444
+ variant: "body2",
445
+ color: "error",
446
+ children: error
447
+ }) : null,
448
+ /*#__PURE__*/ _jsxs(Stack, {
449
+ direction: "row",
450
+ spacing: 1,
451
+ sx: {
452
+ justifyContent: 'flex-end'
453
+ },
454
+ children: [
455
+ task ? /*#__PURE__*/ _jsx(Button, {
456
+ color: "error",
457
+ onClick: ()=>void remove(),
458
+ disabled: busy,
459
+ sx: {
460
+ mr: 'auto'
461
+ },
462
+ children: 'Delete'
463
+ }) : null,
464
+ /*#__PURE__*/ _jsx(Button, {
465
+ onClick: onClose,
466
+ disabled: busy,
467
+ children: 'Cancel'
468
+ }),
469
+ /*#__PURE__*/ _jsx(Button, {
470
+ type: "submit",
471
+ variant: "contained",
472
+ disabled: busy || !filed,
473
+ children: task ? 'Save' : 'Create task'
474
+ })
475
+ ]
476
+ })
477
+ ]
478
+ });
479
+ }
480
+ TaskForm.displayName = 'TaskForm';
481
+ export default TaskEditDrawer;
482
+
483
+ //# sourceMappingURL=task-edit-drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/task-edit-drawer.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, findOrgMember } from '@aglyn/aglyn'\nimport { useConfirmationContext } from '@aglyn/shared-ui-jsx'\nimport { useSnackbar } from '@aglyn/shared-ui-snackstack'\nimport {\n useFirestore,\n useUser,\n writeGuardedBySeed,\n} from '@aglyn/tenant-feature-instance'\nimport {\n Button,\n Drawer,\n MenuItem,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport { deleteDoc, doc } from 'firebase/firestore'\nimport { useMemo, useState } from 'react'\nimport type { CrmTaskRow } from '../hooks/use-crm-tasks'\nimport { useOrgMemberDirectory } from '../hooks/use-org-member-directory'\nimport { refreshCrmNextActivity } from '../model/next-activity-api'\nimport { saveCrmTask } from '../model/task-api'\nimport {\n CRM_TASK_NOTES_MAX,\n CRM_TASK_TITLE_MAX,\n type CrmTaskFields,\n crmTaskFieldsOf,\n} from '../model/task-routes'\nimport {\n CRM_TASK_KIND_LABELS,\n CRM_TASK_KINDS,\n CRM_TASK_PRIORITIES,\n CRM_TASK_PRIORITY_LABELS,\n dueAtToLocalInput,\n localInputToDueAt,\n} from '../model/task-views'\nimport { useCrmOrgMount } from '../hooks/use-crm-org-mount'\nimport { useCrmScope } from '../hooks/use-crm-scope'\nimport { isOrgTask } from '../model/task-scope'\nimport CrmRecordPicker from './crm-record-picker'\nimport { CrmSitePicker } from './crm-site-picker'\nimport TaskSnoozeMenu from './task-snooze-menu'\n\nexport interface TaskEditDrawerProps {\n open: boolean\n onClose: () => void\n /**\n * The site the drawer is opened under, or `null` at the organization\n * level (AGL-2630), where a NEW task asks which site it is filed from —\n * or whether it is the organization's own, with no site (AGL-2637) —\n * and an edit keeps the task's own.\n */\n hostId: string | null\n org?: Record<string, unknown> | null\n orgId: string | null | undefined\n scope: readonly [string, string] | null\n /** The reader's tokens, or `null` at the organization level — no clause. */\n readTokens: readonly string[] | null\n /** The task being edited; absent while creating. */\n task?: CrmTaskRow | null\n /**\n * What a \"New task\" button pressed on a record fills in before the person\n * types: the record's own id, so the link is made for them.\n */\n prefill?: Partial<CrmTaskFields>\n /**\n * The verdict of the listener the edited row came from. An edit is refused\n * when the seed is unconfirmed, for the reason the contacts drawer refuses:\n * every field on this form is written back on save, and a form seeded from\n * a stale cache writes the stale values over newer ones.\n */\n seed?: { fromCache: boolean; unreadable: boolean }\n onSaved?: (taskId: string) => void\n}\n\n/**\n * Create or edit one task (AGL-2599).\n *\n * A drawer on the list, the console's standing shape for creating — the\n * list stays where it was and the form slides over it. The same drawer edits,\n * because a task is small enough that \"the record's own page\" would be this\n * form with more air around it.\n *\n * The form is mounted only while the drawer is open and keyed by the task,\n * so opening a different task or \"New task\" after an edit starts from that\n * task's values and not from whatever was last typed.\n */\nexport function TaskEditDrawer(props: TaskEditDrawerProps) {\n const { open, onClose, task } = props\n return (\n <Drawer anchor=\"right\" open={open} onClose={onClose}>\n {open ? <TaskForm key={task?.$id ?? 'new'} {...props} /> : null}\n </Drawer>\n )\n}\nTaskEditDrawer.displayName = 'TaskEditDrawer'\n\nfunction TaskForm(props: TaskEditDrawerProps) {\n const { onClose, hostId, org, orgId, scope, readTokens, task, prefill, seed, onSaved } =\n props\n const firestore = useFirestore()\n const { data: user } = useUser()\n const { enqueueSnackbar } = useSnackbar()\n const { confirm } = useConfirmationContext()\n const directory = useOrgMemberDirectory(orgId)\n const mount = useCrmOrgMount()\n // The viewing group under a site, for a linked contact's facet name; null\n // at the organization level, where the picker names each contact through\n // its own holder. The site the route files a NEW task from is the mounted\n // one or the picked one — or none, when the reader files the task with\n // the organization itself; an edit goes back to the task's own.\n const { consentGroup, createHostId } = useCrmScope({ hostId, org })\n const groupId = consentGroup?.groupId ?? null\n const [noSite, setNoSite] = useState(false)\n const filedFrom = task ? (task.hostId ?? null) : noSite ? null : createHostId\n /*\n * Whether the form knows where the task goes: an edit always does (the\n * document does), and a create does once a site is picked or the\n * organization is. `filedFrom` alone cannot say — it is null for both\n * \"not yet picked\" and \"the organization's own\".\n */\n const filed = Boolean(task) || noSite || Boolean(createHostId)\n /*\n * Which level the route runs at: the site the drawer is mounted under, or\n * the organization, with the site a NEW task is filed from named beside\n * it. An edit names no site — the route reads the task's own.\n */\n const routeScope = hostId\n ? { hostId }\n : orgId\n ? { orgId, ...(task || !filedFrom ? {} : { hostId: filedFrom }) }\n : null\n\n const [fields, setFields] = useState<CrmTaskFields>(() => {\n const base = crmTaskFieldsOf(task ?? {})\n if (task) return base\n // A new task is the creator's own unless a button said otherwise: it\n // lands in \"My tasks\", and assigning it elsewhere is a choice made in\n // the picker rather than a default that notifies a teammate by accident.\n // Its reminder is left UNSAID (AGL-2659) — the field shows the due time\n // and the route decides — until the person touches it.\n return { ...base, remindAtMs: undefined, assigneeUid: user?.uid ?? null, ...prefill }\n })\n const assignee = findOrgMember(directory.members, fields.assigneeUid)\n const [busy, setBusy] = useState(false)\n const [error, setError] = useState<string | null>(null)\n\n const set = <K extends keyof CrmTaskFields>(key: K, value: CrmTaskFields[K]) =>\n setFields((prev) => ({ ...prev, [key]: value }))\n /*\n * The due date, and the reminder with it (AGL-2659): a reminder left\n * unsaid shows the due time and needs no help, and one a person set to\n * the due time follows it here as the route would follow it — so what\n * the field shows after the change is what the save will store.\n */\n const setDue = (dueAtMs: number | null) =>\n setFields((prev) => ({\n ...prev,\n dueAtMs,\n ...(typeof prev.remindAtMs === 'number' && prev.remindAtMs === prev.dueAtMs\n ? { remindAtMs: dueAtMs }\n : {}),\n }))\n /** What the reminder field shows: the due time while nothing is said. */\n const remindAtMs = fields.remindAtMs === undefined ? fields.dueAtMs : fields.remindAtMs\n const reminderHelp =\n remindAtMs === null\n ? 'No reminder.'\n : remindAtMs === fields.dueAtMs\n ? 'At the due time — the assignee is reminded in the console and by email.'\n : 'The assignee is reminded in the console and by email.'\n\n const save = async () => {\n if (!fields.title.trim()) {\n setError('A task needs a title.')\n return\n }\n if (!filed) {\n setError('Pick the site this task is filed from, or file it with the organization.')\n return\n }\n if (!routeScope) {\n setError('The organization is still loading. Try again in a moment.')\n return\n }\n setBusy(true)\n setError(null)\n try {\n const write = async () => {\n const result = await saveCrmTask(user, {\n ...routeScope,\n ...(task ? { taskId: task.$id } : {}),\n task: { ...fields, title: fields.title.trim() },\n })\n enqueueSnackbar(\n task\n ? 'Task saved'\n : result.notified\n ? 'Task created and the assignee notified'\n : 'Task created',\n { variant: 'success' },\n )\n onSaved?.(result.taskId)\n onClose()\n }\n if (task) {\n const verdict = await writeGuardedBySeed(\n {\n subject: 'task',\n fromCache: seed?.fromCache ?? false,\n unreadable: seed?.unreadable ?? false,\n },\n write,\n )\n if (!verdict.ok) {\n enqueueSnackbar(verdict.message ?? 'The task could not be saved.', {\n variant: 'warning',\n })\n }\n } else {\n await write()\n }\n } catch (cause) {\n setError(cause instanceof Error ? cause.message : 'The task could not be saved.')\n } finally {\n setBusy(false)\n }\n }\n\n /*\n * Deleting is client-direct: it has no side effect outside the document,\n * and the rules gate it on the same predicate as any other CRM write.\n */\n const remove = async () => {\n if (!task || !scope) return\n const confirmed = await confirm({\n title: 'Delete this task?',\n description: `\"${task.title}\" is removed for everyone who can see it. Completed tasks can be kept instead — tick it done.`,\n confirmationText: 'Delete',\n confirmationButtonProps: { color: 'error' },\n })\n if (!confirmed) return\n setBusy(true)\n try {\n await deleteDoc(\n doc(firestore, scope[0], scope[1], CRM_COLLECTIONS.tasks, task.$id),\n )\n enqueueSnackbar('Task deleted', { variant: 'success' })\n onClose()\n // A client-direct write: the records it named are told (AGL-2661).\n await refreshCrmNextActivity(user, routeScope, [task])\n } catch (cause) {\n setError(cause instanceof Error ? cause.message : 'The task could not be deleted.')\n } finally {\n setBusy(false)\n }\n }\n\n return (\n <Stack\n component=\"form\"\n spacing={2}\n sx={{ width: { xs: '100vw', sm: 420 }, p: 3 }}\n onSubmit={(event: { preventDefault: () => void }) => {\n event.preventDefault()\n void save()\n }}\n >\n <Typography variant=\"h6\">{task ? 'Edit task' : 'New task'}</Typography>\n {/* Only a new task at the organization level asks — see `filedFrom`. */}\n {task ? null : (\n <CrmSitePicker\n hostId={hostId}\n disabled={busy}\n noSite={{\n label: 'This organization (no site)',\n helperText:\n 'A task of the organization itself, listed from the ' +\n 'organization hub and from every site. Completing it runs no ' +\n \"site's automations.\",\n picked: noSite,\n onPick: setNoSite,\n }}\n />\n )}\n {/* An edit at the organization level says where the task is filed. */}\n {task && mount ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {isOrgTask(task)\n ? 'Filed with the organization — no site.'\n : `Filed from ${mount.siteName(task.hostId as string)}.`}\n </Typography>\n ) : null}\n <TextField\n label=\"Title\"\n value={fields.title}\n onChange={(event) => set('title', event.target.value)}\n size=\"small\"\n autoFocus\n required\n slotProps={{ htmlInput: { maxLength: CRM_TASK_TITLE_MAX } }}\n />\n <Stack direction=\"row\" spacing={1}>\n <TextField\n select\n label=\"Kind\"\n value={fields.kind}\n onChange={(event) => set('kind', event.target.value as CrmTaskFields['kind'])}\n size=\"small\"\n sx={{ flex: 1 }}\n >\n {CRM_TASK_KINDS.map((kind) => (\n <MenuItem key={kind} value={kind}>\n {CRM_TASK_KIND_LABELS[kind]}\n </MenuItem>\n ))}\n </TextField>\n <TextField\n select\n label=\"Priority\"\n value={fields.priority}\n onChange={(event) =>\n set('priority', event.target.value as CrmTaskFields['priority'])\n }\n size=\"small\"\n sx={{ flex: 1 }}\n >\n {CRM_TASK_PRIORITIES.map((priority) => (\n <MenuItem key={priority} value={priority}>\n {CRM_TASK_PRIORITY_LABELS[priority]}\n </MenuItem>\n ))}\n </TextField>\n </Stack>\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'flex-start' }}>\n <TextField\n label=\"Due\"\n type=\"datetime-local\"\n value={dueAtToLocalInput(fields.dueAtMs)}\n onChange={(event) => setDue(localInputToDueAt(event.target.value))}\n size=\"small\"\n slotProps={{ inputLabel: { shrink: true } }}\n helperText=\"Leave empty for a task with no due date.\"\n sx={{ flex: 1 }}\n />\n {/*\n A stored task is snoozed in place — the one write lands and the\n field follows it, so a later Save carries the same date. A task\n that does not exist yet has nothing to write, so the same menu\n fills the field and the save is the write.\n */}\n <TaskSnoozeMenu\n variant=\"button\"\n dueAtMs={fields.dueAtMs}\n remindAtMs={remindAtMs}\n disabled={busy}\n target={\n task && scope\n ? { write: { scope, taskId: task.$id } }\n : { pick: setDue }\n }\n onSnoozed={setDue}\n />\n </Stack>\n {/*\n The reminder (AGL-2659), beside the due date it follows by default.\n Its own field rather than a switch, because \"remind me an hour\n before\" is the second thing a person wants after \"remind me\".\n */}\n <Stack direction=\"row\" spacing={1} sx={{ alignItems: 'flex-start' }}>\n <TextField\n label=\"Remind me\"\n type=\"datetime-local\"\n value={dueAtToLocalInput(remindAtMs)}\n onChange={(event) => set('remindAtMs', localInputToDueAt(event.target.value))}\n size=\"small\"\n slotProps={{ inputLabel: { shrink: true } }}\n helperText={reminderHelp}\n sx={{ flex: 1 }}\n />\n <Button\n size=\"small\"\n onClick={() => set('remindAtMs', null)}\n disabled={busy || remindAtMs === null}\n >\n {'No reminder'}\n </Button>\n </Stack>\n <TextField\n select\n label=\"Assignee\"\n // The stored assignee resolved to a member — by uid, or by an\n // address the roster has — so the picker highlights the person and\n // a save writes their uid. One the roster does not hold is kept as\n // its own option: a controlled select whose value is absent from\n // its options renders empty, which reads as unassigned.\n value={assignee?.uid ?? fields.assigneeUid ?? ''}\n onChange={(event) => set('assigneeUid', event.target.value || null)}\n size=\"small\"\n disabled={directory.loading}\n helperText={\n directory.error ??\n (fields.assigneeUid && fields.assigneeUid !== user?.uid\n ? 'They will be notified when you save.'\n : undefined)\n }\n >\n <MenuItem value=\"\">{'Unassigned'}</MenuItem>\n {fields.assigneeUid && !assignee ? (\n <MenuItem value={fields.assigneeUid}>{directory.nameOf(fields.assigneeUid)}</MenuItem>\n ) : null}\n {directory.members.map((member) => (\n <MenuItem key={member.uid} value={member.uid}>\n {member.label}\n {member.uid === user?.uid ? ' (you)' : ''}\n </MenuItem>\n ))}\n </TextField>\n <Typography variant=\"overline\" color=\"text.secondary\">\n {'Linked to'}\n </Typography>\n <CrmRecordPicker\n kind=\"contact\"\n scope={scope}\n readTokens={readTokens}\n groupId={groupId}\n org={org}\n value={fields.contactId}\n onChange={(id) => set('contactId', id)}\n disabled={busy}\n />\n <CrmRecordPicker\n kind=\"company\"\n scope={scope}\n readTokens={readTokens}\n groupId={groupId}\n org={org}\n value={fields.companyId}\n onChange={(id) => set('companyId', id)}\n disabled={busy}\n />\n <CrmRecordPicker\n kind=\"deal\"\n scope={scope}\n readTokens={readTokens}\n groupId={groupId}\n org={org}\n value={fields.dealId}\n onChange={(id) => set('dealId', id)}\n disabled={busy}\n />\n <TextField\n label=\"Notes\"\n value={fields.notes}\n onChange={(event) => set('notes', event.target.value)}\n size=\"small\"\n multiline\n minRows={3}\n slotProps={{ htmlInput: { maxLength: CRM_TASK_NOTES_MAX } }}\n />\n {error ? (\n <Typography variant=\"body2\" color=\"error\">\n {error}\n </Typography>\n ) : null}\n <Stack direction=\"row\" spacing={1} sx={{ justifyContent: 'flex-end' }}>\n {task ? (\n <Button\n color=\"error\"\n onClick={() => void remove()}\n disabled={busy}\n sx={{ mr: 'auto' }}\n >\n {'Delete'}\n </Button>\n ) : null}\n <Button onClick={onClose} disabled={busy}>\n {'Cancel'}\n </Button>\n <Button type=\"submit\" variant=\"contained\" disabled={busy || !filed}>\n {task ? 'Save' : 'Create task'}\n </Button>\n </Stack>\n </Stack>\n )\n}\nTaskForm.displayName = 'TaskForm'\n\nexport default TaskEditDrawer\n"],"names":["CRM_COLLECTIONS","findOrgMember","useConfirmationContext","useSnackbar","useFirestore","useUser","writeGuardedBySeed","Button","Drawer","MenuItem","Stack","TextField","Typography","deleteDoc","doc","useState","useOrgMemberDirectory","refreshCrmNextActivity","saveCrmTask","CRM_TASK_NOTES_MAX","CRM_TASK_TITLE_MAX","crmTaskFieldsOf","CRM_TASK_KIND_LABELS","CRM_TASK_KINDS","CRM_TASK_PRIORITIES","CRM_TASK_PRIORITY_LABELS","dueAtToLocalInput","localInputToDueAt","useCrmOrgMount","useCrmScope","isOrgTask","CrmRecordPicker","CrmSitePicker","TaskSnoozeMenu","TaskEditDrawer","props","open","onClose","task","anchor","TaskForm","$id","displayName","assignee","directory","hostId","org","orgId","scope","readTokens","prefill","seed","onSaved","firestore","data","user","enqueueSnackbar","confirm","mount","consentGroup","createHostId","groupId","noSite","setNoSite","filedFrom","filed","Boolean","routeScope","fields","setFields","base","remindAtMs","undefined","assigneeUid","uid","members","busy","setBusy","error","setError","set","key","value","prev","setDue","dueAtMs","reminderHelp","save","title","trim","write","result","taskId","notified","variant","verdict","subject","fromCache","unreadable","ok","message","cause","Error","remove","confirmed","description","confirmationText","confirmationButtonProps","color","tasks","component","spacing","sx","width","xs","sm","p","onSubmit","event","preventDefault","disabled","label","helperText","picked","onPick","siteName","onChange","target","size","autoFocus","required","slotProps","htmlInput","maxLength","direction","select","kind","flex","map","priority","alignItems","type","inputLabel","shrink","pick","onSnoozed","onClick","loading","nameOf","member","contactId","id","companyId","dealId","notes","multiline","minRows","justifyContent","mr"],"mappings":"AAAA;;;;;;;;;;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BACLxF,OAAOA;gBACPC,YAAYA;gBACZY,SAASA;gBACTf,KAAKA;gBACLoC,OAAOd,OAAOqF,MAAM;gBACpB3B,UAAU,CAACyB,KAAOvE,IAAI,UAAUuE;gBAChC/B,UAAU5C;;0BAEZ,KAACjE;gBACC8G,OAAM;gBACNvC,OAAOd,OAAOsF,KAAK;gBACnB5B,UAAU,CAACR,QAAUtC,IAAI,SAASsC,MAAMS,MAAM,CAAC7C,KAAK;gBACpD8C,MAAK;gBACL2B,SAAS;gBACTC,SAAS;gBACTzB,WAAW;oBAAEC,WAAW;wBAAEC,WAAWlH;oBAAmB;gBAAE;;YAE3D2D,sBACC,KAAClE;gBAAWkF,SAAQ;gBAAQc,OAAM;0BAC/B9B;iBAED;0BACJ,MAACpE;gBAAM4H,WAAU;gBAAMvB,SAAS;gBAAGC,IAAI;oBAAE6C,gBAAgB;gBAAW;;oBACjEvH,qBACC,KAAC/B;wBACCqG,OAAM;wBACNsC,SAAS,IAAM,KAAK3C;wBACpBiB,UAAU5C;wBACVoC,IAAI;4BAAE8C,IAAI;wBAAO;kCAEhB;yBAED;kCACJ,KAACvJ;wBAAO2I,SAAS7G;wBAASmF,UAAU5C;kCACjC;;kCAEH,KAACrE;wBAAOsI,MAAK;wBAAS/C,SAAQ;wBAAY0B,UAAU5C,QAAQ,CAACX;kCAC1D3B,OAAO,SAAS;;;;;;AAK3B;AACAE,SAASE,WAAW,GAAG;AAEvB,eAAeR,eAAc"}
@@ -0,0 +1,24 @@
1
+ import { type TaskImportField, type TaskImportRawRow, type TaskImportSkippedRow } from '../model/crm-task-import';
2
+ import { type CsvImportVocabulary } from './csv-import-drawer';
3
+ /** The browser-side address of the route one chunk is posted to. */
4
+ export declare const TASKS_IMPORT_URL = "/api/crm/tasks-import";
5
+ /** Built once: nothing in it depends on a render. */
6
+ export declare const TASK_IMPORT_VOCABULARY: CsvImportVocabulary<TaskImportField, TaskImportRawRow & Record<string, unknown>, TaskImportSkippedRow>;
7
+ export interface TaskImportDrawerProps {
8
+ open: boolean;
9
+ onClose: () => void;
10
+ /** The site the file is filed from, or `null` at the organization level. */
11
+ hostId: string | null;
12
+ }
13
+ export declare function TaskImportDrawer(props: TaskImportDrawerProps): import("react").JSX.Element;
14
+ export declare namespace TaskImportDrawer {
15
+ var displayName: string;
16
+ }
17
+ /** The "Import CSV" action on the tasks list, with the drawer it opens. */
18
+ export declare function TaskImportButton(props: {
19
+ hostId: string | null;
20
+ }): import("react").JSX.Element;
21
+ export declare namespace TaskImportButton {
22
+ var displayName: string;
23
+ }
24
+ export default TaskImportDrawer;
@@ -0,0 +1,82 @@
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 } from "react/jsx-runtime";
18
+ /**
19
+ * IMPORTING A TASKS FILE — the task vocabulary over the shared drawer
20
+ * (AGL-2662).
21
+ *
22
+ * The server half is `server/tasks-import.ts`. What is particular to
23
+ * tasks: the title is the one cell every row needs, an assignee address
24
+ * that names nobody on the team refuses the ROW rather than filing the
25
+ * task unassigned, no notification is sent, and nothing is merged — a
26
+ * task has no key, so every row is a new task.
27
+ */ import { pluginDocsHelp } from "@aglyn/aglyn";
28
+ import { TASK_IMPORT_CHUNK_SIZE, TASK_IMPORT_FIELD_LABELS, TASK_IMPORT_FIELDS, TASK_IMPORT_MAX_ROWS, TASK_IMPORT_PREVIEW_ROWS, TASK_IMPORT_SKIP_LABELS, emptyTaskImportResult, guessTaskImportMapping, mapTaskImportRow, mergeTaskImportResults, taskImportSkippedCsv } from "../model/crm-task-import.js";
29
+ import { tasksCsv } from "../model/tasks-csv.js";
30
+ import { CsvImportButton, CsvImportDrawer } from "./csv-import-drawer.js";
31
+ /** The browser-side address of the route one chunk is posted to. */ export const TASKS_IMPORT_URL = '/api/crm/tasks-import';
32
+ /** Built once: nothing in it depends on a render. */ export const TASK_IMPORT_VOCABULARY = {
33
+ title: 'Import tasks from CSV',
34
+ help: pluginDocsHelp('crmTasks', {
35
+ anchor: '#import-from-csv'
36
+ }),
37
+ sitePickerHelperText: 'The site these tasks are filed from — it decides which of your sites ' + 'may see them.',
38
+ intro: 'A CSV with a header row. Match its columns to task fields below, check ' + 'the preview, then import. An assignee is a team member’s email address; ' + 'a row naming somebody who is not on the team is skipped. Nobody is ' + 'notified. Every row becomes a new task — importing a file twice files ' + `it twice. Up to ${TASK_IMPORT_MAX_ROWS.toLocaleString()} rows per file ` + '— split a larger one.',
39
+ fields: TASK_IMPORT_FIELDS,
40
+ fieldLabels: TASK_IMPORT_FIELD_LABELS,
41
+ requiredField: 'title',
42
+ requiredWarning: 'Choose which column holds the task title. It is the one field every ' + 'row needs.',
43
+ unusableNotice: (count, total)=>`${count.toLocaleString()} of ${total.toLocaleString()} rows have no ` + 'title and will be skipped. You can download them after the import.',
44
+ guessMapping: guessTaskImportMapping,
45
+ mapRow: (cells, mapping)=>mapTaskImportRow(cells, mapping),
46
+ route: TASKS_IMPORT_URL,
47
+ maxRows: TASK_IMPORT_MAX_ROWS,
48
+ chunkSize: TASK_IMPORT_CHUNK_SIZE,
49
+ previewRows: TASK_IMPORT_PREVIEW_ROWS,
50
+ emptyResult: emptyTaskImportResult,
51
+ mergeResults: mergeTaskImportResults,
52
+ skipLabels: TASK_IMPORT_SKIP_LABELS,
53
+ skippedCsv: taskImportSkippedCsv,
54
+ skippedFileName: 'skipped-tasks.csv',
55
+ // The export's own header over no rows, so an export re-imports as is.
56
+ templateCsv: ()=>tasksCsv([]),
57
+ templateFileName: 'tasks-template.csv'
58
+ };
59
+ export function TaskImportDrawer(props) {
60
+ const { open, onClose, hostId } = props;
61
+ return /*#__PURE__*/ _jsx(CsvImportDrawer, {
62
+ open: open,
63
+ onClose: onClose,
64
+ hostId: hostId,
65
+ vocabulary: TASK_IMPORT_VOCABULARY
66
+ });
67
+ }
68
+ TaskImportDrawer.displayName = 'TaskImportDrawer';
69
+ /** The "Import CSV" action on the tasks list, with the drawer it opens. */ export function TaskImportButton(props) {
70
+ const { hostId } = props;
71
+ return /*#__PURE__*/ _jsx(CsvImportButton, {
72
+ children: (open, onClose)=>/*#__PURE__*/ _jsx(TaskImportDrawer, {
73
+ open: open,
74
+ onClose: onClose,
75
+ hostId: hostId
76
+ })
77
+ });
78
+ }
79
+ TaskImportButton.displayName = 'TaskImportButton';
80
+ export default TaskImportDrawer;
81
+
82
+ //# sourceMappingURL=task-import-drawer.js.map