@livechat/developer-studio-api 5.11.2 → 6.0.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.
@@ -1319,30 +1319,31 @@ var segmentMembershipDataZod = customerMetadataZod.extend({
1319
1319
  membership_last_updated_at: import_zod.z.string(),
1320
1320
  segment_fields: import_zod.z.object({
1321
1321
  email: import_zod.z.string().optional(),
1322
- customer_properties: import_zod.z.record(import_zod.z.unknown()).optional()
1323
- }).passthrough().optional()
1324
- }).passthrough();
1322
+ customer_properties: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional()
1323
+ }).loose().optional()
1324
+ }).loose();
1325
1325
  var cdpCustomerEventMessageZod = import_zod.z.discriminatedUnion("type", [
1326
1326
  import_zod.z.object({
1327
1327
  id: import_zod.z.string(),
1328
1328
  type: import_zod.z.literal("customer_email_set" /* EmailSet */),
1329
1329
  data: customerMetadataZod.extend({
1330
1330
  email: import_zod.z.string()
1331
- }).passthrough()
1331
+ }).loose()
1332
1332
  }),
1333
1333
  import_zod.z.object({
1334
1334
  id: import_zod.z.string(),
1335
1335
  type: import_zod.z.literal("customer_properties_values_updated" /* PropertiesValuesUpdated */),
1336
1336
  data: customerMetadataZod.extend({
1337
1337
  customer_properties: import_zod.z.record(
1338
+ import_zod.z.string(),
1338
1339
  import_zod.z.object({
1339
1340
  value: import_zod.z.unknown(),
1340
1341
  last_updated_at: import_zod.z.string(),
1341
1342
  last_updated_agent_account_id: import_zod.z.string().optional(),
1342
1343
  last_updated_agent_client_id: import_zod.z.string().optional()
1343
- }).passthrough()
1344
+ }).loose()
1344
1345
  )
1345
- }).passthrough()
1346
+ }).loose()
1346
1347
  }),
1347
1348
  import_zod.z.object({
1348
1349
  id: import_zod.z.string(),
@@ -1558,9 +1559,9 @@ var integrationEventsCoreZods = {
1558
1559
  },
1559
1560
  get authorization() {
1560
1561
  return import_zod6.z.object({
1561
- headers: import_zod6.z.record(import_zod6.z.string()).optional(),
1562
- query_params: import_zod6.z.record(import_zod6.z.string()).optional(),
1563
- data: import_zod6.z.record(import_zod6.z.string()).optional()
1562
+ headers: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string()).optional(),
1563
+ query_params: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string()).optional(),
1564
+ data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.string()).optional()
1564
1565
  });
1565
1566
  },
