@aglyn/plugins-crm 1.26.5 → 1.27.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 +14 -14
- package/src/lib/model/native-vocabulary.d.ts +4 -0
- package/src/lib/model/native-vocabulary.js +8 -1
- package/src/lib/model/native-vocabulary.js.map +1 -1
- package/src/lib/native-nav.js +9 -3
- package/src/lib/native-nav.js.map +1 -1
- package/src/lib/server/api-v1/contacts.js +35 -8
- package/src/lib/server/api-v1/contacts.js.map +1 -1
- package/src/lib/server/api-v1/crm-activities.js +1 -1
- package/src/lib/server/api-v1/crm-activities.js.map +1 -1
- package/src/lib/server/api-v1/crm-companies.js +1 -1
- package/src/lib/server/api-v1/crm-companies.js.map +1 -1
- package/src/lib/server/api-v1/crm-deals.js +1 -1
- package/src/lib/server/api-v1/crm-deals.js.map +1 -1
- package/src/lib/server/api-v1/crm-email-templates.js +1 -1
- package/src/lib/server/api-v1/crm-email-templates.js.map +1 -1
- package/src/lib/server/api-v1/crm-leads.js +25 -12
- package/src/lib/server/api-v1/crm-leads.js.map +1 -1
- package/src/lib/server/api-v1/crm-shared.d.ts +8 -2
- package/src/lib/server/api-v1/crm-shared.js +12 -2
- package/src/lib/server/api-v1/crm-shared.js.map +1 -1
- package/src/lib/server/api-v1/crm-tasks.js +1 -1
- package/src/lib/server/api-v1/crm-tasks.js.map +1 -1
- package/src/lib/server/api-v1/openapi.js +2 -0
- package/src/lib/server/api-v1/openapi.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/plugins-crm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.27.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.
|
|
29
|
-
"@aglyn/shared-data-enums": "1.
|
|
30
|
-
"@aglyn/shared-data-mdi": "1.
|
|
31
|
-
"@aglyn/shared-ui-jsx": "1.
|
|
32
|
-
"@aglyn/shared-ui-next": "1.
|
|
33
|
-
"@aglyn/shared-ui-snackstack": "1.
|
|
34
|
-
"@aglyn/shared-util-email": "1.
|
|
35
|
-
"@aglyn/shared-util-http": "1.
|
|
36
|
-
"@aglyn/shared-util-timestamp": "1.
|
|
37
|
-
"@aglyn/shared-util-tools": "1.
|
|
38
|
-
"@aglyn/tenant-data-admin": "1.
|
|
39
|
-
"@aglyn/tenant-feature-instance": "1.
|
|
40
|
-
"@aglyn/tenant-runtime": "1.
|
|
28
|
+
"@aglyn/aglyn": "1.27.0",
|
|
29
|
+
"@aglyn/shared-data-enums": "1.27.0",
|
|
30
|
+
"@aglyn/shared-data-mdi": "1.27.0",
|
|
31
|
+
"@aglyn/shared-ui-jsx": "1.27.0",
|
|
32
|
+
"@aglyn/shared-ui-next": "1.27.0",
|
|
33
|
+
"@aglyn/shared-ui-snackstack": "1.27.0",
|
|
34
|
+
"@aglyn/shared-util-email": "1.27.0",
|
|
35
|
+
"@aglyn/shared-util-http": "1.27.0",
|
|
36
|
+
"@aglyn/shared-util-timestamp": "1.27.0",
|
|
37
|
+
"@aglyn/shared-util-tools": "1.27.0",
|
|
38
|
+
"@aglyn/tenant-data-admin": "1.27.0",
|
|
39
|
+
"@aglyn/tenant-feature-instance": "1.27.0",
|
|
40
|
+
"@aglyn/tenant-runtime": "1.27.0",
|
|
41
41
|
"@dnd-kit/core": "^6.3.1",
|
|
42
42
|
"@dnd-kit/utilities": "^3.2.2",
|
|
43
43
|
"@swc/helpers": "0.5.24",
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
export declare const NATIVE_CRM_LEAD_STATUSES: string[];
|
|
19
19
|
/** The statuses a lead still needs working in. */
|
|
20
20
|
export declare const NATIVE_CRM_LEAD_OPEN_STATUSES: string[];
|
|
21
|
+
/** The email verdicts a saved view's Email clause may name (`leadQueryClause`, `contactQueryClause`). */
|
|
22
|
+
export declare const NATIVE_EMAIL_STATE_STATUSES: string[];
|
|
23
|
+
/** A lead source's directions, which a saved view's Direction clause may name. */
|
|
24
|
+
export declare const NATIVE_CRM_LEAD_SOURCE_DIRECTIONS: string[];
|
|
21
25
|
/** Every contact lifecycle stage, in order. */
|
|
22
26
|
export declare const NATIVE_CONTACT_LIFECYCLE_STAGES: string[];
|
|
23
27
|
/** Every task kind, in order. */
|
|
@@ -21,8 +21,9 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
|
21
21
|
* shapes the native contracts generator does not translate. Each value here
|
|
22
22
|
* is the same data re-read as plain arrays and maps; nothing in the web
|
|
23
23
|
* apps imports this file, so it adds nothing to their bundles.
|
|
24
|
-
*/ import { CONTACT_LIFECYCLE_STAGES, CRM_ACTIVITY_DIRECTIONS, CRM_ACTIVITY_KINDS, CRM_FIELD_OBJECTS, CRM_LEAD_OPEN_STATUSES, CRM_LEAD_STATUSES, CRM_PICKLIST_DEFINITIONS, CRM_TASK_KINDS } from "@aglyn/aglyn/app-utils/crm";
|
|
24
|
+
*/ import { CONTACT_LIFECYCLE_STAGES, CRM_ACTIVITY_DIRECTIONS, CRM_ACTIVITY_KINDS, CRM_FIELD_OBJECTS, CRM_LEAD_OPEN_STATUSES, CRM_LEAD_SOURCE_DIRECTIONS, CRM_LEAD_STATUSES, CRM_PICKLIST_DEFINITIONS, CRM_TASK_KINDS } from "@aglyn/aglyn/app-utils/crm";
|
|
25
25
|
import { CONTACT_FIELD_DEFAULT_CURRENCY, CONTACT_FIELD_TYPE_LABELS, CONTACT_FIELD_TYPES, currencyFractionDigits } from "@aglyn/aglyn/app-utils/contact-custom-fields";
|
|
26
|
+
import { EMAIL_STATE_STATUSES } from "@aglyn/aglyn/app-utils/email-state";
|
|
26
27
|
import { CRM_REPORT_PERIODS } from "./crm-reports.js";
|
|
27
28
|
import { DEAL_CURRENCIES } from "./deal-board-model.js";
|
|
28
29
|
/** Every lead status, in the console's order. */ export const NATIVE_CRM_LEAD_STATUSES = [
|
|
@@ -31,6 +32,12 @@ import { DEAL_CURRENCIES } from "./deal-board-model.js";
|
|
|
31
32
|
/** The statuses a lead still needs working in. */ export const NATIVE_CRM_LEAD_OPEN_STATUSES = [
|
|
32
33
|
...CRM_LEAD_OPEN_STATUSES
|
|
33
34
|
];
|
|
35
|
+
/** The email verdicts a saved view's Email clause may name (`leadQueryClause`, `contactQueryClause`). */ export const NATIVE_EMAIL_STATE_STATUSES = [
|
|
36
|
+
...EMAIL_STATE_STATUSES
|
|
37
|
+
];
|
|
38
|
+
/** A lead source's directions, which a saved view's Direction clause may name. */ export const NATIVE_CRM_LEAD_SOURCE_DIRECTIONS = [
|
|
39
|
+
...CRM_LEAD_SOURCE_DIRECTIONS
|
|
40
|
+
];
|
|
34
41
|
/** Every contact lifecycle stage, in order. */ export const NATIVE_CONTACT_LIFECYCLE_STAGES = [
|
|
35
42
|
...CONTACT_LIFECYCLE_STAGES
|
|
36
43
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/model/native-vocabulary.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 * THE CRM'S VOCABULARIES, FLAT, FOR THE NATIVE APPS (AGL-3669).\n *\n * The console reads these off `as const` tuples and typed definitions,\n * shapes the native contracts generator does not translate. Each value here\n * is the same data re-read as plain arrays and maps; nothing in the web\n * apps imports this file, so it adds nothing to their bundles.\n */\n\nimport {\n CONTACT_LIFECYCLE_STAGES,\n CRM_ACTIVITY_DIRECTIONS,\n CRM_ACTIVITY_KINDS,\n CRM_FIELD_OBJECTS,\n CRM_LEAD_OPEN_STATUSES,\n CRM_LEAD_STATUSES,\n CRM_PICKLIST_DEFINITIONS,\n CRM_TASK_KINDS,\n} from '@aglyn/aglyn/app-utils/crm'\nimport {\n CONTACT_FIELD_DEFAULT_CURRENCY,\n CONTACT_FIELD_TYPE_LABELS,\n CONTACT_FIELD_TYPES,\n currencyFractionDigits,\n} from '@aglyn/aglyn/app-utils/contact-custom-fields'\nimport { CRM_REPORT_PERIODS } from './crm-reports'\nimport { DEAL_CURRENCIES } from './deal-board-model'\n\n/** Every lead status, in the console's order. */\nexport const NATIVE_CRM_LEAD_STATUSES: string[] = [...CRM_LEAD_STATUSES]\n\n/** The statuses a lead still needs working in. */\nexport const NATIVE_CRM_LEAD_OPEN_STATUSES: string[] = [...CRM_LEAD_OPEN_STATUSES]\n\n/** Every contact lifecycle stage, in order. */\nexport const NATIVE_CONTACT_LIFECYCLE_STAGES: string[] = [...CONTACT_LIFECYCLE_STAGES]\n\n/** Every task kind, in order. */\nexport const NATIVE_CRM_TASK_KINDS: string[] = [...CRM_TASK_KINDS]\n\n/** Every activity kind, in order. */\nexport const NATIVE_CRM_ACTIVITY_KINDS: string[] = [...CRM_ACTIVITY_KINDS]\n\n/**\n * The Material Design glyphs the console's activity timeline draws for the\n * channels that are brands (`KIND_ICONS` in `activity-list`). Neither SF\n * Symbols nor Material Icons carry a brand's mark, so the apps draw these\n * paths through their SVG path icon, and the timeline shows the same marks on\n * every platform. Copied rather than imported, because this module stays pure;\n * `native-vocabulary.spec.ts` holds them to `@aglyn/shared-data-mdi`.\n */\nexport const NATIVE_CRM_ACTIVITY_ICON_PATHS: Record<string, string> = {\n whatsapp:\n 'M12.04 2C6.58 2 2.13 6.45 2.13 11.91C2.13 13.66 2.59 15.36 3.45 16.86L2.05 22L7.3 20.62C8.75 21.41 10.38 21.83 12.04 21.83C17.5 21.83 21.95 17.38 21.95 11.92C21.95 9.27 20.92 6.78 19.05 4.91C17.18 3.03 14.69 2 12.04 2M12.05 3.67C14.25 3.67 16.31 4.53 17.87 6.09C19.42 7.65 20.28 9.72 20.28 11.92C20.28 16.46 16.58 20.15 12.04 20.15C10.56 20.15 9.11 19.76 7.85 19L7.55 18.83L4.43 19.65L5.26 16.61L5.06 16.29C4.24 15 3.8 13.47 3.8 11.91C3.81 7.37 7.5 3.67 12.05 3.67M8.53 7.33C8.37 7.33 8.1 7.39 7.87 7.64C7.65 7.89 7 8.5 7 9.71C7 10.93 7.89 12.1 8 12.27C8.14 12.44 9.76 14.94 12.25 16C12.84 16.27 13.3 16.42 13.66 16.53C14.25 16.72 14.79 16.69 15.22 16.63C15.7 16.56 16.68 16.03 16.89 15.45C17.1 14.87 17.1 14.38 17.04 14.27C16.97 14.17 16.81 14.11 16.56 14C16.31 13.86 15.09 13.26 14.87 13.18C14.64 13.1 14.5 13.06 14.31 13.3C14.15 13.55 13.67 14.11 13.53 14.27C13.38 14.44 13.24 14.46 13 14.34C12.74 14.21 11.94 13.95 11 13.11C10.26 12.45 9.77 11.64 9.62 11.39C9.5 11.15 9.61 11 9.73 10.89C9.84 10.78 10 10.6 10.1 10.45C10.23 10.31 10.27 10.2 10.35 10.04C10.43 9.87 10.39 9.73 10.33 9.61C10.27 9.5 9.77 8.26 9.56 7.77C9.36 7.29 9.16 7.35 9 7.34C8.86 7.34 8.7 7.33 8.53 7.33Z',\n messenger:\n 'M12,2C6.36,2 2,6.13 2,11.7C2,14.61 3.19,17.14 5.14,18.87C5.3,19 5.4,19.22 5.41,19.44L5.46,21.22C5.5,21.79 6.07,22.16 6.59,21.93L8.57,21.06C8.74,21 8.93,20.97 9.1,21C10,21.27 11,21.4 12,21.4C17.64,21.4 22,17.27 22,11.7C22,6.13 17.64,2 12,2M18,9.46L15.07,14.13C14.6,14.86 13.6,15.05 12.9,14.5L10.56,12.77C10.35,12.61 10.05,12.61 9.84,12.77L6.68,15.17C6.26,15.5 5.71,15 6,14.54L8.93,9.87C9.4,9.14 10.4,8.95 11.1,9.47L13.44,11.23C13.66,11.39 13.95,11.39 14.16,11.23L17.32,8.83C17.74,8.5 18.29,9 18,9.46Z',\n instagram:\n 'M7.8,2H16.2C19.4,2 22,4.6 22,7.8V16.2A5.8,5.8 0 0,1 16.2,22H7.8C4.6,22 2,19.4 2,16.2V7.8A5.8,5.8 0 0,1 7.8,2M7.6,4A3.6,3.6 0 0,0 4,7.6V16.4C4,18.39 5.61,20 7.6,20H16.4A3.6,3.6 0 0,0 20,16.4V7.6C20,5.61 18.39,4 16.4,4H7.6M17.25,5.5A1.25,1.25 0 0,1 18.5,6.75A1.25,1.25 0 0,1 17.25,8A1.25,1.25 0 0,1 16,6.75A1.25,1.25 0 0,1 17.25,5.5M12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9Z',\n linkedin:\n 'M19 3A2 2 0 0 1 21 5V19A2 2 0 0 1 19 21H5A2 2 0 0 1 3 19V5A2 2 0 0 1 5 3H19M18.5 18.5V13.2A3.26 3.26 0 0 0 15.24 9.94C14.39 9.94 13.4 10.46 12.92 11.24V10.13H10.13V18.5H12.92V13.57C12.92 12.8 13.54 12.17 14.31 12.17A1.4 1.4 0 0 1 15.71 13.57V18.5H18.5M6.88 8.56A1.68 1.68 0 0 0 8.56 6.88C8.56 5.95 7.81 5.19 6.88 5.19A1.69 1.69 0 0 0 5.19 6.88C5.19 7.81 5.95 8.56 6.88 8.56M8.27 18.5V10.13H5.5V18.5H8.27Z',\n}\n\n/** The objects custom fields are kept for. */\nexport const NATIVE_CRM_FIELD_OBJECTS: string[] = [...CRM_FIELD_OBJECTS]\n\n/** The report periods, in the console's order. */\nexport const NATIVE_CRM_REPORT_PERIODS: string[] = [...CRM_REPORT_PERIODS]\n\n/** The directions an activity of each kind can take. */\nexport const NATIVE_CRM_ACTIVITY_DIRECTIONS: Record<string, string[]> = Object.fromEntries(\n Object.entries(CRM_ACTIVITY_DIRECTIONS).map(([kind, directions]) => [kind, [...(directions ?? [])]]),\n)\n\n/** One picklist as the native pickers start it: its id, label, object and standard labels. */\nexport interface NativeCrmPicklist {\n id: string\n label: string\n object: string\n standardLabels: string[]\n}\n\n/** Every picklist the CRM keeps, with the labels a workspace starts with. */\nexport const NATIVE_CRM_PICKLISTS: NativeCrmPicklist[] = CRM_PICKLIST_DEFINITIONS.map((definition) => ({\n id: definition.id,\n label: definition.label,\n object: definition.object,\n standardLabels: definition.standardValues.map((value) => value.label),\n}))\n\n/** Every custom field type, in the order the console's field drawer lists them (AGL-3971). */\nexport const NATIVE_CRM_FIELD_TYPES: string[] = [...CONTACT_FIELD_TYPES]\n\n/** How each custom field type reads, the console's own words. */\nexport const NATIVE_CRM_FIELD_TYPE_LABELS: Record<string, string> = { ...CONTACT_FIELD_TYPE_LABELS }\n\n/** The currencies a currency field's picker offers: the deal amount picker's list, lowercase ISO 4217. */\nexport const NATIVE_CRM_FIELD_CURRENCIES: string[] = [...DEAL_CURRENCIES]\n\n/** The currency a currency field is in when it names none. */\nexport const NATIVE_CRM_FIELD_DEFAULT_CURRENCY: string = CONTACT_FIELD_DEFAULT_CURRENCY\n\n/**\n * How many decimals each currency's minor unit has where it is not two, as\n * the console's `Intl` reads them (`currencyFractionDigits`): JPY, KRW and\n * VND 0; BHD, KWD and OMR 3. A code not listed has two, as the console's\n * fallback does.\n */\nexport const NATIVE_CURRENCY_FRACTION_DIGITS: Record<string, number> = Object.fromEntries(\n Intl.supportedValuesOf('currency')\n .map((code) => [code.toLowerCase(), currencyFractionDigits(code)] as const)\n .filter(([, digits]) => digits !== 2),\n)\n"],"names":["CONTACT_LIFECYCLE_STAGES","CRM_ACTIVITY_DIRECTIONS","CRM_ACTIVITY_KINDS","CRM_FIELD_OBJECTS","CRM_LEAD_OPEN_STATUSES","CRM_LEAD_STATUSES","CRM_PICKLIST_DEFINITIONS","CRM_TASK_KINDS","CONTACT_FIELD_DEFAULT_CURRENCY","CONTACT_FIELD_TYPE_LABELS","CONTACT_FIELD_TYPES","currencyFractionDigits","CRM_REPORT_PERIODS","DEAL_CURRENCIES","NATIVE_CRM_LEAD_STATUSES","NATIVE_CRM_LEAD_OPEN_STATUSES","NATIVE_CONTACT_LIFECYCLE_STAGES","NATIVE_CRM_TASK_KINDS","NATIVE_CRM_ACTIVITY_KINDS","NATIVE_CRM_ACTIVITY_ICON_PATHS","whatsapp","messenger","instagram","linkedin","NATIVE_CRM_FIELD_OBJECTS","NATIVE_CRM_REPORT_PERIODS","NATIVE_CRM_ACTIVITY_DIRECTIONS","Object","fromEntries","entries","map","kind","directions","NATIVE_CRM_PICKLISTS","definition","id","label","object","standardLabels","standardValues","value","NATIVE_CRM_FIELD_TYPES","NATIVE_CRM_FIELD_TYPE_LABELS","NATIVE_CRM_FIELD_CURRENCIES","NATIVE_CRM_FIELD_DEFAULT_CURRENCY","NATIVE_CURRENCY_FRACTION_DIGITS","Intl","supportedValuesOf","code","toLowerCase","filter","digits"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;CAOC,GAED,SACEA,wBAAwB,EACxBC,uBAAuB,EACvBC,kBAAkB,EAClBC,iBAAiB,EACjBC,sBAAsB,EACtBC,iBAAiB,EACjBC,wBAAwB,EACxBC,cAAc,QACT,6BAA4B;AACnC,SACEC,8BAA8B,EAC9BC,yBAAyB,EACzBC,mBAAmB,EACnBC,sBAAsB,QACjB,+CAA8C;AACrD,SAASC,kBAAkB,QAAQ,mBAAe;AAClD,SAASC,eAAe,QAAQ,wBAAoB;AAEpD,+CAA+C,GAC/C,OAAO,MAAMC,2BAAqC;OAAIT;CAAkB,CAAA;AAExE,gDAAgD,GAChD,OAAO,MAAMU,gCAA0C;OAAIX;CAAuB,CAAA;AAElF,6CAA6C,GAC7C,OAAO,MAAMY,kCAA4C;OAAIhB;CAAyB,CAAA;AAEtF,+BAA+B,GAC/B,OAAO,MAAMiB,wBAAkC;OAAIV;CAAe,CAAA;AAElE,mCAAmC,GACnC,OAAO,MAAMW,4BAAsC;OAAIhB;CAAmB,CAAA;AAE1E;;;;;;;CAOC,GACD,OAAO,MAAMiB,iCAAyD;IACpEC,UACE;IACFC,WACE;IACFC,WACE;IACFC,UACE;AACJ,EAAC;AAED,4CAA4C,GAC5C,OAAO,MAAMC,2BAAqC;OAAIrB;CAAkB,CAAA;AAExE,gDAAgD,GAChD,OAAO,MAAMsB,4BAAsC;OAAIb;CAAmB,CAAA;AAE1E,sDAAsD,GACtD,OAAO,MAAMc,iCAA2DC,OAAOC,WAAW,CACxFD,OAAOE,OAAO,CAAC5B,yBAAyB6B,GAAG,CAAC,CAAC,CAACC,MAAMC,WAAW,GAAK;QAACD;QAAM;eAAKC,qBAAAA,aAAc,EAAE;SAAE;KAAC,GACpG;AAUD,2EAA2E,GAC3E,OAAO,MAAMC,uBAA4C3B,yBAAyBwB,GAAG,CAAC,CAACI,aAAgB,CAAA;QACrGC,IAAID,WAAWC,EAAE;QACjBC,OAAOF,WAAWE,KAAK;QACvBC,QAAQH,WAAWG,MAAM;QACzBC,gBAAgBJ,WAAWK,cAAc,CAACT,GAAG,CAAC,CAACU,QAAUA,MAAMJ,KAAK;IACtE,CAAA,GAAG;AAEH,4FAA4F,GAC5F,OAAO,MAAMK,yBAAmC;OAAI/B;CAAoB,CAAA;AAExE,+DAA+D,GAC/D,OAAO,MAAMgC,+BAAuD,aAAKjC,2BAA2B;AAEpG,wGAAwG,GACxG,OAAO,MAAMkC,8BAAwC;OAAI9B;CAAgB,CAAA;AAEzE,4DAA4D,GAC5D,OAAO,MAAM+B,oCAA4CpC,+BAA8B;AAEvF;;;;;CAKC,GACD,OAAO,MAAMqC,kCAA0DlB,OAAOC,WAAW,CACvFkB,KAAKC,iBAAiB,CAAC,YACpBjB,GAAG,CAAC,CAACkB,OAAS;QAACA,KAAKC,WAAW;QAAItC,uBAAuBqC;KAAM,EAChEE,MAAM,CAAC,CAAC,GAAGC,OAAO,GAAKA,WAAW,IACtC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/crm/src/lib/model/native-vocabulary.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 * THE CRM'S VOCABULARIES, FLAT, FOR THE NATIVE APPS (AGL-3669).\n *\n * The console reads these off `as const` tuples and typed definitions,\n * shapes the native contracts generator does not translate. Each value here\n * is the same data re-read as plain arrays and maps; nothing in the web\n * apps imports this file, so it adds nothing to their bundles.\n */\n\nimport {\n CONTACT_LIFECYCLE_STAGES,\n CRM_ACTIVITY_DIRECTIONS,\n CRM_ACTIVITY_KINDS,\n CRM_FIELD_OBJECTS,\n CRM_LEAD_OPEN_STATUSES,\n CRM_LEAD_SOURCE_DIRECTIONS,\n CRM_LEAD_STATUSES,\n CRM_PICKLIST_DEFINITIONS,\n CRM_TASK_KINDS,\n} from '@aglyn/aglyn/app-utils/crm'\nimport {\n CONTACT_FIELD_DEFAULT_CURRENCY,\n CONTACT_FIELD_TYPE_LABELS,\n CONTACT_FIELD_TYPES,\n currencyFractionDigits,\n} from '@aglyn/aglyn/app-utils/contact-custom-fields'\nimport { EMAIL_STATE_STATUSES } from '@aglyn/aglyn/app-utils/email-state'\nimport { CRM_REPORT_PERIODS } from './crm-reports'\nimport { DEAL_CURRENCIES } from './deal-board-model'\n\n/** Every lead status, in the console's order. */\nexport const NATIVE_CRM_LEAD_STATUSES: string[] = [...CRM_LEAD_STATUSES]\n\n/** The statuses a lead still needs working in. */\nexport const NATIVE_CRM_LEAD_OPEN_STATUSES: string[] = [...CRM_LEAD_OPEN_STATUSES]\n/** The email verdicts a saved view's Email clause may name (`leadQueryClause`, `contactQueryClause`). */\nexport const NATIVE_EMAIL_STATE_STATUSES: string[] = [...EMAIL_STATE_STATUSES]\n/** A lead source's directions, which a saved view's Direction clause may name. */\nexport const NATIVE_CRM_LEAD_SOURCE_DIRECTIONS: string[] = [...CRM_LEAD_SOURCE_DIRECTIONS]\n\n/** Every contact lifecycle stage, in order. */\nexport const NATIVE_CONTACT_LIFECYCLE_STAGES: string[] = [...CONTACT_LIFECYCLE_STAGES]\n\n/** Every task kind, in order. */\nexport const NATIVE_CRM_TASK_KINDS: string[] = [...CRM_TASK_KINDS]\n\n/** Every activity kind, in order. */\nexport const NATIVE_CRM_ACTIVITY_KINDS: string[] = [...CRM_ACTIVITY_KINDS]\n\n/**\n * The Material Design glyphs the console's activity timeline draws for the\n * channels that are brands (`KIND_ICONS` in `activity-list`). Neither SF\n * Symbols nor Material Icons carry a brand's mark, so the apps draw these\n * paths through their SVG path icon, and the timeline shows the same marks on\n * every platform. Copied rather than imported, because this module stays pure;\n * `native-vocabulary.spec.ts` holds them to `@aglyn/shared-data-mdi`.\n */\nexport const NATIVE_CRM_ACTIVITY_ICON_PATHS: Record<string, string> = {\n whatsapp:\n 'M12.04 2C6.58 2 2.13 6.45 2.13 11.91C2.13 13.66 2.59 15.36 3.45 16.86L2.05 22L7.3 20.62C8.75 21.41 10.38 21.83 12.04 21.83C17.5 21.83 21.95 17.38 21.95 11.92C21.95 9.27 20.92 6.78 19.05 4.91C17.18 3.03 14.69 2 12.04 2M12.05 3.67C14.25 3.67 16.31 4.53 17.87 6.09C19.42 7.65 20.28 9.72 20.28 11.92C20.28 16.46 16.58 20.15 12.04 20.15C10.56 20.15 9.11 19.76 7.85 19L7.55 18.83L4.43 19.65L5.26 16.61L5.06 16.29C4.24 15 3.8 13.47 3.8 11.91C3.81 7.37 7.5 3.67 12.05 3.67M8.53 7.33C8.37 7.33 8.1 7.39 7.87 7.64C7.65 7.89 7 8.5 7 9.71C7 10.93 7.89 12.1 8 12.27C8.14 12.44 9.76 14.94 12.25 16C12.84 16.27 13.3 16.42 13.66 16.53C14.25 16.72 14.79 16.69 15.22 16.63C15.7 16.56 16.68 16.03 16.89 15.45C17.1 14.87 17.1 14.38 17.04 14.27C16.97 14.17 16.81 14.11 16.56 14C16.31 13.86 15.09 13.26 14.87 13.18C14.64 13.1 14.5 13.06 14.31 13.3C14.15 13.55 13.67 14.11 13.53 14.27C13.38 14.44 13.24 14.46 13 14.34C12.74 14.21 11.94 13.95 11 13.11C10.26 12.45 9.77 11.64 9.62 11.39C9.5 11.15 9.61 11 9.73 10.89C9.84 10.78 10 10.6 10.1 10.45C10.23 10.31 10.27 10.2 10.35 10.04C10.43 9.87 10.39 9.73 10.33 9.61C10.27 9.5 9.77 8.26 9.56 7.77C9.36 7.29 9.16 7.35 9 7.34C8.86 7.34 8.7 7.33 8.53 7.33Z',\n messenger:\n 'M12,2C6.36,2 2,6.13 2,11.7C2,14.61 3.19,17.14 5.14,18.87C5.3,19 5.4,19.22 5.41,19.44L5.46,21.22C5.5,21.79 6.07,22.16 6.59,21.93L8.57,21.06C8.74,21 8.93,20.97 9.1,21C10,21.27 11,21.4 12,21.4C17.64,21.4 22,17.27 22,11.7C22,6.13 17.64,2 12,2M18,9.46L15.07,14.13C14.6,14.86 13.6,15.05 12.9,14.5L10.56,12.77C10.35,12.61 10.05,12.61 9.84,12.77L6.68,15.17C6.26,15.5 5.71,15 6,14.54L8.93,9.87C9.4,9.14 10.4,8.95 11.1,9.47L13.44,11.23C13.66,11.39 13.95,11.39 14.16,11.23L17.32,8.83C17.74,8.5 18.29,9 18,9.46Z',\n instagram:\n 'M7.8,2H16.2C19.4,2 22,4.6 22,7.8V16.2A5.8,5.8 0 0,1 16.2,22H7.8C4.6,22 2,19.4 2,16.2V7.8A5.8,5.8 0 0,1 7.8,2M7.6,4A3.6,3.6 0 0,0 4,7.6V16.4C4,18.39 5.61,20 7.6,20H16.4A3.6,3.6 0 0,0 20,16.4V7.6C20,5.61 18.39,4 16.4,4H7.6M17.25,5.5A1.25,1.25 0 0,1 18.5,6.75A1.25,1.25 0 0,1 17.25,8A1.25,1.25 0 0,1 16,6.75A1.25,1.25 0 0,1 17.25,5.5M12,7A5,5 0 0,1 17,12A5,5 0 0,1 12,17A5,5 0 0,1 7,12A5,5 0 0,1 12,7M12,9A3,3 0 0,0 9,12A3,3 0 0,0 12,15A3,3 0 0,0 15,12A3,3 0 0,0 12,9Z',\n linkedin:\n 'M19 3A2 2 0 0 1 21 5V19A2 2 0 0 1 19 21H5A2 2 0 0 1 3 19V5A2 2 0 0 1 5 3H19M18.5 18.5V13.2A3.26 3.26 0 0 0 15.24 9.94C14.39 9.94 13.4 10.46 12.92 11.24V10.13H10.13V18.5H12.92V13.57C12.92 12.8 13.54 12.17 14.31 12.17A1.4 1.4 0 0 1 15.71 13.57V18.5H18.5M6.88 8.56A1.68 1.68 0 0 0 8.56 6.88C8.56 5.95 7.81 5.19 6.88 5.19A1.69 1.69 0 0 0 5.19 6.88C5.19 7.81 5.95 8.56 6.88 8.56M8.27 18.5V10.13H5.5V18.5H8.27Z',\n}\n\n/** The objects custom fields are kept for. */\nexport const NATIVE_CRM_FIELD_OBJECTS: string[] = [...CRM_FIELD_OBJECTS]\n\n/** The report periods, in the console's order. */\nexport const NATIVE_CRM_REPORT_PERIODS: string[] = [...CRM_REPORT_PERIODS]\n\n/** The directions an activity of each kind can take. */\nexport const NATIVE_CRM_ACTIVITY_DIRECTIONS: Record<string, string[]> = Object.fromEntries(\n Object.entries(CRM_ACTIVITY_DIRECTIONS).map(([kind, directions]) => [kind, [...(directions ?? [])]]),\n)\n\n/** One picklist as the native pickers start it: its id, label, object and standard labels. */\nexport interface NativeCrmPicklist {\n id: string\n label: string\n object: string\n standardLabels: string[]\n}\n\n/** Every picklist the CRM keeps, with the labels a workspace starts with. */\nexport const NATIVE_CRM_PICKLISTS: NativeCrmPicklist[] = CRM_PICKLIST_DEFINITIONS.map((definition) => ({\n id: definition.id,\n label: definition.label,\n object: definition.object,\n standardLabels: definition.standardValues.map((value) => value.label),\n}))\n\n/** Every custom field type, in the order the console's field drawer lists them (AGL-3971). */\nexport const NATIVE_CRM_FIELD_TYPES: string[] = [...CONTACT_FIELD_TYPES]\n\n/** How each custom field type reads, the console's own words. */\nexport const NATIVE_CRM_FIELD_TYPE_LABELS: Record<string, string> = { ...CONTACT_FIELD_TYPE_LABELS }\n\n/** The currencies a currency field's picker offers: the deal amount picker's list, lowercase ISO 4217. */\nexport const NATIVE_CRM_FIELD_CURRENCIES: string[] = [...DEAL_CURRENCIES]\n\n/** The currency a currency field is in when it names none. */\nexport const NATIVE_CRM_FIELD_DEFAULT_CURRENCY: string = CONTACT_FIELD_DEFAULT_CURRENCY\n\n/**\n * How many decimals each currency's minor unit has where it is not two, as\n * the console's `Intl` reads them (`currencyFractionDigits`): JPY, KRW and\n * VND 0; BHD, KWD and OMR 3. A code not listed has two, as the console's\n * fallback does.\n */\nexport const NATIVE_CURRENCY_FRACTION_DIGITS: Record<string, number> = Object.fromEntries(\n Intl.supportedValuesOf('currency')\n .map((code) => [code.toLowerCase(), currencyFractionDigits(code)] as const)\n .filter(([, digits]) => digits !== 2),\n)\n"],"names":["CONTACT_LIFECYCLE_STAGES","CRM_ACTIVITY_DIRECTIONS","CRM_ACTIVITY_KINDS","CRM_FIELD_OBJECTS","CRM_LEAD_OPEN_STATUSES","CRM_LEAD_SOURCE_DIRECTIONS","CRM_LEAD_STATUSES","CRM_PICKLIST_DEFINITIONS","CRM_TASK_KINDS","CONTACT_FIELD_DEFAULT_CURRENCY","CONTACT_FIELD_TYPE_LABELS","CONTACT_FIELD_TYPES","currencyFractionDigits","EMAIL_STATE_STATUSES","CRM_REPORT_PERIODS","DEAL_CURRENCIES","NATIVE_CRM_LEAD_STATUSES","NATIVE_CRM_LEAD_OPEN_STATUSES","NATIVE_EMAIL_STATE_STATUSES","NATIVE_CRM_LEAD_SOURCE_DIRECTIONS","NATIVE_CONTACT_LIFECYCLE_STAGES","NATIVE_CRM_TASK_KINDS","NATIVE_CRM_ACTIVITY_KINDS","NATIVE_CRM_ACTIVITY_ICON_PATHS","whatsapp","messenger","instagram","linkedin","NATIVE_CRM_FIELD_OBJECTS","NATIVE_CRM_REPORT_PERIODS","NATIVE_CRM_ACTIVITY_DIRECTIONS","Object","fromEntries","entries","map","kind","directions","NATIVE_CRM_PICKLISTS","definition","id","label","object","standardLabels","standardValues","value","NATIVE_CRM_FIELD_TYPES","NATIVE_CRM_FIELD_TYPE_LABELS","NATIVE_CRM_FIELD_CURRENCIES","NATIVE_CRM_FIELD_DEFAULT_CURRENCY","NATIVE_CURRENCY_FRACTION_DIGITS","Intl","supportedValuesOf","code","toLowerCase","filter","digits"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;CAOC,GAED,SACEA,wBAAwB,EACxBC,uBAAuB,EACvBC,kBAAkB,EAClBC,iBAAiB,EACjBC,sBAAsB,EACtBC,0BAA0B,EAC1BC,iBAAiB,EACjBC,wBAAwB,EACxBC,cAAc,QACT,6BAA4B;AACnC,SACEC,8BAA8B,EAC9BC,yBAAyB,EACzBC,mBAAmB,EACnBC,sBAAsB,QACjB,+CAA8C;AACrD,SAASC,oBAAoB,QAAQ,qCAAoC;AACzE,SAASC,kBAAkB,QAAQ,mBAAe;AAClD,SAASC,eAAe,QAAQ,wBAAoB;AAEpD,+CAA+C,GAC/C,OAAO,MAAMC,2BAAqC;OAAIV;CAAkB,CAAA;AAExE,gDAAgD,GAChD,OAAO,MAAMW,gCAA0C;OAAIb;CAAuB,CAAA;AAClF,uGAAuG,GACvG,OAAO,MAAMc,8BAAwC;OAAIL;CAAqB,CAAA;AAC9E,gFAAgF,GAChF,OAAO,MAAMM,oCAA8C;OAAId;CAA2B,CAAA;AAE1F,6CAA6C,GAC7C,OAAO,MAAMe,kCAA4C;OAAIpB;CAAyB,CAAA;AAEtF,+BAA+B,GAC/B,OAAO,MAAMqB,wBAAkC;OAAIb;CAAe,CAAA;AAElE,mCAAmC,GACnC,OAAO,MAAMc,4BAAsC;OAAIpB;CAAmB,CAAA;AAE1E;;;;;;;CAOC,GACD,OAAO,MAAMqB,iCAAyD;IACpEC,UACE;IACFC,WACE;IACFC,WACE;IACFC,UACE;AACJ,EAAC;AAED,4CAA4C,GAC5C,OAAO,MAAMC,2BAAqC;OAAIzB;CAAkB,CAAA;AAExE,gDAAgD,GAChD,OAAO,MAAM0B,4BAAsC;OAAIf;CAAmB,CAAA;AAE1E,sDAAsD,GACtD,OAAO,MAAMgB,iCAA2DC,OAAOC,WAAW,CACxFD,OAAOE,OAAO,CAAChC,yBAAyBiC,GAAG,CAAC,CAAC,CAACC,MAAMC,WAAW,GAAK;QAACD;QAAM;eAAKC,qBAAAA,aAAc,EAAE;SAAE;KAAC,GACpG;AAUD,2EAA2E,GAC3E,OAAO,MAAMC,uBAA4C9B,yBAAyB2B,GAAG,CAAC,CAACI,aAAgB,CAAA;QACrGC,IAAID,WAAWC,EAAE;QACjBC,OAAOF,WAAWE,KAAK;QACvBC,QAAQH,WAAWG,MAAM;QACzBC,gBAAgBJ,WAAWK,cAAc,CAACT,GAAG,CAAC,CAACU,QAAUA,MAAMJ,KAAK;IACtE,CAAA,GAAG;AAEH,4FAA4F,GAC5F,OAAO,MAAMK,yBAAmC;OAAIlC;CAAoB,CAAA;AAExE,+DAA+D,GAC/D,OAAO,MAAMmC,+BAAuD,aAAKpC,2BAA2B;AAEpG,wGAAwG,GACxG,OAAO,MAAMqC,8BAAwC;OAAIhC;CAAgB,CAAA;AAEzE,4DAA4D,GAC5D,OAAO,MAAMiC,oCAA4CvC,+BAA8B;AAEvF;;;;;CAKC,GACD,OAAO,MAAMwC,kCAA0DlB,OAAOC,WAAW,CACvFkB,KAAKC,iBAAiB,CAAC,YACpBjB,GAAG,CAAC,CAACkB,OAAS;QAACA,KAAKC,WAAW;QAAIzC,uBAAuBwC;KAAM,EAChEE,MAAM,CAAC,CAAC,GAAGC,OAAO,GAAKA,WAAW,IACtC"}
|
package/src/lib/native-nav.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
1
2
|
/**
|
|
2
3
|
* @license
|
|
3
4
|
* Copyright 2026 Aglyn LLC
|
|
@@ -26,12 +27,17 @@
|
|
|
26
27
|
* (`orgNavItems`, `/[orgSlug]/crm`), the site's the site's hub; both list
|
|
27
28
|
* the same sections under the same ids.
|
|
28
29
|
*/ function row(scope, order) {
|
|
29
|
-
return {
|
|
30
|
+
return _extends({
|
|
30
31
|
id: 'crm',
|
|
31
32
|
label: 'CRM',
|
|
32
33
|
icon: nativeNavIcon('person.text.rectangle', 'contact_mail'),
|
|
33
34
|
screen: 'crm.contacts',
|
|
34
|
-
pluginId: 'crm'
|
|
35
|
+
pluginId: 'crm'
|
|
36
|
+
}, scope === 'org' ? {
|
|
37
|
+
permissions: [
|
|
38
|
+
'data.manage'
|
|
39
|
+
]
|
|
40
|
+
} : {}, {
|
|
35
41
|
order,
|
|
36
42
|
keywords: [
|
|
37
43
|
'contacts',
|
|
@@ -51,7 +57,7 @@
|
|
|
51
57
|
],
|
|
52
58
|
docs: scope === 'org' ? '/content-and-data/crm/overview#at-the-organization-level' : '/content-and-data/crm/overview',
|
|
53
59
|
console: nativeNavRef(scope === 'org' ? 'orgPluginTab' : 'hostPluginTab', '/crm')
|
|
54
|
-
};
|
|
60
|
+
});
|
|
55
61
|
}
|
|
56
62
|
export const NATIVE_NAV_ROWS = [
|
|
57
63
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/plugins/crm/src/lib/native-nav.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\nimport {\n type NativeNavContribution,\n type NativeNavCreateContribution,\n type NativeNavRow,\n nativeNavHubSection,\n nativeNavIcon,\n nativeNavRef,\n} from '@aglyn/aglyn/app-utils/native-nav'\n\n/**\n * The CRM in the native apps' navigation (AGL-3943): the rows this plugin\n * adds to the manifest the shells draw, placed into the core's lists by\n * `order` (`assembleNativeNav`, `generate:native-contracts`). Labels are the\n * console's words, held by `apps/console/specs/native-nav-manifest.spec.ts`.\n *\n * Imports only the core's plain nav module, so the native contracts read it.\n */\n\n/**\n * The row at either scope. The workspace's opens the console's org page\n * (`orgNavItems`, `/[orgSlug]/crm`), the site's the site's hub; both list\n * the same sections under the same ids.\n */\nfunction row(scope: 'org' | 'host', order: number): NativeNavRow {\n return {\n id: 'crm',\n label: 'CRM',\n icon: nativeNavIcon('person.text.rectangle', 'contact_mail'),\n screen: 'crm.contacts',\n pluginId: 'crm',\n order,\n keywords: ['contacts', 'people', 'deals', 'tasks'],\n sections: [\n nativeNavHubSection(scope, '/crm', 'contacts', 'Contacts', 'crm.contacts'),\n nativeNavHubSection(scope, '/crm', 'leads', 'Leads', 'crm.leads'),\n nativeNavHubSection(scope, '/crm', 'companies', 'Companies', 'crm.companies'),\n nativeNavHubSection(scope, '/crm', 'deals', 'Deals / Opportunities', 'crm.deals'),\n nativeNavHubSection(scope, '/crm', 'tasks', 'Tasks', 'crm.tasks'),\n nativeNavHubSection(scope, '/crm', 'reports', 'Reports', 'crm.reports'),\n nativeNavHubSection(scope, '/crm', 'fields', 'Fields', 'crm.fields'),\n nativeNavHubSection(scope, '/crm', 'settings', 'Settings', 'crm.settings'),\n ],\n docs: scope === 'org' ? '/content-and-data/crm/overview#at-the-organization-level' : '/content-and-data/crm/overview',\n console: nativeNavRef(scope === 'org' ? 'orgPluginTab' : 'hostPluginTab', '/crm'),\n }\n}\n\nexport const NATIVE_NAV_ROWS: readonly NativeNavContribution[] = [\n { list: 'workspace', group: 'workspace', row: row('org', 20) },\n { list: 'site', group: 'customers', row: row('host', 20) },\n]\n\n/** A contact, at either scope: the console's \"New contact\" on the CRM's Contacts. */\nfunction contact(scope: 'org' | 'host', order: number): NativeNavCreateContribution['item'] {\n return {\n id: 'contact',\n label: 'Contact',\n icon: nativeNavIcon('person.badge.plus', 'person_add'),\n screen: 'crm.contacts',\n params: { new: '1' },\n pluginId: 'crm',\n permission: 'data.manage',\n planFeature: 'crm',\n order,\n console: nativeNavRef(scope === 'org' ? 'orgPluginSection' : 'hostPluginSection', '/crm/contacts'),\n }\n}\n\nexport const NATIVE_NAV_CREATE: readonly NativeNavCreateContribution[] = [\n { scope: 'workspace', item: contact('org', 20) },\n { scope: 'site', item: contact('host', 70) },\n]\n"],"names":["nativeNavHubSection","nativeNavIcon","nativeNavRef","row","scope","order","id","label","icon","screen","pluginId","keywords","sections","docs","console","NATIVE_NAV_ROWS","list","group","contact","params","new","permission","planFeature","NATIVE_NAV_CREATE","item"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAIEA,mBAAmB,EACnBC,aAAa,EACbC,YAAY,QACP,oCAAmC;AAE1C;;;;;;;CAOC,GAED;;;;CAIC,GACD,SAASC,IAAIC,KAAqB,EAAEC,KAAa;IAC/C,OAAO;QACLC,IAAI;QACJC,OAAO;QACPC,MAAMP,cAAc,yBAAyB;QAC7CQ,QAAQ;QACRC,UAAU;
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/plugins/crm/src/lib/native-nav.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\nimport {\n type NativeNavContribution,\n type NativeNavCreateContribution,\n type NativeNavRow,\n nativeNavHubSection,\n nativeNavIcon,\n nativeNavRef,\n} from '@aglyn/aglyn/app-utils/native-nav'\n\n/**\n * The CRM in the native apps' navigation (AGL-3943): the rows this plugin\n * adds to the manifest the shells draw, placed into the core's lists by\n * `order` (`assembleNativeNav`, `generate:native-contracts`). Labels are the\n * console's words, held by `apps/console/specs/native-nav-manifest.spec.ts`.\n *\n * Imports only the core's plain nav module, so the native contracts read it.\n */\n\n/**\n * The row at either scope. The workspace's opens the console's org page\n * (`orgNavItems`, `/[orgSlug]/crm`), the site's the site's hub; both list\n * the same sections under the same ids.\n */\nfunction row(scope: 'org' | 'host', order: number): NativeNavRow {\n return {\n id: 'crm',\n label: 'CRM',\n icon: nativeNavIcon('person.text.rectangle', 'contact_mail'),\n screen: 'crm.contacts',\n pluginId: 'crm',\n // The org tab strip asks the extension's permission (plugin.ts).\n ...(scope === 'org' ? { permissions: ['data.manage'] } : {}),\n order,\n keywords: ['contacts', 'people', 'deals', 'tasks'],\n sections: [\n nativeNavHubSection(scope, '/crm', 'contacts', 'Contacts', 'crm.contacts'),\n nativeNavHubSection(scope, '/crm', 'leads', 'Leads', 'crm.leads'),\n nativeNavHubSection(scope, '/crm', 'companies', 'Companies', 'crm.companies'),\n nativeNavHubSection(scope, '/crm', 'deals', 'Deals / Opportunities', 'crm.deals'),\n nativeNavHubSection(scope, '/crm', 'tasks', 'Tasks', 'crm.tasks'),\n nativeNavHubSection(scope, '/crm', 'reports', 'Reports', 'crm.reports'),\n nativeNavHubSection(scope, '/crm', 'fields', 'Fields', 'crm.fields'),\n nativeNavHubSection(scope, '/crm', 'settings', 'Settings', 'crm.settings'),\n ],\n docs: scope === 'org' ? '/content-and-data/crm/overview#at-the-organization-level' : '/content-and-data/crm/overview',\n console: nativeNavRef(scope === 'org' ? 'orgPluginTab' : 'hostPluginTab', '/crm'),\n }\n}\n\nexport const NATIVE_NAV_ROWS: readonly NativeNavContribution[] = [\n { list: 'workspace', group: 'workspace', row: row('org', 20) },\n { list: 'site', group: 'customers', row: row('host', 20) },\n]\n\n/** A contact, at either scope: the console's \"New contact\" on the CRM's Contacts. */\nfunction contact(scope: 'org' | 'host', order: number): NativeNavCreateContribution['item'] {\n return {\n id: 'contact',\n label: 'Contact',\n icon: nativeNavIcon('person.badge.plus', 'person_add'),\n screen: 'crm.contacts',\n params: { new: '1' },\n pluginId: 'crm',\n permission: 'data.manage',\n planFeature: 'crm',\n order,\n console: nativeNavRef(scope === 'org' ? 'orgPluginSection' : 'hostPluginSection', '/crm/contacts'),\n }\n}\n\nexport const NATIVE_NAV_CREATE: readonly NativeNavCreateContribution[] = [\n { scope: 'workspace', item: contact('org', 20) },\n { scope: 'site', item: contact('host', 70) },\n]\n"],"names":["nativeNavHubSection","nativeNavIcon","nativeNavRef","row","scope","order","id","label","icon","screen","pluginId","permissions","keywords","sections","docs","console","NATIVE_NAV_ROWS","list","group","contact","params","new","permission","planFeature","NATIVE_NAV_CREATE","item"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAIEA,mBAAmB,EACnBC,aAAa,EACbC,YAAY,QACP,oCAAmC;AAE1C;;;;;;;CAOC,GAED;;;;CAIC,GACD,SAASC,IAAIC,KAAqB,EAAEC,KAAa;IAC/C,OAAO;QACLC,IAAI;QACJC,OAAO;QACPC,MAAMP,cAAc,yBAAyB;QAC7CQ,QAAQ;QACRC,UAAU;OAENN,UAAU,QAAQ;QAAEO,aAAa;YAAC;SAAc;IAAC,IAAI,CAAC;QAC1DN;QACAO,UAAU;YAAC;YAAY;YAAU;YAAS;SAAQ;QAClDC,UAAU;YACRb,oBAAoBI,OAAO,QAAQ,YAAY,YAAY;YAC3DJ,oBAAoBI,OAAO,QAAQ,SAAS,SAAS;YACrDJ,oBAAoBI,OAAO,QAAQ,aAAa,aAAa;YAC7DJ,oBAAoBI,OAAO,QAAQ,SAAS,yBAAyB;YACrEJ,oBAAoBI,OAAO,QAAQ,SAAS,SAAS;YACrDJ,oBAAoBI,OAAO,QAAQ,WAAW,WAAW;YACzDJ,oBAAoBI,OAAO,QAAQ,UAAU,UAAU;YACvDJ,oBAAoBI,OAAO,QAAQ,YAAY,YAAY;SAC5D;QACDU,MAAMV,UAAU,QAAQ,6DAA6D;QACrFW,SAASb,aAAaE,UAAU,QAAQ,iBAAiB,iBAAiB;;AAE9E;AAEA,OAAO,MAAMY,kBAAoD;IAC/D;QAAEC,MAAM;QAAaC,OAAO;QAAaf,KAAKA,IAAI,OAAO;IAAI;IAC7D;QAAEc,MAAM;QAAQC,OAAO;QAAaf,KAAKA,IAAI,QAAQ;IAAI;CAC1D,CAAA;AAED,mFAAmF,GACnF,SAASgB,QAAQf,KAAqB,EAAEC,KAAa;IACnD,OAAO;QACLC,IAAI;QACJC,OAAO;QACPC,MAAMP,cAAc,qBAAqB;QACzCQ,QAAQ;QACRW,QAAQ;YAAEC,KAAK;QAAI;QACnBX,UAAU;QACVY,YAAY;QACZC,aAAa;QACblB;QACAU,SAASb,aAAaE,UAAU,QAAQ,qBAAqB,qBAAqB;IACpF;AACF;AAEA,OAAO,MAAMoB,oBAA4D;IACvE;QAAEpB,OAAO;QAAaqB,MAAMN,QAAQ,OAAO;IAAI;IAC/C;QAAEf,OAAO;QAAQqB,MAAMN,QAAQ,QAAQ;IAAI;CAC5C,CAAA"}
|
|
@@ -17,7 +17,7 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
|
17
17
|
*/ import { nameSearchFields } from "@aglyn/aglyn/app-utils/name-search";
|
|
18
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
|
-
import { claimWrite, orgOwnsHost, paginate, readJsonBody, requireScope, serialize } from "@aglyn/tenant-data-admin/server/api-v1-kit";
|
|
20
|
+
import { admitNamedSite, 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.
|
|
22
22
|
import { scheduleCapturedEmailCheck } from "@aglyn/tenant-data-admin/server/capture-email-check";
|
|
23
23
|
// The leaf, not the barrel: the console's API specs substitute the barrel
|
|
@@ -650,12 +650,27 @@ function readContactInput(body, { partial }) {
|
|
|
650
650
|
link
|
|
651
651
|
};
|
|
652
652
|
}
|
|
653
|
+
/**
|
|
654
|
+
* The site a contact call names through `consentSiteId`, admitted the way
|
|
655
|
+
* the site router admits one in its path (AGL-4235, `admitNamedSite`): after
|
|
656
|
+
* the workspace-ownership check each caller already makes, a connected app
|
|
657
|
+
* whose person is not on the site hears `404 No such site`, and the site's
|
|
658
|
+
* own lock decides by the request's method. `null` to proceed.
|
|
659
|
+
*
|
|
660
|
+
* Asked of the writes too, though the contact itself is the workspace's:
|
|
661
|
+
* the console records a site as where consent was given only for a person
|
|
662
|
+
* whose access reaches that site (`crm/contacts-create`,
|
|
663
|
+
* `crm/contact-update`), so an app may not record one its person could not.
|
|
664
|
+
*/ async function consentSiteRefusal(ctx, request, siteId) {
|
|
665
|
+
const admitted = await admitNamedSite(ctx, request, siteId);
|
|
666
|
+
return 'snapshot' in admitted ? null : admitted;
|
|
667
|
+
}
|
|
653
668
|
/**
|
|
654
669
|
* The holder a contact READ is for, from `?consentSiteId=`: that site's
|
|
655
670
|
* consent group, or `null` for the union view. The parameter the writes take,
|
|
656
671
|
* validated the same way, so a client has one name for "which site" on every
|
|
657
|
-
* contact call.
|
|
658
|
-
*/ function contactViewGroup(ctx, url) {
|
|
672
|
+
* contact call — and admitted the same way ({@link consentSiteRefusal}).
|
|
673
|
+
*/ async function contactViewGroup(ctx, request, url) {
|
|
659
674
|
var _url_searchParams_get;
|
|
660
675
|
const siteId = ((_url_searchParams_get = url.searchParams.get('consentSiteId')) != null ? _url_searchParams_get : '').trim();
|
|
661
676
|
if (!siteId) return {
|
|
@@ -673,6 +688,10 @@ function readContactInput(body, { partial }) {
|
|
|
673
688
|
})
|
|
674
689
|
};
|
|
675
690
|
}
|
|
691
|
+
const refused = await consentSiteRefusal(ctx, request, siteId);
|
|
692
|
+
if (refused) return {
|
|
693
|
+
response: refused
|
|
694
|
+
};
|
|
676
695
|
return {
|
|
677
696
|
groupId: consentGroupForHost(ctx.org, siteId).groupId
|
|
678
697
|
};
|
|
@@ -761,6 +780,10 @@ const contactsCollection = (ctx)=>ctx.firestore.collection('orgs').doc(ctx.orgId
|
|
|
761
780
|
headers: ctx.headers
|
|
762
781
|
});
|
|
763
782
|
}
|
|
783
|
+
if (consentSiteId) {
|
|
784
|
+
const refused = await consentSiteRefusal(ctx, request, consentSiteId);
|
|
785
|
+
if (refused) return refused;
|
|
786
|
+
}
|
|
764
787
|
/*
|
|
765
788
|
* Who may see the new contact: the whole org, unless the org keeps each
|
|
766
789
|
* site's records apart — then the named site's group, and a contact named
|
|
@@ -953,6 +976,10 @@ const contactsCollection = (ctx)=>ctx.firestore.collection('orgs').doc(ctx.orgId
|
|
|
953
976
|
headers: ctx.headers
|
|
954
977
|
});
|
|
955
978
|
}
|
|
979
|
+
if (consentSiteId) {
|
|
980
|
+
const refused = await consentSiteRefusal(ctx, request, consentSiteId);
|
|
981
|
+
if (refused) return refused;
|
|
982
|
+
}
|
|
956
983
|
const crmErrors = await contactCrmRefErrors(ctx, crm, {
|
|
957
984
|
contactId: contactRef.id,
|
|
958
985
|
siteId: consentSiteId,
|
|
@@ -1157,7 +1184,7 @@ const contactsCollection = (ctx)=>ctx.firestore.collection('orgs').doc(ctx.orgId
|
|
|
1157
1184
|
* therefore come back empty with `has_more` false, which is the short-page
|
|
1158
1185
|
* case `conventions.md` already tells clients to expect and which
|
|
1159
1186
|
* `?channel=online` on orders already produces.
|
|
1160
|
-
*/ async function listContacts(ctx, collection, url) {
|
|
1187
|
+
*/ async function listContacts(request, ctx, collection, url) {
|
|
1161
1188
|
var _url_searchParams_get, _url_searchParams_get1, _url_searchParams_get2;
|
|
1162
1189
|
const rawEmail = url.searchParams.get('email');
|
|
1163
1190
|
let email = null;
|
|
@@ -1203,7 +1230,7 @@ const contactsCollection = (ctx)=>ctx.firestore.collection('orgs').doc(ctx.orgId
|
|
|
1203
1230
|
const lifecycleStage = rawStage || null;
|
|
1204
1231
|
const ownerUid = ((_url_searchParams_get1 = url.searchParams.get('ownerUid')) != null ? _url_searchParams_get1 : '').trim().slice(0, CONTACT_NAME_MAX) || null;
|
|
1205
1232
|
const companyId = ((_url_searchParams_get2 = url.searchParams.get('companyId')) != null ? _url_searchParams_get2 : '').trim().slice(0, CRM_ID_MAX) || null;
|
|
1206
|
-
const group = contactViewGroup(ctx, url);
|
|
1233
|
+
const group = await contactViewGroup(ctx, request, url);
|
|
1207
1234
|
if ('response' in group) return group.response;
|
|
1208
1235
|
// ONE selector, the most selective that was given: the unique email, then
|
|
1209
1236
|
// the company, then the tag. Every other filter is checked on the page.
|
|
@@ -1255,7 +1282,7 @@ export async function handleContacts(request, ctx, segments, url) {
|
|
|
1255
1282
|
if (request.method === 'GET') {
|
|
1256
1283
|
const denied = requireScope(ctx, 'contacts:read');
|
|
1257
1284
|
if (denied) return denied;
|
|
1258
|
-
return listContacts(ctx, collection, url);
|
|
1285
|
+
return listContacts(request, ctx, collection, url);
|
|
1259
1286
|
}
|
|
1260
1287
|
if (request.method === 'POST') {
|
|
1261
1288
|
const denied = requireScope(ctx, 'contacts:write');
|
|
@@ -1281,14 +1308,14 @@ export async function handleContacts(request, ctx, segments, url) {
|
|
|
1281
1308
|
}
|
|
1282
1309
|
const denied = requireScope(ctx, 'contacts:write');
|
|
1283
1310
|
if (denied) return denied;
|
|
1284
|
-
const group = contactViewGroup(ctx, url);
|
|
1311
|
+
const group = await contactViewGroup(ctx, request, url);
|
|
1285
1312
|
if ('response' in group) return group.response;
|
|
1286
1313
|
return mergeContactRoute(request, ctx, contactRef, (snap)=>contactView(snap, group.groupId));
|
|
1287
1314
|
}
|
|
1288
1315
|
if (request.method === 'GET') {
|
|
1289
1316
|
const denied = requireScope(ctx, 'contacts:read');
|
|
1290
1317
|
if (denied) return denied;
|
|
1291
|
-
const group = contactViewGroup(ctx, url);
|
|
1318
|
+
const group = await contactViewGroup(ctx, request, url);
|
|
1292
1319
|
if ('response' in group) return group.response;
|
|
1293
1320
|
const snap = await contactRef.get();
|
|
1294
1321
|
if (!snap.exists) {
|