@aglyn/plugins-crm 1.0.0-beta.218 → 1.0.0-beta.220

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 (346) hide show
  1. package/README.md +2 -0
  2. package/package.json +14 -14
  3. package/src/index.d.ts +1 -0
  4. package/src/index.js.map +1 -1
  5. package/src/lib/components/companies-bulk-bar.js +12 -4
  6. package/src/lib/components/companies-bulk-bar.js.map +1 -1
  7. package/src/lib/components/company-detail-page.js +11 -0
  8. package/src/lib/components/company-detail-page.js.map +1 -1
  9. package/src/lib/components/company-edit-drawer.js +12 -2
  10. package/src/lib/components/company-edit-drawer.js.map +1 -1
  11. package/src/lib/components/company-import-drawer.d.ts +1 -1
  12. package/src/lib/components/company-picker.js +10 -3
  13. package/src/lib/components/company-picker.js.map +1 -1
  14. package/src/lib/components/contact-associations-card.js +4 -3
  15. package/src/lib/components/contact-associations-card.js.map +1 -1
  16. package/src/lib/components/contact-detail-page.d.ts +4 -4
  17. package/src/lib/components/contact-detail-page.js +50 -53
  18. package/src/lib/components/contact-detail-page.js.map +1 -1
  19. package/src/lib/components/contact-list-columns.d.ts +3 -0
  20. package/src/lib/components/contact-list-columns.js +21 -5
  21. package/src/lib/components/contact-list-columns.js.map +1 -1
  22. package/src/lib/components/contact-merge-dialog.js +2 -1
  23. package/src/lib/components/contact-merge-dialog.js.map +1 -1
  24. package/src/lib/components/contact-timeline-card.js +4 -3
  25. package/src/lib/components/contact-timeline-card.js.map +1 -1
  26. package/src/lib/components/contacts-bulk-bar.d.ts +3 -3
  27. package/src/lib/components/contacts-bulk-bar.js +24 -51
  28. package/src/lib/components/contacts-bulk-bar.js.map +1 -1
  29. package/src/lib/components/contacts-section.js +9 -3
  30. package/src/lib/components/contacts-section.js.map +1 -1
  31. package/src/lib/components/crm-booking-zone.d.ts +8 -2
  32. package/src/lib/components/crm-booking-zone.js.map +1 -1
  33. package/src/lib/components/crm-export-all-button.d.ts +1 -1
  34. package/src/lib/components/crm-export-all-button.js.map +1 -1
  35. package/src/lib/components/crm-glance-card.js +2 -1
  36. package/src/lib/components/crm-glance-card.js.map +1 -1
  37. package/src/lib/components/crm-send-email-dialog.js +9 -6
  38. package/src/lib/components/crm-send-email-dialog.js.map +1 -1
  39. package/src/lib/components/csv-import-drawer.js +2 -2
  40. package/src/lib/components/csv-import-drawer.js.map +1 -1
  41. package/src/lib/components/deal-detail-page.js +18 -2
  42. package/src/lib/components/deal-detail-page.js.map +1 -1
  43. package/src/lib/components/deal-edit-drawer.js +10 -0
  44. package/src/lib/components/deal-edit-drawer.js.map +1 -1
  45. package/src/lib/components/deal-products-card.js +27 -16
  46. package/src/lib/components/deal-products-card.js.map +1 -1
  47. package/src/lib/components/deals-bulk-bar.js +13 -5
  48. package/src/lib/components/deals-bulk-bar.js.map +1 -1
  49. package/src/lib/components/lead-campaigns-card.d.ts +4 -4
  50. package/src/lib/components/lead-campaigns-card.js +15 -8
  51. package/src/lib/components/lead-campaigns-card.js.map +1 -1
  52. package/src/lib/components/lead-detail-page.js +25 -5
  53. package/src/lib/components/lead-detail-page.js.map +1 -1
  54. package/src/lib/components/lead-properties-card.js +10 -0
  55. package/src/lib/components/lead-properties-card.js.map +1 -1
  56. package/src/lib/components/lead-status-chip.js +3 -1
  57. package/src/lib/components/lead-status-chip.js.map +1 -1
  58. package/src/lib/components/lead-surfaces-note.js +4 -5
  59. package/src/lib/components/lead-surfaces-note.js.map +1 -1
  60. package/src/lib/components/lead-unqualify-dialog.js +6 -0
  61. package/src/lib/components/lead-unqualify-dialog.js.map +1 -1
  62. package/src/lib/components/leads-bulk-bar.js +34 -11
  63. package/src/lib/components/leads-bulk-bar.js.map +1 -1
  64. package/src/lib/components/leads-section.js +41 -8
  65. package/src/lib/components/leads-section.js.map +1 -1
  66. package/src/lib/components/new-lead-drawer.js +5 -4
  67. package/src/lib/components/new-lead-drawer.js.map +1 -1
  68. package/src/lib/components/org-lead-surfaces-note.js +6 -2
  69. package/src/lib/components/org-lead-surfaces-note.js.map +1 -1
  70. package/src/lib/components/recipes-card.js +9 -4
  71. package/src/lib/components/recipes-card.js.map +1 -1
  72. package/src/lib/components/record-sharing-card.d.ts +57 -0
  73. package/src/lib/components/record-sharing-card.js +244 -0
  74. package/src/lib/components/record-sharing-card.js.map +1 -0
  75. package/src/lib/components/reports/activity-card.js +4 -3
  76. package/src/lib/components/reports/activity-card.js.map +1 -1
  77. package/src/lib/components/reports/closed-deals-card.js +4 -3
  78. package/src/lib/components/reports/closed-deals-card.js.map +1 -1
  79. package/src/lib/components/reports/contacts-mix-card.js +3 -2
  80. package/src/lib/components/reports/contacts-mix-card.js.map +1 -1
  81. package/src/lib/components/reports/contacts-trend-card.js +2 -1
  82. package/src/lib/components/reports/contacts-trend-card.js.map +1 -1
  83. package/src/lib/components/reports/forecast-card.js +3 -2
  84. package/src/lib/components/reports/forecast-card.js.map +1 -1
  85. package/src/lib/components/reports/lead-funnel-card.js +8 -6
  86. package/src/lib/components/reports/lead-funnel-card.js.map +1 -1
  87. package/src/lib/components/reports/pipeline-card.js +4 -3
  88. package/src/lib/components/reports/pipeline-card.js.map +1 -1
  89. package/src/lib/components/reports/report-format.d.ts +1 -1
  90. package/src/lib/components/reports/report-format.js.map +1 -1
  91. package/src/lib/components/reports/report-scope.d.ts +1 -1
  92. package/src/lib/components/reports/report-scope.js.map +1 -1
  93. package/src/lib/components/reports/source-conversion-card.js +2 -1
  94. package/src/lib/components/reports/source-conversion-card.js.map +1 -1
  95. package/src/lib/components/reports/tasks-card.js +2 -1
  96. package/src/lib/components/reports/tasks-card.js.map +1 -1
  97. package/src/lib/components/reports/won-lost-by-owner-card.js +3 -2
  98. package/src/lib/components/reports/won-lost-by-owner-card.js.map +1 -1
  99. package/src/lib/components/reports-section.js +4 -4
  100. package/src/lib/components/reports-section.js.map +1 -1
  101. package/src/lib/components/settings-section.js +7 -0
  102. package/src/lib/components/settings-section.js.map +1 -1
  103. package/src/lib/components/share-records-dialog.d.ts +28 -0
  104. package/src/lib/components/share-records-dialog.js +184 -0
  105. package/src/lib/components/share-records-dialog.js.map +1 -0
  106. package/src/lib/components/sharing-rule-drawer.d.ts +37 -0
  107. package/src/lib/components/sharing-rule-drawer.js +374 -0
  108. package/src/lib/components/sharing-rule-drawer.js.map +1 -0
  109. package/src/lib/components/sharing-rules-card.d.ts +24 -0
  110. package/src/lib/components/sharing-rules-card.js +287 -0
  111. package/src/lib/components/sharing-rules-card.js.map +1 -0
  112. package/src/lib/components/use-crm-api.d.ts +1 -1
  113. package/src/lib/components/use-crm-api.js.map +1 -1
  114. package/src/lib/components/use-site-route-context.d.ts +25 -0
  115. package/src/lib/components/use-site-route-context.js +58 -0
  116. package/src/lib/components/use-site-route-context.js.map +1 -0
  117. package/src/lib/constants/api-routes.d.ts +31 -0
  118. package/src/lib/constants/api-routes.js +27 -1
  119. package/src/lib/constants/api-routes.js.map +1 -1
  120. package/src/lib/constants/bundle-common.d.ts +2 -0
  121. package/src/lib/constants/bundle-common.js +1 -0
  122. package/src/lib/constants/bundle-common.js.map +1 -1
  123. package/src/lib/declarations.console-server.d.ts +41 -0
  124. package/src/lib/declarations.console-server.js +115 -0
  125. package/src/lib/declarations.console-server.js.map +1 -0
  126. package/src/lib/declarations.server.d.ts +12 -0
  127. package/src/lib/declarations.server.js +84 -1
  128. package/src/lib/declarations.server.js.map +1 -1
  129. package/src/lib/hooks/use-contact-remove.d.ts +35 -0
  130. package/src/lib/hooks/use-contact-remove.js +77 -0
  131. package/src/lib/hooks/use-contact-remove.js.map +1 -0
  132. package/src/lib/hooks/use-crm-campaigns.d.ts +2 -2
  133. package/src/lib/hooks/use-crm-campaigns.js +3 -3
  134. package/src/lib/hooks/use-crm-campaigns.js.map +1 -1
  135. package/src/lib/hooks/use-crm-sharing.d.ts +30 -0
  136. package/src/lib/hooks/use-crm-sharing.js +109 -0
  137. package/src/lib/hooks/use-crm-sharing.js.map +1 -0
  138. package/src/lib/model/campaign-filing-activity.d.ts +1 -1
  139. package/src/lib/model/campaign-filing-activity.js +1 -1
  140. package/src/lib/model/campaign-filing-activity.js.map +1 -1
  141. package/src/lib/model/companies-csv.d.ts +1 -1
  142. package/src/lib/model/companies-csv.js +2 -2
  143. package/src/lib/model/companies-csv.js.map +1 -1
  144. package/src/lib/model/contact-holder.d.ts +68 -0
  145. package/src/lib/model/contact-holder.js +129 -0
  146. package/src/lib/model/contact-holder.js.map +1 -0
  147. package/src/lib/model/contact-interaction-links.d.ts +46 -0
  148. package/src/lib/model/contact-interaction-links.js +65 -0
  149. package/src/lib/model/contact-interaction-links.js.map +1 -0
  150. package/src/lib/model/contact-merge.d.ts +136 -0
  151. package/src/lib/model/contact-merge.js +412 -0
  152. package/src/lib/model/contact-merge.js.map +1 -0
  153. package/src/lib/model/contact-record.d.ts +7 -1
  154. package/src/lib/model/contact-record.js +7 -6
  155. package/src/lib/model/contact-record.js.map +1 -1
  156. package/src/lib/model/contact-remove.d.ts +48 -0
  157. package/src/lib/model/contact-remove.js +22 -0
  158. package/src/lib/model/contact-remove.js.map +1 -0
  159. package/src/lib/model/contacts-bulk-writes.d.ts +2 -71
  160. package/src/lib/model/contacts-bulk-writes.js +2 -82
  161. package/src/lib/model/contacts-bulk-writes.js.map +1 -1
  162. package/src/lib/model/contacts-csv.d.ts +2 -2
  163. package/src/lib/model/contacts-csv.js +2 -2
  164. package/src/lib/model/contacts-csv.js.map +1 -1
  165. package/src/lib/model/crm-csv.d.ts +239 -0
  166. package/src/lib/model/crm-csv.js +467 -0
  167. package/src/lib/model/crm-csv.js.map +1 -0
  168. package/src/lib/model/crm-digest.d.ts +227 -0
  169. package/src/lib/model/crm-digest.js +336 -0
  170. package/src/lib/model/crm-digest.js.map +1 -0
  171. package/src/lib/model/crm-import.d.ts +7 -1
  172. package/src/lib/model/crm-import.js +2 -1
  173. package/src/lib/model/crm-import.js.map +1 -1
  174. package/src/lib/model/crm-inbound.d.ts +162 -0
  175. package/src/lib/model/crm-inbound.js +208 -0
  176. package/src/lib/model/crm-inbound.js.map +1 -0
  177. package/src/lib/model/crm-lead-import.d.ts +1 -1
  178. package/src/lib/model/crm-lead-import.js +4 -4
  179. package/src/lib/model/crm-lead-import.js.map +1 -1
  180. package/src/lib/model/crm-record-routes.d.ts +5 -0
  181. package/src/lib/model/crm-record-routes.js +7 -0
  182. package/src/lib/model/crm-record-routes.js.map +1 -1
  183. package/src/lib/model/crm-reports.d.ts +467 -0
  184. package/src/lib/model/crm-reports.js +667 -0
  185. package/src/lib/model/crm-reports.js.map +1 -0
  186. package/src/lib/model/crm-routes.d.ts +6 -5
  187. package/src/lib/model/crm-routes.js +7 -7
  188. package/src/lib/model/crm-routes.js.map +1 -1
  189. package/src/lib/model/crm-search-sources.d.ts +15 -0
  190. package/src/lib/model/crm-search-sources.js +162 -0
  191. package/src/lib/model/crm-search-sources.js.map +1 -0
  192. package/src/lib/model/crm-sharing-api.d.ts +32 -0
  193. package/src/lib/model/crm-sharing-api.js +59 -0
  194. package/src/lib/model/crm-sharing-api.js.map +1 -0
  195. package/src/lib/model/crm-sharing.d.ts +333 -0
  196. package/src/lib/model/crm-sharing.js +603 -0
  197. package/src/lib/model/crm-sharing.js.map +1 -0
  198. package/src/lib/model/deals-csv.d.ts +1 -1
  199. package/src/lib/model/deals-csv.js +4 -5
  200. package/src/lib/model/deals-csv.js.map +1 -1
  201. package/src/lib/model/lead-filters.d.ts +5 -4
  202. package/src/lib/model/lead-filters.js +7 -5
  203. package/src/lib/model/lead-filters.js.map +1 -1
  204. package/src/lib/model/leads-csv.d.ts +1 -1
  205. package/src/lib/model/leads-csv.js +1 -1
  206. package/src/lib/model/leads-csv.js.map +1 -1
  207. package/src/lib/model/tasks-csv.d.ts +1 -1
  208. package/src/lib/model/tasks-csv.js +1 -1
  209. package/src/lib/model/tasks-csv.js.map +1 -1
  210. package/src/lib/plan-entitlements.d.ts +75 -0
  211. package/src/lib/plan-entitlements.js +56 -0
  212. package/src/lib/plan-entitlements.js.map +1 -0
  213. package/src/lib/plugin.js +39 -0
  214. package/src/lib/plugin.js.map +1 -1
  215. package/src/lib/server/api-v1/contacts-merge.d.ts +20 -0
  216. package/src/lib/server/api-v1/contacts-merge.js +120 -0
  217. package/src/lib/server/api-v1/contacts-merge.js.map +1 -0
  218. package/src/lib/server/api-v1/contacts.d.ts +18 -0
  219. package/src/lib/server/api-v1/contacts.js +1076 -0
  220. package/src/lib/server/api-v1/contacts.js.map +1 -0
  221. package/src/lib/server/api-v1/crm-activities.d.ts +18 -0
  222. package/src/lib/server/api-v1/crm-activities.js +269 -0
  223. package/src/lib/server/api-v1/crm-activities.js.map +1 -0
  224. package/src/lib/server/api-v1/crm-companies.d.ts +18 -0
  225. package/src/lib/server/api-v1/crm-companies.js +391 -0
  226. package/src/lib/server/api-v1/crm-companies.js.map +1 -0
  227. package/src/lib/server/api-v1/crm-deals.d.ts +18 -0
  228. package/src/lib/server/api-v1/crm-deals.js +631 -0
  229. package/src/lib/server/api-v1/crm-deals.js.map +1 -0
  230. package/src/lib/server/api-v1/crm-email-templates.d.ts +18 -0
  231. package/src/lib/server/api-v1/crm-email-templates.js +336 -0
  232. package/src/lib/server/api-v1/crm-email-templates.js.map +1 -0
  233. package/src/lib/server/api-v1/crm-leads.d.ts +18 -0
  234. package/src/lib/server/api-v1/crm-leads.js +833 -0
  235. package/src/lib/server/api-v1/crm-leads.js.map +1 -0
  236. package/src/lib/server/api-v1/crm-pipelines.d.ts +76 -0
  237. package/src/lib/server/api-v1/crm-pipelines.js +146 -0
  238. package/src/lib/server/api-v1/crm-pipelines.js.map +1 -0
  239. package/src/lib/server/api-v1/crm-shared.d.ts +271 -0
  240. package/src/lib/server/api-v1/crm-shared.js +436 -0
  241. package/src/lib/server/api-v1/crm-shared.js.map +1 -0
  242. package/src/lib/server/api-v1/crm-tasks.d.ts +18 -0
  243. package/src/lib/server/api-v1/crm-tasks.js +398 -0
  244. package/src/lib/server/api-v1/crm-tasks.js.map +1 -0
  245. package/src/lib/server/api-v1/openapi.d.ts +29 -0
  246. package/src/lib/server/api-v1/openapi.js +985 -0
  247. package/src/lib/server/api-v1/openapi.js.map +1 -0
  248. package/src/lib/server/api-v1/usage.d.ts +26 -0
  249. package/src/lib/server/api-v1/usage.js +73 -0
  250. package/src/lib/server/api-v1/usage.js.map +1 -0
  251. package/src/lib/server/campaign-filing-activity.d.ts +1 -1
  252. package/src/lib/server/campaign-filing-activity.js +7 -11
  253. package/src/lib/server/campaign-filing-activity.js.map +1 -1
  254. package/src/lib/server/capture-contact.js +15 -4
  255. package/src/lib/server/capture-contact.js.map +1 -1
  256. package/src/lib/server/consent-group-participant.js +1 -1
  257. package/src/lib/server/consent-group-participant.js.map +1 -1
  258. package/src/lib/server/contact-email-engagement.d.ts +33 -0
  259. package/src/lib/server/contact-email-engagement.js +146 -0
  260. package/src/lib/server/contact-email-engagement.js.map +1 -0
  261. package/src/lib/server/contact-lifecycle-floor.d.ts +89 -0
  262. package/src/lib/server/contact-lifecycle-floor.js +91 -0
  263. package/src/lib/server/contact-lifecycle-floor.js.map +1 -0
  264. package/src/lib/server/contact-remove.d.ts +75 -0
  265. package/src/lib/server/contact-remove.js +244 -0
  266. package/src/lib/server/contact-remove.js.map +1 -0
  267. package/src/lib/server/contact-update.js +4 -3
  268. package/src/lib/server/contact-update.js.map +1 -1
  269. package/src/lib/server/contacts-import.d.ts +47 -11
  270. package/src/lib/server/contacts-import.js +171 -71
  271. package/src/lib/server/contacts-import.js.map +1 -1
  272. package/src/lib/server/contacts-merge.d.ts +1 -1
  273. package/src/lib/server/contacts-merge.js +3 -2
  274. package/src/lib/server/contacts-merge.js.map +1 -1
  275. package/src/lib/server/container-detach.d.ts +31 -0
  276. package/src/lib/server/container-detach.js +115 -0
  277. package/src/lib/server/container-detach.js.map +1 -0
  278. package/src/lib/server/convert-host-lead.d.ts +189 -0
  279. package/src/lib/server/convert-host-lead.js +518 -0
  280. package/src/lib/server/convert-host-lead.js.map +1 -0
  281. package/src/lib/server/crm-inbound-email.d.ts +162 -0
  282. package/src/lib/server/crm-inbound-email.js +259 -0
  283. package/src/lib/server/crm-inbound-email.js.map +1 -0
  284. package/src/lib/server/crm-records-meter.d.ts +50 -0
  285. package/src/lib/server/crm-records-meter.js +126 -0
  286. package/src/lib/server/crm-records-meter.js.map +1 -0
  287. package/src/lib/server/crm-sharing.d.ts +108 -0
  288. package/src/lib/server/crm-sharing.js +790 -0
  289. package/src/lib/server/crm-sharing.js.map +1 -0
  290. package/src/lib/server/daily-digest-route.d.ts +101 -0
  291. package/src/lib/server/daily-digest-route.js +578 -0
  292. package/src/lib/server/daily-digest-route.js.map +1 -0
  293. package/src/lib/server/export-route.d.ts +60 -0
  294. package/src/lib/server/export-route.js +447 -0
  295. package/src/lib/server/export-route.js.map +1 -0
  296. package/src/lib/server/inbound-address.js +5 -3
  297. package/src/lib/server/inbound-address.js.map +1 -1
  298. package/src/lib/server/inbound-route.d.ts +74 -0
  299. package/src/lib/server/inbound-route.js +260 -0
  300. package/src/lib/server/inbound-route.js.map +1 -0
  301. package/src/lib/server/lead-campaign-carry.js +3 -3
  302. package/src/lib/server/lead-campaign-carry.js.map +1 -1
  303. package/src/lib/server/lead-convert.d.ts +1 -1
  304. package/src/lib/server/lead-convert.js +2 -2
  305. package/src/lib/server/lead-convert.js.map +1 -1
  306. package/src/lib/server/lead-create.d.ts +1 -1
  307. package/src/lib/server/lead-create.js +10 -15
  308. package/src/lib/server/lead-create.js.map +1 -1
  309. package/src/lib/server/lead-nurturing.d.ts +23 -0
  310. package/src/lib/server/lead-nurturing.js +82 -0
  311. package/src/lib/server/lead-nurturing.js.map +1 -0
  312. package/src/lib/server/leads-import.js +7 -7
  313. package/src/lib/server/leads-import.js.map +1 -1
  314. package/src/lib/server/merge-contacts.d.ts +55 -0
  315. package/src/lib/server/merge-contacts.js +274 -0
  316. package/src/lib/server/merge-contacts.js.map +1 -0
  317. package/src/lib/server/pipeline-record-index.d.ts +36 -0
  318. package/src/lib/server/pipeline-record-index.js +87 -0
  319. package/src/lib/server/pipeline-record-index.js.map +1 -0
  320. package/src/lib/server/record-email-state.js +23 -0
  321. package/src/lib/server/record-email-state.js.map +1 -1
  322. package/src/lib/server/record-facts.js +2 -1
  323. package/src/lib/server/record-facts.js.map +1 -1
  324. package/src/lib/server/record-timeline.d.ts +12 -0
  325. package/src/lib/server/record-timeline.js +127 -15
  326. package/src/lib/server/record-timeline.js.map +1 -1
  327. package/src/lib/server/task-reminders-route.d.ts +82 -0
  328. package/src/lib/server/task-reminders-route.js +499 -0
  329. package/src/lib/server/task-reminders-route.js.map +1 -0
  330. package/src/lib/server/task-routes.d.ts +2 -0
  331. package/src/lib/server/task-routes.js +22 -3
  332. package/src/lib/server/task-routes.js.map +1 -1
  333. package/src/lib/server-deal-stage.js +2 -1
  334. package/src/lib/server-deal-stage.js.map +1 -1
  335. package/src/lib/server.d.ts +5 -2
  336. package/src/lib/server.js +47 -2
  337. package/src/lib/server.js.map +1 -1
  338. package/src/lib/testing/stand-in-site-record-routes.d.ts +26 -0
  339. package/src/lib/testing/stand-in-site-record-routes.js +55 -0
  340. package/src/lib/testing/stand-in-site-record-routes.js.map +1 -0
  341. package/src/lib/usage-axes.d.ts +35 -0
  342. package/src/lib/usage-axes.js +75 -0
  343. package/src/lib/usage-axes.js.map +1 -0
  344. package/src/lib/components/use-emails-hub-path.d.ts +0 -24
  345. package/src/lib/components/use-emails-hub-path.js +0 -59
  346. package/src/lib/components/use-emails-hub-path.js.map +0 -1