1566
1567
  withCore(schema) {
@@ -1584,7 +1585,7 @@ var BigCommerceEventNames = /* @__PURE__ */ ((BigCommerceEventNames2) => {
1584
1585
  })(BigCommerceEventNames || {});
1585
1586
  var bigcommerceEventsZods = {
1586
1587
  provider: import_zod7.z.literal("bigcommerce" /* BigCommerce */),
1587
- eventName: import_zod7.z.nativeEnum(BigCommerceEventNames),
1588
+ eventName: import_zod7.z.enum(BigCommerceEventNames),
1588
1589
  events: {
1589
1590
  cartCreated: integrationEventBase.extend({
1590
1591
  name: import_zod7.z.literal("cart_created" /* CartCreated */)
@@ -1654,7 +1655,7 @@ var HubspotEventNames = /* @__PURE__ */ ((HubspotEventNames2) => {
1654
1655
  })(HubspotEventNames || {});
1655
1656
  var hubspotEventsZods = {
1656
1657
  provider: import_zod8.z.literal("hubspot" /* HubSpot */),
1657
- eventName: import_zod8.z.nativeEnum(HubspotEventNames),
1658
+ eventName: import_zod8.z.enum(HubspotEventNames),
1658
1659
  events: {
1659
1660
  contactCreated: integrationEventBase.extend({
1660
1661
  name: import_zod8.z.literal("contact_created" /* ContactCreated */)
@@ -1708,7 +1709,7 @@ var MailchimpEventNames = /* @__PURE__ */ ((MailchimpEventNames2) => {
1708
1709
  })(MailchimpEventNames || {});
1709
1710
  var mailchimpEventsZods = {
1710
1711
  provider: import_zod9.z.literal("mailchimp" /* Mailchimp */),
1711
- eventName: import_zod9.z.nativeEnum(MailchimpEventNames),
1712
+ eventName: import_zod9.z.enum(MailchimpEventNames),
1712
1713
  events: {
1713
1714
  subscribed: integrationEventBase.extend({
1714
1715
  listId: import_zod9.z.string(),
@@ -1766,7 +1767,7 @@ var ShopifyEventNames = /* @__PURE__ */ ((ShopifyEventNames2) => {
1766
1767
  })(ShopifyEventNames || {});
1767
1768
  var shopifyEventsZods = {
1768
1769
  provider: import_zod10.z.literal("shopify" /* Shopify */),
1769
- eventName: import_zod10.z.nativeEnum(ShopifyEventNames),
1770
+ eventName: import_zod10.z.enum(ShopifyEventNames),
1770
1771
  events: {
1771
1772
  orderCreated: integrationEventBase.extend({
1772
1773
  name: import_zod10.z.literal("order_created" /* OrderCreated */)
@@ -1817,7 +1818,7 @@ var SlackEventNames = /* @__PURE__ */ ((SlackEventNames2) => {
1817
1818
  })(SlackEventNames || {});
1818
1819
  var slackEventsZods = {
1819
1820
  provider: import_zod11.z.literal("slack" /* Slack */),
1820
- eventName: import_zod11.z.nativeEnum(SlackEventNames),
1821
+ eventName: import_zod11.z.enum(SlackEventNames),
1821
1822
  events: {
1822
1823
  channelNewMessagePosted: integrationEventBase.extend({
1823
1824
  name: import_zod11.z.literal("channel_new_message_posted" /* ChannelNewMessagePosted */),
@@ -1891,7 +1892,7 @@ var TextCustomerSegmentType = /* @__PURE__ */ ((TextCustomerSegmentType2) => {
1891
1892
  return TextCustomerSegmentType2;
1892
1893
  })(TextCustomerSegmentType || {});
1893
1894
  var textCustomerEventsZods = {
1894
- eventName: import_zod12.z.nativeEnum(TextCustomerEventNames),
1895
+ eventName: import_zod12.z.enum(TextCustomerEventNames),
1895
1896
  events: {
1896
1897
  emailSet: integrationEventBase.extend({
1897
1898
  name: import_zod12.z.literal("customer_email_set" /* EmailSet */),
@@ -1908,11 +1909,11 @@ var textCustomerEventsZods = {
1908
1909
  }),
1909
1910
  segmentAdded: integrationEventBase.extend({
1910
1911
  name: import_zod12.z.literal("segment_added" /* SegmentAdded */),
1911
- segment_type: import_zod12.z.nativeEnum(TextCustomerSegmentType)
1912
+ segment_type: import_zod12.z.enum(TextCustomerSegmentType)
1912
1913
  }),
1913
1914
  segmentRemoved: integrationEventBase.extend({
1914
1915
  name: import_zod12.z.literal("segment_removed" /* SegmentRemoved */),
1915
- segment_type: import_zod12.z.nativeEnum(TextCustomerSegmentType)
1916
+ segment_type: import_zod12.z.enum(TextCustomerSegmentType)
1916
1917
  })
1917
1918
  },
1918
1919
  get event() {
@@ -1966,7 +1967,7 @@ var baseFiltersZod = import_zod13.z.object({
1966
1967
  });
1967
1968
  var textHelpDeskEventsZods = {
1968
1969
  provider: import_zod13.z.literal("text-helpdesk" /* HelpDesk */),
1969
- eventName: import_zod13.z.nativeEnum(TextHelpDeskEventNames),
1970
+ eventName: import_zod13.z.enum(TextHelpDeskEventNames),
1970
1971
  events: {
1971
1972
  ticketCreated: integrationEventBase.extend({
1972
1973
  name: import_zod13.z.literal("ticket_created" /* TicketCreated */)
@@ -1977,15 +1978,15 @@ var textHelpDeskEventsZods = {
1977
1978
  ticketStatusChanged: integrationEventBase.extend({
1978
1979
  name: import_zod13.z.literal("ticket_status_changed" /* TicketStatusChanged */),
1979
1980
  status: import_zod13.z.object({
1980
- from: import_zod13.z.array(import_zod13.z.nativeEnum(TicketStatus)).optional(),
1981
- to: import_zod13.z.array(import_zod13.z.nativeEnum(TicketStatus)).optional()
1981
+ from: import_zod13.z.array(import_zod13.z.enum(TicketStatus)).optional(),
1982
+ to: import_zod13.z.array(import_zod13.z.enum(TicketStatus)).optional()
1982
1983
  }).optional()
1983
1984
  }).extend(baseFiltersZod.shape),
1984
1985
  ticketPriorityChanged: integrationEventBase.extend({
1985
1986
  name: import_zod13.z.literal("ticket_priority_changed" /* TicketPriorityChanged */),
1986
1987
  priority: import_zod13.z.object({
1987
- from: import_zod13.z.array(import_zod13.z.nativeEnum(TicketPriority)).optional(),
1988
- to: import_zod13.z.array(import_zod13.z.nativeEnum(TicketPriority)).optional()
1988
+ from: import_zod13.z.array(import_zod13.z.enum(TicketPriority)).optional(),
1989
+ to: import_zod13.z.array(import_zod13.z.enum(TicketPriority)).optional()
1989
1990
  }).optional()
1990
1991
  }).extend(baseFiltersZod.shape),
1991
1992
  ticketTagsChanged: integrationEventBase.extend({
@@ -2018,7 +2019,7 @@ var textHelpDeskEventsZods = {
2018
2019
  ticketMessageAdded: import_zod13.z.discriminatedUnion("version", [
2019
2020
  import_zod13.z.object({
2020
2021
  name: import_zod13.z.literal("ticket_message_added" /* TicketMessageAdded */),
2021
- version: import_zod13.z.undefined()
2022
+ version: import_zod13.z.literal("v0").optional()
2022
2023
  }).extend(baseFiltersZod.shape),
2023
2024
  import_zod13.z.object({
2024
2025
  name: import_zod13.z.literal("ticket_message_added" /* TicketMessageAdded */),
@@ -2089,6 +2090,7 @@ var TextLivechatEventNames = /* @__PURE__ */ ((TextLivechatEventNames2) => {
2089
2090
  TextLivechatEventNames2["CustomerLeftChat"] = "customer_left_chat";
2090
2091
  TextLivechatEventNames2["ChatIdle"] = "chat_idle";
2091
2092
  TextLivechatEventNames2["ProductCardEvent"] = "product_card_event";
2093
+ TextLivechatEventNames2["RichMessagePostback"] = "rich_message_postback";
2092
2094
  TextLivechatEventNames2["FormFilled"] = "form_filled";
2093
2095
  TextLivechatEventNames2["CustomFormFilled"] = "custom_form_filled";
2094
2096
  return TextLivechatEventNames2;
@@ -2104,42 +2106,49 @@ var TextLivechatProductCardEventType = /* @__PURE__ */ ((TextLivechatProductCard
2104
2106
  TextLivechatProductCardEventType2["AddToCart"] = "add_to_cart";
2105
2107
  return TextLivechatProductCardEventType2;
2106
2108
  })(TextLivechatProductCardEventType || {});
2109
+ var livechatChatContext = import_zod14.z.object({
2110
+ chat_id: import_zod14.z.string().min(1).optional(),
2111
+ thread_id: import_zod14.z.string().min(1).optional()
2112
+ });
2113
+ var livechatEventContext = import_zod14.z.object({
2114
+ event_id: import_zod14.z.string().min(1).optional()
2115
+ });
2107
2116
  var textLivechatEventsZods = {
2108
2117
  provider: import_zod14.z.literal("text-livechat" /* LiveChat */),
2109
- eventName: import_zod14.z.nativeEnum(TextLivechatEventNames),
2118
+ eventName: import_zod14.z.enum(TextLivechatEventNames),
2110
2119
  events: {
2111
- chatStarted: integrationEventBase.extend({
2120
+ chatStarted: integrationEventBase.extend(livechatChatContext.shape).extend({
2112
2121
  name: import_zod14.z.literal("chat_started" /* ChatStarted */),
2113
2122
  targetAgentId: import_zod14.z.string().optional()
2114
2123
  }),
2115
- chatEnded: integrationEventBase.extend({
2124
+ chatEnded: integrationEventBase.extend(livechatChatContext.shape).extend({
2116
2125
  name: import_zod14.z.literal("chat_ended" /* ChatEnded */)
2117
2126
  }),
2118
- chatTransferred: integrationEventBase.extend({
2127
+ chatTransferred: integrationEventBase.extend(livechatChatContext.shape).extend({
2119
2128
  name: import_zod14.z.literal("chat_transferred" /* ChatTransferred */),
2120
2129
  targetGroups: import_zod14.z.array(import_zod14.z.number()).optional(),
2121
2130
  targetAgents: import_zod14.z.array(import_zod14.z.string()).optional()
2122
2131
  }),
2123
- chatTagged: integrationEventBase.extend({
2132
+ chatTagged: integrationEventBase.extend(livechatChatContext.shape).extend({
2124
2133
  name: import_zod14.z.literal("chat_tagged" /* ChatTagged */),
2125
2134
  tag: import_zod14.z.string().optional()
2126
2135
  }),
2127
- chatRated: integrationEventBase.extend({
2136
+ chatRated: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
2128
2137
  name: import_zod14.z.literal("chat_rated" /* ChatRated */),
2129
2138
  rating: import_zod14.z.enum(["good", "bad", "all"]).optional()
2130
2139
  }),
2131
- chatCommented: integrationEventBase.extend({
2140
+ chatCommented: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
2132
2141
  name: import_zod14.z.literal("chat_commented" /* ChatCommented */)
2133
2142
  }),
2134
2143
  chatMessage: import_zod14.z.discriminatedUnion("version", [
2135
- import_zod14.z.object({
2144
+ integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
2136
2145
  name: import_zod14.z.literal("chat_message" /* ChatMessage */),
2137
- version: import_zod14.z.undefined(),
2146
+ version: import_zod14.z.literal("v0").optional(),
2138
2147
  filter: import_zod14.z.string().optional(),
2139
2148
  caseInsensitive: import_zod14.z.boolean().optional(),
2140
2149
  matchWholeWords: import_zod14.z.boolean().optional()
2141
2150
  }),
2142
- import_zod14.z.object({
2151
+ integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
2143
2152
  name: import_zod14.z.literal("chat_message" /* ChatMessage */),
2144
2153
  version: import_zod14.z.enum(["v1", "v2"]),
2145
2154
  filters: import_zod14.z.array(import_zod14.z.string()),
@@ -2147,31 +2156,42 @@ var textLivechatEventsZods = {
2147
2156
  matchWholeWords: import_zod14.z.boolean().optional()
2148
2157
  })
2149
2158
  ]),
2150
- userAddedToChat: integrationEventBase.extend({
2159
+ userAddedToChat: integrationEventBase.extend(livechatChatContext.shape).extend({
2151
2160
  name: import_zod14.z.literal("user_added_to_chat" /* UserAddedToChat */),
2152
2161
  userType: import_zod14.z.enum(["agent", "customer"]).optional(),
2153
2162
  targetAgentId: import_zod14.z.string().optional()
2154
2163
  }),
2155
- userRemovedFromChat: integrationEventBase.extend({
2164
+ userRemovedFromChat: integrationEventBase.extend(livechatChatContext.shape).extend({
2156
2165
  name: import_zod14.z.literal("user_removed_from_chat" /* UserRemovedFromChat */)
2157
2166
  }),
2158
- customerLeftChat: integrationEventBase.extend({
2167
+ customerLeftChat: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
2159
2168
  name: import_zod14.z.literal("customer_left_chat" /* CustomerLeftChat */),
2160
- reasons: import_zod14.z.array(import_zod14.z.nativeEnum(CustomerLeftChatReason)).optional()
2169
+ reasons: import_zod14.z.array(import_zod14.z.enum(CustomerLeftChatReason)).optional()
2161
2170
  }),
2162
- chatIdle: integrationEventBase.extend({
2171
+ chatIdle: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
2163
2172
  name: import_zod14.z.literal("chat_idle" /* ChatIdle */)
2164
2173
  }),
2165
- productCardEvent: integrationEventBase.extend({
2174
+ productCardEvent: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
2166
2175
  name: import_zod14.z.literal("product_card_event" /* ProductCardEvent */),
2167
- type: import_zod14.z.nativeEnum(TextLivechatProductCardEventType),
2176
+ type: import_zod14.z.enum(TextLivechatProductCardEventType),
2168
2177
  product_id: import_zod14.z.string().optional()
2169
2178
  }),
2170
- formFilled: integrationEventBase.extend({
2179
+ richMessagePostback: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
2180
+ name: import_zod14.z.literal("rich_message_postback" /* RichMessagePostback */),
2181
+ postbacks: import_zod14.z.union([
2182
+ import_zod14.z.array(import_zod14.z.string().min(1)),
2183
+ import_zod14.z.record(import_zod14.z.string().min(1), import_zod14.z.string().min(1))
2184
+ ]).refine((input) => {
2185
+ const ids = Array.isArray(input) ? input : Object.values(input);
2186
+ return ids.length > 0 && new Set(ids).size === ids.length;
2187
+ }, "Postbacks must be nonempty and IDs must be unique"),
2188
+ user_ids: import_zod14.z.array(import_zod14.z.string().min(1)).min(1).optional()
2189
+ }),
2190
+ formFilled: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
2171
2191
  name: import_zod14.z.literal("form_filled" /* FormFilled */),
2172
2192
  form_id: import_zod14.z.string().optional()
2173
2193
  }),
2174
- customFormFilled: integrationEventBase.extend({
2194
+ customFormFilled: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
2175
2195
  name: import_zod14.z.literal("custom_form_filled" /* CustomFormFilled */),
2176
2196
  form_id: import_zod14.z.string().optional()
2177
2197
  })
@@ -2190,6 +2210,7 @@ var textLivechatEventsZods = {
2190
2210
  this.events.customerLeftChat,
2191
2211
  this.events.chatIdle,
2192
2212
  this.events.productCardEvent,
2213
+ this.events.richMessagePostback,
2193
2214
  this.events.formFilled,
2194
2215
  this.events.customFormFilled
2195
2216
  ]);
@@ -29,7 +29,7 @@ import {
29
29
  isFilterGroup,
30
30
  isWorkflowBaseHttpTaskCore,
31
31
  serializeFilters
32
- } from "./chunk-3I7N2WOU.mjs";
32
+ } from "./chunk-OA7BKSZP.mjs";
33
33
  export {
34
34
  CredentialStatus,
35
35
  CredentialType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/developer-studio-api",
3
- "version": "5.11.2",
3
+ "version": "6.0.0",
4
4
  "description": "This project is API for LiveChat Developer Studio.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "axios": "^1.20.0",
29
29
  "json-schema": "^0.4.0",
30
30
  "shopify-api-node": "^3.13.1",
31
- "zod": "^3.23.8"
31
+ "zod": "^4.3.6"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/json-schema": "^7.0.15",
@@ -36,9 +36,9 @@
36
36
  "eslint": "^9.39.1",
37
37
  "tsup": "^8.5.1",
38
38
  "typescript": "^5.1.6",
39
- "tsconfig": "0.2.1",
40
39
  "eslint-config-custom": "0.0.15",
41
- "utils": "0.3.5"
40
+ "utils": "0.4.0",
41
+ "tsconfig": "0.2.1"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsup",