@automate.ax/integration-contracts 0.103.2 → 0.104.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.
@@ -45,7 +45,15 @@ export declare const CLOSE_WEBHOOK_PAYLOAD_SCHEMA: z.ZodObject<{
45
45
  subscriptionId: z.ZodString;
46
46
  }, z.core.$strip>;
47
47
  export declare const CLOSE_TRIGGER_CONFIG_SCHEMA: z.ZodObject<{}, z.core.$strip>;
48
- export declare const CLOSE_SEMANTIC_EVENT_TYPES: readonly ["close.call.answered", "close.call.completed", "close.comment.created", "close.comment.deleted", "close.comment.updated", "close.contact.created", "close.contact.deleted", "close.contact.updated", "close.email.received", "close.email.sent", "close.lead.created", "close.lead.deleted", "close.lead.merged", "close.lead.updated", "close.meeting.canceled", "close.meeting.completed", "close.meeting.scheduled", "close.meeting.started", "close.opportunity.created", "close.opportunity.deleted", "close.opportunity.lost", "close.opportunity.updated", "close.opportunity.won", "close.sequenceSubscription.created", "close.sequenceSubscription.deleted", "close.sequenceSubscription.errored", "close.sequenceSubscription.finished", "close.sequenceSubscription.goalReached", "close.sequenceSubscription.paused", "close.sequenceSubscription.resumed", "close.sequenceSubscription.updated", "close.sms.received", "close.sms.sent", "close.task.completed", "close.task.created", "close.task.deleted", "close.task.updated"];
48
+ export declare const CLOSE_SMART_VIEW_MEMBERSHIP_TRIGGER_CONFIG_SCHEMA: z.ZodObject<{
49
+ smartViewId: z.ZodString;
50
+ }, z.core.$strip>;
51
+ export declare const CLOSE_SMART_VIEW_MEMBERSHIP_EVENT_SCHEMA: z.ZodObject<{
52
+ leadId: z.ZodString;
53
+ smartViewId: z.ZodString;
54
+ }, z.core.$strip>;
55
+ export declare const CLOSE_SEMANTIC_EVENT_TYPES: readonly ["close.call.answered", "close.call.completed", "close.comment.created", "close.comment.deleted", "close.comment.updated", "close.contact.created", "close.contact.deleted", "close.contact.updated", "close.email.received", "close.email.sent", "close.lead.created", "close.lead.deleted", "close.lead.merged", "close.lead.updated", "close.meeting.canceled", "close.meeting.completed", "close.meeting.scheduled", "close.meeting.started", "close.opportunity.created", "close.opportunity.deleted", "close.opportunity.lost", "close.opportunity.updated", "close.opportunity.won", "close.sequenceSubscription.created", "close.sequenceSubscription.deleted", "close.sequenceSubscription.errored", "close.sequenceSubscription.finished", "close.sequenceSubscription.goalReached", "close.sequenceSubscription.paused", "close.sequenceSubscription.resumed", "close.sequenceSubscription.updated", "close.smartView.created", "close.smartView.updated", "close.sms.received", "close.sms.sent", "close.task.completed", "close.task.created", "close.task.deleted", "close.task.updated"];
56
+ export declare const CLOSE_SMART_VIEW_MEMBERSHIP_EVENT_TYPES: readonly ["close.smartView.leadEntered", "close.smartView.leadExited"];
49
57
  export declare const closeTriggerContracts: {
50
58
  readonly "close.event": {
51
59
  readonly configSchema: z.ZodObject<{}, z.core.$strip>;
@@ -1974,6 +1982,138 @@ export declare const closeTriggerContracts: {
1974
1982
  objectType: z.ZodLiteral<"sequence_subscription">;
1975
1983
  }, z.core.$strip>;
1976
1984
  };
1985
+ readonly "close.smartView.created": {
1986
+ configSchema: z.ZodObject<{}, z.core.$strip>;
1987
+ eventSchema: z.ZodObject<{
1988
+ apiKeyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1989
+ changedFields: z.ZodPrefault<z.ZodArray<z.ZodString>>;
1990
+ createdAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>;
1991
+ id: z.ZodString;
1992
+ leadId: z.ZodNullable<z.ZodString>;
1993
+ meta: z.ZodPrefault<z.ZodCustom<Record<string, import("@automate.ax/codec").Encodable>, Record<string, import("@automate.ax/codec").Encodable>>>;
1994
+ objectId: z.ZodString;
1995
+ organizationId: z.ZodString;
1996
+ previousData: z.ZodNullable<z.ZodCustom<Record<string, import("@automate.ax/codec").Encodable>, Record<string, import("@automate.ax/codec").Encodable>>>;
1997
+ requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1998
+ updatedAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>;
1999
+ userId: z.ZodNullable<z.ZodString>;
2000
+ action: z.ZodLiteral<"created">;
2001
+ data: z.ZodObject<{
2002
+ createdAt: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
2003
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2004
+ id: z.ZodOptional<z.ZodString>;
2005
+ isShared: z.ZodOptional<z.ZodBoolean>;
2006
+ isUserDependent: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
2007
+ name: z.ZodOptional<z.ZodString>;
2008
+ organizationId: z.ZodOptional<z.ZodString>;
2009
+ query: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2010
+ selectedFields: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodCustom<Record<string, import("@automate.ax/codec").Encodable>, Record<string, import("@automate.ax/codec").Encodable>>>>>>;
2011
+ sharedWith: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>>;
2012
+ sharingSettings: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodObject<{
2013
+ createdAt: z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
2014
+ createdById: z.ZodNullable<z.ZodString>;
2015
+ groupIds: z.ZodArray<z.ZodString>;
2016
+ updatedAt: z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
2017
+ updatedById: z.ZodNullable<z.ZodString>;
2018
+ userIds: z.ZodArray<z.ZodString>;
2019
+ wholeOrg: z.ZodBoolean;
2020
+ }, z.core.$strip>>>>;
2021
+ sQuery: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, import("@automate.ax/codec").Encodable>, Record<string, import("@automate.ax/codec").Encodable>>>>;
2022
+ type: z.ZodOptional<z.ZodEnum<{
2023
+ email: "email";
2024
+ lead: "lead";
2025
+ contact: "contact";
2026
+ opportunity: "opportunity";
2027
+ call: "call";
2028
+ sms: "sms";
2029
+ meeting: "meeting";
2030
+ note: "note";
2031
+ whatsapp_message: "whatsapp_message";
2032
+ custom_activity: "custom_activity";
2033
+ form_submission: "form_submission";
2034
+ }>>;
2035
+ updatedAt: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
2036
+ userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2037
+ usedRecently: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
2038
+ }, z.core.$strip>;
2039
+ objectType: z.ZodLiteral<"saved_search">;
2040
+ }, z.core.$strip>;
2041
+ };
2042
+ readonly "close.smartView.updated": {
2043
+ configSchema: z.ZodObject<{}, z.core.$strip>;
2044
+ eventSchema: z.ZodObject<{
2045
+ apiKeyId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2046
+ changedFields: z.ZodPrefault<z.ZodArray<z.ZodString>>;
2047
+ createdAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>;
2048
+ id: z.ZodString;
2049
+ leadId: z.ZodNullable<z.ZodString>;
2050
+ meta: z.ZodPrefault<z.ZodCustom<Record<string, import("@automate.ax/codec").Encodable>, Record<string, import("@automate.ax/codec").Encodable>>>;
2051
+ objectId: z.ZodString;
2052
+ organizationId: z.ZodString;
2053
+ previousData: z.ZodNullable<z.ZodCustom<Record<string, import("@automate.ax/codec").Encodable>, Record<string, import("@automate.ax/codec").Encodable>>>;
2054
+ requestId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2055
+ updatedAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>;
2056
+ userId: z.ZodNullable<z.ZodString>;
2057
+ action: z.ZodLiteral<"updated">;
2058
+ data: z.ZodObject<{
2059
+ createdAt: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
2060
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2061
+ id: z.ZodOptional<z.ZodString>;
2062
+ isShared: z.ZodOptional<z.ZodBoolean>;
2063
+ isUserDependent: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
2064
+ name: z.ZodOptional<z.ZodString>;
2065
+ organizationId: z.ZodOptional<z.ZodString>;
2066
+ query: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2067
+ selectedFields: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodCustom<Record<string, import("@automate.ax/codec").Encodable>, Record<string, import("@automate.ax/codec").Encodable>>>>>>;
2068
+ sharedWith: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>>;
2069
+ sharingSettings: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodObject<{
2070
+ createdAt: z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
2071
+ createdById: z.ZodNullable<z.ZodString>;
2072
+ groupIds: z.ZodArray<z.ZodString>;
2073
+ updatedAt: z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
2074
+ updatedById: z.ZodNullable<z.ZodString>;
2075
+ userIds: z.ZodArray<z.ZodString>;
2076
+ wholeOrg: z.ZodBoolean;
2077
+ }, z.core.$strip>>>>;
2078
+ sQuery: z.ZodOptional<z.ZodNullable<z.ZodCustom<Record<string, import("@automate.ax/codec").Encodable>, Record<string, import("@automate.ax/codec").Encodable>>>>;
2079
+ type: z.ZodOptional<z.ZodEnum<{
2080
+ email: "email";
2081
+ lead: "lead";
2082
+ contact: "contact";
2083
+ opportunity: "opportunity";
2084
+ call: "call";
2085
+ sms: "sms";
2086
+ meeting: "meeting";
2087
+ note: "note";
2088
+ whatsapp_message: "whatsapp_message";
2089
+ custom_activity: "custom_activity";
2090
+ form_submission: "form_submission";
2091
+ }>>;
2092
+ updatedAt: z.ZodOptional<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
2093
+ userId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2094
+ usedRecently: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
2095
+ }, z.core.$strip>;
2096
+ objectType: z.ZodLiteral<"saved_search">;
2097
+ }, z.core.$strip>;
2098
+ };
2099
+ readonly "close.smartView.leadEntered": {
2100
+ readonly configSchema: z.ZodObject<{
2101
+ smartViewId: z.ZodString;
2102
+ }, z.core.$strip>;
2103
+ readonly eventSchema: z.ZodObject<{
2104
+ leadId: z.ZodString;
2105
+ smartViewId: z.ZodString;
2106
+ }, z.core.$strip>;
2107
+ };
2108
+ readonly "close.smartView.leadExited": {
2109
+ readonly configSchema: z.ZodObject<{
2110
+ smartViewId: z.ZodString;
2111
+ }, z.core.$strip>;
2112
+ readonly eventSchema: z.ZodObject<{
2113
+ leadId: z.ZodString;
2114
+ smartViewId: z.ZodString;
2115
+ }, z.core.$strip>;
2116
+ };
1977
2117
  readonly "close.sms.received": {
1978
2118
  configSchema: z.ZodObject<{}, z.core.$strip>;
1979
2119
  eventSchema: z.ZodObject<{
@@ -3213,7 +3353,7 @@ export declare const closeTriggerContracts: {
3213
3353
  *
3214
3354
  * @param event - Normalized Close webhook event.
3215
3355
  */
3216
- export declare function getCloseSemanticEventTypes(event: z.output<typeof CLOSE_EVENT_SCHEMA>): ("close.call.answered" | "close.call.completed" | "close.comment.created" | "close.comment.deleted" | "close.comment.updated" | "close.contact.created" | "close.contact.deleted" | "close.contact.updated" | "close.email.received" | "close.email.sent" | "close.lead.created" | "close.lead.deleted" | "close.lead.merged" | "close.lead.updated" | "close.meeting.canceled" | "close.meeting.completed" | "close.meeting.scheduled" | "close.meeting.started" | "close.opportunity.created" | "close.opportunity.deleted" | "close.opportunity.lost" | "close.opportunity.updated" | "close.opportunity.won" | "close.sequenceSubscription.created" | "close.sequenceSubscription.deleted" | "close.sequenceSubscription.errored" | "close.sequenceSubscription.finished" | "close.sequenceSubscription.goalReached" | "close.sequenceSubscription.paused" | "close.sequenceSubscription.resumed" | "close.sequenceSubscription.updated" | "close.sms.received" | "close.sms.sent" | "close.task.completed" | "close.task.created" | "close.task.deleted" | "close.task.updated")[];
3356
+ export declare function getCloseSemanticEventTypes(event: z.output<typeof CLOSE_EVENT_SCHEMA>): ("close.call.answered" | "close.call.completed" | "close.comment.created" | "close.comment.deleted" | "close.comment.updated" | "close.contact.created" | "close.contact.deleted" | "close.contact.updated" | "close.email.received" | "close.email.sent" | "close.lead.created" | "close.lead.deleted" | "close.lead.merged" | "close.lead.updated" | "close.meeting.canceled" | "close.meeting.completed" | "close.meeting.scheduled" | "close.meeting.started" | "close.opportunity.created" | "close.opportunity.deleted" | "close.opportunity.lost" | "close.opportunity.updated" | "close.opportunity.won" | "close.sequenceSubscription.created" | "close.sequenceSubscription.deleted" | "close.sequenceSubscription.errored" | "close.sequenceSubscription.finished" | "close.sequenceSubscription.goalReached" | "close.sequenceSubscription.paused" | "close.sequenceSubscription.resumed" | "close.sequenceSubscription.updated" | "close.smartView.created" | "close.smartView.updated" | "close.sms.received" | "close.sms.sent" | "close.task.completed" | "close.task.created" | "close.task.deleted" | "close.task.updated")[];
3217
3357
  /**
3218
3358
  * Resolves the provider event selections needed by a Close trigger type.
3219
3359
  *
@@ -1,6 +1,6 @@
1
1
  import * as z from "zod";
2
2
  import { CLOSE_OBJECT_SCHEMA } from "./api.js";
3
- import { CLOSE_CALL_SCHEMA, CLOSE_COMMENT_SCHEMA, CLOSE_DATE_SCHEMA, CLOSE_CONTACT_SCHEMA, CLOSE_EMAIL_SCHEMA, CLOSE_LEAD_SCHEMA, CLOSE_MEETING_SCHEMA, CLOSE_OPPORTUNITY_SCHEMA, CLOSE_SEQUENCE_SUBSCRIPTION_SCHEMA, CLOSE_SMS_SCHEMA, CLOSE_TASK_SCHEMA, } from "./schemas.js";
3
+ import { CLOSE_CALL_SCHEMA, CLOSE_COMMENT_SCHEMA, CLOSE_DATE_SCHEMA, CLOSE_CONTACT_SCHEMA, CLOSE_EMAIL_SCHEMA, CLOSE_LEAD_SCHEMA, CLOSE_MEETING_SCHEMA, CLOSE_OPPORTUNITY_SCHEMA, CLOSE_SEQUENCE_SUBSCRIPTION_SCHEMA, CLOSE_SMART_VIEW_SCHEMA, CLOSE_SMS_SCHEMA, CLOSE_TASK_SCHEMA, } from "./schemas.js";
4
4
  /**
5
5
  * Object-action pairs accepted by Close's webhook subscription API.
6
6
  *
@@ -209,6 +209,13 @@ export const CLOSE_WEBHOOK_PAYLOAD_SCHEMA = z.object({
209
209
  subscriptionId: z.string(),
210
210
  });
211
211
  export const CLOSE_TRIGGER_CONFIG_SCHEMA = z.object({});
212
+ export const CLOSE_SMART_VIEW_MEMBERSHIP_TRIGGER_CONFIG_SCHEMA = z.object({
213
+ smartViewId: z.string().startsWith("save_"),
214
+ });
215
+ export const CLOSE_SMART_VIEW_MEMBERSHIP_EVENT_SCHEMA = z.object({
216
+ leadId: z.string().startsWith("lead_"),
217
+ smartViewId: z.string().startsWith("save_"),
218
+ });
212
219
  // Event snapshots can omit fields that are required by the current REST
213
220
  // resource. Close's documented opportunity-won webhook is one such payload.
214
221
  const CLOSE_CALL_EVENT_DATA_SCHEMA = CLOSE_CALL_SCHEMA.partial();
@@ -222,6 +229,7 @@ const CLOSE_LEAD_EVENT_DATA_SCHEMA = CLOSE_LEAD_SCHEMA.partial();
222
229
  const CLOSE_MEETING_EVENT_DATA_SCHEMA = CLOSE_MEETING_SCHEMA.partial();
223
230
  const CLOSE_OPPORTUNITY_EVENT_DATA_SCHEMA = CLOSE_OPPORTUNITY_SCHEMA.partial();
224
231
  const CLOSE_SEQUENCE_SUBSCRIPTION_EVENT_DATA_SCHEMA = CLOSE_SEQUENCE_SUBSCRIPTION_SCHEMA.partial();
232
+ const CLOSE_SMART_VIEW_EVENT_DATA_SCHEMA = CLOSE_SMART_VIEW_SCHEMA.partial();
225
233
  const CLOSE_SMS_EVENT_DATA_SCHEMA = CLOSE_SMS_SCHEMA.partial();
226
234
  const CLOSE_DELETED_EVENT_DATA_SCHEMA = z.union([
227
235
  z.null(),
@@ -365,6 +373,16 @@ const SEMANTIC_EVENTS = {
365
373
  "updated",
366
374
  CLOSE_SEQUENCE_SUBSCRIPTION_EVENT_DATA_SCHEMA,
367
375
  ],
376
+ "close.smartView.created": [
377
+ "saved_search",
378
+ "created",
379
+ CLOSE_SMART_VIEW_EVENT_DATA_SCHEMA,
380
+ ],
381
+ "close.smartView.updated": [
382
+ "saved_search",
383
+ "updated",
384
+ CLOSE_SMART_VIEW_EVENT_DATA_SCHEMA,
385
+ ],
368
386
  "close.sms.received": [
369
387
  "activity.sms",
370
388
  "created",
@@ -408,6 +426,8 @@ export const CLOSE_SEMANTIC_EVENT_TYPES = [
408
426
  "close.sequenceSubscription.paused",
409
427
  "close.sequenceSubscription.resumed",
410
428
  "close.sequenceSubscription.updated",
429
+ "close.smartView.created",
430
+ "close.smartView.updated",
411
431
  "close.sms.received",
412
432
  "close.sms.sent",
413
433
  "close.task.completed",
@@ -415,6 +435,10 @@ export const CLOSE_SEMANTIC_EVENT_TYPES = [
415
435
  "close.task.deleted",
416
436
  "close.task.updated",
417
437
  ];
438
+ export const CLOSE_SMART_VIEW_MEMBERSHIP_EVENT_TYPES = [
439
+ "close.smartView.leadEntered",
440
+ "close.smartView.leadExited",
441
+ ];
418
442
  export const closeTriggerContracts = {
419
443
  "close.event": {
420
444
  configSchema: CLOSE_TRIGGER_CONFIG_SCHEMA,
@@ -451,6 +475,16 @@ export const closeTriggerContracts = {
451
475
  "close.sequenceSubscription.paused": semanticContract("sequence_subscription", "updated", CLOSE_SEQUENCE_SUBSCRIPTION_EVENT_DATA_SCHEMA),
452
476
  "close.sequenceSubscription.resumed": semanticContract("sequence_subscription", "updated", CLOSE_SEQUENCE_SUBSCRIPTION_EVENT_DATA_SCHEMA),
453
477
  "close.sequenceSubscription.updated": semanticContract("sequence_subscription", "updated", CLOSE_SEQUENCE_SUBSCRIPTION_EVENT_DATA_SCHEMA),
478
+ "close.smartView.created": semanticContract("saved_search", "created", CLOSE_SMART_VIEW_EVENT_DATA_SCHEMA),
479
+ "close.smartView.updated": semanticContract("saved_search", "updated", CLOSE_SMART_VIEW_EVENT_DATA_SCHEMA),
480
+ "close.smartView.leadEntered": {
481
+ configSchema: CLOSE_SMART_VIEW_MEMBERSHIP_TRIGGER_CONFIG_SCHEMA,
482
+ eventSchema: CLOSE_SMART_VIEW_MEMBERSHIP_EVENT_SCHEMA,
483
+ },
484
+ "close.smartView.leadExited": {
485
+ configSchema: CLOSE_SMART_VIEW_MEMBERSHIP_TRIGGER_CONFIG_SCHEMA,
486
+ eventSchema: CLOSE_SMART_VIEW_MEMBERSHIP_EVENT_SCHEMA,
487
+ },
454
488
  "close.sms.received": semanticContract("activity.sms", "created", CLOSE_SMS_EVENT_DATA_SCHEMA),
455
489
  "close.sms.sent": semanticContract("activity.sms", "sent", CLOSE_SMS_EVENT_DATA_SCHEMA),
456
490
  "close.task.completed": taskContract("completed", CLOSE_TASK_EVENT_DATA_SCHEMA),
@@ -85,6 +85,66 @@ export declare const CLOSE_CONTACT_SCHEMA: z.ZodObject<{
85
85
  url: z.ZodString;
86
86
  }, z.core.$strip>>>;
87
87
  }, z.core.$strip>;
88
+ export declare const CLOSE_SMART_VIEW_TYPE_SCHEMA: z.ZodEnum<{
89
+ email: "email";
90
+ lead: "lead";
91
+ contact: "contact";
92
+ opportunity: "opportunity";
93
+ call: "call";
94
+ sms: "sms";
95
+ meeting: "meeting";
96
+ note: "note";
97
+ whatsapp_message: "whatsapp_message";
98
+ custom_activity: "custom_activity";
99
+ form_submission: "form_submission";
100
+ }>;
101
+ export declare const CLOSE_SMART_VIEW_SHARING_SETTINGS_SCHEMA: z.ZodObject<{
102
+ createdAt: z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
103
+ createdById: z.ZodNullable<z.ZodString>;
104
+ groupIds: z.ZodArray<z.ZodString>;
105
+ updatedAt: z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
106
+ updatedById: z.ZodNullable<z.ZodString>;
107
+ userIds: z.ZodArray<z.ZodString>;
108
+ wholeOrg: z.ZodBoolean;
109
+ }, z.core.$strip>;
110
+ export declare const CLOSE_SMART_VIEW_SCHEMA: z.ZodObject<{
111
+ createdAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>;
112
+ description: z.ZodNullable<z.ZodString>;
113
+ id: z.ZodString;
114
+ isShared: z.ZodBoolean;
115
+ isUserDependent: z.ZodNullable<z.ZodBoolean>;
116
+ name: z.ZodString;
117
+ organizationId: z.ZodString;
118
+ query: z.ZodNullable<z.ZodString>;
119
+ selectedFields: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodCustom<Record<string, import("@automate.ax/codec").Encodable>, Record<string, import("@automate.ax/codec").Encodable>>>>>;
120
+ sharedWith: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
121
+ sharingSettings: z.ZodOptional<z.ZodNullable<z.ZodObject<{
122
+ createdAt: z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
123
+ createdById: z.ZodNullable<z.ZodString>;
124
+ groupIds: z.ZodArray<z.ZodString>;
125
+ updatedAt: z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>>;
126
+ updatedById: z.ZodNullable<z.ZodString>;
127
+ userIds: z.ZodArray<z.ZodString>;
128
+ wholeOrg: z.ZodBoolean;
129
+ }, z.core.$strip>>>;
130
+ sQuery: z.ZodNullable<z.ZodCustom<Record<string, import("@automate.ax/codec").Encodable>, Record<string, import("@automate.ax/codec").Encodable>>>;
131
+ type: z.ZodEnum<{
132
+ email: "email";
133
+ lead: "lead";
134
+ contact: "contact";
135
+ opportunity: "opportunity";
136
+ call: "call";
137
+ sms: "sms";
138
+ meeting: "meeting";
139
+ note: "note";
140
+ whatsapp_message: "whatsapp_message";
141
+ custom_activity: "custom_activity";
142
+ form_submission: "form_submission";
143
+ }>;
144
+ updatedAt: z.ZodPipe<z.ZodUnion<readonly [z.ZodDate, z.ZodString]>, z.ZodTransform<Date, string | Date>>;
145
+ userId: z.ZodNullable<z.ZodString>;
146
+ usedRecently: z.ZodOptional<z.ZodBoolean>;
147
+ }, z.core.$strip>;
88
148
  export declare const CLOSE_OPPORTUNITY_STATUS_TYPE_SCHEMA: z.ZodEnum<{
89
149
  active: "active";
90
150
  lost: "lost";
@@ -72,6 +72,46 @@ export const CLOSE_CONTACT_SCHEMA = z.object({
72
72
  updatedBy: z.string().nullable(),
73
73
  urls: CLOSE_CONTACT_URL_SCHEMA.array().prefault([]),
74
74
  });
75
+ export const CLOSE_SMART_VIEW_TYPE_SCHEMA = z.enum([
76
+ "lead",
77
+ "contact",
78
+ "opportunity",
79
+ "call",
80
+ "email",
81
+ "sms",
82
+ "meeting",
83
+ "note",
84
+ "whatsapp_message",
85
+ "custom_activity",
86
+ "form_submission",
87
+ ]);
88
+ export const CLOSE_SMART_VIEW_SHARING_SETTINGS_SCHEMA = z.object({
89
+ createdAt: DATE_SCHEMA.nullable(),
90
+ createdById: z.string().nullable(),
91
+ groupIds: z.string().array(),
92
+ updatedAt: DATE_SCHEMA.nullable(),
93
+ updatedById: z.string().nullable(),
94
+ userIds: z.string().array(),
95
+ wholeOrg: z.boolean(),
96
+ });
97
+ export const CLOSE_SMART_VIEW_SCHEMA = z.object({
98
+ createdAt: DATE_SCHEMA,
99
+ description: z.string().nullable(),
100
+ id: z.string(),
101
+ isShared: z.boolean(),
102
+ isUserDependent: z.boolean().nullable(),
103
+ name: z.string(),
104
+ organizationId: z.string(),
105
+ query: z.string().nullable(),
106
+ selectedFields: CLOSE_OBJECT_SCHEMA.array().nullable().optional(),
107
+ sharedWith: z.string().array().nullable().optional(),
108
+ sharingSettings: CLOSE_SMART_VIEW_SHARING_SETTINGS_SCHEMA.nullable().optional(),
109
+ sQuery: CLOSE_OBJECT_SCHEMA.nullable(),
110
+ type: CLOSE_SMART_VIEW_TYPE_SCHEMA,
111
+ updatedAt: DATE_SCHEMA,
112
+ userId: z.string().nullable(),
113
+ usedRecently: z.boolean().optional(),
114
+ });
75
115
  export const CLOSE_OPPORTUNITY_STATUS_TYPE_SCHEMA = z.enum([
76
116
  "active",
77
117
  "lost",
@@ -134,10 +134,10 @@ export declare const GRAPH_MEMBER_SCHEMA: z.ZodPipe<z.ZodObject<{
134
134
  }>>;
135
135
  export declare const TEAMS_CHAT_SCHEMA: z.ZodObject<{
136
136
  chatType: z.ZodEnum<{
137
+ meeting: "meeting";
137
138
  group: "group";
138
139
  unknownFutureValue: "unknownFutureValue";
139
140
  oneOnOne: "oneOnOne";
140
- meeting: "meeting";
141
141
  }>;
142
142
  createdAt: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodDate, z.ZodPipe<z.ZodISODateTime, z.ZodTransform<Date, string>>]>>>, z.ZodTransform<Date | undefined, Date | null | undefined>>;
143
143
  chatId: z.ZodString;
@@ -148,10 +148,10 @@ export declare const TEAMS_CHAT_SCHEMA: z.ZodObject<{
148
148
  }, z.core.$strip>;
149
149
  export declare const GRAPH_CHAT_SCHEMA: z.ZodPipe<z.ZodObject<{
150
150
  chatType: z.ZodEnum<{
151
+ meeting: "meeting";
151
152
  group: "group";
152
153
  unknownFutureValue: "unknownFutureValue";
153
154
  oneOnOne: "oneOnOne";
154
- meeting: "meeting";
155
155
  }>;
156
156
  createdDateTime: z.ZodOptional<z.ZodNullable<z.ZodString>>;
157
157
  id: z.ZodString;
@@ -160,7 +160,7 @@ export declare const GRAPH_CHAT_SCHEMA: z.ZodPipe<z.ZodObject<{
160
160
  topic: z.ZodOptional<z.ZodNullable<z.ZodString>>;
161
161
  webUrl: z.ZodOptional<z.ZodNullable<z.ZodString>>;
162
162
  }, z.core.$loose>, z.ZodTransform<{
163
- chatType: "group" | "unknownFutureValue" | "oneOnOne" | "meeting";
163
+ chatType: "meeting" | "group" | "unknownFutureValue" | "oneOnOne";
164
164
  createdAt: Date | undefined;
165
165
  chatId: string;
166
166
  updatedAt: Date | undefined;
@@ -169,7 +169,7 @@ export declare const GRAPH_CHAT_SCHEMA: z.ZodPipe<z.ZodObject<{
169
169
  webUrl: string | undefined;
170
170
  }, {
171
171
  [x: string]: unknown;
172
- chatType: "group" | "unknownFutureValue" | "oneOnOne" | "meeting";
172
+ chatType: "meeting" | "group" | "unknownFutureValue" | "oneOnOne";
173
173
  id: string;
174
174
  createdDateTime?: string | null | undefined;
175
175
  lastUpdatedDateTime?: string | null | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/integration-contracts",
3
- "version": "0.103.2",
3
+ "version": "0.104.0",
4
4
  "description": "Shared integration payload contracts and provider primitives for Automate.ax.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -49,7 +49,7 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
- "@automate.ax/codec": "0.103.2",
52
+ "@automate.ax/codec": "0.104.0",
53
53
  "@cfworker/json-schema": "^4.1.1",
54
54
  "@googleapis/calendar": "^15.0.0",
55
55
  "@googleapis/forms": "^6.0.1",
@@ -10,6 +10,7 @@ import {
10
10
  CLOSE_MEETING_SCHEMA,
11
11
  CLOSE_OPPORTUNITY_SCHEMA,
12
12
  CLOSE_SEQUENCE_SUBSCRIPTION_SCHEMA,
13
+ CLOSE_SMART_VIEW_SCHEMA,
13
14
  CLOSE_SMS_SCHEMA,
14
15
  CLOSE_TASK_SCHEMA,
15
16
  } from "./schemas"
@@ -228,6 +229,13 @@ export const CLOSE_WEBHOOK_PAYLOAD_SCHEMA = z.object({
228
229
  })
229
230
 
230
231
  export const CLOSE_TRIGGER_CONFIG_SCHEMA = z.object({})
232
+ export const CLOSE_SMART_VIEW_MEMBERSHIP_TRIGGER_CONFIG_SCHEMA = z.object({
233
+ smartViewId: z.string().startsWith("save_"),
234
+ })
235
+ export const CLOSE_SMART_VIEW_MEMBERSHIP_EVENT_SCHEMA = z.object({
236
+ leadId: z.string().startsWith("lead_"),
237
+ smartViewId: z.string().startsWith("save_"),
238
+ })
231
239
 
232
240
  // Event snapshots can omit fields that are required by the current REST
233
241
  // resource. Close's documented opportunity-won webhook is one such payload.
@@ -244,6 +252,7 @@ const CLOSE_MEETING_EVENT_DATA_SCHEMA = CLOSE_MEETING_SCHEMA.partial()
244
252
  const CLOSE_OPPORTUNITY_EVENT_DATA_SCHEMA = CLOSE_OPPORTUNITY_SCHEMA.partial()
245
253
  const CLOSE_SEQUENCE_SUBSCRIPTION_EVENT_DATA_SCHEMA =
246
254
  CLOSE_SEQUENCE_SUBSCRIPTION_SCHEMA.partial()
255
+ const CLOSE_SMART_VIEW_EVENT_DATA_SCHEMA = CLOSE_SMART_VIEW_SCHEMA.partial()
247
256
  const CLOSE_SMS_EVENT_DATA_SCHEMA = CLOSE_SMS_SCHEMA.partial()
248
257
  const CLOSE_DELETED_EVENT_DATA_SCHEMA = z.union([
249
258
  z.null(),
@@ -388,6 +397,16 @@ const SEMANTIC_EVENTS = {
388
397
  "updated",
389
398
  CLOSE_SEQUENCE_SUBSCRIPTION_EVENT_DATA_SCHEMA,
390
399
  ],
400
+ "close.smartView.created": [
401
+ "saved_search",
402
+ "created",
403
+ CLOSE_SMART_VIEW_EVENT_DATA_SCHEMA,
404
+ ],
405
+ "close.smartView.updated": [
406
+ "saved_search",
407
+ "updated",
408
+ CLOSE_SMART_VIEW_EVENT_DATA_SCHEMA,
409
+ ],
391
410
  "close.sms.received": [
392
411
  "activity.sms",
393
412
  "created",
@@ -432,6 +451,8 @@ export const CLOSE_SEMANTIC_EVENT_TYPES = [
432
451
  "close.sequenceSubscription.paused",
433
452
  "close.sequenceSubscription.resumed",
434
453
  "close.sequenceSubscription.updated",
454
+ "close.smartView.created",
455
+ "close.smartView.updated",
435
456
  "close.sms.received",
436
457
  "close.sms.sent",
437
458
  "close.task.completed",
@@ -440,6 +461,11 @@ export const CLOSE_SEMANTIC_EVENT_TYPES = [
440
461
  "close.task.updated",
441
462
  ] as const satisfies readonly (keyof typeof SEMANTIC_EVENTS)[]
442
463
 
464
+ export const CLOSE_SMART_VIEW_MEMBERSHIP_EVENT_TYPES = [
465
+ "close.smartView.leadEntered",
466
+ "close.smartView.leadExited",
467
+ ] as const
468
+
443
469
  export const closeTriggerContracts = {
444
470
  "close.event": {
445
471
  configSchema: CLOSE_TRIGGER_CONFIG_SCHEMA,
@@ -600,6 +626,24 @@ export const closeTriggerContracts = {
600
626
  "updated",
601
627
  CLOSE_SEQUENCE_SUBSCRIPTION_EVENT_DATA_SCHEMA,
602
628
  ),
629
+ "close.smartView.created": semanticContract(
630
+ "saved_search",
631
+ "created",
632
+ CLOSE_SMART_VIEW_EVENT_DATA_SCHEMA,
633
+ ),
634
+ "close.smartView.updated": semanticContract(
635
+ "saved_search",
636
+ "updated",
637
+ CLOSE_SMART_VIEW_EVENT_DATA_SCHEMA,
638
+ ),
639
+ "close.smartView.leadEntered": {
640
+ configSchema: CLOSE_SMART_VIEW_MEMBERSHIP_TRIGGER_CONFIG_SCHEMA,
641
+ eventSchema: CLOSE_SMART_VIEW_MEMBERSHIP_EVENT_SCHEMA,
642
+ },
643
+ "close.smartView.leadExited": {
644
+ configSchema: CLOSE_SMART_VIEW_MEMBERSHIP_TRIGGER_CONFIG_SCHEMA,
645
+ eventSchema: CLOSE_SMART_VIEW_MEMBERSHIP_EVENT_SCHEMA,
646
+ },
603
647
  "close.sms.received": semanticContract(
604
648
  "activity.sms",
605
649
  "created",
@@ -622,10 +666,7 @@ export const closeTriggerContracts = {
622
666
  "close.task.updated": taskContract("updated", CLOSE_TASK_EVENT_DATA_SCHEMA),
623
667
  } as const satisfies Record<
624
668
  string,
625
- {
626
- configSchema: typeof CLOSE_TRIGGER_CONFIG_SCHEMA
627
- eventSchema: z.ZodType
628
- }
669
+ { configSchema: z.ZodType; eventSchema: z.ZodType }
629
670
  >
630
671
 
631
672
  /**
@@ -80,6 +80,50 @@ export const CLOSE_CONTACT_SCHEMA = z.object({
80
80
  urls: CLOSE_CONTACT_URL_SCHEMA.array().prefault([]),
81
81
  })
82
82
 
83
+ export const CLOSE_SMART_VIEW_TYPE_SCHEMA = z.enum([
84
+ "lead",
85
+ "contact",
86
+ "opportunity",
87
+ "call",
88
+ "email",
89
+ "sms",
90
+ "meeting",
91
+ "note",
92
+ "whatsapp_message",
93
+ "custom_activity",
94
+ "form_submission",
95
+ ])
96
+
97
+ export const CLOSE_SMART_VIEW_SHARING_SETTINGS_SCHEMA = z.object({
98
+ createdAt: DATE_SCHEMA.nullable(),
99
+ createdById: z.string().nullable(),
100
+ groupIds: z.string().array(),
101
+ updatedAt: DATE_SCHEMA.nullable(),
102
+ updatedById: z.string().nullable(),
103
+ userIds: z.string().array(),
104
+ wholeOrg: z.boolean(),
105
+ })
106
+
107
+ export const CLOSE_SMART_VIEW_SCHEMA = z.object({
108
+ createdAt: DATE_SCHEMA,
109
+ description: z.string().nullable(),
110
+ id: z.string(),
111
+ isShared: z.boolean(),
112
+ isUserDependent: z.boolean().nullable(),
113
+ name: z.string(),
114
+ organizationId: z.string(),
115
+ query: z.string().nullable(),
116
+ selectedFields: CLOSE_OBJECT_SCHEMA.array().nullable().optional(),
117
+ sharedWith: z.string().array().nullable().optional(),
118
+ sharingSettings:
119
+ CLOSE_SMART_VIEW_SHARING_SETTINGS_SCHEMA.nullable().optional(),
120
+ sQuery: CLOSE_OBJECT_SCHEMA.nullable(),
121
+ type: CLOSE_SMART_VIEW_TYPE_SCHEMA,
122
+ updatedAt: DATE_SCHEMA,
123
+ userId: z.string().nullable(),
124
+ usedRecently: z.boolean().optional(),
125
+ })
126
+
83
127
  export const CLOSE_OPPORTUNITY_STATUS_TYPE_SCHEMA = z.enum([
84
128
  "active",
85
129
  "lost",