@erxes/core-contract 0.1.0-v2.4 → 0.1.0-v2.6

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/dist/client.d.ts CHANGED
@@ -30981,6 +30981,304 @@ export declare const memberQueries: {
30981
30981
  };
30982
30982
  }>>>, "input" | "staleTime">>;
30983
30983
  };
30984
+ /**
30985
+ * Where erxes-ui's `ContactLink` reads a customer or company:
30986
+ * `<ContactLink contentType="core:customer" contentId={id} contacts={contactQueries} />`.
30987
+ * It is the query web's panel reads, so a name edited there shows in every link.
30988
+ */
30989
+ export declare const contactQueries: {
30990
+ customer: (id: string) => NoInfer<{
30991
+ input: {
30992
+ id: string;
30993
+ };
30994
+ staleTime: number;
30995
+ } & Omit<import("@orpc/tanstack-query").QueryOptionsBase<{
30996
+ id: string;
30997
+ state: "customer" | "lead";
30998
+ firstName: string | null;
30999
+ middleName: string | null;
31000
+ lastName: string | null;
31001
+ avatarUrl: string | null;
31002
+ primaryEmail: string | null;
31003
+ emails: string[];
31004
+ primaryPhone: string | null;
31005
+ phones: string[];
31006
+ sex: 0 | 1 | 2 | 9 | null;
31007
+ birthDate: string | null;
31008
+ position: string | null;
31009
+ department: string | null;
31010
+ code: string | null;
31011
+ description: string | null;
31012
+ ownerId: string | null;
31013
+ leadStageId: string | null;
31014
+ leadStageChangedAt: string | null;
31015
+ disqualifyReason: string | null;
31016
+ source: string | null;
31017
+ sourceDetails: Record<string, string>;
31018
+ convertedAt: string | null;
31019
+ lastActivityAt: string;
31020
+ createdAt: string;
31021
+ updatedAt: string;
31022
+ tagIds: string[];
31023
+ customFields: Record<string, string | number | boolean | string[]>;
31024
+ }, import("@orpc/contract").ErrorFromErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
31025
+ UNAUTHORIZED: {
31026
+ status: number;
31027
+ };
31028
+ NOT_ALLOWED: {
31029
+ status: number;
31030
+ data: import("zod").ZodOptional<import("zod").ZodObject<{
31031
+ permission: import("zod").ZodString;
31032
+ }, import("zod/v4/core").$strip>>;
31033
+ };
31034
+ PLUGIN_ONLY: {
31035
+ status: number;
31036
+ };
31037
+ MEMBERS_ONLY: {
31038
+ status: number;
31039
+ };
31040
+ ORG_REQUIRED: {
31041
+ status: number;
31042
+ };
31043
+ SCOPE_REQUIRED: {
31044
+ status: number;
31045
+ };
31046
+ SERVICE_TOKEN_REQUIRED: {
31047
+ status: number;
31048
+ };
31049
+ ORGANIZATION_DISABLED: {
31050
+ status: number;
31051
+ data: import("zod").ZodObject<{
31052
+ manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
31053
+ }, import("zod/v4/core").$strip>;
31054
+ };
31055
+ NOT_IN_PLAN: {
31056
+ status: number;
31057
+ data: import("zod").ZodOptional<import("zod").ZodObject<{
31058
+ manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
31059
+ }, import("zod/v4/core").$strip>>;
31060
+ };
31061
+ READ_ONLY: {
31062
+ status: number;
31063
+ };
31064
+ TOO_MANY_REQUESTS: {
31065
+ status: number;
31066
+ };
31067
+ INVALID_INPUT: {
31068
+ status: number;
31069
+ data: import("zod").ZodObject<{
31070
+ issues: import("zod").ZodArray<import("zod").ZodObject<{
31071
+ path: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodInt]>>;
31072
+ message: import("zod").ZodString;
31073
+ }, import("zod/v4/core").$strip>>;
31074
+ }, import("zod/v4/core").$strip>;
31075
+ };
31076
+ NOT_FOUND: {
31077
+ status: number;
31078
+ };
31079
+ TAKEN: {
31080
+ status: number;
31081
+ data: import("zod").ZodObject<{
31082
+ field: import("zod").ZodString;
31083
+ id: import("zod").ZodOptional<import("zod").ZodString>;
31084
+ values: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
31085
+ }, import("zod/v4/core").$strip>;
31086
+ };
31087
+ INVALID_CURSOR: {
31088
+ status: number;
31089
+ };
31090
+ INVALID_REFERENCE: {
31091
+ status: number;
31092
+ data: import("zod").ZodObject<{
31093
+ field: import("zod").ZodString;
31094
+ }, import("zod/v4/core").$strip>;
31095
+ };
31096
+ INVALID_FILTER: {
31097
+ status: number;
31098
+ };
31099
+ FILTER_TOO_SLOW: {
31100
+ status: number;
31101
+ };
31102
+ INVALID_ACTOR: {
31103
+ status: number;
31104
+ };
31105
+ INVALID_FIELD: {
31106
+ status: number;
31107
+ data: import("zod").ZodObject<{
31108
+ fieldId: import("zod").ZodString;
31109
+ }, import("zod/v4/core").$strip>;
31110
+ };
31111
+ INVALID_FIELD_VALUE: {
31112
+ status: number;
31113
+ data: import("zod").ZodObject<{
31114
+ fieldId: import("zod").ZodString;
31115
+ }, import("zod/v4/core").$strip>;
31116
+ };
31117
+ INVALID_OWNER: {
31118
+ status: number;
31119
+ };
31120
+ INVALID_TAG: {
31121
+ status: number;
31122
+ };
31123
+ INVALID_TYPE: {
31124
+ status: number;
31125
+ };
31126
+ MASS_DELETE_STOPPED: {
31127
+ status: number;
31128
+ };
31129
+ NOT_A_LEAD: {
31130
+ status: number;
31131
+ };
31132
+ TAG_LIMIT: {
31133
+ status: number;
31134
+ };
31135
+ }>>>, "input" | "staleTime">>;
31136
+ company: (id: string) => NoInfer<{
31137
+ input: {
31138
+ id: string;
31139
+ };
31140
+ staleTime: number;
31141
+ } & Omit<import("@orpc/tanstack-query").QueryOptionsBase<{
31142
+ id: string;
31143
+ primaryName: string;
31144
+ state: "customer" | "lead";
31145
+ names: string[];
31146
+ avatarUrl: string | null;
31147
+ primaryEmail: string | null;
31148
+ emails: string[];
31149
+ primaryPhone: string | null;
31150
+ phones: string[];
31151
+ website: string | null;
31152
+ industry: string | null;
31153
+ size: number | null;
31154
+ businessType: string | null;
31155
+ code: string | null;
31156
+ description: string | null;
31157
+ ownerId: string | null;
31158
+ leadStageId: string | null;
31159
+ leadStageChangedAt: string | null;
31160
+ disqualifyReason: string | null;
31161
+ source: string | null;
31162
+ sourceDetails: Record<string, string>;
31163
+ convertedAt: string | null;
31164
+ lastActivityAt: string;
31165
+ createdAt: string;
31166
+ updatedAt: string;
31167
+ tagIds: string[];
31168
+ customFields: Record<string, string | number | boolean | string[]>;
31169
+ }, import("@orpc/contract").ErrorFromErrorMap<import("@orpc/contract").MergedErrorMap<Record<never, never>, {
31170
+ UNAUTHORIZED: {
31171
+ status: number;
31172
+ };
31173
+ NOT_ALLOWED: {
31174
+ status: number;
31175
+ data: import("zod").ZodOptional<import("zod").ZodObject<{
31176
+ permission: import("zod").ZodString;
31177
+ }, import("zod/v4/core").$strip>>;
31178
+ };
31179
+ PLUGIN_ONLY: {
31180
+ status: number;
31181
+ };
31182
+ MEMBERS_ONLY: {
31183
+ status: number;
31184
+ };
31185
+ ORG_REQUIRED: {
31186
+ status: number;
31187
+ };
31188
+ SCOPE_REQUIRED: {
31189
+ status: number;
31190
+ };
31191
+ SERVICE_TOKEN_REQUIRED: {
31192
+ status: number;
31193
+ };
31194
+ ORGANIZATION_DISABLED: {
31195
+ status: number;
31196
+ data: import("zod").ZodObject<{
31197
+ manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
31198
+ }, import("zod/v4/core").$strip>;
31199
+ };
31200
+ NOT_IN_PLAN: {
31201
+ status: number;
31202
+ data: import("zod").ZodOptional<import("zod").ZodObject<{
31203
+ manageUrl: import("zod").ZodNullable<import("zod").ZodString>;
31204
+ }, import("zod/v4/core").$strip>>;
31205
+ };
31206
+ READ_ONLY: {
31207
+ status: number;
31208
+ };
31209
+ TOO_MANY_REQUESTS: {
31210
+ status: number;
31211
+ };
31212
+ INVALID_INPUT: {
31213
+ status: number;
31214
+ data: import("zod").ZodObject<{
31215
+ issues: import("zod").ZodArray<import("zod").ZodObject<{
31216
+ path: import("zod").ZodArray<import("zod").ZodUnion<readonly [import("zod").ZodString, import("zod").ZodInt]>>;
31217
+ message: import("zod").ZodString;
31218
+ }, import("zod/v4/core").$strip>>;
31219
+ }, import("zod/v4/core").$strip>;
31220
+ };
31221
+ NOT_FOUND: {
31222
+ status: number;
31223
+ };
31224
+ TAKEN: {
31225
+ status: number;
31226
+ data: import("zod").ZodObject<{
31227
+ field: import("zod").ZodString;
31228
+ id: import("zod").ZodOptional<import("zod").ZodString>;
31229
+ values: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
31230
+ }, import("zod/v4/core").$strip>;
31231
+ };
31232
+ INVALID_CURSOR: {
31233
+ status: number;
31234
+ };
31235
+ INVALID_REFERENCE: {
31236
+ status: number;
31237
+ data: import("zod").ZodObject<{
31238
+ field: import("zod").ZodString;
31239
+ }, import("zod/v4/core").$strip>;
31240
+ };
31241
+ INVALID_FILTER: {
31242
+ status: number;
31243
+ };
31244
+ FILTER_TOO_SLOW: {
31245
+ status: number;
31246
+ };
31247
+ INVALID_ACTOR: {
31248
+ status: number;
31249
+ };
31250
+ INVALID_FIELD: {
31251
+ status: number;
31252
+ data: import("zod").ZodObject<{
31253
+ fieldId: import("zod").ZodString;
31254
+ }, import("zod/v4/core").$strip>;
31255
+ };
31256
+ INVALID_FIELD_VALUE: {
31257
+ status: number;
31258
+ data: import("zod").ZodObject<{
31259
+ fieldId: import("zod").ZodString;
31260
+ }, import("zod/v4/core").$strip>;
31261
+ };
31262
+ INVALID_OWNER: {
31263
+ status: number;
31264
+ };
31265
+ INVALID_TAG: {
31266
+ status: number;
31267
+ };
31268
+ INVALID_TYPE: {
31269
+ status: number;
31270
+ };
31271
+ MASS_DELETE_STOPPED: {
31272
+ status: number;
31273
+ };
31274
+ NOT_A_LEAD: {
31275
+ status: number;
31276
+ };
31277
+ TAG_LIMIT: {
31278
+ status: number;
31279
+ };
31280
+ }>>>, "input" | "staleTime">>;
31281
+ };
30984
31282
  /** Any error core answers with: one per code in `ERRORS`, with that code's `data`. */
