strapi-plugin-hubspot 0.11.0 → 0.11.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.11.1 — 2026-08-29
4
+
5
+ Ships the company-search sharpening that missed the 0.11.0 tarball (the
6
+ release was published before its PR merged):
7
+
8
+ - pasted SIRET/SIREN identifiers survive their formatting (spaces, dots,
9
+ dashes) and query directly;
10
+ - closed structures excluded at the source (`etat_administratif=A`);
11
+ - big groups surface up to 5 matching établissements.
12
+
3
13
  ## 0.11.0 — 2026-08-29
4
14
 
5
15
  ### Added — the `company` field (INSEE/SIRENE)
@@ -1179,13 +1179,20 @@ async function query(params) {
1179
1179
  return null;
1180
1180
  }
1181
1181
  }
1182
+ function normalizeQuery(q) {
1183
+ const trimmed = q.trim();
1184
+ const digits = trimmed.replace(/[\s.-]/g, "");
1185
+ return /^\d{9}$/.test(digits) || /^\d{14}$/.test(digits) ? digits : trimmed;
1186
+ }
1182
1187
  async function searchCompanies(q) {
1183
- const trimmed = q.trim().slice(0, 60);
1188
+ const trimmed = normalizeQuery(q).slice(0, 60);
1184
1189
  if (trimmed.length < 3) return [];
1185
1190
  const key = trimmed.toLowerCase();
1186
1191
  const cached = cache.get(key);
1187
1192
  if (cached && Date.now() - cached.at < CACHE_TTL_MS) return cached.hits;
1188
- const payload = await query(`q=${encodeURIComponent(trimmed)}&per_page=8`);
1193
+ const payload = await query(
1194
+ `q=${encodeURIComponent(trimmed)}&per_page=8&etat_administratif=A&limite_matching_etablissements=5`
1195
+ );
1189
1196
  const hits = payload ? normalizeCompanyHits(payload) : [];
1190
1197
  if (payload) cache.set(key, { at: Date.now(), hits });
1191
1198
  return hits;
@@ -1178,13 +1178,20 @@ async function query(params) {
1178
1178
  return null;
1179
1179
  }
1180
1180
  }
1181
+ function normalizeQuery(q) {
1182
+ const trimmed = q.trim();
1183
+ const digits = trimmed.replace(/[\s.-]/g, "");
1184
+ return /^\d{9}$/.test(digits) || /^\d{14}$/.test(digits) ? digits : trimmed;
1185
+ }
1181
1186
  async function searchCompanies(q) {
1182
- const trimmed = q.trim().slice(0, 60);
1187
+ const trimmed = normalizeQuery(q).slice(0, 60);
1183
1188
  if (trimmed.length < 3) return [];
1184
1189
  const key = trimmed.toLowerCase();
1185
1190
  const cached = cache.get(key);
1186
1191
  if (cached && Date.now() - cached.at < CACHE_TTL_MS) return cached.hits;
1187
- const payload = await query(`q=${encodeURIComponent(trimmed)}&per_page=8`);
1192
+ const payload = await query(
1193
+ `q=${encodeURIComponent(trimmed)}&per_page=8&etat_administratif=A&limite_matching_etablissements=5`
1194
+ );
1188
1195
  const hits = payload ? normalizeCompanyHits(payload) : [];
1189
1196
  if (payload) cache.set(key, { at: Date.now(), hits });
1190
1197
  return hits;
@@ -70,6 +70,11 @@ export declare function pickSiret(payload: SearchPayload, siret: string): Compan
70
70
  * `companyMap`. Only complete mappings with an actual value produce a write.
71
71
  */
72
72
  export declare function companyProperties(map: CompanyMap, hit: CompanyHit): Record<string, Record<string, Primitive>>;
73
+ /**
74
+ * A pasted identifier survives its formatting: "798 841 284 00010" queries as
75
+ * a SIRET, "798.841.284" as a SIREN. Anything else is a plain text query.
76
+ */
77
+ export declare function normalizeQuery(q: string): string;
73
78
  /** Autocomplete search. Bounded, cached; empty on any failure. */
74
79
  export declare function searchCompanies(q: string): Promise<CompanyHit[]>;
75
80
  /** Authoritative re-resolution of a selected SIRET; null when unreachable. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-hubspot",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "The form builder for HubSpot in Strapi — multi-step forms with conditional fields mapped to real CRM properties, a public submit pipeline with retries, and save-time mapping validation.",
5
5
  "keywords": [
6
6
  "strapi",