@livechat/developer-studio-api 5.12.0 → 6.1.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.
@@ -4092,7 +4092,8 @@ var textPlatformApi = {
4092
4092
  var urls8 = {
4093
4093
  listSchema: () => "/workflow_resources/schema",
4094
4094
  getSchema: (provider) => `/workflow_resources/schema/${provider}`,
4095
- getResource: (resource) => `/workflow_resources/resources/${[resource.provider, resource.domain, resource.name].filter(notEmpty).join("/")}`
4095
+ getResource: (resource) => `/workflow_resources/resources/${[resource.provider, resource.domain, resource.name].filter(notEmpty).join("/")}`,
4096
+ getResourceItem: (resource, id) => `${urls8.getResource(resource)}/${encodeURIComponent(id)}`
4096
4097
  };
4097
4098
  var textResourcerApi = {
4098
4099
  getResource(resource, credentialId, authorization) {
@@ -4114,6 +4115,25 @@ var textResourcerApi = {
4114
4115
  });
4115
4116
  });
4116
4117
  },
4118
+ getResourceItem(resource, credentialId, id, authorization) {
4119
+ return __async(this, null, function* () {
4120
+ const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4121
+ ensureAuthorizationToken: true
4122
+ }));
4123
+ return textClientInstance.get(urls8.getResourceItem(resource, id), __spreadProps(__spreadValues({}, config), {
4124
+ headers: __spreadProps(__spreadValues({}, config.headers), {
4125
+ "X-Credential-ID": credentialId
4126
+ })
4127
+ })).catch((error) => {
4128
+ if (error instanceof TextApiError) {
4129
+ throw error.withCustomMessage(
4130
+ `Couldn't get resourcer resource item. [${error.message}]`
4131
+ );
4132
+ }
4133
+ throw error;
4134
+ });
4135
+ });
4136
+ },
4117
4137
  createResource(resource, credentialId, payload, authorization) {
4118
4138
  return __async(this, null, function* () {
4119
4139
  const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
@@ -8569,30 +8589,31 @@ var segmentMembershipDataZod = customerMetadataZod.extend({
8569
8589
  membership_last_updated_at: z.string(),
8570
8590
  segment_fields: z.object({
8571
8591
  email: z.string().optional(),
8572
- customer_properties: z.record(z.unknown()).optional()
8573
- }).passthrough().optional()
8574
- }).passthrough();
8592
+ customer_properties: z.record(z.string(), z.unknown()).optional()
8593
+ }).loose().optional()
8594
+ }).loose();
8575
8595
  var cdpCustomerEventMessageZod = z.discriminatedUnion("type", [
8576
8596
  z.object({
8577
8597
  id: z.string(),
8578
8598
  type: z.literal("customer_email_set" /* EmailSet */),
8579
8599
  data: customerMetadataZod.extend({
8580
8600
  email: z.string()
8581
- }).passthrough()
8601
+ }).loose()
8582
8602
  }),
8583
8603
  z.object({
8584
8604
  id: z.string(),
8585
8605
  type: z.literal("customer_properties_values_updated" /* PropertiesValuesUpdated */),
8586
8606
  data: customerMetadataZod.extend({
8587
8607
  customer_properties: z.record(
8608
+ z.string(),
8588
8609
  z.object({
8589
8610
  value: z.unknown(),
8590
8611
  last_updated_at: z.string(),
8591
8612
  last_updated_agent_account_id: z.string().optional(),
8592
8613
  last_updated_agent_client_id: z.string().optional()
8593
- }).passthrough()
8614
+ }).loose()
8594
8615
  )
8595
- }).passthrough()
8616
+ }).loose()
8596
8617
  }),