30985
31283
  type ApiError = ORPCErrorFromErrorMap<typeof ERRORS>;
30986
31284
  /**
package/dist/client.js CHANGED
@@ -48,6 +48,21 @@ const memberQueries = {
48
48
  })
49
49
  };
50
50
  /**
51
+ * Where erxes-ui's `ContactLink` reads a customer or company:
52
+ * `<ContactLink contentType="core:customer" contentId={id} contacts={contactQueries} />`.
53
+ * It is the query web's panel reads, so a name edited there shows in every link.
54
+ */
55
+ const contactQueries = {
56
+ customer: (id) => orpc.customers.get.queryOptions({
57
+ input: { id },
58
+ staleTime: 6e4
59
+ }),
60
+ company: (id) => orpc.companies.get.queryOptions({
61
+ input: { id },
62
+ staleTime: 6e4
63
+ })
64
+ };
65
+ /**
51
66
  * Whether core answered with `code` (`TAKEN`, `NOT_FOUND`, …). It narrows
52
67
  * `error.data` to what `ERRORS` declares for the code, so the field a
53
68
  * `TAKEN` is about reads as `error.data.field`.
@@ -59,4 +74,4 @@ const messageOf = (error) => {
59
74
  if (issue) return `${issue.path.join(".")}: ${issue.message}`;
60
75
  return error instanceof Error ? error.message : "Something went wrong. Try again.";
61
76
  };
62
- export { isApiError, memberQueries, messageOf, orpc };
77
+ export { contactQueries, isApiError, memberQueries, messageOf, orpc };
package/dist/customers.js CHANGED
@@ -3,9 +3,9 @@ import { customers } from "./db/src/schema/customers.js";
3
3
  import { companies, customerCompanies } from "./db/src/schema/companies.js";
4
4
  import "./db/src/schema/index.js";
5
5
  import { COMMON_ERRORS, ERRORS } from "./errors.js";
6
- import { CustomerSex } from "./values.js";
6
+ import { ContactState, CustomerSex } from "./values.js";
7
7
  import { CursorQuery, CustomFields, CustomFieldsPatch, DESCRIPTION_MAX, EmailAddress, Id, IdList, ImageAddress, PhoneNumber, cursorPageOf, isoDate, listOf } from "./common.js";
8
- import { ContactState, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, lifecycleInput, lifecycleRow } from "./leads.js";
8
+ import { LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, lifecycleInput, lifecycleRow } from "./leads.js";
9
9
  import { oc } from "@orpc/contract";
10
10
  import { z } from "zod";
11
11
  import { createSelectSchema, createUpdateSchema } from "drizzle-zod";
@@ -79,6 +79,13 @@ const customerSessions = pgTable("customer_sessions", {
79
79
  clientId: text().notNull(),
80
80
  tokenHash: text().notNull(),
81
81
  previousTokenHash: text(),
82
+ /**
83
+ * The current refresh token, sealed with core's key, and when it replaced
84
+ * the previous one: a refresh with the previous token just after (a second
85
+ * tab, a retried request) gets this same token instead of ending the session.
86
+ */
87
+ tokenSealed: text(),
88
+ rotatedAt: timestamptz(),
82
89
  userAgent: text(),
