@absolutejs/engagement-apollo 0.0.9 → 0.0.11

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/README.md CHANGED
@@ -25,7 +25,7 @@ const activity = await apollo.listActivities?.({
25
25
  | `enrichCompany` | `GET /v1/organizations/enrich` | Domain required. |
26
26
  | `listActivities` | `POST /v1/emailer_messages/search` | **Plan-gated** — engagement API access varies by Apollo plan. Returns `[]` if unsupported; verify field mapping against a live account before relying on it. |
27
27
 
28
- Company enrichment preserves provider identity and annual revenue with observation time and provider-estimate attribution. Currency remains unknown when the provider does not specify it.
28
+ Company enrichment preserves provider identity and annual revenue with observation time and provider-estimate attribution. Apollo documents `organization.annual_revenue` as an estimate in USD; the adapter preserves that denomination. It does not infer currency from the company location.
29
29
 
30
30
  Company enrichment returns `null` for no match (404), throws `RateLimitError` for 429, and throws `EngagementProviderError` for authentication, permission, server, or malformed-response failures. Errors exclude raw response bodies and credentials. Person/activity endpoints retain their existing behavior.
31
31
 
package/dist/index.js CHANGED
@@ -11,6 +11,20 @@ var LOCKED_EMAIL = /email_not_unlocked/iu;
11
11
  var isRecord = (value) => typeof value === "object" && value !== null;
12
12
  var str = (value) => typeof value === "string" && value.length > 0 ? value : null;
13
13
  var num = (value) => typeof value === "number" && Number.isFinite(value) ? value : null;
14
+ var companyDomain = (org) => {
15
+ const primary = str(org.primary_domain);
16
+ if (primary)
17
+ return primary;
18
+ const website = str(org.website_url);
19
+ if (!website)
20
+ return null;
21
+ try {
22
+ const url = new URL(website);
23
+ return (url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password ? url.hostname.toLowerCase().replace(/^www\./u, "") || null : null;
24
+ } catch {
25
+ return null;
26
+ }
27
+ };
14
28
  var joinLocation = (parts) => {
15
29
  const present = parts.filter((part) => part !== null);
16
30
  return present.length > 0 ? present.join(", ") : null;
@@ -130,13 +144,13 @@ var apolloSource = (options) => {
130
144
  annualRevenue: revenue !== null && revenue > 0 || revenueDisplay ? {
131
145
  amount: revenue !== null && revenue > 0 ? revenue : null,
132
146
  display: revenueDisplay,
133
- currency: null,
147
+ currency: "USD",
134
148
  basis: "provider_estimate",
135
149
  provider: "apollo",
136
150
  observedAt: new Date().toISOString()
137
151
  } : null,
138
152
  description: str(org.short_description),
139
- domain: str(org.primary_domain),
153
+ domain: companyDomain(org),
140
154
  employeeCount: num(org.estimated_num_employees),
141
155
  foundedYear: num(org.founded_year),
142
156
  industry: str(org.industry),
package/package.json CHANGED
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "type": "module",
46
46
  "types": "./dist/index.d.ts",
47
- "version": "0.0.9",
47
+ "version": "0.0.11",
48
48
  "exports": {
49
49
  ".": {
50
50
  "types": "./dist/index.d.ts",