@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,343 @@
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 { CONTACT_LIFECYCLE_STAGE_LABELS, CONTACT_LIFECYCLE_STAGES, consentGroupDisclosure, normalizeAddress, normalizeContactEmail, normalizePhone } from "@aglyn/aglyn";
19
+ import { ICON_VARIANT_CLOSE } from "@aglyn/shared-data-enums";
20
+ import { Container, MdiIcon, SrOnly } from "@aglyn/shared-ui-jsx";
21
+ import { NavigationDrawerComponent } from "@aglyn/shared-ui-jsx/components/navigation-drawer.component";
22
+ import { Alert, Button, Checkbox, FormControlLabel, FormHelperText, IconButton, MenuItem, Stack, TextField, Typography } from "@mui/material";
23
+ import { useEffect, useState } from "react";
24
+ import { useCrmScope } from "../hooks/use-crm-scope.js";
25
+ import { parseContactTags } from "../model/contact-record.js";
26
+ import { CompanyPicker, useCompanyOptions, useCreateCompany } from "./company-picker.js";
27
+ import { ContactAddressFields, EMPTY_ADDRESS } from "./contact-address-fields.js";
28
+ import { CrmSitePicker } from "./crm-site-picker.js";
29
+ /**
30
+ * ADDING ONE PERSON BY HAND, IN A DRAWER (AGL-2596).
31
+ *
32
+ * A drawer and not a form above the list: a create form sitting on top of a
33
+ * table is the shape every list in this console was built to stop. The
34
+ * button in the list's header opens this, and the list is exactly as it was
35
+ * behind it.
36
+ *
37
+ * ## What is checked here and what is not
38
+ *
39
+ * The two fields a person can mistype in a way the record cannot hold — the
40
+ * email and the phone number — are checked before the request leaves, with
41
+ * the same normalizers the route runs, so the refusal lands under the field
42
+ * rather than as a sentence from the server. Everything else is the route's
43
+ * to decide: whether the address already belongs to somebody (it merges),
44
+ * whether the plan's band has room (it refuses, and its sentence is shown
45
+ * above the form unchanged).
46
+ *
47
+ * ## The consent box is a claim, and says so
48
+ *
49
+ * The forms plugin's rule for the opt-in field is that submitting a form is
50
+ * never itself consent. Typing somebody into the CRM is not either — so the
51
+ * checkbox is worded as the person's act, not the operator's, and the helper
52
+ * carries the group disclosure the form would have shown them.
53
+ *
54
+ * ## The company is a record, picked or created here
55
+ *
56
+ * The Company field is the picker (AGL-2613): a choice from the companies
57
+ * this site may see, with a "Create …" row for a name none of them carry, so
58
+ * the person filing a contact never leaves the drawer to make the account.
59
+ * What leaves the drawer is the company's id AND its name — the id is the
60
+ * link the route writes into the facet, the name is the label the list
61
+ * column and the global search keep reading. The company listen opens with
62
+ * the drawer and closes with it, because the drawer is mounted only while
63
+ * it is open.
64
+ */ export function NewContactDrawer(props) {
65
+ var _ref;
66
+ const { open, onClose, hostId, org, busy, error, owners, ownersReady, onSubmit } = props;
67
+ /*
68
+ * The controller the consent checkbox records a basis FOR: the mounted
69
+ * site's group, or at the organization level the picked site's — the one
70
+ * the route will capture the contact under. `null` until a site is
71
+ * picked, and the submit waits on it.
72
+ */ const { createHostId, createGroup } = useCrmScope({
73
+ hostId,
74
+ org
75
+ });
76
+ const consentGroup = createGroup;
77
+ const companies = useCompanyOptions({
78
+ hostId,
79
+ org,
80
+ enabled: open
81
+ });
82
+ const createCompany = useCreateCompany({
83
+ hostId,
84
+ org
85
+ });
86
+ const [email, setEmail] = useState('');
87
+ const [name, setName] = useState('');
88
+ const [phone, setPhone] = useState('');
89
+ const [jobTitle, setJobTitle] = useState('');
90
+ const [company, setCompany] = useState(null);
91
+ const [ownerUid, setOwnerUid] = useState('');
92
+ const [lifecycleStage, setLifecycleStage] = useState('');
93
+ const [tags, setTags] = useState('');
94
+ const [address, setAddress] = useState(EMPTY_ADDRESS);
95
+ const [marketingConsent, setMarketingConsent] = useState(false);
96
+ const [emailError, setEmailError] = useState('');
97
+ const [phoneError, setPhoneError] = useState('');
98
+ /*
99
+ * A fresh form on every opening. The drawer stays mounted behind the list
100
+ * between uses, and a person typed and then abandoned must not reappear
101
+ * half-filled the next time somebody reaches for "New contact".
102
+ */ useEffect(()=>{
103
+ if (!open) return;
104
+ setEmail('');
105
+ setName('');
106
+ setPhone('');
107
+ setJobTitle('');
108
+ setCompany(null);
109
+ setOwnerUid('');
110
+ setLifecycleStage('');
111
+ setTags('');
112
+ setAddress(EMPTY_ADDRESS);
113
+ setMarketingConsent(false);
114
+ setEmailError('');
115
+ setPhoneError('');
116
+ }, [
117
+ open
118
+ ]);
119
+ const handleSubmit = ()=>{
120
+ var _ref;
121
+ const normalizedEmail = normalizeContactEmail(email);
122
+ const trimmedPhone = phone.trim();
123
+ const normalizedPhone = trimmedPhone ? normalizePhone(trimmedPhone) : '';
124
+ setEmailError(normalizedEmail ? '' : 'Enter a valid email address.');
125
+ setPhoneError(trimmedPhone && !normalizedPhone ? 'Enter it with its country code, like +1 512 555 0107.' : '');
126
+ if (!normalizedEmail || trimmedPhone && !normalizedPhone) return;
127
+ onSubmit({
128
+ email: normalizedEmail,
129
+ name: name.trim().slice(0, 120),
130
+ phone: normalizedPhone != null ? normalizedPhone : '',
131
+ jobTitle: jobTitle.trim().slice(0, 120),
132
+ companyName: company ? company.name.trim().slice(0, 120) : '',
133
+ companyId: (_ref = company == null ? void 0 : company.id) != null ? _ref : null,
134
+ ownerUid,
135
+ lifecycleStage,
136
+ tags: parseContactTags(tags),
137
+ address: normalizeAddress(address),
138
+ marketingConsent
139
+ });
140
+ };
141
+ const disclosure = consentGroup ? consentGroupDisclosure(consentGroup) : null;
142
+ return /*#__PURE__*/ _jsx(NavigationDrawerComponent, {
143
+ open: open,
144
+ anchor: "right",
145
+ variant: "temporary",
146
+ onClose: onClose,
147
+ AppBarProps: {
148
+ color: 'surface'
149
+ },
150
+ sx: {
151
+ '& .MuiDrawer-paper': {
152
+ width: {
153
+ xs: '100%',
154
+ sm: 480
155
+ }
156
+ }
157
+ },
158
+ appBarLeft: /*#__PURE__*/ _jsxs(_Fragment, {
159
+ children: [
160
+ /*#__PURE__*/ _jsxs(IconButton, {
161
+ color: "inherit",
162
+ edge: "start",
163
+ onClick: onClose,
164
+ sx: {
165
+ mr: 2
166
+ },
167
+ children: [
168
+ /*#__PURE__*/ _jsx(MdiIcon, {
169
+ path: ICON_VARIANT_CLOSE.path
170
+ }),
171
+ /*#__PURE__*/ _jsx(SrOnly, {
172
+ children: "close drawer"
173
+ })
174
+ ]
175
+ }),
176
+ /*#__PURE__*/ _jsx(Typography, {
177
+ variant: "h6",
178
+ component: "div",
179
+ children: 'New contact'
180
+ })
181
+ ]
182
+ }),
183
+ appBarRight: /*#__PURE__*/ _jsx(Button, {
184
+ variant: "outlined",
185
+ color: "inherit",
186
+ onClick: onClose,
187
+ children: 'Cancel'
188
+ }),
189
+ children: /*#__PURE__*/ _jsx(Container, {
190
+ gutterY: true,
191
+ children: /*#__PURE__*/ _jsxs(Stack, {
192
+ spacing: 2,
193
+ children: [
194
+ error ? /*#__PURE__*/ _jsx(Alert, {
195
+ severity: "warning",
196
+ children: error
197
+ }) : null,
198
+ /*#__PURE__*/ _jsx(CrmSitePicker, {
199
+ hostId: hostId,
200
+ disabled: Boolean(busy),
201
+ helperText: "The site that captures this person — it decides which sites may see them and whose marketing consent the checkbox below records."
202
+ }),
203
+ /*#__PURE__*/ _jsx(TextField, {
204
+ size: "small",
205
+ label: "Email",
206
+ type: "email",
207
+ value: email,
208
+ onChange: (event)=>setEmail(event.target.value),
209
+ error: Boolean(emailError),
210
+ helperText: emailError || 'The one field that is required — it is what makes two captures one person.',
211
+ required: true,
212
+ fullWidth: true,
213
+ autoFocus: true
214
+ }),
215
+ /*#__PURE__*/ _jsx(TextField, {
216
+ size: "small",
217
+ label: "Name",
218
+ value: name,
219
+ onChange: (event)=>setName(event.target.value),
220
+ slotProps: {
221
+ htmlInput: {
222
+ maxLength: 120
223
+ }
224
+ },
225
+ fullWidth: true
226
+ }),
227
+ /*#__PURE__*/ _jsx(TextField, {
228
+ size: "small",
229
+ label: "Phone",
230
+ value: phone,
231
+ onChange: (event)=>setPhone(event.target.value),
232
+ error: Boolean(phoneError),
233
+ helperText: phoneError || 'With the country code, like +1 512 555 0107',
234
+ fullWidth: true
235
+ }),
236
+ /*#__PURE__*/ _jsx(TextField, {
237
+ size: "small",
238
+ label: "Job title",
239
+ value: jobTitle,
240
+ onChange: (event)=>setJobTitle(event.target.value),
241
+ slotProps: {
242
+ htmlInput: {
243
+ maxLength: 120
244
+ }
245
+ },
246
+ fullWidth: true
247
+ }),
248
+ /*#__PURE__*/ _jsx(CompanyPicker, {
249
+ options: companies.options,
250
+ ready: companies.ready,
251
+ truncated: companies.truncated,
252
+ value: (_ref = company == null ? void 0 : company.id) != null ? _ref : null,
253
+ onChange: (_id, picked)=>setCompany(picked),
254
+ onCreate: createCompany,
255
+ email: email,
256
+ disabled: Boolean(busy),
257
+ helperText: "The account this person works for. Type a name nobody has filed yet to create it."
258
+ }),
259
+ /*#__PURE__*/ _jsxs(TextField, {
260
+ select: true,
261
+ size: "small",
262
+ label: "Lifecycle stage",
263
+ value: lifecycleStage,
264
+ onChange: (event)=>setLifecycleStage(event.target.value),
265
+ fullWidth: true,
266
+ children: [
267
+ /*#__PURE__*/ _jsx(MenuItem, {
268
+ value: "",
269
+ children: 'Not placed yet'
270
+ }),
271
+ CONTACT_LIFECYCLE_STAGES.map((stage)=>/*#__PURE__*/ _jsx(MenuItem, {
272
+ value: stage,
273
+ children: CONTACT_LIFECYCLE_STAGE_LABELS[stage]
274
+ }, stage))
275
+ ]
276
+ }),
277
+ /*#__PURE__*/ _jsxs(TextField, {
278
+ select: true,
279
+ size: "small",
280
+ label: "Owner",
281
+ value: ownerUid,
282
+ onChange: (event)=>setOwnerUid(event.target.value),
283
+ helperText: ownersReady && !owners.length ? 'The team roster could not be read, so nobody can be picked yet.' : 'The team member responsible for this relationship',
284
+ fullWidth: true,
285
+ children: [
286
+ /*#__PURE__*/ _jsx(MenuItem, {
287
+ value: "",
288
+ children: 'Unassigned'
289
+ }),
290
+ owners.map((owner)=>/*#__PURE__*/ _jsx(MenuItem, {
291
+ value: owner.uid,
292
+ children: owner.label
293
+ }, owner.uid))
294
+ ]
295
+ }),
296
+ /*#__PURE__*/ _jsx(TextField, {
297
+ size: "small",
298
+ label: "Tags",
299
+ placeholder: "vip, beta",
300
+ helperText: "Comma-separated",
301
+ value: tags,
302
+ onChange: (event)=>setTags(event.target.value),
303
+ fullWidth: true
304
+ }),
305
+ /*#__PURE__*/ _jsx(Typography, {
306
+ variant: "subtitle2",
307
+ children: 'Address'
308
+ }),
309
+ /*#__PURE__*/ _jsx(ContactAddressFields, {
310
+ value: address,
311
+ onChange: setAddress
312
+ }),
313
+ /*#__PURE__*/ _jsxs(Stack, {
314
+ children: [
315
+ /*#__PURE__*/ _jsx(FormControlLabel, {
316
+ control: /*#__PURE__*/ _jsx(Checkbox, {
317
+ checked: marketingConsent,
318
+ onChange: (event)=>setMarketingConsent(event.target.checked)
319
+ }),
320
+ label: "This person opted in to marketing email"
321
+ }),
322
+ /*#__PURE__*/ _jsx(FormHelperText, {
323
+ children: (disclosure ? `${disclosure} ` : '') + 'Tick it only if they agreed. Adding a contact is never itself consent.'
324
+ })
325
+ ]
326
+ }),
327
+ /*#__PURE__*/ _jsx(Button, {
328
+ variant: "contained",
329
+ color: "primary",
330
+ // Held until the capturing site is known: the route resolves the
331
+ // org from it and stamps the record with it.
332
+ disabled: Boolean(busy) || !createHostId,
333
+ onClick: handleSubmit,
334
+ children: busy ? 'Adding…' : 'Add contact'
335
+ })
336
+ ]
337
+ })
338
+ })
339
+ });
340
+ }
341
+ export default NewContactDrawer;
342
+
343
+ //# sourceMappingURL=new-contact-drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/new-contact-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 {\n CONTACT_LIFECYCLE_STAGE_LABELS,\n CONTACT_LIFECYCLE_STAGES,\n consentGroupDisclosure,\n type AglynOrgBilling,\n type AglynPostalAddress,\n type ConsentGroup,\n type ContactLifecycleStage,\n normalizeAddress,\n normalizeContactEmail,\n normalizePhone,\n} from '@aglyn/aglyn'\nimport { ICON_VARIANT_CLOSE } from '@aglyn/shared-data-enums'\nimport { Container, MdiIcon, SrOnly } from '@aglyn/shared-ui-jsx'\nimport { NavigationDrawerComponent } from '@aglyn/shared-ui-jsx/components/navigation-drawer.component'\nimport {\n Alert,\n Button,\n Checkbox,\n FormControlLabel,\n FormHelperText,\n IconButton,\n MenuItem,\n Stack,\n TextField,\n Typography,\n} from '@mui/material'\nimport { useEffect, useState } from 'react'\nimport { useCrmScope } from '../hooks/use-crm-scope'\nimport { parseContactTags } from '../model/contact-record'\nimport {\n CompanyPicker,\n type CompanyOption,\n useCompanyOptions,\n useCreateCompany,\n} from './company-picker'\nimport {\n ContactAddressFields,\n EMPTY_ADDRESS,\n type AddressDraft,\n} from './contact-address-fields'\nimport { CrmSitePicker } from './crm-site-picker'\nimport type { OrgMemberOption } from './use-org-members'\n\n/** What the drawer hands back — already normalized where the route would. */\nexport interface NewContactValues {\n email: string\n name: string\n phone: string\n jobTitle: string\n /** The picked company's name — the label the list column and the search read. */\n companyName: string\n /** The picked company, or `null` for none (AGL-2613). */\n companyId: string | null\n ownerUid: string\n lifecycleStage: ContactLifecycleStage | ''\n tags: string[]\n address: AglynPostalAddress | null\n marketingConsent: boolean\n}\n\nexport interface NewContactDrawerProps {\n open: boolean\n onClose: () => void\n /**\n * The site the contact is being added from — what scopes the company list\n * and the controller the consent checkbox records a basis for. `null` at\n * the organization level (AGL-2630), where the drawer asks which site\n * with a picker and holds its submit until one is named.\n */\n hostId: string | null\n /** The org document the shell passed, for the company picker's scope. */\n org?: Partial<AglynOrgBilling> | null\n /** The request is in flight — the form holds still and the button says so. */\n busy?: boolean\n /** What the route answered when it refused, shown above the form. */\n error?: string | null\n /** The team, for the owner picker. */\n owners: OrgMemberOption[]\n /** The roster has answered — an empty list is then \"nobody to pick\". */\n ownersReady: boolean\n onSubmit: (values: NewContactValues) => void\n}\n\n/**\n * ADDING ONE PERSON BY HAND, IN A DRAWER (AGL-2596).\n *\n * A drawer and not a form above the list: a create form sitting on top of a\n * table is the shape every list in this console was built to stop. The\n * button in the list's header opens this, and the list is exactly as it was\n * behind it.\n *\n * ## What is checked here and what is not\n *\n * The two fields a person can mistype in a way the record cannot hold — the\n * email and the phone number — are checked before the request leaves, with\n * the same normalizers the route runs, so the refusal lands under the field\n * rather than as a sentence from the server. Everything else is the route's\n * to decide: whether the address already belongs to somebody (it merges),\n * whether the plan's band has room (it refuses, and its sentence is shown\n * above the form unchanged).\n *\n * ## The consent box is a claim, and says so\n *\n * The forms plugin's rule for the opt-in field is that submitting a form is\n * never itself consent. Typing somebody into the CRM is not either — so the\n * checkbox is worded as the person's act, not the operator's, and the helper\n * carries the group disclosure the form would have shown them.\n *\n * ## The company is a record, picked or created here\n *\n * The Company field is the picker (AGL-2613): a choice from the companies\n * this site may see, with a \"Create …\" row for a name none of them carry, so\n * the person filing a contact never leaves the drawer to make the account.\n * What leaves the drawer is the company's id AND its name — the id is the\n * link the route writes into the facet, the name is the label the list\n * column and the global search keep reading. The company listen opens with\n * the drawer and closes with it, because the drawer is mounted only while\n * it is open.\n */\nexport function NewContactDrawer(props: NewContactDrawerProps) {\n const {\n open,\n onClose,\n hostId,\n org,\n busy,\n error,\n owners,\n ownersReady,\n onSubmit,\n } = props\n /*\n * The controller the consent checkbox records a basis FOR: the mounted\n * site's group, or at the organization level the picked site's — the one\n * the route will capture the contact under. `null` until a site is\n * picked, and the submit waits on it.\n */\n const { createHostId, createGroup } = useCrmScope({ hostId, org })\n const consentGroup: ConsentGroup | null = createGroup\n const companies = useCompanyOptions({ hostId, org, enabled: open })\n const createCompany = useCreateCompany({ hostId, org })\n\n const [email, setEmail] = useState('')\n const [name, setName] = useState('')\n const [phone, setPhone] = useState('')\n const [jobTitle, setJobTitle] = useState('')\n const [company, setCompany] = useState<CompanyOption | null>(null)\n const [ownerUid, setOwnerUid] = useState('')\n const [lifecycleStage, setLifecycleStage] = useState<\n ContactLifecycleStage | ''\n >('')\n const [tags, setTags] = useState('')\n const [address, setAddress] = useState<AddressDraft>(EMPTY_ADDRESS)\n const [marketingConsent, setMarketingConsent] = useState(false)\n const [emailError, setEmailError] = useState('')\n const [phoneError, setPhoneError] = useState('')\n\n /*\n * A fresh form on every opening. The drawer stays mounted behind the list\n * between uses, and a person typed and then abandoned must not reappear\n * half-filled the next time somebody reaches for \"New contact\".\n */\n useEffect(() => {\n if (!open) return\n setEmail('')\n setName('')\n setPhone('')\n setJobTitle('')\n setCompany(null)\n setOwnerUid('')\n setLifecycleStage('')\n setTags('')\n setAddress(EMPTY_ADDRESS)\n setMarketingConsent(false)\n setEmailError('')\n setPhoneError('')\n }, [open])\n\n const handleSubmit = () => {\n const normalizedEmail = normalizeContactEmail(email)\n const trimmedPhone = phone.trim()\n const normalizedPhone = trimmedPhone ? normalizePhone(trimmedPhone) : ''\n setEmailError(normalizedEmail ? '' : 'Enter a valid email address.')\n setPhoneError(\n trimmedPhone && !normalizedPhone\n ? 'Enter it with its country code, like +1 512 555 0107.'\n : '',\n )\n if (!normalizedEmail || (trimmedPhone && !normalizedPhone)) return\n onSubmit({\n email: normalizedEmail,\n name: name.trim().slice(0, 120),\n phone: normalizedPhone ?? '',\n jobTitle: jobTitle.trim().slice(0, 120),\n companyName: company ? company.name.trim().slice(0, 120) : '',\n companyId: company?.id ?? null,\n ownerUid,\n lifecycleStage,\n tags: parseContactTags(tags),\n address: normalizeAddress(address),\n marketingConsent,\n })\n }\n\n const disclosure = consentGroup ? consentGroupDisclosure(consentGroup) : null\n\n return (\n <NavigationDrawerComponent\n open={open}\n anchor=\"right\"\n variant=\"temporary\"\n onClose={onClose}\n AppBarProps={{ color: 'surface' }}\n sx={{ '& .MuiDrawer-paper': { width: { xs: '100%', sm: 480 } } }}\n appBarLeft={\n <>\n <IconButton\n color=\"inherit\"\n edge=\"start\"\n onClick={onClose}\n sx={{ mr: 2 }}\n >\n <MdiIcon path={ICON_VARIANT_CLOSE.path} />\n <SrOnly>close drawer</SrOnly>\n </IconButton>\n <Typography variant=\"h6\" component=\"div\">\n {'New contact'}\n </Typography>\n </>\n }\n appBarRight={\n <Button variant=\"outlined\" color=\"inherit\" onClick={onClose}>\n {'Cancel'}\n </Button>\n }\n >\n <Container gutterY>\n <Stack spacing={2}>\n {error ? <Alert severity=\"warning\">{error}</Alert> : null}\n {/*\n First, because everything below it is filed under the answer: the\n site decides which of the org's sites may see the person and whose\n consent the checkbox at the foot records. Renders nothing under a\n site (AGL-2630).\n */}\n <CrmSitePicker\n hostId={hostId}\n disabled={Boolean(busy)}\n helperText=\"The site that captures this person — it decides which sites may see them and whose marketing consent the checkbox below records.\"\n />\n <TextField\n size=\"small\"\n label=\"Email\"\n type=\"email\"\n value={email}\n onChange={(event) => setEmail(event.target.value)}\n error={Boolean(emailError)}\n helperText={\n emailError ||\n 'The one field that is required — it is what makes two captures one person.'\n }\n required\n fullWidth\n autoFocus\n />\n <TextField\n size=\"small\"\n label=\"Name\"\n value={name}\n onChange={(event) => setName(event.target.value)}\n slotProps={{ htmlInput: { maxLength: 120 } }}\n fullWidth\n />\n <TextField\n size=\"small\"\n label=\"Phone\"\n value={phone}\n onChange={(event) => setPhone(event.target.value)}\n error={Boolean(phoneError)}\n helperText={phoneError || 'With the country code, like +1 512 555 0107'}\n fullWidth\n />\n <TextField\n size=\"small\"\n label=\"Job title\"\n value={jobTitle}\n onChange={(event) => setJobTitle(event.target.value)}\n slotProps={{ htmlInput: { maxLength: 120 } }}\n fullWidth\n />\n <CompanyPicker\n options={companies.options}\n ready={companies.ready}\n truncated={companies.truncated}\n value={company?.id ?? null}\n onChange={(_id, picked) => setCompany(picked)}\n onCreate={createCompany}\n email={email}\n disabled={Boolean(busy)}\n helperText=\"The account this person works for. Type a name nobody has filed yet to create it.\"\n />\n <TextField\n select\n size=\"small\"\n label=\"Lifecycle stage\"\n value={lifecycleStage}\n onChange={(event) =>\n setLifecycleStage(event.target.value as ContactLifecycleStage | '')\n }\n fullWidth\n >\n <MenuItem value=\"\">{'Not placed yet'}</MenuItem>\n {CONTACT_LIFECYCLE_STAGES.map((stage) => (\n <MenuItem key={stage} value={stage}>\n {CONTACT_LIFECYCLE_STAGE_LABELS[stage]}\n </MenuItem>\n ))}\n </TextField>\n <TextField\n select\n size=\"small\"\n label=\"Owner\"\n value={ownerUid}\n onChange={(event) => setOwnerUid(event.target.value)}\n helperText={\n ownersReady && !owners.length\n ? 'The team roster could not be read, so nobody can be picked yet.'\n : 'The team member responsible for this relationship'\n }\n fullWidth\n >\n <MenuItem value=\"\">{'Unassigned'}</MenuItem>\n {owners.map((owner) => (\n <MenuItem key={owner.uid} value={owner.uid}>\n {owner.label}\n </MenuItem>\n ))}\n </TextField>\n <TextField\n size=\"small\"\n label=\"Tags\"\n placeholder=\"vip, beta\"\n helperText=\"Comma-separated\"\n value={tags}\n onChange={(event) => setTags(event.target.value)}\n fullWidth\n />\n <Typography variant=\"subtitle2\">{'Address'}</Typography>\n <ContactAddressFields value={address} onChange={setAddress} />\n <Stack>\n <FormControlLabel\n control={\n <Checkbox\n checked={marketingConsent}\n onChange={(event) => setMarketingConsent(event.target.checked)}\n />\n }\n label=\"This person opted in to marketing email\"\n />\n <FormHelperText>\n {(disclosure ? `${disclosure} ` : '') +\n 'Tick it only if they agreed. Adding a contact is never itself consent.'}\n </FormHelperText>\n </Stack>\n <Button\n variant=\"contained\"\n color=\"primary\"\n // Held until the capturing site is known: the route resolves the\n // org from it and stamps the record with it.\n disabled={Boolean(busy) || !createHostId}\n onClick={handleSubmit}\n >\n {busy ? 'Adding…' : 'Add contact'}\n </Button>\n </Stack>\n </Container>\n </NavigationDrawerComponent>\n )\n}\n\nexport default NewContactDrawer\n"],"names":["CONTACT_LIFECYCLE_STAGE_LABELS","CONTACT_LIFECYCLE_STAGES","consentGroupDisclosure","normalizeAddress","normalizeContactEmail","normalizePhone","ICON_VARIANT_CLOSE","Container","MdiIcon","SrOnly","NavigationDrawerComponent","Alert","Button","Checkbox","FormControlLabel","FormHelperText","IconButton","MenuItem","Stack","TextField","Typography","useEffect","useState","useCrmScope","parseContactTags","CompanyPicker","useCompanyOptions","useCreateCompany","ContactAddressFields","EMPTY_ADDRESS","CrmSitePicker","NewContactDrawer","props","open","onClose","hostId","org","busy","error","owners","ownersReady","onSubmit","createHostId","createGroup","consentGroup","companies","enabled","createCompany","email","setEmail","name","setName","phone","setPhone","jobTitle","setJobTitle","company","setCompany","ownerUid","setOwnerUid","lifecycleStage","setLifecycleStage","tags","setTags","address","setAddress","marketingConsent","setMarketingConsent","emailError","setEmailError","phoneError","setPhoneError","handleSubmit","normalizedEmail","trimmedPhone","trim","normalizedPhone","slice","companyName","companyId","id","disclosure","anchor","variant","AppBarProps","color","sx","width","xs","sm","appBarLeft","edge","onClick","mr","path","component","appBarRight","gutterY","spacing","severity","disabled","Boolean","helperText","size","label","type","value","onChange","event","target","required","fullWidth","autoFocus","slotProps","htmlInput","maxLength","options","ready","truncated","_id","picked","onCreate","select","map","stage","length","owner","uid","placeholder","control","checked"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;AAEA,SACEA,8BAA8B,EAC9BC,wBAAwB,EACxBC,sBAAsB,EAKtBC,gBAAgB,EAChBC,qBAAqB,EACrBC,cAAc,QACT,eAAc;AACrB,SAASC,kBAAkB,QAAQ,2BAA0B;AAC7D,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,uBAAsB;AACjE,SAASC,yBAAyB,QAAQ,8DAA6D;AACv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wBACZ1B,YAAW;wBACXI,OAAO5C;wBACP6C,UAAU,CAACC,QAAU7C,QAAQ6C,MAAMC,MAAM,CAACH,KAAK;wBAC/CK,SAAS;;kCAEX,KAAC3F;wBAAW+D,SAAQ;kCAAa;;kCACjC,KAACvD;wBAAqB8E,OAAO1C;wBAAS2C,UAAU1C;;kCAChD,MAAC/C;;0CACC,KAACJ;gCACCmH,uBACE,KAACpH;oCACCqH,SAAShE;oCACTyC,UAAU,CAACC,QAAUzC,oBAAoByC,MAAMC,MAAM,CAACqB,OAAO;;gCAGjE1B,OAAM;;0CAER,KAACzF;0CACE,AAACkE,CAAAA,aAAa,GAAGA,WAAW,CAAC,CAAC,GAAG,EAAC,IACjC;;;;kCAGN,KAACrE;wBACCuE,SAAQ;wBACRE,OAAM;wBACN,iEAAiE;wBACjE,6CAA6C;wBAC7Ce,UAAUC,QAAQhE,SAAS,CAACK;wBAC5BkD,SAASpB;kCAERnC,OAAO,YAAY;;;;;;AAMhC;AAEA,eAAeN,iBAAgB"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * How many sites the note opens with their forms showing. The rest sit
19
+ * behind a count until asked for — and, since a site's forms are read by
20
+ * the group that shows them, are not read until then either.
21
+ */
22
+ export declare const ORG_LEAD_SURFACES_OPEN_SITES = 3;
23
+ /**
24
+ * WHAT CREATES A LEAD, ACROSS THE ORGANIZATION (AGL-2638).
25
+ *
26
+ * The org-level Leads section lists every site's leads in one table, and
27
+ * for a while said nothing about why a form's people were in it: the
28
+ * per-site note was drawn only under a site. This is the same note grouped
29
+ * by site — each site's routed forms, the forms that could route with the
30
+ * switch beside them, and the forms that cannot with the reason as the
31
+ * tooltip — over the sites the mount already bounds. The always-on
32
+ * surfaces are named once at the top, because a member sign-up files a
33
+ * lead on every site and saying so three times would suggest otherwise.
34
+ *
35
+ * ## Bounded two ways
36
+ *
37
+ * The sites come from the mount, which the shell already capped; and only
38
+ * the first {@link ORG_LEAD_SURFACES_OPEN_SITES} groups mount their reader
39
+ * until the reader opens the rest, so an org with twenty sites opens three
40
+ * listeners on arrival and not twenty.
41
+ *
42
+ * ## Links
43
+ *
44
+ * A site's name opens its own Leads section, and a form its own page, both
45
+ * built from the mount's `hostsPath` and the site's subdomain the way the
46
+ * mount builds a site's hub; a site whose subdomain never resolved is named
47
+ * and not linked. No host-index read per site: the mount already answered.
48
+ *
49
+ * Rendered only beneath the org mount — under a site the hook answers
50
+ * `null` and so does the note, which keeps the section's one-line choice
51
+ * between the two notes honest.
52
+ */
53
+ export declare function OrgLeadSurfacesNote(): import("react").JSX.Element;
54
+ export declare namespace OrgLeadSurfacesNote {
55
+ var displayName: string;
56
+ }
57
+ export default OrgLeadSurfacesNote;
@@ -0,0 +1,172 @@
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 { AppLink } from "@aglyn/shared-ui-jsx";
19
+ import { Button, Stack, Typography } from "@mui/material";
20
+ import { useCallback, useState } from "react";
21
+ import { useCrmOrgMount } from "../hooks/use-crm-org-mount.js";
22
+ import { LEAD_SURFACES_CONTACTS_TOO, LEAD_SURFACES_INTRO, LeadSurfaceFormList, UnroutedLeadSurfaces, useLeadSurfaceForms, useTurnOnLeadRouting } from "./lead-surfaces-note.js";
23
+ /**
24
+ * How many sites the note opens with their forms showing. The rest sit
25
+ * behind a count until asked for — and, since a site's forms are read by
26
+ * the group that shows them, are not read until then either.
27
+ */ export const ORG_LEAD_SURFACES_OPEN_SITES = 3;
28
+ /**
29
+ * WHAT CREATES A LEAD, ACROSS THE ORGANIZATION (AGL-2638).
30
+ *
31
+ * The org-level Leads section lists every site's leads in one table, and
32
+ * for a while said nothing about why a form's people were in it: the
33
+ * per-site note was drawn only under a site. This is the same note grouped
34
+ * by site — each site's routed forms, the forms that could route with the
35
+ * switch beside them, and the forms that cannot with the reason as the
36
+ * tooltip — over the sites the mount already bounds. The always-on
37
+ * surfaces are named once at the top, because a member sign-up files a
38
+ * lead on every site and saying so three times would suggest otherwise.
39
+ *
40
+ * ## Bounded two ways
41
+ *
42
+ * The sites come from the mount, which the shell already capped; and only
43
+ * the first {@link ORG_LEAD_SURFACES_OPEN_SITES} groups mount their reader
44
+ * until the reader opens the rest, so an org with twenty sites opens three
45
+ * listeners on arrival and not twenty.
46
+ *
47
+ * ## Links
48
+ *
49
+ * A site's name opens its own Leads section, and a form its own page, both
50
+ * built from the mount's `hostsPath` and the site's subdomain the way the
51
+ * mount builds a site's hub; a site whose subdomain never resolved is named
52
+ * and not linked. No host-index read per site: the mount already answered.
53
+ *
54
+ * Rendered only beneath the org mount — under a site the hook answers
55
+ * `null` and so does the note, which keeps the section's one-line choice
56
+ * between the two notes honest.
57
+ */ export function OrgLeadSurfacesNote() {
58
+ const mount = useCrmOrgMount();
59
+ const { turningOn, turnOn } = useTurnOnLeadRouting();
60
+ const [opened, setOpened] = useState(false);
61
+ if (!mount) return null;
62
+ const { hosts, hostsReady } = mount;
63
+ const shown = opened ? hosts : hosts.slice(0, ORG_LEAD_SURFACES_OPEN_SITES);
64
+ const folded = hosts.length - shown.length;
65
+ return /*#__PURE__*/ _jsxs(Stack, {
66
+ spacing: 1,
67
+ children: [
68
+ /*#__PURE__*/ _jsx(Typography, {
69
+ variant: "body2",
70
+ color: "text.secondary",
71
+ children: `${LEAD_SURFACES_INTRO}, on every site. ${LEAD_SURFACES_CONTACTS_TOO}`
72
+ }),
73
+ !hostsReady ? /*#__PURE__*/ _jsx(Typography, {
74
+ variant: "caption",
75
+ color: "text.secondary",
76
+ children: '…'
77
+ }) : !hosts.length ? /*#__PURE__*/ _jsx(Typography, {
78
+ variant: "body2",
79
+ color: "text.secondary",
80
+ children: 'This organization has no sites yet.'
81
+ }) : /*#__PURE__*/ _jsxs(_Fragment, {
82
+ children: [
83
+ shown.map((host)=>/*#__PURE__*/ _jsx(SiteLeadSurfaces, {
84
+ host: host,
85
+ mount: mount,
86
+ turningOn: turningOn,
87
+ onTurnOn: (form)=>void turnOn({
88
+ hostId: host.id,
89
+ form,
90
+ siteName: mount.siteName(host.id)
91
+ })
92
+ }, host.id)),
93
+ folded > 0 ? /*#__PURE__*/ _jsx(Button, {
94
+ size: "small",
95
+ variant: "text",
96
+ onClick: ()=>setOpened(true),
97
+ sx: {
98
+ alignSelf: 'flex-start'
99
+ },
100
+ children: `Show ${folded} more ${folded === 1 ? 'site' : 'sites'}`
101
+ }) : hosts.length > ORG_LEAD_SURFACES_OPEN_SITES ? /*#__PURE__*/ _jsx(Button, {
102
+ size: "small",
103
+ variant: "text",
104
+ onClick: ()=>setOpened(false),
105
+ sx: {
106
+ alignSelf: 'flex-start'
107
+ },
108
+ children: `Show the first ${ORG_LEAD_SURFACES_OPEN_SITES} sites only`
109
+ }) : null
110
+ ]
111
+ })
112
+ ]
113
+ });
114
+ }
115
+ OrgLeadSurfacesNote.displayName = 'OrgLeadSurfacesNote';
116
+ /**
117
+ * One site's group: its name, then the same two rows the site note draws,
118
+ * read by the same reader. A site with no forms says so in one line rather
119
+ * than drawing an empty "no form routes leads yet" that reads like a
120
+ * verdict on forms that do not exist.
121
+ */ function SiteLeadSurfaces(props) {
122
+ const { host, mount, turningOn, onTurnOn } = props;
123
+ const { routed, unrouted, truncated, status } = useLeadSurfaceForms(host.id);
124
+ const name = mount.siteName(host.id);
125
+ const hubHref = mount.siteHubHref(host.id);
126
+ const subdomain = mount.siteSubdomain(host.id);
127
+ const formHref = useCallback((formId)=>subdomain ? `${mount.hostsPath}/${encodeURIComponent(subdomain)}/forms/${encodeURIComponent(formId)}` : null, [
128
+ mount.hostsPath,
129
+ subdomain
130
+ ]);
131
+ return /*#__PURE__*/ _jsxs(Stack, {
132
+ spacing: 0.25,
133
+ children: [
134
+ /*#__PURE__*/ _jsx(Typography, {
135
+ variant: "subtitle2",
136
+ component: "div",
137
+ children: hubHref ? /*#__PURE__*/ _jsx(AppLink, {
138
+ href: `${hubHref}/leads`,
139
+ underline: "hover",
140
+ children: name
141
+ }) : name
142
+ }),
143
+ /*#__PURE__*/ _jsx(Typography, {
144
+ variant: "body2",
145
+ color: "text.secondary",
146
+ component: "div",
147
+ children: status === 'loading' ? '…' : status === 'error' ? 'The forms on this site could not be read.' : !routed.length && !unrouted.length ? 'No forms on this site yet.' : routed.length ? /*#__PURE__*/ _jsxs(_Fragment, {
148
+ children: [
149
+ 'Routing leads: ',
150
+ /*#__PURE__*/ _jsx(LeadSurfaceFormList, {
151
+ forms: routed,
152
+ truncated: truncated,
153
+ formHref: formHref
154
+ }),
155
+ '.'
156
+ ]
157
+ }) : 'No form routes leads yet.'
158
+ }),
159
+ unrouted.length ? /*#__PURE__*/ _jsx(UnroutedLeadSurfaces, {
160
+ hostId: host.id,
161
+ forms: unrouted,
162
+ formHref: formHref,
163
+ turningOn: turningOn,
164
+ onTurnOn: onTurnOn
165
+ }) : null
166
+ ]
167
+ });
168
+ }
169
+ SiteLeadSurfaces.displayName = 'SiteLeadSurfaces';
170
+ export default OrgLeadSurfacesNote;
171
+
172
+ //# sourceMappingURL=org-lead-surfaces-note.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/components/org-lead-surfaces-note.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\n'use client'\n\nimport type { ConsolePluginOrgHost } from '@aglyn/aglyn'\nimport { AppLink } from '@aglyn/shared-ui-jsx'\nimport { Button, Stack, Typography } from '@mui/material'\nimport { useCallback, useState } from 'react'\nimport { type CrmOrgMount, useCrmOrgMount } from '../hooks/use-crm-org-mount'\nimport type { LeadSurfaceForm } from '../model/lead-surfaces'\nimport {\n LEAD_SURFACES_CONTACTS_TOO,\n LEAD_SURFACES_INTRO,\n type LeadRoutingTarget,\n LeadSurfaceFormList,\n UnroutedLeadSurfaces,\n useLeadSurfaceForms,\n useTurnOnLeadRouting,\n} from './lead-surfaces-note'\n\n/**\n * How many sites the note opens with their forms showing. The rest sit\n * behind a count until asked for — and, since a site's forms are read by\n * the group that shows them, are not read until then either.\n */\nexport const ORG_LEAD_SURFACES_OPEN_SITES = 3\n\n/**\n * WHAT CREATES A LEAD, ACROSS THE ORGANIZATION (AGL-2638).\n *\n * The org-level Leads section lists every site's leads in one table, and\n * for a while said nothing about why a form's people were in it: the\n * per-site note was drawn only under a site. This is the same note grouped\n * by site — each site's routed forms, the forms that could route with the\n * switch beside them, and the forms that cannot with the reason as the\n * tooltip — over the sites the mount already bounds. The always-on\n * surfaces are named once at the top, because a member sign-up files a\n * lead on every site and saying so three times would suggest otherwise.\n *\n * ## Bounded two ways\n *\n * The sites come from the mount, which the shell already capped; and only\n * the first {@link ORG_LEAD_SURFACES_OPEN_SITES} groups mount their reader\n * until the reader opens the rest, so an org with twenty sites opens three\n * listeners on arrival and not twenty.\n *\n * ## Links\n *\n * A site's name opens its own Leads section, and a form its own page, both\n * built from the mount's `hostsPath` and the site's subdomain the way the\n * mount builds a site's hub; a site whose subdomain never resolved is named\n * and not linked. No host-index read per site: the mount already answered.\n *\n * Rendered only beneath the org mount — under a site the hook answers\n * `null` and so does the note, which keeps the section's one-line choice\n * between the two notes honest.\n */\nexport function OrgLeadSurfacesNote() {\n const mount = useCrmOrgMount()\n const { turningOn, turnOn } = useTurnOnLeadRouting()\n const [opened, setOpened] = useState(false)\n if (!mount) return null\n const { hosts, hostsReady } = mount\n const shown = opened ? hosts : hosts.slice(0, ORG_LEAD_SURFACES_OPEN_SITES)\n const folded = hosts.length - shown.length\n return (\n <Stack spacing={1}>\n <Typography variant=\"body2\" color=\"text.secondary\">\n {`${LEAD_SURFACES_INTRO}, on every site. ${LEAD_SURFACES_CONTACTS_TOO}`}\n </Typography>\n {!hostsReady ? (\n <Typography variant=\"caption\" color=\"text.secondary\">\n {'…'}\n </Typography>\n ) : !hosts.length ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n {'This organization has no sites yet.'}\n </Typography>\n ) : (\n <>\n {shown.map((host) => (\n <SiteLeadSurfaces\n key={host.id}\n host={host}\n mount={mount}\n turningOn={turningOn}\n onTurnOn={(form) =>\n void turnOn({ hostId: host.id, form, siteName: mount.siteName(host.id) })\n }\n />\n ))}\n {folded > 0 ? (\n <Button\n size=\"small\"\n variant=\"text\"\n onClick={() => setOpened(true)}\n sx={{ alignSelf: 'flex-start' }}\n >\n {`Show ${folded} more ${folded === 1 ? 'site' : 'sites'}`}\n </Button>\n ) : hosts.length > ORG_LEAD_SURFACES_OPEN_SITES ? (\n <Button\n size=\"small\"\n variant=\"text\"\n onClick={() => setOpened(false)}\n sx={{ alignSelf: 'flex-start' }}\n >\n {`Show the first ${ORG_LEAD_SURFACES_OPEN_SITES} sites only`}\n </Button>\n ) : null}\n </>\n )}\n </Stack>\n )\n}\nOrgLeadSurfacesNote.displayName = 'OrgLeadSurfacesNote'\n\n/**\n * One site's group: its name, then the same two rows the site note draws,\n * read by the same reader. A site with no forms says so in one line rather\n * than drawing an empty \"no form routes leads yet\" that reads like a\n * verdict on forms that do not exist.\n */\nfunction SiteLeadSurfaces(props: {\n host: ConsolePluginOrgHost\n mount: CrmOrgMount\n turningOn: LeadRoutingTarget | null\n onTurnOn: (form: LeadSurfaceForm) => void\n}) {\n const { host, mount, turningOn, onTurnOn } = props\n const { routed, unrouted, truncated, status } = useLeadSurfaceForms(host.id)\n const name = mount.siteName(host.id)\n const hubHref = mount.siteHubHref(host.id)\n const subdomain = mount.siteSubdomain(host.id)\n const formHref = useCallback(\n (formId: string) =>\n subdomain\n ? `${mount.hostsPath}/${encodeURIComponent(subdomain)}/forms/${encodeURIComponent(formId)}`\n : null,\n [mount.hostsPath, subdomain],\n )\n return (\n <Stack spacing={0.25}>\n <Typography variant=\"subtitle2\" component=\"div\">\n {hubHref ? (\n <AppLink href={`${hubHref}/leads`} underline=\"hover\">\n {name}\n </AppLink>\n ) : (\n name\n )}\n </Typography>\n <Typography variant=\"body2\" color=\"text.secondary\" component=\"div\">\n {status === 'loading' ? (\n '…'\n ) : status === 'error' ? (\n 'The forms on this site could not be read.'\n ) : !routed.length && !unrouted.length ? (\n 'No forms on this site yet.'\n ) : routed.length ? (\n <>\n {'Routing leads: '}\n <LeadSurfaceFormList forms={routed} truncated={truncated} formHref={formHref} />\n {'.'}\n </>\n ) : (\n 'No form routes leads yet.'\n )}\n </Typography>\n {unrouted.length ? (\n <UnroutedLeadSurfaces\n hostId={host.id}\n forms={unrouted}\n formHref={formHref}\n turningOn={turningOn}\n onTurnOn={onTurnOn}\n />\n ) : null}\n </Stack>\n )\n}\nSiteLeadSurfaces.displayName = 'SiteLeadSurfaces'\n\nexport default OrgLeadSurfacesNote\n"],"names":["AppLink","Button","Stack","Typography","useCallback","useState","useCrmOrgMount","LEAD_SURFACES_CONTACTS_TOO","LEAD_SURFACES_INTRO","LeadSurfaceFormList","UnroutedLeadSurfaces","useLeadSurfaceForms","useTurnOnLeadRouting","ORG_LEAD_SURFACES_OPEN_SITES","OrgLeadSurfacesNote","mount","turningOn","turnOn","opened","setOpened","hosts","hostsReady","shown","slice","folded","length","spacing","variant","color","map","host","SiteLeadSurfaces","onTurnOn","form","hostId","id","siteName","size","onClick","sx","alignSelf","displayName","props","routed","unrouted","truncated","status","name","hubHref","siteHubHref","subdomain","siteSubdomain","formHref","formId","hostsPath","encodeURIComponent","component","href","underline","forms"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;AAGA,SAASA,OAAO,QAAQ,uBAAsB;AAC9C,SAASC,MAAM,EAAEC,KAAK,EAAEC,UAAU,QAAQ,gBAAe;AACzD,SAASC,WAAW,EAAEC,QAAQ,QAAQ,QAAO;AAC7C,SAA2BC,cAAc,QAAQ,gCAA4B;AAE7E,SACEC,0BAA0B,EAC1BC,mBAAmB,EAEnBC,mBAAmB,EACnBC,oBAAoB,EACpBC,mBAAmB,EACnBC,oBAAoB,QACf,0BAAsB;AAE7B;;;;CAIC,GACD,OAAO,MAAMC,+BAA+B,EAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GACD,OAAO,SAASC;IACd,MAAMC,QAAQT;IACd,MAAM,EAAEU,SAAS,EAAEC,MAAM,EAAE,GAAGL;IAC9B,MAAM,CAACM,QAAQC,UAAU,GAAGd,SAAS;IACrC,IAAI,CAACU,OAAO,OAAO;IACnB,MAAM,EAAEK,KAAK,EAAEC,UAAU,EAAE,GAAGN;IAC9B,MAAMO,QAAQJ,SAASE,QAAQA,MAAMG,KAAK,CAAC,GAAGV;IAC9C,MAAMW,SAASJ,MAAMK,MAAM,GAAGH,MAAMG,MAAM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