83
90
  ip: text(),
84
91
  createdAt: createdAt(),
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ import { EmailMessage, emailsContract } from "./emails.js";
16
16
  import { CoreEvent, EventFailure, EventFailureStatus, EventInput, EventNotify, eventsContract } from "./events.js";
17
17
  import { Field, FieldGroup, FieldUsage, fieldGroupsContract, fieldsContract } from "./fields.js";
18
18
  import { FileInfo, FileSettings, UploadTarget, filesContract } from "./files.js";
19
- import { ContactState, LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, SourceDetails, leadsContract, lifecycleInput, lifecycleRow } from "./leads.js";
19
+ import { LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, SourceDetails, leadsContract, lifecycleInput, lifecycleRow } from "./leads.js";
20
20
  import { COUNTRIES, Country, Currency, currencyDigits, currencyOfCountry } from "./money.js";
21
21
  import { CORE_NOTIFICATION_KINDS, CoreNotificationKind, Notification, NotificationGroupSetting, NotificationInput, NotificationSettings, notificationsContract } from "./notifications.js";
22
22
  import { ActorType, AppLink, DedupeKey, EntityType, EventType } from "./platform.js";
@@ -30,7 +30,7 @@ import { Tag, tagsContract } from "./tags.js";
30
30
  import { TrashItem, trashContract } from "./trash.js";
