@aglyn/plugins-crm 1.23.1 → 1.25.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/plugins-crm",
3
- "version": "1.23.1",
3
+ "version": "1.25.0",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,19 +25,19 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/aglyn": "1.23.1",
29
- "@aglyn/shared-data-enums": "1.23.1",
30
- "@aglyn/shared-data-mdi": "1.23.1",
31
- "@aglyn/shared-ui-jsx": "1.23.1",
32
- "@aglyn/shared-ui-next": "1.23.1",
33
- "@aglyn/shared-ui-snackstack": "1.23.1",
34
- "@aglyn/shared-util-email": "1.23.1",
35
- "@aglyn/shared-util-http": "1.23.1",
36
- "@aglyn/shared-util-timestamp": "1.23.1",
37
- "@aglyn/shared-util-tools": "1.23.1",
38
- "@aglyn/tenant-data-admin": "1.23.1",
39
- "@aglyn/tenant-feature-instance": "1.23.1",
40
- "@aglyn/tenant-runtime": "1.23.1",
28
+ "@aglyn/aglyn": "1.25.0",
29
+ "@aglyn/shared-data-enums": "1.25.0",
30
+ "@aglyn/shared-data-mdi": "1.25.0",
31
+ "@aglyn/shared-ui-jsx": "1.25.0",
32
+ "@aglyn/shared-ui-next": "1.25.0",
33
+ "@aglyn/shared-ui-snackstack": "1.25.0",
34
+ "@aglyn/shared-util-email": "1.25.0",
35
+ "@aglyn/shared-util-http": "1.25.0",
36
+ "@aglyn/shared-util-timestamp": "1.25.0",
37
+ "@aglyn/shared-util-tools": "1.25.0",
38
+ "@aglyn/tenant-data-admin": "1.25.0",
39
+ "@aglyn/tenant-feature-instance": "1.25.0",
40
+ "@aglyn/tenant-runtime": "1.25.0",
41
41
  "@dnd-kit/core": "^6.3.1",
42
42
  "@dnd-kit/utilities": "^3.2.2",
43
43
  "@swc/helpers": "0.5.24",
@@ -1,3 +1,4 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
1
2
  /**
2
3
  * @license
3
4
  * Copyright 2026 Aglyn LLC
@@ -37,8 +38,7 @@
37
38
  * organization-wide profile, or one site's through `?consentSiteId=` —
38
39
  * with its `alternateEmails` now carrying the merged address.
39
40
  */ import { ApiErrors, apiJson } from "@aglyn/tenant-data-admin";
40
- import { apiKeyActorLabel } from "@aglyn/aglyn/app-utils/activity-presenter";
41
- import { claimWrite, readJsonBody } from "@aglyn/tenant-data-admin/server/api-v1-kit";
41
+ import { apiActorFields, apiActorLabel, claimWrite, readJsonBody } from "@aglyn/tenant-data-admin/server/api-v1-kit";
42
42
  import { mergeContacts } from "../merge-contacts.js";
43
43
  /** The key an integration names the record to fold in by. */ export const MERGE_SOURCE_FIELD = 'sourceContactId';
44
44
  export async function mergeContactRoute(request, ctx, survivorRef, view) {
@@ -74,13 +74,12 @@ export async function mergeContactRoute(request, ctx, survivorRef, view) {
74
74
  // A key has no uid; `'api'` is the attribution every API-created CRM
75
75
  // record carries in `createdByUid`, and the note it leaves names the
76
76
  // key when the organization named it.
77
- actor: {
77
+ actor: _extends({
78
78
  uid: 'api',
79
- email: null,
80
- apiKeyName: ctx.keyName
81
- },
79
+ email: null
80
+ }, apiActorFields(ctx)),
82
81
  hostId: null,
83
- actorName: ctx.keyName ? apiKeyActorLabel(ctx.keyName) : 'API'
82
+ actorName: ctx.keyName ? apiActorLabel(ctx) : 'API'
84
83
  });
