digital-tools 2.0.1
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.
- package/.turbo/turbo-build.log +5 -0
- package/CHANGELOG.md +9 -0
- package/README.md +1144 -0
- package/dist/define.d.ts +109 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +268 -0
- package/dist/define.js.map +1 -0
- package/dist/entities/advertising.d.ts +79 -0
- package/dist/entities/advertising.d.ts.map +1 -0
- package/dist/entities/advertising.js +1000 -0
- package/dist/entities/advertising.js.map +1 -0
- package/dist/entities/ai.d.ts +69 -0
- package/dist/entities/ai.d.ts.map +1 -0
- package/dist/entities/ai.js +757 -0
- package/dist/entities/ai.js.map +1 -0
- package/dist/entities/analytics.d.ts +83 -0
- package/dist/entities/analytics.d.ts.map +1 -0
- package/dist/entities/analytics.js +1589 -0
- package/dist/entities/analytics.js.map +1 -0
- package/dist/entities/automation.d.ts +61 -0
- package/dist/entities/automation.d.ts.map +1 -0
- package/dist/entities/automation.js +602 -0
- package/dist/entities/automation.js.map +1 -0
- package/dist/entities/communication.d.ts +96 -0
- package/dist/entities/communication.d.ts.map +1 -0
- package/dist/entities/communication.js +1151 -0
- package/dist/entities/communication.js.map +1 -0
- package/dist/entities/crm.d.ts +91 -0
- package/dist/entities/crm.d.ts.map +1 -0
- package/dist/entities/crm.js +1387 -0
- package/dist/entities/crm.js.map +1 -0
- package/dist/entities/design.d.ts +61 -0
- package/dist/entities/design.d.ts.map +1 -0
- package/dist/entities/design.js +547 -0
- package/dist/entities/design.js.map +1 -0
- package/dist/entities/development.d.ts +145 -0
- package/dist/entities/development.d.ts.map +1 -0
- package/dist/entities/development.js +2213 -0
- package/dist/entities/development.js.map +1 -0
- package/dist/entities/document.d.ts +54 -0
- package/dist/entities/document.d.ts.map +1 -0
- package/dist/entities/document.js +875 -0
- package/dist/entities/document.js.map +1 -0
- package/dist/entities/ecommerce.d.ts +93 -0
- package/dist/entities/ecommerce.d.ts.map +1 -0
- package/dist/entities/ecommerce.js +1430 -0
- package/dist/entities/ecommerce.js.map +1 -0
- package/dist/entities/experiment.d.ts +89 -0
- package/dist/entities/experiment.d.ts.map +1 -0
- package/dist/entities/experiment.js +1040 -0
- package/dist/entities/experiment.js.map +1 -0
- package/dist/entities/finance.d.ts +272 -0
- package/dist/entities/finance.d.ts.map +1 -0
- package/dist/entities/finance.js +3479 -0
- package/dist/entities/finance.js.map +1 -0
- package/dist/entities/forms.d.ts +91 -0
- package/dist/entities/forms.d.ts.map +1 -0
- package/dist/entities/forms.js +1893 -0
- package/dist/entities/forms.js.map +1 -0
- package/dist/entities/hr.d.ts +62 -0
- package/dist/entities/hr.d.ts.map +1 -0
- package/dist/entities/hr.js +662 -0
- package/dist/entities/hr.js.map +1 -0
- package/dist/entities/identity.d.ts +90 -0
- package/dist/entities/identity.d.ts.map +1 -0
- package/dist/entities/identity.js +998 -0
- package/dist/entities/identity.js.map +1 -0
- package/dist/entities/index.d.ts +410 -0
- package/dist/entities/index.d.ts.map +1 -0
- package/dist/entities/index.js +283 -0
- package/dist/entities/index.js.map +1 -0
- package/dist/entities/infrastructure.d.ts +98 -0
- package/dist/entities/infrastructure.d.ts.map +1 -0
- package/dist/entities/infrastructure.js +1154 -0
- package/dist/entities/infrastructure.js.map +1 -0
- package/dist/entities/knowledge.d.ts +98 -0
- package/dist/entities/knowledge.d.ts.map +1 -0
- package/dist/entities/knowledge.js +1439 -0
- package/dist/entities/knowledge.js.map +1 -0
- package/dist/entities/marketing.d.ts +82 -0
- package/dist/entities/marketing.d.ts.map +1 -0
- package/dist/entities/marketing.js +1611 -0
- package/dist/entities/marketing.js.map +1 -0
- package/dist/entities/media.d.ts +83 -0
- package/dist/entities/media.d.ts.map +1 -0
- package/dist/entities/media.js +1635 -0
- package/dist/entities/media.js.map +1 -0
- package/dist/entities/notification.d.ts +76 -0
- package/dist/entities/notification.d.ts.map +1 -0
- package/dist/entities/notification.js +1200 -0
- package/dist/entities/notification.js.map +1 -0
- package/dist/entities/presentation.d.ts +61 -0
- package/dist/entities/presentation.d.ts.map +1 -0
- package/dist/entities/presentation.js +1275 -0
- package/dist/entities/presentation.js.map +1 -0
- package/dist/entities/productivity.d.ts +92 -0
- package/dist/entities/productivity.d.ts.map +1 -0
- package/dist/entities/productivity.js +1318 -0
- package/dist/entities/productivity.js.map +1 -0
- package/dist/entities/project-management.d.ts +89 -0
- package/dist/entities/project-management.d.ts.map +1 -0
- package/dist/entities/project-management.js +1137 -0
- package/dist/entities/project-management.js.map +1 -0
- package/dist/entities/recruiting.d.ts +54 -0
- package/dist/entities/recruiting.d.ts.map +1 -0
- package/dist/entities/recruiting.js +737 -0
- package/dist/entities/recruiting.js.map +1 -0
- package/dist/entities/shipping.d.ts +52 -0
- package/dist/entities/shipping.d.ts.map +1 -0
- package/dist/entities/shipping.js +510 -0
- package/dist/entities/shipping.js.map +1 -0
- package/dist/entities/signature.d.ts +83 -0
- package/dist/entities/signature.d.ts.map +1 -0
- package/dist/entities/signature.js +1103 -0
- package/dist/entities/signature.js.map +1 -0
- package/dist/entities/site.d.ts +33 -0
- package/dist/entities/site.d.ts.map +1 -0
- package/dist/entities/site.js +223 -0
- package/dist/entities/site.js.map +1 -0
- package/dist/entities/spreadsheet.d.ts +68 -0
- package/dist/entities/spreadsheet.d.ts.map +1 -0
- package/dist/entities/spreadsheet.js +1342 -0
- package/dist/entities/spreadsheet.js.map +1 -0
- package/dist/entities/storage.d.ts +74 -0
- package/dist/entities/storage.d.ts.map +1 -0
- package/dist/entities/storage.js +1199 -0
- package/dist/entities/storage.js.map +1 -0
- package/dist/entities/support.d.ts +83 -0
- package/dist/entities/support.d.ts.map +1 -0
- package/dist/entities/support.js +1167 -0
- package/dist/entities/support.js.map +1 -0
- package/dist/entities/video-conferencing.d.ts +129 -0
- package/dist/entities/video-conferencing.d.ts.map +1 -0
- package/dist/entities/video-conferencing.js +1751 -0
- package/dist/entities/video-conferencing.js.map +1 -0
- package/dist/entities/video.d.ts +76 -0
- package/dist/entities/video.d.ts.map +1 -0
- package/dist/entities/video.js +951 -0
- package/dist/entities/video.js.map +1 -0
- package/dist/entities.d.ts +147 -0
- package/dist/entities.d.ts.map +1 -0
- package/dist/entities.js +1664 -0
- package/dist/entities.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +75 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/analytics/index.d.ts +19 -0
- package/dist/providers/analytics/index.d.ts.map +1 -0
- package/dist/providers/analytics/index.js +18 -0
- package/dist/providers/analytics/index.js.map +1 -0
- package/dist/providers/analytics/mixpanel.d.ts +25 -0
- package/dist/providers/analytics/mixpanel.d.ts.map +1 -0
- package/dist/providers/analytics/mixpanel.js +256 -0
- package/dist/providers/analytics/mixpanel.js.map +1 -0
- package/dist/providers/calendar/cal-com.d.ts +26 -0
- package/dist/providers/calendar/cal-com.d.ts.map +1 -0
- package/dist/providers/calendar/cal-com.js +304 -0
- package/dist/providers/calendar/cal-com.js.map +1 -0
- package/dist/providers/calendar/google-calendar.d.ts +25 -0
- package/dist/providers/calendar/google-calendar.d.ts.map +1 -0
- package/dist/providers/calendar/google-calendar.js +336 -0
- package/dist/providers/calendar/google-calendar.js.map +1 -0
- package/dist/providers/calendar/index.d.ts +20 -0
- package/dist/providers/calendar/index.d.ts.map +1 -0
- package/dist/providers/calendar/index.js +21 -0
- package/dist/providers/calendar/index.js.map +1 -0
- package/dist/providers/crm/hubspot.d.ts +25 -0
- package/dist/providers/crm/hubspot.d.ts.map +1 -0
- package/dist/providers/crm/hubspot.js +567 -0
- package/dist/providers/crm/hubspot.js.map +1 -0
- package/dist/providers/crm/index.d.ts +19 -0
- package/dist/providers/crm/index.d.ts.map +1 -0
- package/dist/providers/crm/index.js +18 -0
- package/dist/providers/crm/index.js.map +1 -0
- package/dist/providers/development/github.d.ts +25 -0
- package/dist/providers/development/github.d.ts.map +1 -0
- package/dist/providers/development/github.js +473 -0
- package/dist/providers/development/github.js.map +1 -0
- package/dist/providers/development/index.d.ts +19 -0
- package/dist/providers/development/index.d.ts.map +1 -0
- package/dist/providers/development/index.js +18 -0
- package/dist/providers/development/index.js.map +1 -0
- package/dist/providers/ecommerce/index.d.ts +19 -0
- package/dist/providers/ecommerce/index.d.ts.map +1 -0
- package/dist/providers/ecommerce/index.js +18 -0
- package/dist/providers/ecommerce/index.js.map +1 -0
- package/dist/providers/ecommerce/shopify.d.ts +25 -0
- package/dist/providers/ecommerce/shopify.d.ts.map +1 -0
- package/dist/providers/ecommerce/shopify.js +379 -0
- package/dist/providers/ecommerce/shopify.js.map +1 -0
- package/dist/providers/email/index.d.ts +20 -0
- package/dist/providers/email/index.d.ts.map +1 -0
- package/dist/providers/email/index.js +21 -0
- package/dist/providers/email/index.js.map +1 -0
- package/dist/providers/email/resend.d.ts +25 -0
- package/dist/providers/email/resend.d.ts.map +1 -0
- package/dist/providers/email/resend.js +259 -0
- package/dist/providers/email/resend.js.map +1 -0
- package/dist/providers/email/sendgrid.d.ts +25 -0
- package/dist/providers/email/sendgrid.d.ts.map +1 -0
- package/dist/providers/email/sendgrid.js +162 -0
- package/dist/providers/email/sendgrid.js.map +1 -0
- package/dist/providers/finance/index.d.ts +19 -0
- package/dist/providers/finance/index.d.ts.map +1 -0
- package/dist/providers/finance/index.js +18 -0
- package/dist/providers/finance/index.js.map +1 -0
- package/dist/providers/finance/stripe.d.ts +25 -0
- package/dist/providers/finance/stripe.d.ts.map +1 -0
- package/dist/providers/finance/stripe.js +550 -0
- package/dist/providers/finance/stripe.js.map +1 -0
- package/dist/providers/forms/index.d.ts +19 -0
- package/dist/providers/forms/index.d.ts.map +1 -0
- package/dist/providers/forms/index.js +18 -0
- package/dist/providers/forms/index.js.map +1 -0
- package/dist/providers/forms/typeform.d.ts +25 -0
- package/dist/providers/forms/typeform.d.ts.map +1 -0
- package/dist/providers/forms/typeform.js +501 -0
- package/dist/providers/forms/typeform.js.map +1 -0
- package/dist/providers/index.d.ts +56 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +124 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/knowledge/index.d.ts +19 -0
- package/dist/providers/knowledge/index.d.ts.map +1 -0
- package/dist/providers/knowledge/index.js +18 -0
- package/dist/providers/knowledge/index.js.map +1 -0
- package/dist/providers/knowledge/notion.d.ts +25 -0
- package/dist/providers/knowledge/notion.d.ts.map +1 -0
- package/dist/providers/knowledge/notion.js +390 -0
- package/dist/providers/knowledge/notion.js.map +1 -0
- package/dist/providers/marketing/index.d.ts +19 -0
- package/dist/providers/marketing/index.d.ts.map +1 -0
- package/dist/providers/marketing/index.js +18 -0
- package/dist/providers/marketing/index.js.map +1 -0
- package/dist/providers/marketing/mailchimp.d.ts +25 -0
- package/dist/providers/marketing/mailchimp.d.ts.map +1 -0
- package/dist/providers/marketing/mailchimp.js +444 -0
- package/dist/providers/marketing/mailchimp.js.map +1 -0
- package/dist/providers/media/cloudinary.d.ts +25 -0
- package/dist/providers/media/cloudinary.d.ts.map +1 -0
- package/dist/providers/media/cloudinary.js +319 -0
- package/dist/providers/media/cloudinary.js.map +1 -0
- package/dist/providers/media/index.d.ts +19 -0
- package/dist/providers/media/index.d.ts.map +1 -0
- package/dist/providers/media/index.js +18 -0
- package/dist/providers/media/index.js.map +1 -0
- package/dist/providers/messaging/index.d.ts +24 -0
- package/dist/providers/messaging/index.d.ts.map +1 -0
- package/dist/providers/messaging/index.js +21 -0
- package/dist/providers/messaging/index.js.map +1 -0
- package/dist/providers/messaging/slack.d.ts +25 -0
- package/dist/providers/messaging/slack.d.ts.map +1 -0
- package/dist/providers/messaging/slack.js +394 -0
- package/dist/providers/messaging/slack.js.map +1 -0
- package/dist/providers/messaging/twilio-sms.d.ts +25 -0
- package/dist/providers/messaging/twilio-sms.d.ts.map +1 -0
- package/dist/providers/messaging/twilio-sms.js +250 -0
- package/dist/providers/messaging/twilio-sms.js.map +1 -0
- package/dist/providers/project-management/index.d.ts +19 -0
- package/dist/providers/project-management/index.d.ts.map +1 -0
- package/dist/providers/project-management/index.js +18 -0
- package/dist/providers/project-management/index.js.map +1 -0
- package/dist/providers/project-management/linear.d.ts +25 -0
- package/dist/providers/project-management/linear.d.ts.map +1 -0
- package/dist/providers/project-management/linear.js +576 -0
- package/dist/providers/project-management/linear.js.map +1 -0
- package/dist/providers/registry.d.ts +41 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +87 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/providers/spreadsheet/google-sheets.d.ts +25 -0
- package/dist/providers/spreadsheet/google-sheets.d.ts.map +1 -0
- package/dist/providers/spreadsheet/google-sheets.js +376 -0
- package/dist/providers/spreadsheet/google-sheets.js.map +1 -0
- package/dist/providers/spreadsheet/index.d.ts +20 -0
- package/dist/providers/spreadsheet/index.d.ts.map +1 -0
- package/dist/providers/spreadsheet/index.js +21 -0
- package/dist/providers/spreadsheet/index.js.map +1 -0
- package/dist/providers/spreadsheet/xlsx.d.ts +26 -0
- package/dist/providers/spreadsheet/xlsx.d.ts.map +1 -0
- package/dist/providers/spreadsheet/xlsx.js +424 -0
- package/dist/providers/spreadsheet/xlsx.js.map +1 -0
- package/dist/providers/storage/index.d.ts +30 -0
- package/dist/providers/storage/index.d.ts.map +1 -0
- package/dist/providers/storage/index.js +25 -0
- package/dist/providers/storage/index.js.map +1 -0
- package/dist/providers/storage/s3.d.ts +25 -0
- package/dist/providers/storage/s3.d.ts.map +1 -0
- package/dist/providers/storage/s3.js +420 -0
- package/dist/providers/storage/s3.js.map +1 -0
- package/dist/providers/support/index.d.ts +19 -0
- package/dist/providers/support/index.d.ts.map +1 -0
- package/dist/providers/support/index.js +18 -0
- package/dist/providers/support/index.js.map +1 -0
- package/dist/providers/support/zendesk.d.ts +25 -0
- package/dist/providers/support/zendesk.d.ts.map +1 -0
- package/dist/providers/support/zendesk.js +374 -0
- package/dist/providers/support/zendesk.js.map +1 -0
- package/dist/providers/tasks/index.d.ts +19 -0
- package/dist/providers/tasks/index.d.ts.map +1 -0
- package/dist/providers/tasks/index.js +18 -0
- package/dist/providers/tasks/index.js.map +1 -0
- package/dist/providers/tasks/todoist.d.ts +25 -0
- package/dist/providers/tasks/todoist.d.ts.map +1 -0
- package/dist/providers/tasks/todoist.js +287 -0
- package/dist/providers/tasks/todoist.js.map +1 -0
- package/dist/providers/types.d.ts +1753 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +10 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/providers/video-conferencing/google-meet.d.ts +26 -0
- package/dist/providers/video-conferencing/google-meet.d.ts.map +1 -0
- package/dist/providers/video-conferencing/google-meet.js +287 -0
- package/dist/providers/video-conferencing/google-meet.js.map +1 -0
- package/dist/providers/video-conferencing/index.d.ts +22 -0
- package/dist/providers/video-conferencing/index.d.ts.map +1 -0
- package/dist/providers/video-conferencing/index.js +32 -0
- package/dist/providers/video-conferencing/index.js.map +1 -0
- package/dist/providers/video-conferencing/jitsi.d.ts +26 -0
- package/dist/providers/video-conferencing/jitsi.d.ts.map +1 -0
- package/dist/providers/video-conferencing/jitsi.js +255 -0
- package/dist/providers/video-conferencing/jitsi.js.map +1 -0
- package/dist/providers/video-conferencing/teams.d.ts +26 -0
- package/dist/providers/video-conferencing/teams.d.ts.map +1 -0
- package/dist/providers/video-conferencing/teams.js +271 -0
- package/dist/providers/video-conferencing/teams.js.map +1 -0
- package/dist/providers/video-conferencing/zoom.d.ts +25 -0
- package/dist/providers/video-conferencing/zoom.d.ts.map +1 -0
- package/dist/providers/video-conferencing/zoom.js +333 -0
- package/dist/providers/video-conferencing/zoom.js.map +1 -0
- package/dist/providers/voice/vapi.d.ts +27 -0
- package/dist/providers/voice/vapi.d.ts.map +1 -0
- package/dist/providers/voice/vapi.js +440 -0
- package/dist/providers/voice/vapi.js.map +1 -0
- package/dist/registry.d.ts +38 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +129 -0
- package/dist/registry.js.map +1 -0
- package/dist/tools/communication.d.ts +94 -0
- package/dist/tools/communication.d.ts.map +1 -0
- package/dist/tools/communication.js +185 -0
- package/dist/tools/communication.js.map +1 -0
- package/dist/tools/data.d.ts +61 -0
- package/dist/tools/data.d.ts.map +1 -0
- package/dist/tools/data.js +206 -0
- package/dist/tools/data.js.map +1 -0
- package/dist/tools/index.d.ts +12 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +12 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/web.d.ts +45 -0
- package/dist/tools/web.d.ts.map +1 -0
- package/dist/tools/web.js +138 -0
- package/dist/tools/web.js.map +1 -0
- package/dist/types.d.ts +330 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +45 -0
- package/src/define.ts +321 -0
- package/src/entities/advertising.ts +1086 -0
- package/src/entities/ai.ts +835 -0
- package/src/entities/analytics.ts +1690 -0
- package/src/entities/automation.ts +669 -0
- package/src/entities/communication.ts +1255 -0
- package/src/entities/crm.ts +1481 -0
- package/src/entities/design.ts +606 -0
- package/src/entities/development.ts +2392 -0
- package/src/entities/document.ts +930 -0
- package/src/entities/ecommerce.ts +1539 -0
- package/src/entities/experiment.ts +1139 -0
- package/src/entities/finance.ts +3907 -0
- package/src/entities/forms.ts +2021 -0
- package/src/entities/hr.ts +725 -0
- package/src/entities/identity.ts +1093 -0
- package/src/entities/index.ts +731 -0
- package/src/entities/infrastructure.ts +1254 -0
- package/src/entities/knowledge.ts +1547 -0
- package/src/entities/marketing.ts +1718 -0
- package/src/entities/media.ts +1747 -0
- package/src/entities/notification.ts +1260 -0
- package/src/entities/presentation.ts +1360 -0
- package/src/entities/productivity.ts +1411 -0
- package/src/entities/project-management.ts +1222 -0
- package/src/entities/recruiting.ts +797 -0
- package/src/entities/shipping.ts +566 -0
- package/src/entities/signature.ts +1204 -0
- package/src/entities/site.ts +244 -0
- package/src/entities/spreadsheet.ts +1434 -0
- package/src/entities/storage.ts +1290 -0
- package/src/entities/support.ts +1267 -0
- package/src/entities/video-conferencing.ts +1874 -0
- package/src/entities/video.ts +1035 -0
- package/src/entities.ts +1795 -0
- package/src/index.ts +176 -0
- package/src/providers/analytics/index.ts +21 -0
- package/src/providers/analytics/mixpanel.ts +311 -0
- package/src/providers/calendar/cal-com.ts +435 -0
- package/src/providers/calendar/google-calendar.ts +412 -0
- package/src/providers/calendar/index.ts +24 -0
- package/src/providers/crm/hubspot.ts +667 -0
- package/src/providers/crm/index.ts +21 -0
- package/src/providers/development/github.ts +608 -0
- package/src/providers/development/index.ts +21 -0
- package/src/providers/ecommerce/index.ts +21 -0
- package/src/providers/ecommerce/shopify.ts +451 -0
- package/src/providers/email/index.ts +24 -0
- package/src/providers/email/resend.ts +301 -0
- package/src/providers/email/sendgrid.ts +196 -0
- package/src/providers/finance/index.ts +21 -0
- package/src/providers/finance/stripe.ts +665 -0
- package/src/providers/forms/index.ts +21 -0
- package/src/providers/forms/typeform.ts +598 -0
- package/src/providers/index.ts +281 -0
- package/src/providers/knowledge/index.ts +21 -0
- package/src/providers/knowledge/notion.ts +497 -0
- package/src/providers/marketing/index.ts +21 -0
- package/src/providers/marketing/mailchimp.ts +656 -0
- package/src/providers/media/cloudinary.ts +373 -0
- package/src/providers/media/index.ts +21 -0
- package/src/providers/messaging/index.ts +24 -0
- package/src/providers/messaging/slack.ts +487 -0
- package/src/providers/messaging/twilio-sms.ts +301 -0
- package/src/providers/project-management/index.ts +21 -0
- package/src/providers/project-management/linear.ts +693 -0
- package/src/providers/registry.ts +119 -0
- package/src/providers/spreadsheet/google-sheets.ts +464 -0
- package/src/providers/spreadsheet/index.ts +24 -0
- package/src/providers/spreadsheet/xlsx.ts +542 -0
- package/src/providers/storage/index.ts +35 -0
- package/src/providers/storage/s3.ts +513 -0
- package/src/providers/support/index.ts +21 -0
- package/src/providers/support/zendesk.ts +417 -0
- package/src/providers/tasks/index.ts +21 -0
- package/src/providers/tasks/todoist.ts +407 -0
- package/src/providers/types.ts +2113 -0
- package/src/providers/video-conferencing/google-meet.ts +412 -0
- package/src/providers/video-conferencing/index.ts +35 -0
- package/src/providers/video-conferencing/jitsi.ts +324 -0
- package/src/providers/video-conferencing/teams.ts +408 -0
- package/src/providers/video-conferencing/zoom.ts +451 -0
- package/src/registry.ts +172 -0
- package/src/tools/communication.ts +256 -0
- package/src/tools/data.ts +236 -0
- package/src/tools/index.ts +12 -0
- package/src/tools/web.ts +161 -0
- package/src/types.ts +539 -0
- package/test/define.test.ts +367 -0
- package/test/registry.test.ts +444 -0
- package/test/tools.test.ts +453 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,667 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HubSpot CRM Provider
|
|
3
|
+
*
|
|
4
|
+
* Concrete implementation of CRMProvider using HubSpot CRM API v3.
|
|
5
|
+
*
|
|
6
|
+
* @packageDocumentation
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type {
|
|
10
|
+
CRMProvider,
|
|
11
|
+
ProviderConfig,
|
|
12
|
+
ProviderHealth,
|
|
13
|
+
ProviderInfo,
|
|
14
|
+
CreateContactOptions,
|
|
15
|
+
CRMContactData,
|
|
16
|
+
ContactListOptions,
|
|
17
|
+
PaginatedResult,
|
|
18
|
+
CreateDealOptions,
|
|
19
|
+
DealData,
|
|
20
|
+
DealListOptions,
|
|
21
|
+
CreateActivityOptions,
|
|
22
|
+
CRMActivityData,
|
|
23
|
+
} from '../types.js'
|
|
24
|
+
import { defineProvider } from '../registry.js'
|
|
25
|
+
|
|
26
|
+
const HUBSPOT_API_URL = 'https://api.hubapi.com/crm/v3'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* HubSpot provider info
|
|
30
|
+
*/
|
|
31
|
+
export const hubspotInfo: ProviderInfo = {
|
|
32
|
+
id: 'crm.hubspot',
|
|
33
|
+
name: 'HubSpot',
|
|
34
|
+
description: 'HubSpot CRM platform for managing contacts, deals, and activities',
|
|
35
|
+
category: 'crm',
|
|
36
|
+
website: 'https://www.hubspot.com',
|
|
37
|
+
docsUrl: 'https://developers.hubspot.com/docs/api/overview',
|
|
38
|
+
requiredConfig: ['accessToken'],
|
|
39
|
+
optionalConfig: ['baseUrl'],
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Map HubSpot contact properties to CRMContactData
|
|
44
|
+
*/
|
|
45
|
+
function mapContactFromHubSpot(contact: any): CRMContactData {
|
|
46
|
+
const props = contact.properties || {}
|
|
47
|
+
return {
|
|
48
|
+
id: contact.id,
|
|
49
|
+
firstName: props.firstname || '',
|
|
50
|
+
lastName: props.lastname || '',
|
|
51
|
+
email: props.email,
|
|
52
|
+
phone: props.phone,
|
|
53
|
+
company: props.company,
|
|
54
|
+
title: props.jobtitle,
|
|
55
|
+
ownerId: props.hubspot_owner_id,
|
|
56
|
+
createdAt: new Date(props.createdate || contact.createdAt),
|
|
57
|
+
updatedAt: new Date(props.lastmodifieddate || contact.updatedAt),
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Map HubSpot deal properties to DealData
|
|
63
|
+
*/
|
|
64
|
+
function mapDealFromHubSpot(deal: any): DealData {
|
|
65
|
+
const props = deal.properties || {}
|
|
66
|
+
return {
|
|
67
|
+
id: deal.id,
|
|
68
|
+
name: props.dealname || '',
|
|
69
|
+
value: props.amount ? parseFloat(props.amount) : undefined,
|
|
70
|
+
currency: props.deal_currency_code,
|
|
71
|
+
stage: props.dealstage || '',
|
|
72
|
+
probability: props.hs_deal_stage_probability ? parseFloat(props.hs_deal_stage_probability) : undefined,
|
|
73
|
+
contactId: props.associatedcontactid,
|
|
74
|
+
companyId: props.associatedcompanyid,
|
|
75
|
+
ownerId: props.hubspot_owner_id,
|
|
76
|
+
closeDate: props.closedate ? new Date(props.closedate) : undefined,
|
|
77
|
+
createdAt: new Date(props.createdate || deal.createdAt),
|
|
78
|
+
updatedAt: new Date(props.hs_lastmodifieddate || deal.updatedAt),
|
|
79
|
+
wonAt: props.hs_date_entered_closedwon ? new Date(props.hs_date_entered_closedwon) : undefined,
|
|
80
|
+
lostAt: props.hs_date_entered_closedlost ? new Date(props.hs_date_entered_closedlost) : undefined,
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Map HubSpot engagement to CRMActivityData
|
|
86
|
+
*/
|
|
87
|
+
function mapActivityFromHubSpot(engagement: any, contactId: string): CRMActivityData {
|
|
88
|
+
const props = engagement.properties || {}
|
|
89
|
+
return {
|
|
90
|
+
id: engagement.id,
|
|
91
|
+
type: props.hs_engagement_type || 'note',
|
|
92
|
+
subject: props.hs_engagement_subject || '',
|
|
93
|
+
body: props.hs_note_body || props.hs_email_text || '',
|
|
94
|
+
contactId,
|
|
95
|
+
ownerId: props.hubspot_owner_id || '',
|
|
96
|
+
dueDate: props.hs_task_due_date ? new Date(props.hs_task_due_date) : undefined,
|
|
97
|
+
completedAt: props.hs_engagement_completed_at ? new Date(props.hs_engagement_completed_at) : undefined,
|
|
98
|
+
createdAt: new Date(props.hs_createdate || engagement.createdAt),
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Create HubSpot CRM provider
|
|
104
|
+
*/
|
|
105
|
+
export function createHubSpotProvider(config: ProviderConfig): CRMProvider {
|
|
106
|
+
let accessToken: string
|
|
107
|
+
let baseUrl: string
|
|
108
|
+
|
|
109
|
+
// Helper function to associate deal with contact
|
|
110
|
+
async function associateDealWithContact(dealId: string, contactId: string): Promise<void> {
|
|
111
|
+
try {
|
|
112
|
+
const response = await fetch(
|
|
113
|
+
`${baseUrl}/objects/deals/${dealId}/associations/contacts/${contactId}/deal_to_contact`,
|
|
114
|
+
{
|
|
115
|
+
method: 'PUT',
|
|
116
|
+
headers: {
|
|
117
|
+
Authorization: `Bearer ${accessToken}`,
|
|
118
|
+
'Content-Type': 'application/json',
|
|
119
|
+
},
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
if (!response.ok) {
|
|
124
|
+
throw new Error(`HTTP ${response.status}`)
|
|
125
|
+
}
|
|
126
|
+
} catch (error) {
|
|
127
|
+
// Log but don't throw - association is optional
|
|
128
|
+
console.warn('Failed to associate deal with contact:', error)
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Helper function to associate deal with company
|
|
133
|
+
async function associateDealWithCompany(dealId: string, companyId: string): Promise<void> {
|
|
134
|
+
try {
|
|
135
|
+
const response = await fetch(
|
|
136
|
+
`${baseUrl}/objects/deals/${dealId}/associations/companies/${companyId}/deal_to_company`,
|
|
137
|
+
{
|
|
138
|
+
method: 'PUT',
|
|
139
|
+
headers: {
|
|
140
|
+
Authorization: `Bearer ${accessToken}`,
|
|
141
|
+
'Content-Type': 'application/json',
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
if (!response.ok) {
|
|
147
|
+
throw new Error(`HTTP ${response.status}`)
|
|
148
|
+
}
|
|
149
|
+
} catch (error) {
|
|
150
|
+
// Log but don't throw - association is optional
|
|
151
|
+
console.warn('Failed to associate deal with company:', error)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Helper function to associate engagement with contact
|
|
156
|
+
async function associateEngagementWithContact(engagementId: string, contactId: string): Promise<void> {
|
|
157
|
+
try {
|
|
158
|
+
const response = await fetch(
|
|
159
|
+
`${baseUrl}/objects/engagements/${engagementId}/associations/contacts/${contactId}/engagement_to_contact`,
|
|
160
|
+
{
|
|
161
|
+
method: 'PUT',
|
|
162
|
+
headers: {
|
|
163
|
+
Authorization: `Bearer ${accessToken}`,
|
|
164
|
+
'Content-Type': 'application/json',
|
|
165
|
+
},
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
if (!response.ok) {
|
|
170
|
+
throw new Error(`HTTP ${response.status}`)
|
|
171
|
+
}
|
|
172
|
+
} catch (error) {
|
|
173
|
+
console.warn('Failed to associate engagement with contact:', error)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return {
|
|
178
|
+
info: hubspotInfo,
|
|
179
|
+
|
|
180
|
+
async initialize(cfg: ProviderConfig): Promise<void> {
|
|
181
|
+
accessToken = cfg.accessToken as string
|
|
182
|
+
baseUrl = (cfg.baseUrl as string) || HUBSPOT_API_URL
|
|
183
|
+
|
|
184
|
+
if (!accessToken) {
|
|
185
|
+
throw new Error('HubSpot access token is required')
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
async healthCheck(): Promise<ProviderHealth> {
|
|
190
|
+
const start = Date.now()
|
|
191
|
+
try {
|
|
192
|
+
const response = await fetch(`${baseUrl}/objects/contacts?limit=1`, {
|
|
193
|
+
headers: {
|
|
194
|
+
Authorization: `Bearer ${accessToken}`,
|
|
195
|
+
'Content-Type': 'application/json',
|
|
196
|
+
},
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
return {
|
|
200
|
+
healthy: response.ok,
|
|
201
|
+
latencyMs: Date.now() - start,
|
|
202
|
+
message: response.ok ? 'Connected' : `HTTP ${response.status}`,
|
|
203
|
+
checkedAt: new Date(),
|
|
204
|
+
}
|
|
205
|
+
} catch (error) {
|
|
206
|
+
return {
|
|
207
|
+
healthy: false,
|
|
208
|
+
latencyMs: Date.now() - start,
|
|
209
|
+
message: error instanceof Error ? error.message : 'Unknown error',
|
|
210
|
+
checkedAt: new Date(),
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
async dispose(): Promise<void> {
|
|
216
|
+
// No cleanup needed
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
async createContact(contact: CreateContactOptions): Promise<CRMContactData> {
|
|
220
|
+
const properties: Record<string, any> = {
|
|
221
|
+
firstname: contact.firstName,
|
|
222
|
+
lastname: contact.lastName,
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (contact.email) properties.email = contact.email
|
|
226
|
+
if (contact.phone) properties.phone = contact.phone
|
|
227
|
+
if (contact.company) properties.company = contact.company
|
|
228
|
+
if (contact.title) properties.jobtitle = contact.title
|
|
229
|
+
|
|
230
|
+
// Add custom fields
|
|
231
|
+
if (contact.customFields) {
|
|
232
|
+
Object.assign(properties, contact.customFields)
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
try {
|
|
236
|
+
const response = await fetch(`${baseUrl}/objects/contacts`, {
|
|
237
|
+
method: 'POST',
|
|
238
|
+
headers: {
|
|
239
|
+
Authorization: `Bearer ${accessToken}`,
|
|
240
|
+
'Content-Type': 'application/json',
|
|
241
|
+
},
|
|
242
|
+
body: JSON.stringify({ properties }),
|
|
243
|
+
})
|
|
244
|
+
|
|
245
|
+
if (!response.ok) {
|
|
246
|
+
const errorData = await response.json().catch(() => ({}))
|
|
247
|
+
throw new Error((errorData as any)?.message || `HTTP ${response.status}`)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const data: any = await response.json()
|
|
251
|
+
return mapContactFromHubSpot(data)
|
|
252
|
+
} catch (error) {
|
|
253
|
+
throw new Error(
|
|
254
|
+
`Failed to create contact: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
async getContact(contactId: string): Promise<CRMContactData | null> {
|
|
260
|
+
try {
|
|
261
|
+
const response = await fetch(`${baseUrl}/objects/contacts/${contactId}`, {
|
|
262
|
+
headers: {
|
|
263
|
+
Authorization: `Bearer ${accessToken}`,
|
|
264
|
+
'Content-Type': 'application/json',
|
|
265
|
+
},
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
if (response.status === 404) {
|
|
269
|
+
return null
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (!response.ok) {
|
|
273
|
+
throw new Error(`HTTP ${response.status}`)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const data: any = await response.json()
|
|
277
|
+
return mapContactFromHubSpot(data)
|
|
278
|
+
} catch (error) {
|
|
279
|
+
if (error instanceof Error && error.message.includes('404')) {
|
|
280
|
+
return null
|
|
281
|
+
}
|
|
282
|
+
throw new Error(
|
|
283
|
+
`Failed to get contact: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
284
|
+
)
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
|
|
288
|
+
async updateContact(
|
|
289
|
+
contactId: string,
|
|
290
|
+
updates: Partial<CreateContactOptions>
|
|
291
|
+
): Promise<CRMContactData> {
|
|
292
|
+
const properties: Record<string, any> = {}
|
|
293
|
+
|
|
294
|
+
if (updates.firstName !== undefined) properties.firstname = updates.firstName
|
|
295
|
+
if (updates.lastName !== undefined) properties.lastname = updates.lastName
|
|
296
|
+
if (updates.email !== undefined) properties.email = updates.email
|
|
297
|
+
if (updates.phone !== undefined) properties.phone = updates.phone
|
|
298
|
+
if (updates.company !== undefined) properties.company = updates.company
|
|
299
|
+
if (updates.title !== undefined) properties.jobtitle = updates.title
|
|
300
|
+
|
|
301
|
+
// Add custom fields
|
|
302
|
+
if (updates.customFields) {
|
|
303
|
+
Object.assign(properties, updates.customFields)
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
try {
|
|
307
|
+
const response = await fetch(`${baseUrl}/objects/contacts/${contactId}`, {
|
|
308
|
+
method: 'PATCH',
|
|
309
|
+
headers: {
|
|
310
|
+
Authorization: `Bearer ${accessToken}`,
|
|
311
|
+
'Content-Type': 'application/json',
|
|
312
|
+
},
|
|
313
|
+
body: JSON.stringify({ properties }),
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
if (!response.ok) {
|
|
317
|
+
const errorData = await response.json().catch(() => ({}))
|
|
318
|
+
throw new Error((errorData as any)?.message || `HTTP ${response.status}`)
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
const data: any = await response.json()
|
|
322
|
+
return mapContactFromHubSpot(data)
|
|
323
|
+
} catch (error) {
|
|
324
|
+
throw new Error(
|
|
325
|
+
`Failed to update contact: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
326
|
+
)
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
|
|
330
|
+
async listContacts(options?: ContactListOptions): Promise<PaginatedResult<CRMContactData>> {
|
|
331
|
+
const params = new URLSearchParams({
|
|
332
|
+
limit: String(options?.limit || 100),
|
|
333
|
+
})
|
|
334
|
+
|
|
335
|
+
if (options?.cursor) {
|
|
336
|
+
params.set('after', options.cursor)
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
try {
|
|
340
|
+
const response = await fetch(`${baseUrl}/objects/contacts?${params}`, {
|
|
341
|
+
headers: {
|
|
342
|
+
Authorization: `Bearer ${accessToken}`,
|
|
343
|
+
'Content-Type': 'application/json',
|
|
344
|
+
},
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
if (!response.ok) {
|
|
348
|
+
throw new Error(`HTTP ${response.status}`)
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
const data: any = await response.json()
|
|
352
|
+
return {
|
|
353
|
+
items: (data.results || []).map(mapContactFromHubSpot),
|
|
354
|
+
total: data.total,
|
|
355
|
+
hasMore: !!data.paging?.next,
|
|
356
|
+
nextCursor: data.paging?.next?.after,
|
|
357
|
+
}
|
|
358
|
+
} catch (error) {
|
|
359
|
+
throw new Error(
|
|
360
|
+
`Failed to list contacts: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
361
|
+
)
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
|
|
365
|
+
async searchContacts(query: string): Promise<CRMContactData[]> {
|
|
366
|
+
try {
|
|
367
|
+
const response = await fetch(`${baseUrl}/objects/contacts/search`, {
|
|
368
|
+
method: 'POST',
|
|
369
|
+
headers: {
|
|
370
|
+
Authorization: `Bearer ${accessToken}`,
|
|
371
|
+
'Content-Type': 'application/json',
|
|
372
|
+
},
|
|
373
|
+
body: JSON.stringify({
|
|
374
|
+
filterGroups: [
|
|
375
|
+
{
|
|
376
|
+
filters: [
|
|
377
|
+
{
|
|
378
|
+
propertyName: 'email',
|
|
379
|
+
operator: 'CONTAINS_TOKEN',
|
|
380
|
+
value: query,
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
propertyName: 'firstname',
|
|
384
|
+
operator: 'CONTAINS_TOKEN',
|
|
385
|
+
value: query,
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
propertyName: 'lastname',
|
|
389
|
+
operator: 'CONTAINS_TOKEN',
|
|
390
|
+
value: query,
|
|
391
|
+
},
|
|
392
|
+
],
|
|
393
|
+
},
|
|
394
|
+
],
|
|
395
|
+
limit: 100,
|
|
396
|
+
}),
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
if (!response.ok) {
|
|
400
|
+
throw new Error(`HTTP ${response.status}`)
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const data: any = await response.json()
|
|
404
|
+
return (data.results || []).map(mapContactFromHubSpot)
|
|
405
|
+
} catch (error) {
|
|
406
|
+
throw new Error(
|
|
407
|
+
`Failed to search contacts: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
408
|
+
)
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
|
|
412
|
+
async createDeal(deal: CreateDealOptions): Promise<DealData> {
|
|
413
|
+
const properties: Record<string, any> = {
|
|
414
|
+
dealname: deal.name,
|
|
415
|
+
dealstage: deal.stage,
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
if (deal.value !== undefined) properties.amount = String(deal.value)
|
|
419
|
+
if (deal.currency) properties.deal_currency_code = deal.currency
|
|
420
|
+
if (deal.closeDate) properties.closedate = deal.closeDate.toISOString()
|
|
421
|
+
if (deal.probability !== undefined) properties.hs_deal_stage_probability = String(deal.probability)
|
|
422
|
+
|
|
423
|
+
try {
|
|
424
|
+
const response = await fetch(`${baseUrl}/objects/deals`, {
|
|
425
|
+
method: 'POST',
|
|
426
|
+
headers: {
|
|
427
|
+
Authorization: `Bearer ${accessToken}`,
|
|
428
|
+
'Content-Type': 'application/json',
|
|
429
|
+
},
|
|
430
|
+
body: JSON.stringify({ properties }),
|
|
431
|
+
})
|
|
432
|
+
|
|
433
|
+
if (!response.ok) {
|
|
434
|
+
const errorData = await response.json().catch(() => ({}))
|
|
435
|
+
throw new Error((errorData as any)?.message || `HTTP ${response.status}`)
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
const data: any = await response.json()
|
|
439
|
+
const dealData = mapDealFromHubSpot(data)
|
|
440
|
+
|
|
441
|
+
// Associate with contact if specified
|
|
442
|
+
if (deal.contactId) {
|
|
443
|
+
await associateDealWithContact(dealData.id, deal.contactId)
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Associate with company if specified
|
|
447
|
+
if (deal.companyId) {
|
|
448
|
+
await associateDealWithCompany(dealData.id, deal.companyId)
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
return dealData
|
|
452
|
+
} catch (error) {
|
|
453
|
+
throw new Error(
|
|
454
|
+
`Failed to create deal: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
455
|
+
)
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
|
|
459
|
+
async getDeal(dealId: string): Promise<DealData | null> {
|
|
460
|
+
try {
|
|
461
|
+
const response = await fetch(`${baseUrl}/objects/deals/${dealId}`, {
|
|
462
|
+
headers: {
|
|
463
|
+
Authorization: `Bearer ${accessToken}`,
|
|
464
|
+
'Content-Type': 'application/json',
|
|
465
|
+
},
|
|
466
|
+
})
|
|
467
|
+
|
|
468
|
+
if (response.status === 404) {
|
|
469
|
+
return null
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
if (!response.ok) {
|
|
473
|
+
throw new Error(`HTTP ${response.status}`)
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
const data: any = await response.json()
|
|
477
|
+
return mapDealFromHubSpot(data)
|
|
478
|
+
} catch (error) {
|
|
479
|
+
if (error instanceof Error && error.message.includes('404')) {
|
|
480
|
+
return null
|
|
481
|
+
}
|
|
482
|
+
throw new Error(
|
|
483
|
+
`Failed to get deal: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
484
|
+
)
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
|
|
488
|
+
async updateDeal(dealId: string, updates: Partial<CreateDealOptions>): Promise<DealData> {
|
|
489
|
+
const properties: Record<string, any> = {}
|
|
490
|
+
|
|
491
|
+
if (updates.name !== undefined) properties.dealname = updates.name
|
|
492
|
+
if (updates.stage !== undefined) properties.dealstage = updates.stage
|
|
493
|
+
if (updates.value !== undefined) properties.amount = String(updates.value)
|
|
494
|
+
if (updates.currency !== undefined) properties.deal_currency_code = updates.currency
|
|
495
|
+
if (updates.closeDate !== undefined) properties.closedate = updates.closeDate.toISOString()
|
|
496
|
+
if (updates.probability !== undefined) properties.hs_deal_stage_probability = String(updates.probability)
|
|
497
|
+
|
|
498
|
+
try {
|
|
499
|
+
const response = await fetch(`${baseUrl}/objects/deals/${dealId}`, {
|
|
500
|
+
method: 'PATCH',
|
|
501
|
+
headers: {
|
|
502
|
+
Authorization: `Bearer ${accessToken}`,
|
|
503
|
+
'Content-Type': 'application/json',
|
|
504
|
+
},
|
|
505
|
+
body: JSON.stringify({ properties }),
|
|
506
|
+
})
|
|
507
|
+
|
|
508
|
+
if (!response.ok) {
|
|
509
|
+
const errorData = await response.json().catch(() => ({}))
|
|
510
|
+
throw new Error((errorData as any)?.message || `HTTP ${response.status}`)
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
const data: any = await response.json()
|
|
514
|
+
return mapDealFromHubSpot(data)
|
|
515
|
+
} catch (error) {
|
|
516
|
+
throw new Error(
|
|
517
|
+
`Failed to update deal: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
518
|
+
)
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
|
|
522
|
+
async listDeals(options?: DealListOptions): Promise<PaginatedResult<DealData>> {
|
|
523
|
+
const params = new URLSearchParams({
|
|
524
|
+
limit: String(options?.limit || 100),
|
|
525
|
+
})
|
|
526
|
+
|
|
527
|
+
if (options?.cursor) {
|
|
528
|
+
params.set('after', options.cursor)
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
try {
|
|
532
|
+
const response = await fetch(`${baseUrl}/objects/deals?${params}`, {
|
|
533
|
+
headers: {
|
|
534
|
+
Authorization: `Bearer ${accessToken}`,
|
|
535
|
+
'Content-Type': 'application/json',
|
|
536
|
+
},
|
|
537
|
+
})
|
|
538
|
+
|
|
539
|
+
if (!response.ok) {
|
|
540
|
+
throw new Error(`HTTP ${response.status}`)
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
const data: any = await response.json()
|
|
544
|
+
return {
|
|
545
|
+
items: (data.results || []).map(mapDealFromHubSpot),
|
|
546
|
+
total: data.total,
|
|
547
|
+
hasMore: !!data.paging?.next,
|
|
548
|
+
nextCursor: data.paging?.next?.after,
|
|
549
|
+
}
|
|
550
|
+
} catch (error) {
|
|
551
|
+
throw new Error(
|
|
552
|
+
`Failed to list deals: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
553
|
+
)
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
|
|
557
|
+
async logActivity(contactId: string, activity: CreateActivityOptions): Promise<CRMActivityData> {
|
|
558
|
+
// Map activity type to HubSpot engagement type
|
|
559
|
+
const engagementType = activity.type === 'email' ? 'EMAIL' :
|
|
560
|
+
activity.type === 'call' ? 'CALL' :
|
|
561
|
+
activity.type === 'meeting' ? 'MEETING' :
|
|
562
|
+
activity.type === 'task' ? 'TASK' :
|
|
563
|
+
'NOTE'
|
|
564
|
+
|
|
565
|
+
const properties: Record<string, any> = {
|
|
566
|
+
hs_engagement_type: engagementType.toLowerCase(),
|
|
567
|
+
hs_engagement_subject: activity.subject,
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
if (activity.body) {
|
|
571
|
+
if (engagementType === 'NOTE') {
|
|
572
|
+
properties.hs_note_body = activity.body
|
|
573
|
+
} else if (engagementType === 'EMAIL') {
|
|
574
|
+
properties.hs_email_text = activity.body
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
if (activity.dueDate) {
|
|
579
|
+
properties.hs_task_due_date = activity.dueDate.toISOString()
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
try {
|
|
583
|
+
const response = await fetch(`${baseUrl}/objects/engagements`, {
|
|
584
|
+
method: 'POST',
|
|
585
|
+
headers: {
|
|
586
|
+
Authorization: `Bearer ${accessToken}`,
|
|
587
|
+
'Content-Type': 'application/json',
|
|
588
|
+
},
|
|
589
|
+
body: JSON.stringify({ properties }),
|
|
590
|
+
})
|
|
591
|
+
|
|
592
|
+
if (!response.ok) {
|
|
593
|
+
const errorData = await response.json().catch(() => ({}))
|
|
594
|
+
throw new Error((errorData as any)?.message || `HTTP ${response.status}`)
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
const data: any = await response.json()
|
|
598
|
+
|
|
599
|
+
// Associate engagement with contact
|
|
600
|
+
await associateEngagementWithContact(data.id, contactId)
|
|
601
|
+
|
|
602
|
+
return mapActivityFromHubSpot(data, contactId)
|
|
603
|
+
} catch (error) {
|
|
604
|
+
throw new Error(
|
|
605
|
+
`Failed to log activity: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
606
|
+
)
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
|
|
610
|
+
async listActivities(contactId: string): Promise<CRMActivityData[]> {
|
|
611
|
+
try {
|
|
612
|
+
// Get associated engagements for the contact
|
|
613
|
+
const response = await fetch(
|
|
614
|
+
`${baseUrl}/objects/contacts/${contactId}/associations/engagements`,
|
|
615
|
+
{
|
|
616
|
+
headers: {
|
|
617
|
+
Authorization: `Bearer ${accessToken}`,
|
|
618
|
+
'Content-Type': 'application/json',
|
|
619
|
+
},
|
|
620
|
+
}
|
|
621
|
+
)
|
|
622
|
+
|
|
623
|
+
if (!response.ok) {
|
|
624
|
+
throw new Error(`HTTP ${response.status}`)
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
const data: any = await response.json()
|
|
628
|
+
const engagementIds = (data.results || []).map((r: any) => r.id)
|
|
629
|
+
|
|
630
|
+
if (engagementIds.length === 0) {
|
|
631
|
+
return []
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
// Fetch engagement details in batch
|
|
635
|
+
const engagements = await Promise.all(
|
|
636
|
+
engagementIds.map(async (id: string) => {
|
|
637
|
+
const engResponse = await fetch(`${baseUrl}/objects/engagements/${id}`, {
|
|
638
|
+
headers: {
|
|
639
|
+
Authorization: `Bearer ${accessToken}`,
|
|
640
|
+
'Content-Type': 'application/json',
|
|
641
|
+
},
|
|
642
|
+
})
|
|
643
|
+
if (engResponse.ok) {
|
|
644
|
+
return engResponse.json()
|
|
645
|
+
}
|
|
646
|
+
return null
|
|
647
|
+
})
|
|
648
|
+
)
|
|
649
|
+
|
|
650
|
+
return engagements
|
|
651
|
+
.filter((eng: any) => eng !== null)
|
|
652
|
+
.map((eng: any) => mapActivityFromHubSpot(eng, contactId))
|
|
653
|
+
} catch (error) {
|
|
654
|
+
throw new Error(
|
|
655
|
+
`Failed to list activities: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
656
|
+
)
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* HubSpot provider definition
|
|
664
|
+
*/
|
|
665
|
+
export const hubspotProvider = defineProvider(hubspotInfo, async (config) =>
|
|
666
|
+
createHubSpotProvider(config)
|
|
667
|
+
)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CRM Providers
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export { hubspotInfo, hubspotProvider, createHubSpotProvider } from './hubspot.js'
|
|
8
|
+
|
|
9
|
+
import { hubspotProvider } from './hubspot.js'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Register all CRM providers
|
|
13
|
+
*/
|
|
14
|
+
export function registerCRMProviders(): void {
|
|
15
|
+
hubspotProvider.register()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* All CRM providers
|
|
20
|
+
*/
|
|
21
|
+
export const crmProviders = [hubspotProvider]
|