@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,746 @@
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, Fragment as _Fragment } from "react/jsx-runtime";
19
+ /**
20
+ * IMPORTING A CSV INTO A CRM COLLECTION — the screen, for whichever
21
+ * collection (AGL-2602, shared since AGL-2621).
22
+ *
23
+ * The contact import settled the walk from a file on disk to a result the
24
+ * operator can act on: choose the file, read what is in it, match its
25
+ * columns to fields with the first row beside each, preview the ten rows
26
+ * the mapping produces, run it in bounded requests with a progress bar,
27
+ * and report what was added, updated and skipped with the skipped rows as
28
+ * a file to fix. A companies file walks the same path with a different
29
+ * vocabulary, so the walk lives here once and each collection hands in a
30
+ * {@link CsvImportVocabulary}: its fields and their labels, the one field
31
+ * every row needs, its route, its tally, its template.
32
+ *
33
+ * ## The file is read in the browser, and judged on the server
34
+ *
35
+ * `parseCsv` — the same parser the list import and the dataset import run
36
+ * — turns the file into cells here, so the operator can map and preview
37
+ * without a round trip and without uploading a file they may still decide
38
+ * not to import. Nothing is VALIDATED here beyond counting the rows whose
39
+ * required cell is unusable, and that count is a courtesy: every row is
40
+ * judged by the route, through the normalizers every other door uses, and
41
+ * the numbers on the result panel are the server's.
42
+ *
43
+ * ## Bounded requests, and closing stops them
44
+ *
45
+ * A chunk per request, as many requests as the file needs, and a progress
46
+ * bar between them. Closing the drawer mid-run stops the loop after the
47
+ * request in flight; the rows already written stay written and the result
48
+ * panel says how far it got. There is no durable job to resume — an import
49
+ * is idempotent by construction (the door dedupes on the address, or the
50
+ * domain and the name), so running the same file again finishes what a
51
+ * closed drawer left, reporting the earlier rows as merged.
52
+ */ import { customImportTarget, customImportTargetKey, LIST_IMPORT_MAX_CHARACTERS, parseCsv } from "@aglyn/aglyn";
53
+ import { ICON_VARIANT_CLOSE } from "@aglyn/shared-data-enums";
54
+ import { Container, HelpTip, MdiIcon, SrOnly } from "@aglyn/shared-ui-jsx";
55
+ import { NavigationDrawerComponent } from "@aglyn/shared-ui-jsx/components/navigation-drawer.component";
56
+ import { ScrollTable } from "@aglyn/shared-ui-jsx/components/scroll-table.component";
57
+ import { useSnackbar } from "@aglyn/shared-ui-snackstack";
58
+ import { authorizedFetch } from "@aglyn/shared-util-http/authorized-token";
59
+ import { useOrgDataScope, useUser } from "@aglyn/tenant-feature-instance";
60
+ import { useConsoleWidgetSlot } from "@aglyn/aglyn/app-utils/console-widget-slot-context";
61
+ import { Alert, AlertTitle, Box, Button, Chip, IconButton, LinearProgress, MenuItem, Stack, TableBody, TableCell, TableHead, TableRow, TextField, Typography } from "@mui/material";
62
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
63
+ import { useCrmOrgMount } from "../hooks/use-crm-org-mount.js";
64
+ import { downloadTextFile } from "../model/contacts-csv.js";
65
+ import { importColumns } from "../model/import-column-shapes.js";
66
+ import { CrmSitePicker } from "./crm-site-picker.js";
67
+ /** The value the mapping select shows for a column that is not imported. */ const SKIP_TARGET = '';
68
+ /** What a target is called — a standard field's label, or the custom field's. */ function targetLabel(target, vocabulary) {
69
+ var _vocabulary_fieldLabels_target;
70
+ const customKey = customImportTargetKey(target);
71
+ if (customKey) {
72
+ var _ref;
73
+ var _vocabulary_customFields_find, _vocabulary_customFields;
74
+ return (_ref = (_vocabulary_customFields = vocabulary.customFields) == null ? void 0 : (_vocabulary_customFields_find = _vocabulary_customFields.find((field)=>field.key === customKey)) == null ? void 0 : _vocabulary_customFields_find.label) != null ? _ref : customKey;
75
+ }
76
+ return (_vocabulary_fieldLabels_target = vocabulary.fieldLabels[target]) != null ? _vocabulary_fieldLabels_target : target;
77
+ }
78
+ /** What a dropped-value field is called in the result panel — the label without its hint. */ function droppedFieldLabel(field, vocabulary) {
79
+ return targetLabel(field, vocabulary).replace(/ \(.*\)$/, '');
80
+ }
81
+ export function CsvImportDrawer(props) {
82
+ var _ref, _rows_;
83
+ const { open, onClose, hostId, vocabulary } = props;
84
+ const { data: user } = useUser();
85
+ const { enqueueSnackbar } = useSnackbar();
86
+ // The site every row is captured under: the mounted one, or at the
87
+ // organization level the one the picker named — `null` until it has.
88
+ const mount = useCrmOrgMount();
89
+ const createHostId = (_ref = hostId != null ? hostId : mount == null ? void 0 : mount.createHostId) != null ? _ref : null;
90
+ const [fileName, setFileName] = useState('');
91
+ const [columns, setColumns] = useState([]);
92
+ const [rows, setRows] = useState([]);
93
+ /** How many rows the file had past the ceiling, so the drawer can say so. */ const [overCeiling, setOverCeiling] = useState(0);
94
+ const [mapping, setMapping] = useState({});
95
+ const [result, setResult] = useState(null);
96
+ const [progress, setProgress] = useState(null);
97
+ const [busy, setBusy] = useState(false);
98
+ /**
99
+ * Set when the drawer closes mid-run, read by the loop.
100
+ *
101
+ * A ref and not state, for the reason the list import gives: the loop is
102
+ * an `async` function that captured its closure when it started, and a
103
+ * state value it read would be the one from that render.
104
+ */ const abandoned = useRef(false);
105
+ useEffect(()=>{
106
+ if (open) abandoned.current = false;
107
+ }, [
108
+ open
109
+ ]);
110
+ const reset = useCallback(()=>{
111
+ setFileName('');
112
+ setColumns([]);
113
+ setRows([]);
114
+ setOverCeiling(0);
115
+ setMapping({});
116
+ setResult(null);
117
+ setProgress(null);
118
+ }, []);
119
+ const handleClose = useCallback(()=>{
120
+ abandoned.current = true;
121
+ onClose();
122
+ }, [
123
+ onClose
124
+ ]);
125
+ const handleFile = useCallback(async (file)=>{
126
+ if (!file) return;
127
+ const contents = await file.text().catch(()=>'');
128
+ if (contents.length > LIST_IMPORT_MAX_CHARACTERS) {
129
+ return void enqueueSnackbar('That file is too large to read in one go. Split it and import the ' + 'pieces.', {
130
+ variant: 'warning',
131
+ allowDuplicate: true
132
+ });
133
+ }
134
+ const table = parseCsv(contents).filter((cells)=>cells.some((cell)=>String(cell != null ? cell : '').trim()));
135
+ if (table.length < 2) {
136
+ return void enqueueSnackbar('That file needs a header row and at least one row under it.', {
137
+ variant: 'warning',
138
+ allowDuplicate: true
139
+ });
140
+ }
141
+ const header = table[0].map((cell)=>String(cell != null ? cell : '').trim());
142
+ const body = table.slice(1);
143
+ setFileName(file.name);
144
+ setColumns(header);
145
+ setRows(body.slice(0, vocabulary.maxRows));
146
+ setOverCeiling(Math.max(0, body.length - vocabulary.maxRows));
147
+ setMapping(vocabulary.guessMapping(header));
148
+ setResult(null);
149
+ setProgress(null);
150
+ }, [
151
+ enqueueSnackbar,
152
+ vocabulary
153
+ ]);
154
+ const requiredMapped = Object.values(mapping).includes(vocabulary.requiredField);
155
+ /** Rows whose required cell the server would refuse. */ const unusableRows = useMemo(()=>{
156
+ var _ref, _vocabulary_unusable;
157
+ var _Object_entries_find;
158
+ const at = Number((_ref = (_Object_entries_find = Object.entries(mapping).find(([, target])=>target === vocabulary.requiredField)) == null ? void 0 : _Object_entries_find[0]) != null ? _ref : -1);
159
+ if (at < 0) return rows.length;
160
+ const unusable = (_vocabulary_unusable = vocabulary.unusable) != null ? _vocabulary_unusable : (cell)=>!cell.trim();
161
+ return rows.filter((cells)=>{
162
+ var _cells_at;
163
+ return unusable(String((_cells_at = cells[at]) != null ? _cells_at : ''));
164
+ }).length;
165
+ }, [
166
+ mapping,
167
+ rows,
168
+ vocabulary
169
+ ]);
170
+ const preview = useMemo(()=>rows.slice(0, vocabulary.previewRows).map((cells)=>vocabulary.mapRow(cells, mapping)), [
171
+ rows,
172
+ mapping,
173
+ vocabulary
174
+ ]);
175
+ const mappedTargets = useMemo(()=>Object.entries(mapping).sort(([a], [b])=>Number(a) - Number(b)).map(([, target])=>target), [
176
+ mapping
177
+ ]);
178
+ /*
179
+ * The `importMapping` zone (AGL-2917), hosted through the shell's renderer:
180
+ * a widget there reads each column's header and shape, never a cell, and
181
+ * proposes a matching, which replaces the table's above for the preview to
182
+ * show. A target this import does not offer, or one a column before it
183
+ * already took, is dropped, as the table itself would refuse it.
184
+ */ const MappingSlot = useConsoleWidgetSlot();
185
+ const { orgId } = useOrgDataScope({
186
+ hostId: hostId != null ? hostId : undefined,
187
+ orgId: mount == null ? void 0 : mount.orgId
188
+ });
189
+ const shapedColumns = useMemo(()=>importColumns(columns, rows), [
190
+ columns,
191
+ rows
192
+ ]);
193
+ const offeredTargets = useMemo(()=>{
194
+ var _vocabulary_customFields;
195
+ return new Set([
196
+ ...vocabulary.fields,
197
+ ...((_vocabulary_customFields = vocabulary.customFields) != null ? _vocabulary_customFields : []).map((field)=>customImportTarget(field.key))
198
+ ]);
199
+ }, [
200
+ vocabulary
201
+ ]);
202
+ const proposeMapping = useCallback((proposed)=>{
203
+ const taken = new Set();
204
+ const next = {};
205
+ for (const [column, target] of Object.entries(proposed).sort(([a], [b])=>Number(a) - Number(b))){
206
+ const index = Number(column);
207
+ if (!Number.isInteger(index) || index < 0 || index >= columns.length) continue;
208
+ if (!offeredTargets.has(target) || taken.has(target)) continue;
209
+ taken.add(target);
210
+ next[index] = target;
211
+ }
212
+ setMapping(next);
213
+ }, [
214
+ offeredTargets,
215
+ columns.length
216
+ ]);
217
+ const handleMap = useCallback((index, target)=>{
218
+ setMapping((previous)=>{
219
+ const next = {};
220
+ for (const [column, existing] of Object.entries(previous)){
221
+ // One column per target: choosing a target already taken moves it
222
+ // here rather than importing one field from two columns.
223
+ if (Number(column) !== index && existing !== target) {
224
+ next[Number(column)] = existing;
225
+ }
226
+ }
227
+ if (target !== SKIP_TARGET) next[index] = target;
228
+ return next;
229
+ });
230
+ }, []);
231
+ /**
232
+ * Runs the file, one bounded request at a time.
233
+ *
234
+ * Every chunk's result is folded into the running total as it arrives,
235
+ * so a file that stops halfway — a lost connection, a closed drawer —
236
+ * still reports what it did rather than nothing.
237
+ */ const handleImport = useCallback(async ()=>{
238
+ if (busy || !rows.length || !requiredMapped || !createHostId) return;
239
+ setBusy(true);
240
+ let total = vocabulary.emptyResult();
241
+ setResult(total);
242
+ setProgress({
243
+ sent: 0,
244
+ total: rows.length
245
+ });
246
+ try {
247
+ for(let offset = 0; offset < rows.length; offset += vocabulary.chunkSize){
248
+ if (abandoned.current) return;
249
+ const chunk = rows.slice(offset, offset + vocabulary.chunkSize).map((cells)=>vocabulary.mapRow(cells, mapping));
250
+ const response = await authorizedFetch(user, vocabulary.route, {
251
+ method: 'POST',
252
+ headers: {
253
+ 'Content-Type': 'application/json'
254
+ },
255
+ body: JSON.stringify({
256
+ hostId: createHostId,
257
+ rows: chunk
258
+ })
259
+ });
260
+ const payload = await response.json().catch(()=>({}));
261
+ if (!response.ok) {
262
+ var _ref;
263
+ return void enqueueSnackbar((_ref = payload == null ? void 0 : payload.error) != null ? _ref : 'The import could not continue.', {
264
+ variant: 'warning',
265
+ allowDuplicate: true
266
+ });
267
+ }
268
+ total = vocabulary.mergeResults(total, payload, offset);
269
+ setResult(total);
270
+ setProgress({
271
+ sent: Math.min(offset + chunk.length, rows.length),
272
+ total: rows.length
273
+ });
274
+ }
275
+ enqueueSnackbar('Import finished', {
276
+ variant: 'success',
277
+ persist: false
278
+ });
279
+ } catch (unused) {
280
+ enqueueSnackbar('The import could not continue.', {
281
+ variant: 'warning',
282
+ allowDuplicate: true
283
+ });
284
+ } finally{
285
+ setBusy(false);
286
+ }
287
+ }, [
288
+ busy,
289
+ rows,
290
+ requiredMapped,
291
+ mapping,
292
+ user,
293
+ createHostId,
294
+ enqueueSnackbar,
295
+ vocabulary
296
+ ]);
297
+ const handleDownloadSkipped = useCallback(()=>{
298
+ if (!(result == null ? void 0 : result.skipped.length)) return;
299
+ downloadTextFile(vocabulary.skippedFileName, 'text/csv', vocabulary.skippedCsv(columns, result.skipped.map((entry)=>{
300
+ var _rows_entry_index;
301
+ return {
302
+ cells: (_rows_entry_index = rows[entry.index]) != null ? _rows_entry_index : [],
303
+ reason: entry.reason
304
+ };
305
+ })));
306
+ }, [
307
+ result,
308
+ columns,
309
+ rows,
310
+ vocabulary
311
+ ]);
312
+ const finished = !!result && !busy;
313
+ return /*#__PURE__*/ _jsx(NavigationDrawerComponent, {
314
+ open: open,
315
+ anchor: "right",
316
+ variant: "temporary",
317
+ onClose: handleClose,
318
+ AppBarProps: {
319
+ color: 'surface'
320
+ },
321
+ appBarLeft: /*#__PURE__*/ _jsxs(_Fragment, {
322
+ children: [
323
+ /*#__PURE__*/ _jsxs(IconButton, {
324
+ color: "inherit",
325
+ edge: "start",
326
+ onClick: handleClose,
327
+ sx: {
328
+ mr: 2
329
+ },
330
+ children: [
331
+ /*#__PURE__*/ _jsx(MdiIcon, {
332
+ path: ICON_VARIANT_CLOSE.path
333
+ }),
334
+ /*#__PURE__*/ _jsx(SrOnly, {
335
+ children: 'close drawer'
336
+ })
337
+ ]
338
+ }),
339
+ /*#__PURE__*/ _jsx(Typography, {
340
+ variant: "h6",
341
+ component: "div",
342
+ children: vocabulary.title
343
+ }),
344
+ /*#__PURE__*/ _jsx(HelpTip, _extends({}, vocabulary.help))
345
+ ]
346
+ }),
347
+ appBarRight: /*#__PURE__*/ _jsx(Button, {
348
+ variant: "outlined",
349
+ color: "inherit",
350
+ onClick: handleClose,
351
+ children: finished ? 'Done' : 'Cancel'
352
+ }),
353
+ children: /*#__PURE__*/ _jsx(Container, {
354
+ gutterY: true,
355
+ children: /*#__PURE__*/ _jsx(Stack, {
356
+ spacing: 2,
357
+ children: result ? /*#__PURE__*/ _jsx(ImportResultPanel, {
358
+ result: result,
359
+ progress: progress,
360
+ busy: busy,
361
+ vocabulary: vocabulary,
362
+ onDownloadSkipped: handleDownloadSkipped,
363
+ onAnother: reset
364
+ }) : /*#__PURE__*/ _jsxs(_Fragment, {
365
+ children: [
366
+ /*#__PURE__*/ _jsx(CrmSitePicker, {
367
+ hostId: hostId,
368
+ disabled: busy,
369
+ helperText: vocabulary.sitePickerHelperText
370
+ }),
371
+ /*#__PURE__*/ _jsx(Typography, {
372
+ variant: "body2",
373
+ color: "text.secondary",
374
+ children: vocabulary.intro
375
+ }),
376
+ /*#__PURE__*/ _jsxs(Stack, {
377
+ direction: "row",
378
+ spacing: 1,
379
+ sx: {
380
+ alignItems: 'center',
381
+ flexWrap: 'wrap',
382
+ rowGap: 1
383
+ },
384
+ children: [
385
+ /*#__PURE__*/ _jsxs(Button, {
386
+ variant: "outlined",
387
+ component: "label",
388
+ disabled: busy,
389
+ children: [
390
+ 'Choose file',
391
+ /*#__PURE__*/ _jsx("input", {
392
+ type: "file",
393
+ accept: ".csv,text/csv",
394
+ hidden: true,
395
+ onChange: (event)=>{
396
+ var _event_target_files;
397
+ void handleFile((_event_target_files = event.target.files) == null ? void 0 : _event_target_files[0]);
398
+ event.target.value = '';
399
+ }
400
+ })
401
+ ]
402
+ }),
403
+ /*#__PURE__*/ _jsx(Button, {
404
+ size: "small",
405
+ disabled: busy,
406
+ onClick: ()=>downloadTextFile(vocabulary.templateFileName, 'text/csv', vocabulary.templateCsv()),
407
+ children: 'Download template'
408
+ }),
409
+ fileName ? /*#__PURE__*/ _jsx(Chip, {
410
+ size: "small",
411
+ variant: "outlined",
412
+ label: fileName
413
+ }) : null,
414
+ rows.length ? /*#__PURE__*/ _jsx(Typography, {
415
+ variant: "body2",
416
+ color: "text.secondary",
417
+ children: `${rows.length.toLocaleString()} rows`
418
+ }) : null
419
+ ]
420
+ }),
421
+ overCeiling > 0 ? /*#__PURE__*/ _jsx(Alert, {
422
+ severity: "warning",
423
+ children: `This file has ${(rows.length + overCeiling).toLocaleString()} ` + `rows. Only the first ${vocabulary.maxRows.toLocaleString()} ` + 'are imported — split the file and import the rest ' + 'separately.'
424
+ }) : null,
425
+ columns.length ? /*#__PURE__*/ _jsx(ImportMappingTable, {
426
+ columns: columns,
427
+ sample: (_rows_ = rows[0]) != null ? _rows_ : [],
428
+ mapping: mapping,
429
+ vocabulary: vocabulary,
430
+ onMap: handleMap
431
+ }) : null,
432
+ columns.length && MappingSlot && vocabulary.collection ? /*#__PURE__*/ _jsx(MappingSlot, {
433
+ slot: "importMapping",
434
+ hostId: hostId,
435
+ orgId: orgId != null ? orgId : undefined,
436
+ collection: vocabulary.collection,
437
+ columns: shapedColumns,
438
+ mapping: mapping,
439
+ proposeMapping: (proposed)=>proposeMapping(proposed)
440
+ }) : null,
441
+ columns.length > 0 && !requiredMapped ? /*#__PURE__*/ _jsx(Alert, {
442
+ severity: "warning",
443
+ children: vocabulary.requiredWarning
444
+ }) : null,
445
+ columns.length > 0 && requiredMapped ? /*#__PURE__*/ _jsx(ImportPreviewTable, {
446
+ targets: mappedTargets,
447
+ preview: preview,
448
+ total: rows.length,
449
+ unusable: unusableRows,
450
+ vocabulary: vocabulary
451
+ }) : null,
452
+ /*#__PURE__*/ _jsx(Stack, {
453
+ direction: "row",
454
+ spacing: 1,
455
+ sx: {
456
+ justifyContent: 'flex-end'
457
+ },
458
+ children: /*#__PURE__*/ _jsx(Button, {
459
+ variant: "contained",
460
+ // Held until the capturing site is known.
461
+ disabled: busy || !rows.length || !requiredMapped || !createHostId,
462
+ onClick: ()=>void handleImport(),
463
+ children: rows.length ? `Import ${rows.length.toLocaleString()} rows` : 'Import'
464
+ })
465
+ })
466
+ ]
467
+ })
468
+ })
469
+ })
470
+ });
471
+ }
472
+ CsvImportDrawer.displayName = 'CsvImportDrawer';
473
+ /**
474
+ * WHICH COLUMN IS WHICH.
475
+ *
476
+ * One row per column in the file: its header, the first row's value under
477
+ * it so the operator can tell "Title" the job from "Title" the honorific,
478
+ * and a select naming where it goes. The proposal came from the alias
479
+ * table; every row of this table is the operator's to overrule.
480
+ */ function ImportMappingTable(props) {
481
+ const { columns, sample, mapping, vocabulary, onMap } = props;
482
+ return /*#__PURE__*/ _jsxs(Stack, {
483
+ spacing: 1,
484
+ children: [
485
+ /*#__PURE__*/ _jsx(Typography, {
486
+ variant: "subtitle2",
487
+ children: 'Columns'
488
+ }),
489
+ /*#__PURE__*/ _jsxs(ScrollTable, {
490
+ size: "small",
491
+ children: [
492
+ /*#__PURE__*/ _jsx(TableHead, {
493
+ children: /*#__PURE__*/ _jsxs(TableRow, {
494
+ children: [
495
+ /*#__PURE__*/ _jsx(TableCell, {
496
+ children: 'Column'
497
+ }),
498
+ /*#__PURE__*/ _jsx(TableCell, {
499
+ children: 'First row'
500
+ }),
501
+ /*#__PURE__*/ _jsx(TableCell, {
502
+ children: 'Imports as'
503
+ })
504
+ ]
505
+ })
506
+ }),
507
+ /*#__PURE__*/ _jsx(TableBody, {
508
+ children: columns.map((column, index)=>{
509
+ var _sample_index, _mapping_index, _vocabulary_customFields;
510
+ return /*#__PURE__*/ _jsxs(TableRow, {
511
+ children: [
512
+ /*#__PURE__*/ _jsx(TableCell, {
513
+ children: column || `Column ${index + 1}`
514
+ }),
515
+ /*#__PURE__*/ _jsx(TableCell, {
516
+ children: /*#__PURE__*/ _jsx(Typography, {
517
+ variant: "body2",
518
+ color: "text.secondary",
519
+ noWrap: true,
520
+ children: String((_sample_index = sample[index]) != null ? _sample_index : '')
521
+ })
522
+ }),
523
+ /*#__PURE__*/ _jsx(TableCell, {
524
+ children: /*#__PURE__*/ _jsxs(TextField, {
525
+ select: true,
526
+ size: "small",
527
+ value: (_mapping_index = mapping[index]) != null ? _mapping_index : SKIP_TARGET,
528
+ onChange: (event)=>onMap(index, event.target.value),
529
+ sx: {
530
+ minWidth: 220
531
+ },
532
+ children: [
533
+ /*#__PURE__*/ _jsx(MenuItem, {
534
+ value: SKIP_TARGET,
535
+ children: 'Do not import'
536
+ }),
537
+ vocabulary.fields.map((field)=>/*#__PURE__*/ _jsx(MenuItem, {
538
+ value: field,
539
+ children: vocabulary.fieldLabels[field]
540
+ }, field)),
541
+ ((_vocabulary_customFields = vocabulary.customFields) != null ? _vocabulary_customFields : []).map((field)=>/*#__PURE__*/ _jsx(MenuItem, {
542
+ value: customImportTarget(field.key),
543
+ children: `${field.label} (custom)`
544
+ }, field.key))
545
+ ]
546
+ })
547
+ })
548
+ ]
549
+ }, `${column}-${index}`);
550
+ })
551
+ })
552
+ ]
553
+ })
554
+ ]
555
+ });
556
+ }
557
+ /**
558
+ * The first rows, as the mapping reads them.
559
+ *
560
+ * Verbatim cell values under the fields they were mapped to — not the
561
+ * normalized ones, because normalization is the server's and a preview that
562
+ * showed a cleaned phone number would be promising a result the route may
563
+ * refuse. What it does say is how many rows have no usable required cell,
564
+ * since that is the one refusal the operator can fix before sending.
565
+ */ function ImportPreviewTable(props) {
566
+ const { targets, preview, total, unusable, vocabulary } = props;
567
+ const cell = (row, target)=>{
568
+ var _row_target;
569
+ const customKey = customImportTargetKey(target);
570
+ if (customKey) {
571
+ var _ref;
572
+ var _row_custom;
573
+ return String((_ref = (_row_custom = row['custom']) == null ? void 0 : _row_custom[customKey]) != null ? _ref : '');
574
+ }
575
+ return String((_row_target = row[target]) != null ? _row_target : '');
576
+ };
577
+ return /*#__PURE__*/ _jsxs(Stack, {
578
+ spacing: 1,
579
+ children: [
580
+ /*#__PURE__*/ _jsx(Typography, {
581
+ variant: "subtitle2",
582
+ children: `Preview — first ${Math.min(preview.length, vocabulary.previewRows)} of ${total.toLocaleString()}`
583
+ }),
584
+ unusable > 0 ? /*#__PURE__*/ _jsx(Alert, {
585
+ severity: "info",
586
+ children: vocabulary.unusableNotice(unusable, total)
587
+ }) : null,
588
+ /*#__PURE__*/ _jsx(Box, {
589
+ children: /*#__PURE__*/ _jsxs(ScrollTable, {
590
+ size: "small",
591
+ children: [
592
+ /*#__PURE__*/ _jsx(TableHead, {
593
+ children: /*#__PURE__*/ _jsx(TableRow, {
594
+ children: targets.map((target)=>/*#__PURE__*/ _jsx(TableCell, {
595
+ children: targetLabel(target, vocabulary)
596
+ }, target))
597
+ })
598
+ }),
599
+ /*#__PURE__*/ _jsx(TableBody, {
600
+ children: preview.map((row, index)=>/*#__PURE__*/ _jsx(TableRow, {
601
+ children: targets.map((target)=>/*#__PURE__*/ _jsx(TableCell, {
602
+ children: /*#__PURE__*/ _jsx(Typography, {
603
+ variant: "body2",
604
+ noWrap: true,
605
+ sx: {
606
+ maxWidth: 240
607
+ },
608
+ children: cell(row, target)
609
+ })
610
+ }, target))
611
+ }, index))
612
+ })
613
+ ]
614
+ })
615
+ })
616
+ ]
617
+ });
618
+ }
619
+ /** How far the run has got, and what it did. */ function ImportResultPanel(props) {
620
+ var _ref, _ref1;
621
+ const { result, progress, busy, vocabulary, onDownloadSkipped, onAnother } = props;
622
+ const percent = (progress == null ? void 0 : progress.total) ? Math.min(progress.sent / progress.total * 100, 100) : 0;
623
+ const skippedByReason = useMemo(()=>{
624
+ const counts = {};
625
+ for (const entry of result.skipped){
626
+ var _counts_entry_reason;
627
+ counts[entry.reason] = ((_counts_entry_reason = counts[entry.reason]) != null ? _counts_entry_reason : 0) + 1;
628
+ }
629
+ return Object.entries(counts);
630
+ }, [
631
+ result.skipped
632
+ ]);
633
+ const droppedFields = Object.entries(result.dropped).filter(([, count])=>count > 0);
634
+ return /*#__PURE__*/ _jsxs(Stack, {
635
+ spacing: 2,
636
+ children: [
637
+ /*#__PURE__*/ _jsx(Typography, {
638
+ variant: "body2",
639
+ color: "text.secondary",
640
+ children: busy ? `${((_ref = progress == null ? void 0 : progress.sent) != null ? _ref : 0).toLocaleString()} of ${((_ref1 = progress == null ? void 0 : progress.total) != null ? _ref1 : 0).toLocaleString()} rows sent.` : `Finished. ${result.created.toLocaleString()} added, ` + `${result.merged.toLocaleString()} updated, ` + `${result.skipped.length.toLocaleString()} skipped.`
641
+ }),
642
+ /*#__PURE__*/ _jsx(LinearProgress, {
643
+ variant: "determinate",
644
+ value: percent,
645
+ sx: {
646
+ borderRadius: 1
647
+ }
648
+ }),
649
+ skippedByReason.length ? /*#__PURE__*/ _jsxs(ScrollTable, {
650
+ size: "small",
651
+ children: [
652
+ /*#__PURE__*/ _jsx(TableHead, {
653
+ children: /*#__PURE__*/ _jsxs(TableRow, {
654
+ children: [
655
+ /*#__PURE__*/ _jsx(TableCell, {
656
+ children: 'Skipped'
657
+ }),
658
+ /*#__PURE__*/ _jsx(TableCell, {
659
+ align: "right",
660
+ children: 'Rows'
661
+ })
662
+ ]
663
+ })
664
+ }),
665
+ /*#__PURE__*/ _jsx(TableBody, {
666
+ children: skippedByReason.map(([reason, count])=>{
667
+ var _vocabulary_skipLabels_reason;
668
+ return /*#__PURE__*/ _jsxs(TableRow, {
669
+ children: [
670
+ /*#__PURE__*/ _jsx(TableCell, {
671
+ children: (_vocabulary_skipLabels_reason = vocabulary.skipLabels[reason]) != null ? _vocabulary_skipLabels_reason : reason
672
+ }),
673
+ /*#__PURE__*/ _jsx(TableCell, {
674
+ align: "right",
675
+ children: count
676
+ })
677
+ ]
678
+ }, reason);
679
+ })
680
+ })
681
+ ]
682
+ }) : null,
683
+ droppedFields.length ? /*#__PURE__*/ _jsxs(Alert, {
684
+ severity: "info",
685
+ children: [
686
+ /*#__PURE__*/ _jsx(AlertTitle, {
687
+ children: 'Some values could not be read'
688
+ }),
689
+ 'The rows were imported without them: ' + droppedFields.map(([field, count])=>`${droppedFieldLabel(field, vocabulary)} (${count})`).join(', ') + '.'
690
+ ]
691
+ }) : null,
692
+ result.ownersUnresolved.length ? /*#__PURE__*/ _jsx(Alert, {
693
+ severity: "info",
694
+ children: 'No team member has these owner addresses, so those rows ' + `have no owner: ${result.ownersUnresolved.slice(0, 5).join(', ')}` + (result.ownersUnresolved.length > 5 ? ` and ${result.ownersUnresolved.length - 5} more.` : '.')
695
+ }) : null,
696
+ vocabulary.resultExtras == null ? void 0 : vocabulary.resultExtras.call(vocabulary, result),
697
+ /*#__PURE__*/ _jsxs(Stack, {
698
+ direction: "row",
699
+ spacing: 1,
700
+ sx: {
701
+ justifyContent: 'flex-end'
702
+ },
703
+ children: [
704
+ result.skipped.length ? /*#__PURE__*/ _jsx(Button, {
705
+ variant: "outlined",
706
+ onClick: onDownloadSkipped,
707
+ children: 'Download skipped rows'
708
+ }) : null,
709
+ !busy ? /*#__PURE__*/ _jsx(Button, {
710
+ variant: "outlined",
711
+ onClick: onAnother,
712
+ children: 'Import another file'
713
+ }) : null
714
+ ]
715
+ })
716
+ ]
717
+ });
718
+ }
719
+ /**
720
+ * An "Import CSV" button that mounts its drawer only once it has been
721
+ * opened, so the list pays nothing — no hooks, no listeners — for a
722
+ * feature the operator has not reached for.
723
+ */ export function CsvImportButton(props) {
724
+ const { label = 'Import CSV', children } = props;
725
+ const [open, setOpen] = useState(false);
726
+ const [mounted, setMounted] = useState(false);
727
+ const handleOpen = useCallback(()=>{
728
+ setMounted(true);
729
+ setOpen(true);
730
+ }, []);
731
+ const handleClose = useCallback(()=>setOpen(false), []);
732
+ return /*#__PURE__*/ _jsxs(_Fragment, {
733
+ children: [
734
+ /*#__PURE__*/ _jsx(Button, {
735
+ size: "small",
736
+ onClick: handleOpen,
737
+ children: label
738
+ }),
739
+ mounted ? children(open, handleClose) : null
740
+ ]
741
+ });
742
+ }
743
+ CsvImportButton.displayName = 'CsvImportButton';
744
+ export default CsvImportDrawer;
745
+
746
+ //# sourceMappingURL=csv-import-drawer.js.map