85
84
  if (result.ok === false) {
86
85
  await claim.release();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../../libs/plugins/crm/src/lib/server/api-v1/contacts-merge.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * `POST /v1/contacts/{contactId}/merge` (AGL-2625) — fold another contact\n * into this one.\n *\n * The contact in the path SURVIVES: it keeps its address as the identity,\n * and the record named by `sourceContactId` is folded into it and deleted.\n * `mergeContacts` (`../merge-contacts.ts`) is the whole of the work — the same\n * function behind the console's `crm/contacts-merge` — so an integration\n * and a person at the record page cannot merge two different ways.\n *\n * ## Idempotency\n *\n * Takes an `Idempotency-Key` with the delete's exact semantics, and for the\n * delete's reason: a merge destroys a record, and a retry after a lost\n * response must be able to tell \"already merged\" from \"wrong id\". Without a\n * key, a second call finds no source contact and answers `404`, which is\n * true and is the confusion the key removes.\n *\n * ## What it answers\n *\n * The surviving contact, read back the way `GET` reads it — the\n * organization-wide profile, or one site's through `?consentSiteId=` —\n * with its `alternateEmails` now carrying the merged address.\n */\n\nimport { ApiErrors, apiJson } from '@aglyn/tenant-data-admin'\nimport { apiKeyActorLabel } from '@aglyn/aglyn/app-utils/activity-presenter'\nimport {\n type ApiV1Context,\n claimWrite,\n readJsonBody,\n} from '@aglyn/tenant-data-admin/server/api-v1-kit'\nimport { mergeContacts } from '../merge-contacts'\n\n/** The key an integration names the record to fold in by. */\nexport const MERGE_SOURCE_FIELD = 'sourceContactId'\n\nexport async function mergeContactRoute(\n request: Request,\n ctx: ApiV1Context,\n survivorRef: FirebaseFirestore.DocumentReference,\n view: (snapshot: FirebaseFirestore.DocumentSnapshot) => unknown,\n): Promise<Response> {\n const body = await readJsonBody(request)\n const raw = body[MERGE_SOURCE_FIELD]\n const sourceId = typeof raw === 'string' ? raw.trim() : ''\n const fields: Record<string, string> = {}\n if (raw === undefined) fields[MERGE_SOURCE_FIELD] = 'Required — the contact to merge into this one'\n else if (!sourceId) fields[MERGE_SOURCE_FIELD] = 'Must be a contact id'\n else if (sourceId === survivorRef.id) {\n fields[MERGE_SOURCE_FIELD] = 'Must be a different contact from the one in the path'\n }\n for (const key of Object.keys(body)) {\n if (key !== MERGE_SOURCE_FIELD) fields[key] = 'Not accepted on a merge'\n }\n if (Object.keys(fields).length) {\n return ApiErrors.badRequest({\n message: 'Merge failed validation',\n code: 'validation_failed',\n fields,\n headers: ctx.headers,\n })\n }\n\n const claimed = await claimWrite(\n ctx,\n '*',\n request.headers.get('Idempotency-Key'),\n 'contact-merges',\n )\n if ('replay' in claimed) return claimed.replay\n const { claim } = claimed\n\n try {\n const result = await mergeContacts({\n firestore: ctx.firestore,\n orgRef: ctx.firestore.collection('orgs').doc(ctx.orgId),\n survivorId: survivorRef.id,\n mergedId: sourceId,\n // A key has no uid; `'api'` is the attribution every API-created CRM\n // record carries in `createdByUid`, and the note it leaves names the\n // key when the organization named it.\n actor: { uid: 'api', email: null, apiKeyName: ctx.keyName },\n hostId: null,\n actorName: ctx.keyName ? apiKeyActorLabel(ctx.keyName) : 'API',\n })\n if (result.ok === false) {\n await claim.release()\n if (result.reason === 'survivor-missing') {\n return ApiErrors.notFound({ message: 'No such contact', headers: ctx.headers })\n }\n if (result.reason === 'merged-missing') {\n return ApiErrors.notFound({\n message: 'No such contact to merge',\n code: 'source_not_found',\n headers: ctx.headers,\n })\n }\n return ApiErrors.badRequest({\n message: 'Merge failed validation',\n code: 'validation_failed',\n fields: { [MERGE_SOURCE_FIELD]: 'Must be a different contact from the one in the path' },\n headers: ctx.headers,\n })\n }\n const answer = view(await survivorRef.get())\n await claim.record(200, answer)\n return apiJson(answer, { headers: ctx.headers })\n } catch (error) {\n await claim.release()\n throw error\n }\n}\n"],"names":["ApiErrors","apiJson","apiKeyActorLabel","claimWrite","readJsonBody","mergeContacts","MERGE_SOURCE_FIELD","mergeContactRoute","request","ctx","survivorRef","view","body","raw","sourceId","trim","fields","undefined","id","key","Object","keys","length","badRequest","message","code","headers","claimed","get","replay","claim","result","firestore","orgRef","collection","doc","orgId","survivorId","mergedId","actor","uid","email","apiKeyName","keyName","hostId","actorName","ok","release","reason","notFound","answer","record","error"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GAED,SAASA,SAAS,EAAEC,OAAO,QAAQ,2BAA0B;AAC7D,SAASC,gBAAgB,QAAQ,4CAA2C;AAC5E,SAEEC,UAAU,EACVC,YAAY,QACP,6CAA4C;AACnD,SAASC,aAAa,QAAQ,uBAAmB;AAEjD,2DAA2D,GAC3D,OAAO,MAAMC,qBAAqB,kBAAiB;AAEnD,OAAO,eAAeC,kBACpBC,OAAgB,EAChBC,GAAiB,EACjBC,WAAgD,EAChDC,IAA+D;IAE/D,MAAMC,OAAO,MAAMR,aAAaI;IAChC,MAAMK,MAAMD,IAAI,CAACN,mBAAmB;IACpC,MAAMQ,WAAW,OAAOD,QAAQ,WAAWA,IAAIE,IAAI,KAAK;IACxD,MAAMC,SAAiC,CAAC;IACxC,IAAIH,QAAQI,WAAWD,MAAM,CAACV,mBAAmB,GAAG;SAC/C,IAAI,CAACQ,UAAUE,MAAM,CAACV,mBAAmB,GAAG;SAC5C,IAAIQ,aAAaJ,YAAYQ,EAAE,EAAE;QACpCF,MAAM,CAACV,mBAAmB,GAAG;IAC/B;IACA,KAAK,MAAMa,OAAOC,OAAOC,IAAI,CAACT,MAAO;QACnC,IAAIO,QAAQb,oBAAoBU,MAAM,CAACG,IAAI,GAAG;IAChD;IACA,IAAIC,OAAOC,IAAI,CAACL,QAAQM,MAAM,EAAE;QAC9B,OAAOtB,UAAUuB,UAAU,CAAC;YAC1BC,SAAS;YACTC,MAAM;YACNT;YACAU,SAASjB,IAAIiB,OAAO;QACtB;IACF;IAEA,MAAMC,UAAU,MAAMxB,WACpBM,KACA,KACAD,QAAQkB,OAAO,CAACE,GAAG,CAAC,oBACpB;IAEF,IAAI,YAAYD,SAAS,OAAOA,QAAQE,MAAM;IAC9C,MAAM,EAAEC,KAAK,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/contacts-merge.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * `POST /v1/contacts/{contactId}/merge` (AGL-2625) — fold another contact\n * into this one.\n *\n * The contact in the path SURVIVES: it keeps its address as the identity,\n * and the record named by `sourceContactId` is folded into it and deleted.\n * `mergeContacts` (`../merge-contacts.ts`) is the whole of the work — the same\n * function behind the console's `crm/contacts-merge` — so an integration\n * and a person at the record page cannot merge two different ways.\n *\n * ## Idempotency\n *\n * Takes an `Idempotency-Key` with the delete's exact semantics, and for the\n * delete's reason: a merge destroys a record, and a retry after a lost\n * response must be able to tell \"already merged\" from \"wrong id\". Without a\n * key, a second call finds no source contact and answers `404`, which is\n * true and is the confusion the key removes.\n *\n * ## What it answers\n *\n * The surviving contact, read back the way `GET` reads it — the\n * organization-wide profile, or one site's through `?consentSiteId=` —\n * with its `alternateEmails` now carrying the merged address.\n */\n\nimport { ApiErrors, apiJson } from '@aglyn/tenant-data-admin'\nimport {\n apiActorFields,\n apiActorLabel,\n type ApiV1Context,\n claimWrite,\n readJsonBody,\n} from '@aglyn/tenant-data-admin/server/api-v1-kit'\nimport { mergeContacts } from '../merge-contacts'\n\n/** The key an integration names the record to fold in by. */\nexport const MERGE_SOURCE_FIELD = 'sourceContactId'\n\nexport async function mergeContactRoute(\n request: Request,\n ctx: ApiV1Context,\n survivorRef: FirebaseFirestore.DocumentReference,\n view: (snapshot: FirebaseFirestore.DocumentSnapshot) => unknown,\n): Promise<Response> {\n const body = await readJsonBody(request)\n const raw = body[MERGE_SOURCE_FIELD]\n const sourceId = typeof raw === 'string' ? raw.trim() : ''\n const fields: Record<string, string> = {}\n if (raw === undefined) fields[MERGE_SOURCE_FIELD] = 'Required — the contact to merge into this one'\n else if (!sourceId) fields[MERGE_SOURCE_FIELD] = 'Must be a contact id'\n else if (sourceId === survivorRef.id) {\n fields[MERGE_SOURCE_FIELD] = 'Must be a different contact from the one in the path'\n }\n for (const key of Object.keys(body)) {\n if (key !== MERGE_SOURCE_FIELD) fields[key] = 'Not accepted on a merge'\n }\n if (Object.keys(fields).length) {\n return ApiErrors.badRequest({\n message: 'Merge failed validation',\n code: 'validation_failed',\n fields,\n headers: ctx.headers,\n })\n }\n\n const claimed = await claimWrite(\n ctx,\n '*',\n request.headers.get('Idempotency-Key'),\n 'contact-merges',\n )\n if ('replay' in claimed) return claimed.replay\n const { claim } = claimed\n\n try {\n const result = await mergeContacts({\n firestore: ctx.firestore,\n orgRef: ctx.firestore.collection('orgs').doc(ctx.orgId),\n survivorId: survivorRef.id,\n mergedId: sourceId,\n // A key has no uid; `'api'` is the attribution every API-created CRM\n // record carries in `createdByUid`, and the note it leaves names the\n // key when the organization named it.\n actor: { uid: 'api', email: null, ...apiActorFields(ctx) },\n hostId: null,\n actorName: ctx.keyName ? apiActorLabel(ctx) : 'API',\n })\n if (result.ok === false) {\n await claim.release()\n if (result.reason === 'survivor-missing') {\n return ApiErrors.notFound({ message: 'No such contact', headers: ctx.headers })\n }\n if (result.reason === 'merged-missing') {\n return ApiErrors.notFound({\n message: 'No such contact to merge',\n code: 'source_not_found',\n headers: ctx.headers,\n })\n }\n return ApiErrors.badRequest({\n message: 'Merge failed validation',\n code: 'validation_failed',\n fields: { [MERGE_SOURCE_FIELD]: 'Must be a different contact from the one in the path' },\n headers: ctx.headers,\n })\n }\n const answer = view(await survivorRef.get())\n await claim.record(200, answer)\n return apiJson(answer, { headers: ctx.headers })\n } catch (error) {\n await claim.release()\n throw error\n }\n}\n"],"names":["ApiErrors","apiJson","apiActorFields","apiActorLabel","claimWrite","readJsonBody","mergeContacts","MERGE_SOURCE_FIELD","mergeContactRoute","request","ctx","survivorRef","view","body","raw","sourceId","trim","fields","undefined","id","key","Object","keys","length","badRequest","message","code","headers","claimed","get","replay","claim","result","firestore","orgRef","collection","doc","orgId","survivorId","mergedId","actor","uid","email","hostId","actorName","keyName","ok","release","reason","notFound","answer","record","error"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GAED,SAASA,SAAS,EAAEC,OAAO,QAAQ,2BAA0B;AAC7D,SACEC,cAAc,EACdC,aAAa,EAEbC,UAAU,EACVC,YAAY,QACP,6CAA4C;AACnD,SAASC,aAAa,QAAQ,uBAAmB;AAEjD,2DAA2D,GAC3D,OAAO,MAAMC,qBAAqB,kBAAiB;AAEnD,OAAO,eAAeC,kBACpBC,OAAgB,EAChBC,GAAiB,EACjBC,WAAgD,EAChDC,IAA+D;IAE/D,MAAMC,OAAO,MAAMR,aAAaI;IAChC,MAAMK,MAAMD,IAAI,CAACN,mBAAmB;IACpC,MAAMQ,WAAW,OAAOD,QAAQ,WAAWA,IAAIE,IAAI,KAAK;IACxD,MAAMC,SAAiC,CAAC;IACxC,IAAIH,QAAQI,WAAWD,MAAM,CAACV,mBAAmB,GAAG;SAC/C,IAAI,CAACQ,UAAUE,MAAM,CAACV,mBAAmB,GAAG;SAC5C,IAAIQ,aAAaJ,YAAYQ,EAAE,EAAE;QACpCF,MAAM,CAACV,mBAAmB,GAAG;IAC/B;IACA,KAAK,MAAMa,OAAOC,OAAOC,IAAI,CAACT,MAAO;QACnC,IAAIO,QAAQb,oBAAoBU,MAAM,CAACG,IAAI,GAAG;IAChD;IACA,IAAIC,OAAOC,IAAI,CAACL,QAAQM,MAAM,EAAE;QAC9B,OAAOvB,UAAUwB,UAAU,CAAC;YAC1BC,SAAS;YACTC,MAAM;YACNT;YACAU,SAASjB,IAAIiB,OAAO;QACtB;IACF;IAEA,MAAMC,UAAU,MAAMxB,WACpBM,KACA,K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,MAAMK;IACR;AACF"}
@@ -15,7 +15,7 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
15
15
  * See the License for the specific language governing permissions and
16
16
  * limitations under the License.
17
17
  */ import { nameSearchFields } from "@aglyn/aglyn/app-utils/name-search";
18
- import { CAPTURED_BY_HOST_FIELD, composeContactName, CONTACT_BIRTHDATE_REFUSAL, CONTACT_COMPANY_IDS_FIELD, CONTACT_EXTRA_PHONE_FIELDS, CONTACT_FACETS_FIELD, ORG_CONTACT_HOLDER_ID, CONTACT_FIELDS_MAX_PER_ORG, CONTACT_LIFECYCLE_STAGES, CONTACT_NAME_PART_MAX, consentGroupForHost, crmDefaultScopeOf, crmScopeTokens, contactFacetPath, createResourceUid, CRM_COLLECTIONS, CRM_LEAD_SOURCE_PICKLIST, CRM_MEDIA_IDS_MAX, CRM_SALUTATION_PICKLIST, isContactLifecycleStage, judgeCrmPicklistValue, MARKETING_CONSENT_BY_HOST_FIELD, marketingConsentFieldsForGroup, marketingConsentHostIds, normalizeAddress, normalizeContactBirthdate, normalizeContactEmail, normalizeCrmMediaIds, normalizePhone, ORG_SCOPE_TOKEN, planContactCompanyLink, readContactCompanyLink, readContactCustomInput, readContactFacet, soloConsentGroup } from "@aglyn/aglyn/server";
18
+ import { CAPTURED_BY_HOST_FIELD, composeContactName, CONTACT_BIRTHDATE_REFUSAL, CONTACT_COMPANY_IDS_FIELD, CONTACT_EXTRA_PHONE_FIELDS, CONTACT_FACETS_FIELD, ORG_CONTACT_HOLDER_ID, CONTACT_FIELDS_MAX_PER_ORG, CONTACT_LIFECYCLE_STAGES, CONTACT_NAME_PART_MAX, consentGroupForHost, crmDefaultScopeOf, crmScopeTokens, contactFacetPath, createResourceUid, CRM_COLLECTIONS, CRM_LEAD_SOURCE_PICKLIST, CRM_MEDIA_IDS_MAX, CRM_SALUTATION_PICKLIST, isContactLifecycleStage, judgeCrmPicklistValue, MARKETING_CONSENT_BY_HOST_FIELD, marketingConsentFieldsForGroup, marketingConsentHostIds, normalizeAddress, normalizeContactBirthdate, normalizeContactEmail, normalizeCrmMediaIds, normalizePhone, ORG_SCOPE_TOKEN, planContactCompanyLink, readContactCompanyLink, readContactCustomInput, readContactFacet, soloConsentGroup, crmRecordsRefusalMessage } from "@aglyn/aglyn/server";
19
19
  import { ApiErrors, apiJson, contactCompanyMirrorValue, crmRecordsQuotaForOrg, listResponse, restampCrmListFieldsAt, settleCompanyContactsCounts } from "@aglyn/tenant-data-admin";
20
20
  import { claimWrite, orgOwnsHost, paginate, readJsonBody, requireScope, serialize } from "@aglyn/tenant-data-admin/server/api-v1-kit";
21
21
  // The leaf, so a spec that stands a partial barrel in still reaches it.
@@ -843,7 +843,8 @@ const contactsCollection = (ctx)=>ctx.firestore.collection('orgs').doc(ctx.orgId
843
843
  // and integrators match on it; the band behind it widened, the code
844
844
  // did not. Companies and deals answer `crm_records_quota`.
845
845
  return ApiErrors.planRequired({
846
- message: `CRM records limit reached (${quota.included} records across ` + 'contacts, companies and deals). Upgrade the plan to add more.',
846
+ // Names Starter's ceiling and the plan without one (AGL-4227).
847
+ message: crmRecordsRefusalMessage(ctx.org, quota),
847
848
  code: 'contact_quota',
848
849
  headers: ctx.headers
849
850
  });