31
31
  import { Export, ExportQuery, Import, ImportOptions, ImportRow, ImportStatus, TransferColumn, TransferRecordType, transferContract } from "./transfer.js";
32
32
  import { DateOnly, User, UserLinks, UserStatus, usersContract } from "./users.js";
33
- import { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf } from "./values.js";
33
+ import { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, ContactState, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf } from "./values.js";
34
34
  import { FilterField, RecordFilter, View, ViewRecordType, ViewSort, viewsContract } from "./views.js";
35
35
  import { CORE_EVENT_TYPES, EventPattern, EventTypeInfo, Webhook, WebhookDelivery, webhooksContract } from "./webhooks.js";
36
36
  /** The whole core API. Core implements it; plugins call it with a typed client. */
package/dist/index.js CHANGED
@@ -23,14 +23,14 @@ import { CORE_EVENT_TYPES, EventPattern, EventTypeInfo, Webhook, WebhookDelivery
23
23
  import { EntitlementStatus, OrganizationStatus, PluginAccess, PluginPlan, PluginTier, SaasWorkspace, SubscriptionInfo, saasContract } from "./saas.js";
24
24
  import { FilterField, RecordFilter, View, ViewRecordType, ViewSort, viewsContract } from "./views.js";
25
25
  import { Export, ExportQuery, Import, ImportOptions, ImportRow, ImportStatus, TransferColumn, TransferRecordType, transferContract } from "./transfer.js";
26
- import { ContactState, LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, SourceDetails, leadsContract, lifecycleInput, lifecycleRow } from "./leads.js";
26
+ import { LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, SourceDetails, leadsContract, lifecycleInput, lifecycleRow } from "./leads.js";
27
27
  import { ActionInput, Audience, AutomationDefinition, AutomationStep, AutomationTrigger, ConditionGroup, ConditionOperator, ConditionRule, ContextPath, Reentry, RelativeAmount } from "./db/src/automationDefinition.js";
28
28
  import { ActionField, ActionInfo, AutomationRun, RunStatus, RunStep } from "./automationRuns.js";
29
29
  import { ContentType, CursorQuery, CustomFields, CustomFieldsPatch, CustomValue, DESCRIPTION_MAX, EmailAddress, FieldContentType, Id, IdList, ImageAddress, InvalidInput, LIST_MAX, PageInfo, PhoneNumber, QueryBoolean, QueryFlag, cursorPageOf, isoDate, listOf } from "./common.js";
30
30
  import { COMMON_ERRORS, ERRORS } from "./errors.js";
31
31
  import { COUNTRIES, Country, Currency, currencyDigits, currencyOfCountry } from "./money.js";
32
32
  import { ActorType, AppLink, DedupeKey, EntityType, EventType } from "./platform.js";
33
- import { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf } from "./values.js";
33
+ import { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, ContactState, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf } from "./values.js";
34
34
  // src/index.ts
35
35
  /** The whole core API. Core implements it; plugins call it with a typed client. */
36
36
  const coreContract = {
package/dist/leads.d.ts CHANGED
@@ -20,11 +20,6 @@ export declare const LeadRecordType: z.ZodEnum<{
20
20
  customer: "customer";
21
21
  }>;
22
22
  export type LeadRecordType = z.infer<typeof LeadRecordType>;
23
- /** `lead`: not a customer yet. People and companies alike. */
24
- export declare const ContactState: z.ZodEnum<{
25
- customer: "customer";
26
- lead: "lead";
27
- }>;
28
23
  /**
29
24
  * The lifecycle columns every contact (person or company) carries:
30
25
  * `state`, `leadStageId` (stays after conversion), `leadStageChangedAt`,
package/dist/leads.js CHANGED
@@ -1,4 +1,4 @@
1
- import { CONTENT_TYPES, CUSTOMER_STATES, LEAD_STAGE_KINDS } from "./db/src/enums.js";
1
+ import { CONTENT_TYPES, LEAD_STAGE_KINDS } from "./db/src/enums.js";
2
2
  import { leadStages } from "./db/src/schema/leadStages.js";
3
3
  import { leadEvents } from "./db/src/schema/leads.js";
4
4
  import "./db/src/schema/index.js";
@@ -34,8 +34,6 @@ const LeadSource = z.string().trim().toLowerCase().regex(/^[a-z0-9][a-z0-9_.:-]{
34
34
  const SourceDetails = z.record(z.string().max(50), z.string().max(500)).refine((value) => Object.keys(value).length <= 20, "at most 20 details");
35
35
  /** Whom a lead action is about: people or companies (both go through the same stages). */
36
36
  const LeadRecordType = z.enum(CONTENT_TYPES);
37
- /** `lead`: not a customer yet. People and companies alike. */
38
- const ContactState = z.enum(CUSTOMER_STATES);
39
37
  /**
40
38
  * The lifecycle columns every contact (person or company) carries:
41
39
  * `state`, `leadStageId` (stays after conversion), `leadStageChangedAt`,
@@ -241,4 +239,4 @@ const leadsContract = {
241
239
  to: z.iso.datetime().optional()
242
240
  })).output(LeadReport)
243
241
  };
244
- export { ContactState, LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, SourceDetails, leadsContract, lifecycleInput, lifecycleRow };
242
+ export { LEAD_SOURCES, LIFECYCLE_COLUMNS, LIFECYCLE_INPUT_COLUMNS, LeadEvent, LeadRecordType, LeadReport, LeadSource, LeadStage, LeadStageKind, SourceDetails, leadsContract, lifecycleInput, lifecycleRow };
package/dist/values.d.ts CHANGED
@@ -23,6 +23,11 @@ export type UserLinkName = z.infer<typeof UserLinkName>;
23
23
  /** ISO/IEC 5218, as in erxes until now: 0 not known, 1 male, 2 female, 9 not applicable. */
24
24
  export declare const CustomerSex: z.ZodUnion<z.ZodLiteral<0 | 1 | 2 | 9>[]>;
25
25
  export type CustomerSex = z.infer<typeof CustomerSex>;
26
+ /** `lead`: not a customer yet. People and companies alike. */
27
+ export declare const ContactState: z.ZodEnum<{
28
+ customer: "customer";
29
+ lead: "lead";
30
+ }>;
26
31
  export declare const ProductKind: z.ZodEnum<{
27
32
  goods: "goods";
28
33
  service: "service";
package/dist/values.js CHANGED
@@ -1,4 +1,4 @@
1
- import { AUDIT_STREAM_FORMATS, AUTOMATION_STATUSES, CUSTOMER_SEXES, FIELD_TYPES, FIELD_VALIDATIONS, INVOICE_STATUSES, LIVE_MODES, NOTIFICATION_DELIVERIES, PAYMENT_GATEWAY_KINDS, PRODUCT_KINDS } from "./db/src/enums.js";
1
+ import { AUDIT_STREAM_FORMATS, AUTOMATION_STATUSES, CUSTOMER_SEXES, CUSTOMER_STATES, FIELD_TYPES, FIELD_VALIDATIONS, INVOICE_STATUSES, LIVE_MODES, NOTIFICATION_DELIVERIES, PAYMENT_GATEWAY_KINDS, PRODUCT_KINDS } from "./db/src/enums.js";
2
2
  import { z } from "zod";
3
3
  // src/values.ts
4
4
  const CORE_API_VERSION = "v1";
@@ -22,6 +22,8 @@ const USER_LINK_NAMES = [
22
22
  const UserLinkName = z.enum(USER_LINK_NAMES);
23
23
  /** ISO/IEC 5218, as in erxes until now: 0 not known, 1 male, 2 female, 9 not applicable. */
24
24
  const CustomerSex = z.union(CUSTOMER_SEXES.map((code) => z.literal(code)));
25
+ /** `lead`: not a customer yet. People and companies alike. */
26
+ const ContactState = z.enum(CUSTOMER_STATES);
25
27
  const ProductKind = z.enum(PRODUCT_KINDS);
26
28
  const FieldType = z.enum(FIELD_TYPES);
27
29
  /** Field types whose values are chosen from `options`. */
@@ -136,4 +138,4 @@ const CORE_NOTIFICATION_GROUPS = [
136
138
  ];
137
139
  /** The group a notification belongs to: a core group, or the plugin that sent it. */
138
140
  const notificationGroupOf = (source, kind) => source === "core" ? CORE_NOTIFICATION_GROUPS.find((group) => group.kinds.includes(kind))?.key ?? "records" : source;
139
- export { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf };
141
+ export { AuditStreamFormat, AutomationStatus, CORE_API_PREFIX, CORE_API_VERSION, CORE_NOTIFICATION_GROUPS, ContactState, CustomerSex, FIELD_TYPE_FAMILIES, FieldType, FieldValidation, InviteRole, InvoiceStatus, LiveMode, NewPassword, NotificationDelivery, OPTION_FIELD_TYPES, PAYMENT_GATEWAYS, PaymentGatewayKind, ProductKind, RoleKey, UNMUTABLE_NOTIFICATION_KINDS, USER_LINK_NAMES, UserLinkName, gatewayTakes, notificationGroupOf };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erxes/core-contract",
3
- "version": "0.1.0-v2.4",
3
+ "version": "0.1.0-v2.6",
4
4
  "private": false,
5
5
  "description": "erxes core API contract (/core/v1) and event schemas, shared by core and plugins",
6
6
  "license": "AGPL-3.0-only",