8597
8618
  z.object({
8598
8619
  id: z.string(),
@@ -8865,9 +8886,9 @@ var integrationEventsCoreZods = {
8865
8886
  },
8866
8887
  get authorization() {
8867
8888
  return z6.object({
8868
- headers: z6.record(z6.string()).optional(),
8869
- query_params: z6.record(z6.string()).optional(),
8870
- data: z6.record(z6.string()).optional()
8889
+ headers: z6.record(z6.string(), z6.string()).optional(),
8890
+ query_params: z6.record(z6.string(), z6.string()).optional(),
8891
+ data: z6.record(z6.string(), z6.string()).optional()
8871
8892
  });
8872
8893
  },
8873
8894
  withCore(schema) {
@@ -8891,7 +8912,7 @@ var BigCommerceEventNames = /* @__PURE__ */ ((BigCommerceEventNames2) => {
8891
8912
  })(BigCommerceEventNames || {});
8892
8913
  var bigcommerceEventsZods = {
8893
8914
  provider: z7.literal("bigcommerce" /* BigCommerce */),
8894
- eventName: z7.nativeEnum(BigCommerceEventNames),
8915
+ eventName: z7.enum(BigCommerceEventNames),
8895
8916
  events: {
8896
8917
  cartCreated: integrationEventBase.extend({
8897
8918
  name: z7.literal("cart_created" /* CartCreated */)
@@ -8961,7 +8982,7 @@ var HubspotEventNames = /* @__PURE__ */ ((HubspotEventNames2) => {
8961
8982
  })(HubspotEventNames || {});
8962
8983
  var hubspotEventsZods = {
8963
8984
  provider: z8.literal("hubspot" /* HubSpot */),
8964
- eventName: z8.nativeEnum(HubspotEventNames),
8985
+ eventName: z8.enum(HubspotEventNames),
8965
8986
  events: {
8966
8987
  contactCreated: integrationEventBase.extend({
8967
8988
  name: z8.literal("contact_created" /* ContactCreated */)
@@ -9015,7 +9036,7 @@ var MailchimpEventNames = /* @__PURE__ */ ((MailchimpEventNames2) => {
9015
9036
  })(MailchimpEventNames || {});
9016
9037
  var mailchimpEventsZods = {
9017
9038
  provider: z9.literal("mailchimp" /* Mailchimp */),
9018
- eventName: z9.nativeEnum(MailchimpEventNames),
9039
+ eventName: z9.enum(MailchimpEventNames),
9019
9040
  events: {
9020
9041
  subscribed: integrationEventBase.extend({
9021
9042
  listId: z9.string(),
@@ -9073,7 +9094,7 @@ var ShopifyEventNames = /* @__PURE__ */ ((ShopifyEventNames2) => {
9073
9094
  })(ShopifyEventNames || {});
9074
9095
  var shopifyEventsZods = {
9075
9096
  provider: z10.literal("shopify" /* Shopify */),
9076
- eventName: z10.nativeEnum(ShopifyEventNames),
9097
+ eventName: z10.enum(ShopifyEventNames),
9077
9098
  events: {
9078
9099
  orderCreated: integrationEventBase.extend({
9079
9100
  name: z10.literal("order_created" /* OrderCreated */)
@@ -9124,7 +9145,7 @@ var SlackEventNames = /* @__PURE__ */ ((SlackEventNames2) => {
9124
9145
  })(SlackEventNames || {});
9125
9146
  var slackEventsZods = {
9126
9147
  provider: z11.literal("slack" /* Slack */),
9127
- eventName: z11.nativeEnum(SlackEventNames),
9148
+ eventName: z11.enum(SlackEventNames),
9128
9149
  events: {
9129
9150
  channelNewMessagePosted: integrationEventBase.extend({
9130
9151
  name: z11.literal("channel_new_message_posted" /* ChannelNewMessagePosted */),
@@ -9198,7 +9219,7 @@ var TextCustomerSegmentType = /* @__PURE__ */ ((TextCustomerSegmentType2) => {
9198
9219
  return TextCustomerSegmentType2;
9199
9220
  })(TextCustomerSegmentType || {});
9200
9221
  var textCustomerEventsZods = {
9201
- eventName: z12.nativeEnum(TextCustomerEventNames),
9222
+ eventName: z12.enum(TextCustomerEventNames),
9202
9223
  events: {
9203
9224
  emailSet: integrationEventBase.extend({
9204
9225
  name: z12.literal("customer_email_set" /* EmailSet */),
@@ -9215,11 +9236,11 @@ var textCustomerEventsZods = {
9215
9236
  }),
9216
9237
  segmentAdded: integrationEventBase.extend({
9217
9238
  name: z12.literal("segment_added" /* SegmentAdded */),
9218
- segment_type: z12.nativeEnum(TextCustomerSegmentType)
9239
+ segment_type: z12.enum(TextCustomerSegmentType)
9219
9240
  }),
9220
9241
  segmentRemoved: integrationEventBase.extend({
9221
9242
  name: z12.literal("segment_removed" /* SegmentRemoved */),
9222
- segment_type: z12.nativeEnum(TextCustomerSegmentType)
9243
+ segment_type: z12.enum(TextCustomerSegmentType)
9223
9244
  })
9224
9245
  },
9225
9246
  get event() {
@@ -9273,7 +9294,7 @@ var baseFiltersZod = z13.object({
9273
9294
  });
9274
9295
  var textHelpDeskEventsZods = {
9275
9296
  provider: z13.literal("text-helpdesk" /* HelpDesk */),
9276
- eventName: z13.nativeEnum(TextHelpDeskEventNames),
9297
+ eventName: z13.enum(TextHelpDeskEventNames),
9277
9298
  events: {
9278
9299
  ticketCreated: integrationEventBase.extend({
9279
9300
  name: z13.literal("ticket_created" /* TicketCreated */)
@@ -9284,15 +9305,15 @@ var textHelpDeskEventsZods = {
9284
9305
  ticketStatusChanged: integrationEventBase.extend({
9285
9306
  name: z13.literal("ticket_status_changed" /* TicketStatusChanged */),
9286
9307
  status: z13.object({
9287
- from: z13.array(z13.nativeEnum(TicketStatus)).optional(),
9288
- to: z13.array(z13.nativeEnum(TicketStatus)).optional()
9308
+ from: z13.array(z13.enum(TicketStatus)).optional(),
9309
+ to: z13.array(z13.enum(TicketStatus)).optional()
9289
9310
  }).optional()
9290
9311
  }).extend(baseFiltersZod.shape),
9291
9312
  ticketPriorityChanged: integrationEventBase.extend({
9292
9313
  name: z13.literal("ticket_priority_changed" /* TicketPriorityChanged */),
9293
9314
  priority: z13.object({
9294
- from: z13.array(z13.nativeEnum(TicketPriority)).optional(),
9295
- to: z13.array(z13.nativeEnum(TicketPriority)).optional()
9315
+ from: z13.array(z13.enum(TicketPriority)).optional(),
9316
+ to: z13.array(z13.enum(TicketPriority)).optional()
9296
9317
  }).optional()
9297
9318
  }).extend(baseFiltersZod.shape),
9298
9319
  ticketTagsChanged: integrationEventBase.extend({
@@ -9421,7 +9442,7 @@ var livechatEventContext = z14.object({
9421
9442
  });
9422
9443
  var textLivechatEventsZods = {
9423
9444
  provider: z14.literal("text-livechat" /* LiveChat */),
9424
- eventName: z14.nativeEnum(TextLivechatEventNames),
9445
+ eventName: z14.enum(TextLivechatEventNames),
9425
9446
  events: {
9426
9447
  chatStarted: integrationEventBase.extend(livechatChatContext.shape).extend({
9427
9448
  name: z14.literal("chat_started" /* ChatStarted */),
@@ -9472,14 +9493,14 @@ var textLivechatEventsZods = {
9472
9493
  }),
9473
9494
  customerLeftChat: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
9474
9495
  name: z14.literal("customer_left_chat" /* CustomerLeftChat */),
9475
- reasons: z14.array(z14.nativeEnum(CustomerLeftChatReason)).optional()
9496
+ reasons: z14.array(z14.enum(CustomerLeftChatReason)).optional()
9476
9497
  }),
9477
9498
  chatIdle: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
9478
9499
  name: z14.literal("chat_idle" /* ChatIdle */)
9479
9500
  }),
9480
9501
  productCardEvent: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({
9481
9502
  name: z14.literal("product_card_event" /* ProductCardEvent */),
9482
- type: z14.nativeEnum(TextLivechatProductCardEventType),
9503
+ type: z14.enum(TextLivechatProductCardEventType),
9483
9504
  product_id: z14.string().optional()
9484
9505
  }),
9485
9506
  richMessagePostback: integrationEventBase.extend(livechatEventContext.shape).extend(livechatChatContext.shape).extend({