@@ -0,0 +1,985 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ /**
3
+ * @license
4
+ * Copyright 2026 Aglyn LLC
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */ import { booleanField, integerField, isoField, nullableField, objectKindField, openObjectField, postalAddressField, queryParam, RECORD_STAMPS, stringField, stringListField, UPDATED_AFTER_PARAM } from "@aglyn/tenant-data-admin/server/api-v1-description";
18
+ /**
19
+ * The CRM's resources as the customer API's OpenAPI document describes them
20
+ * (AGL-2733), keyed by the resource each describes — what the console's
21
+ * builder turns into their paths, tags and schemas, and the MCP tools derive
22
+ * from.
23
+ *
24
+ * Transcribed from the response examples in `apps/docs/api/resources/*.md`,
25
+ * the customer-facing contract, as the platform's own resources are; each
26
+ * write body lists its handler's own writable set. `api-v1-openapi.spec.ts`
27
+ * holds the document to every endpoint the documentation promises.
28
+ */ export const CRM_API_V1_DESCRIPTIONS = {
29
+ contacts: {
30
+ tag: 'Contacts',
31
+ description: 'People, organization-wide. Part of the CRM, which is included from Starter.',
32
+ schemaName: 'Contact',
33
+ required: [
34
+ 'id',
35
+ 'object',
36
+ 'email'
37
+ ],
38
+ writable: [
39
+ 'email',
40
+ 'name',
41
+ 'tags',
42
+ 'notes',
43
+ 'marketingConsent',
44
+ 'consentSiteId',
45
+ 'consentGroupId',
46
+ 'custom',
47
+ 'phone',
48
+ 'jobTitle',
49
+ 'companyId',
50
+ 'address',
51
+ 'ownerUid',
52
+ 'lifecycleStage',
53
+ 'mediaIds'
54
+ ],
55
+ writeOnly: {
56
+ consentSiteId: stringField('The site this write is made on behalf of: where the person opted in, and whose profile the profile fields land on.'),
57
+ consentGroupId: stringField('With `marketingConsent: true`: the consent group the person was shown when they opted in. The opt-in then covers every site of that group; without it, or when the site is no longer in that group, it covers `consentSiteId` alone.'),
58
+ custom: openObjectField('Contact custom fields, keyed by field key.'),
59
+ mediaIds: stringListField('Media library files attached by the named site, by id, at most 20. An empty array clears them.')
60
+ },
61
+ writeNote: '`email` is accepted on create only — a `PATCH` that names it is a `400`, because a contact is identified by its email.',
62
+ fields: _extends({
63
+ id: stringField('Contact id.'),
64
+ object: objectKindField('contact'),
65
+ email: stringField('Primary email. Unique per organization.'),
66
+ name: stringField('Display name.'),
67
+ tags: stringListField('Free-form tags.'),
68
+ notes: stringField('Free-form notes.'),
69
+ marketingConsent: booleanField('Whether the contact accepted marketing email.'),
70
+ consentSites: stringListField('Site ids the consent was given on.'),
71
+ sources: stringListField('Where this contact came from.'),
72
+ phone: stringField('Telephone number.'),
73
+ jobTitle: stringField('Job title.'),
74
+ companyId: nullableField(stringField('Primary company.')),
75
+ address: postalAddressField(),
76
+ ownerUid: nullableField(stringField('Owning user. Checked on the page, not the query.')),
77
+ lifecycleStage: nullableField(stringField('CRM lifecycle stage.')),
78
+ companyIds: stringListField('Every company this contact belongs to.'),
79
+ alternateEmails: stringListField('Other addresses that resolve to this contact.')
80
+ }, RECORD_STAMPS),
81
+ ops: [
82
+ {
83
+ path: '/v1/contacts',
84
+ method: 'get',
85
+ operationId: 'listContacts',
86
+ summary: 'List contacts',
87
+ list: true,
88
+ returns: 'Contact',
89
+ entitlement: 'crm',
90
+ description: 'Combining `email` with `tag` narrows on `email` and checks `tag` on the page, so pages can come back short. `lifecycleStage` and `ownerUid` live on a per-site profile and are ALWAYS checked on the page.',
91
+ filters: [
92
+ queryParam('email', 'Exact match, normalized the way the write path normalizes it. An unusable value is a 400.'),
93
+ queryParam('tag', 'Checked on the page when combined with `email`.'),
94
+ queryParam('lifecycleStage', 'Always checked on the page.'),
95
+ queryParam('ownerUid', 'Always checked on the page.')
96
+ ]
97
+ },
98
+ {
99
+ path: '/v1/contacts',
100
+ method: 'post',
101
+ operationId: 'createContact',
102
+ summary: 'Create a contact',
103
+ accepts: 'ContactWrite',
104
+ returns: 'Contact',
105
+ entitlement: 'crm',
106
+ creates: true,
107
+ description: 'A duplicate email is `409 conflict` (`code: "contact_exists"`), and the message names the existing id.'
108
+ },
109
+ {
110
+ path: '/v1/contacts/{contactId}',
111
+ method: 'get',
112
+ operationId: 'getContact',
113
+ summary: 'Retrieve a contact',
114
+ returns: 'Contact',
115
+ entitlement: 'crm',
116
+ pathParams: [
117
+ {
118
+ name: 'contactId',
119
+ description: 'Contact id.'
120
+ }
121
+ ]
122
+ },
123
+ {
124
+ path: '/v1/contacts/{contactId}',
125
+ method: 'patch',
126
+ operationId: 'updateContact',
127
+ summary: 'Update a contact',
128
+ accepts: 'ContactWrite',
129
+ returns: 'Contact',
130
+ entitlement: 'crm',
131
+ pathParams: [
132
+ {
133
+ name: 'contactId',
134
+ description: 'Contact id.'
135
+ }
136
+ ]
137
+ },
138
+ {
139
+ path: '/v1/contacts/{contactId}',
140
+ method: 'delete',
141
+ operationId: 'deleteContact',
142
+ summary: 'Delete a contact',
143
+ returns: 'Deleted',
144
+ entitlement: 'crm',
145
+ pathParams: [
146
+ {
147
+ name: 'contactId',
148
+ description: 'Contact id.'
149
+ }
150
+ ]
151
+ },
152
+ {
153
+ path: '/v1/contacts/{contactId}/merge',
154
+ method: 'post',
155
+ operationId: 'mergeContact',
156
+ summary: 'Merge two contacts',
157
+ accepts: 'ContactMerge',
158
+ returns: 'Contact',
159
+ entitlement: 'crm',
160
+ pathParams: [
161
+ {
162
+ name: 'contactId',
163
+ description: 'The contact that survives.'
164
+ }
165
+ ]
166
+ }
167
+ ],
168
+ components: {
169
+ ContactMerge: {
170
+ type: 'object',
171
+ required: [
172
+ 'sourceContactId'
173
+ ],
174
+ description: 'Merge another contact into this one. The source is removed. Any other ' + 'member is a `400`.',
175
+ properties: {
176
+ sourceContactId: {
177
+ type: 'string',
178
+ description: 'The contact to merge FROM. It does not survive, and it must not be ' + 'the contact in the path.'
179
+ }
180
+ },
181
+ additionalProperties: false
182
+ }
183
+ }
184
+ },
185
+ companies: {
186
+ tag: 'Companies',
187
+ description: 'Organizations in the CRM.',
188
+ schemaName: 'Company',
189
+ required: [
190
+ 'id',
191
+ 'object',
192
+ 'name'
193
+ ],
194
+ writable: [
195
+ 'name',
196
+ 'domain',
197
+ 'website',
198
+ 'phone',
199
+ 'address',
200
+ 'industry',
201
+ 'ownerUid',
202
+ 'notes',
203
+ 'custom',
204
+ 'mediaIds',
205
+ 'consentSiteId'
206
+ ],
207
+ writeOnly: {
208
+ mediaIds: stringListField('Media library files attached to this company, by id, at most 20. An empty array clears them.'),
209
+ consentSiteId: stringField('The site the company is created on behalf of.')
210
+ },
211
+ writeNote: 'A create needs `name` and `consentSiteId`; a `PATCH` that names `consentSiteId` is a `400`.',
212
+ fields: _extends({
213
+ id: stringField('Company id.'),
214
+ object: objectKindField('company'),
215
+ name: stringField('Company name.'),
216
+ domain: nullableField(stringField('Primary domain. Unique per organization.')),
217
+ website: nullableField(stringField('Website URL.')),
218
+ phone: nullableField(stringField('Telephone number.')),
219
+ address: postalAddressField(),
220
+ industry: nullableField(stringField('Industry label.')),
221
+ ownerUid: nullableField(stringField('Owning user.')),
222
+ notes: nullableField(stringField('Free-form notes.')),
223
+ custom: openObjectField('Customer-defined fields.'),
224
+ nextTaskAt: nullableField(isoField('When the next open task on this company is due.')),
225
+ siteId: nullableField(stringField('Site the record originated on.'))
226
+ }, RECORD_STAMPS),
227
+ ops: [
228
+ {
229
+ path: '/v1/companies',
230
+ method: 'get',
231
+ operationId: 'listCompanies',
232
+ summary: 'List companies',
233
+ list: true,
234
+ returns: 'Company',
235
+ entitlement: 'crm',
236
+ filters: [
237
+ UPDATED_AFTER_PARAM,
238
+ queryParam('domain', 'Exact match.'),
239
+ queryParam('ownerUid', 'Owning user.')
240
+ ]
241
+ },
242
+ {
243
+ path: '/v1/companies',
244
+ method: 'post',
245
+ operationId: 'createCompany',
246
+ summary: 'Create a company',
247
+ accepts: 'CompanyWrite',
248
+ returns: 'Company',
249
+ entitlement: 'crm',
250
+ creates: true,
251
+ description: 'A duplicate domain is `409 conflict` (`code: "company_exists"`), naming the existing id.'
252
+ },
253
+ {
254
+ path: '/v1/companies/{companyId}',
255
+ method: 'get',
256
+ operationId: 'getCompany',
257
+ summary: 'Retrieve a company',
258
+ returns: 'Company',
259
+ entitlement: 'crm',
260
+ pathParams: [
261
+ {
262
+ name: 'companyId',
263
+ description: 'Company id.'
264
+ }
265
+ ]
266
+ },
267
+ {
268
+ path: '/v1/companies/{companyId}',
269
+ method: 'patch',
270
+ operationId: 'updateCompany',
271
+ summary: 'Update a company',
272
+ accepts: 'CompanyWrite',
273
+ returns: 'Company',
274
+ entitlement: 'crm',
275
+ pathParams: [
276
+ {
277
+ name: 'companyId',
278
+ description: 'Company id.'
279
+ }
280
+ ]
281
+ },
282
+ {
283
+ path: '/v1/companies/{companyId}',
284
+ method: 'delete',
285
+ operationId: 'deleteCompany',
286
+ summary: 'Delete a company',
287
+ returns: 'Deleted',
288
+ entitlement: 'crm',
289
+ pathParams: [
290
+ {
291
+ name: 'companyId',
292
+ description: 'Company id.'
293
+ }
294
+ ]
295
+ }
296
+ ]
297
+ },
298
+ pipelines: {
299
+ tag: 'Pipelines',
300
+ description: 'Deal pipelines and their stages. Read-only over the API.',
301
+ schemaName: 'Pipeline',
302
+ required: [
303
+ 'id',
304
+ 'object',
305
+ 'name',
306
+ 'stages'
307
+ ],
308
+ fields: _extends({
309
+ id: stringField('Pipeline id.'),
310
+ object: objectKindField('pipeline'),
311
+ name: stringField('Pipeline name.'),
312
+ isDefault: booleanField('Whether new deals land here when none is named.'),
313
+ archived: booleanField('Whether the pipeline is archived.'),
314
+ archivedAt: nullableField(isoField('When it was archived.')),
315
+ stages: {
316
+ type: 'array',
317
+ description: 'Ordered stages. A deal’s `stageId` names one of these.',
318
+ items: {
319
+ type: 'object',
320
+ properties: {
321
+ id: {
322
+ type: 'string'
323
+ },
324
+ name: {
325
+ type: 'string'
326
+ },
327
+ order: {
328
+ type: 'integer'
329
+ }
330
+ },
331
+ additionalProperties: true
332
+ }
333
+ },
334
+ siteId: nullableField(stringField('Site the pipeline belongs to, when scoped.'))
335
+ }, RECORD_STAMPS),
336
+ ops: [
337
+ {
338
+ path: '/v1/pipelines',
339
+ method: 'get',
340
+ operationId: 'listPipelines',
341
+ summary: 'List pipelines',
342
+ list: true,
343
+ returns: 'Pipeline',
344
+ entitlement: 'crm',
345
+ filters: [
346
+ UPDATED_AFTER_PARAM
347
+ ]
348
+ },
349
+ {
350
+ path: '/v1/pipelines/{pipelineId}',
351
+ method: 'get',
352
+ operationId: 'getPipeline',
353
+ summary: 'Retrieve a pipeline',
354
+ returns: 'Pipeline',
355
+ entitlement: 'crm',
356
+ pathParams: [
357
+ {
358
+ name: 'pipelineId',
359
+ description: 'Pipeline id.'
360
+ }
361
+ ]
362
+ }
363
+ ]
364
+ },
365
+ deals: {
366
+ tag: 'Deals',
367
+ description: 'Opportunities moving through a pipeline.',
368
+ schemaName: 'Deal',
369
+ required: [
370
+ 'id',
371
+ 'object',
372
+ 'title',
373
+ 'pipelineId',
374
+ 'stageId'
375
+ ],
376
+ writable: [
377
+ 'title',
378
+ 'pipelineId',
379
+ 'stageId',
380
+ 'status',
381
+ 'amountCents',
382
+ 'currency',
383
+ 'lineItems',
384
+ 'expectedCloseAt',
385
+ 'ownerUid',
386
+ 'contactId',
387
+ 'companyId',
388
+ 'lostReason',
389
+ 'notes',
390
+ 'custom',
391
+ 'mediaIds',
392
+ 'consentSiteId'
393
+ ],
394
+ writeOnly: {
395
+ mediaIds: stringListField('Media library files attached to this deal, by id, at most 20. An empty array clears them.'),
396
+ consentSiteId: stringField('The site the deal is created on behalf of.')
397
+ },
398
+ writeNote: '`pipelineId` and `consentSiteId` are accepted on create only; a `PATCH` that names either is a `400`.',
399
+ fields: _extends({
400
+ id: stringField('Deal id.'),
401
+ object: objectKindField('deal'),
402
+ title: stringField('Deal title.'),
403
+ pipelineId: stringField('Pipeline the deal sits in.'),
404
+ stageId: stringField('Stage within that pipeline.'),
405
+ status: stringField('`open`, `won` or `lost`.'),
406
+ amountCents: integerField('Value in the smallest unit of `currency`.'),
407
+ currency: stringField('ISO 4217 code.'),
408
+ lineItems: {
409
+ type: 'array',
410
+ description: 'Line items, when the deal carries them.',
411
+ items: {
412
+ type: 'object',
413
+ additionalProperties: true
414
+ }
415
+ },
416
+ expectedCloseAt: nullableField(isoField('Forecast close date.')),
417
+ closedAt: nullableField(isoField('When it was actually closed.')),
418
+ stageChangedAt: nullableField(isoField('When the stage last moved.')),
419
+ ownerUid: nullableField(stringField('Owning user.')),
420
+ contactId: nullableField(stringField('Associated contact.')),
421
+ companyId: nullableField(stringField('Associated company.')),
422
+ lostReason: nullableField(stringField('Why it was lost.')),
423
+ notes: nullableField(stringField('Free-form notes.')),
424
+ custom: openObjectField('Customer-defined fields.'),
425
+ nextTaskAt: nullableField(isoField('When the next open task on this deal is due.')),
426
+ siteId: nullableField(stringField('Site the record originated on.'))
427
+ }, RECORD_STAMPS),
428
+ ops: [
429
+ {
430
+ path: '/v1/deals',
431
+ method: 'get',
432
+ operationId: 'listDeals',
433
+ summary: 'List deals',
434
+ list: true,
435
+ returns: 'Deal',
436
+ entitlement: 'crm',
437
+ filters: [
438
+ UPDATED_AFTER_PARAM,
439
+ queryParam('pipelineId', 'Pipeline.'),
440
+ queryParam('stageId', 'Stage.'),
441
+ queryParam('status', 'Deal status.'),
442
+ queryParam('ownerUid', 'Owning user.')
443
+ ]
444
+ },
445
+ {
446
+ path: '/v1/deals',
447
+ method: 'post',
448
+ operationId: 'createDeal',
449
+ summary: 'Create a deal',
450
+ accepts: 'DealWrite',
451
+ returns: 'Deal',
452
+ entitlement: 'crm',
453
+ creates: true
454
+ },
455
+ {
456
+ path: '/v1/deals/{dealId}',
457
+ method: 'get',
458
+ operationId: 'getDeal',
459
+ summary: 'Retrieve a deal',
460
+ returns: 'Deal',
461
+ entitlement: 'crm',
462
+ pathParams: [
463
+ {
464
+ name: 'dealId',
465
+ description: 'Deal id.'
466
+ }
467
+ ]
468
+ },
469
+ {
470
+ path: '/v1/deals/{dealId}',
471
+ method: 'patch',
472
+ operationId: 'updateDeal',
473
+ summary: 'Update a deal',
474
+ accepts: 'DealWrite',
475
+ returns: 'Deal',
476
+ entitlement: 'crm',
477
+ pathParams: [
478
+ {
479
+ name: 'dealId',
480
+ description: 'Deal id.'
481
+ }
482
+ ]
483
+ },
484
+ {
485
+ path: '/v1/deals/{dealId}',
486
+ method: 'delete',
487
+ operationId: 'deleteDeal',
488
+ summary: 'Delete a deal',
489
+ returns: 'Deleted',
490
+ entitlement: 'crm',
491
+ pathParams: [
492
+ {
493
+ name: 'dealId',
494
+ description: 'Deal id.'
495
+ }
496
+ ]
497
+ }
498
+ ]
499
+ },
500
+ tasks: {
501
+ tag: 'Tasks',
502
+ description: 'Follow-ups attached to CRM records.',
503
+ schemaName: 'Task',
504
+ required: [
505
+ 'id',
506
+ 'object',
507
+ 'title'
508
+ ],
509
+ writable: [
510
+ 'title',
511
+ 'notes',
512
+ 'kind',
513
+ 'priority',
514
+ 'status',
515
+ 'dueAt',
516
+ 'remindAt',
517
+ 'assigneeUid',
518
+ 'contactId',
519
+ 'companyId',
520
+ 'dealId',
521
+ 'consentSiteId'
522
+ ],
523
+ writeOnly: {
524
+ consentSiteId: stringField('The site the task is created on behalf of.')
525
+ },
526
+ writeNote: 'A create needs `title` and `consentSiteId`; a `PATCH` that names `consentSiteId` is a `400`.',
527
+ fields: _extends({
528
+ id: stringField('Task id.'),
529
+ object: objectKindField('task'),
530
+ title: stringField('Task title.'),
531
+ notes: nullableField(stringField('Free-form notes.')),
532
+ kind: stringField('Task kind, e.g. `call` or `email`.'),
533
+ priority: stringField('Priority label.'),
534
+ status: stringField('`open` or `done`.'),
535
+ dueAt: nullableField(isoField('When the task is due.')),
536
+ remindAt: nullableField(isoField('When a reminder is scheduled.')),
537
+ reminderSentAt: nullableField(isoField('When the reminder was sent.')),
538
+ completedAt: nullableField(isoField('When it was completed.')),
539
+ assigneeUid: nullableField(stringField('Assigned user.')),
540
+ contactId: nullableField(stringField('Associated contact.')),
541
+ companyId: nullableField(stringField('Associated company.')),
542
+ dealId: nullableField(stringField('Associated deal.')),
543
+ siteId: nullableField(stringField('Site the record originated on.'))
544
+ }, RECORD_STAMPS),
545
+ ops: [
546
+ {
547
+ path: '/v1/tasks',
548
+ method: 'get',
549
+ operationId: 'listTasks',
550
+ summary: 'List tasks',
551
+ list: true,
552
+ returns: 'Task',
553
+ entitlement: 'crm',
554
+ filters: [
555
+ UPDATED_AFTER_PARAM,
556
+ queryParam('status', 'Task status.'),
557
+ queryParam('assigneeUid', 'Assigned user.'),
558
+ queryParam('contactId', 'Associated contact.'),
559
+ queryParam('dealId', 'Associated deal.')
560
+ ]
561
+ },
562
+ {
563
+ path: '/v1/tasks',
564
+ method: 'post',
565
+ operationId: 'createTask',
566
+ summary: 'Create a task',
567
+ accepts: 'TaskWrite',
568
+ returns: 'Task',
569
+ entitlement: 'crm',
570
+ creates: true
571
+ },
572
+ {
573
+ path: '/v1/tasks/{taskId}',
574
+ method: 'get',
575
+ operationId: 'getTask',
576
+ summary: 'Retrieve a task',
577
+ returns: 'Task',
578
+ entitlement: 'crm',
579
+ pathParams: [
580
+ {
581
+ name: 'taskId',
582
+ description: 'Task id.'
583
+ }
584
+ ]
585
+ },
586
+ {
587
+ path: '/v1/tasks/{taskId}',
588
+ method: 'patch',
589
+ operationId: 'updateTask',
590
+ summary: 'Update a task',
591
+ accepts: 'TaskWrite',
592
+ returns: 'Task',
593
+ entitlement: 'crm',
594
+ pathParams: [
595
+ {
596
+ name: 'taskId',
597
+ description: 'Task id.'
598
+ }
599
+ ]
600
+ },
601
+ {
602
+ path: '/v1/tasks/{taskId}',
603
+ method: 'delete',
604
+ operationId: 'deleteTask',
605
+ summary: 'Delete a task',
606
+ returns: 'Deleted',
607
+ entitlement: 'crm',
608
+ pathParams: [
609
+ {
610
+ name: 'taskId',
611
+ description: 'Task id.'
612
+ }
613
+ ]
614
+ }
615
+ ]
616
+ },
617
+ activities: {
618
+ tag: 'Activities',
619
+ description: 'Logged interactions. Append-only: no PATCH.',
620
+ schemaName: 'Activity',
621
+ required: [
622
+ 'id',
623
+ 'object',
624
+ 'kind',
625
+ 'at'
626
+ ],
627
+ writable: [
628
+ 'kind',
629
+ 'body',
630
+ 'at',
631
+ 'byUid',
632
+ 'contactId',
633
+ 'companyId',
634
+ 'dealId',
635
+ 'outcome',
636
+ 'durationMinutes',
637
+ 'consentSiteId'
638
+ ],
639
+ writeOnly: {
640
+ consentSiteId: stringField('The site the activity is logged on behalf of.')
641
+ },
642
+ writeRequired: [
643
+ 'body',
644
+ 'consentSiteId'
645
+ ],
646
+ fields: _extends({
647
+ id: stringField('Activity id.'),
648
+ object: objectKindField('activity'),
649
+ kind: stringField('What happened, e.g. `call`, `email`, `note`.'),
650
+ body: stringField('Free-form body.'),
651
+ at: isoField('When the interaction happened — not when it was logged.'),
652
+ byUid: nullableField(stringField('User who logged it.')),
653
+ contactId: nullableField(stringField('Associated contact.')),
654
+ companyId: nullableField(stringField('Associated company.')),
655
+ dealId: nullableField(stringField('Associated deal.')),
656
+ outcome: nullableField(stringField('Outcome label.')),
657
+ durationMinutes: nullableField(integerField('Duration, for calls and meetings.')),
658
+ siteId: nullableField(stringField('Site the record originated on.'))
659
+ }, RECORD_STAMPS),
660
+ ops: [
661
+ {
662
+ path: '/v1/activities',
663
+ method: 'get',
664
+ operationId: 'listActivities',
665
+ summary: 'List activities',
666
+ list: true,
667
+ returns: 'Activity',
668
+ entitlement: 'crm',
669
+ filters: [
670
+ UPDATED_AFTER_PARAM,
671
+ queryParam('kind', 'Activity kind.'),
672
+ queryParam('contactId', 'Associated contact.'),
673
+ queryParam('dealId', 'Associated deal.')
674
+ ]
675
+ },
676
+ {
677
+ path: '/v1/activities',
678
+ method: 'post',
679
+ operationId: 'createActivity',
680
+ summary: 'Log an activity',
681
+ accepts: 'ActivityWrite',
682
+ returns: 'Activity',
683
+ entitlement: 'crm',
684
+ creates: true
685
+ },
686
+ {
687
+ path: '/v1/activities/{activityId}',
688
+ method: 'get',
689
+ operationId: 'getActivity',
690
+ summary: 'Retrieve an activity',
691
+ returns: 'Activity',
692
+ entitlement: 'crm',
693
+ pathParams: [
694
+ {
695
+ name: 'activityId',
696
+ description: 'Activity id.'
697
+ }
698
+ ]
699
+ },
700
+ {
701
+ path: '/v1/activities/{activityId}',
702
+ method: 'delete',
703
+ operationId: 'deleteActivity',
704
+ summary: 'Delete an activity',
705
+ returns: 'Deleted',
706
+ entitlement: 'crm',
707
+ pathParams: [
708
+ {
709
+ name: 'activityId',
710
+ description: 'Activity id.'
711
+ }
712
+ ]
713
+ }
714
+ ]
715
+ },
716
+ leads: {
717
+ tag: 'Leads',
718
+ description: 'Unqualified interest, before it becomes a contact. A lead is a record of its own: the person and their company as text, until converting makes the contact and the company.',
719
+ schemaName: 'Lead',
720
+ required: [
721
+ 'id',
722
+ 'object',
723
+ 'siteId'
724
+ ],
725
+ writable: [
726
+ 'siteId',
727
+ 'email',
728
+ 'name',
729
+ 'status',
730
+ 'ownerUid',
731
+ 'ownerEmail',
732
+ 'notes',
733
+ 'unqualifiedReason',
734
+ 'company',
735
+ 'jobTitle',
736
+ 'phone',
737
+ 'website',
738
+ 'address',
739
+ 'tags',
740
+ 'leadSource'
741
+ ],
742
+ writeNote: '`email` and `name` are taken on a create only; a `PATCH` cannot change the address, which is the lead’s identity within its site.',
743
+ writeRequired: [
744
+ 'email'
745
+ ],
746
+ writeOnly: {
747
+ siteId: stringField('The site the lead belongs to, instead of the `siteId` query parameter.'),
748
+ status: stringField('`new`, `nurturing`, `working` or `unqualified` (`nurturing` and `unqualified` on a `PATCH` only). A lead becomes `qualified` by being converted.'),
749
+ ownerEmail: stringField('A member’s address, resolved against the organization’s roster. Not with `ownerUid` in the same request.')
750
+ },
751
+ fields: _extends({
752
+ id: stringField('Lead id.'),
753
+ object: objectKindField('lead'),
754
+ siteId: stringField('Site the lead arrived on.'),
755
+ email: nullableField(stringField('Email — the lead’s identity within its site.')),
756
+ name: nullableField(stringField('Name, when supplied.')),
757
+ status: stringField('Lead status.'),
758
+ ownerUid: nullableField(stringField('Owning user.')),
759
+ notes: nullableField(stringField('Free-form notes.')),
760
+ unqualifiedReason: nullableField(stringField('Why the lead was disqualified.')),
761
+ company: nullableField(stringField('The company’s name, as text. Converting the lead is what links or creates the company record.')),
762
+ jobTitle: nullableField(stringField('Job title.')),
763
+ phone: nullableField(stringField('E.164 phone number.')),
764
+ website: nullableField(stringField('An http(s) URL.')),
765
+ address: nullableField(postalAddressField()),
766
+ tags: stringListField('Lower-cased tags.'),
767
+ leadSource: nullableField(stringField("Where the lead came from: one of the organization's active lead source values " + '(CRM › Fields › Leads), matched without regard to case. Any other value is refused ' + 'with a 400 naming the values allowed; the value a lead already holds is kept even ' + "after it is deactivated. A create that names none starts from the list's default.")),
768
+ sources: stringListField('The surfaces that captured the lead: `signup`, `booking`, `form:{formId}`, `import`, `manual`, `api`.'),
769
+ submissionCount: integerField('How many form submissions this lead has made.'),
770
+ firstSeen: isoField('First interaction.'),
771
+ lastSeen: isoField('Most recent interaction.'),
772
+ marketingConsent: booleanField('Whether marketing consent was given.'),
773
+ marketingConsentAt: nullableField(isoField('When consent was given.')),
774
+ convertedContactId: nullableField(stringField('Contact created by conversion.')),
775
+ convertedAt: nullableField(isoField('When it was converted.')),
776
+ companyId: nullableField(stringField('Company created or matched by conversion.')),
777
+ dealId: nullableField(stringField('Deal created by conversion.'))
778
+ }, RECORD_STAMPS),
779
+ ops: [
780
+ {
781
+ path: '/v1/leads',
782
+ method: 'get',
783
+ operationId: 'listLeads',
784
+ summary: 'List leads',
785
+ list: true,
786
+ returns: 'Lead',
787
+ entitlement: 'crm',
788
+ filters: [
789
+ UPDATED_AFTER_PARAM,
790
+ queryParam('siteId', 'Site the lead arrived on.'),
791
+ queryParam('status', 'Lead status.'),
792
+ queryParam('ownerUid', 'Owning user.')
793
+ ]
794
+ },
795
+ {
796
+ path: '/v1/leads',
797
+ method: 'post',
798
+ operationId: 'createLead',
799
+ summary: 'Create a lead',
800
+ accepts: 'LeadWrite',
801
+ returns: 'Lead',
802
+ entitlement: 'crm',
803
+ creates: true,
804
+ description: 'A lead sourced outside the site, entered before anyone has qualified it. One address is one lead per site: creating one the site already holds updates it and answers 200. No contact and no company are created — converting the lead does that — and no marketing consent is recorded.'
805
+ },
806
+ {
807
+ path: '/v1/leads/{leadId}',
808
+ method: 'get',
809
+ operationId: 'getLead',
810
+ summary: 'Retrieve a lead',
811
+ returns: 'Lead',
812
+ entitlement: 'crm',
813
+ pathParams: [
814
+ {
815
+ name: 'leadId',
816
+ description: 'Lead id.'
817
+ }
818
+ ]
819
+ },
820
+ {
821
+ path: '/v1/leads/{leadId}',
822
+ method: 'patch',
823
+ operationId: 'updateLead',
824
+ summary: 'Update a lead',
825
+ accepts: 'LeadWrite',
826
+ returns: 'Lead',
827
+ entitlement: 'crm',
828
+ pathParams: [
829
+ {
830
+ name: 'leadId',
831
+ description: 'Lead id.'
832
+ }
833
+ ]
834
+ },
835
+ {
836
+ path: '/v1/leads/{leadId}/convert',
837
+ method: 'post',
838
+ operationId: 'convertLead',
839
+ summary: 'Convert a lead',
840
+ returns: 'LeadConversion',
841
+ entitlement: 'crm',
842
+ description: 'Creates a contact, and optionally a company and a deal. Idempotent on the lead: converting an already-converted lead returns the existing ids.',
843
+ pathParams: [
844
+ {
845
+ name: 'leadId',
846
+ description: 'Lead id.'
847
+ }
848
+ ]
849
+ }
850
+ ],
851
+ components: {
852
+ LeadConversion: {
853
+ type: 'object',
854
+ description: 'What the conversion produced. Idempotent on the lead: converting an ' + 'already-converted lead returns the existing ids rather than creating ' + 'a second set.',
855
+ properties: {
856
+ object: {
857
+ type: 'string',
858
+ const: 'lead_conversion'
859
+ },
860
+ contactId: {
861
+ type: 'string'
862
+ },
863
+ companyId: {
864
+ type: [
865
+ 'string',
866
+ 'null'
867
+ ]
868
+ },
869
+ dealId: {
870
+ type: [
871
+ 'string',
872
+ 'null'
873
+ ]
874
+ }
875
+ },
876
+ additionalProperties: true
877
+ }
878
+ }
879
+ },
880
+ 'email-templates': {
881
+ tag: 'Email templates',
882
+ description: 'Reusable email bodies.',
883
+ schemaName: 'EmailTemplate',
884
+ required: [
885
+ 'id',
886
+ 'object',
887
+ 'name'
888
+ ],
889
+ writable: [
890
+ 'name',
891
+ 'kind',
892
+ 'visibility',
893
+ 'ownerUid',
894
+ 'subject',
895
+ 'body',
896
+ 'consentSiteId'
897
+ ],
898
+ writeOnly: {
899
+ consentSiteId: stringField('The site the template is created on behalf of.')
900
+ },
901
+ writeNote: 'A create needs `name`, `body` and `consentSiteId`; a `PATCH` that names `consentSiteId` is a `400`.',
902
+ fields: _extends({
903
+ id: stringField('Template id.'),
904
+ object: objectKindField('email_template'),
905
+ name: stringField('Template name.'),
906
+ kind: stringField('Template kind.'),
907
+ visibility: stringField('`org` or `private`.'),
908
+ ownerUid: nullableField(stringField('Owner, for a private template.')),
909
+ subject: stringField('Subject line.'),
910
+ body: stringField('Body. May contain merge tokens.'),
911
+ siteId: nullableField(stringField('Site the template belongs to, when scoped.'))
912
+ }, RECORD_STAMPS),
913
+ ops: [
914
+ {
915
+ path: '/v1/email-templates',
916
+ method: 'get',
917
+ operationId: 'listEmailTemplates',
918
+ summary: 'List email templates',
919
+ list: true,
920
+ returns: 'EmailTemplate',
921
+ entitlement: 'crm',
922
+ filters: [
923
+ UPDATED_AFTER_PARAM,
924
+ queryParam('kind', 'Template kind.'),
925
+ queryParam('visibility', 'Visibility.')
926
+ ]
927
+ },
928
+ {
929
+ path: '/v1/email-templates',
930
+ method: 'post',
931
+ operationId: 'createEmailTemplate',
932
+ summary: 'Create a template',
933
+ accepts: 'EmailTemplateWrite',
934
+ returns: 'EmailTemplate',
935
+ entitlement: 'crm',
936
+ creates: true
937
+ },
938
+ {
939
+ path: '/v1/email-templates/{templateId}',
940
+ method: 'get',
941
+ operationId: 'getEmailTemplate',
942
+ summary: 'Retrieve a template',
943
+ returns: 'EmailTemplate',
944
+ entitlement: 'crm',
945
+ pathParams: [
946
+ {
947
+ name: 'templateId',
948
+ description: 'Template id.'
949
+ }
950
+ ]
951
+ },
952
+ {
953
+ path: '/v1/email-templates/{templateId}',
954
+ method: 'patch',
955
+ operationId: 'updateEmailTemplate',
956
+ summary: 'Update a template',
957
+ accepts: 'EmailTemplateWrite',
958
+ returns: 'EmailTemplate',
959
+ entitlement: 'crm',
960
+ pathParams: [
961
+ {
962
+ name: 'templateId',
963
+ description: 'Template id.'
964
+ }
965
+ ]
966
+ },
967
+ {
968
+ path: '/v1/email-templates/{templateId}',
969
+ method: 'delete',
970
+ operationId: 'deleteEmailTemplate',
971
+ summary: 'Delete a template',
972
+ returns: 'Deleted',
973
+ entitlement: 'crm',
974
+ pathParams: [
975
+ {
976
+ name: 'templateId',
977
+ description: 'Template id.'
978
+ }
979
+ ]
980
+ }
981
+ ]
982
+ }
983
+ };
984
+
985
+ //# sourceMappingURL=openapi.js.map